mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Creando presupuestos encuandernado
This commit is contained in:
@ -484,6 +484,10 @@ $routes->group('serviciospresupuesto', ['namespace' => 'App\Controllers\Presupue
|
||||
$routes->post('datatable_editor', 'PresupuestoAcabados::datatable_editor', ['as' => 'editorOfPresupuestoAcabados']);
|
||||
});
|
||||
|
||||
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'PresupuestoEncuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
|
||||
$routes->post('datatable_editor', 'PresupuestoEncuadernaciones::datatable_editor', ['as' => 'editorOfPresupuestoEncuadernaciones']);
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -9,7 +9,7 @@ use App\Entities\Clientes\ClienteContactoEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoAcabadoModel;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
@ -25,7 +25,7 @@ use const App\Controllers\Clientes\APPPATH;
|
||||
class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = PresupuestoAcabadoModel::class;
|
||||
protected $modelName = PresupuestoAcabadosModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Presupuesto acabado';
|
||||
@ -57,19 +57,18 @@ class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = PresupuestoAcabadoModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$order = PresupuestoAcabadosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$id_P = $reqData['id_presupuesto'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource("", $id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource("", $id_P)->countAllResults()
|
||||
$this->model->getResource($id_P)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -84,17 +83,17 @@ class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst( $db, 'presupuesto_acabados' )
|
||||
->fields(
|
||||
Field::inst( 'nombre' )
|
||||
Field::inst( 'tarifa_acabado_id' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Selecciones servicios de acabado' )
|
||||
),
|
||||
Field::inst( 'precio_unitario' )
|
||||
Field::inst( 'precio_unidad' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Falta apellidos' )
|
||||
'message' => 'Falta precio unitario' )
|
||||
),
|
||||
Field::inst( 'precio_total' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Falta cargp' )
|
||||
'message' => 'Falta precio total' )
|
||||
),
|
||||
|
||||
Field::inst( 'presupuesto_id' ),
|
||||
@ -102,6 +101,7 @@ class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
|
||||
)
|
||||
->validator( function($editor, $action, $data){
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||
//return $response;
|
||||
/*foreach ($data['data'] as $pkey => $values ){
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if (!empty($response)){
|
||||
|
||||
131
ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php
Normal file
131
ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php namespace App\Controllers\Presupuestos;
|
||||
|
||||
|
||||
use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Clientes\ClienteContactoEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use function App\Controllers\Clientes\csrf_hash;
|
||||
use function App\Controllers\Clientes\csrf_token;
|
||||
use function App\Controllers\Clientes\lang;
|
||||
use function App\Controllers\Clientes\model;
|
||||
use function App\Controllers\Clientes\redirect;
|
||||
use function App\Controllers\Clientes\route_to;
|
||||
use function App\Controllers\Clientes\view;
|
||||
use const App\Controllers\Clientes\APPPATH;
|
||||
|
||||
class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = PresupuestoEncuadernacionesModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Presupuesto encuadernaciones';
|
||||
protected static $singularObjectNameCc = 'presupuestoEncuadernaciones';
|
||||
protected static $pluralObjectName = 'Presupuestos encuadernaciones';
|
||||
protected static $pluralObjectNameCc = 'presupuestosEncuadernaciones';
|
||||
|
||||
protected static $controllerSlug = 'presupuesto-encuadernaciones';
|
||||
|
||||
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
|
||||
|
||||
protected $indexRoute = 'contactoDeClienteList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = PresupuestoEncuadernacionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$id_P = $reqData['id_presupuesto'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($id_P)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable_editor() {
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst( $db, 'presupuesto_acabados' )
|
||||
->fields(
|
||||
Field::inst( 'tarifa_encuadernado_id' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Selecciones servicios de acabado' )
|
||||
),
|
||||
Field::inst( 'precio_unidad' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Falta precio unitario' )
|
||||
),
|
||||
Field::inst( 'precio_total' )
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => 'Falta precio total' )
|
||||
),
|
||||
|
||||
Field::inst( 'presupuesto_id' ),
|
||||
|
||||
)
|
||||
->validator( function($editor, $action, $data){
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||
//return $response;
|
||||
/*foreach ($data['data'] as $pkey => $values ){
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if (!empty($response)){
|
||||
return $response;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
})
|
||||
->debug(true)
|
||||
->process( $_POST )
|
||||
->data();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$response[$csrfTokenName] = $newTokenHash;
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"presupuesto_id" => null,
|
||||
"tarifa_encuadernado_id" => null,
|
||||
"precio_unidad" => null,
|
||||
"precio_total" => null,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"presupuesto_id" => "int",
|
||||
"tarifa_encuadernado_id" => "int",
|
||||
"precio_unidad" => "float",
|
||||
"precio_total" => "float",
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoManipuladosEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"presupuesto_id" => null,
|
||||
"tarifa_manipulado_id" => null,
|
||||
"precio_unidad" => null,
|
||||
"precio_total" => null,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"presupuesto_id" => "int",
|
||||
"tarifa_manipulado_id" => "int",
|
||||
"precio_unidad" => "float",
|
||||
"precio_total" => "float",
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoPreimpresionesEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"presupuesto_id" => null,
|
||||
"tarifa_preimpresion_id" => null,
|
||||
"precio_unidad" => null,
|
||||
"precio_total" => null,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"presupuesto_id" => "int",
|
||||
"tarifa_preimpresion_id" => "int",
|
||||
"precio_unidad" => "float",
|
||||
"precio_total" => "float",
|
||||
];
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoAcabadoModel extends \App\Models\GoBaseModel
|
||||
class PresupuestoAcabadosModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "presupuesto_acabados";
|
||||
|
||||
@ -19,7 +19,7 @@ class PresupuestoAcabadoModel extends \App\Models\GoBaseModel
|
||||
2 => "t1.precio_total"
|
||||
];
|
||||
|
||||
protected $allowedFields = ["presupuesto_id", "tarifa_acabado_id", "nombre", "precio", "precio_unidad"];
|
||||
protected $allowedFields = ["presupuesto_id", "tarifa_acabado_id", "nombre", "precio_total", "precio_unidad"];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoAcabadosEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -52,7 +52,7 @@ class PresupuestoAcabadoModel extends \App\Models\GoBaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $presupuesto_id = -1)
|
||||
public function getResource($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -63,13 +63,6 @@ class PresupuestoAcabadoModel extends \App\Models\GoBaseModel
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t2.nombre", $search)
|
||||
->orlike("t1.precio_unidad", $search)
|
||||
->orLike("t1.precio_total", $search)
|
||||
->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "presupuesto_encuadernaciones";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t2.nombre",
|
||||
1 => "t1.precio_unidad",
|
||||
2 => "t1.precio_total"
|
||||
];
|
||||
|
||||
protected $allowedFields = ["presupuesto_id", "tarifa_encuadernado_id", "nombre", "precio_total", "precio_unidad"];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"precio_total" => [
|
||||
"label" => "Presupuestos.precioTotal",
|
||||
"rules" => "decimal|required",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"precio_total" => [
|
||||
"decimal" => "Presupuestos.validation.decimal",
|
||||
"requerido" => "Presupuestos.validation.decimal",
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_encuadernado_id AS tarifa_encuadernado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernado_id = t2.id", "left");
|
||||
|
||||
return $builder;
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,18 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="servicios-encuadernacion" role="tabpanel">
|
||||
<h3>Proximanente</h3>
|
||||
<table id="tableOfServiciosEncuadernacion" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Tarifaencuadernacion.tarifaaencuadernacion') ?></th>
|
||||
<th><?= lang('Presupuestos.precioUnidad') ?></th>
|
||||
<th><?= lang('Presupuestos.precioTotal') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="servicios-manipulado" role="tabpanel">
|
||||
@ -137,7 +148,7 @@
|
||||
"name": "tarifa_acabado_id",
|
||||
"type": "select"
|
||||
}, {
|
||||
"name": "precio_unitario"
|
||||
"name": "precio_unidad"
|
||||
}, {
|
||||
"name": "precio_total"
|
||||
}, {
|
||||
@ -278,3 +289,163 @@
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<!------------------------------------------------------->
|
||||
<!-- Código JS comportamiento tabla servicios acabado. -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
const lastColNr2 = $('#tableOfServiciosEncuadernacion').find("tr:first th").length - 1;
|
||||
|
||||
editor = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfPresupuestoEncuadernaciones') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfServiciosEncuadernacion",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
"name": "tarifa_encuadernado_id",
|
||||
"type": "select"
|
||||
}, {
|
||||
"name": "precio_unidad"
|
||||
}, {
|
||||
"name": "precio_total"
|
||||
}, {
|
||||
"name": "presupuesto_id",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
} );
|
||||
|
||||
// Generación de la lista de servicios de acabado (id, nombre)
|
||||
const encuadernadosList = <?php echo json_encode($serviciosEncuadernacion); ?>;
|
||||
editor.field( 'tarifa_encuadernado_id' ).update( encuadernadosList );
|
||||
|
||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['presupuesto_id'] = id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
d.data[v]['presupuesto_id'] = id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
});
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfServiciosEncuadernacion').on( 'click', 'tbody span.edit', function (e) {
|
||||
editor.inline(
|
||||
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||
cancelTrigger: 'span.cancel',
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
||||
submitTrigger: 'span.edit',
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$('#tableOfServiciosEncuadernacion').on( 'click', 'tbody span.remove', function (e) {
|
||||
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
editor
|
||||
.create( false )
|
||||
.edit( this.parentNode, false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var theTable = $('#tableOfServiciosEncuadernacion').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfPresupuestoEncuadernaciones') ?>',
|
||||
data: {
|
||||
id_presupuesto: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{'data': 'tarifa_encuadernado_id',
|
||||
render: function(data, type, row, meta) {
|
||||
var value = encuadernadosList.find(element => element.value === data);
|
||||
return value['label'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'precio_unidad' },
|
||||
{ 'data': 'precio_total' },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr2]
|
||||
},
|
||||
{
|
||||
"orderData": [ 0, 1 ],
|
||||
"targets": 0
|
||||
},
|
||||
|
||||
],
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
buttons: [ {
|
||||
className: 'btn btn-primary float-end me-sm-3 me-1',
|
||||
extend: "createInline",
|
||||
editor: editor,
|
||||
formOptions: {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<i class="ti ti-device-floppy"/>'
|
||||
}
|
||||
} ]
|
||||
} );
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user