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