mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/colors-plannings' into 'main'
add colors plannings See merge request jjimenez/safekat!703
This commit is contained in:
@ -746,6 +746,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
|||||||
$routes->post("update", 'Ordentrabajo::update_orden_trabajo');
|
$routes->post("update", 'Ordentrabajo::update_orden_trabajo');
|
||||||
$routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada');
|
$routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada');
|
||||||
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
|
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
|
||||||
|
$routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1');
|
||||||
|
|
||||||
/**======================
|
/**======================
|
||||||
* FILES
|
* FILES
|
||||||
|
|||||||
@ -328,26 +328,26 @@ class Ordentrabajo extends BaseController
|
|||||||
}
|
}
|
||||||
public function planning_rotativa_datatable()
|
public function planning_rotativa_datatable()
|
||||||
{
|
{
|
||||||
$q = $this->produccionService->planningRotativaQueryDatatable();
|
$query = $this->produccionService->planningRotativaQueryDatatable();
|
||||||
return DataTable::of($q)
|
return DataTable::of($query)
|
||||||
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
||||||
->add("metros_check", fn($q) => $q->otId)
|
->add("metros_check", fn($q) => $q->otId)
|
||||||
->add("corte", fn($q) => ["otId" => $q->otId, "tipo_corte" => $this->produccionService->ordenTrabajoTareaCorte($q->otId)])
|
->add("corte", fn($q) => ["otId" => $q->otId, "tipo_corte" => $this->produccionService->ordenTrabajoTareaCorte($q->otId)])
|
||||||
->add("action", fn($q) => $q)
|
->add("action", fn($q) => ["data" => $q])
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
public function planning_plana_datatable()
|
public function planning_plana_datatable()
|
||||||
{
|
{
|
||||||
$q = $this->produccionService->planningPlanaQueryDatatable();
|
$query = $this->produccionService->planningPlanaQueryDatatable();
|
||||||
$padreId = $this->request->getGet('padre_id');
|
$padreId = $this->request->getGet('padre_id');
|
||||||
if ($padreId) {
|
if ($padreId) {
|
||||||
$q->where('lg_maquinas.padre_id', $padreId);
|
$query->where('lg_maquinas.padre_id', $padreId);
|
||||||
}
|
}
|
||||||
return DataTable::of($q)
|
return DataTable::of($query)
|
||||||
->edit("tiempo_real_sum", fn($q) => $q->tiempo_real_sum)
|
->edit("tiempo_real_sum", fn($q) => $q->tiempo_real_sum)
|
||||||
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
||||||
->add("pliegos_check", fn($q) => $q->otId)
|
->add("pliegos_check", fn($q) => $q->otId)
|
||||||
->add("action", fn($q) => $q)
|
->add("action", fn($q) => ["data" => $q ])
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
public function select_maquina_planning_rot()
|
public function select_maquina_planning_rot()
|
||||||
@ -431,4 +431,9 @@ class Ordentrabajo extends BaseController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function get_orden_trabajo_color_status(int $orden_trabajo_id)
|
||||||
|
{
|
||||||
|
$color = $this->produccionService->init($orden_trabajo_id)->getOtColorStatus();
|
||||||
|
return $this->response->setJSON(["color" => $color]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,12 +87,12 @@ class OrdenTrabajoEntity extends Entity
|
|||||||
public function dates(): ?OrdenTrabajoDateEntity
|
public function dates(): ?OrdenTrabajoDateEntity
|
||||||
{
|
{
|
||||||
$m = model(OrdenTrabajoDate::class);
|
$m = model(OrdenTrabajoDate::class);
|
||||||
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
return $m->where('orden_trabajo_id', $this->attributes["id"])->first();
|
||||||
}
|
}
|
||||||
public function users(): ?OrdenTrabajoUserEntity
|
public function users(): ?OrdenTrabajoUserEntity
|
||||||
{
|
{
|
||||||
$m = model(OrdenTrabajoUser::class);
|
$m = model(OrdenTrabajoUser::class);
|
||||||
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
return $m->where('orden_trabajo_id', $this->attributes["id"])->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,24 +109,24 @@ class OrdenTrabajoEntity extends Entity
|
|||||||
$this->attributes["dates"] = $ot_dates->fill($data);
|
$this->attributes["dates"] = $ot_dates->fill($data);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
public function getBarCode() : string
|
public function getBarCode(): string
|
||||||
{
|
{
|
||||||
$barcode = new TypeCode128();
|
$barcode = new TypeCode128();
|
||||||
$renderer = new PngRenderer();
|
$renderer = new PngRenderer();
|
||||||
$barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id);
|
$barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id);
|
||||||
return base64_encode($renderer->render($barcodeData,200, 50));
|
return base64_encode($renderer->render($barcodeData, 200, 50));
|
||||||
}
|
}
|
||||||
public function files() : array
|
public function files(): array
|
||||||
{
|
{
|
||||||
$m = model(OrdenTrabajoFileModel::class);
|
$m = model(OrdenTrabajoFileModel::class);
|
||||||
return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? [];
|
return $m->where('orden_trabajo_id', $this->attributes['id'])->findAll() ?? [];
|
||||||
}
|
}
|
||||||
public function pedidoEsperaBy() : ?UserEntity
|
public function pedidoEsperaBy(): ?UserEntity
|
||||||
{
|
{
|
||||||
$m = model(UserModel::class);
|
$m = model(UserModel::class);
|
||||||
if($this->attributes['pedido_espera_by']){
|
if ($this->attributes['pedido_espera_by']) {
|
||||||
return $m->findById($this->attributes['pedido_espera_by']);
|
return $m->findById($this->attributes['pedido_espera_by']);
|
||||||
}else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,10 +139,10 @@ class OrdenTrabajoEntity extends Entity
|
|||||||
helper('filesystem');
|
helper('filesystem');
|
||||||
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
|
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
|
||||||
$portada_path = null;
|
$portada_path = null;
|
||||||
if($path){
|
if ($path) {
|
||||||
if(file_exists($path)){
|
if (file_exists($path)) {
|
||||||
$portada_path = $path;
|
$portada_path = $path;
|
||||||
}else{
|
} else {
|
||||||
$portada_path = null;
|
$portada_path = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,14 +79,20 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
public function init(int $orden_trabajo_id): self
|
public function init(int $orden_trabajo_id): self
|
||||||
{
|
{
|
||||||
$this->maquinaModel = model(MaquinaModel::class);
|
try {
|
||||||
$this->otModel = model(OrdenTrabajoModel::class);
|
//code...
|
||||||
$this->ot = $this->otModel->find($orden_trabajo_id);
|
$this->maquinaModel = model(MaquinaModel::class);
|
||||||
$pedido = $this->ot->pedido();
|
$this->otModel = model(OrdenTrabajoModel::class);
|
||||||
$this->setPedido($pedido);
|
$this->ot = $this->otModel->find($orden_trabajo_id);
|
||||||
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
$pedido = $this->ot->pedido();
|
||||||
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
$this->setPedido($pedido);
|
||||||
return $this;
|
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
||||||
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||||
|
return $this;
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
dd($orden_trabajo_id);
|
||||||
|
throw $th;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Establece el pedido sobre el que se va a trabajar
|
* Establece el pedido sobre el que se va a trabajar
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="modalNewTask" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel1"><?= lang('Produccion.task') ?></h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="formNewOtTask" method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 mb-0">
|
||||||
|
<label for="ot-task-nombre" class="form-label"><?= lang('Produccion.nombre') ?></label>
|
||||||
|
<input type="input" rows="4" cols="10" id="ot-task-nombre" placeholder="Escriba un título" name="nombre" class="form-control" />
|
||||||
|
</div>
|
||||||
|
<div class="col-12 mb-0">
|
||||||
|
<label for="ot-task-nombre" class="form-label"><?= lang('Produccion.tiempo_estimado') ?></label>
|
||||||
|
<input type="input" rows="4" cols="10" id="ot-task-tiempo-estimado" name="tiempo_estimado" class="form-control" />
|
||||||
|
</div>
|
||||||
|
<div class="col-12 mb-0">
|
||||||
|
<label for="ot-task-nombre" class="form-label"><?= lang('Produccion.tiempo_estimado') ?></label>
|
||||||
|
<select type="input" rows="4" cols="10" id="ot-task-tiempo-estimado" name="tiempo_estimado" class="form-control"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.global_come_back') ?></button>
|
||||||
|
<button type="button" id="submit_new_hebra" class="btn btn-primary d-none"><?= lang('Chat.modal.btn_send') ?></button>
|
||||||
|
<button type="button" id="submit_update_hebra" class="btn btn-primary d-none"><?= lang('Chat.modal.btn_send_update') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -41,9 +41,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row text-end mt-2">
|
<div class="row d-flex flex-row justify-content-between align-items-center mt-2 gap-2">
|
||||||
<div class="col-md-12">
|
<div class="col-md-3 text-start">
|
||||||
<button type="button" class="btn btn-danger btn-md" id="btn-reset-tareas"><i class="ti ti-trash ti-xs"></i> Reiniciar tareas</button>
|
<!-- <button type="button" class="btn btn-primary btn-md align-items-center" id="btn-add-tarea"><span class="ti ti-plus ti-sm me-1"></span> Insertar tarea</button> -->
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 gap-2 text-end">
|
||||||
|
<!-- <button type="button" class="btn btn-warning btn-md" id="btn-reset-tareas-time"><span class="ti ti-clock ti-sm me-1"></span> Actualizar tiempo</button> -->
|
||||||
|
<button type="button" class="btn btn-danger btn-md" id="btn-reset-tareas"><span class="ti ti-trash ti-sm me-1"></span> Reiniciar tareas</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -151,6 +151,9 @@ class PlanningRotativa {
|
|||||||
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"
|
||||||
},
|
},
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
this.getColorOtStatus(row,data)
|
||||||
|
},
|
||||||
columns: this.datatableColumns,
|
columns: this.datatableColumns,
|
||||||
ajax: '/produccion/ordentrabajo/planning/rotativa/datatable'
|
ajax: '/produccion/ordentrabajo/planning/rotativa/datatable'
|
||||||
});
|
});
|
||||||
@ -165,7 +168,9 @@ class PlanningRotativa {
|
|||||||
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.datatablePlanaColumns,
|
columns: this.datatablePlanaColumns,
|
||||||
|
createdRow: (row,data,dataIndex) => {
|
||||||
|
this.getColorOtStatus(row,data)
|
||||||
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
url : '/produccion/ordentrabajo/planning/plana/datatable',
|
url : '/produccion/ordentrabajo/planning/plana/datatable',
|
||||||
data : d => {
|
data : d => {
|
||||||
@ -245,7 +250,7 @@ class PlanningRotativa {
|
|||||||
this.tablePlanningPlana.on('change', ".pliegos-check", this.calcPliegosCheck.bind(this))
|
this.tablePlanningPlana.on('change', ".pliegos-check", this.calcPliegosCheck.bind(this))
|
||||||
}
|
}
|
||||||
_renderBtnAction(d) {
|
_renderBtnAction(d) {
|
||||||
return `<a href="/produccion/ordentrabajo/edit/${d.otId}" class="ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-eye"></i></a>`
|
return `<a href="/produccion/ordentrabajo/edit/${d.data.otId}" class="ot-tarea-comment" data-id="${d.data.otId}"><i class="ti ti-eye"></i></a>`
|
||||||
}
|
}
|
||||||
_columnFiltering() {
|
_columnFiltering() {
|
||||||
this.api().columns()
|
this.api().columns()
|
||||||
@ -362,7 +367,15 @@ class PlanningRotativa {
|
|||||||
}
|
}
|
||||||
toggleCorteError(){
|
toggleCorteError(){
|
||||||
}
|
}
|
||||||
|
getColorOtStatus(row,data){
|
||||||
|
let ajax = new Ajax("/produccion/ordentrabajo/color/"+data.otId,null,null,
|
||||||
|
(response) => {
|
||||||
|
$(row).css("border-left",`10px solid ${response.color}`)
|
||||||
|
$(row).css("border-right",`10px solid ${response.color}`)
|
||||||
|
},null
|
||||||
|
)
|
||||||
|
ajax.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user