mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en obtener el gramaje. las funcion calcular mermas hay que colocarla en mejor sitio
This commit is contained in:
@ -547,6 +547,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
||||
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
|
||||
$routes->post('edit/(:num)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente']);
|
||||
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'tablaPresupuestosCliente']);
|
||||
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
|
||||
});
|
||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
@ -149,13 +149,18 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
|
||||
$presupuestoEntity = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
|
||||
$presupuestoEntity->POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
$presupuestoEntity->clienteId = $clienteId;
|
||||
|
||||
$datosPresupuesto = (object)array();
|
||||
$datosPresupuesto->POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
$datosPresupuesto->paisList = model('App\Models\Configuracion\PaisModel')->getAllForMenu('id, nombre', 'nombre', true);
|
||||
$datosPresupuesto->papelFormatoList = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
|
||||
$datosPresupuesto->papelInteriorNegro = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('negro', false, false);
|
||||
$datosPresupuesto->papelInteriorNegroHq = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('negrohq', false, false);
|
||||
$datosPresupuesto->papelInteriorColor = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('color', false, false);
|
||||
$datosPresupuesto->papelInteriorColorHq = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('colorhq', false, false);
|
||||
|
||||
$this->viewData['formAction'] = route_to('crearPresupuestoCliente');
|
||||
|
||||
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
|
||||
@ -468,6 +473,39 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getGramaje(){
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
try {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$merma = $reqData['merma'] ?? 0;
|
||||
$papel = $reqData['papel'] ?? "";
|
||||
$uso = $reqData['uso'] ?? "";
|
||||
|
||||
$model = new PapelGenericoModel();
|
||||
$menu = $model->getGramajeComparador($papel, $uso, intval($tirada + $merma));
|
||||
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
$data = [
|
||||
'error' => $e,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
} finally {
|
||||
return $this->respond($data);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
@ -187,6 +187,7 @@ class LoginAuthFilter implements FilterInterface
|
||||
'datatable_editor_2',
|
||||
'collect',
|
||||
'cast',
|
||||
'getGramaje'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -3,30 +3,29 @@
|
||||
<input hidden readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="<?= old('id', $presupuestoEntity->id) ?>">
|
||||
|
||||
<div class="row g-2">
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div id="tapaDiv" class="row">
|
||||
|
||||
<div class="col-sm-3 mb-md-0 mb-2">
|
||||
<div class="form-check custom-option custom-option-basic checked">
|
||||
<label class="form-check-label custom-option-content" for="customRadioTemp1">
|
||||
<input name="customRadioTemp" class="form-check-input" type="radio" value="" id="customRadioTemp1" checked="">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Tapa blanda</span>
|
||||
</span>
|
||||
</label>
|
||||
<div id="tapaBlandaDiv" class="form-check custom-option custom-option-tapa custom-option-basic checked">
|
||||
<label class="form-check-label custom-option-content" for="tapaBlanda">
|
||||
<input name="tapaBlanda" class="form-check-input" type="radio" value="" id="tapaBlanda" checked="">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Tapa blanda</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-check custom-option custom-option-basic">
|
||||
<label class="form-check-label custom-option-content" for="customRadioTemp2">
|
||||
<input name="customRadioTemp" class="form-check-input" type="radio" value="" id="customRadioTemp2">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Tapa Dura</span>
|
||||
</span>
|
||||
</label>
|
||||
<div id="tapaDuraDiv" class="form-check custom-option custom-option-tapa custom-option-basic">
|
||||
<label class="form-check-label custom-option-content" for="tapaDura">
|
||||
<input name="tapaDura" class="form-check-input" type="radio" value="" id="tapaDura">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Tapa Dura</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!--//.row -->
|
||||
|
||||
@ -39,30 +38,30 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3 mb-3">
|
||||
<label for="tirada" class="form-label">
|
||||
<?=lang('Presupuestos.tirada') ?> 1
|
||||
<?= lang('Presupuestos.tirada') ?> 1
|
||||
</label>
|
||||
<input type="number" id="tirada" name="tirada" maxLength="8" step="1" class="form-control" value="<?=old('tirada', $presupuestoEntity->tirada) ?>">
|
||||
<input type="number" id="tirada" name="tirada" maxLength="8" step="1" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="col-sm-3 mb-3">
|
||||
<label for="tirada2" class="form-label">
|
||||
<?=lang('Presupuestos.tirada') ?> 2
|
||||
<?= lang('Presupuestos.tirada') ?> 2
|
||||
</label>
|
||||
<input type="number" id="tirada2" name="tirada2" maxLength="8" step="1" class="form-control" value="<?=old('tirada2', $presupuestoEntity->tirada2) ?>">
|
||||
<input type="number" id="tirada2" name="tirada2" maxLength="8" step="1" class="form-control" value="<?= old('tirada2', $presupuestoEntity->tirada2) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="col-sm-3 mb-3">
|
||||
<label for="tirada3" class="form-label">
|
||||
<?=lang('Presupuestos.tirada') ?> 3
|
||||
<?= lang('Presupuestos.tirada') ?> 3
|
||||
</label>
|
||||
<input type="number" id="tirada3" name="tirada3" maxLength="8" step="1" class="form-control" value="<?=old('tirada3', $presupuestoEntity->tirada3) ?>">
|
||||
<input type="number" id="tirada3" name="tirada3" maxLength="8" step="1" class="form-control" value="<?= old('tirada3', $presupuestoEntity->tirada3) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="col-sm-3 mb-3">
|
||||
<label for="tirada4" class="form-label">
|
||||
<?=lang('Presupuestos.tirada') ?> 4
|
||||
<?= lang('Presupuestos.tirada') ?> 4
|
||||
</label>
|
||||
<input type="number" id="tirada4" name="tirada4" maxLength="8" step="1" class="form-control" value="<?=old('tirada4', $presupuestoEntity->tirada4) ?>">
|
||||
<input type="number" id="tirada4" name="tirada4" maxLength="8" step="1" class="form-control" value="<?= old('tirada4', $presupuestoEntity->tirada4) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div> <!--//.row -->
|
||||
@ -72,15 +71,15 @@
|
||||
|
||||
<div class="col-sm-3 mb-3">
|
||||
<label for="paginas" class="form-label">
|
||||
<?=lang('Presupuestos.paginas') ?>
|
||||
<?= lang('Presupuestos.paginas') ?>
|
||||
</label>
|
||||
<input type="number" id="paginas" name="paginas" maxLength="8" step="1" class="form-control" value="<?=old('paginas', $presupuestoEntity->paginas) ?>">
|
||||
<input type="number" id="paginas" name="paginas" maxLength="8" step="1" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
</div> <!--//.row -->
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div id="tamanioLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == false ? '' : 'style="display: none"'; ?>>
|
||||
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
|
||||
Tamaño Libro*
|
||||
@ -105,8 +104,8 @@
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div id="altoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> >
|
||||
<div class="mb-1">
|
||||
<div id="altoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>>
|
||||
<div class="mb-1">
|
||||
<label class="form-label" for="papelFormatoAlto">Alto Libro</label>
|
||||
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="1" class="form-control formato_libro" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
@ -118,7 +117,7 @@
|
||||
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!--//.row -->
|
||||
|
||||
<div class="divider divider-dark text-start mb-1">
|
||||
@ -127,21 +126,83 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5> Color del interior </h5>
|
||||
<h6> Color del interior </h6>
|
||||
<div class="row">
|
||||
|
||||
</div> <!--//.row -->
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col col-sm-1 d-flex justify-content-center">
|
||||
<div id="colorNegroDiv" class="form-check change-papel-interior custom-option-color custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="colorNegro">
|
||||
<span class="custom-option-body">
|
||||
<img style="height:32px;width:32px" src="<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_bn.png") ?>" alt="">
|
||||
</span>
|
||||
</label>
|
||||
<input name="colorNegro" class="form-check-input" type="radio" value="colorNegro" id="colorNegro" checked="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-sm-1 d-flex justify-content-center">
|
||||
<div id="colorColorDiv" class="form-check change-papel-interior custom-option-color custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="colorColor">
|
||||
<span class="custom-option-body">
|
||||
<img style="height:32px;width:32px" src="<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_color.png") ?>" alt="">
|
||||
</span>
|
||||
</label>
|
||||
<input name="colorColor" class="form-check-input" type="radio" value="colorColor" id="colorColor">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!--//.row -->
|
||||
|
||||
<h6> Calidad </h6>
|
||||
<div class="row">
|
||||
|
||||
<h5> Papel </h5>
|
||||
<div class="col-sm-3 mb-md-0 mb-2">
|
||||
<div id="calidadEstandarDiv" class="form-check change-papel-interior custom-option custom-option-calidad custom-option-basic checked">
|
||||
<label class="form-check-label custom-option-content" for="calidadEstandar">
|
||||
<input name="calidadEstandar" class="form-check-input" type="radio" value="" id="calidadEstandar" checked="">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Estándar</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div id="calidadPremiumDiv" class="form-check change-papel-interior custom-option custom-option-calidad custom-option-basic">
|
||||
<label class="form-check-label custom-option-content" for="calidadPremium">
|
||||
<input name="calidadPremium" class="form-check-input" type="radio" value="" id="calidadPremium">
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Premium</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mb-3 d-flex align-items-end">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="0" <?= $presupuestoEntity->excluir_rotativa == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
||||
</div> <!--//.row -->
|
||||
|
||||
<h6> Papel </h6>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-4 mb-md-0 mb-2">
|
||||
<label for="papelInterior" class="form-label">Tipo de papel</label>
|
||||
<select id="papelInterior" name="papelInterior" class="form-control select2bs2" style="width: 100%;"></select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2 mb-md-0 mb-2">
|
||||
<label for="papelInterior" class="form-label">Gramaje (g/m2)</label>
|
||||
<select id="gramajeInterior" name="gramajeInterior" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h6> Opciones extra </h6>
|
||||
<div class="row">
|
||||
<div class="col-sm-3 mb-3 d-flex align-items-end">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="0" <?= $presupuestoEntity->excluir_rotativa == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -158,8 +219,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
window.routes_disenio_libro = {
|
||||
obtenerGramaje: "<?=route_to('obtenerGramaje') ?>",
|
||||
}
|
||||
<?= $this->endSection() ?>
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="row g-2 d-flex justify-content-center">
|
||||
|
||||
<div class="col-md-4 mb-md-0 mb-2">
|
||||
<div class="form-check checked custom-option custom-option-image custom-option-image-radio">
|
||||
<div class="form-check checked custom-option-tipo custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="tipoCosido">
|
||||
<span class="custom-option-body">
|
||||
<img src="<?= site_url("assets/img/libro_cosido.jpeg") ?>" alt="radioImg">
|
||||
@ -14,7 +14,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mb-md-0 mb-2">
|
||||
<div class="form-check custom-option custom-option-image custom-option-image-radio">
|
||||
<div class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="tipoFresado">
|
||||
<span class="custom-option-body">
|
||||
<img src="<?= site_url("assets/img/libro_fresado.jpeg") ?>" alt="radioImg2">
|
||||
@ -26,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mb-md-0 mb-2">
|
||||
<div class="form-check custom-option custom-option-image custom-option-image-radio">
|
||||
<div id="grapadoDiv" class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="tipoGrapado">
|
||||
<span class="custom-option-body">
|
||||
<img src="<?= site_url("assets/img/libro_grapado.jpeg") ?>" alt="radioImg3">
|
||||
@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mb-md-0 mb-2">
|
||||
<div class="form-check custom-option custom-option-image custom-option-image-radio">
|
||||
<div class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="tipoEspiral">
|
||||
<span class="custom-option-body">
|
||||
<img src="<?= site_url("assets/img/libro_espiral.jpeg") ?>" alt="radioImg4">
|
||||
@ -50,7 +50,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mb-md-0 mb-2">
|
||||
<div class="form-check custom-option custom-option-image custom-option-image-radio">
|
||||
<div class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
|
||||
<label class="form-check-label custom-option-content" for="tipoWireO">
|
||||
<span class="custom-option-body">
|
||||
<img src="<?= site_url("assets/img/libro_wire-o.jpeg") ?>" alt="radioImg5">
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
$('#papelFormatoPersonalizado').on('change', function()
|
||||
{
|
||||
if ($(this).is(":checked")) {
|
||||
@ -10,4 +9,213 @@ $('#papelFormatoPersonalizado').on('change', function()
|
||||
$('#anchoLibroDiv').hide();
|
||||
$('#altoLibroDiv').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Init custom option check
|
||||
function initTapaCheck()
|
||||
{
|
||||
const _this = this
|
||||
|
||||
const tapaOptionList = [].slice.call(document.querySelectorAll('.custom-option-tapa .form-check-input'))
|
||||
tapaOptionList.map(function (customOptionEL) {
|
||||
// Update custom options check on page load
|
||||
_this.updateTapaCheck(customOptionEL)
|
||||
|
||||
// Update custom options check on click
|
||||
customOptionEL.addEventListener('click', e => {
|
||||
_this.updateTapaCheck(customOptionEL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function updateTapaCheck(el)
|
||||
{
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tapa'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option-tapa').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option-tapa').classList.add('checked')
|
||||
if(el.closest('.custom-option-tapa').id == 'tapaBlandaDiv') {
|
||||
$('#tapaBlanda').prop('checked', true);
|
||||
$('#tapaDura').prop('checked', false);
|
||||
}
|
||||
else {
|
||||
$('#tapaBlanda').prop('checked', false);
|
||||
$('#tapaDura').prop('checked', true);
|
||||
}
|
||||
} else {
|
||||
el.closest('.custom-option-tapa').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initColorCheck()
|
||||
{
|
||||
const _this = this
|
||||
|
||||
const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-color .form-check-input'))
|
||||
custopOptionList.map(function (customOptionEL) {
|
||||
// Update custom options check on page load
|
||||
_this.updateColorCheck(customOptionEL)
|
||||
|
||||
// Update custom options check on click
|
||||
customOptionEL.addEventListener('click', e => {
|
||||
_this.updateColorCheck(customOptionEL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function updateColorCheck(el)
|
||||
{
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-color'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option-color').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option-color').classList.add('checked')
|
||||
if(el.closest('.custom-option-color').id == 'colorNegroDiv') {
|
||||
$('#colorNegro').prop('checked', true);
|
||||
$('#colorColor').prop('checked', false);
|
||||
}
|
||||
else {
|
||||
$('#colorNegro').prop('checked', false);
|
||||
$('#colorColor').prop('checked', true);
|
||||
}
|
||||
|
||||
} else {
|
||||
el.closest('.custom-option-color').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initCalidadCheck()
|
||||
{
|
||||
const _this = this
|
||||
|
||||
const calidadOptionList = [].slice.call(document.querySelectorAll('.custom-option-calidad .form-check-input'))
|
||||
calidadOptionList.map(function (customOptionEL) {
|
||||
// Update custom options check on page load
|
||||
_this.updateCalidadCheck(customOptionEL)
|
||||
|
||||
// Update custom options check on click
|
||||
customOptionEL.addEventListener('click', e => {
|
||||
_this.updateCalidadCheck(customOptionEL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function updateCalidadCheck(el)
|
||||
{
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-calidad'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option-calidad').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option-calidad').classList.add('checked')
|
||||
if(el.closest('.custom-option-calidad').id == 'calidadEstandarDiv') {
|
||||
$('#calidadEstandar').prop('checked', true);
|
||||
$('#calidadPremium').prop('checked', false);
|
||||
}
|
||||
else {
|
||||
$('#calidadEstandar').prop('checked', false);
|
||||
$('#calidadPremium').prop('checked', true);
|
||||
}
|
||||
} else {
|
||||
el.closest('.custom-option-calidad').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function initDisenioLibro(){
|
||||
initTapaCheck();
|
||||
initColorCheck();
|
||||
initCalidadCheck();
|
||||
|
||||
updatePapelInterior();
|
||||
}
|
||||
|
||||
$('.change-papel-interior ').on('change', updatePapelInterior)
|
||||
|
||||
function updatePapelInterior() {
|
||||
isColor = $('#colorNegroDiv').hasClass('checked') ? false : true;
|
||||
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
||||
|
||||
var data = [];
|
||||
|
||||
if(!isColor && !isHq) {
|
||||
data = window.datosPresupuesto.papelInteriorNegro;
|
||||
}
|
||||
else if(!isColor && isHq) {
|
||||
data = window.datosPresupuesto.papelInteriorNegroHq;
|
||||
}
|
||||
else if(isColor && !isHq) {
|
||||
data = window.datosPresupuesto.papelInteriorColor;
|
||||
}
|
||||
else if(isColor && isHq) {
|
||||
data = window.datosPresupuesto.papelInteriorColorHq;
|
||||
}
|
||||
|
||||
var dropdown = $("#papelInterior");
|
||||
dropdown.empty();
|
||||
$.each(data, function() {
|
||||
dropdown.append($("<option />").val(this.id).text(this.nombre));
|
||||
});
|
||||
//Se quita la seleccion del dropdown
|
||||
dropdown.val('').trigger('change');
|
||||
|
||||
}
|
||||
|
||||
$('#papelInterior').on('change', function() {
|
||||
isColor = $('#colorNegroDiv').hasClass('checked') ? false : true;
|
||||
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
||||
|
||||
if($('#papelInterior option:selected').val() != undefined){
|
||||
var uso = 'bn';
|
||||
|
||||
if(!isColor && !isHq) {
|
||||
uso = 'bn';
|
||||
}
|
||||
else if(!isColor && isHq) {
|
||||
uso = 'bnhq';
|
||||
}
|
||||
else if(isColor && !isHq) {
|
||||
uso = 'color';
|
||||
}
|
||||
else if(isColor && isHq) {
|
||||
uso = 'colorhq';
|
||||
}
|
||||
merma = calcular_mermas();
|
||||
datos = {
|
||||
tirada: $('#tirada').val(),
|
||||
merma: calcular_mermas(),
|
||||
uso: uso,
|
||||
papel: $('#papelInterior option:selected').text()
|
||||
};
|
||||
datos = Object.assign(datos, window.token_ajax)
|
||||
|
||||
$.ajax({
|
||||
url: window.routes_disenio_libro.obtenerGramaje,
|
||||
type: 'POST',
|
||||
data: datos,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var data = JSON.parse(response);
|
||||
|
||||
//$('#papelInteriorGramaje').val(data.gramaje);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -263,4 +263,52 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
function calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
|
||||
if(tirada> window.datosPresupuesto.POD ){
|
||||
merma = tirada*0.1<=30 ? tirada*0.1 : 30
|
||||
}
|
||||
else{
|
||||
/*merma_lineas = []
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var rowData = this.data();
|
||||
if(rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
|
||||
const formas_linea = parseInt($('#isCosido').val())==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
|
||||
if(formas_linea > tirada)
|
||||
merma_lineas.push(formas_linea-tirada)
|
||||
else
|
||||
merma_lineas.push(tirada%formas_linea)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(merma_lineas.length>0)
|
||||
merma = Math.max(...merma_lineas)
|
||||
|
||||
else{
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.validation.no_lp_for_merma +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
merma = 0
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,35 +1,53 @@
|
||||
// Init custom option check
|
||||
function initCustomOptionCheck()
|
||||
function initTipoLibroCheck()
|
||||
{
|
||||
const _this = this
|
||||
|
||||
const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option .form-check-input'))
|
||||
const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-tipo .form-check-input'))
|
||||
custopOptionList.map(function (customOptionEL) {
|
||||
// Update custom options check on page load
|
||||
_this.updateCustomOptionCheck(customOptionEL)
|
||||
_this.updateTipoLibroCheck(customOptionEL)
|
||||
|
||||
// Update custom options check on click
|
||||
customOptionEL.addEventListener('click', e => {
|
||||
_this.updateCustomOptionCheck(customOptionEL)
|
||||
_this.updateTipoLibroCheck(customOptionEL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function updateCustomOptionCheck(el)
|
||||
function updateTipoLibroCheck(el)
|
||||
{
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option'))
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tipo'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option').classList.remove('checked')
|
||||
customRadioOptionEL.closest('.custom-option-tipo').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option').classList.add('checked')
|
||||
el.closest('.custom-option-tipo').classList.add('checked')
|
||||
if(el.closest('.custom-option-tipo').id == 'grapadoDiv') {
|
||||
$('#tapaDiv').hide();
|
||||
}
|
||||
else {
|
||||
$('#tapaDiv').show();
|
||||
}
|
||||
} else {
|
||||
el.closest('.custom-option').classList.remove('checked')
|
||||
el.closest('.custom-option-tipo').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
initTipoLibroCheck();
|
||||
|
||||
|
||||
function getUpdatePapelInterior() {
|
||||
var impresionInterior = $('input[name="impresionInterior"]:checked').val();
|
||||
if(impresionInterior == 'color') {
|
||||
$('#colorInteriorDiv').show();
|
||||
}
|
||||
else {
|
||||
$('#colorInteriorDiv').hide();
|
||||
}
|
||||
}
|
||||
|
||||
initCustomOptionCheck();
|
||||
|
||||
|
||||
@ -80,13 +80,9 @@
|
||||
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cliente/_datosLibroItems") ?>
|
||||
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none">Previous</span>
|
||||
</button>
|
||||
<div class="col-12 d-flex justify-content-end mt-4">
|
||||
<button class="btn btn-primary btn-next waves-effect waves-light">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Next</span>
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
|
||||
<i class="ti ti-arrow-right ti-xs"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -103,10 +99,10 @@
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none">Previous</span>
|
||||
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
|
||||
</button>
|
||||
<button class="btn btn-primary btn-next waves-effect waves-light">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Next</span>
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
|
||||
<i class="ti ti-arrow-right ti-xs"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -122,10 +118,10 @@
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none">Previous</span>
|
||||
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
|
||||
</button>
|
||||
<button class="btn btn-primary btn-next waves-effect waves-light">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Next</span>
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
|
||||
<i class="ti ti-arrow-right ti-xs"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -190,10 +186,10 @@
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none">Previous</span>
|
||||
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
|
||||
</button>
|
||||
<button class="btn btn-primary btn-next waves-effect waves-light">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Next</span>
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
|
||||
<i class="ti ti-arrow-right ti-xs"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -257,7 +253,7 @@
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none">Previous</span>
|
||||
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
|
||||
</button>
|
||||
<button class="btn btn-success btn-submit btn-next waves-effect waves-light">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Submit</span><i class="ti ti-check ti-xs"></i>
|
||||
@ -268,21 +264,14 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Create Deal Wizard -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="pt-4">
|
||||
<input type="submit" class="btn btn-primary float-start me-sm-3 me-1" name="save" id="saveForm" value="<?= lang("Basic.global.Save") ?>" />
|
||||
</div>
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
<div class="pt-4">
|
||||
<input type="submit" class="btn btn-primary float-start me-sm-3 me-1" name="save" id="saveForm" value="<?= lang("Basic.global.Save") ?>" />
|
||||
</div>
|
||||
</div><!--//.row -->
|
||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
|
||||
@ -291,6 +280,9 @@
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
window.datosPresupuesto = <?= json_encode($datosPresupuesto) ?>;
|
||||
window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
|
||||
initDisenioLibro();
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
@ -689,7 +689,6 @@
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
|
||||
23289
xdebug.log
23289
xdebug.log
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user