mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/config_cabezada' into 'main'
Feat/config cabezada See merge request jjimenez/safekat!893
This commit is contained in:
@ -394,7 +394,7 @@ class ImportadorBubok extends BaseResourceController
|
||||
'gramajeCubierta' => in_array($encuadernadoId, [1, 3]) ? 150 : 300, // 150 gramos para "fresado tapa dura" y "cosido tapa dura"
|
||||
'solapas' => !empty($producto->cover->type->consolapas) ? 80 : 0,
|
||||
'acabado' => $acabadoId,
|
||||
'cabezada' => 'WHI',
|
||||
'cabezada' => model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadaDefault(),
|
||||
'lomoRedondo' => 0
|
||||
],
|
||||
'guardas' => [],
|
||||
|
||||
@ -272,7 +272,7 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
'gramajeCubierta' => $libro->cubierta_gramaje,
|
||||
'solapas' => $libro->cubierta_ancho_solapas,
|
||||
'acabado' => $libro->cubierta_acabado_id,
|
||||
'cabezada' => 'WHI',
|
||||
'cabezada' => model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadaDefault(),
|
||||
'lomoRedondo' => 0
|
||||
],
|
||||
|
||||
|
||||
@ -460,6 +460,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
||||
|
||||
$this->viewData['cabezadas'] = model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadasDisponibles();
|
||||
|
||||
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($presupuestoEntity->tipo_impresion_id));
|
||||
|
||||
$this->viewData['formAction'] = route_to('updatePresupuestoAdmin', $id);
|
||||
|
||||
@ -133,6 +133,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$this->viewData['lomo_maximo_fresado_cosido'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('lomo_maximo_fresado_cosido')->value;
|
||||
$this->viewData['lomo_minimo_fresado_cosido'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('lomo_minimo_fresado_cosido')->value;
|
||||
$this->viewData['eb'] = 0;
|
||||
$this->viewData['cabezadas'] = model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadasDisponibles();
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
@ -178,6 +179,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$this->viewData['lomo_maximo_fresado_cosido'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('lomo_maximo_fresado_cosido')->value;
|
||||
$this->viewData['lomo_minimo_fresado_cosido'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('lomo_minimo_fresado_cosido')->value;
|
||||
$this->viewData['eb'] = $presupuestoEntity->envio_base;
|
||||
$this->viewData['cabezadas'] = model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadasDisponibles();
|
||||
|
||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||
@ -1103,7 +1105,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1 ? intval($cubierta['tamanioSolapas']) : 0,
|
||||
'acabado' => $cubierta['acabado'] ?? 0,
|
||||
'lomoRedondo' => $cubierta['lomoRedondo'] ?? 0,
|
||||
'cabezada' => $cubierta['cabezada'] ?? 'WHI',
|
||||
'cabezada' => $cubierta['cabezada'] ?? model('\App\Models\Configuracion\ConfigVariableModel')->getCabezadaDefault(),
|
||||
];
|
||||
|
||||
// Sobrecubierta
|
||||
|
||||
@ -56,4 +56,40 @@ class ConfigVariableModel extends Model
|
||||
|
||||
return $builder->get()->getFirstRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve solo el valor de la variable por nombre
|
||||
*/
|
||||
public function getValue(string $name): ?string
|
||||
{
|
||||
$row = $this->getVariable($name);
|
||||
return $row ? $row->value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve el valor decodificado (JSON) si aplica
|
||||
*/
|
||||
public function getDecodedValue(string $name): ?array
|
||||
{
|
||||
$value = $this->getValue($name);
|
||||
$decoded = json_decode($value, true);
|
||||
|
||||
return (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) ? $decoded : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve las opciones disponibles de cabezadas (como array clave => langKey)
|
||||
*/
|
||||
public function getCabezadasDisponibles(): array
|
||||
{
|
||||
return $this->getDecodedValue('cabezadas_disponibles') ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve la cabezada por defecto, o 'WHI' si no está definida
|
||||
*/
|
||||
public function getCabezadaDefault(): string
|
||||
{
|
||||
return $this->getValue('cabezada_default') ?? 'WHI';
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableConfigVariables" class="table table-striped table-hover" style="width: 100%;">
|
||||
<table id="tableConfigVariables" class="table table-striped table-hover table-responsive" style="width: 100%; word-break: break-word;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('ConfigVariables.datatable.columns.name') ?></th>
|
||||
@ -55,11 +55,13 @@
|
||||
<div class="row g-4">
|
||||
<div class="col-12 mb-0">
|
||||
<label for="value" class="form-label"><?= lang('ConfigVariables.form.value') ?></label>
|
||||
<input type="number" min=0 id="value" class="form-control">
|
||||
<div id="value-wrapper">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-0">
|
||||
<label for="description" class="form-label"><?= lang('ConfigVariables.form.description') ?></label>
|
||||
<textarea type="text" rows="4" cols="10" id="description" class="form-control"></textarea>
|
||||
<textarea type="text" rows="4" cols="10" id="description" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -75,4 +77,13 @@
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= versioned_asset('assets/js/safekat/pages/configuracion/variables.js') ?>"></script>
|
||||
<script>
|
||||
// Pasamos las opciones al frontend desde PHP
|
||||
window.CABEZADAS_OPCIONES = <?= json_encode([
|
||||
'WHI' => lang('Presupuestos.blanca'),
|
||||
'GRE' => lang('Presupuestos.verde'),
|
||||
'BLUE' => lang('Presupuestos.azul'),
|
||||
'REDYEL' => lang('Presupuestos.rojaAmarilla'),
|
||||
]) ?>;
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -222,46 +222,39 @@
|
||||
</div>
|
||||
|
||||
<?php if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3): ?>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<label id="label_compLomoRedondo" for="compLomoRedondo" class="form-label">
|
||||
<?= lang('Presupuestos.lomoRedondo') ?>*
|
||||
</label>
|
||||
<select id="compLomoRedondo" name="lomo_redondo" service-id="<?= $serviciosAutomaticos['lomo_redondo'] ?>"
|
||||
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<p>
|
||||
<?= lang('Presupuestos.no') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="1">
|
||||
<p>
|
||||
<?= lang('Presupuestos.si') ?>
|
||||
</p>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<label for="cabezada" class="form-label">
|
||||
<?= lang('Presupuestos.cabezada') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2" id="cabezada" name="cabezada">
|
||||
<option value="WHI">
|
||||
<?= lang('Presupuestos.blanca') ?>
|
||||
</option>
|
||||
<option value="GRE">
|
||||
<?= lang('Presupuestos.verde') ?>
|
||||
</option>
|
||||
<option value="BLUE">
|
||||
<?= lang('Presupuestos.azul') ?>
|
||||
</option>
|
||||
<option value="REDYEL">
|
||||
<?= lang('Presupuestos.rojaAmarilla') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<label id="label_compLomoRedondo" for="compLomoRedondo" class="form-label">
|
||||
<?= lang('Presupuestos.lomoRedondo') ?>*
|
||||
</label>
|
||||
<select id="compLomoRedondo" name="lomo_redondo" service-id="<?= $serviciosAutomaticos['lomo_redondo'] ?>"
|
||||
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<p>
|
||||
<?= lang('Presupuestos.no') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="1">
|
||||
<p>
|
||||
<?= lang('Presupuestos.si') ?>
|
||||
</p>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<label for="cabezada" class="form-label">
|
||||
<?= lang('Presupuestos.cabezada') ?>
|
||||
</label>
|
||||
<select class="form-select" name="cabezada" id="cabezada">
|
||||
<?php foreach ($cabezadas as $key => $langKey): ?>
|
||||
<option value="<?= esc($key) ?>">
|
||||
<?= lang($langKey) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
@ -269,83 +262,83 @@
|
||||
</div>
|
||||
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8 && $tipo_impresion_id != 21): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<p>
|
||||
<?= lang('PapelImpresion.sobrecubierta') ?>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<p>
|
||||
<?= lang('PapelImpresion.sobrecubierta') ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compSobrecubierta" name="comp_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<?= lang('Presupuestos.no') ?>
|
||||
</option>
|
||||
<option value="1">
|
||||
<?= lang('Presupuestos.si') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select disabled id="compPapelSobrecubierta" name="comp_papel_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select disabled id="compGramajeSobrecubierta" name="comp_gramaje_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compSobrecubierta" name="comp_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<?= lang('Presupuestos.no') ?>
|
||||
</option>
|
||||
<option value="1">
|
||||
<?= lang('Presupuestos.si') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select disabled id="compPapelSobrecubierta" name="comp_papel_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select disabled id="compGramajeSobrecubierta" name="comp_gramaje_sobrecubierta"
|
||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<p>
|
||||
<?= lang('PapelImpresion.guardas') ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compCarasGuardas" name="comp_paginas_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<p>
|
||||
<?= lang('Presupuestos.sinImpresion') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<p>
|
||||
<?= lang('Presupuestos.unaCara') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="8">
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8): ?>
|
||||
<p>
|
||||
<?= lang('Presupuestos.dosCaras') ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select id="compPapelGuardas" name="comp_papel_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compGramajeGuardas" name="comp_gramaje_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<p>
|
||||
<?= lang('PapelImpresion.guardas') ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compCarasGuardas" name="comp_paginas_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<p>
|
||||
<?= lang('Presupuestos.sinImpresion') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<p>
|
||||
<?= lang('Presupuestos.unaCara') ?>
|
||||
</p>
|
||||
</option>
|
||||
<option value="8">
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8): ?>
|
||||
<p>
|
||||
<?= lang('Presupuestos.dosCaras') ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select id="compPapelGuardas" name="comp_papel_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compGramajeGuardas" name="comp_gramaje_guardas"
|
||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row">
|
||||
@ -733,102 +726,102 @@
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
<?php if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
<div class="accordion mt-3" id="accordionCompGuardas">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button id="accordion-button-int-guardas" type="button" class="accordion-button"
|
||||
data-bs-toggle="collapse" data-bs-target="#accordionCompGuardasTip"
|
||||
aria-expanded="false" aria-controls="accordionCompGuardasTip">
|
||||
<h6 id="title_guardas">
|
||||
<?= lang("Presupuestos.Guardas") ?>
|
||||
</h6>
|
||||
</button>
|
||||
</h2>
|
||||
<div class="accordion mt-3" id="accordionCompGuardas">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button id="accordion-button-int-guardas" type="button" class="accordion-button"
|
||||
data-bs-toggle="collapse" data-bs-target="#accordionCompGuardasTip"
|
||||
aria-expanded="false" aria-controls="accordionCompGuardasTip">
|
||||
<h6 id="title_guardas">
|
||||
<?= lang("Presupuestos.Guardas") ?>
|
||||
</h6>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionCompGuardasTip" class="accordion-collapse collapse"
|
||||
data-bs-parent="#accordionCompGuardasTip">
|
||||
<div class="accordion-body">
|
||||
<div id="accordionCompGuardasTip" class="accordion-collapse collapse"
|
||||
data-bs-parent="#accordionCompGuardasTip">
|
||||
<div class="accordion-body">
|
||||
|
||||
<table id="tableCompGuardas" class="comparator-table table dt-responsive dataTable"
|
||||
style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.tipo') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.paginas') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.papel') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.gramaje') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.marca') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.maquina') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.numeroPliegos') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.pliegosPedido') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.precioPliego') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.libro') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.totalPapelPedido') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.lomo') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.peso') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.horas') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.precioImpresion') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.total') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="dt-result dt-result-text" colspan="14">
|
||||
<?= lang('Presupuestos.total') ?>
|
||||
<?= lang("Presupuestos.Guardas") ?>:
|
||||
</td>
|
||||
<td id="total_comp_guardas" class="dt-result dt-result-value" colspan="2">
|
||||
0.00 </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<table id="tableCompGuardas" class="comparator-table table dt-responsive dataTable"
|
||||
style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.tipo') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.paginas') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.papel') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.gramaje') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.marca') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.maquina') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.numeroPliegos') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.pliegosPedido') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.precioPliego') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.libro') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.totalPapelPedido') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.lomo') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.peso') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.horas') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em; max-width:80px">
|
||||
<?= lang('Presupuestos.precioImpresion') ?>
|
||||
</th>
|
||||
<th style="padding-right: 0.75em;">
|
||||
<?= lang('Presupuestos.total') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="dt-result dt-result-text" colspan="14">
|
||||
<?= lang('Presupuestos.total') ?>
|
||||
<?= lang("Presupuestos.Guardas") ?>:
|
||||
</td>
|
||||
<td id="total_comp_guardas" class="dt-result dt-result-value" colspan="2">
|
||||
0.00 </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<button type="button" name="insertarGuardasBtn" id="insertarGuardasBtn"
|
||||
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
|
||||
<?= lang('Presupuestos.insertarLinea') . ' ' . strtoupper(lang('Presupuestos.Guardas')) ?>
|
||||
</button>
|
||||
<div>
|
||||
<button type="button" name="insertarGuardasBtn" id="insertarGuardasBtn"
|
||||
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
|
||||
<?= lang('Presupuestos.insertarLinea') . ' ' . strtoupper(lang('Presupuestos.Guardas')) ?>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="accordion mt-3" id="accordionCompFaja">
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
<a href="<?= route_to('editarCliente', $cliente_id); ?>" target="_blank"><i class="ti ti-file-search ti-sm mx-2""></i></a>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
<select id=" clienteId" name="cliente_id" class="form-control select2bs2" style="width: 100%;">
|
||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -136,10 +136,11 @@
|
||||
<?= lang('Presupuestos.cabezada') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2" id="cabezada" name="cabezada">
|
||||
<option value="WHI"><?= lang('Presupuestos.blanca') ?></option>
|
||||
<option value="GRE"><?= lang('Presupuestos.verde') ?></option>
|
||||
<option value="BLUE"><?= lang('Presupuestos.azul') ?></option>
|
||||
<option value="REDYEL"><?= lang('Presupuestos.rojaAmarilla') ?></option>
|
||||
<?php foreach ($cabezadas as $key => $langKey): ?>
|
||||
<option value="<?= esc($key) ?>">
|
||||
<?= lang($langKey) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
|
||||
import Modal from "./modal.js";
|
||||
import Ajax from "./ajax.js";
|
||||
class ConfigVariableDatatable
|
||||
{
|
||||
constructor(domItem)
|
||||
{
|
||||
class ConfigVariableDatatable {
|
||||
constructor(domItem) {
|
||||
this.domItem = domItem
|
||||
this.datatableItem = this.domItem
|
||||
this.modalItem = $("#modalConfigVariableForm")
|
||||
@ -14,76 +12,69 @@ class ConfigVariableDatatable
|
||||
this.formEdit = this.modalItem.find("#formEditConfigVariable")
|
||||
|
||||
}
|
||||
init(){
|
||||
init() {
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
dom: 'Blrtip',
|
||||
serverSide: true,
|
||||
lengthMenu: [ 25, 50, 100, 200 ],
|
||||
lengthMenu: [25, 50, 100, 200],
|
||||
pageLength: 50,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns : [
|
||||
{data : 'name',searchable:true,sortable:false},
|
||||
{data : 'value',searchable:true,sortable:false},
|
||||
{data : 'description',searchable:true,sortable:false},
|
||||
{data : 'action',sortable:false,searchable:false,
|
||||
render : (d,t) =>{
|
||||
columns: [
|
||||
{ data: 'name', searchable: true, sortable: false },
|
||||
{ data: 'value', searchable: true, sortable: false },
|
||||
{ data: 'description', searchable: true, sortable: false },
|
||||
{
|
||||
data: 'action', sortable: false, searchable: false,
|
||||
render: (d, t) => {
|
||||
return `
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0)" data-id="${d}" class="edit-variable"><i class="ti ti-pencil ti-sm mx-2"></i></a>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
ajax: '/configuracion/variables/datatable'
|
||||
});
|
||||
|
||||
}
|
||||
events()
|
||||
{
|
||||
this.modalItem.on("click",".btn-update-variable",this.handleUpdateVariable.bind(this))
|
||||
this.datatableItem.on("click",".edit-variable",(e)=> {
|
||||
events() {
|
||||
this.modalItem.on("click", ".btn-update-variable", this.handleUpdateVariable.bind(this))
|
||||
this.datatableItem.on("click", ".edit-variable", (e) => {
|
||||
e.preventDefault()
|
||||
this.variableId = $(e.currentTarget).data("id")
|
||||
this.handleGetVariable()
|
||||
})
|
||||
|
||||
}
|
||||
handleGetVariable()
|
||||
{
|
||||
handleGetVariable() {
|
||||
const url = `/configuracion/variables/find/${this.variableId}`
|
||||
let ajax = new Ajax(
|
||||
url,null,null,
|
||||
url, null, null,
|
||||
this.handleGetVariableSuccess.bind(this),
|
||||
this.handleGetVariableError.bind(this)
|
||||
)
|
||||
ajax.get()
|
||||
|
||||
}
|
||||
handleGetVariableSuccess(data){
|
||||
handleGetVariableSuccess(data) {
|
||||
this.formEdit[0].reset()
|
||||
this.modalEdit.toggle()
|
||||
this.nameInput = this.formEdit
|
||||
.find("#name")
|
||||
this.nameInput = this.formEdit.find("#name")
|
||||
this.nameInput.val(data.name)
|
||||
this.valueInput = this.formEdit
|
||||
.find("#value")
|
||||
this.valueInput.val(data.value)
|
||||
this.descriptionInput = this.formEdit
|
||||
.find("#description")
|
||||
this.renderValueField(data.name, data.value)
|
||||
this.descriptionInput = this.formEdit.find("#description")
|
||||
this.descriptionInput.val(data.description)
|
||||
|
||||
}
|
||||
handleGetVariableError(err){}
|
||||
handleUpdateVariable()
|
||||
{
|
||||
handleGetVariableError(err) { }
|
||||
handleUpdateVariable() {
|
||||
const url = `/configuracion/variables/edit/${this.variableId}`
|
||||
const data = {
|
||||
value : this.valueInput.val(),
|
||||
description : this.descriptionInput.val(),
|
||||
value: this.valueInput.val(),
|
||||
description: this.descriptionInput.val(),
|
||||
}
|
||||
let ajax = new Ajax(
|
||||
url,
|
||||
@ -94,26 +85,49 @@ class ConfigVariableDatatable
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handleUpdateVariableSucess(data){
|
||||
handleUpdateVariableSucess(data) {
|
||||
this.modalEdit.toggle()
|
||||
this.datatable.ajax.reload()
|
||||
}
|
||||
handleUpdateVariableError(err){}
|
||||
handleUpdateVariableError(err) { }
|
||||
|
||||
handleDeleteVariable()
|
||||
{
|
||||
handleDeleteVariable() {
|
||||
const url = `/configuracion/variables/delete/${this.variableId}`
|
||||
let ajax = new Ajax(
|
||||
url,null,null,
|
||||
url, null, null,
|
||||
this.handleDeleteVariableSucess.bind(this),
|
||||
this.handleDeleteVariableError.bind(this)
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handleDeleteVariableSucess(data){
|
||||
handleDeleteVariableSucess(data) {
|
||||
this.datatable.reload()
|
||||
}
|
||||
handleDeleteVariableError(err){}
|
||||
handleDeleteVariableError(err) { }
|
||||
|
||||
renderValueField(name, currentValue) {
|
||||
const wrapper = this.formEdit.find("#value-wrapper");
|
||||
let html = '';
|
||||
|
||||
if (name === 'cabezadas_disponibles') {
|
||||
html = `<textarea id="value" rows="6" class="form-control">${currentValue}</textarea>`;
|
||||
} else if (name === 'cabezada_default') {
|
||||
const options = window.CABEZADAS_OPCIONES || {};
|
||||
html = `<select id="value" class="form-select">`;
|
||||
for (const [key, label] of Object.entries(options)) {
|
||||
const selected = key === currentValue ? 'selected' : '';
|
||||
html += `<option value="${key}" ${selected}>${label}</option>`;
|
||||
}
|
||||
html += `</select>`;
|
||||
} else {
|
||||
html = `<input type="text" id="value" class="form-control" value="${currentValue}">`;
|
||||
}
|
||||
|
||||
wrapper.html(html);
|
||||
this.valueInput = this.formEdit.find("#value"); // Actualiza referencia
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default ConfigVariableDatatable;
|
||||
@ -2,4 +2,4 @@ import ConfigVariableDatatable from "../../components/configVariableDatatable.js
|
||||
|
||||
const item = new ConfigVariableDatatable($("#tableConfigVariables"))
|
||||
item.init()
|
||||
item.events()
|
||||
item.events()
|
||||
|
||||
@ -120,19 +120,19 @@ class Resumen {
|
||||
data: { presupuesto_id: id }
|
||||
|
||||
}).done(function (response) {
|
||||
if (response == null || response == "") {
|
||||
return;
|
||||
}
|
||||
let values = JSON.parse(response);
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
var mockFile = { name: values[i].name, size: values[i].size, hash: values[i].hash };
|
||||
if (!response) return;
|
||||
|
||||
thisDropzone.files.push(mockFile); // add to files array
|
||||
thisDropzone.emit("addedfile", mockFile);
|
||||
thisDropzone.emit("thumbnail", mockFile, window.location.host + "/sistema/intranet/presupuestos/" + values[i].hash);
|
||||
thisDropzone.emit("complete", mockFile);
|
||||
thisDropzone.options.success.call(thisDropzone, mockFile);
|
||||
};
|
||||
let files;
|
||||
try {
|
||||
files = Array.isArray(response)
|
||||
? response
|
||||
: typeof response === 'string'
|
||||
? JSON.parse(response)
|
||||
: [];
|
||||
} catch (e) {
|
||||
console.error("Error parseando respuesta:", e);
|
||||
files = [];
|
||||
}
|
||||
}).always(function () {
|
||||
$('#loader').hide();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user