Se agrego boton de eliminar venta,venta especial y cancelacion
This commit is contained in:
@@ -71,6 +71,16 @@ class CancelacionController extends Component
|
||||
$this->closeModal();
|
||||
}
|
||||
|
||||
public function delete(Movimiento $venta)
|
||||
{
|
||||
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$venta->delete();
|
||||
session()->flash('message',"La cancelacion se ha eliminado del sistema.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
{
|
||||
|
||||
@@ -102,6 +102,16 @@ class VentaController extends Component
|
||||
$this->closeModal();
|
||||
}
|
||||
|
||||
public function delete(Movimiento $venta)
|
||||
{
|
||||
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$venta->delete();
|
||||
session()->flash('message',"La venta se ha eliminado del sistema.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ class VentaEspecialController extends Component
|
||||
$this->ventaEspecial->user_id = Auth::user()->id;
|
||||
$this->ventaEspecial->save();
|
||||
|
||||
session()->flash('message',"La venta se ha registrado correctamente!");
|
||||
session()->flash('message',"La venta especial se ha registrado correctamente!");
|
||||
|
||||
$this->clearInputs();
|
||||
$this->closeModal();
|
||||
@@ -156,6 +156,16 @@ class VentaEspecialController extends Component
|
||||
$this->closeModalLiquidar();
|
||||
}
|
||||
|
||||
public function delete(Movimiento $venta)
|
||||
{
|
||||
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$venta->delete();
|
||||
session()->flash('message',"La venta especial se ha eliminado del sistema.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<th>Motivo</th>
|
||||
<th>Registrado por</th>
|
||||
<th>Fecha</th>
|
||||
@role('admin')<th>Acciones</th>@endrole
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -43,7 +44,7 @@
|
||||
<th>{{$cancelacion->motivo}}</th>
|
||||
<th>{{$cancelacion->user->name}}</th>
|
||||
<th>{{$cancelacion->created_at}}</th>
|
||||
|
||||
@role('admin') <th><button wire:click="delete({{ $venta->id }})" class="btn btn-sm btn-error">Eliminar</button></th> @endrole
|
||||
</tr>
|
||||
@empty
|
||||
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
@else
|
||||
<button wire:click="liquidar({{ $venta->id }})" class="btn btn-sm btn-secondary">Liquidar</button>
|
||||
@endif
|
||||
@role('admin') <button wire:click="delete({{ $venta->id }})" class="btn btn-sm btn-error">Eliminar</button> @endrole
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<th>Total Venta</th>
|
||||
<th>Registrado por</th>
|
||||
<th>Fecha</th>
|
||||
@role('admin')<th>Acciones</th>@endrole
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -48,6 +49,7 @@
|
||||
<th>{{ $venta->precio_venta }}</th>
|
||||
<th>{{ $venta->user->name }}</th>
|
||||
<th>{{ $venta->created_at }}</th>
|
||||
@role('admin') <th><button wire:click="delete({{ $venta->id }})" class="btn btn-sm btn-error">Eliminar</button></th> @endrole
|
||||
</tr>
|
||||
@empty
|
||||
{{$ventas->links()}}
|
||||
|
||||
Reference in New Issue
Block a user