trabajando en pedidos 3

This commit is contained in:
jaimejimenezortega
2024-06-13 23:53:20 +02:00
parent b1734e169b
commit c9d8875392
12 changed files with 418 additions and 83 deletions

View File

@ -524,6 +524,7 @@ $routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Cliente
$routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
$routes->get('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'newCosidotapablanda']);
$routes->get('edit/(:any)', 'Cosidotapablanda::edit/$1', ['as' => 'editarPresupuesto']);
$routes->post('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'createCosidotapablanda']);
$routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']);
$routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']);
@ -541,6 +542,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
$routes->post('edit/(:num)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente']);
$routes->get('edit/(:any)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente2']);
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
@ -598,6 +600,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
$routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']);
$routes->post('add', 'Pedido::add', ['as' => 'crearPedido']);
$routes->get('edit/(:any)', 'Pedido::edit/$1', ['as' => 'editarPedido']);
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
});
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);

View File

@ -27,6 +27,8 @@ class Pedido extends \App\Controllers\BaseResourceController
$this->viewData['pageTitle'] = lang('Tarifaextra.moduleTitle');
// Se indica que este controlador trabaja con soft_delete
$this->viewData = ['usingServerSideDataTable' => true];
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_pedidos"), 'route' => "javascript:void(0);", 'active' => false],
@ -130,6 +132,29 @@ class Pedido extends \App\Controllers\BaseResourceController
}
}
public function getlineas(){
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;
}
$id = $reqData['pedido_id'] ?? 0;
$resourceData = $this->model->obtenerLineasPedido($id);
return $this->respond(Collection::datatable(
$resourceData,
count($resourceData),
count($resourceData)
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
private function obtenerDatosFormulario(&$pedidoEntity){
$datos = $this->model->obtenerDatosForm($pedidoEntity->id);

View File

@ -20,18 +20,11 @@ class Test extends BaseController
public function index()
{
helper('rbac');
//$user = auth()->user();
//generate_php_permissions_constant();
echo generate_php_permissions_matrix_constant();
//$user->syncGroups('admin');
//var_dump($user->can('token.menu'));
$model = new PresupuestoModel();
$data = $model->generarLineaPedido(123);
echo '<pre>';
var_dump($data);
echo '</pre>';
}

View File

@ -35,11 +35,31 @@ return [
'fecha_entrega_externo' => 'External Delivery Date',
'lineas' => 'Lines',
'unidades' => "Units",
'concepto' => "Concept",
'total' => "Total",
'presupuesto' => 'Budget',
'moduleTitle' => 'Orders',
'pedido' => 'Order',
'pedidos' => 'Orders',
'pedidosList' => 'Orders List',
'unaCara' => '1 side',
'dosCaras' => '2 sides',
'lineasTemplates' =>[
'libro' => "[BUDGET %s] Printing of %s copies of %s pages.\nTitle: %s. Author: %s. ISBN: %s.Size: %smm.\n",
'libro_linea_interior' => "%s black pages on %s paper of %s grams",
'libro_linea_cubierta' => "\nCover printed on %s on %s paper of %s grams",
'libro_linea_sobrecubierta' => "\nDust jacket on %s paper of %s grams",
'libro_solapas' => " with flaps of %smm.",
'libro_encuadernacion' => "\nType of binding: %s"
],
'albaranes' => 'Delivery Notes',
'facturas' => 'Invoices',
'validation' => [

View File

@ -34,12 +34,32 @@ return [
'fecha_entrega_externo' => "Fecha entrega externo",
'lineas' => 'Líneas pedido',
'unidades' => "Unidades",
'concepto' => "Concepto",
'total' => "Total",
'presupuesto' => 'Presupuesto',
'moduleTitle' => 'Pedidos',
'pedido' => 'Pedido',
'pedidos' => 'Pedidos',
'pedidosList' => 'Lista de Pedidos',
'unaCara' => '1 cara',
'dosCaras' => '2 caras',
'lineasTemplates' =>[
'libro' => "[PRESUPUESTO %s] Impresión de %s ejemplares de %s páginas.\nTítulo: %s. Autor: %s. ISBN: %s.Tamaño: %smm.\n",
'libro_linea_interior' => "%s páginas en negro sobre papel %s de %s gramos",
'libro_linea_cubierta' => "\nCubierta impresa a %s sobre papel %s de %s gramos",
'libro_linea_sobrecubierta' => "\nSobrecubierta sobre papel %s de %s gramos",
'libro_solapas' => " con solapas de %smm." ,
'libro_encuadernacion' => "\nTipo de encuadernación: %s"
],
'albaranes' => 'Albaranes',
'facturas' => 'Facturas',
'validation' => [
],

View File

@ -67,4 +67,22 @@ class PedidoModel extends \App\Models\BaseModel
return $builder->get()->getResultObject();
}
public function obtenerLineasPedido($pedido_id){
$builder = $this->db
->table($this->table . " t1")
->select(
"t2.presupuesto_id"
);
$builder->where("t1.id", $pedido_id);
$builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left");
$model_presupuesto = model("App\Models\Presupuestos\PresupuestoModel");
$lineasPresupuesto = [];
foreach($builder->get()->getResultObject() as $row){
array_push($lineasPresupuesto, $model_presupuesto->generarLineaPedido($row->presupuesto_id)[0]);
}
return $lineasPresupuesto;
}
}

View File

@ -538,5 +538,172 @@ class PresupuestoModel extends \App\Models\BaseModel
return $json;
}
public function generarLineaPedido($presupuesto_id)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS numero, t1.tipo_impresion_id as tipo, t1.tirada AS unidades, t1.total_aceptado as total, t1.paginas AS paginas,
t1.titulo AS titulo, t1.autor AS autor, t1.isbn AS isbn,
t1.papel_formato_id AS papel_formato_id, t1.papel_formato_personalizado AS papel_formato_personalizado,
t1.papel_formato_ancho AS papel_formato_ancho, t1.papel_formato_alto AS papel_formato_alto,
CONCAT(CAST(t2.ancho AS INT), 'x', CAST(t2.alto AS INT)) AS tamanio,
t3.codigo AS codigo_encuadernacion,
t1.solapas AS solapas_cubierta, CAST(t1.solapas_ancho AS INT) AS solapas_ancho_cubierta,
t1.solapas_sobrecubierta AS solapas_sobrecubierta, CAST(t1.solapas_ancho_sobrecubierta AS INT) AS solapas_ancho_sobrecubierta,"
);
$builder->join("lg_papel_formato t2", "t1.papel_formato_id = t2.id", "left");
$builder->join("tipos_presupuestos t3", "t1.tipo_impresion_id = t3.id", "left");
$builder->where("t1.is_deleted", 0);
$builder->where("t1.id", $presupuesto_id);
$presupuesto = $builder->get()->getResultObject();
if(count($presupuesto) > 0){
$modelLinea = model('App\Models\Presupuestos\PresupuestoLineaModel');
$lineas = $modelLinea->where('presupuesto_id', $presupuesto_id)->findAll();
$presupuesto = $presupuesto[0];
// Libro
if($presupuesto->tipo < 10){
if($presupuesto->papel_formato_personalizado == 1){
$presupuesto->tamanio= $presupuesto->papel_formato_ancho . "x" . $presupuesto->papel_formato_alto;
}
$presupuesto->concepto = sprintf(lang('Pedidos.lineasTemplates.libro'),
$presupuesto->numero,
$presupuesto->unidades,
$presupuesto->paginas,
$presupuesto->titulo,
$presupuesto->autor,
$presupuesto->isbn,
$presupuesto->tamanio);
$presupuesto->concepto .= $this->generarConceptoLineasPresupuestoLibro($lineas, $presupuesto);
$presupuesto = (object)[
'numero' => $presupuesto->numero,
'unidades' => $presupuesto->unidades,
'total' => $presupuesto->total,
'concepto' => $presupuesto->concepto,
];
}
return [$presupuesto];
}
}
private function generarConceptoLineasPresupuestoLibro($lineas, $presupuesto){
$model_papel = model('App\Models\Configuracion\PapelImpresionModel');
$description_interior = "";
$description_cubierta = "";
$description_sobrecubierta = "";
$paginas_negro = 0;
$paginas_color = 0;
$papel_negro = "";
$papel_color = "";
$gramaje_negro = 0;
$gramaje_color = 0;
$lp_bn_lines = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_bn') === 0;
});
$lp_color_lines = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_color') === 0;
});
$lp_rot_bn = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_rot_bn') === 0;
});
$lp_rot_color = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_rot_color') === 0;
});
if(count($lp_bn_lines) > 0){
$lp_bn_lines = array_values($lp_bn_lines)[0];
$paginas_negro = $lp_bn_lines->paginas;
$gramaje_negro = $lp_bn_lines->gramaje;
$papel_negro = $model_papel->where('id', $lp_bn_lines->papel_impresion_id)->first()->nombre;
$description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'),
strval($paginas_negro),
$papel_negro,
strval($gramaje_negro)) . ". ";
}
if(count($lp_color_lines) > 0){
$lp_color_lines = array_values($lp_color_lines)[0];
$paginas_color = $lp_color_lines->paginas;
$gramaje_color = $lp_color_lines->gramaje;
$papel_color = $model_papel->where('id', $lp_color_lines->papel_impresion_id)->first()->nombre;
$description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'),
strval($paginas_color),
$papel_color,
strval($gramaje_color)) . ". ";
}
if(count($lp_rot_bn) > 0){
$lp_rot_bn = array_values($lp_rot_bn)[0];
$paginas_negro = $lp_rot_bn->paginas;
$gramaje_negro = $lp_rot_bn->gramaje;
$papel_negro = $model_papel->where('id', $lp_rot_bn->papel_impresion_id)->first()->nombre;
$description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'),
strval($paginas_negro),
$papel_negro,
strval($gramaje_negro)) . ". ";
}
if(count($lp_rot_color) > 0){
$lp_rot_color = array_values($lp_rot_color)[0];
$paginas_negro = intval($lp_rot_color->paginas)-intval($lp_rot_color->rotativa_pag_color);
$gramaje = $lp_rot_color->gramaje;
$papel = $model_papel->where('id', $lp_rot_color->papel_impresion_id)->first()->nombre;
if($paginas_negro > 0){
$description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'),
strval($paginas_negro),
$papel,
strval($gramaje)) . ". ";
}
$description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'),
strval($lp_rot_color->rotativa_pag_color),
$papel,
strval($gramaje)) . ". ";
}
$lp_cubierta = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_cubierta') === 0;
});
$lp_sobrecubierta = array_filter($lineas, function($linea) {
return strpos($linea->tipo, 'lp_sobrecubierta') === 0;
});
if(count($lp_cubierta) > 0){
$lp_cubierta = array_values($lp_cubierta)[0];
if($lp_cubierta->paginas == 2){
$lp_cubierta->caras = lang('Pedidos.unaCara');
}
else{
$lp_cubierta->caras = lang('Pedidos.dosCaras');
}
$description_cubierta = sprintf(lang('Pedidos.lineasTemplates.libro_linea_cubierta'),
$lp_cubierta->caras,
$model_papel->where('id', $lp_cubierta->papel_impresion_id)->first()->nombre,
strval($lp_cubierta->gramaje));
$description_cubierta .= ($presupuesto->solapas_cubierta==1? sprintf(lang('Pedidos.lineasTemplates.libro_solapas'), $presupuesto->solapas_ancho_cubierta):". ");
}
if(count($lp_sobrecubierta) > 0){
$lp_sobrecubierta = array_values($lp_sobrecubierta)[0];
$description_sobrecubierta = sprintf(lang('Pedidos.lineasTemplates.libro_linea_sobrecubierta'),
$model_papel->where('id', $lp_sobrecubierta->papel_impresion_id)->first()->nombre,
strval($lp_sobrecubierta->gramaje));
$description_sobrecubierta .= ($presupuesto->solapas_sobrecubierta==1? sprintf(lang('Pedidos.lineasTemplates.libro_solapas'), $presupuesto->solapas_ancho_sobrecubierta):". ");
}
$acabado = sprintf(lang('Pedidos.lineasTemplates.libro_encuadernacion'),
lang('Presupuestos.' . $presupuesto->codigo_encuadernacion));
return $description_interior. $description_cubierta . $description_sobrecubierta . $acabado;
}
}

