mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add field activo in papel_generico
This commit is contained in:
@ -156,6 +156,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
if ($this->request->getPost('show_in_client') == null) {
|
if ($this->request->getPost('show_in_client') == null) {
|
||||||
$sanitizedData['show_in_client'] = false;
|
$sanitizedData['show_in_client'] = false;
|
||||||
}
|
}
|
||||||
|
if ($this->request->getPost('activo') == null) {
|
||||||
|
$sanitizedData['activo'] = false;
|
||||||
|
}
|
||||||
if ($this->request->getPost('show_in_client_special') == null) {
|
if ($this->request->getPost('show_in_client_special') == null) {
|
||||||
$sanitizedData['show_in_client_special'] = false;
|
$sanitizedData['show_in_client_special'] = false;
|
||||||
}
|
}
|
||||||
@ -163,6 +166,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
if ($sanitizedData['show_in_client_special']) {
|
if ($sanitizedData['show_in_client_special']) {
|
||||||
$sanitizedData['show_in_client'] = true;
|
$sanitizedData['show_in_client'] = true;
|
||||||
}
|
}
|
||||||
|
if ($sanitizedData['activo']) {
|
||||||
|
$sanitizedData['activo'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
|
||||||
|
class AlterAddColumnActivoPapelGenerico extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$field = [
|
||||||
|
'activo' => [
|
||||||
|
'type' => 'BOOLEAN',
|
||||||
|
'default' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$this->forge->addColumn('lg_papel_generico',$field);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropColumn('lg_papel_generico','activo');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -13,11 +13,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
|
|||||||
"show_in_client" => false,
|
"show_in_client" => false,
|
||||||
"show_in_client_special" => false,
|
"show_in_client_special" => false,
|
||||||
"is_deleted" => 0,
|
"is_deleted" => 0,
|
||||||
|
"activo" => false,
|
||||||
"created_at" => null,
|
"created_at" => null,
|
||||||
"updated_at" => null,
|
"updated_at" => null,
|
||||||
];
|
];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
"show_in_client" => "boolean",
|
"show_in_client" => "boolean",
|
||||||
|
"activo" => "boolean",
|
||||||
"show_in_client_special" => "boolean",
|
"show_in_client_special" => "boolean",
|
||||||
"is_deleted" => "int",
|
"is_deleted" => "int",
|
||||||
];
|
];
|
||||||
|
|||||||
@ -8,6 +8,7 @@ return [
|
|||||||
'createdAt' => 'Creado el',
|
'createdAt' => 'Creado el',
|
||||||
'deletedAt' => 'Deleted At',
|
'deletedAt' => 'Deleted At',
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
|
'activo' => 'Activo',
|
||||||
'isDeleted' => 'Is Deleted',
|
'isDeleted' => 'Is Deleted',
|
||||||
'moduleTitle' => 'Papel Genérico',
|
'moduleTitle' => 'Papel Genérico',
|
||||||
'nombre' => 'Nombre',
|
'nombre' => 'Nombre',
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
4 => "t1.show_in_client_special",
|
4 => "t1.show_in_client_special",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
|
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted", "activo"];
|
||||||
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
|
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
@ -120,25 +120,28 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
{
|
{
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select("t1.id AS id, t1.nombre AS nombre,
|
||||||
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot,
|
t1.code AS code,
|
||||||
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special"
|
t1.code_ot AS code_ot,
|
||||||
|
t1.activo AS activo,
|
||||||
|
t1.show_in_client AS show_in_client,
|
||||||
|
t1.show_in_client_special AS show_in_client_special"
|
||||||
)
|
)
|
||||||
->where("is_deleted", 0);
|
->where("is_deleted", 0);
|
||||||
|
|
||||||
return empty($search)
|
return empty($search)
|
||||||
? $builder
|
? $builder
|
||||||
: $builder
|
: $builder
|
||||||
->groupStart()
|
->groupStart()
|
||||||
->like("t1.id", $search)
|
->like("t1.id", $search)
|
||||||
->orLike("t1.nombre", $search)
|
->orLike("t1.nombre", $search)
|
||||||
->orLike("t1.code", $search)
|
->orLike("t1.code", $search)
|
||||||
->orLike("t1.code_ot", $search)
|
->orLike("t1.code_ot", $search)
|
||||||
->orLike("t1.id", $search)
|
->orLike("t1.id", $search)
|
||||||
->orLike("t1.nombre", $search)
|
->orLike("t1.nombre", $search)
|
||||||
->orLike("t1.code", $search)
|
->orLike("t1.code", $search)
|
||||||
->orLike("t1.code_ot", $search)
|
->orLike("t1.code_ot", $search)
|
||||||
->groupEnd();
|
->groupEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,15 @@
|
|||||||
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control"
|
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control"
|
||||||
value="<?= old('code_ot', $papelGenerico->code_ot) ?>">
|
value="<?= old('code_ot', $papelGenerico->code_ot) ?>">
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<label for="activo_papel_generico" class="form-check-label">
|
||||||
|
<?= lang('PapelGenerico.activo') ?>
|
||||||
|
</label>
|
||||||
|
<input type="checkbox" id="activo_papel_generico" name="activo" value="1"
|
||||||
|
class="form-check-input" <?= $papelGenerico->activo == true ? 'checked' : ''; ?>>
|
||||||
|
</div><!--//.form-check -->
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
|
||||||
|
|||||||
@ -144,6 +144,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
<th><?= lang('PapelGenerico.codeOt') ?></th>
|
<th><?= lang('PapelGenerico.codeOt') ?></th>
|
||||||
<th><?= lang('PapelGenerico.showInClient') ?></th>
|
<th><?= lang('PapelGenerico.showInClient') ?></th>
|
||||||
<th><?= lang('PapelGenerico.showInClientSpecial') ?></th>
|
<th><?= lang('PapelGenerico.showInClientSpecial') ?></th>
|
||||||
|
<th><?= lang('PapelGenerico.activo') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -92,13 +93,14 @@
|
|||||||
{ 'data': 'code_ot' },
|
{ 'data': 'code_ot' },
|
||||||
{ 'data': 'show_in_client' },
|
{ 'data': 'show_in_client' },
|
||||||
{ 'data': 'show_in_client_special' },
|
{ 'data': 'show_in_client_special' },
|
||||||
|
{ 'data': 'activo' },
|
||||||
{ 'data': actionBtns }
|
{ 'data': actionBtns }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [3, 4];
|
const boolCols = [3, 4, 5];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
|||||||
Reference in New Issue
Block a user