mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
presupuesto cliente para perfil cliente
This commit is contained in:
@ -99,6 +99,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
// Se obtiene el cliente ID a partir del usuario de la sesion
|
// Se obtiene el cliente ID a partir del usuario de la sesion
|
||||||
$model_user = model('App\Models\Usuarios\UserModel');
|
$model_user = model('App\Models\Usuarios\UserModel');
|
||||||
|
|
||||||
$user = $model_user->find(auth()->user()->id);
|
$user = $model_user->find(auth()->user()->id);
|
||||||
$clienteId = $user->cliente_id;
|
$clienteId = $user->cliente_id;
|
||||||
|
|
||||||
|
|||||||
@ -16,14 +16,15 @@
|
|||||||
<label for="autor" class="form-label">
|
<label for="autor" class="form-label">
|
||||||
<?= lang('Presupuestos.autor') ?>
|
<?= lang('Presupuestos.autor') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="autor" placeholder="Autor" name="autor" maxLength="150" class="form-control text-center" value="">
|
<input type="text" id="autor" placeholder="Autor" name="autor" maxLength="150" class="form-control text-center"
|
||||||
|
value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
<div class="col-sm-4 mb-3">
|
<div class="col-sm-4 mb-3">
|
||||||
<label for="isbn" class="form-label">
|
<label for="isbn" class="form-label">
|
||||||
<?=lang('Presupuestos.isbn') ?>
|
<?= lang('Presupuestos.isbn') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="isbn" name="isbn" placeholder="ISBN" maxLength="50" class="form-control" value="">
|
<input type="text" id="isbn" name="isbn" placeholder="ISBN" maxLength="50" class="form-control" value="">
|
||||||
</div>
|
</div>
|
||||||
@ -32,35 +33,44 @@
|
|||||||
<label for="coleccion" class="form-label">
|
<label for="coleccion" class="form-label">
|
||||||
<?= lang('Presupuestos.coleccion') ?>
|
<?= lang('Presupuestos.coleccion') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="coleccion" name="coleccion" placeholder="Coleccion" maxLength="255" class="form-control" value="">
|
<input type="text" id="coleccion" name="coleccion" placeholder="Coleccion" maxLength="255"
|
||||||
|
class="form-control" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4 mb-3">
|
<div class="col-sm-4 mb-3">
|
||||||
<label for="referenciaCliente" class="form-label">
|
<label for="referenciaCliente" class="form-label">
|
||||||
<?=lang('Presupuestos.referenciaCliente') ?>
|
<?= lang('Presupuestos.referenciaCliente') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="referenciaCliente" name="referencia_cliente" placeholder="Referencia cliente" maxLength="100" class="form-control" value="">
|
<input type="text" id="referenciaCliente" name="referencia_cliente" placeholder="Referencia cliente"
|
||||||
</div>
|
maxLength="100" class="form-control" value="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
|
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
|
||||||
<label id="label_clienteId" for="clienteId" class="form-label">
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
id="label_clienteId" for="clienteId" class="form-label">
|
||||||
Cliente*
|
Cliente*
|
||||||
</label>
|
</label>
|
||||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
|
<select <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
|
<?php if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?>
|
||||||
|
<option value="<?= $clienteId ?>" selected>cliente</option>
|
||||||
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row col-sm-5 mb-3 d-flex flex-column align-items-center">
|
<div class="row col-sm-5 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="excluirRotativa"
|
<input <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
name="excluir_rotativa" value="1">
|
class="calcular-presupuesto form-check-input" type="checkbox" id="excluirPortada"
|
||||||
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
name="excluir_portada" value="1">
|
||||||
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,9 @@ class DatosGenerales {
|
|||||||
|
|
||||||
// Selects
|
// Selects
|
||||||
this.formatoLibro.init();
|
this.formatoLibro.init();
|
||||||
this.cliente.init();
|
if (this.excluirRotativa.length != 0) {
|
||||||
|
this.cliente.init();
|
||||||
|
}
|
||||||
|
|
||||||
// Inicializa el tipo de impresion
|
// Inicializa el tipo de impresion
|
||||||
this.#handlePaginas();
|
this.#handlePaginas();
|
||||||
@ -100,6 +102,8 @@ class DatosGenerales {
|
|||||||
message: window.translations["validation"].cliente,
|
message: window.translations["validation"].cliente,
|
||||||
callback: function (input) {
|
callback: function (input) {
|
||||||
// Get the selected options
|
// Get the selected options
|
||||||
|
if(this.excluirRotativa.length == 0)
|
||||||
|
return true;
|
||||||
const options = $("#clienteId").select2('data');
|
const options = $("#clienteId").select2('data');
|
||||||
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
||||||
return options !== null && options.length > 0 && hasValidOption;
|
return options !== null && options.length > 0 && hasValidOption;
|
||||||
@ -382,9 +386,11 @@ class DatosGenerales {
|
|||||||
this.coleccion.val(datos.coleccion);
|
this.coleccion.val(datos.coleccion);
|
||||||
this.referenciaCliente.val(datos.referenciaCliente);
|
this.referenciaCliente.val(datos.referenciaCliente);
|
||||||
|
|
||||||
this.cliente.setOption(datos.clienteId, datos.clienteNombre);
|
if (this.excluirRotativa.length != 0) {
|
||||||
this.cliente.setVal(datos.clienteId);
|
this.cliente.setOption(datos.clienteId, datos.clienteNombre);
|
||||||
$(this.cliente).trigger('change');
|
this.cliente.setVal(datos.clienteId);
|
||||||
|
$(this.cliente).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
if (datos.excluirRotativa) {
|
if (datos.excluirRotativa) {
|
||||||
this.excluirRotativa.prop('checked', true);
|
this.excluirRotativa.prop('checked', true);
|
||||||
@ -434,6 +440,12 @@ class DatosGenerales {
|
|||||||
this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change');
|
this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCliente(){
|
||||||
|
if (this.excluirRotativa.length == 0)
|
||||||
|
return $('#clienteId').val();
|
||||||
|
return this.cliente.getVal();
|
||||||
|
}
|
||||||
|
|
||||||
getDimensionLibro() {
|
getDimensionLibro() {
|
||||||
|
|
||||||
let ancho = 0;
|
let ancho = 0;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class Direcciones {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
||||||
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
||||||
|
|
||||||
this.direccionesCliente.init();
|
this.direccionesCliente.init();
|
||||||
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
||||||
|
|||||||
@ -62,6 +62,11 @@ class PresupuestoCliente {
|
|||||||
this.disenioCubierta.init();
|
this.disenioCubierta.init();
|
||||||
this.direcciones.init();
|
this.direcciones.init();
|
||||||
|
|
||||||
|
if(this.datosGenerales.excluirRotativa.length == 0){
|
||||||
|
|
||||||
|
this.direcciones.direccionesCliente.setParams({ 'cliente_id': $("#clienteId").val() })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.btnNext.on('click', this.#nextStep.bind(this));
|
this.btnNext.on('click', this.#nextStep.bind(this));
|
||||||
this.btnPrev.on('click', this.#prevtStep.bind(this));
|
this.btnPrev.on('click', this.#prevtStep.bind(this));
|
||||||
@ -189,63 +194,6 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*RELLENAR_PRESUPUESTO(finalizar) {
|
|
||||||
|
|
||||||
if (finalizar) {
|
|
||||||
|
|
||||||
$("#titulo").val("Titulo del libro");
|
|
||||||
$("#titulo").trigger('change');
|
|
||||||
|
|
||||||
const clienteId = $("#clienteId");
|
|
||||||
const newOption = new Option("Cliente Potencial", "1817", true, true);
|
|
||||||
clienteId.append(newOption).trigger('change');
|
|
||||||
|
|
||||||
const papelFormatoId = $("#papelFormatoId");
|
|
||||||
const newOption2 = new Option("148 x 210", "1", true, true);
|
|
||||||
papelFormatoId.append(newOption2).trigger('change');
|
|
||||||
|
|
||||||
|
|
||||||
$("#paginasColor").val("6");
|
|
||||||
$("#paginasColor").trigger('change');
|
|
||||||
|
|
||||||
$("#fresado").trigger("click");
|
|
||||||
|
|
||||||
|
|
||||||
$("#colorPremium").trigger("click");
|
|
||||||
$("#offsetBlanco").trigger("click");
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#gramaje90").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#tapaDura").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#unidadesEnvio").val("50");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#titulo").trigger('change');
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
#handleTitulosMenu(event) {
|
#handleTitulosMenu(event) {
|
||||||
|
|
||||||
$('.titulos-menu').removeClass('crossed');
|
$('.titulos-menu').removeClass('crossed');
|
||||||
@ -266,7 +214,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#goToForm(form) {
|
#goToForm(form) {
|
||||||
|
|
||||||
switch (form) {
|
switch (form) {
|
||||||
case '#datos-generales':
|
case '#datos-generales':
|
||||||
this.validationStepper.to(1);
|
this.validationStepper.to(1);
|
||||||
@ -439,7 +387,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(response.error){
|
if (response.error) {
|
||||||
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
|
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -546,7 +494,7 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
this.datos = {
|
this.datos = {
|
||||||
|
|
||||||
clienteId: this.datosGenerales.cliente.getVal(),
|
clienteId: this.datosGenerales.getCliente(),
|
||||||
|
|
||||||
tamanio: this.datosGenerales.getDimensionLibro(),
|
tamanio: this.datosGenerales.getDimensionLibro(),
|
||||||
tirada: this.datosGenerales.getTiradas(),
|
tirada: this.datosGenerales.getTiradas(),
|
||||||
@ -651,7 +599,9 @@ class PresupuestoCliente {
|
|||||||
this.calcularPresupuesto = false;
|
this.calcularPresupuesto = false;
|
||||||
|
|
||||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||||
this.direcciones.handleChangeCliente();
|
if (this.datosGenerales.excluirRotativa.length !== 0) {
|
||||||
|
this.direcciones.handleChangeCliente();
|
||||||
|
}
|
||||||
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
||||||
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
||||||
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||||
|
|||||||
Reference in New Issue
Block a user