View File

@ -0,0 +1,24 @@
<div class="accordion accordion-bordered mt-3" id="accordioAlbaranes">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingAlbaranes">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionAlbaranesTip" aria-expanded="false" aria-controls="accordionAlbaranesTip">
<h3><?= lang("Pedidos.albaranes") ?></h3>
</button>
</h2>
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show" data-bs-parent="#accordioAlbaranes">
<div class="accordion-body">
</div> <!-- /.accordion-body -->
</div>
</div>
</div>
<?=$this->section('additionalInlineJs') ?>
<?=$this->endSection() ?>

View File

@ -27,7 +27,7 @@
<label for="cliente" class="form-label">
<?= lang('Pedidos.cliente') ?>
<div class="btn-group btn-group-sm">
<a href="<?= route_to('editarCliente', $pedidoEntity->cliente_id); ?>" target="_blank" ><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="<?= route_to('editarCliente', $pedidoEntity->cliente_id); ?>" target="_blank" ><i class="ti ti-file-search ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</label>
<input readonly id="cliente" name="cliente" tabindex="2" maxLength="11" class="form-control" value="<?= old('cliente', $pedidoEntity->cliente) ?>" >
@ -60,7 +60,7 @@
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<?= lang('Pedidos.totales') ?>
<i class="ti ti-businessplan ti-sm mx-2"></i><?= lang('Pedidos.totales') ?>
</button>
</h2>
@ -95,7 +95,7 @@
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<?= lang("Pedidos.fechas") ?>
<i class="ti ti-calendar ti-sm mx-2"></i><?= lang("Pedidos.fechas") ?>
</button>
</h2>

