mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
generando papeles especiales
This commit is contained in:
@ -301,13 +301,14 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||||
$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;
|
||||||
$papel_especial = goSanitize($this->request->getGet('papel_especial'))[0] ?? 0;
|
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, false);
|
||||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $papel_especial);
|
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, true);
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
$data = [
|
$data = [
|
||||||
'papeles' => $menu,
|
'papeles' => $menu,
|
||||||
|
'papeles_especiales' => $menu2,
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
return $this->respond($data);
|
return $this->respond($data);
|
||||||
@ -315,4 +316,37 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************
|
||||||
|
*
|
||||||
|
* AUQIIIIII
|
||||||
|
*/
|
||||||
|
public function selectPapelEspecial()
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
|
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||||
|
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||||
|
$items = $this->model->getPapelCliente($tipo, $cubierta, null, true);
|
||||||
|
|
||||||
|
$query = $this->model->builder()->select(
|
||||||
|
[
|
||||||
|
"id",
|
||||||
|
"nombre as name"
|
||||||
|
]
|
||||||
|
)->where("deleted_at", null);
|
||||||
|
if ($this->request->getGet("q")) {
|
||||||
|
$query->groupStart()
|
||||||
|
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON($query->get()->getResultObject());
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -256,6 +256,7 @@ return [
|
|||||||
// Placeholders
|
// Placeholders
|
||||||
'formatoLibro' => "Formato libro",
|
'formatoLibro' => "Formato libro",
|
||||||
'selectCliente' => "Seleccione cliente",
|
'selectCliente' => "Seleccione cliente",
|
||||||
|
'selectPapel' => "Seleccione papel",
|
||||||
|
|
||||||
|
|
||||||
// Preview
|
// Preview
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
1 => "t1.code",
|
1 => "t1.code",
|
||||||
2 => "t1.code_ot",
|
2 => "t1.code_ot",
|
||||||
3 => "t1.show_in_client",
|
3 => "t1.show_in_client",
|
||||||
3 => "t1.show_in_client_special",
|
4 => "t1.show_in_client_special",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
|
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
|
||||||
|
|||||||
@ -51,6 +51,12 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="divPapelEspecialInterior" name="div_papel_especial_interior" class="row col-sm-10 mb-5 justify-content-center d-none">
|
||||||
|
<select id="papelEspecialInterior" name="papel_especial_interior" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
|
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||||
|
|
||||||
<div id="interiorGramaje70" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
|
<div id="interiorGramaje70" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
|
||||||
|
|||||||
@ -18,9 +18,13 @@ class DisenioInterior {
|
|||||||
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
||||||
this.textoPapelInterior = this.domItem.find("#textoPapelInterior");
|
this.textoPapelInterior = this.domItem.find("#textoPapelInterior");
|
||||||
this.divPapelInteriorColor = this.domItem.find("#divPapelInteriorColor");
|
this.divPapelInteriorColor = this.domItem.find("#divPapelInteriorColor");
|
||||||
|
this.divPapelEspecialInterior = this.domItem.find("#divPapelEspecialInterior");
|
||||||
|
this.papelEspecialInterior = this.domItem.find("#papelEspecialInterior");
|
||||||
this.divGramajeInterior = this.domItem.find("#divGramajeInterior");
|
this.divGramajeInterior = this.domItem.find("#divGramajeInterior");
|
||||||
this.papelInterior = this.domItem.find(".papel-interior");
|
this.papelInterior = this.domItem.find(".papel-interior");
|
||||||
|
|
||||||
|
this.papelEspecial = new ClassSelect($("#papelEspecialInterior"), '/clientes/cliente/getSelect2', window.translations["selectPapel"]);
|
||||||
|
|
||||||
this.negroEstandar = this.domItem.find("#negroEstandar");
|
this.negroEstandar = this.domItem.find("#negroEstandar");
|
||||||
this.negroPremium = this.domItem.find("#negroPremium");
|
this.negroPremium = this.domItem.find("#negroPremium");
|
||||||
this.colorEstandar = this.domItem.find("#colorEstandar");
|
this.colorEstandar = this.domItem.find("#colorEstandar");
|
||||||
@ -165,6 +169,32 @@ class DisenioInterior {
|
|||||||
container.append(radioButton).append(label);
|
container.append(radioButton).append(label);
|
||||||
$('#divPapelInterior').append(container);
|
$('#divPapelInterior').append(container);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(response.papeles_especiales.length > 0){
|
||||||
|
this.divPapelInterior.removeClass('d-none');
|
||||||
|
|
||||||
|
var container = $('<div>', {
|
||||||
|
class: 'custom-selector d-flex flex-column align-items-center justify-content-center'
|
||||||
|
});
|
||||||
|
|
||||||
|
var radioButton = $('<input>', {
|
||||||
|
type: 'radio', // Tipo de input
|
||||||
|
name: 'calcular-presupuesto papel-interior',
|
||||||
|
id: 'papelInteriorEspecial', // ID único
|
||||||
|
value: 'option1' // Valor del radio button
|
||||||
|
});
|
||||||
|
|
||||||
|
// Crear una etiqueta para el radio button
|
||||||
|
var label = $('<label>', {
|
||||||
|
for: 'papelInteriorEspecial',
|
||||||
|
text: 'PAPEL ESPECIAL'
|
||||||
|
});
|
||||||
|
|
||||||
|
radioButton.on('click', this.#handlePapelInterior.bind(this));
|
||||||
|
|
||||||
|
container.append(radioButton).append(label);
|
||||||
|
$('#divPapelInterior').append(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cargarDatos(datos, papelInteriorDiferente) {
|
cargarDatos(datos, papelInteriorDiferente) {
|
||||||
@ -592,6 +622,7 @@ class DisenioInterior {
|
|||||||
|
|
||||||
|
|
||||||
#handlePapelInterior(event) {
|
#handlePapelInterior(event) {
|
||||||
|
|
||||||
const context = this;
|
const context = this;
|
||||||
|
|
||||||
// Accede al ID del elemento que disparó el evento
|
// Accede al ID del elemento que disparó el evento
|
||||||
@ -606,17 +637,23 @@ class DisenioInterior {
|
|||||||
else if (this.colorPremium.hasClass('selected'))
|
else if (this.colorPremium.hasClass('selected'))
|
||||||
tipo = 'colorhq';
|
tipo = 'colorhq';
|
||||||
|
|
||||||
new Ajax('/papelesgenericos/getpapelcliente',
|
if(papel == 'papelEspecialInterior'){
|
||||||
{
|
|
||||||
[this.csrf_token]: this.csrf_hash,
|
}
|
||||||
papel: papel,
|
else{
|
||||||
tipo: tipo,
|
new Ajax('/papelesgenericos/getpapelcliente',
|
||||||
cubierta: 0,
|
{
|
||||||
},
|
[this.csrf_token]: this.csrf_hash,
|
||||||
{},
|
papel: papel,
|
||||||
this.fillGramajes.bind(context),
|
tipo: tipo,
|
||||||
(response) => { console.log(response); }
|
cubierta: 0,
|
||||||
).get();
|
},
|
||||||
|
{},
|
||||||
|
this.fillGramajes.bind(context),
|
||||||
|
(response) => { console.log(response); }
|
||||||
|
).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user