modificado form papel generico

This commit is contained in:
2024-11-19 20:51:11 +01:00
parent 9e4cd024bd
commit 8be0e3d16c
8 changed files with 75 additions and 37 deletions

View File

@ -156,8 +156,10 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
if ($this->request->getPost('show_in_client') == null) {
$sanitizedData['show_in_client'] = false;
}
if ($this->request->getPost('show_in_client_special') == null) {
$sanitizedData['show_in_client_special'] = false;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :

View File

@ -10,13 +10,15 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
"nombre" => null,
"code" => null,
"code_ot" => null,
"show_in_client" => true,
"show_in_client" => false,
"show_in_client_special" => false,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"show_in_client" => "boolean",
"show_in_client_special" => "boolean",
"is_deleted" => "int",
];
}

View File

@ -16,6 +16,7 @@ return [
'papelGenericoList' => 'Lista Papeles Genéricos',
'papelesGenericos' => 'Papeles Genéricos',
'showInClient' => 'Mostrar en cliente',
'showInClientSpecial' => 'Papel especial cliente',
'updatedAt' => 'Actualizado el',
'form_acordion_title' => 'Propiedades Papel Genérico',

View File

@ -19,9 +19,10 @@ class PapelGenericoModel extends \App\Models\BaseModel
1 => "t1.code",
2 => "t1.code_ot",
3 => "t1.show_in_client",
3 => "t1.show_in_client_special",
];
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "deleted_at", "is_deleted"];
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
protected $useTimestamps = true;
@ -104,7 +105,8 @@ class PapelGenericoModel extends \App\Models\BaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot, t1.show_in_client AS show_in_client"
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot,
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special"
)
->where("is_deleted", 0);

View File

@ -150,7 +150,8 @@ class PapelImpresionModel extends \App\Models\BaseModel
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada,
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special"
);
$builder->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left");

View File

@ -1,36 +1,54 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('PapelGenerico.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $papelGenerico->nombre) ?>">
</div><!--//.mb-3 -->
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('PapelGenerico.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
value="<?= old('nombre', $papelGenerico->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?=lang('PapelGenerico.code') ?>
</label>
<input type="text" id="code" name="code" maxLength="5" class="form-control" value="<?=old('code', $papelGenerico->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('PapelGenerico.code') ?>
</label>
<input type="text" id="code" name="code" maxLength="5" class="form-control"
value="<?= old('code', $papelGenerico->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="codeOt" class="form-label">
<?=lang('PapelGenerico.codeOt') ?>
</label>
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control" value="<?=old('code_ot', $papelGenerico->code_ot) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="codeOt" class="form-label">
<?= lang('PapelGenerico.codeOt') ?>
</label>
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control"
value="<?= old('code_ot', $papelGenerico->code_ot) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<div class="mb-3">
<div class="form-check">
<label for="showInClient" class="form-check-label">
<input type="checkbox" id="showInClient" name="show_in_client" value="1" class="form-check-input"<?=$papelGenerico->show_in_client== true ? 'checked' : ''; ?>>
<?=lang('PapelGenerico.showInClient') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<label for="showInClient" class="form-check-label">
<?= lang('PapelGenerico.showInClient') ?>
</label>
<input type="checkbox" id="showInClient" name="show_in_client" value="1" class="form-check-input"
<?= $papelGenerico->show_in_client == true ? 'checked' : ''; ?>>
</div><!--//.col -->
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!-- //.row -->
<div class="mb-3">
<div class="form-check">
<label for="showInClientSpecial" class="form-check-label">
<?= lang('PapelGenerico.showInClientSpecial') ?>
</label>
<input type="checkbox" id="showInClientSpecial" name="show_in_client_special" value="1"
class="form-check-input" <?= $papelGenerico->show_in_client_special == true ? 'checked' : ''; ?>>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -134,6 +134,16 @@
window.location.href = `/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`;
});
$('#showInClientSpecial').on('change', function() {
if($(this).is(':checked')) {
$('#showInClient').prop('disabled', true);
$('#showInClient').prop('checked', true);
}
else{
$('#showInClient').prop('disabled', false);
}
});
<?=$this->endSection() ?>

View File

@ -20,6 +20,7 @@
<th><?= lang('PapelGenerico.code') ?></th>
<th><?= lang('PapelGenerico.codeOt') ?></th>
<th><?= lang('PapelGenerico.showInClient') ?></th>
<th><?= lang('PapelGenerico.showInClientSpecial') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -90,13 +91,14 @@
{ 'data': 'code' },
{ 'data': 'code_ot' },
{ 'data': 'show_in_client' },
{ 'data': 'show_in_client_special' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [3];
const boolCols = [3, 4];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';