View File

@ -0,0 +1,24 @@
<div class="accordion accordion-bordered mt-3" id="accordioFacturas">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingFacturas">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionFacturasTip" aria-expanded="false" aria-controls="accordionFacturasTip">
<h3><?= lang("Pedidos.facturas") ?></h3>
</button>
</h2>
<div id="accordionFacturasTip" class="accordion-collapse collapse show" data-bs-parent="#accordioFacturas">
<div class="accordion-body">
</div> <!-- /.accordion-body -->
</div>
</div>
</div>
<?=$this->section('additionalInlineJs') ?>
<?=$this->endSection() ?>

View File

@ -13,24 +13,21 @@
<table id="tableOfLineasPedido" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?=lang('Presupuestos.id')?></th>
<th><?= lang('Presupuestos.created_at') ?></th>
<th><?= lang('Presupuestos.tipoPresupuesto') ?></th>
<th><?= lang('Clientes.cliente') ?></th>
<th><?= lang('Presupuestos.comercial') ?></th>
<th><?= lang('Presupuestos.titulo') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th><?= lang('Presupuestos.incRei') ?></th>
<th class='noFilter'><?= lang('Presupuestos.paginas') ?></th>
<th class='noFilter'><?= lang('Presupuestos.tirada') ?></th>
<th class='noFilter'><?= lang('Presupuestos.totalPresupuesto') ?></th>
<th><?= lang('Presupuestos.presupuestoEstado') ?></th>
<th class="noFilter text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?= lang('Pedidos.presupuesto') ?></th>
<th><?=lang('Pedidos.unidades')?></th>
<th><?= lang('Pedidos.concepto') ?></th>
<th><?= lang('Pedidos.total') ?></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th colspan="4" style="text-align:right">Total:</th>
</tr>
</tfoot>
</table>
</div> <!-- /.accordion-body -->
</div>
@ -40,64 +37,97 @@
<?=$this->section('additionalInlineJs') ?>
$("#fecha_entrega_real").flatpickr({
dateFormat: "d/m/Y",
locale: {
firstDayOfWeek: 1,
weekdays: {
shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
},
months: {
shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
const lastColNr = $('#tableOfLineasPedido').find("tr:first th").length - 1;
const viewPresupuestoBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-file-search ti-sm btn-view mx-2" data-id="${data.numero}"></i></a>
</div>
</td>`;
};
var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
searchable: false,
info: false,
dom: '',
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('tablaLineasPedido') ?>',
data: function ( d ) {
d.pedido_id = <?= $pedidoEntity->id ?>;
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
targets: 0,
orderable: false,
data: null,
defaultContent: ''
},
{
targets: [1,2,3],
orderable: false,
},
],
columns: [
{
data: viewPresupuestoBtns,
className: 'dt-center'
},
{data: 'unidades'},
{data: 'concepto'},
{data: 'total'},
],
footerCallback: function (row, data, start, end, display) {
let api = this.api();
// Remove the formatting to get integer data for summation
let intVal = function (i) {
return typeof i === 'string'
? i.replace(/[\$,]/g, '') * 1
: typeof i === 'number'
? i
: 0;
};
// Total over all pages
total = api
.column(3)
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// Update footer
api.column(3).footer().innerHTML =
'Total: ' + total;
}
});
$("#fecha_impresion").flatpickr({
dateFormat: "d/m/Y",
locale: {
firstDayOfWeek: 1,
weekdays: {
shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
},
months: {
shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
},
},
});
$("#fecha_encuadernado").flatpickr({
dateFormat: "d/m/Y",
locale: {
firstDayOfWeek: 1,
weekdays: {
shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
},
months: {
shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
},
},
});
$("#fecha_entrega_externo").flatpickr({
dateFormat: "d/m/Y",
locale: {
firstDayOfWeek: 1,
weekdays: {
shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
},
months: {
shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
},
},
$(document).on('click', '.btn-view', function(e) {
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')): ?>
var url = '<?= route_to('editarPresupuesto', ':id') ?>';
<?php else: ?>
var url = '<?= route_to('editarPresupuestoCliente2', ':id') ?>';
<?php endif; ?>
url = url.replace(':id', `${$(this).attr('data-id')}` );
console.log(url);
window.open(
url,
'_blank' // <- This is what makes it open in a new window.
);
});
<?=$this->endSection() ?>

View File

@ -17,6 +17,8 @@
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
<?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
<?= view("themes/vuexy/form/pedidos/_albaranesItems") ?>
<?= view("themes/vuexy/form/pedidos/_facturasItems") ?>
</div><!-- /.card-body -->
<div class="pt-4">
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
@ -30,9 +32,18 @@
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.css") ?>">
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/select/dataTables.select.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
<?=$this->endSection() ?>