Implementacion de modulo de pedidos
This commit is contained in:
@@ -12,9 +12,9 @@ class CancelacionController extends Component
|
||||
use WithPagination;
|
||||
|
||||
const CODIGO_CANCELACION = 3;
|
||||
public $buscador = '' , $modal = false;
|
||||
public $buscador = '' , $modal = false, $modalDate = false;
|
||||
|
||||
public $cancelacion;
|
||||
public $cancelacion, $created_at;
|
||||
|
||||
protected $rules = [
|
||||
'cancelacion.codigo' => 'min:0',
|
||||
@@ -71,6 +71,26 @@ class CancelacionController extends Component
|
||||
$this->closeModal();
|
||||
}
|
||||
|
||||
public function editDate(Movimiento $movimiento)
|
||||
{
|
||||
$this->cancelacion = $movimiento;
|
||||
$this->showModal('modalDate');
|
||||
}
|
||||
|
||||
public function saveDate()
|
||||
{
|
||||
$this->validate([
|
||||
'created_at' => 'required',
|
||||
]);
|
||||
|
||||
$this->cancelacion->created_at = $this->created_at;
|
||||
$this->cancelacion->save();
|
||||
session()->flash('message',"La fecha ha sido cambiada correctamente.");
|
||||
|
||||
$this->clearInputs();
|
||||
$this->closeModal('modalDate');
|
||||
}
|
||||
|
||||
public function delete(Movimiento $venta)
|
||||
{
|
||||
|
||||
@@ -82,14 +102,14 @@ class CancelacionController extends Component
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
public function showModal($modal = "modal")
|
||||
{
|
||||
$this->modal = true;
|
||||
$this->{$modal} = true;
|
||||
}
|
||||
|
||||
public function closeModal()
|
||||
public function closeModal($modal = "modal")
|
||||
{
|
||||
$this->modal = false;
|
||||
$this->{$modal} = false;
|
||||
}
|
||||
|
||||
public function clearInputs()
|
||||
|
||||
@@ -58,7 +58,11 @@ class DashboardController extends Component
|
||||
Movimiento::where([
|
||||
['estado_movimiento_id','=', $tipo_movimiento],
|
||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
||||
])->sum('pago_vales');
|
||||
])->sum('pago_vales') +
|
||||
Movimiento::where([
|
||||
['estado_movimiento_id','=', $tipo_movimiento],
|
||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
||||
])->sum('pago_transferencia');
|
||||
}
|
||||
|
||||
public function validarCaja()
|
||||
|
||||
102
app/Http/Livewire/ImpresoraController.php
Normal file
102
app/Http/Livewire/ImpresoraController.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Impresora;
|
||||
use App\Models\User;
|
||||
use App\Printer\PrinterHandler;
|
||||
use Livewire\Component;
|
||||
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
||||
use Mike42\Escpos\Printer;
|
||||
|
||||
class ImpresoraController extends Component
|
||||
{
|
||||
public $impresora, $impresoraUser;
|
||||
public $modal = false;
|
||||
|
||||
protected $rules = [
|
||||
'impresora.estacion' => 'required',
|
||||
'impresora.nombre_impresora' => 'required',
|
||||
'impresora.is_compartida' => 'required'
|
||||
];
|
||||
public function render()
|
||||
{
|
||||
$impresoraUser = auth()->user()->impresora_id;
|
||||
return view('impresora.impresora',[
|
||||
'impresoras' => Impresora::paginate(10),
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->impresora = new Impresora();
|
||||
$this->impresora->is_compartida = false;
|
||||
$this->openModal();
|
||||
}
|
||||
|
||||
public function saveImpresora()
|
||||
{
|
||||
$user = User::findOrFail(auth()->user()->id);
|
||||
|
||||
$user->impresora_id = $this->impresoraUser;
|
||||
$user->save();
|
||||
session()->flash('messageImpresora','Impresora vinculada correctamente.');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
'impresora.estacion' => 'required',
|
||||
]);
|
||||
|
||||
if($this->impresora->is_compartida)
|
||||
{
|
||||
$this->validate([
|
||||
'impresora.nombre_impresora' => 'required'
|
||||
]);
|
||||
}
|
||||
else if(!is_numeric($this->impresora->nombre_impresora))
|
||||
{
|
||||
$this->impresora->nombre_impresora = 9100;
|
||||
}
|
||||
|
||||
$this->impresora->save();
|
||||
|
||||
session()->flash('message','La impresora se guardo correctamente.');
|
||||
$this->closeModal();
|
||||
$this->clearInputs();
|
||||
}
|
||||
|
||||
public function imprimir(Impresora $impresora)
|
||||
{
|
||||
try {
|
||||
$printer = new PrinterHandler($impresora, $impresora->is_compartida?PrinterHandler::PRINTER_BY_SHARED:PrinterHandler::PRINTER_BY_IP);
|
||||
// 32 caracteres
|
||||
$printer->testPage();
|
||||
|
||||
session()->flash('message','Impresion enviada a: '.'smb://'.$impresora->estacion.'/'.$impresora->nombre_impresora);
|
||||
} catch (\Throwable $th) {
|
||||
session()->flash('error','No se pudo establecer conexión con la impresora, verifica configuración.'.$th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Impresora $impresora)
|
||||
{
|
||||
$impresora->delete();
|
||||
session()->flash('message','La impresora se ha eliminado correctamente.');
|
||||
}
|
||||
public function openModal()
|
||||
{
|
||||
$this->modal = true;
|
||||
}
|
||||
|
||||
public function closeModal()
|
||||
{
|
||||
$this->modal = false;
|
||||
}
|
||||
|
||||
public function clearInputs()
|
||||
{
|
||||
$this->reset();
|
||||
}
|
||||
}
|
||||
410
app/Http/Livewire/PedidoController.php
Normal file
410
app/Http/Livewire/PedidoController.php
Normal file
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Impresora;
|
||||
use App\Models\Movimiento;
|
||||
use App\Models\Pedido;
|
||||
use App\Models\Producto;
|
||||
use App\Models\Ruta;
|
||||
use App\Printer\PrinterHandler;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class PedidoController extends Component
|
||||
{
|
||||
public $buscador ="", $buscadorProducto = "" ,$modal = false, $modalPedido = false;
|
||||
|
||||
public $pedido, $productos = [],$totalPagar = 0, $IVA = 0, $ventaEspecial;
|
||||
public $pago_efectivo, $cambio;
|
||||
public $totals = [];
|
||||
protected $rules =[
|
||||
'productos.*.linea' => 'required',
|
||||
'productos.*.codigo' => 'required',
|
||||
'productos.*.descripcion' => 'required',
|
||||
'productos.*.ruta_id' => 'required',
|
||||
'productos.*.cantidad' => 'required',
|
||||
'productos.*.precio_unitario' => 'required',
|
||||
'pedido.cuenta' => 'required',
|
||||
'pedido.folio_proveedor' => 'required',
|
||||
'pedido.telefono' => 'required',
|
||||
'pedido.year' => 'required',
|
||||
'pedido.marca' => 'required',
|
||||
'pedido.modelo' => 'required',
|
||||
'pedido.motor' => 'required',
|
||||
'pedido.user_id' => 'required',
|
||||
'pedido.comentarios' => 'required',
|
||||
'pedido.numero_remision' => 'required',
|
||||
'totals.*' => 'required',
|
||||
'ventaEspecial.codigo' => 'min:0',
|
||||
'ventaEspecial.pago_efectivo' => 'numeric',
|
||||
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||
'ventaEspecial.pago_vales' => 'numeric',
|
||||
'ventaEspecial.precio_venta' => 'numeric',
|
||||
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||
'ventaEspecial.nota_credito' => 'numeric',
|
||||
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||
];
|
||||
|
||||
protected $messages = [
|
||||
'productos.*.linea.required' => 'Campo obligatorio.',
|
||||
'productos.*.codigo.required' => 'Campo obligatorio.',
|
||||
'productos.*.descripcion.required' => 'Campo obligatorio.',
|
||||
'productos.*.ruta_id.required' => 'Campo obligatorio.',
|
||||
'productos.*.cantidad.required' => 'Campo obligatorio.',
|
||||
'productos.*.precio_unitario.required' => 'Campo obligatorio.',
|
||||
'productos.*.unidades.required' => 'Campo obligatorio.',
|
||||
|
||||
'productos.*.linea.max' => 'Campo debe ser menor a :max.',
|
||||
'productos.*.codigo.max' => 'Campo debe ser menor a :max.',
|
||||
'productos.*.descripcion.max' => 'Campo debe ser menor a :max.',
|
||||
'productos.*.ruta_id.max' => 'Campo debe ser menor a :max.',
|
||||
'productos.*.cantidad.max' => 'Campo debe ser menor a :max.',
|
||||
'productos.*.precio_unitario.max' => 'Campo debe ser menor a :max.',
|
||||
];
|
||||
|
||||
protected $listeners = ['agregar','save','saveArrivo','cerrarVenta','entregarVenta'];
|
||||
|
||||
public function render()
|
||||
{
|
||||
if($this->buscador != "")
|
||||
{
|
||||
$pedidos = Pedido::where('pedido','like','%'.$this->buscador.'%')
|
||||
->orderBy('is_venta_cerrada','asc')
|
||||
->orderBy('is_venta_entregada','asc')
|
||||
->orderBy('id','desc')
|
||||
->paginate(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pedidos = Pedido::Where('user_id',"=",auth()->user()->id)
|
||||
->orderBy('is_venta_cerrada','ASC')
|
||||
->orderBy('is_venta_entregada','ASC')
|
||||
->orderBy('id','desc')
|
||||
->paginate(10);
|
||||
}
|
||||
return view('pedido.pedido',[
|
||||
// 'pedidos' => Pedido::where('pedido','like','%'.$this->buscador.'%')->orWhere('user_id',"=",auth()->user()->id)->orderBy('id','desc')->paginate(10),
|
||||
'pedidos' => $pedidos,
|
||||
'productosList' => Producto::where('descripcion','like','%'.$this->buscadorProducto.'%')
|
||||
->orWhere('codigo','like','%'.$this->buscadorProducto.'%')->paginate(10),
|
||||
'rutas' => Ruta::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->reset();
|
||||
$this->pago_efectivo = 0;
|
||||
$this->cambio = 0;
|
||||
$this->pedido = new Pedido();
|
||||
$this->ventaEspecial = new Movimiento([
|
||||
'codigo' => 0,
|
||||
'pago_efectivo' => 0,
|
||||
'pago_tarjeta' => 0,
|
||||
'pago_vales' => 0,
|
||||
'pago_transferencia' => 0,
|
||||
'nota_credito' => 0,
|
||||
'precio_venta' => 0,
|
||||
'estado_movimiento_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
||||
|
||||
]);
|
||||
$this->showModal();
|
||||
}
|
||||
|
||||
public function agregar($id = '')
|
||||
{
|
||||
// if(auth()->user()->hasRole('admin'))
|
||||
$this->buscadorProducto = '';
|
||||
$this->productos[] = Producto::firstOrNew(['id' => $id]);
|
||||
$this->totals[] = 0;
|
||||
$this->emit('addProductEvent');
|
||||
}
|
||||
|
||||
public function agregarProductoArrivo($id = '')
|
||||
{
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$this->buscadorProducto = '';
|
||||
$this->productos[] = Producto::firstOrNew(['id' => $id]);
|
||||
$this->totals[] = 0;
|
||||
$this->emit('addProductEvent');
|
||||
}
|
||||
}
|
||||
|
||||
public function total($id)
|
||||
{
|
||||
return ((key_exists('cantidad',$this->productos[$id]) && key_exists('precio_unitario',$this->productos[$id]) ) &&
|
||||
(is_numeric($this->productos[$id]['cantidad']) && is_numeric($this->productos[$id]['precio_unitario'])))
|
||||
?$this->productos[$id]['cantidad'] * $this->productos[$id]['precio_unitario']
|
||||
:'0';
|
||||
}
|
||||
|
||||
public function updatedPagoEfectivo($value)
|
||||
{
|
||||
if($value)
|
||||
{
|
||||
$this->cambio = $this->pago_efectivo - $this->ventaEspecial->pago_efectivo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updatedProductos($value, $key)
|
||||
{
|
||||
$key = intval(explode('.',$key)[0]);
|
||||
$this->totals[$key] = $this->total($key);
|
||||
if($this->totals[$key] != 0)
|
||||
{
|
||||
$this->updateTotal($this->totals);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTotal($totals)
|
||||
{
|
||||
$total = array_sum(array_filter($totals,'is_numeric'));
|
||||
$this->totalPagar = $total/1.08;
|
||||
$this->IVA = $this->totalPagar*0.08;
|
||||
$this->totalPagar += $this->IVA;
|
||||
}
|
||||
|
||||
public function updatedModal()
|
||||
{
|
||||
if(!$this->modal){
|
||||
$this->clearInputs();
|
||||
}
|
||||
}
|
||||
|
||||
public function updatedModalPedido()
|
||||
{
|
||||
if(!$this->modalPedido){
|
||||
$this->clearInputs();
|
||||
}
|
||||
}
|
||||
|
||||
public function show(Pedido $pedido)
|
||||
{
|
||||
// dd($pedido->is_venta_cerrada,$pedido->is_venta_entregada);
|
||||
$this->totalPagar = 0;
|
||||
$this->IVA = 0;
|
||||
$this->pedido = $pedido;
|
||||
foreach ($this->pedido->productos as $producto) {
|
||||
$producto->unidades = $producto->pivot->unidades;
|
||||
$producto->precio_unitario = $producto->pivot->precio_unitario;
|
||||
$producto->producto_id = $producto->pivot->producto_id;
|
||||
$producto->is_arrivo = $producto->pivot->is_arrivo;
|
||||
$this->productos[] = $producto;
|
||||
$this->totalPagar+= ($producto->pivot->unidades*$producto->pivot->precio_unitario);
|
||||
}
|
||||
|
||||
$this->totalPagar/= 1.08;
|
||||
$this->IVA = $this->totalPagar*0.08;
|
||||
$this->totalPagar += $this->IVA;
|
||||
|
||||
$this->showModal('modalPedido');
|
||||
}
|
||||
public function save()
|
||||
{
|
||||
if(!$this->productos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$this->pedido->user_id = auth()->user()->id;
|
||||
$this->validate([
|
||||
'pedido.cuenta' => 'required',
|
||||
'pedido.telefono' => 'required',
|
||||
'pedido.year' => 'required',
|
||||
'pedido.marca' => 'required',
|
||||
'pedido.modelo' => 'required',
|
||||
'pedido.motor' => 'required',
|
||||
'productos.*.linea' => 'required|max:20',
|
||||
'productos.*.codigo' => 'required|max:20',
|
||||
'productos.*.descripcion' => 'required|max:100',
|
||||
'productos.*.ruta_id' => 'required',
|
||||
'productos.*.cantidad' => 'required|max:4',
|
||||
'productos.*.precio_unitario' => 'required|max:8',
|
||||
|
||||
'ventaEspecial.pago_efectivo' => 'numeric',
|
||||
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||
'ventaEspecial.pago_vales' => 'numeric',
|
||||
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||
'ventaEspecial.nota_credito' => 'numeric',
|
||||
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||
]);
|
||||
|
||||
$this->pedido->is_venta_cerrada = 0;
|
||||
$this->pedido->is_venta_entregada = 0;
|
||||
|
||||
$this->pedido->save();
|
||||
|
||||
$this->ventaEspecial->user_id = auth()->user()->id;
|
||||
$this->ventaEspecial->precio_venta = $this->totalPagar;
|
||||
$this->ventaEspecial->codigo = $this->pedido->pedido;
|
||||
$this->ventaEspecial->save();
|
||||
// $this->ventaEspecial->save();
|
||||
|
||||
foreach ($this->productos as $producto) {
|
||||
$productoCreated = Producto::firstOrCreate(
|
||||
['linea' => $producto['linea'], 'codigo' => $producto['codigo']],
|
||||
[
|
||||
'linea' => $producto['linea'],
|
||||
'codigo' => $producto['codigo'],
|
||||
'descripcion' => $producto['descripcion'],
|
||||
'ruta_id' => $producto['ruta_id'],
|
||||
'precio_unitario' => $producto['precio_unitario'],
|
||||
]
|
||||
);
|
||||
|
||||
$productoCreated->precio_unitario = $producto['precio_unitario'];
|
||||
$productoCreated->save();
|
||||
|
||||
$this->pedido->productos()->attach($productoCreated->id,['unidades' => $producto['cantidad'], 'precio_unitario' => $producto['precio_unitario'], 'is_arrivo' => false]);
|
||||
}
|
||||
$this->pedido->cambio = $this->cambio;
|
||||
// $this->imprimirTicket($this->pedido);
|
||||
// $this->imprimirTicket($this->pedido,false);
|
||||
session()->flash('message','El pedido se ha generado correctamente.');
|
||||
$this->closeModal();
|
||||
$this->clearInputs();
|
||||
}
|
||||
|
||||
public function entregarVenta()
|
||||
{
|
||||
$this->pedido->is_venta_entregada = true;
|
||||
$this->pedido->venta_entregada_user_id = auth()->user()->id;
|
||||
$this->pedido->venta_entregada_at = Carbon::now();
|
||||
$this->pedido->save();
|
||||
|
||||
$this->closeModal('modalPedido');
|
||||
session()->flash('message','El pedido se ha entregado correctamente.');
|
||||
$this->clearInputs();
|
||||
}
|
||||
|
||||
public function cerrarVenta()
|
||||
{
|
||||
if(!$this->pedido->is_venta_entregada)
|
||||
{
|
||||
session()->flash('error','No puedes cerrar la venta si no la has entregado.');
|
||||
$this->closeModal('modalPedido');
|
||||
return;
|
||||
}
|
||||
$this->pedido->is_venta_cerrada = true;
|
||||
$this->pedido->venta_cerrada_user_id = auth()->user()->id;
|
||||
$this->pedido->venta_cerrada_at = Carbon::now();
|
||||
$this->pedido->save();
|
||||
|
||||
$this->closeModal('modalPedido');
|
||||
session()->flash('message','El pedido se ha cerrado correctamente.');
|
||||
$this->clearInputs();
|
||||
}
|
||||
|
||||
public function saveArrivo()
|
||||
{
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$this->validate([
|
||||
'pedido.cuenta' => 'required',
|
||||
'pedido.telefono' => 'required',
|
||||
'pedido.year' => 'required',
|
||||
'pedido.marca' => 'required',
|
||||
'pedido.modelo' => 'required',
|
||||
'pedido.motor' => 'required',
|
||||
'productos.*.linea' => 'required|max:20',
|
||||
'productos.*.codigo' => 'required|max:20',
|
||||
'productos.*.descripcion' => 'required|max:100',
|
||||
'productos.*.ruta_id' => 'required',
|
||||
'productos.*.unidades' => 'required|max:10',
|
||||
'productos.*.precio_unitario' => 'required|max:8',
|
||||
]);
|
||||
|
||||
foreach ($this->productos as $index => $producto) {
|
||||
$productoCreado = Producto::updateOrCreate(
|
||||
['id' => $producto['id']??""],
|
||||
[
|
||||
'linea' => $producto['linea'],
|
||||
'codigo' => $producto['codigo'],
|
||||
'descripcion' => $producto['descripcion'],
|
||||
'ruta_id' => $producto['ruta_id'],
|
||||
'precio_unitario' => $producto['precio_unitario'],
|
||||
]
|
||||
);
|
||||
$this->productos[$index]['producto_id'] = $productoCreado->id;
|
||||
$this->productos[$index]['id'] = $productoCreado->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if(auth()->user()->hasRole('admin'))
|
||||
// {
|
||||
$this->validate([
|
||||
'pedido.cuenta' => 'required',
|
||||
'pedido.telefono' => 'required',
|
||||
'pedido.year' => 'required',
|
||||
]);
|
||||
|
||||
$this->pedido->save();
|
||||
$productosSync = [];
|
||||
foreach ($this->productos as $producto) {
|
||||
$productosSync[$producto['id']] = [
|
||||
'unidades' => $producto['unidades'],
|
||||
'precio_unitario' => $producto['precio_unitario'],
|
||||
'is_arrivo' => $producto['is_arrivo'] ?? 0
|
||||
];
|
||||
}
|
||||
$this->pedido->productos()->sync($productosSync);
|
||||
|
||||
session()->flash('message','El pedido se ha actualizado correctamente.');
|
||||
// }
|
||||
$this->closeModal('modalPedido');
|
||||
$this->clearInputs();
|
||||
}
|
||||
|
||||
public function delete(Pedido $pedido)
|
||||
{
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$pedido->productos()->detach();
|
||||
$pedido->delete();
|
||||
session()->flash('message','El pedido se ha eliminado correctamente.');
|
||||
}
|
||||
}
|
||||
|
||||
public function eliminarProducto($id)
|
||||
{
|
||||
unset($this->productos[$id]);
|
||||
unset($this->totals[$id]);
|
||||
}
|
||||
|
||||
public function imprimirTicket(Pedido $pedido,$hashed = true)
|
||||
{
|
||||
// foreach ($pedido->productos as $producto) {
|
||||
// dd('Codigo:'.$producto->codigo.' desc:'.substr($producto->descripcion,0,11).' Cant:'.$producto->pivot->unidades.' Total:'.round($producto->pivot->unidades*$producto->pivot->precio_unitario/1.16,2));
|
||||
// // dd($producto->pivot);
|
||||
// }
|
||||
// try {
|
||||
$impresora = Impresora::findOrFail(auth()->user()->impresora_id);
|
||||
$printer = new PrinterHandler($impresora,$impresora->is_compartida?PrinterHandler::PRINTER_BY_SHARED:PrinterHandler::PRINTER_BY_IP);
|
||||
$printer->printPedido($pedido,$hashed);
|
||||
$printer->feed();
|
||||
$printer->cut();
|
||||
$printer->close();
|
||||
// } catch (\Throwable $th) {
|
||||
// throw $th;
|
||||
// }
|
||||
}
|
||||
|
||||
public function showModal($modal = 'modal')
|
||||
{
|
||||
$this->{$modal} = true;
|
||||
}
|
||||
|
||||
public function closeModal($modal = 'modal')
|
||||
{
|
||||
$this->{$modal} = false;
|
||||
}
|
||||
|
||||
public function clearInputs()
|
||||
{
|
||||
$this->reset();
|
||||
}
|
||||
}
|
||||
63
app/Http/Livewire/ReportePedidoController.php
Normal file
63
app/Http/Livewire/ReportePedidoController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Exports\PedidosExport;
|
||||
use App\Models\Pedido;
|
||||
use Carbon\Carbon;
|
||||
use Livewire\Component;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ReportePedidoController extends Component
|
||||
{
|
||||
public $fecha_inicio, $fecha_final;
|
||||
public $fn_inicio, $fn_final;
|
||||
public $is_venta_cerrada = "", $is_venta_entregada ="";
|
||||
|
||||
public function render()
|
||||
{
|
||||
$query = Pedido::query();
|
||||
|
||||
$query->when($this->is_venta_entregada, function ($query) {
|
||||
return $query->where('is_venta_entregada',"=",$this->is_venta_entregada);
|
||||
});
|
||||
$query->when($this->is_venta_cerrada, function ($query) {
|
||||
return $query->where('is_venta_cerrada',"=",$this->is_venta_cerrada);
|
||||
});
|
||||
|
||||
$query->when(($this->fn_inicio && $this->fn_final), function ($query) {
|
||||
return $query->whereBetween('created_at', [$this->fn_inicio, $this->fn_final]);
|
||||
});
|
||||
return view('pedido.reporte-pedido',[
|
||||
'pedidos' => $query->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function updatedFechaInicio()
|
||||
{
|
||||
$this->fn_inicio= Carbon::parse($this->fecha_inicio)->startOfDay();
|
||||
}
|
||||
|
||||
public function updatedFechaFinal()
|
||||
{
|
||||
$this->fn_final= Carbon::parse($this->fecha_final)->endOfDay();
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
$query = Pedido::query();
|
||||
|
||||
$query->when($this->is_venta_entregada, function ($query) {
|
||||
return $query->where('is_venta_entregada',"=",$this->is_venta_entregada);
|
||||
});
|
||||
$query->when($this->is_venta_cerrada, function ($query) {
|
||||
return $query->where('is_venta_cerrada',"=",$this->is_venta_cerrada);
|
||||
});
|
||||
|
||||
$query->when(($this->fn_inicio && $this->fn_final), function ($query) {
|
||||
return $query->whereBetween('created_at', [$this->fn_inicio, $this->fn_final]);
|
||||
});
|
||||
|
||||
return Excel::download(new PedidosExport($this->fn_inicio, $this->fn_final,$this->is_venta_cerrada,$this->is_venta_entregada),'pedido-'.Carbon::now()->format('Y-m-d').'.xlsx');
|
||||
}
|
||||
}
|
||||
79
app/Http/Livewire/RutaController.php
Normal file
79
app/Http/Livewire/RutaController.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Ruta;
|
||||
use Livewire\Component;
|
||||
|
||||
class RutaController extends Component
|
||||
{
|
||||
public $ruta, $buscador, $modal = false;
|
||||
|
||||
protected $rules = [
|
||||
'ruta.ruta' => 'required',
|
||||
'ruta.prefijo' => 'required',
|
||||
];
|
||||
public function render()
|
||||
{
|
||||
$rutas = Ruta::where('ruta','like','%'.$this->buscador.'%')->paginate(10);
|
||||
return view('ruta.ruta',[
|
||||
'rutas' => $rutas,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->clearInputs();
|
||||
$this->ruta = new Ruta();
|
||||
$this->showModal();
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
'ruta.ruta' => 'required|max:50',
|
||||
'ruta.prefijo' => 'required|max:10',
|
||||
]);
|
||||
|
||||
$id = $this->ruta->id;
|
||||
|
||||
$this->ruta->save();
|
||||
|
||||
session()->flash('message',$id?"La ruta se a modificado correctamente.":"La ruta se ha registrado correctamente!");
|
||||
|
||||
$this->clearInputs();
|
||||
$this->closeModal();
|
||||
}
|
||||
|
||||
public function edit(Ruta $ruta)
|
||||
{
|
||||
$this->ruta = $ruta;
|
||||
$this->showModal();
|
||||
}
|
||||
|
||||
public function delete(Ruta $ruta)
|
||||
{
|
||||
|
||||
if(auth()->user()->hasRole('admin'))
|
||||
{
|
||||
$ruta->delete();
|
||||
session()->flash('message',"La ruta se ha eliminado del sistema.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
{
|
||||
$this->modal = true;
|
||||
}
|
||||
|
||||
public function closeModal()
|
||||
{
|
||||
$this->modal = false;
|
||||
}
|
||||
|
||||
public function clearInputs()
|
||||
{
|
||||
$this->reset();
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ class UserController extends Component
|
||||
}
|
||||
$this->validate([
|
||||
'user.name' => 'required|min:3',
|
||||
'password' => 'required|min:6'
|
||||
// 'password' => 'required|min:6'
|
||||
]);
|
||||
|
||||
$this->user->password = Hash::make($this->password);
|
||||
|
||||
@@ -14,8 +14,8 @@ class VentaController extends Component
|
||||
|
||||
const CODIGO_VENTA = 1;
|
||||
|
||||
public $buscador = '', $modal = false;
|
||||
public $venta, $cambio, $faltante;
|
||||
public $buscador = '', $modal = false, $modalDate = false;
|
||||
public $venta, $cambio, $faltante, $created_at;
|
||||
|
||||
protected $rules = [
|
||||
'venta.codigo' => 'min:0',
|
||||
@@ -24,6 +24,7 @@ class VentaController extends Component
|
||||
'venta.pago_vales' => 'numeric',
|
||||
'venta.precio_venta' => 'required|numeric|gte:1',
|
||||
'venta.pago_transferencia' => 'numeric',
|
||||
'venta.nota_credito' => 'numeric',
|
||||
'venta.estado_movimiento_id' => 'numeric',
|
||||
'venta.user_id',
|
||||
];
|
||||
@@ -52,6 +53,7 @@ class VentaController extends Component
|
||||
'pago_tarjeta' => 0,
|
||||
'pago_vales' => 0,
|
||||
'pago_transferencia' => 0,
|
||||
'nota_credito' => 0,
|
||||
'estado_movimiento_id' => 1,
|
||||
]);
|
||||
$this->cambio;
|
||||
@@ -74,6 +76,33 @@ class VentaController extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function calcularTotalPagar($venta)
|
||||
{
|
||||
return ((float)$venta->precio_venta - ((float)$venta->pago_efectivo +
|
||||
(float)$venta->pago_tarjeta + (float)$venta->pago_vales +
|
||||
(float)$venta->pago_transferencia + (float)$venta->nota_credito));
|
||||
}
|
||||
|
||||
public function editDate(Movimiento $movimiento)
|
||||
{
|
||||
$this->venta = $movimiento;
|
||||
$this->showModal('modalDate');
|
||||
}
|
||||
|
||||
public function saveDate()
|
||||
{
|
||||
$this->validate([
|
||||
'created_at' => 'required',
|
||||
]);
|
||||
|
||||
$this->venta->created_at = $this->created_at;
|
||||
$this->venta->save();
|
||||
session()->flash('message',"La fecha ha sido cambiada correctamente.");
|
||||
|
||||
$this->clearInputs();
|
||||
$this->closeModal('modalDate');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
@@ -82,6 +111,7 @@ class VentaController extends Component
|
||||
'venta.pago_tarjeta' => 'required|numeric',
|
||||
'venta.pago_vales' => 'numeric',
|
||||
'venta.pago_transferencia' => 'numeric',
|
||||
'venta.nota_credito' => 'numeric',
|
||||
'venta.estado_movimiento_id' => 'numeric',
|
||||
]);
|
||||
|
||||
@@ -91,6 +121,12 @@ class VentaController extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->calcularTotalPagar($this->venta)>0)
|
||||
{
|
||||
session()->flash("error","El pago debe ser igual o mayor a la venta.");
|
||||
return;
|
||||
}
|
||||
|
||||
$this->venta->ajusteCambio();
|
||||
|
||||
$this->venta->user_id = Auth::user()->id;
|
||||
@@ -112,15 +148,14 @@ class VentaController extends Component
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
public function showModal($modal = "modal")
|
||||
{
|
||||
$this->modal = true;
|
||||
$this->{$modal} = true;
|
||||
}
|
||||
|
||||
public function closeModal()
|
||||
public function closeModal($modal = "modal")
|
||||
{
|
||||
$this->modal = false;
|
||||
$this->{$modal} = false;
|
||||
}
|
||||
|
||||
public function clearInputs()
|
||||
|
||||
@@ -12,7 +12,7 @@ class VentaEspecialController extends Component
|
||||
use WithPagination;
|
||||
|
||||
const CODIGO_VENTA_ESPECIAL = 2;
|
||||
public $buscador = '', $modal = false, $modalLiquidar;
|
||||
public $buscador = '', $modal = false, $modalDate = false, $created_at, $modalLiquidar;
|
||||
public $ventaEspecial, $total_pagar, $ventaAnterior, $abonado, $cambio, $faltante;
|
||||
|
||||
protected $rules = [
|
||||
@@ -22,6 +22,7 @@ class VentaEspecialController extends Component
|
||||
'ventaEspecial.pago_vales' => 'numeric',
|
||||
'ventaEspecial.precio_venta' => 'numeric',
|
||||
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||
'ventaEspecial.nota_credito' => 'numeric',
|
||||
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||
];
|
||||
|
||||
@@ -47,6 +48,7 @@ class VentaEspecialController extends Component
|
||||
'pago_tarjeta' => 0,
|
||||
'pago_vales' => 0,
|
||||
'pago_transferencia' => 0,
|
||||
'nota_credito' => 0,
|
||||
'precio_venta' => 0,
|
||||
'estado_movimiento_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
||||
|
||||
@@ -64,6 +66,7 @@ class VentaEspecialController extends Component
|
||||
'pago_tarjeta' => 0,
|
||||
'pago_vales' => 0,
|
||||
'pago_transferencia' => 0,
|
||||
'nota_credito' => 0,
|
||||
'precio_venta' => $this->ventaAnterior->faltante(),
|
||||
'estado_movimiento_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
||||
]);
|
||||
@@ -93,7 +96,9 @@ class VentaEspecialController extends Component
|
||||
|
||||
public function calcularTotalPagar($venta)
|
||||
{
|
||||
return ($venta->precio_venta - $venta->pago_efectivo - $venta->pago_tarjeta - $venta->pago_vales - $venta->pago_transferencia);
|
||||
return ((float)$venta->precio_venta - ((float)$venta->pago_efectivo +
|
||||
(float)$venta->pago_tarjeta + (float)$venta->pago_vales +
|
||||
(float)$venta->pago_transferencia + (float)$venta->nota_credito));
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +109,7 @@ class VentaEspecialController extends Component
|
||||
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||
'ventaEspecial.pago_vales' => 'numeric',
|
||||
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||
'ventaEspecial.nota_credito' => 'numeric',
|
||||
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
||||
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||
]);
|
||||
@@ -124,10 +130,12 @@ class VentaEspecialController extends Component
|
||||
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||
'ventaEspecial.pago_vales' => 'numeric',
|
||||
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||
'ventaEspecial.nota_credito' => 'numeric',
|
||||
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
||||
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||
]);
|
||||
|
||||
|
||||
if(($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()) >0){
|
||||
session()->flash("message_abono","Debes liquidar la deuda para cerrarla.");
|
||||
return;
|
||||
@@ -156,6 +164,26 @@ class VentaEspecialController extends Component
|
||||
$this->closeModalLiquidar();
|
||||
}
|
||||
|
||||
public function editDate(Movimiento $movimiento)
|
||||
{
|
||||
$this->ventaEspecial = $movimiento;
|
||||
$this->showModal('modalDate');
|
||||
}
|
||||
|
||||
public function saveDate()
|
||||
{
|
||||
$this->validate([
|
||||
'created_at' => 'required',
|
||||
]);
|
||||
|
||||
$this->ventaEspecial->created_at = $this->created_at;
|
||||
$this->ventaEspecial->save();
|
||||
session()->flash('message',"La fecha ha sido cambiada correctamente.");
|
||||
|
||||
$this->clearInputs();
|
||||
$this->closeModal('modalDate');
|
||||
}
|
||||
|
||||
public function delete(Movimiento $venta)
|
||||
{
|
||||
|
||||
@@ -167,14 +195,14 @@ class VentaEspecialController extends Component
|
||||
}
|
||||
|
||||
|
||||
public function showModal()
|
||||
public function showModal($modal = "modal")
|
||||
{
|
||||
$this->modal = true;
|
||||
$this->{$modal} = true;
|
||||
}
|
||||
|
||||
public function closeModal()
|
||||
public function closeModal($modal = "modal")
|
||||
{
|
||||
$this->modal = false;
|
||||
$this->{$modal} = false;
|
||||
}
|
||||
|
||||
public function showModalLiquidar()
|
||||
|
||||
17
app/Models/Impresora.php
Normal file
17
app/Models/Impresora.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Impresora extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'estacion',
|
||||
'nombre_impresora',
|
||||
'is_compartida',
|
||||
];
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class Movimiento extends Model
|
||||
'pago_vales',
|
||||
'pago_transferencia',
|
||||
'precio_venta',
|
||||
'nota_credito',
|
||||
'estado_movimiento_id',
|
||||
'user_id',
|
||||
'is_liquidado',
|
||||
@@ -38,7 +39,8 @@ class Movimiento extends Model
|
||||
return ((float)$this->pago_efectivo +
|
||||
(float)$this->pago_tarjeta +
|
||||
(float)$this->pago_vales +
|
||||
(float)$this->pago_transferencia);
|
||||
(float)$this->pago_transferencia +
|
||||
(float)$this->nota_credito);
|
||||
}
|
||||
|
||||
public function cambio()
|
||||
@@ -47,6 +49,7 @@ class Movimiento extends Model
|
||||
((float)$this->pago_efectivo +
|
||||
(float)$this->pago_tarjeta +
|
||||
(float)$this->pago_vales +
|
||||
(float)$this->nota_credito +
|
||||
(float)$this->pago_transferencia) -
|
||||
(float)$this->precio_venta
|
||||
);
|
||||
@@ -59,7 +62,8 @@ class Movimiento extends Model
|
||||
((float)$this->pago_efectivo +
|
||||
(float)$this->pago_tarjeta +
|
||||
(float)$this->pago_vales +
|
||||
(float)$this->pago_transferencia)
|
||||
(float)$this->pago_transferencia +
|
||||
(float)$this->nota_credito)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,6 +83,30 @@ class Movimiento extends Model
|
||||
public function isTotalMayorCambio() : bool
|
||||
{
|
||||
|
||||
return ($this->pago_tarjeta + $this->pago_vales + $this->pago_transferencia)>$this->precio_venta;
|
||||
return ($this->pago_tarjeta + $this->pago_vales + $this->pago_transferencia + $this->nota_credito)>$this->precio_venta;
|
||||
}
|
||||
|
||||
public function getAbonos()
|
||||
{
|
||||
$collecion = collect($this->getFillable());
|
||||
$elements = [];
|
||||
foreach ($collecion as $value) {
|
||||
if(str_contains($value,"pago_"))
|
||||
{
|
||||
if($this->{$value} > 0)
|
||||
{
|
||||
$elements[] = [$this->{$value},str_replace("pago_","",$value)];
|
||||
}
|
||||
}
|
||||
else if(str_contains($value,"nota_credito"))
|
||||
{
|
||||
if($this->{$value} > 0)
|
||||
{
|
||||
$elements[] = [$this->{$value},str_replace("nota_","Nota de ",$value)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
}
|
||||
|
||||
78
app/Models/Pedido.php
Normal file
78
app/Models/Pedido.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pedido extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'cuenta',
|
||||
'pedido',
|
||||
'telefono',
|
||||
'year',
|
||||
'marca',
|
||||
'modelo',
|
||||
'motor',
|
||||
'folio_proveedor',
|
||||
'user_id',
|
||||
'comentarios',
|
||||
'numero_remision',
|
||||
|
||||
'is_venta_cerrada',
|
||||
'venta_cerrada_user_id',
|
||||
'is_venta_entregada',
|
||||
'venta_entregada_user_id',
|
||||
'venta_cerrada_at',
|
||||
'venta_entregada_at'
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::created(function ($model){
|
||||
$model->pedido = 'PE-'.$model->id;
|
||||
$model->save();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function productos()
|
||||
{
|
||||
return $this->belongsToMany(Producto::class,'producto_pedidos','pedido_id','producto_id')->withPivot(['unidades','is_arrivo','precio_unitario']);
|
||||
}
|
||||
|
||||
public function ultimaVenta()
|
||||
{
|
||||
return $this->hasOne(Movimiento::class,'codigo','pedido')->latest();
|
||||
}
|
||||
|
||||
public function primeraVenta()
|
||||
{
|
||||
return $this->hasOne(Movimiento::class,'codigo','pedido')->first();
|
||||
}
|
||||
|
||||
public function ultimaVentaBy()
|
||||
{
|
||||
return $this->ultimaVenta()->where('is_liquidado', '=', '1')->first();
|
||||
}
|
||||
|
||||
public function ventaEntregadaUser()
|
||||
{
|
||||
return $this->belongsTo(User::class,'venta_entregada_user_id','id');
|
||||
}
|
||||
|
||||
public function ventaCerradaUser()
|
||||
{
|
||||
return $this->belongsTo(User::class,'venta_cerrada_user_id','id');
|
||||
}
|
||||
}
|
||||
30
app/Models/Producto.php
Normal file
30
app/Models/Producto.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Producto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'linea',
|
||||
'codigo',
|
||||
'descripcion',
|
||||
// 'prefijo',
|
||||
'ruta_id',
|
||||
'cantidad',
|
||||
'precio_unitario',
|
||||
];
|
||||
|
||||
public function ruta()
|
||||
{
|
||||
return $this->belongsTo(Ruta::class);
|
||||
}
|
||||
// public function total()
|
||||
// {
|
||||
// return (is_int($this->cantidad) && is_int($this->precio_unitario))?$this->cantidad * $this->precio_unitario:'';
|
||||
// }
|
||||
}
|
||||
16
app/Models/Ruta.php
Normal file
16
app/Models/Ruta.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ruta extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'ruta',
|
||||
'prefijo',
|
||||
];
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class User extends Authenticatable
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
'name', 'email', 'password','impresora_id',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -60,4 +60,9 @@ class User extends Authenticatable
|
||||
protected $appends = [
|
||||
'profile_photo_url',
|
||||
];
|
||||
|
||||
public function impresora()
|
||||
{
|
||||
return $this->belongsTo(Impresora::class);
|
||||
}
|
||||
}
|
||||
|
||||
172
app/Printer/PrinterHandler.php
Normal file
172
app/Printer/PrinterHandler.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace App\Printer;
|
||||
|
||||
use App\Models\Impresora;
|
||||
use App\Models\Pedido;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Mike42\Escpos\EscposImage;
|
||||
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
||||
use Mike42\Escpos\Printer;
|
||||
|
||||
class PrinterHandler{
|
||||
|
||||
private Impresora $impresora;
|
||||
private Printer $printer;
|
||||
private $printerConfig;
|
||||
|
||||
const PRINTER_BY_IP = 1;
|
||||
const PRINTER_BY_SHARED = 2;
|
||||
|
||||
public function __construct(Impresora $impresora,$type_printer) {
|
||||
$this->impresora = $impresora;
|
||||
if($type_printer == PrinterHandler::PRINTER_BY_IP)
|
||||
{
|
||||
$connector = new NetworkPrintConnector($impresora->estacion,$impresora->nombre_impresora);
|
||||
}
|
||||
else if($type_printer == PrinterHandler::PRINTER_BY_SHARED)
|
||||
{
|
||||
$connector = new WindowsPrintConnector("smb://".$impresora->estacion."/".$impresora->nombre_impresora."");
|
||||
}
|
||||
$this->printer = new Printer($connector);
|
||||
}
|
||||
|
||||
|
||||
public function text(string $message="") : void {
|
||||
$this->printer->text($message."\n");
|
||||
}
|
||||
|
||||
public function testPage()
|
||||
{
|
||||
$img = EscposImage::load('storage/img/proone_print.jpg',false);
|
||||
$this->printer->bitImage($img);
|
||||
|
||||
$this->text("***** ESTRADA AUTOPARTES *****");
|
||||
$this->text("Pagina de prueba de impresion");
|
||||
$this->text("Estacion:".$this->impresora->estacion);
|
||||
$this->text("Nombre Impresora:".$this->impresora->nombre_impresora);
|
||||
$this->text("Desarrollado por Super Dev Bros");
|
||||
$this->feed();
|
||||
$this->cut();
|
||||
$this->close();
|
||||
}
|
||||
|
||||
public function printImage($path)
|
||||
{
|
||||
$img = EscposImage::load($path);
|
||||
$this->printer->bitImage($img);
|
||||
}
|
||||
|
||||
public function printPedido (Pedido $pedido, $hashed = true)
|
||||
{
|
||||
$IVA = 0;
|
||||
$subTotal = 0;
|
||||
$total = 0;
|
||||
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
$this->printImage('storage/img/proone_print.jpg');
|
||||
$this->feed();
|
||||
$this->printer -> setTextSize(2, 2);
|
||||
if($hashed)
|
||||
{
|
||||
$this->text("CLIENTE");
|
||||
}
|
||||
$this->text("No. Pedido:");
|
||||
$this->text($pedido->pedido);
|
||||
$this->printer -> setTextSize(1, 1);
|
||||
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
$this->feed(1);
|
||||
$this->text("MIGUEL ANGEL ROMERO ESTRADA");
|
||||
$this->text("DIEGO ESQUIVEL #130 INT. 3");
|
||||
$this->text("PLAYAS DE ROSARITO, BC 22706 Mexico");
|
||||
$this->text("R.F.C. : ROEM691011EZ4");
|
||||
$this->text("TELEFONOS: (661) 613-5549, (661) 104-4313");
|
||||
$this->text(" (661) 104-4590, (661) 120-0015");
|
||||
$this->text("CORREO: ventas@stradaautopartes.com");
|
||||
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
|
||||
$this->feed(1);
|
||||
$this->text("Atendido por: ".$pedido->user->name);
|
||||
$this->feed(1);
|
||||
|
||||
$this->text("---------------- Datos Cliente ----------------");
|
||||
$this->text("Cuenta: ".$pedido->cuenta);
|
||||
$this->text("Telefono: ".$pedido->telefono);
|
||||
$this->text("Fecha: ".now()->format('Y-m-d H:m:s'));
|
||||
$this->text("Año:".$pedido->year);
|
||||
$this->text("Marca:".$pedido->marca);
|
||||
$this->text("Modelo:".$pedido->modelo);
|
||||
$this->text("Motor:".$pedido->motor);
|
||||
$this->text("---------------- Datos De Pago ----------------");
|
||||
foreach ($pedido->primeraVenta()->getAbonos() as $value) {
|
||||
$this->text("Metodo: ".$value[1]." | Anticipo: ".$value[0]);
|
||||
}
|
||||
$this->text("Adeudo: ".$pedido->primeraVenta()->faltante());
|
||||
|
||||
// $this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
$this->text("-------------------- Pedido --------------------");
|
||||
if($hashed)
|
||||
{
|
||||
$this->text('Codigo Linea Descripcion Cant Precio ');
|
||||
}
|
||||
else
|
||||
{
|
||||
// 48 digitos.
|
||||
$this->text('Codigo Linea RT Descripcion Cant Precio ');
|
||||
}
|
||||
foreach ($pedido->productos as $producto) {
|
||||
if($hashed)
|
||||
{
|
||||
$this->text(str_pad(substr(Hash::make($producto->codigo),0,10),11)."".str_pad($producto->linea,7)."".str_pad(substr($producto->descripcion,0,18),19)."".str_pad(intval($producto->pivot->unidades),5)."".round($producto->pivot->precio_unitario,8));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->text(str_pad(substr($producto->codigo ,0,10),11)."".str_pad($producto->linea,6)."".str_pad($producto->ruta->prefijo,5)."".str_pad(substr($producto->descripcion,0,11),12)."".str_pad(intval($producto->pivot->unidades),5)."".round($producto->pivot->precio_unitario,8));
|
||||
}
|
||||
// $this->text(str_pad(substr($producto->codigo,0,9),10)."".str_pad($producto->prefijo,6)."".str_pad(substr($producto->descripcion,0,14),15)."".str_pad($producto->pivot->unidades,10)."".round($producto->pivot->unidades*$producto->pivot->precio_unitario/1.16,2));
|
||||
$subTotal+=$producto->pivot->unidades*$producto->pivot->precio_unitario/1.16;
|
||||
}
|
||||
$this->text("________________________________________________");
|
||||
$IVA = $subTotal*0.16;
|
||||
$total = round($subTotal+$IVA,2);
|
||||
$this->feed(1);
|
||||
$this->printer->setJustification(Printer::JUSTIFY_RIGHT);
|
||||
$this->text("SubTotal: ".round($subTotal));
|
||||
$this->text("IVA 8%: ".round($IVA));
|
||||
$this->text("Total a Pagar: ".$total);
|
||||
if($pedido->cambio>0)
|
||||
{
|
||||
$this->text("Cambio: ".$pedido->cambio);
|
||||
}
|
||||
$this->feed(1);
|
||||
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
$this->text("-------------------COMENTARIOS------------------");
|
||||
$this->text($pedido->comentarios ?? "");
|
||||
$this->text("________________________________________________");
|
||||
$this->feed(1);
|
||||
$this->text("Revise bien su mercancia, en partes electronicas");
|
||||
$this->text("no hay garantia, no hay devolucion de efectivo.");
|
||||
$this->text("Toda orden requiere un anticipo del 50%,");
|
||||
$this->text("y toda cancelacion se cobrara el 50%");
|
||||
|
||||
$this->feed(1);
|
||||
$this->feed(1);
|
||||
|
||||
$this->printer -> setTextSize(2, 2);
|
||||
$this->text("¡Gracias por su compra!");
|
||||
|
||||
}
|
||||
|
||||
public function cut()
|
||||
{
|
||||
$this->printer->cut();
|
||||
}
|
||||
|
||||
public function close()
|
||||
{
|
||||
$this->printer->close();
|
||||
}
|
||||
public function feed($lines=2)
|
||||
{
|
||||
$this->printer->feed($lines);
|
||||
}
|
||||
}
|
||||
58
app/exports/PedidosExport.php
Normal file
58
app/exports/PedidosExport.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Invoice;
|
||||
use App\Models\Movimiento;
|
||||
use App\Models\Pedido;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class PedidosExport implements FromView{
|
||||
|
||||
public $fecha_inicio, $fecha_final;
|
||||
public $is_venta_cerrada, $is_venta_entregada;
|
||||
|
||||
public function __construct($fecha_inicio, $fecha_final, $is_venta_cerrada, $is_venta_entregada)
|
||||
{
|
||||
$this->fecha_inicio = $fecha_inicio;
|
||||
$this->fecha_final = $fecha_final;
|
||||
$this->is_venta_cerrada = $is_venta_cerrada;
|
||||
$this->is_venta_entregada = $is_venta_entregada;
|
||||
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return Pedido::select(
|
||||
'pedido',
|
||||
'cuenta',
|
||||
'telefono',
|
||||
'year',
|
||||
'marca',
|
||||
'modelo',
|
||||
'motor',
|
||||
)->get();
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$query = Pedido::query();
|
||||
|
||||
$query->when($this->is_venta_entregada, function ($query) {
|
||||
return $query->where('is_venta_entregada',"=",$this->is_venta_entregada);
|
||||
});
|
||||
$query->when($this->is_venta_cerrada, function ($query) {
|
||||
return $query->where('is_venta_cerrada',"=",$this->is_venta_cerrada);
|
||||
});
|
||||
|
||||
$query->when(($this->fecha_inicio && $this->fecha_final), function ($query) {
|
||||
return $query->whereBetween('created_at', [$this->fecha_inicio, $this->fecha_final]);
|
||||
});
|
||||
|
||||
return view('export.reportePedidoExport',[
|
||||
// 'pedidos' => Pedido::whereBetween('created_at',[$this->fecha_inicio,$this->fecha_final])->get(),
|
||||
'pedidos' => $query->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
"laravel/tinker": "^2.8",
|
||||
"livewire/livewire": "^2.11",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"mike42/escpos-php": "^4.0",
|
||||
"spatie/laravel-permission": "^5.10"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
108
composer.lock
generated
108
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "14e9faecb70a51de80bbf489ed9e7322",
|
||||
"content-hash": "78117f62189eddfbc5c660d5c182522c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@@ -2663,6 +2663,112 @@
|
||||
},
|
||||
"time": "2022-12-02T22:17:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mike42/escpos-php",
|
||||
"version": "v4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mike42/escpos-php.git",
|
||||
"reference": "74fd89a3384135c90a8c6dc4b724e03df7c0e4f9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/74fd89a3384135c90a8c6dc4b724e03df7c0e4f9",
|
||||
"reference": "74fd89a3384135c90a8c6dc4b724e03df7c0e4f9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-zlib": "*",
|
||||
"mike42/gfx-php": "^0.6",
|
||||
"php": ">=7.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"squizlabs/php_codesniffer": "^3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "Used for image printing if present.",
|
||||
"ext-imagick": "Will be used for image printing if present. Required for PDF printing or use of custom fonts."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mike42\\": "src/Mike42"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Billington",
|
||||
"email": "michael.billington@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers",
|
||||
"homepage": "https://github.com/mike42/escpos-php",
|
||||
"keywords": [
|
||||
"Epson",
|
||||
"barcode",
|
||||
"escpos",
|
||||
"printer",
|
||||
"receipt-printer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mike42/escpos-php/issues",
|
||||
"source": "https://github.com/mike42/escpos-php/tree/v4.0"
|
||||
},
|
||||
"time": "2022-05-23T11:05:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mike42/gfx-php",
|
||||
"version": "v0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mike42/gfx-php.git",
|
||||
"reference": "ed9ded2a9298e4084a9c557ab74a89b71e43dbdb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mike42/gfx-php/zipball/ed9ded2a9298e4084a9c557ab74a89b71e43dbdb",
|
||||
"reference": "ed9ded2a9298e4084a9c557ab74a89b71e43dbdb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbench/phpbench": "@dev",
|
||||
"phpunit/phpunit": "^6.5",
|
||||
"squizlabs/php_codesniffer": "^3.3.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mike42\\": "src/Mike42"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Billington",
|
||||
"email": "michael.billington@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The pure PHP graphics library",
|
||||
"homepage": "https://github.com/mike42/gfx-php",
|
||||
"support": {
|
||||
"issues": "https://github.com/mike42/gfx-php/issues",
|
||||
"source": "https://github.com/mike42/gfx-php/tree/v0.6"
|
||||
},
|
||||
"time": "2019-10-05T02:44:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mobiledetect/mobiledetectlib",
|
||||
"version": "2.8.41",
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('productos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('linea',5);
|
||||
$table->string('codigo',50);
|
||||
$table->string('descripcion');
|
||||
// $table->string('prefijo',30);
|
||||
$table->decimal('precio_unitario');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('productos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('pedidos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
// Datos del cliente
|
||||
$table->string('pedido',30)->nullable();
|
||||
$table->string('cuenta',20);
|
||||
$table->string('telefono',15);
|
||||
// Datos del auto
|
||||
$table->string('year',4);
|
||||
$table->string('marca',40);
|
||||
$table->string('modelo',40);
|
||||
$table->string('motor',20);
|
||||
// Datos envio del producto
|
||||
$table->string('folio_proveedor')->nullable();
|
||||
$table->string('numero_remision')->nullable();
|
||||
|
||||
$table->boolean('is_venta_cerrada')->nullable();
|
||||
$table->unsignedBigInteger('venta_cerrada_user_id')->nullable();
|
||||
$table->foreign('venta_cerrada_user_id')->references('id')->on('users');
|
||||
|
||||
$table->boolean('is_venta_entregada')->nullable();
|
||||
$table->unsignedBigInteger('venta_entregada_user_id')->nullable();
|
||||
$table->foreign('venta_entregada_user_id')->references('id')->on('users');
|
||||
|
||||
|
||||
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
|
||||
$table->timestamp('venta_cerrada_at')->nullable();
|
||||
$table->timestamp('venta_entregada_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pedidos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('producto_pedidos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->unsignedBigInteger('pedido_id');
|
||||
$table->unsignedBigInteger('producto_id');
|
||||
|
||||
$table->foreign('pedido_id')->references('id')->on('pedidos');
|
||||
$table->foreign('producto_id')->references('id')->on('productos');
|
||||
$table->decimal('unidades');
|
||||
$table->decimal('precio_unitario');
|
||||
$table->boolean('is_arrivo');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('producto_pedidos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('impresoras', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('estacion');
|
||||
$table->string('nombre_impresora');
|
||||
$table->boolean('is_compartida');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('impresoras');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('impresora_id')->nullable();
|
||||
$table->foreign('impresora_id')->references('id')->on('impresoras')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropForeign(['impresora_id']);
|
||||
$table->dropColumn('impresora_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('movimientos', function (Blueprint $table) {
|
||||
$table->float('nota_credito',30)->after('pago_transferencia')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('movimientos', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('nota_credito');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('pedidos', function (Blueprint $table) {
|
||||
$table->string('comentarios')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('pedidos', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('comentarios');
|
||||
});
|
||||
}
|
||||
};
|
||||
29
database/migrations/2023_12_19_185943_create_rutas_table.php
Normal file
29
database/migrations/2023_12_19_185943_create_rutas_table.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('rutas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('ruta',50);
|
||||
$table->string('prefijo',10);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('rutas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('ruta_id')->after('descripcion');
|
||||
$table->foreign('ruta_id')->references('id')->on('rutas');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
|
||||
EstadoCajaMovimientoSeeder::class,
|
||||
RoleSeeder::class,
|
||||
UserSeeder::class,
|
||||
GenericSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
19
database/seeders/GenericSeeder.php
Normal file
19
database/seeders/GenericSeeder.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class GenericSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
$roleCompras = Role::create(['name' => 'compras']);
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,112 @@ window.Alpine = Alpine;
|
||||
Alpine.plugin(focus);
|
||||
|
||||
Alpine.start();
|
||||
|
||||
document.addEventListener("DOMContentLoaded", ()=> {
|
||||
|
||||
//estados
|
||||
let inputs = document.querySelectorAll('.input-enter');
|
||||
let inputsProduct = document.querySelectorAll('.input-product');
|
||||
let btnAdd = document.querySelector('#btn-add');
|
||||
|
||||
init();
|
||||
|
||||
function init()
|
||||
{
|
||||
inputEnterInit();
|
||||
inputProductsEvent();
|
||||
addKeyListener();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function inputEnterInit() {
|
||||
inputs.forEach(function(input, index) {
|
||||
input.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter' || event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
let nextIndex = index + 1;
|
||||
if (nextIndex < inputs.length) {
|
||||
inputs[nextIndex].focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addKeyListener()
|
||||
{
|
||||
const keysPressed = ['F6','F7','F8','F9'];
|
||||
|
||||
document.addEventListener('keydown',function(event){
|
||||
|
||||
if(!keysPressed.includes(event.key)) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if(event.key === 'F8' && document.querySelector('#modal-1').checked)
|
||||
{
|
||||
event.preventDefault();
|
||||
Livewire.emit('agregar');
|
||||
}
|
||||
else if(event.key === 'F9' && document.querySelector('#modal-1').checked)
|
||||
{
|
||||
Livewire.emit('save');
|
||||
}
|
||||
else if(event.key === 'F6' && document.querySelector('#modal-2').checked)
|
||||
{
|
||||
event.preventDefault();
|
||||
Livewire.emit('agregar');
|
||||
}
|
||||
else if(event.key === 'F7')
|
||||
{
|
||||
Livewire.emit('cerrarVenta' && document.querySelector('#modal-2').checked);
|
||||
}
|
||||
else if(event.key === 'F8' && document.querySelector('#modal-2').checked)
|
||||
{
|
||||
Livewire.emit('entregarVenta');
|
||||
}
|
||||
else if(event.key === 'F9' && document.querySelector('#modal-2').checked)
|
||||
{
|
||||
Livewire.emit('saveArrivo');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function inputProductsEvent() {
|
||||
inputsProduct.forEach(function(inputProduct, index) {
|
||||
inputProduct.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter' || event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
let nextIndex = index + 1;
|
||||
console.log(`nextIndex:${nextIndex} | Length: ${inputs.length}`);
|
||||
if (nextIndex < inputsProduct.length) {
|
||||
inputsProduct[nextIndex].focus();
|
||||
}
|
||||
if( (nextIndex == inputsProduct.length))
|
||||
{
|
||||
btnAdd.click();
|
||||
updateProductsDOM();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateListProducts()
|
||||
{
|
||||
inputsProduct[inputsProduct.length-6]?.focus();
|
||||
}
|
||||
|
||||
Livewire.on('addProductEvent',function(){
|
||||
updateProductsDOM();
|
||||
updateListProducts();
|
||||
});
|
||||
|
||||
async function updateProductsDOM()
|
||||
{
|
||||
inputsProduct = document.querySelectorAll('.input-product');
|
||||
inputProductsEvent();
|
||||
}
|
||||
});
|
||||
|
||||
52
resources/views/export/reportePedidoExport.blade.php
Normal file
52
resources/views/export/reportePedidoExport.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Orden</th>
|
||||
<th>Fecha</th>
|
||||
<th>Cuenta</th>
|
||||
<th>Telefono</th>
|
||||
<th>Liquidado por</th>
|
||||
<th>Creado por</th>
|
||||
<th>Entregado por</th>
|
||||
<th>Cerrado por</th>
|
||||
<th>Comentarios</th>
|
||||
|
||||
<th>Codigo</th>
|
||||
<th>Linea</th>
|
||||
<th>Descripcion</th>
|
||||
<th>Almacen</th>
|
||||
<th>Cantidad</th>
|
||||
<th>¿Recibido?</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($pedidos as $pedido)
|
||||
<tr>
|
||||
<td>{{ $pedido->pedido }}</td>
|
||||
<td>{{ $pedido->created_at->format('Y-m-d') }}</td>
|
||||
<td>{{ $pedido->cuenta }}</td>
|
||||
<td>{{ $pedido->telefono }}</td>
|
||||
<td>{{ $pedido->ultimaVentaBy()?->user->name ?? "No Liquidado" }}</td>
|
||||
<td>{{ $pedido->user->name }}</td>
|
||||
<td>{{ $pedido->ventaEntregadaUser?->name ?? "No Entregado" }}</td>
|
||||
<td>{{ $pedido->ventaCerradaUser?->name ?? "No Cerrado" }}</td>
|
||||
<td>{{ $pedido->comentarios }}</td>
|
||||
<td>
|
||||
<table class="table table-hover table-zebra">
|
||||
<tr></tr>
|
||||
@foreach ($pedido->productos as $producto)
|
||||
<tr>
|
||||
<td>{{ $producto->codigo }}</td>
|
||||
<td>{{ $producto->linea }}</td>
|
||||
<td>{{ $producto->descripcion }}</td>
|
||||
<td>{{ $producto->prefijo }}</td>
|
||||
<td>{{ $producto->pivot->unidades }}</td>
|
||||
<td>{{ $producto->pivot->is_arrivo?"Recibido":"No Recibido" }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
129
resources/views/impresora/impresora.blade.php
Normal file
129
resources/views/impresora/impresora.blade.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<div>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Impresora') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<section class="container max-w-7xl mx-auto grid grid-cols-6 my-10 gap-5">
|
||||
<article class="col-span-2">
|
||||
<h2 class="font-bold">Mi impresora</h2>
|
||||
<p>Selecciona una impresora para utilizar en tu perfil.</p>
|
||||
</article>
|
||||
<article class="bg-white col-span-4 p-3 rounded-lg">
|
||||
@if (session()->has('messageImpresora'))
|
||||
<div class="alert alert-success my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('messageImpresora') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex justify-center items-center gap-2">
|
||||
<label class="font-bold" for="seleccionar-impresora">Seleciona impresora:</label>
|
||||
<select wire:model="impresoraUser" id="seleccionar-impresora" class="select">
|
||||
<option value="null">Selecciona una opción</option>
|
||||
@foreach ($impresoras as $impresora)
|
||||
<option value="{{$impresora->id }}">{{$impresora->estacion}}:{{$impresora->nombre_impresora}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<button wire:click="saveImpresora()" class="btn btn-primary">Guardar Impresora</button>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="col-span-2">
|
||||
<h2 class="font-bold">Agrega una impresora</h2>
|
||||
<p>Puedes agregar una impresora de tu estación local, solo recuerda que para agregar una impresora debes tener la impresora compartida desde la computadora.</p>
|
||||
</article>
|
||||
<article class="bg-white col-span-4 p-3 rounded-lg">
|
||||
<div class="mb-3 flex justify-between">
|
||||
<button wire:click="create()" class="btn btn-sm btn-primary">Agregar Impresora</button>
|
||||
</div>
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('message') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-error my-2">
|
||||
<svg class="h-8 w-8" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 4C12.96 4 4 12.96 4 24C4 35.04 12.96 44 24 44C35.04 44 44 35.04 44 24C44 12.96 35.04 4 24 4ZM24 26C22.9 26 22 25.1 22 24V16C22 14.9 22.9 14 24 14C25.1 14 26 14.9 26 16V24C26 25.1 25.1 26 24 26ZM26 34H22V30H26V34Z" fill="#E92C2C" />
|
||||
</svg>
|
||||
<span>{{ session('error') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="bg-white text-neutral overflow-hidden sm:rounded-lg p-3">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Estacion / IP</th>
|
||||
<th>Nombre Impresora / Puerto</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($impresoras as $impresora)
|
||||
<th>{{ $impresora->estacion }}</th>
|
||||
<th>{{ $impresora->nombre_impresora }}</th>
|
||||
@role('admin')
|
||||
<th class="flex gap-2">
|
||||
<svg wire:click="imprimir({{$impresora->id}})" xmlns="http://www.w3.org/2000/svg" class="text-sky-600 cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z" />
|
||||
</svg>
|
||||
<svg wire:click="delete({{ $impresora->id }})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</th>
|
||||
@endrole
|
||||
</tr>
|
||||
@empty
|
||||
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
<span>No hay impresoras registradas en el sistema.</span>
|
||||
</div>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{$impresoras->links()}}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
<input class="modal-state" wire:model.defer="modal" id="modal-1" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal-overlay" for="modal-1"></label>
|
||||
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Agregar Impresora</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Nombre Estación / IP de Impresora:</label>
|
||||
<input id="codigo" wire:model="impresora.estacion" type="text" placeholder="Nombre de la computadora (con la impresora)" class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
@error('impresora.estacion')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Nombre Impresora / Puerto de Impresora:</label>
|
||||
<input id="codigo" wire:model="impresora.nombre_impresora" type="text" placeholder="Nombre de la impresora" class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
@error('impresora.nombre_impresora')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div>
|
||||
<label class="flex cursor-pointer gap-2">
|
||||
<input type="checkbox" class="checkbox" wire:model="impresora.is_compartida" />
|
||||
<span>¿Es impresora compartida?</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
3
resources/views/livewire/ruta-controller.blade.php
Normal file
3
resources/views/livewire/ruta-controller.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
{{-- A good traveler has no fixed plans and is not intent upon arriving. --}}
|
||||
</div>
|
||||
@@ -12,7 +12,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Navigation Links -->
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex items-center">
|
||||
@role('usuario|admin')
|
||||
<x-nav-link href="{{ route('dashboard') }}" :active="request()->routeIs('dashboard')">
|
||||
{{ __('Dashboard') }}
|
||||
</x-nav-link>
|
||||
@@ -25,10 +26,25 @@
|
||||
<x-nav-link href="{{ route('cancelacion') }}" :active="request()->routeIs('cancelacion')">
|
||||
{{ __('Cancelacion') }}
|
||||
</x-nav-link>
|
||||
@role('admin')
|
||||
<x-nav-link href="{{ route('reporte') }}" :active="request()->routeIs('reporte')">
|
||||
{{ __('Reporte') }}
|
||||
@endrole
|
||||
<x-nav-link href="{{ route('pedido') }}" :active="request()->routeIs('pedido')">
|
||||
{{ __('Pedido') }}
|
||||
</x-nav-link>
|
||||
@role('admin')
|
||||
<x-nav-link href="{{ route('rutas') }}" :active="request()->routeIs('rutas')">
|
||||
{{ __('Rutas') }}
|
||||
</x-nav-link>
|
||||
@endrole
|
||||
@role('admin|compras')
|
||||
<div class="dropdown dropdown-hover">
|
||||
<label class="items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out" tabindex="0">Reportes</label>
|
||||
<div class="dropdown-menu dropdown-menu-bottom-right">
|
||||
@role('admin')<a href="{{ route('reporte-ventas') }}" class="dropdown-item text-sm {{request()->routeIs('reporte-ventas')?"dropdown-active":""}}">Ventas</a>@endrole
|
||||
<a href="{{ route('reporte-pedidos') }}" tabindex="-1" class="dropdown-item text-sm {{request()->routeIs('reporte-pedidos')?"dropdown-active":""}}">Pedidos</a>
|
||||
</div>
|
||||
</div>
|
||||
@endrole
|
||||
@role('admin')
|
||||
<x-nav-link href="{{ route('usuarios') }}" :active="request()->routeIs('usuarios')">
|
||||
{{ __('Usuarios') }}
|
||||
</x-nav-link>
|
||||
@@ -68,6 +84,10 @@
|
||||
{{ __('Profile') }}
|
||||
</x-dropdown-link>
|
||||
|
||||
<x-dropdown-link href="{{ route('impresora') }}">
|
||||
{{ __('Impresora') }}
|
||||
</x-dropdown-link>
|
||||
|
||||
@if (Laravel\Jetstream\Jetstream::hasApiFeatures())
|
||||
<x-dropdown-link href="{{ route('api-tokens.index') }}">
|
||||
{{ __('API Tokens') }}
|
||||
|
||||
484
resources/views/pedido/pedido.blade copy.php
Normal file
484
resources/views/pedido/pedido.blade copy.php
Normal file
@@ -0,0 +1,484 @@
|
||||
<div>
|
||||
<x-slot name="header">
|
||||
<div class="flex justify-between">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Pedidos') }}
|
||||
</h2>
|
||||
<h3 class="font-bold">Impresora: <span class="font-normal">{{auth()->user()?->impresora?->estacion ?? "Sin Asignar"}}:{{auth()->user()?->impresora?->nombre_impresora}}</span></h3>
|
||||
</div>
|
||||
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="mb-3 flex justify-between">
|
||||
<button wire:click="create()" class="btn btn-sm btn-primary">Registrar pedido</button>
|
||||
<div class="form-group max-w-md">
|
||||
<div class="form-field flex flex-row items-center">
|
||||
<label for="buscador" class="form-label font-bold">Buscar:</label>
|
||||
<input id="buscador" wire:model="buscador" type="" placeholder="Buscar por pedido" class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('message') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-error my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('error') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="bg-white text-neutral overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Pedido</th>
|
||||
<th>Cuenta</th>
|
||||
<th>Recibidos</th>
|
||||
<th>Registrado por</th>
|
||||
<th>Entregado por</th>
|
||||
<th>Cerrado por</th>
|
||||
<th>Fecha</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($pedidos as $pedido)
|
||||
<th>{{ $pedido->pedido }}</th>
|
||||
<th>{{ $pedido->cuenta }}</th>
|
||||
{{-- <th>{{ $pedido->folio_proveedor?$pedido->folio_proveedor:"No asignado" }}</th> --}}
|
||||
{{-- <th>{{ $pedido->year }} {{ $pedido->marca }} {{ $pedido->modelo }}</th> --}}
|
||||
<th>{{ $pedido->productos->where('pivot.is_arrivo', 1)->count()." de ".$pedido->productos->count()." Productos";}}</th>
|
||||
<th>{{ $pedido->user->name }}</th>
|
||||
<th>{{ $pedido->ventaEntregadaUser?->name ?? "Sin Entregar" }}</th>
|
||||
<th>{{ $pedido->ventaCerradaUser?->name ?? "Sin Cerrar" }}</th>
|
||||
<th>{{ $pedido->created_at }}</th>
|
||||
<th class="flex gap-2">
|
||||
<svg wire:click="show({{$pedido->id}})" xmlns="http://www.w3.org/2000/svg" class="cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
<svg wire:click="imprimirTicket({{$pedido->id}},false)" xmlns="http://www.w3.org/2000/svg" class="text-sky-600 cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z" />
|
||||
</svg>
|
||||
@role('admin')
|
||||
<svg wire:click="delete({{ $pedido->id }})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</th>
|
||||
@endrole
|
||||
</tr>
|
||||
@empty
|
||||
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
<span>No hay pedidos registrados en el sistema.</span>
|
||||
</div>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{$pedidos->links()}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modal" id="modal-1" type="checkbox" />
|
||||
<div class="modal w-screen">
|
||||
<label class="modal-overlay" for="modal-1"></label>
|
||||
<div class="modal-content flex flex-col gap-2 max-w-5xl">
|
||||
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Registrar Pedido</h3>
|
||||
|
||||
<h4>Datos del cliente</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cuenta" class="form-label font-bold">Cuenta:</label>
|
||||
<input id="cuenta" wire:model="pedido.cuenta" type="text" placeholder="Cuenta usuario" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="telefono" class="form-label font-bold">Telefono:</label>
|
||||
<input id="telefono" wire:model="pedido.telefono" type="text" maxlength="10" placeholder="Numero de telefono" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Datos del vehiculo</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="year" class="form-label font-bold">Año:</label>
|
||||
<input id="year" wire:model="pedido.year" type="number" maxlength="4" placeholder="Año del vehiculo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.year')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="marca" class="form-label font-bold">Marca:</label>
|
||||
<input id="marca" wire:model="pedido.marca" type="text" placeholder="Marca del vehiculo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.marca')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="modelo" class="form-label font-bold">Modelo:</label>
|
||||
<input id="modelo" wire:model="pedido.modelo" type="text" placeholder="Modelo del vehiculo" class="input max-w-full input-enter" />
|
||||
@error('pedido.modelo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="motor" class="form-label font-bold">Motor:</label>
|
||||
<input id="motor" wire:model="pedido.motor" type="text" placeholder="Tamaño del motor" class="input max-w-full input-enter" />
|
||||
@error('pedido.motor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="comentarios" class="form-label font-bold">Comentarios:</label>
|
||||
<textarea id="comentarios" wire:model="pedido.comentarios" type="text" placeholder="Registra el historial del pedido." class="textarea max-w-full input-enter" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col justify-between gap-1">
|
||||
<h4>Productos a cotizar</h4>
|
||||
<div class="">
|
||||
<div class="dropdown dropdown-open w-full">
|
||||
<input class="input input-block input-enter" wire:model="buscadorProducto" placeholder="Buscar pieza" />
|
||||
@if ($buscadorProducto!="")
|
||||
<div class="dropdown-menu w-full">
|
||||
@forelse ($productosList as $producto)
|
||||
<button class="dropdown-item text-sm" wire:click="agregar({{$producto->id}})">Codigo: {{$producto->codigo}} | Descripcion: {{$producto->descripcion}}</button>
|
||||
@empty
|
||||
<button class="dropdown-item text-sm">No se encontraron coincidencias.</button>
|
||||
@endforelse
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div>
|
||||
@foreach ($productos as $key => $producto)
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo-{{$key}}" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo-{{$key}}" wire:model="productos.{{$key}}.codigo" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.codigo")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-3">
|
||||
<div class="form-field">
|
||||
<label for="descripcion-{{$key}}" class="form-label font-bold">Descripcion:</label>
|
||||
<input id="descripcion-{{$key}}" wire:model="productos.{{$key}}.descripcion" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.descripcion")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="linea-{{$key}}" class="form-label font-bold">Linea:</label>
|
||||
<input id="linea-{{$key}}" wire:model="productos.{{$key}}.linea" type="text" maxlength="4" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.linea")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
{{-- <div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="prefijo-{{$key}}" class="form-label font-bold">Prefijo:</label>
|
||||
<input id="prefijo-{{$key}}" maxlength="8" wire:model="productos.{{$key}}.prefijo" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.prefijo")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div> --}}
|
||||
<div class="form-group gap-1">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Ruta:</label>
|
||||
<select class="select" wire:model="productos.{{$key}}.ruta_id">
|
||||
<option selected value="">- Ruta -</option>
|
||||
@foreach ($rutas as $ruta)
|
||||
<option value="{{$ruta->id}}">{{$ruta->prefijo}} - {{ $ruta->ruta }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error("productos.{$key}.ruta_id")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Cantidad:</label>
|
||||
<input id="cantidad-{{$key}}" maxlength="4" wire:model="productos.{{$key}}.cantidad" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.cantidad")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-2">
|
||||
<div class="form-field">
|
||||
<label for="precio_unitario-{{$key}}" class="form-label font-bold">Precio Unitario:</label>
|
||||
<input id="precio_unitario-{{$key}}" maxlength="6" wire:model="productos.{{$key}}.precio_unitario" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.precio_unitario")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="total-{{$key}}" class="form-label font-bold">Total:</label>
|
||||
<input id="total-{{$key}}" wire:model="totals.{{$key}}" type="text" disabled class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="form-label invisible">btn</label>
|
||||
<svg wire:click="eliminarProducto({{$key}})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">SubTotal: <span class="font-normal">{{round($totalPagar - $IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">IVA 8%: <span class="font-normal">{{round($IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">Total a Pagar: <span class="font-normal">{{round($totalPagar,2)}}</span></p>
|
||||
</div>
|
||||
|
||||
<h4>Deposito del producto</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
|
||||
<div class="grid grid-cols-5 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('ventaEspecial.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de vales" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="nota_credito" class="form-label font-bold">Nota Credito:</label>
|
||||
<input id="nota_credito" wire:model="ventaEspecial.nota_credito" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.nota_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex gap-3 mt-2">
|
||||
<button id="btn-add" wire:click='agregar()' class="btn btn-primary btn-block">Agregar producto [F8]</button>
|
||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar [F9]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="modal-state" wire:model.defer="modalPedido" id="modal-2" type="checkbox" />
|
||||
<div class="modal w-screen">
|
||||
<label class="modal-overlay" for="modal-2"></label>
|
||||
<div class="modal-content flex flex-col gap-2 max-w-5xl">
|
||||
<label for="modal-2" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Registrar Pedido</h3>
|
||||
|
||||
<h4>Datos del cliente</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cuenta-pedido" class="form-label font-bold">Cuenta:</label>
|
||||
<input id="cuenta-pedido" wire:model="pedido.cuenta" type="text" placeholder="Cuenta usuario" class="input max-w-full" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="telefono-pedido" class="form-label font-bold">Telefono:</label>
|
||||
<input id="telefono-pedido" wire:model="pedido.telefono" type="text" maxlength="10" placeholder="Numero de telefono" class="input max-w-full" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="folio_proveedor" class="form-label font-bold">Folio Proveedor:</label>
|
||||
<input id="folio_proveedor" wire:model="pedido.folio_proveedor" type="text" placeholder="Folio Proveedor" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.folio_proveedor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="numero_remision" class="form-label font-bold">Numero Remisión:</label>
|
||||
<input id="numero_remision" wire:model="pedido.numero_remision" type="text" placeholder="Numero Remision" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.numero_remision')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Datos del vehiculo</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="year-pedido" class="form-label font-bold">Año:</label>
|
||||
<input id="year-pedido" wire:model="pedido.year" type="number" maxlength="4" placeholder="Año del vehiculo" class="input max-w-full" disabled />
|
||||
</div>
|
||||
@error('pedido.year')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="marca-pedido" class="form-label font-bold">Marca:</label>
|
||||
<input id="marca-pedido" wire:model="pedido.marca" type="text" placeholder="Marca del vehiculo" class="input max-w-full" disabled />
|
||||
</div>
|
||||
@error('pedido.marca')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="modelo-pedido" class="form-label font-bold">Modelo:</label>
|
||||
<input id="modelo-pedido" wire:model="pedido.modelo" type="text" placeholder="Modelo del vehiculo" class="input max-w-full" disabled/>
|
||||
@error('pedido.modelo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="motor-pedido" class="form-label font-bold">Motor:</label>
|
||||
<input id="motor-pedido" wire:model="pedido.motor" type="text" placeholder="Tamaño del motor" class="input max-w-full" disabled/>
|
||||
@error('pedido.motor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="comentarios" class="form-label font-bold">Comentarios:</label>
|
||||
<textarea id="comentarios" wire:model="pedido.comentarios" type="text" placeholder="Registra el historial del pedido." class="textarea max-w-full input-enter" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Pedido</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div>
|
||||
@isset($this->pedido)
|
||||
@foreach ($this->pedido->productos as $key => $producto)
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo-{{$key}}-pedido" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo-{{$key}}-pedido" value="{{$producto->codigo}}" type="text" placeholder="" class="input max-w-full" disabled/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-span-3">
|
||||
<div class="form-field">
|
||||
<label for="descripcion-{{$key}}-pedido" class="form-label font-bold">Descripcion:</label>
|
||||
<input id="descripcion-{{$key}}-pedido" value="{{$producto->descripcion}}" type="text" placeholder="" class="input max-w-full" disabled/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="linea-{{$key}}-pedido" class="form-label font-bold">Linea:</label>
|
||||
<input id="linea-{{$key}}-pedido" value="{{$producto->linea}}" type="text" maxlength="4" placeholder="" class="input max-w-full" disabled/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{-- <div class="form-field">
|
||||
<label for="prefijo-{{$key}}-pedido" class="form-label font-bold">Prefijo:</label>
|
||||
<input id="prefijo-{{$key}}-pedido" value="{{$producto->prefijo}}" type="text" placeholder="" class="input max-w-full" disabled/>
|
||||
</div> --}}
|
||||
<div class="form-field">
|
||||
<label for="prefijo-{{$key}}-pedido" class="form-label font-bold">Ruta:</label>
|
||||
<input id="prefijo-{{$key}}-pedido" value="{{$producto->ruta->id}}" type="text" placeholder="" class="input max-w-full" disabled/>
|
||||
</div>
|
||||
{{-- <div class="form-group gap-1">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Ruta:</label>
|
||||
<select class="select" wire:model="productos.{{$key}}.ruta_id">
|
||||
<option value="">- Ruta -</option>
|
||||
@foreach ($rutas as $ruta)
|
||||
<option {{$ruta->id== $productos[$key]['ruta_id'] ?"selected":""}} value="{{$ruta->id}}">{{$ruta->prefijo}} - {{ $ruta->ruta }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error("productos.{$key}.ruta_id")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div> --}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cantidad-{{$key}}-pedido" class="form-label font-bold">Cantidad:</label>
|
||||
<input id="cantidad-{{$key}}-pedido" value="{{$producto->pivot->unidades}}" type="text" placeholder="" class="input max-w-full" disabled />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-span-2">
|
||||
<div class="form-field">
|
||||
<label for="precio_unitario-{{$key}}-pedido" class="form-label font-bold">Precio Unitario:</label>
|
||||
<input id="precio_unitario-{{$key}}-pedido" value="{{$producto->pivot->precio_unitario}}" type="text" placeholder="" class="input max-w-full" disabled />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="arrivo-{{$key}}-pedido" class="form-label font-bold">¿Arrivo Producto?:</label>
|
||||
<input id="arrivo-{{$key}}-pedido" wire:model="productos.{{$key}}.is_arrivo" type="checkbox" class="checkbox checkbox-primary checkbox-bordered-primary mx-auto max-w-full"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endisset
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">SubTotal: <span class="font-normal">{{round($this->totalPagar - $this->IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">IVA 8%: <span class="font-normal">{{round($this->IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">Total a Pagar: <span class="font-normal">{{round($this->totalPagar,2)}}</span></p>
|
||||
</div>
|
||||
<div class="flex gap-3 mt-2">
|
||||
@if (!$this->pedido?->is_venta_cerrada)
|
||||
<button wire:click="cerrarVenta()" class="btn btn-primary btn-block">Cerrar Pedido [F7]</button>
|
||||
@endif
|
||||
@if (!$this->pedido?->is_venta_entregada)
|
||||
<button wire:click="entregarVenta()" class="btn btn-secondary btn-block">Entregar Pedido [F8]</button>
|
||||
@endif
|
||||
<button wire:click="saveArrivo()" class="btn btn-success btn-block">Guardar Pedido [F9]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
517
resources/views/pedido/pedido.blade.php
Normal file
517
resources/views/pedido/pedido.blade.php
Normal file
@@ -0,0 +1,517 @@
|
||||
<div>
|
||||
<x-slot name="header">
|
||||
<div class="flex justify-between">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Pedidos') }}
|
||||
</h2>
|
||||
<h3 class="font-bold">Impresora: <span class="font-normal">{{auth()->user()?->impresora?->estacion ?? "Sin Asignar"}}:{{auth()->user()?->impresora?->nombre_impresora}}</span></h3>
|
||||
</div>
|
||||
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="mb-3 flex justify-between">
|
||||
<button wire:click="create()" class="btn btn-sm btn-primary">Registrar pedido</button>
|
||||
<div class="form-group max-w-md">
|
||||
<div class="form-field flex flex-row items-center">
|
||||
<label for="buscador" class="form-label font-bold">Buscar:</label>
|
||||
<input id="buscador" wire:model="buscador" type="" placeholder="Buscar por pedido" class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('message') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-error my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('error') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="bg-white text-neutral overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Pedido</th>
|
||||
<th>Cuenta</th>
|
||||
<th>Recibidos</th>
|
||||
<th>Registrado por</th>
|
||||
<th>Entregado por</th>
|
||||
<th>Cerrado por</th>
|
||||
<th>Fecha</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($pedidos as $pedido)
|
||||
<th>{{ $pedido->pedido }}</th>
|
||||
<th>{{ $pedido->cuenta }}</th>
|
||||
{{-- <th>{{ $pedido->folio_proveedor?$pedido->folio_proveedor:"No asignado" }}</th> --}}
|
||||
{{-- <th>{{ $pedido->year }} {{ $pedido->marca }} {{ $pedido->modelo }}</th> --}}
|
||||
<th><span class="badge {{($pedido->productos->where('pivot.is_arrivo',1)->count() == $pedido->productos->count()) ? "badge-success":""}}">{{ $pedido->productos->where('pivot.is_arrivo', 1)->count()." de ".$pedido->productos->count()." Productos";}}</span></th>
|
||||
<th>{{ $pedido->user->name }}</th>
|
||||
<th>{{ $pedido->ventaEntregadaUser?->name ?? "Sin Entregar" }}</span></th>
|
||||
<th><span class="badge {{!$pedido->is_venta_cerrada?"badge-error":""}}">{{ $pedido->ventaCerradaUser?->name ?? "Sin Cerrar" }}</span></th>
|
||||
<th>{{ $pedido->created_at }}</th>
|
||||
<th class="flex gap-2">
|
||||
<svg wire:click="show({{$pedido->id}})" xmlns="http://www.w3.org/2000/svg" class="cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
<svg wire:click="imprimirTicket({{$pedido->id}},false)" xmlns="http://www.w3.org/2000/svg" class="text-sky-600 cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z" />
|
||||
</svg>
|
||||
<svg wire:click="imprimirTicket({{$pedido->id}},true)" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-sky-600 cursor-pointer w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
|
||||
</svg>
|
||||
@role('admin')
|
||||
<svg wire:click="delete({{ $pedido->id }})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</th>
|
||||
@endrole
|
||||
</tr>
|
||||
@empty
|
||||
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
<span>No hay pedidos registrados en el sistema.</span>
|
||||
</div>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{$pedidos->links()}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modal" id="modal-1" type="checkbox" />
|
||||
<div class="modal w-screen">
|
||||
<label class="modal-overlay" for="modal-1"></label>
|
||||
<div class="modal-content flex flex-col gap-2 max-w-5xl">
|
||||
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Registrar Pedido</h3>
|
||||
|
||||
<h4>Datos del cliente</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cuenta" class="form-label font-bold">Cuenta:</label>
|
||||
<input id="cuenta" wire:model="pedido.cuenta" type="text" placeholder="Cuenta usuario" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="telefono" class="form-label font-bold">Telefono:</label>
|
||||
<input id="telefono" wire:model="pedido.telefono" type="text" maxlength="10" placeholder="Numero de telefono" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Datos del vehiculo</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="year" class="form-label font-bold">Año:</label>
|
||||
<input id="year" wire:model="pedido.year" type="number" maxlength="4" placeholder="Año del vehiculo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.year')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="marca" class="form-label font-bold">Marca:</label>
|
||||
<input id="marca" wire:model="pedido.marca" type="text" placeholder="Marca del vehiculo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.marca')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="modelo" class="form-label font-bold">Modelo:</label>
|
||||
<input id="modelo" wire:model="pedido.modelo" type="text" placeholder="Modelo del vehiculo" class="input max-w-full input-enter" />
|
||||
@error('pedido.modelo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="motor" class="form-label font-bold">Motor:</label>
|
||||
<input id="motor" wire:model="pedido.motor" type="text" placeholder="Tamaño del motor" class="input max-w-full input-enter" />
|
||||
@error('pedido.motor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="comentarios" class="form-label font-bold">Comentarios:</label>
|
||||
<textarea id="comentarios" wire:model="pedido.comentarios" type="text" placeholder="Registra el historial del pedido." class="textarea max-w-full input-enter" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col justify-between gap-1">
|
||||
<h4>Productos a cotizar</h4>
|
||||
<div class="">
|
||||
<div class="dropdown dropdown-open w-full">
|
||||
<input class="input input-block input-enter" wire:model="buscadorProducto" placeholder="Buscar pieza" />
|
||||
@if ($buscadorProducto!="")
|
||||
<div class="dropdown-menu w-full">
|
||||
@forelse ($productosList as $producto)
|
||||
<button class="dropdown-item text-sm" wire:click="agregar({{$producto->id}})">Codigo: {{$producto->codigo}} | Linea: {{$producto->linea}} | Descripcion: {{$producto->descripcion}}</button>
|
||||
@empty
|
||||
<button class="dropdown-item text-sm">No se encontraron coincidencias.</button>
|
||||
@endforelse
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div>
|
||||
@foreach ($productos as $key => $producto)
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo-{{$key}}" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo-{{$key}}" wire:model="productos.{{$key}}.codigo" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.codigo")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-3">
|
||||
<div class="form-field">
|
||||
<label for="descripcion-{{$key}}" class="form-label font-bold">Descripcion:</label>
|
||||
<input id="descripcion-{{$key}}" wire:model="productos.{{$key}}.descripcion" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.descripcion")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="linea-{{$key}}" class="form-label font-bold">Linea:</label>
|
||||
<input id="linea-{{$key}}" wire:model="productos.{{$key}}.linea" type="text" maxlength="4" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.linea")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group gap-1">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Ruta:</label>
|
||||
<select class="select input-product" wire:model="productos.{{$key}}.ruta_id">
|
||||
<option selected value="">- Ruta -</option>
|
||||
@foreach ($rutas as $ruta)
|
||||
<option value="{{$ruta->id}}">{{$ruta->prefijo}} - {{ $ruta->ruta }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error("productos.{$key}.ruta_id")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Cantidad:</label>
|
||||
<input id="cantidad-{{$key}}" maxlength="4" wire:model="productos.{{$key}}.cantidad" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.cantidad")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-2">
|
||||
<div class="form-field">
|
||||
<label for="precio_unitario-{{$key}}" class="form-label font-bold">Precio Unitario:</label>
|
||||
<input id="precio_unitario-{{$key}}" maxlength="6" wire:model="productos.{{$key}}.precio_unitario" type="text" placeholder="" class="input max-w-full input-product" />
|
||||
</div>
|
||||
@error("productos.{$key}.precio_unitario")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="total-{{$key}}" class="form-label font-bold">Total:</label>
|
||||
<input id="total-{{$key}}" wire:model="totals.{{$key}}" type="text" disabled class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="form-label invisible">btn</label>
|
||||
<svg wire:click="eliminarProducto({{$key}})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">SubTotal: <span class="font-normal">{{round($totalPagar - $IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">IVA 8%: <span class="font-normal">{{round($IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">Total a Pagar: <span class="font-normal">{{round($totalPagar,2)}}</span></p>
|
||||
</div>
|
||||
|
||||
<h4>Deposito del producto</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
|
||||
<div class="grid grid-cols-5 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('ventaEspecial.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de vales" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="nota_credito" class="form-label font-bold">Nota Credito:</label>
|
||||
<input id="nota_credito" wire:model="ventaEspecial.nota_credito" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
@error('ventaEspecial.nota_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_efectivo" class="form-label font-bold">Cliente Pago en Efectivo:</label>
|
||||
<input id="pago_efectivo" wire:model="pago_efectivo" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cambio" class="form-label font-bold">Cambio:</label>
|
||||
<input id="cambio" wire:model="cambio" type="number" step="any" disabled placeholder="" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex gap-3 mt-2">
|
||||
<button id="btn-add" wire:click='agregar()' class="btn btn-primary btn-block">Agregar producto [F8]</button>
|
||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar [F9]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="modal-state" wire:model.defer="modalPedido" id="modal-2" type="checkbox" />
|
||||
<div class="modal w-screen">
|
||||
<label class="modal-overlay" for="modal-2"></label>
|
||||
<div class="modal-content flex flex-col gap-2 max-w-5xl">
|
||||
<label for="modal-2" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Registrar Pedido</h3>
|
||||
|
||||
<h4>Datos del cliente</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cuenta-pedido" class="form-label font-bold">Cuenta:</label>
|
||||
<input id="cuenta-pedido" wire:model="pedido.cuenta" type="text" placeholder="Cuenta usuario" class="input max-w-full" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="telefono-pedido" class="form-label font-bold">Telefono:</label>
|
||||
<input id="telefono-pedido" wire:model="pedido.telefono" type="text" maxlength="10" placeholder="Numero de telefono" class="input max-w-full" />
|
||||
</div>
|
||||
@error('pedido.cuenta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="folio_proveedor" class="form-label font-bold">Folio Proveedor:</label>
|
||||
<input id="folio_proveedor" wire:model="pedido.folio_proveedor" type="text" placeholder="Folio Proveedor" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.folio_proveedor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="numero_remision" class="form-label font-bold">Numero Remisión:</label>
|
||||
<input id="numero_remision" wire:model="pedido.numero_remision" type="text" placeholder="Numero Remision" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
@error('pedido.numero_remision')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Datos del vehiculo</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="year-pedido" class="form-label font-bold">Año:</label>
|
||||
<input id="year-pedido" wire:model="pedido.year" type="number" maxlength="4" placeholder="Año del vehiculo" class="input max-w-full" disabled />
|
||||
</div>
|
||||
@error('pedido.year')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="marca-pedido" class="form-label font-bold">Marca:</label>
|
||||
<input id="marca-pedido" wire:model="pedido.marca" type="text" placeholder="Marca del vehiculo" class="input max-w-full" disabled />
|
||||
</div>
|
||||
@error('pedido.marca')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="modelo-pedido" class="form-label font-bold">Modelo:</label>
|
||||
<input id="modelo-pedido" wire:model="pedido.modelo" type="text" placeholder="Modelo del vehiculo" class="input max-w-full" disabled/>
|
||||
@error('pedido.modelo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="motor-pedido" class="form-label font-bold">Motor:</label>
|
||||
<input id="motor-pedido" wire:model="pedido.motor" type="text" placeholder="Tamaño del motor" class="input max-w-full" disabled/>
|
||||
@error('pedido.motor')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="comentarios" class="form-label font-bold">Comentarios:</label>
|
||||
<textarea id="comentarios" wire:model="pedido.comentarios" type="text" placeholder="Registra el historial del pedido." class="textarea max-w-full input-enter" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@role('admin')
|
||||
<div class="flex flex-col justify-between gap-1">
|
||||
<h4>Productos a cotizar</h4>
|
||||
<div class="">
|
||||
<div class="dropdown dropdown-open w-full">
|
||||
<input class="input input-block input-enter" wire:model="buscadorProducto" placeholder="Buscar pieza" />
|
||||
@if ($buscadorProducto!="")
|
||||
<div class="dropdown-menu w-full">
|
||||
@forelse ($productosList as $producto)
|
||||
<button class="dropdown-item text-sm" wire:click="agregar({{$producto->id}})">Codigo: {{$producto->codigo}} | Linea: {{$producto->linea}} | Descripcion: {{$producto->descripcion}}</button>
|
||||
@empty
|
||||
<button class="dropdown-item text-sm">No se encontraron coincidencias.</button>
|
||||
@endforelse
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endrole
|
||||
|
||||
<h4>Pedido</h4>
|
||||
<div class="border-b border-gray-400 w-full"></div>
|
||||
<div>
|
||||
@isset($this->pedido)
|
||||
@foreach ($this->productos as $key => $producto)
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo-{{$key}}" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo-{{$key}}" wire:model="productos.{{$key}}.codigo" type="text" placeholder="" class="input max-w-full input-product" @role('compras'){{"disabled"}}@endrole />
|
||||
</div>
|
||||
@error("productos.{$key}.codigo")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-3">
|
||||
<div class="form-field">
|
||||
<label for="descripcion-{{$key}}" class="form-label font-bold">Descripcion:</label>
|
||||
<input id="descripcion-{{$key}}" wire:model="productos.{{$key}}.descripcion" type="text" placeholder="" class="input max-w-full input-product" @role('compras'){{"disabled"}}@endrole />
|
||||
</div>
|
||||
@error("productos.{$key}.descripcion")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="linea-{{$key}}" class="form-label font-bold">Linea:</label>
|
||||
<input id="linea-{{$key}}" wire:model="productos.{{$key}}.linea" type="text" maxlength="4" placeholder="" class="input max-w-full input-product" @role('compras'){{"disabled"}}@endrole />
|
||||
</div>
|
||||
@error("productos.{$key}.linea")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group gap-1">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Ruta:</label>
|
||||
<select class="select input-product" wire:model="productos.{{$key}}.ruta_id" @role('compras'){{"disabled"}}@endrole>
|
||||
<option selected value="">- Ruta -</option>
|
||||
@foreach ($rutas as $ruta)
|
||||
<option value="{{$ruta->id}}">{{$ruta->prefijo}} - {{ $ruta->ruta }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error("productos.{$key}.ruta_id")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="cantidad-{{$key}}" class="form-label font-bold">Cantidad:</label>
|
||||
<input id="cantidad-{{$key}}" maxlength="4" wire:model="productos.{{$key}}.unidades" type="text" placeholder="" class="input max-w-full input-product" @role('compras'){{"disabled"}}@endrole />
|
||||
</div>
|
||||
@error("productos.{$key}.unidades")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group col-span-2">
|
||||
<div class="form-field">
|
||||
<label for="precio_unitario-{{$key}}" class="form-label font-bold">Precio Unitario:</label>
|
||||
<input id="precio_unitario-{{$key}}" maxlength="6" wire:model="productos.{{$key}}.precio_unitario" type="text" placeholder="" class="input max-w-full input-product" @role('compras'){{"disabled"}}@endrole />
|
||||
</div>
|
||||
@error("productos.{$key}.precio_unitario")<span class="block text-xs mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="arrivo-{{$key}}-pedido" class="form-label font-bold">¿Arrivo Producto?:</label>
|
||||
<input id="arrivo-{{$key}}-pedido" wire:model="productos.{{$key}}.is_arrivo" type="checkbox" class="checkbox checkbox-primary checkbox-bordered-primary mx-auto max-w-full"/>
|
||||
</div>
|
||||
</div>
|
||||
@role('admin')
|
||||
<div>
|
||||
<label class="form-label invisible">btn</label>
|
||||
<svg wire:click="eliminarProducto({{$key}})" xmlns="http://www.w3.org/2000/svg" class="text-error cursor-pointer" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
|
||||
</svg>
|
||||
</div>
|
||||
@endrole
|
||||
</div>
|
||||
@endforeach
|
||||
@endisset
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">SubTotal: <span class="font-normal">{{round($this->totalPagar - $this->IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">IVA 8%: <span class="font-normal">{{round($this->IVA,2)}}</span></p>
|
||||
<p class="font-bold text-lg text-right my-2 mx-2">Total a Pagar: <span class="font-normal">{{round($this->totalPagar,2)}}</span></p>
|
||||
</div>
|
||||
<div class="flex gap-3 mt-2">
|
||||
@role('admin')
|
||||
<button id="btn-add" wire:click='agregarProductoArrivo()' class="btn btn-primary btn-block">Agregar producto [F6]</button>
|
||||
@endrole
|
||||
@if (!$this->pedido?->is_venta_cerrada)
|
||||
<button wire:click="cerrarVenta()" class="btn btn-primary btn-block">Cerrar Pedido [F7]</button>
|
||||
@endif
|
||||
@if (!$this->pedido?->is_venta_entregada)
|
||||
<button wire:click="entregarVenta()" class="btn btn-secondary btn-block">Entregar Pedido [F8]</button>
|
||||
@endif
|
||||
<button wire:click="saveArrivo()" class="btn btn-success btn-block">Guardar Pedido [F9]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
100
resources/views/pedido/reporte-pedido.blade.php
Normal file
100
resources/views/pedido/reporte-pedido.blade.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<div>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Reporte Pedido') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="mb-3 flex items-start gap-2">
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<div class="form-group">
|
||||
<div class="form-field items-center flex-row">
|
||||
<label for="fecha_inicio" class="form-label font-bold w-36">Fecha Inicial:</label>
|
||||
<input id="fecha_inicio" wire:model="fecha_inicio" type="date" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
</div>
|
||||
@error('fecha_inicio')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-field items-center flex-row">
|
||||
<label for="fecha_final" class="form-label font-bold w-32">Fecha Final:</label>
|
||||
<input id="fecha_final" wire:model="fecha_final" type="date" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
</div>
|
||||
@error('fecha_final')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
</div>
|
||||
<select wire:model="is_venta_cerrada" class="select">
|
||||
<option value="">¿Venta Cerrada?</option>
|
||||
<option value="1">Si</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
<select wire:model="is_venta_entregada" class="select">
|
||||
<option value="">¿Venta Entregada?</option>
|
||||
<option value="1">Si</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</div>
|
||||
<button wire:click="export()" class="btn btn-sm btn-primary">Generar Reporte</button>
|
||||
</div>
|
||||
<div class="bg-white text-neutral overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Orden</th>
|
||||
<th>Fecha</th>
|
||||
<th>Cuenta</th>
|
||||
<th>Telefono</th>
|
||||
<th>Liquidado por</th>
|
||||
<th>Creado por</th>
|
||||
<th>Entregado por</th>
|
||||
<th>Cerrado por</th>
|
||||
<th>Comentarios</th>
|
||||
|
||||
<th>Productos</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($pedidos as $pedido)
|
||||
<tr>
|
||||
<td>{{ $pedido->pedido }}</td>
|
||||
<td>{{ $pedido->created_at->format('Y-m-d') }}</td>
|
||||
<td>{{ $pedido->cuenta }}</td>
|
||||
<td>{{ $pedido->telefono }}</td>
|
||||
<td>{{ $pedido->ultimaVentaBy()?->user->name ?? "No Liquidado" }}</td>
|
||||
<td>{{ $pedido->user->name }}</td>
|
||||
<td>{{ $pedido->ventaEntregadaUser?->name ?? "No Entregado" }}</td>
|
||||
<td>{{ $pedido->ventaCerradaUser?->name ?? "No Cerrado" }}</td>
|
||||
<td>{{ $pedido->comentarios }}</td>
|
||||
<td>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Codigo</th>
|
||||
<th>Linea</th>
|
||||
<th>Descripcion</th>
|
||||
<th>Almacen</th>
|
||||
<th>Cantidad</th>
|
||||
<th>¿Recibido?</th>
|
||||
</tr>
|
||||
@foreach ($pedido->productos as $producto)
|
||||
<tr>
|
||||
<td>{{ $producto->codigo }}</td>
|
||||
<td>{{ $producto->linea }}</td>
|
||||
<td>{{ $producto->descripcion }}</td>
|
||||
<td>{{ $producto->prefijo }}</td>
|
||||
<td>{{ $producto->pivot->unidades }}</td>
|
||||
<td>{{ $producto->pivot->is_arrivo?"Recibido":"No Recibido" }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
95
resources/views/ruta/ruta.blade.php
Normal file
95
resources/views/ruta/ruta.blade.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<div>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Rutas') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="mb-3 flex justify-between">
|
||||
<button wire:click="create()" class="btn btn-sm btn-primary">Registrar ruta</button>
|
||||
<div class="form-group max-w-md">
|
||||
<div class="form-field flex flex-row items-center">
|
||||
<label for="buscador" class="form-label font-bold">Buscar:</label>
|
||||
<input id="buscador" wire:model="buscador" type="" placeholder="Buscar por codigo" class="input max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success my-2">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>{{ session('message') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="bg-white text-neutral overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-hover table-zebra">
|
||||
<thead>
|
||||
<tr class="text-neutral">
|
||||
<th>Nombre Ruta</th>
|
||||
<th>Prefijo</th>
|
||||
<th>Fecha</th>
|
||||
@role('admin')<th>Acciones</th>@endrole
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($rutas as $ruta)
|
||||
<th>{{ $ruta->ruta }}</th>
|
||||
<th>{{ $ruta->prefijo }}</th>
|
||||
<th>{{ $ruta->created_at }}</th>
|
||||
@role('admin')
|
||||
<th>
|
||||
<button wire:click="edit({{ $ruta->id }})" class="btn btn-sm btn-primary">Editar</button>
|
||||
<button wire:click="delete({{ $ruta->id }})" class="btn btn-sm btn-error">Eliminar</button>
|
||||
</th>
|
||||
@endrole
|
||||
</tr>
|
||||
@empty
|
||||
{{$rutas->links()}}
|
||||
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
<span>No hay rutas registradas en el sistema.</span>
|
||||
</div>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{$rutas->links()}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modal" id="modal-1" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal-overlay" for="modal-1"></label>
|
||||
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Registrar Ruta</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="ruta" class="form-label font-bold">Nombre Ruta:</label>
|
||||
<input id="ruta" wire:model="ruta.ruta" type="text" placeholder="Ingresa nombre de la ruta" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ruta.ruta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="ruta" class="form-label font-bold">Prefijo:</label>
|
||||
<input id="ruta" wire:model="ruta.prefijo" type="text" placeholder="Ingresa prefijo de la ruta" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ruta.prefijo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="save()" class="btn btn-success btn-block input-enter">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,12 @@
|
||||
<th>{{$cancelacion->motivo}}</th>
|
||||
<th>{{$cancelacion->user->name}}</th>
|
||||
<th>{{$cancelacion->created_at}}</th>
|
||||
@role('admin') <th><button wire:click="delete({{ $cancelacion->id }})" class="btn btn-sm btn-error">Eliminar</button></th> @endrole
|
||||
@role('admin')
|
||||
<th>
|
||||
<button wire:click="editDate({{ $cancelacion->id }})" class="btn btn-sm btn-primary">Editar Fecha</button>
|
||||
<button wire:click="delete({{ $cancelacion->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">
|
||||
@@ -72,7 +77,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo" wire:model="cancelacion.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
<input id="codigo" wire:model="cancelacion.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('cancelacion.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -80,7 +85,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="cancelacion.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full" />
|
||||
<input id="efectivo" wire:model="cancelacion.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('cancelacion.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -89,7 +94,7 @@
|
||||
<div class="form-field">
|
||||
<label for="motivo" class="form-label font-bold">Motivo:</label>
|
||||
{{-- <input id="motivo" wire:model="cancelacion.motivo" type="text" placeholder="Motivo de cancelacion" class="input max-w-full" /> --}}
|
||||
<textarea id="motivo" wire:model="cancelacion.motivo" class="textarea-block textarea" placeholder="Motivo de cancelacion" ></textarea>
|
||||
<textarea id="motivo" wire:model="cancelacion.motivo" class="textarea-block textarea input-enter" placeholder="Motivo de cancelacion" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@error('cancelacion.motivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -99,4 +104,26 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modalDate" id="modal-2" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal-overlay" for="modal-2"></label>
|
||||
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||
<label for="modal-2" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Cambiar Fecha de Cancelacion</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="fecha" class="form-label font-bold">Fecha Cancelacion:</label>
|
||||
<input id="fecha" wire:model="created_at" type="datetime-local" placeholder="Fecha Cancelacion" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('created_at')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="saveDate()" class="btn btn-success btn-block input-enter">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<th>Pago Efectivo</th>
|
||||
<th>Pago Tarjeta</th>
|
||||
<th>Pago Tarjeta Vales</th>
|
||||
<th>Pago Nota Credito</th>
|
||||
<th>Pago Transferencia</th>
|
||||
<th>Total a pagar</th>
|
||||
<th>Registrado por</th>
|
||||
@@ -46,6 +47,7 @@
|
||||
<th>{{ $venta->pago_efectivo }}</th>
|
||||
<th>{{ $venta->pago_tarjeta }}</th>
|
||||
<th>{{ $venta->pago_vales }}</th>
|
||||
<th>{{ $venta->nota_credito }}</th>
|
||||
<th>{{ $venta->pago_transferencia }}</th>
|
||||
<th>{{ $venta->precio_venta }}</th>
|
||||
<th>{{ $venta->user->name }}</th>
|
||||
@@ -56,7 +58,10 @@
|
||||
@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
|
||||
@role('admin')
|
||||
<button wire:click="editDate({{ $venta->id }})" class="btn btn-sm btn-primary">Editar Fecha</button>
|
||||
<button wire:click="delete({{ $venta->id }})" class="btn btn-sm btn-error">Eliminar</button>
|
||||
@endrole
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@@ -86,7 +91,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo" wire:model="ventaEspecial.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
<input id="codigo" wire:model="ventaEspecial.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -94,7 +99,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Precio Total:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||
<input id="vales" wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -102,7 +107,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full" />
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -110,7 +115,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -118,7 +123,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -126,11 +131,19 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Nota Credito:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.nota_credito" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.nota_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||
</div>
|
||||
@@ -157,7 +170,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Codigo:</label>
|
||||
<input disabled id="codigo" wire:model="ventaEspecial.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
<input disabled id="codigo" wire:model="ventaEspecial.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -165,7 +178,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full" />
|
||||
<input id="efectivo" wire:model="ventaEspecial.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -173,7 +186,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta" class="input max-w-full" />
|
||||
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -181,7 +194,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -189,15 +202,23 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||
<input id="vales" wire:model="ventaEspecial.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="n-credito" class="form-label font-bold">Nota Credito:</label>
|
||||
<input id="n-credito" wire:model="ventaEspecial.nota_credito" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.nota_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Precio Total:</label>
|
||||
<input id="vales" disabled wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||
<input id="vales" disabled wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('ventaEspecial.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -213,4 +234,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modalDate" id="modal-3" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal-overlay" for="modal-3"></label>
|
||||
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||
<label for="modal-3" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Cambiar Fecha de Venta Especial</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="fecha" class="form-label font-bold">Fecha Venta Especial:</label>
|
||||
<input id="fecha" wire:model="created_at" type="datetime-local" placeholder="Fecha venta especial" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('created_at')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="saveDate()" class="btn btn-success btn-block input-enter">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<th>Pago Efectivo</th>
|
||||
<th>Pago Tarjeta</th>
|
||||
<th>Pago Tarjeta Vales</th>
|
||||
<th>Pago Nota Credito</th>
|
||||
<th>Pago Transferencia</th>
|
||||
<th>Total Venta</th>
|
||||
<th>Registrado por</th>
|
||||
@@ -45,11 +46,17 @@
|
||||
<th>{{ $venta->pago_efectivo }}</th>
|
||||
<th>{{ $venta->pago_tarjeta }}</th>
|
||||
<th>{{ $venta->pago_vales }}</th>
|
||||
<th>{{ $venta->nota_credito }}</th>
|
||||
<th>{{ $venta->pago_transferencia }}</th>
|
||||
<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
|
||||
@role('admin')
|
||||
<th>
|
||||
<button wire:click="editDate({{ $venta->id }})" class="btn btn-sm btn-primary">Editar Fecha</button>
|
||||
<button wire:click="delete({{ $venta->id }})" class="btn btn-sm btn-error">Eliminar</button>
|
||||
</th>
|
||||
@endrole
|
||||
</tr>
|
||||
@empty
|
||||
{{$ventas->links()}}
|
||||
@@ -82,7 +89,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="codigo" class="form-label font-bold">Codigo:</label>
|
||||
<input id="codigo" wire:model="venta.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full" />
|
||||
<input id="codigo" wire:model="venta.codigo" type="text" placeholder="Codigo de venta o folio" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -90,7 +97,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="precio_venta" class="form-label font-bold">Precio Venta:</label>
|
||||
<input id="precio_venta" wire:model="venta.precio_venta" type="number" step="any" placeholder="Pago total de los productos" class="input max-w-full" />
|
||||
<input id="precio_venta" wire:model="venta.precio_venta" type="number" step="any" placeholder="Pago total de los productos" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -98,7 +105,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||
<input id="efectivo" wire:model="venta.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full" />
|
||||
<input id="efectivo" wire:model="venta.pago_efectivo" type="number" step="any" placeholder="Pago en efectivo" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.pago_efectivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -106,7 +113,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||
<input id="tarjeta" wire:model="venta.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de credito o debito" class="input max-w-full" />
|
||||
<input id="tarjeta" wire:model="venta.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de credito o debito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -114,7 +121,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||
<input id="pago_transferencia" wire:model="venta.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||
<input id="pago_transferencia" wire:model="venta.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
@@ -122,18 +129,49 @@
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
||||
<input id="vales" wire:model="venta.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||
<input id="vales" wire:model="venta.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="vales" class="form-label font-bold">Nota Credito:</label>
|
||||
<input id="vales" wire:model="venta.nota_credito" type="number" step="any" placeholder="Pago con nota de credito" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('venta.nota_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
@if (session()->has('error'))
|
||||
<span class="block text-lg mx-auto text-error">{{ session('error') }}</span>
|
||||
@endif
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||
<button wire:click="save()" class="btn btn-success btn-block input-enter">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="modal-state" wire:model.defer="modalDate" id="modal-2" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal-overlay" for="modal-2"></label>
|
||||
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||
<label for="modal-2" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||
|
||||
<h3 class="font-bold text-lg">Cambiar Fecha de Venta</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-field">
|
||||
<label for="fecha" class="form-label font-bold">Fecha Venta:</label>
|
||||
<input id="fecha" wire:model="created_at" type="datetime-local" placeholder="Fecha venta especial" class="input max-w-full input-enter" />
|
||||
</div>
|
||||
</div>
|
||||
@error('created_at')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button wire:click="saveDate()" class="btn btn-success btn-block input-enter">Guardar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
|
||||
use App\Http\Livewire\CancelacionController;
|
||||
use App\Http\Livewire\DashboardController;
|
||||
use App\Http\Livewire\ImpresoraController;
|
||||
use App\Http\Livewire\PedidoController;
|
||||
use App\Http\Livewire\ReporteController;
|
||||
use App\Http\Livewire\ReportePedidoController;
|
||||
use App\Http\Livewire\RutaController;
|
||||
use App\Http\Livewire\UserController;
|
||||
use App\Http\Livewire\VentaController;
|
||||
use App\Http\Livewire\VentaEspecialController;
|
||||
@@ -35,6 +39,8 @@ Route::middleware([
|
||||
Route::get('/venta',VentaController::class)->name('venta');
|
||||
Route::get('/venta-especial',VentaEspecialController::class)->name('venta-especial');
|
||||
Route::get('/cancelacion',CancelacionController::class)->name('cancelacion');
|
||||
Route::get('/pedido',PedidoController::class)->name('pedido');
|
||||
Route::get('/configuracion-impresora',ImpresoraController::class)->name('impresora');
|
||||
});
|
||||
|
||||
Route::middleware([
|
||||
@@ -50,6 +56,16 @@ Route::middleware([
|
||||
'role:admin'
|
||||
])->group(function(){
|
||||
|
||||
Route::get('/reporte',ReporteController::class)->name('reporte');
|
||||
Route::get('/reporte-ventas',ReporteController::class)->name('reporte-ventas');
|
||||
Route::get('/rutas',RutaController::class)->name('rutas');
|
||||
Route::get('/usuarios',UserController::class)->name('usuarios');
|
||||
});
|
||||
|
||||
Route::middleware([
|
||||
'auth:sanctum',
|
||||
config('jetstream.auth_session'),
|
||||
'verified',
|
||||
'role:admin|compras'
|
||||
])->group(function(){
|
||||
Route::get('/reporte-pedidos',ReportePedidoController::class)->name('reporte-pedidos');
|
||||
});
|
||||
Reference in New Issue
Block a user