mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
feat colors
This commit is contained in:
@ -40,6 +40,18 @@ class OrdenTrabajo extends BaseConfig
|
|||||||
"fecha_encuadernado" => "fecha_encuadernado_change_user_id",
|
"fecha_encuadernado" => "fecha_encuadernado_change_user_id",
|
||||||
"fecha_entrega_externo" => "fecha_entrega_externo_change_user_id",
|
"fecha_entrega_externo" => "fecha_entrega_externo_change_user_id",
|
||||||
];
|
];
|
||||||
|
public array $OT_COLORS = [
|
||||||
|
"sin_imprimir" => "#FF6363",
|
||||||
|
"impreso_int" => "#AFDDFF",
|
||||||
|
"impreso_cub" => "#3A59D1",
|
||||||
|
"plastificado" => "#FFD63A",
|
||||||
|
"solapas" => "#4F1C51",
|
||||||
|
"preparado" => "#FF0B55",
|
||||||
|
"cosido" => "#FF0B55",
|
||||||
|
"grapado" => "#FEBA17",
|
||||||
|
"encuadernado" => "#FEBA17",
|
||||||
|
"corte" => "#67AE6E"
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -133,7 +133,7 @@ class Ordentrabajo extends BaseController
|
|||||||
try {
|
try {
|
||||||
$bodyData = $this->request->getPost();
|
$bodyData = $this->request->getPost();
|
||||||
$r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedido($bodyData);
|
$r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedido($bodyData);
|
||||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]);
|
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500);
|
return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500);
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F");
|
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F");
|
||||||
// return $this->response->setJSON($q->get()->getResultArray());
|
// return $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
@ -178,7 +178,7 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]);
|
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]);
|
||||||
// return $this->response->setJSON($q->get()->getResultArray());
|
// return $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
@ -193,7 +193,7 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
|
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
|
||||||
// return $this->response->setJSON($q->get()->getResultArray());
|
// return $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
@ -208,7 +208,7 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||||
// return $this->response->setJSON($q->get()->getResultArray());
|
// return $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name,"color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
|
|||||||
@ -43,9 +43,38 @@ class OrdenTrabajoDateEntity extends Entity
|
|||||||
'deleted_at',
|
'deleted_at',
|
||||||
|
|
||||||
];
|
];
|
||||||
protected $casts = [
|
protected $casts = [];
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function sinImprimirStatus(): bool
|
||||||
|
{
|
||||||
|
return !(
|
||||||
|
$this->attributes['interior_bn_at'] == null
|
||||||
|
&& $this->attributes['interior_color_at'] == null
|
||||||
|
&& $this->attributes['cubierta_at'] == null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public function impresionInteriorStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['interior_bn_at']|| $this->attributes['interior_color_at'];
|
||||||
|
}
|
||||||
|
public function impresionCubiertaStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['cubierta_at'] != null;
|
||||||
|
}
|
||||||
|
public function plastificadoStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['plastificado_at'] != null;
|
||||||
|
}
|
||||||
|
public function encuadernadoStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['encuadernacion_at'] != null;
|
||||||
|
}
|
||||||
|
public function preparacionInterioresStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['preparacion_interiores_at'] != null;
|
||||||
|
}
|
||||||
|
public function corteStatus():bool
|
||||||
|
{
|
||||||
|
return $this->attributes['corte_at'] != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@ class ProductionService extends BaseService
|
|||||||
protected MaquinaEntity $defaultMaquinaCorte;
|
protected MaquinaEntity $defaultMaquinaCorte;
|
||||||
protected MaquinaModel $maquinaModel;
|
protected MaquinaModel $maquinaModel;
|
||||||
protected OrdenTrabajo $ordenTrabajoConfig;
|
protected OrdenTrabajo $ordenTrabajoConfig;
|
||||||
|
public string $statusColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pedido Entity
|
* Pedido Entity
|
||||||
@ -74,6 +75,7 @@ class ProductionService extends BaseService
|
|||||||
$this->otFileModel = model(OrdenTrabajoFileModel::class);
|
$this->otFileModel = model(OrdenTrabajoFileModel::class);
|
||||||
$this->pedidoModel = model(PedidoModel::class);
|
$this->pedidoModel = model(PedidoModel::class);
|
||||||
$this->ordenTrabajoConfig = config('OrdenTrabajo');
|
$this->ordenTrabajoConfig = config('OrdenTrabajo');
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||||
}
|
}
|
||||||
public function init(int $orden_trabajo_id): self
|
public function init(int $orden_trabajo_id): self
|
||||||
{
|
{
|
||||||
@ -83,6 +85,7 @@ class ProductionService extends BaseService
|
|||||||
$pedido = $this->ot->pedido();
|
$pedido = $this->ot->pedido();
|
||||||
$this->setPedido($pedido);
|
$this->setPedido($pedido);
|
||||||
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -631,6 +634,7 @@ class ProductionService extends BaseService
|
|||||||
"tareas_preimpresion" => $this->tareas_preimpresion(),
|
"tareas_preimpresion" => $this->tareas_preimpresion(),
|
||||||
"tareas_impresion" => $this->tareas_impresion(),
|
"tareas_impresion" => $this->tareas_impresion(),
|
||||||
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
|
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
|
||||||
|
"statusColor" => $this->getOtColorStatus(),
|
||||||
];
|
];
|
||||||
return $summary;
|
return $summary;
|
||||||
}
|
}
|
||||||
@ -1107,10 +1111,81 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$progreso = (float) $fill_dates / $total * 100;
|
$progreso = (float) $fill_dates / $total * 100;
|
||||||
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso,2)]);
|
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]);
|
||||||
}else{
|
} else {
|
||||||
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
public function getOtColorStatus(): string
|
||||||
|
{
|
||||||
|
if($this->ot->dates()){
|
||||||
|
$this->updateColor();
|
||||||
|
}
|
||||||
|
return $this->statusColor;
|
||||||
|
}
|
||||||
|
protected function otSinImprimirColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->sinImprimirStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otImpresionIntColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->impresionInteriorStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_int"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otImpresionCubiertaColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->impresionCubiertaStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_cub"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otPlastificadoColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->plastificadoStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["plastificado"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otSolapaColor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
protected function otEncuadernadoColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->encuadernadoStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["encuadernado"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otPreparadoColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->preparacionInterioresStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["preparado"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otCorteColor()
|
||||||
|
{
|
||||||
|
if ($this->ot->dates()->corteStatus()) {
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["corte"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected function otCosidoColor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected function otGrapadoColor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected function updateColor(){
|
||||||
|
$this->otSinImprimirColor();
|
||||||
|
$this->otImpresionIntColor();
|
||||||
|
$this->otCosidoColor();
|
||||||
|
$this->otImpresionCubiertaColor();
|
||||||
|
$this->otPlastificadoColor();
|
||||||
|
$this->otSolapaColor();
|
||||||
|
$this->otPreparadoColor();
|
||||||
|
$this->otGrapadoColor();
|
||||||
|
$this->otEncuadernadoColor();
|
||||||
|
$this->otCorteColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
<table id="<?= $id ?>" class="table table-hover text-dark" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
|
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
|
||||||
|
|||||||
@ -55,6 +55,7 @@ class OrdenTrabajoDatatable {
|
|||||||
},
|
},
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{ className: 'dt-center', targets: '_all' },
|
{ className: 'dt-center', targets: '_all' },
|
||||||
|
|
||||||
],
|
],
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
pageLength: 25,
|
pageLength: 25,
|
||||||
@ -62,7 +63,10 @@ class OrdenTrabajoDatatable {
|
|||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
columns: this.datatableColumns,
|
columns: this.datatableColumns,
|
||||||
ajax: '/produccion/ordentrabajo/datatable'
|
ajax: '/produccion/ordentrabajo/datatable',
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
$(row).css("background-color",data.logo.color)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
initPendientes() {
|
initPendientes() {
|
||||||
@ -76,6 +80,7 @@ class OrdenTrabajoDatatable {
|
|||||||
},
|
},
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{ className: 'dt-center', targets: '_all' },
|
{ className: 'dt-center', targets: '_all' },
|
||||||
|
|
||||||
],
|
],
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
pageLength: 25,
|
pageLength: 25,
|
||||||
@ -83,7 +88,10 @@ class OrdenTrabajoDatatable {
|
|||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
columns: this.datatableColumns,
|
columns: this.datatableColumns,
|
||||||
ajax: '/produccion/ordentrabajo/datatable_pendientes'
|
ajax: '/produccion/ordentrabajo/datatable_pendientes',
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
$(row).css("background-color",data.logo.color)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
initFerroPendiente() {
|
initFerroPendiente() {
|
||||||
@ -97,11 +105,18 @@ class OrdenTrabajoDatatable {
|
|||||||
},
|
},
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
pageLength: 25,
|
pageLength: 25,
|
||||||
|
columnDefs: [
|
||||||
|
{ className: 'dt-center', targets: '_all' },
|
||||||
|
|
||||||
|
],
|
||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
columns: this.datatableColumns,
|
columns: this.datatableColumns,
|
||||||
ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente'
|
ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente',
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
$(row).css("background-color",data.logo.color)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
initFerroOk() {
|
initFerroOk() {
|
||||||
@ -114,12 +129,19 @@ class OrdenTrabajoDatatable {
|
|||||||
bottomEnd: 'paging'
|
bottomEnd: 'paging'
|
||||||
},
|
},
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
|
columnDefs: [
|
||||||
|
{ className: 'dt-center', targets: '_all' },
|
||||||
|
|
||||||
|
],
|
||||||
pageLength: 25,
|
pageLength: 25,
|
||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
columns: this.datatableColumns,
|
columns: this.datatableColumns,
|
||||||
ajax: '/produccion/ordentrabajo/datatable_ferro_ok'
|
ajax: '/produccion/ordentrabajo/datatable_ferro_ok',
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
$(row).css("background-color",data.logo.color)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user