mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en la lista de envios proximos
This commit is contained in:
@ -871,6 +871,7 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi
|
|||||||
$routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio');
|
$routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio');
|
||||||
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
|
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
|
||||||
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
|
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
|
||||||
|
$routes->post('ficharEmbalaje', 'LogisticaController::ficharEmbalaje');
|
||||||
|
|
||||||
$routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']);
|
$routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -132,6 +132,8 @@ class LogisticaController extends BaseController
|
|||||||
|
|
||||||
$result = $query->orderBy("name", "asc")->get()->getResultObject();
|
$result = $query->orderBy("name", "asc")->get()->getResultObject();
|
||||||
|
|
||||||
|
$query = model('App\Models\Logistica\EnvioModel')->db->getLastQuery();
|
||||||
|
|
||||||
return $this->response->setJSON($result);
|
return $this->response->setJSON($result);
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
@ -392,6 +394,17 @@ class LogisticaController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ficharEmbalaje()
|
||||||
|
{
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
|
$ids = $this->request->getPost('ids') ?? [];
|
||||||
|
$result = LogisticaService::ficharEmbalaje($ids);
|
||||||
|
return $this->response->setJSON($result);
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function datatable_enviosEdit($idEnvio)
|
public function datatable_enviosEdit($idEnvio)
|
||||||
{
|
{
|
||||||
@ -406,6 +419,12 @@ class LogisticaController extends BaseController
|
|||||||
return '<input type="checkbox" class="form-check-input checkbox-linea-envio" name="row_selected[]" value="' . $q->id . '">';
|
return '<input type="checkbox" class="form-check-input checkbox-linea-envio" name="row_selected[]" value="' . $q->id . '">';
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
->edit(
|
||||||
|
"ordenTrabajo",
|
||||||
|
function ($row, $meta) {
|
||||||
|
return '<a href="' . base_url('produccion/ordentrabajo/edit/' . $row->ordenTrabajo) . '" target="_blank">' . $row->ordenTrabajo . '</a>';
|
||||||
|
}
|
||||||
|
)
|
||||||
->edit(
|
->edit(
|
||||||
"pedido",
|
"pedido",
|
||||||
function ($row, $meta) {
|
function ($row, $meta) {
|
||||||
|
|||||||
@ -44,6 +44,7 @@ return [
|
|||||||
'totales' => 'Totales',
|
'totales' => 'Totales',
|
||||||
'cajas' => 'Cajas',
|
'cajas' => 'Cajas',
|
||||||
|
|
||||||
|
'ordenTrabajo' => 'OT',
|
||||||
'pedido' => 'Pedido',
|
'pedido' => 'Pedido',
|
||||||
'presupuesto' => 'Presupuesto',
|
'presupuesto' => 'Presupuesto',
|
||||||
'unidadesEnvio' => 'Unidades envío',
|
'unidadesEnvio' => 'Unidades envío',
|
||||||
@ -62,6 +63,7 @@ return [
|
|||||||
|
|
||||||
'codigoSeguimiento' => 'Código de seguimiento',
|
'codigoSeguimiento' => 'Código de seguimiento',
|
||||||
'empresaMensajería' => 'Empresa de mensajería',
|
'empresaMensajería' => 'Empresa de mensajería',
|
||||||
|
'ficharEmbalaje' => 'Fichar embalaje',
|
||||||
'finalizarEnvio' => 'Finalizar envío',
|
'finalizarEnvio' => 'Finalizar envío',
|
||||||
'finalizarEnvioYOTs' => 'Finalizar envío y OTS',
|
'finalizarEnvioYOTs' => 'Finalizar envío y OTS',
|
||||||
|
|
||||||
@ -90,6 +92,7 @@ return [
|
|||||||
'errorInsertarEtiqueta' => 'Error al insertar la etiqueta',
|
'errorInsertarEtiqueta' => 'Error al insertar la etiqueta',
|
||||||
'noEtiqueta' => 'No se ha encontrado la etiqueta',
|
'noEtiqueta' => 'No se ha encontrado la etiqueta',
|
||||||
'noEtiquetaLineas' => 'No se han encontrado líneas de etiqueta',
|
'noEtiquetaLineas' => 'No se han encontrado líneas de etiqueta',
|
||||||
|
'noLineas' => 'No se ha seleccionado ninguna línea',
|
||||||
],
|
],
|
||||||
'success' => [
|
'success' => [
|
||||||
'finalizado' => 'El envío se ha finalizado correctamente',
|
'finalizado' => 'El envío se ha finalizado correctamente',
|
||||||
@ -101,6 +104,7 @@ return [
|
|||||||
'comentariosUpdated' => 'Comentarios actualizados correctamente',
|
'comentariosUpdated' => 'Comentarios actualizados correctamente',
|
||||||
'successReordenarCajas' => 'Cajas reordenadas correctamente',
|
'successReordenarCajas' => 'Cajas reordenadas correctamente',
|
||||||
'imprimirEtiquetas' => 'Etiquetas impresas correctamente',
|
'imprimirEtiquetas' => 'Etiquetas impresas correctamente',
|
||||||
|
'successFicharEmbalaje' => 'Embalaje fichado correctamente',
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
@ -182,6 +182,7 @@ return [
|
|||||||
'duplicate_estado_tarea_progress' => "Último estado de la tarea repetido",
|
'duplicate_estado_tarea_progress' => "Último estado de la tarea repetido",
|
||||||
'task_already_finished' => "La tarea se ha marcado como finalizada.",
|
'task_already_finished' => "La tarea se ha marcado como finalizada.",
|
||||||
'print_label' => "Imprimir etiqueta",
|
'print_label' => "Imprimir etiqueta",
|
||||||
|
'fichar_embalaje' => "Fichar embalaje",
|
||||||
'click_init' => "Clicks al inicio",
|
'click_init' => "Clicks al inicio",
|
||||||
'click_end' => "Clicks al final",
|
'click_end' => "Clicks al final",
|
||||||
"comentarios" => "Comentarios",
|
"comentarios" => "Comentarios",
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class EnvioLineaModel extends Model
|
|||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto,
|
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto, t4.id as ordenTrabajo,
|
||||||
t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw,
|
t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw,
|
||||||
t1.unidades_total as unidadesTotal, t2.tipo_envio as tipo_envio,
|
t1.unidades_total as unidadesTotal, t2.tipo_envio as tipo_envio,
|
||||||
IFNULL((
|
IFNULL((
|
||||||
@ -59,6 +59,7 @@ class EnvioLineaModel extends Model
|
|||||||
);
|
);
|
||||||
$builder->join("envios t2", "t1.envio_id = t2.id", "left");
|
$builder->join("envios t2", "t1.envio_id = t2.id", "left");
|
||||||
$builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left");
|
$builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left");
|
||||||
|
$builder->join("ordenes_trabajo t4", "t1.pedido_id = t4.pedido_id", "left");
|
||||||
|
|
||||||
$builder->where("t1.envio_id", $envio_id);
|
$builder->where("t1.envio_id", $envio_id);
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class LogisticaService
|
|||||||
->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id')
|
->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id')
|
||||||
->whereIn('pr.id', $presupuestoIds)
|
->whereIn('pr.id', $presupuestoIds)
|
||||||
->whereIn('p.estado', ['finalizado', 'produccion'])
|
->whereIn('p.estado', ['finalizado', 'produccion'])
|
||||||
->where('ot_dates.embalaje_at IS NOT NULL')
|
->where('p.fecha_encuadernado IS NOT NULL')
|
||||||
|
->where('DATE(p.fecha_encuadernado) <=', date('Y-m-d'))
|
||||||
->where("NOT EXISTS (
|
->where("NOT EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM envios_lineas el
|
FROM envios_lineas el
|
||||||
@ -103,16 +104,15 @@ class LogisticaService
|
|||||||
->join('presupuestos pr', 'pr.id = pl.presupuesto_id')
|
->join('presupuestos pr', 'pr.id = pl.presupuesto_id')
|
||||||
->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id')
|
->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id')
|
||||||
->join('ordenes_trabajo ot', 'ot.pedido_id = p.id')
|
->join('ordenes_trabajo ot', 'ot.pedido_id = p.id')
|
||||||
->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id')
|
|
||||||
->whereIn('p.estado', ['finalizado', 'produccion'])
|
->whereIn('p.estado', ['finalizado', 'produccion'])
|
||||||
->where('ot_dates.embalaje_at IS NOT NULL')
|
->where('p.fecha_encuadernado IS NOT NULL')
|
||||||
|
->where('DATE(p.fecha_encuadernado) <=', date('Y-m-d'))
|
||||||
->groupBy('pl.id');
|
->groupBy('pl.id');
|
||||||
|
|
||||||
// 4. Envolver y filtrar por unidades pendientes
|
// 4. Envolver y filtrar por unidades pendientes
|
||||||
$builder = $db->table("({$subBuilder->getCompiledSelect(false)}) AS sub");
|
$builder = $db->table("({$subBuilder->getCompiledSelect(false)}) AS sub");
|
||||||
$builder->select('id, name');
|
$builder->select('id, name');
|
||||||
$builder->where('cantidad > unidades_enviadas');
|
$builder->where('cantidad > unidades_enviadas');
|
||||||
$builder->orderBy('name', 'ASC');
|
|
||||||
|
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
@ -539,6 +539,13 @@ class LogisticaService
|
|||||||
$ot = $otModel->where('pedido_id', $linea->pedido_id)
|
$ot = $otModel->where('pedido_id', $linea->pedido_id)
|
||||||
->first();
|
->first();
|
||||||
$ps = (new ProductionService())->init($ot->id);
|
$ps = (new ProductionService())->init($ot->id);
|
||||||
|
$date = $ps->getOrdenTrabajo()->dates()->embalaje_at;
|
||||||
|
if (is_null($date) || empty($date)) {
|
||||||
|
$ps->updateOrdenTrabajoDate([
|
||||||
|
"name" => "embalaje_at",
|
||||||
|
"embalaje_at" => date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
}
|
||||||
$ps->updateOrdenTrabajoDate([
|
$ps->updateOrdenTrabajoDate([
|
||||||
"name" => "envio_at",
|
"name" => "envio_at",
|
||||||
"envio_at" => date('Y-m-d H:i:s')
|
"envio_at" => date('Y-m-d H:i:s')
|
||||||
@ -572,6 +579,29 @@ class LogisticaService
|
|||||||
return $data_return;
|
return $data_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ficharEmbalaje($ids = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_null($ids) || empty($ids) || count($ids) == 0) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => lang('Logistica.errors.noLineas'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($index = 0; $index < count($ids); $index++) {
|
||||||
|
$ps = (new ProductionService())->init($ids[$index]);
|
||||||
|
$ps->updateOrdenTrabajoDate([
|
||||||
|
"name" => "embalaje_at",
|
||||||
|
"embalaje_at" => date('Y-m-d')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'status' => true,
|
||||||
|
'message' => lang('Logistica.success.successFicharEmbalaje'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public static function generateEtiquetasTitulos($envio, $lineas, $printer, $cajas)
|
public static function generateEtiquetasTitulos($envio, $lineas, $printer, $cajas)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4><?= $boxTitle ?>
|
<h4><?= $boxTitle ?>
|
||||||
<?= ($envioEntity->tipo_envio == 'ferro_prototipo') ? '<span class="badge text-bg-warning fw-lg">FERRO</span>':'' ?>
|
<?= ($envioEntity->tipo_envio == 'ferro_prototipo') ? '<span class="badge text-bg-warning fw-lg">FERRO</span>' : '' ?>
|
||||||
<?= ($envioEntity->finalizado == 0) ? '' : '<span class="badge text-bg-success fw-lg">FINALIZADO</span>' ?>
|
<?= ($envioEntity->finalizado == 0) ? '' : '<span class="badge text-bg-success fw-lg">FINALIZADO</span>' ?>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
@ -114,7 +114,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>
|
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio == 'estandar'): ?>
|
||||||
<div class="accordion accordion-bordered">
|
<div class="accordion accordion-bordered">
|
||||||
<div class="card accordion-item active mb-5">
|
<div class="card accordion-item active mb-5">
|
||||||
<h4 class="accordion-header px-4 py-3">
|
<h4 class="accordion-header px-4 py-3">
|
||||||
@ -130,6 +130,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex flex-row mb-3">
|
<div class="d-flex flex-row mb-3">
|
||||||
|
|
||||||
<div class="col-sm-6 px-3">
|
<div class="col-sm-6 px-3">
|
||||||
<label for="buscadorPedidos" class="form-label">
|
<label for="buscadorPedidos" class="form-label">
|
||||||
<?= lang("Logistica.buscadorPedidosTitle2") ?>
|
<?= lang("Logistica.buscadorPedidosTitle2") ?>
|
||||||
@ -145,229 +146,261 @@
|
|||||||
<ti class="ti ti-circle-plus"></ti>
|
<ti class="ti ti-circle-plus"></ti>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
<div class="col-sm-4 px-3">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
|
<div id="proximosEnvios" class="card overflow-hidden" style="height: 100px; ">
|
||||||
<div class="accordion accordion-bordered">
|
<div>Java</div>
|
||||||
<div class="card accordion-item active mb-5">
|
<div>PHP</div>
|
||||||
<h4 class="accordion-header px-4 py-3">
|
<div>Lua</div>
|
||||||
<?= lang("Logistica.lineasEnvio") ?>
|
<div>SQL</div>
|
||||||
</h4>
|
<div>Java</div>
|
||||||
|
<div>PHP</div>
|
||||||
<div id="accordionDatosEnvioTip" class="accordion-collapse collapse show">
|
<div>Lua</div>
|
||||||
<div class="accordion-body px-4 py-3">
|
<div>SQL</div>
|
||||||
<div class="d-flex flex-row">
|
<div>Java</div>
|
||||||
<p><?= lang('Logistica.buttonsActions') ?></p>
|
<div>PHP</div>
|
||||||
</div>
|
<div>Lua</div>
|
||||||
<div class="d-flex flex-row mb-3 align-items-end">
|
<div>SQL</div>
|
||||||
<div class="col-sm-2 px-3">
|
<div>Java</div>
|
||||||
<button id="btnSelectAll" name="btnSelectAll" tabindex="1"
|
<div>PHP</div>
|
||||||
class="btn btn-primary w-100">
|
<div>Lua</div>
|
||||||
<?= lang("Logistica.selectAll") ?>
|
<div>SQL</div>
|
||||||
<i class="ti ti-select"></i>
|
<!-- ... -->
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>
|
|
||||||
<div class="col-sm-2 px-3">
|
|
||||||
<button id="btnEliminarLineas" name="btnEliminarLineas" tabindex="1"
|
|
||||||
class="btn btn-danger w-100">
|
|
||||||
<?= lang("Logistica.eliminar") ?>
|
|
||||||
<i class="ti ti-trash"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="col-sm-2 px-3">
|
|
||||||
<button id="btnGenerarAlbaran" name="btnGenerarAlbaran" tabindex="1"
|
|
||||||
class="btn btn-success w-100">
|
|
||||||
<?= lang("Logistica.generarAlbaran") ?>
|
|
||||||
<i class="ti ti-file-check"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2 px-3">
|
|
||||||
<button id="btnImprimirEtiquetas" name="btnImprimirEtiquetas" tabindex="1"
|
|
||||||
class="btn btn-info w-100">
|
|
||||||
<?= lang("Logistica.imprimirEtiquetas") ?>
|
|
||||||
<i class="ti ti-printer"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-2 px-3 d-flex flex-column justify-content-end">
|
|
||||||
<div class="d-flex flex-column justify-content-end h-100">
|
|
||||||
<label for="impresoraEtiquetas" class="form-label">
|
|
||||||
<?= lang("Logistica.impresoraEtiquetas") ?>
|
|
||||||
</label>
|
|
||||||
<select id="impresoraEtiquetas" name="impresora_etiquetas" tabindex="1"
|
|
||||||
maxlength="50" class="form-control select2bs2" style="width: 100%;">
|
|
||||||
<?php foreach ($envioEntity->impresoras as $impresora): ?>
|
|
||||||
<option value="<?= $impresora->id ?>">
|
|
||||||
<?= $impresora->name ?>
|
|
||||||
</option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row mb-3">
|
|
||||||
|
|
||||||
<table id="tableLineasEnvio" class="table table-striped table-hover w-100">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th><?= lang("Logistica.pedido") ?></th>
|
|
||||||
<th><?= lang("Logistica.presupuesto") ?></th>
|
|
||||||
<th><?= lang("Logistica.titulo") ?></th>
|
|
||||||
<th class="text-center" style="width: 10%;">
|
|
||||||
<?= lang("Logistica.unidadesEnvio") ?>
|
|
||||||
</th>
|
|
||||||
<th class="text-center" style="width: 10%;">
|
|
||||||
<?= lang("Logistica.unidadesEnviadas") ?>
|
|
||||||
</th>
|
|
||||||
<th class="text-center" style="width: 10%;">
|
|
||||||
<?= lang("Logistica.unidadesTotales") ?>
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<th colspan="10">
|
|
||||||
<div class="text-end">
|
|
||||||
<?= lang("Logistica.unidadesTotalesFooter") ?>
|
|
||||||
<span id="footer-unidades-envio"></span>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="10">
|
|
||||||
<div class="text-end">
|
|
||||||
<?= lang("Logistica.peso") ?>
|
|
||||||
<span id="footer-peso"></span>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="col-sm-2 px-3">
|
|
||||||
<label for="cajas" class="form-label">
|
|
||||||
<?= lang("Logistica.cajas") ?>
|
|
||||||
</label>
|
|
||||||
<input type="number" id="cajas" name="cajas" tabindex="1" maxlength="50"
|
|
||||||
class="form-control" value="<?= old('cajas', $envioEntity->cajas) ?>">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="accordion accordion-bordered mt-3 mb-5" id="accordioAlbaranes">
|
|
||||||
|
|
||||||
<div class="card accordion-item active">
|
|
||||||
<h2 class="accordion-header" id="headingAlbaranes">
|
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse"
|
|
||||||
data-bs-target="#accordionAlbaranesTip" aria-expanded="false"
|
|
||||||
aria-controls="accordionAlbaranesTip">
|
|
||||||
<h3><?= lang("Pedidos.albaranes") ?></h3>
|
|
||||||
</button>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show"
|
|
||||||
data-bs-parent="#accordioAlbaranes">
|
|
||||||
<div id="contenedorAlbaranes" class="accordion-body">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="accordion accordion-bordered">
|
<div class="accordion accordion-bordered">
|
||||||
<div class="card accordion-item active mb-5">
|
<div class="card accordion-item active mb-5">
|
||||||
<h4 class="accordion-header px-4 py-3">
|
<h4 class="accordion-header px-4 py-3">
|
||||||
<?= lang("Logistica.acciones") ?>
|
<?= lang("Logistica.lineasEnvio") ?>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div class="d-flex flex-row mb-3">
|
<div id="accordionDatosEnvioTip" class="accordion-collapse collapse show">
|
||||||
<div class="col-sm-3 px-3">
|
<div class="accordion-body px-4 py-3">
|
||||||
<label for="codigoSeguimiento" class="form-label">
|
<div class="d-flex flex-row">
|
||||||
<?= lang("Logistica.codigoSeguimiento") ?>
|
<p><?= lang('Logistica.buttonsActions') ?></p>
|
||||||
</label>
|
|
||||||
<input type="text" id="codigoSeguimiento" name="codigo_seguimiento" tabindex="1"
|
|
||||||
maxlength="100" class="form-control" <?= ($envioEntity->finalizado == 0) ? '' : 'readonly' ?>
|
|
||||||
value="<?= esc(old('codigo_seguimiento', $envioEntity->codigo_seguimiento)) ?>">
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-3 px-3">
|
|
||||||
<label for="empresaMensajeria" class="form-label">
|
|
||||||
<?= lang("Logistica.empresaMensajería") ?>
|
|
||||||
</label>
|
|
||||||
<?php if ($envioEntity->finalizado == 0): ?>
|
|
||||||
<select id="empresaMensajeria" name="empresa_mensajeria" tabindex="1" maxlength="50"
|
|
||||||
class="form-control select2bs2" style="width: 100%;">
|
|
||||||
<?php if ($envioEntity->proveedor_id): ?>
|
|
||||||
<option value="<?= $envioEntity->proveedor_id ?>" "selected">
|
|
||||||
<?= $envioEntity->proveedor_nombre ?>
|
|
||||||
</option>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
<?php else: ?>
|
|
||||||
<input type="text" id="empresaMensajeriaInput" name="empresa_mensajeria_input"
|
|
||||||
tabindex="1" maxlength="100" class="form-control" readonly
|
|
||||||
value="<?= old('empresa_mensajeria', $envioEntity->proveedor_nombre) ?>">
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php if ($envioEntity->finalizado == 0): ?>
|
|
||||||
<div class="col-sm-3 px-3">
|
|
||||||
<button id="finalizarEnvio" name="finalizar_envio" tabindex="1"
|
|
||||||
class="btn btn-primary mt-4 w-100 btn-finalizar">
|
|
||||||
<?= lang("Logistica.finalizarEnvio") ?>
|
|
||||||
<ti class="ti ti-check"></ti>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<?php if ($envioEntity->tipo_envio=='estandar'): ?>
|
<div class="d-flex flex-row mb-3 align-items-end">
|
||||||
<div class="col-sm-3 px-3">
|
<div class="col-sm-2 px-3">
|
||||||
<button id="finalizarEnvioYOTs" name="finalizar_envio_ots" tabindex="1"
|
<button id="btnSelectAll" name="btnSelectAll" tabindex="1"
|
||||||
class="btn btn-primary mt-4 w-100 btn-finalizar">
|
class="btn btn-primary w-100">
|
||||||
<?= lang("Logistica.finalizarEnvioYOTs") ?>
|
<?= lang("Logistica.selectAll") ?>
|
||||||
<ti class="ti ti-checks"></ti>
|
<i class="ti ti-select"></i>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php if ($envioEntity->finalizado == 0 && $envioEntity->tipo_envio == 'estandar'): ?>
|
||||||
|
<div class="col-sm-2 px-3">
|
||||||
|
<button id="btnEliminarLineas" name="btnEliminarLineas" tabindex="1"
|
||||||
|
class="btn btn-danger w-100">
|
||||||
|
<?= lang("Logistica.eliminar") ?>
|
||||||
|
<i class="ti ti-trash"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="col-sm-2 px-3">
|
||||||
|
<button id="btnGenerarAlbaran" name="btnGenerarAlbaran" tabindex="1"
|
||||||
|
class="btn btn-success w-100">
|
||||||
|
<?= lang("Logistica.generarAlbaran") ?>
|
||||||
|
<i class="ti ti-file-check"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 px-3">
|
||||||
|
<button id="ficharEmbalaje" name="fichar_embalaje" tabindex="1"
|
||||||
|
class="btn btn-primary mt-4 w-100 btn-finalizar">
|
||||||
|
<?= lang("Logistica.ficharEmbalaje") ?>
|
||||||
|
<ti class="ti ti-check"></ti>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 px-3">
|
||||||
|
<button id="btnImprimirEtiquetas" name="btnImprimirEtiquetas" tabindex="1"
|
||||||
|
class="btn btn-info w-100">
|
||||||
|
<?= lang("Logistica.imprimirEtiquetas") ?>
|
||||||
|
<i class="ti ti-printer"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-2 px-3 d-flex flex-column justify-content-end">
|
||||||
|
<div class="d-flex flex-column justify-content-end h-100">
|
||||||
|
<label for="impresoraEtiquetas" class="form-label">
|
||||||
|
<?= lang("Logistica.impresoraEtiquetas") ?>
|
||||||
|
</label>
|
||||||
|
<select id="impresoraEtiquetas" name="impresora_etiquetas" tabindex="1"
|
||||||
|
maxlength="50" class="form-control select2bs2" style="width: 100%;">
|
||||||
|
<?php foreach ($envioEntity->impresoras as $impresora): ?>
|
||||||
|
<option value="<?= $impresora->id ?>">
|
||||||
|
<?= $impresora->name ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<div class="row mb-3">
|
||||||
<?php endif; ?>
|
|
||||||
|
<table id="tableLineasEnvio" class="table table-striped table-hover w-100">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th><?= lang("Logistica.ordenTrabajo") ?></th>
|
||||||
|
<th><?= lang("Logistica.pedido") ?></th>
|
||||||
|
<th><?= lang("Logistica.presupuesto") ?></th>
|
||||||
|
<th><?= lang("Logistica.titulo") ?></th>
|
||||||
|
<th class="text-center" style="width: 10%;">
|
||||||
|
<?= lang("Logistica.unidadesEnvio") ?>
|
||||||
|
</th>
|
||||||
|
<th class="text-center" style="width: 10%;">
|
||||||
|
<?= lang("Logistica.unidadesEnviadas") ?>
|
||||||
|
</th>
|
||||||
|
<th class="text-center" style="width: 10%;">
|
||||||
|
<?= lang("Logistica.unidadesTotales") ?>
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11">
|
||||||
|
<div class="text-end">
|
||||||
|
<?= lang("Logistica.unidadesTotalesFooter") ?>
|
||||||
|
<span id="footer-unidades-envio"></span>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11">
|
||||||
|
<div class="text-end">
|
||||||
|
<?= lang("Logistica.peso") ?>
|
||||||
|
<span id="footer-peso"></span>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="col-sm-2 px-3">
|
||||||
|
<label for="cajas" class="form-label">
|
||||||
|
<?= lang("Logistica.cajas") ?>
|
||||||
|
</label>
|
||||||
|
<input type="number" id="cajas" name="cajas" tabindex="1" maxlength="50"
|
||||||
|
class="form-control" value="<?= old('cajas', $envioEntity->cajas) ?>">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="accordion accordion-bordered mt-3 mb-5" id="accordioAlbaranes">
|
||||||
|
|
||||||
|
<div class="card accordion-item active">
|
||||||
|
<h2 class="accordion-header" id="headingAlbaranes">
|
||||||
|
<button type="button" class="accordion-button" data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#accordionAlbaranesTip" aria-expanded="false"
|
||||||
|
aria-controls="accordionAlbaranesTip">
|
||||||
|
<h3><?= lang("Pedidos.albaranes") ?></h3>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show"
|
||||||
|
data-bs-parent="#accordioAlbaranes">
|
||||||
|
<div id="contenedorAlbaranes" class="accordion-body">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="accordion accordion-bordered">
|
||||||
|
<div class="card accordion-item active mb-5">
|
||||||
|
<h4 class="accordion-header px-4 py-3">
|
||||||
|
<?= lang("Logistica.acciones") ?>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div class="d-flex flex-row mb-3">
|
||||||
|
<div class="col-sm-3 px-3">
|
||||||
|
<label for="codigoSeguimiento" class="form-label">
|
||||||
|
<?= lang("Logistica.codigoSeguimiento") ?>
|
||||||
|
</label>
|
||||||
|
<input type="text" id="codigoSeguimiento" name="codigo_seguimiento" tabindex="1"
|
||||||
|
maxlength="100" class="form-control" <?= ($envioEntity->finalizado == 0) ? '' : 'readonly' ?>
|
||||||
|
value="<?= esc(old('codigo_seguimiento', $envioEntity->codigo_seguimiento)) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3 px-3">
|
||||||
|
<label for="empresaMensajeria" class="form-label">
|
||||||
|
<?= lang("Logistica.empresaMensajería") ?>
|
||||||
|
</label>
|
||||||
|
<?php if ($envioEntity->finalizado == 0): ?>
|
||||||
|
<select id="empresaMensajeria" name="empresa_mensajeria" tabindex="1"
|
||||||
|
maxlength="50" class="form-control select2bs2" style="width: 100%;">
|
||||||
|
<?php if ($envioEntity->proveedor_id): ?>
|
||||||
|
<option value="<?= $envioEntity->proveedor_id ?>" "selected">
|
||||||
|
<?= $envioEntity->proveedor_nombre ?>
|
||||||
|
</option>
|
||||||
|
<?php endif; ?>
|
||||||
|
</select>
|
||||||
|
<?php else: ?>
|
||||||
|
<input type="text" id="empresaMensajeriaInput" name="empresa_mensajeria_input"
|
||||||
|
tabindex="1" maxlength="100" class="form-control" readonly
|
||||||
|
value="<?= old('empresa_mensajeria', $envioEntity->proveedor_nombre) ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php if ($envioEntity->finalizado == 0): ?>
|
||||||
|
<div class="col-sm-3 px-3">
|
||||||
|
<button id="finalizarEnvio" name="finalizar_envio" tabindex="1"
|
||||||
|
class="btn btn-primary mt-4 w-100 btn-finalizar">
|
||||||
|
<?= lang("Logistica.finalizarEnvio") ?>
|
||||||
|
<ti class="ti ti-check"></ti>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php if ($envioEntity->tipo_envio == 'estandar'): ?>
|
||||||
|
<div class="col-sm-3 px-3">
|
||||||
|
<button id="finalizarEnvioYOTs" name="finalizar_envio_ots" tabindex="1"
|
||||||
|
class="btn btn-primary mt-4 w-100 btn-finalizar">
|
||||||
|
<?= lang("Logistica.finalizarEnvioYOTs") ?>
|
||||||
|
<ti class="ti ti-checks"></ti>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?= $this->endSection() ?>
|
||||||
<?= $this->endSection() ?>
|
|
||||||
|
|
||||||
<?= $this->section('css') ?>
|
<?= $this->section('css') ?>
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.1/css/rowReorder.dataTables.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.1/css/rowReorder.dataTables.min.css">
|
||||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
|
||||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.css") ?>">
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.css") ?>">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?= site_url("/themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.css") ?>" />
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||||
<script src="https://cdn.datatables.net/rowgroup/1.3.1/js/dataTables.rowGroup.min.js"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"><script>
|
||||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/logistica/envioEdit.js") ?>"></script>
|
<script src="https://cdn.datatables.net/rowgroup/1.3.1/js/dataTables.rowGroup.min.js"></script>
|
||||||
<?= $this->endSection() ?>
|
<script type="module" src="<?= site_url("assets/js/safekat/pages/logistica/envioEdit.js") ?>"></script>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -48,6 +48,9 @@
|
|||||||
<div class="col-md-12 d-flex justify-content-end mb-2">
|
<div class="col-md-12 d-flex justify-content-end mb-2">
|
||||||
<button id="btn-print-labels" class="btn-primary btn d-flex justify-content-evenly gap-2" data-id="<?=$ot_tarea?->maquina_actual()->id?>"><span class="ti ti-barcode ti-lg"></span><?= lang('Produccion.print_label') ?></button>
|
<button id="btn-print-labels" class="btn-primary btn d-flex justify-content-evenly gap-2" data-id="<?=$ot_tarea?->maquina_actual()->id?>"><span class="ti ti-barcode ti-lg"></span><?= lang('Produccion.print_label') ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-12 d-flex justify-content-end mb-2">
|
||||||
|
<button id="btn-fichar-embalaje" class="btn-primary btn d-flex justify-content-evenly gap-2" data-id="<?=$ot_tarea?->maquina_actual()->id?>"><span class="ti ti-calendar ti-lg"></span><?= lang('Produccion.fichar_embalaje') ?></button>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="col-md-6 tarea-card-info-block">
|
<div class="col-md-6 tarea-card-info-block">
|
||||||
<?= view("/themes/vuexy/components/cards/tarea_card.php") ?>
|
<?= view("/themes/vuexy/components/cards/tarea_card.php") ?>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class MaquinistaTareaView {
|
|||||||
this.tareaCardClass = '.tarea-card-action-block'
|
this.tareaCardClass = '.tarea-card-action-block'
|
||||||
this.inputClick = $('.ot-tarea-click')
|
this.inputClick = $('.ot-tarea-click')
|
||||||
this.btnPrintLabels = this.item.find('#btn-print-labels')
|
this.btnPrintLabels = this.item.find('#btn-print-labels')
|
||||||
|
this.btnFicharEmbalaje = this.item.find('#btn-fichar-embalaje')
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
this.actionButtons.on('click', this.eventActionButton.bind(this))
|
this.actionButtons.on('click', this.eventActionButton.bind(this))
|
||||||
@ -22,6 +23,7 @@ class MaquinistaTareaView {
|
|||||||
this.handleGetTareaProgress();
|
this.handleGetTareaProgress();
|
||||||
this.inputClick.on('input', this.handleUpdateClickInput.bind(this))
|
this.inputClick.on('input', this.handleUpdateClickInput.bind(this))
|
||||||
this.btnPrintLabels.on('click', this.handlePrintLabels.bind(this))
|
this.btnPrintLabels.on('click', this.handlePrintLabels.bind(this))
|
||||||
|
this.btnFicharEmbalaje.on('click', this.handleFicharEmbalaje.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
eventActionButton(event) {
|
eventActionButton(event) {
|
||||||
@ -301,6 +303,51 @@ class MaquinistaTareaView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleFicharEmbalaje() {
|
||||||
|
const ot_id = [$('#otId').html()];
|
||||||
|
$.post('/logistica/ficharEmbalaje', {
|
||||||
|
ids: ot_id,
|
||||||
|
}, function (response) {
|
||||||
|
if (response.status) {
|
||||||
|
Swal.fire({
|
||||||
|
text: response.message,
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
table.ajax.reload();
|
||||||
|
}
|
||||||
|
}).fail(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: 'No se pudo realizar el fichaje.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MaquinistaTareaView;
|
export default MaquinistaTareaView;
|
||||||
@ -7,6 +7,7 @@ class EnvioEdit {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.tableCols = [
|
this.tableCols = [
|
||||||
{ data: "rowSelected" },
|
{ data: "rowSelected" },
|
||||||
|
{ data: "ordenTrabajo" },
|
||||||
{ data: "pedido" },
|
{ data: "pedido" },
|
||||||
{ data: "presupuesto" },
|
{ data: "presupuesto" },
|
||||||
{ data: "titulo" },
|
{ data: "titulo" },
|
||||||
@ -42,6 +43,12 @@ class EnvioEdit {
|
|||||||
this.proveedor.init();
|
this.proveedor.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($("#proximosEnvios").length) {
|
||||||
|
new PerfectScrollbar(document.getElementById('proximosEnvios'), {
|
||||||
|
wheelPropagation: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.table = $('#tableLineasEnvio').DataTable({
|
this.table = $('#tableLineasEnvio').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
@ -84,11 +91,11 @@ class EnvioEdit {
|
|||||||
"searchable": false,
|
"searchable": false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [1, 2, 4, 5, 6],
|
"targets": [1, 2, 4, 5, 6, 7],
|
||||||
"className": "text-center",
|
"className": "text-center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: [7, 8, 9],
|
targets: [8, 9, 10],
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -121,7 +128,7 @@ class EnvioEdit {
|
|||||||
}
|
}
|
||||||
const idEnvio = $('#id').val();
|
const idEnvio = $('#id').val();
|
||||||
let num_cajas = this.cajas.val();
|
let num_cajas = this.cajas.val();
|
||||||
if(ids.length != table.rows().count()){
|
if (ids.length != table.rows().count()) {
|
||||||
// se preguntará el numero de cajas en un swal con un input para obtener el valor
|
// se preguntará el numero de cajas en un swal con un input para obtener el valor
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Atención!',
|
title: 'Atención!',
|
||||||
@ -146,7 +153,7 @@ class EnvioEdit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this._imprimirEtiquetas(idEnvio, ids, num_cajas);
|
this._imprimirEtiquetas(idEnvio, ids, num_cajas);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -485,9 +492,14 @@ class EnvioEdit {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#ficharEmbalaje').on('click', (e) => {
|
||||||
|
this._ficharEmbalajeLineas();
|
||||||
|
});
|
||||||
|
|
||||||
this._getAlbaranes();
|
this._getAlbaranes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_imprimirEtiquetas(envio_id, ids, num_cajas) {
|
_imprimirEtiquetas(envio_id, ids, num_cajas) {
|
||||||
|
|
||||||
$.post('/logistica/imprimirEtiquetas', {
|
$.post('/logistica/imprimirEtiquetas', {
|
||||||
@ -510,7 +522,7 @@ class EnvioEdit {
|
|||||||
},
|
},
|
||||||
buttonsStyling: false
|
buttonsStyling: false
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if(response.data){
|
if (response.data) {
|
||||||
// show xml in a new tab
|
// show xml in a new tab
|
||||||
const blob = new Blob([response.data], { type: 'application/xml' });
|
const blob = new Blob([response.data], { type: 'application/xml' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
@ -671,6 +683,95 @@ class EnvioEdit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_ficharEmbalajeLineas() {
|
||||||
|
const table = this.table;
|
||||||
|
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
||||||
|
const checkbox = $(node).find('.checkbox-linea-envio');
|
||||||
|
return checkbox.is(':checked');
|
||||||
|
});
|
||||||
|
const ids = selectedRows.map((node) => {
|
||||||
|
const rowData = table.row(node).data();
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const doc = parser.parseFromString(rowData.ordenTrabajo, 'text/html');
|
||||||
|
return doc.body.textContent.trim(); // extrae solo el texto dentro del <a>
|
||||||
|
}).toArray();
|
||||||
|
|
||||||
|
if (ids.length > 0) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Fichar embalaje',
|
||||||
|
text: '¿Está seguro de fichar el embalaje de las líneas seleccionadas?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Sí',
|
||||||
|
cancelButtonText: 'Cancelar',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-danger me-1',
|
||||||
|
cancelButton: 'btn btn-secondary'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.post('/logistica/ficharEmbalaje', {
|
||||||
|
ids: ids
|
||||||
|
}, function (response) {
|
||||||
|
if (response.status) {
|
||||||
|
Swal.fire({
|
||||||
|
text: response.message,
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
table.ajax.reload();
|
||||||
|
}
|
||||||
|
}).fail(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: 'No se pudo realizar el fichaje.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Sin filas seleccionadas',
|
||||||
|
text: 'Marca al menos una línea para eliminarla.',
|
||||||
|
icon: 'info',
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_deleteLineas() {
|
_deleteLineas() {
|
||||||
const table = this.table;
|
const table = this.table;
|
||||||
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user