mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
corregidos algunos fallos en admin y añadido selector papel y gramaje faja cliente
This commit is contained in:
@ -72,9 +72,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -84,36 +84,36 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else :
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else :
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
@ -133,20 +133,20 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$papelGenerico = $this->model->find($id);
|
||||
|
||||
if ($papelGenerico == false) :
|
||||
if ($papelGenerico == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('PapelGenerico.papelGenerico')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -159,24 +159,24 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('show_in_client_special') == null) {
|
||||
$sanitizedData['show_in_client_special'] = false;
|
||||
}
|
||||
|
||||
if($sanitizedData['show_in_client_special']){
|
||||
|
||||
if ($sanitizedData['show_in_client_special']) {
|
||||
$sanitizedData['show_in_client'] = true;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else :
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('PapelGenerico.papelGenerico'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
@ -186,17 +186,17 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $papelGenerico->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else :
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
@ -210,7 +210,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('PapelGenerico.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
$this->viewData['usingServerSideDataTable'] = true;
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
@ -297,15 +297,14 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if($tirada != null){
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if(intval($tirada) <= intval($POD_value)){
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
@ -313,17 +312,38 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
|
||||
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
if ($forSelect2) {
|
||||
$menu = array_map(function ($item) {
|
||||
if (isset($item->id)) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'id' => $item->gramaje,
|
||||
'name' => $item->gramaje
|
||||
];
|
||||
}
|
||||
}, $menu);
|
||||
|
||||
return $this->respond($menu);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
@ -340,23 +360,23 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if($tirada != null){
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if(intval($tirada) <= intval($POD_value)){
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
@ -364,9 +384,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
|
||||
|
||||
$anchoLibro = 2* $ancho + 2 * $solapas + $lomo;
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
|
||||
@ -125,6 +125,7 @@ return [
|
||||
'faja' => 'Faja',
|
||||
'altoFaja' => 'Alto faja',
|
||||
'papelFaja' => 'Papel faja',
|
||||
'gramajeFaja' => 'Gramaje faja',
|
||||
'tamanioSolapasFaja' => 'Tamaño solapas faja',
|
||||
'plastificadoFaja' => 'Plastificado faja',
|
||||
'estucadoMate170gr' => 'Estucado mate 170 gr',
|
||||
@ -263,7 +264,7 @@ return [
|
||||
'formatoLibro' => "Formato libro",
|
||||
'selectCliente' => "Seleccione cliente",
|
||||
'selectPapel' => "Seleccione papel",
|
||||
|
||||
'selectGramaje' => "Seleccione gramaje",
|
||||
|
||||
// Preview
|
||||
'preview' => 'Previsualización de configuraciones',
|
||||
@ -370,6 +371,7 @@ return [
|
||||
'opcion_solapas' => 'Seleccione la opción para las solapas',
|
||||
'paginas_multiplo_4' => 'El número de páginas para <b>cosido</b> o <b>grapado</b> debe ser múltiplo de 4',
|
||||
'paginas_pares' => 'El número de páginas debe ser par',
|
||||
'extras_cubierta' => 'Rellene todos los campos',
|
||||
],
|
||||
|
||||
'errores' => [
|
||||
|
||||
@ -129,16 +129,16 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -413,6 +413,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
public function getPapelCliente(
|
||||
$tipo,
|
||||
$is_cubierta = false,
|
||||
$is_sobrecubierta = false,
|
||||
$selected_papel_id = null,
|
||||
$tapa_dura = null,
|
||||
$papel_especial = false,
|
||||
@ -517,6 +518,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
if ($tapa_dura == true) {
|
||||
$builder->where("t2.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($is_sobrecubierta == true) {
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
} else {
|
||||
$builder->where("t2.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
|
||||
@ -172,8 +172,9 @@
|
||||
<div class="row justify-content-center">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="acabadoCubierta" name="acabado_cubierta">
|
||||
<option value="0"> <?=lang('Presupuestos.acabadoNinguno') ?> </option>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="acabadoCubierta"
|
||||
name="acabado_cubierta">
|
||||
<option value="0"> <?= lang('Presupuestos.acabadoNinguno') ?> </option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -187,58 +188,54 @@
|
||||
<h3 class="mb-1 fw-bold"> Extras </h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="row col-sm-12 mb-3 justify-content-center align-items-top">
|
||||
|
||||
|
||||
|
||||
<div class="row col-sm-2 mb-3 d-flex flex-column align-items-center sobrecubierta-items">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="calcular-presupuesto form-check-input" type="checkbox" id="addSobrecubierta"
|
||||
name="add_sobrecubierta" value="1">
|
||||
<label class="form-check-label"
|
||||
for="addSobrecubierta"><?= lang('Presupuestos.sobrecubierta') ?></label>
|
||||
</div>
|
||||
<div id="divExtras" name="div_extras" class="row col-sm-12 mb-3 justify-content-center align-items-top">
|
||||
|
||||
<div class="row col-sm-2 mb-3 d-flex flex-column align-items-center sobrecubierta-items">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="calcular-presupuesto form-check-input" type="checkbox" id="addSobrecubierta"
|
||||
name="add_sobrecubierta" value="1">
|
||||
<label class="form-check-label" for="addSobrecubierta"><?= lang('Presupuestos.sobrecubierta') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="papelSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.papelSobrecubierta') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="papelSobrecubierta"
|
||||
name="papel_sobrecubierta">
|
||||
<option value="EST2_170"><?= lang('Presupuestos.estucadoMate170gr') ?></option>
|
||||
<option value="EST2_200"><?= lang('Presupuestos.estucadoMate200gr') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="papelSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.papelSobrecubierta') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="papelSobrecubierta"
|
||||
name="papel_sobrecubierta">
|
||||
<option value="EST2_170"><?= lang('Presupuestos.estucadoMate170gr') ?></option>
|
||||
<option value="EST2_200"><?= lang('Presupuestos.estucadoMate200gr') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="solapasSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.tamanioSolapasSobrecubierta') ?>
|
||||
</label>
|
||||
<input id="solapasSobrecubierta" name="solapas_sobrecubierta" type="number"
|
||||
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
|
||||
value="60">
|
||||
<div id="textoLimitesSolapasSobrecubierta" class="form-text">
|
||||
Entre 60 y 120 mm
|
||||
</div>
|
||||
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="solapasSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.tamanioSolapasSobrecubierta') ?>
|
||||
</label>
|
||||
<input id="solapasSobrecubierta" name="solapas_sobrecubierta" type="number"
|
||||
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1" value="60">
|
||||
<div id="textoLimitesSolapasSobrecubierta" class="form-text">
|
||||
Entre 60 y 120 mm
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="plastificadoSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.acabado') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="acabadoSobrecubierta"
|
||||
name="acabado_sobrecubierta">
|
||||
<option value="0"> <?=lang('Presupuestos.acabadoNinguno') ?> </option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4 config-sobrecubierta d-none sobrecubierta-items">
|
||||
<label for="plastificadoSobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.acabado') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="acabadoSobrecubierta"
|
||||
name="acabado_sobrecubierta">
|
||||
<option value="0"> <?= lang('Presupuestos.acabadoNinguno') ?> </option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row col-sm-12 mb-0 justify-content-center d-none">
|
||||
<div class="row col-sm-12 mb-0 justify-content-center">
|
||||
|
||||
<div class="row justify-content-center">
|
||||
|
||||
<div class="row col-sm-2 mb-3 d-flex flex-column align-items-center">
|
||||
<div class="col-sm-2 mb-3 d-flex flex-column align-items-center">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="calcular-presupuesto form-check-input" type="checkbox" id="addFaja" name="add_faja"
|
||||
value="1">
|
||||
@ -246,26 +243,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row col-sm-3 config-faja d-none">
|
||||
<div class="">
|
||||
<label for="papelFaja" class="form-label">
|
||||
<?= lang('Presupuestos.papelFaja') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="papelFaja" name="papel_faja">
|
||||
</select>
|
||||
</div>
|
||||
<div class="">
|
||||
<label for="papelFaja" class="form-label">
|
||||
<?= lang('Presupuestos.gramajeFaja') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="gramajeFaja" name="gramaje_faja">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-2 config-faja d-none">
|
||||
<label for="altoFaja" class="form-label">
|
||||
<?= lang('Presupuestos.altoFaja') ?>
|
||||
</label>
|
||||
<input id="altoFaja" name="alto_faja" type="number"
|
||||
class="calcular-presupuesto form-control text-center num-input" min="60" step="1" value="60">
|
||||
class="calcular-presupuesto form-control text-center num-input" min="50" step="1" value="60">
|
||||
<div class="form-text">
|
||||
Mayor 60 mm
|
||||
Entre 50 mm y 120 mm
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 config-faja d-none">
|
||||
<label for="barniz" class="form-label">
|
||||
<?= lang('Presupuestos.papelFaja') ?>
|
||||
</label>
|
||||
<select class="form-select select2bs2 calcular-presupuesto" id="papelFaja" name="papel_sobrecubierta">
|
||||
<option value="EST2_170"><?= lang('Presupuestos.estucadoMate170gr') ?></option>
|
||||
<option value="EST2_200"><?= lang('Presupuestos.estucadoMate200gr') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2 config-faja d-none">
|
||||
<label for="solapasFaja" class="form-label">
|
||||
@ -274,7 +280,7 @@
|
||||
<input id="solapasFaja" name="solapas_faja" type="number"
|
||||
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
|
||||
value="60">
|
||||
<div class="form-text">
|
||||
<div id="textoLimitesSolapasFaja" class="form-text">
|
||||
Entre 60 y 120 mm
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -424,7 +424,7 @@ class PresupuestoAdminEdit {
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.errores.paginasLP +
|
||||
window.language.Presupuestos.errores.paginasLP +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
@ -1509,6 +1509,9 @@ class Comparador {
|
||||
|
||||
let datosComp = {};
|
||||
datosComp.sobrecubierta = this.getDataForComp('faja');
|
||||
if(datosComp.sobrecubierta.error){
|
||||
return;
|
||||
}
|
||||
datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas
|
||||
|
||||
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
|
||||
|
||||
@ -98,6 +98,7 @@ class DatosLibro {
|
||||
|
||||
this.anchoSolapasCubierta.on('change', this.changeAnchoSolapasCubierta.bind(this));
|
||||
this.anchoSolapasSobrecubierta.on('change', this.changeAnchoSolapasSobrecubierta.bind(this));
|
||||
this.fajaSolapasAncho.on('change', this.changeAnchoSolapasFaja.bind(this));
|
||||
|
||||
this.paginas.on('change', this.changePaginas.bind(this));
|
||||
this.tirada.on('change', this.changeTirada.bind(this));
|
||||
@ -116,10 +117,13 @@ class DatosLibro {
|
||||
if (this.faja.prop('checked')) {
|
||||
this.div_faja.removeClass('d-none');
|
||||
$('#compFaja').val(1).trigger('change');
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_faja');
|
||||
}
|
||||
else {
|
||||
this.div_faja.addClass('d-none');
|
||||
$('#compFaja').val(0).trigger('change');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_faja');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +304,7 @@ class DatosLibro {
|
||||
|
||||
changeAnchoSolapasSobrecubierta() {
|
||||
|
||||
if (this.checkSolapasGrandes('cubierta')) {
|
||||
if (this.checkSolapasGrandes('sobrecubierta')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
else {
|
||||
@ -311,18 +315,38 @@ class DatosLibro {
|
||||
$('#compSobrecubierta').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
changeAnchoSolapasFaja() {
|
||||
|
||||
if (this.checkSolapasGrandes('faja')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
if($('#compGramajeFaja').select2('data').length > 0){
|
||||
$('#compGramajeFaja').trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
checkSolapasGrandes(elemento) {
|
||||
|
||||
const ancho_libro = 2 * this.getDimensionLibro().ancho;
|
||||
let ancho_solapas = 0.0;
|
||||
let lomo = 0.0;
|
||||
if (elemento == 'cubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho').val());
|
||||
lomo = parseFloat($('lomo_cubierta').val());
|
||||
ancho_solapas = 2 * parseFloat($('#solapas_ancho').val());
|
||||
lomo = parseFloat($('#lomo_cubierta').val());
|
||||
}
|
||||
else if (elemento == 'sobrecubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('lomo_sobrecubierta').val());
|
||||
ancho_solapas = 2 * parseFloat($('#solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('#lomo_sobrecubierta').val());
|
||||
}
|
||||
else if (elemento == 'faja') {
|
||||
ancho_solapas = 2 * parseFloat($('#faja_solapas_ancho').val());
|
||||
lomo = parseFloat($('#lomo_sobrecubierta').val());
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
@ -144,6 +144,10 @@ class Servicios {
|
||||
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_faja'){
|
||||
const id = $('#solapas_faja').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_cubierta'){
|
||||
const id = $('#solapas_grandes_cubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
@ -152,6 +156,10 @@ class Servicios {
|
||||
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_faja'){
|
||||
const id = $('#solapas_grandes_faja').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
}
|
||||
|
||||
removeServicio(event, servicio) {
|
||||
|
||||
@ -92,6 +92,7 @@ class DatosGenerales {
|
||||
|
||||
// Eventos
|
||||
this.checkFormatoPersonalizado.bind('change', this.#handleFormatoLibro.bind(this));
|
||||
this.formatoLibro.item.on('change', this.#handleFormatoLibro.bind(this));
|
||||
this.tiposLibro.on('click', this.#handleTipolibro.bind(this));
|
||||
this.domItem.find('.input-paginas').on('change', this.#handlePaginas.bind(this));
|
||||
this.anchoPersonalizado.on('blur', this.#handleCheckFormatoPersonalizado.bind(this));
|
||||
@ -674,6 +675,8 @@ class DatosGenerales {
|
||||
this.formValidation.revalidateField('papel_formato_ancho');
|
||||
this.formValidation.revalidateField('papel_formato_alto');
|
||||
}
|
||||
const alto = this.getDimensionLibro().alto;
|
||||
$('#altoFaja').closest('.config-faja').find('.form-text').text('Entre 50 y ' + alto + ' mm');
|
||||
}
|
||||
|
||||
#checkValue(event){
|
||||
|
||||
@ -33,12 +33,12 @@ class DisenioCubierta {
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
cubierta: 1,
|
||||
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
|
||||
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
|
||||
solapas: () => {return $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val()},
|
||||
lomo: () => {return $('#lc').val()},
|
||||
tapa_dura: () => {return this.tapaBlanda.hasClass("selected") ? 0 : 1},
|
||||
tirada: () => {return this.presupuestoCliente.datosGenerales.getTiradas()[0]},
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: () => { return $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val() },
|
||||
lomo: () => { return $('#lc').val() },
|
||||
tapa_dura: () => { return this.tapaBlanda.hasClass("selected") ? 0 : 1 },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
}
|
||||
);
|
||||
|
||||
@ -77,11 +77,46 @@ class DisenioCubierta {
|
||||
|
||||
this.configuracionFaja = this.domItem.find(".config-faja");
|
||||
this.faja = this.domItem.find("#addFaja");
|
||||
this.papelFaja = new ClassSelect($("#papelFaja"),
|
||||
'/papelesgenericos/getpapelcliente',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
sobrecubierta: 1,
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return $('#altoFaja').val() },
|
||||
solapas: () => { return $('#solapasFaja').val() },
|
||||
lomo: () => { return parseFloat($('#lsc').val()) + parseFloat($('#lc').val()) },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
forSelect2: 1,
|
||||
}
|
||||
);
|
||||
this.gramajeFaja = new ClassSelect($("#gramajeFaja"),
|
||||
'/papelesgenericos/getpapelcliente',
|
||||
window.translations["selectGramaje"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
papel: () => { return this.papelFaja.getVal() },
|
||||
sobrecubierta: 1,
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return $('#altoFaja').val() },
|
||||
solapas: () => { return $('#solapasFaja').val() },
|
||||
lomo: () => { return parseFloat($('#lsc').val()) + parseFloat($('#lc').val()) },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
forSelect2: 1,
|
||||
}
|
||||
);
|
||||
|
||||
this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta");
|
||||
this.textoSolapasSobrecubierta = this.domItem.find("#textoLimitesSolapasSobrecubierta");
|
||||
|
||||
this.solapasFaja = this.domItem.find("#solapasFaja");
|
||||
this.altoFaja = this.domItem.find("#altoFaja");
|
||||
this.textoSolapasFaja = this.domItem.find("#textoLimitesSolapasFaja");
|
||||
|
||||
this.fresado = $(this.domItem.find("#fresado")[0]);
|
||||
this.cosido = $(this.domItem.find("#cosido")[0]);
|
||||
@ -154,6 +189,9 @@ class DisenioCubierta {
|
||||
this.acabadoCubierta.init();
|
||||
this.acabadoSobrecubierta.init();
|
||||
|
||||
this.papelFaja.init();
|
||||
this.gramajeFaja.init();
|
||||
|
||||
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
|
||||
|
||||
// Eventos
|
||||
@ -171,10 +209,12 @@ class DisenioCubierta {
|
||||
}
|
||||
);
|
||||
this.faja.on('change', () => {
|
||||
this.faja.is(":checked") ? this.configuracionFaja.removeClass("d-none") : this.configuracionFaja.addClass("d-none")
|
||||
}
|
||||
);
|
||||
this.faja.is(":checked") ? this.configuracionFaja.removeClass("d-none") : this.configuracionFaja.addClass("d-none");
|
||||
const div = $('#divExtras'); // Selecciona el div
|
||||
div.find('.fv-plugins-message-container').remove();
|
||||
});
|
||||
|
||||
this.papelFaja.item.on('change', () => { this.gramajeFaja.empty(); });
|
||||
|
||||
// Observadores
|
||||
this.observer.observe(this.tapaBlanda[0], { attributes: true });
|
||||
@ -371,6 +411,34 @@ class DisenioCubierta {
|
||||
}
|
||||
}
|
||||
},
|
||||
div_extras: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
|
||||
const div = $('#divExtras'); // Selecciona el div
|
||||
div.find('.fv-plugins-message-container').remove();
|
||||
|
||||
const papelFaja = $('#papelFaja').select2('data').length > 0;
|
||||
const gramajeFaja = $('#gramajeFaja').select2('data').length > 0;
|
||||
if (papelFaja && gramajeFaja) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
div.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].extras_cubierta}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
@ -388,6 +456,8 @@ class DisenioCubierta {
|
||||
case 'div_gramaje_cubierta':
|
||||
case 'div_papel_especial_cubierta':
|
||||
return '.col-sm-10';
|
||||
case 'div_extras':
|
||||
return '.col-sm-12';
|
||||
default:
|
||||
return '.col-sm-3';
|
||||
}
|
||||
@ -643,9 +713,8 @@ class DisenioCubierta {
|
||||
else {
|
||||
let faja = {};
|
||||
faja.alto = this.domItem.find("#altoFaja").val();
|
||||
let papel = this.domItem.find("#papelFaja").children("option:selected").val();
|
||||
faja.papel = papel.split('_')[0];
|
||||
faja.gramaje = papel.split('_')[1];
|
||||
faja.papel = this.papelFaja.getVal();
|
||||
faja.gramaje = this.gramajeFaja.getVal();
|
||||
faja.solapas = this.domItem.find("#solapasFaja").val();
|
||||
faja.plastificado = this.domItem.find("#plastificadoFaja").children("option:selected").val();
|
||||
return faja;
|
||||
|
||||
@ -178,6 +178,7 @@ class PresupuestoCliente {
|
||||
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
|
||||
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasFaja.text("Entre 60 y " + response + " mm");
|
||||
},
|
||||
() => { }
|
||||
).post();
|
||||
|
||||
Reference in New Issue
Block a user