mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add select imposicion datatable
This commit is contained in:
@ -106,6 +106,11 @@ class Imposiciones extends BaseController
|
||||
{
|
||||
if ($imposicion_id) {
|
||||
$bodyData = $this->request->getPost();
|
||||
if(isset($bodyData["imposicion_esquema_id"])){
|
||||
if($bodyData["imposicion_esquema_id"] == ""){
|
||||
$bodyData["imposicion_esquema_id"] = null;
|
||||
}
|
||||
}
|
||||
$status = $this->model->update($imposicion_id, $bodyData);
|
||||
if ($status) {
|
||||
$imposicionEntity = $this->model->find($imposicion_id);
|
||||
@ -148,9 +153,10 @@ class Imposiciones extends BaseController
|
||||
{
|
||||
$q = $this->model->queryDatatable();
|
||||
return DataTable::of($q)
|
||||
->add('esquema', fn($q) => ["imposicionId" => $q->id,"esquemaId" => $q->esquemaId, "esquemaName" => $q->esquemaName])
|
||||
->add(
|
||||
'action',
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2 w-100 d-flex justify-space-between'>". ImposicionModel::datatable_buttons($q->id)."</div>"
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2 w-100 d-flex justify-space-between'>" . ImposicionModel::datatable_buttons($q->id) . "</div>"
|
||||
)
|
||||
->toJson(true);
|
||||
}
|
||||
@ -160,7 +166,7 @@ class Imposiciones extends BaseController
|
||||
return DataTable::of($q)
|
||||
->add(
|
||||
'action',
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2'>". ImposicionEsquemaModel::datatable_buttons($q->id)."</div>"
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2'>" . ImposicionEsquemaModel::datatable_buttons($q->id) . "</div>"
|
||||
)
|
||||
->toJson(true);
|
||||
}
|
||||
|
||||
@ -15,9 +15,10 @@ class AddFkEsquemaImposiciones extends Migration
|
||||
"imposicion_esquema_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true
|
||||
]
|
||||
]);
|
||||
$this->forge->addForeignKey(["imposicion_esquema_id"],"imposicion_esquemas",["id"]);
|
||||
$this->forge->addForeignKey(["imposicion_esquema_id"],"imposicion_esquemas",["id"],'SET NULL','SET NULL');
|
||||
$this->forge->processIndexes("lg_imposiciones");
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class ImposicionEsquemaModel extends Model
|
||||
"id",
|
||||
"name",
|
||||
"svg_schema as description"
|
||||
]);
|
||||
])->where('deleted_at', null);
|
||||
if ($q) {
|
||||
$query->orLike("name", $q);
|
||||
}
|
||||
|
||||
@ -143,14 +143,18 @@ class ImposicionModel extends BaseModel
|
||||
{
|
||||
return $this->builder()
|
||||
->select([
|
||||
"id",
|
||||
"ancho",
|
||||
"alto",
|
||||
"unidades",
|
||||
"maquina",
|
||||
"orientacion",
|
||||
"etiqueta"
|
||||
])->where('deleted_at', null);
|
||||
"lg_imposiciones.id",
|
||||
"lg_imposiciones.ancho",
|
||||
"lg_imposiciones.alto",
|
||||
"lg_imposiciones.unidades",
|
||||
"lg_imposiciones.maquina",
|
||||
"lg_imposiciones.orientacion",
|
||||
"lg_imposiciones.etiqueta",
|
||||
"imposicion_esquemas.id as esquemaId",
|
||||
"imposicion_esquemas.name as esquemaName"
|
||||
])
|
||||
->join("imposicion_esquemas","imposicion_esquemas.id = lg_imposiciones.imposicion_esquema_id","left")
|
||||
->where('lg_imposiciones.deleted_at', null);
|
||||
}
|
||||
public static function datatable_buttons(int $id)
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
@ -31,6 +32,7 @@
|
||||
<th><?= lang('Imposiciones.orientacion') ?></th>
|
||||
<th><?= lang('Imposiciones.maquina') ?></th>
|
||||
<th><?= lang('Imposiciones.etiqueta') ?></th>
|
||||
<th><?= lang('Imposiciones.imposicion_esquema') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user