mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadido el select2 de los acabados
This commit is contained in:
@ -53,14 +53,35 @@ class Importador {
|
|||||||
uso: 'sobrecubierta',
|
uso: 'sobrecubierta',
|
||||||
});
|
});
|
||||||
|
|
||||||
this.compAcabadoCubiertaSelected = new ClassSelect($("#compAcabadoCubiertaSelected"), '/importador/getacabado', "Seleccione un acabado");
|
this.acabadoCubierta = new ClassSelect($("#compAcabadoCubiertaSelected"),
|
||||||
this.compAcabadoSobrecubiertaSelected = new ClassSelect($("#compAcabadoSobrecubiertaSelected"), '/importador/getacabado', "Seleccione un acabado");
|
'/serviciosacabados/getacabados',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
"cubierta": 1
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.acabadosSobrecubierta = new ClassSelect($("#compAcabadoSobrecubiertaSelected"),
|
||||||
|
'/serviciosacabados/getacabados',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
"sobrecubierta": 1
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
this.openBtn = $('#openOld');
|
this.openBtn = $('#openOld');
|
||||||
this.initImport = $('#initImport');
|
this.initImport = $('#initImport');
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
||||||
|
// Fuerza el foco en el campo de búsqueda de select2
|
||||||
|
$(document).on('select2:open', () => {
|
||||||
|
document.querySelector('.select2-search__field').focus();
|
||||||
|
});
|
||||||
|
|
||||||
this.cliente.init();
|
this.cliente.init();
|
||||||
this.presupuesto.init();
|
this.presupuesto.init();
|
||||||
this.encuadernacion.init();
|
this.encuadernacion.init();
|
||||||
@ -70,8 +91,8 @@ class Importador {
|
|||||||
this.compPapelCubiertaSelected.init();
|
this.compPapelCubiertaSelected.init();
|
||||||
this.compSobrecubiertaSelected.init();
|
this.compSobrecubiertaSelected.init();
|
||||||
|
|
||||||
this.compAcabadoCubiertaSelected.init();
|
this.acabadoCubierta.init();
|
||||||
this.compAcabadoSobrecubiertaSelected.init();
|
this.acabadosSobrecubierta.init();
|
||||||
|
|
||||||
this.cliente.item.on('change', () => {
|
this.cliente.item.on('change', () => {
|
||||||
this.presupuesto.item.val('').trigger('change');
|
this.presupuesto.item.val('').trigger('change');
|
||||||
@ -237,49 +258,49 @@ class Importador {
|
|||||||
if (data.acabados) {
|
if (data.acabados) {
|
||||||
if (data.acabados.cubierta && data.acabados.cubierta.acabadoOld) {
|
if (data.acabados.cubierta && data.acabados.cubierta.acabadoOld) {
|
||||||
$('#compAcabadoCubiertaOrigen').val(data.acabados.cubierta.acabadoOld);
|
$('#compAcabadoCubiertaOrigen').val(data.acabados.cubierta.acabadoOld);
|
||||||
this.compAcabadoCubiertaSelected.setOption(data.acabados.cubierta.acabado.id, data.acabados.cubierta.acabado.name);
|
this.acabadoCubierta.setOption(data.acabados.cubierta.acabado.id, data.acabados.cubierta.acabado.name);
|
||||||
this.compAcabadoCubiertaSelected.item.prop('disabled', false);
|
this.acabadoCubierta.item.prop('disabled', false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#compAcabadoCubiertaOrigen').val("");
|
$('#compAcabadoCubiertaOrigen').val("");
|
||||||
this.compAcabadoCubiertaSelected.empty();
|
this.acabadoCubierta.empty();
|
||||||
this.compAcabadoCubiertaSelected.item.prop('disabled', true);
|
this.acabadoCubierta.item.prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.acabados.sobrecubierta && data.acabados.sobrecubierta.acabadoOld) {
|
if (data.acabados.sobrecubierta && data.acabados.sobrecubierta.acabadoOld) {
|
||||||
$('#compAcabadoSobrecubiertaOrigen').val(data.acabados.sobrecubierta.acabadoOld);
|
$('#compAcabadoSobrecubiertaOrigen').val(data.acabados.sobrecubierta.acabadoOld);
|
||||||
this.compAcabadoSobrecubiertaSelected.setOption(data.acabados.sobrecubierta.acabado.id, data.acabados.sobrecubierta.acabado.name);
|
this.acabadosSobrecubierta.setOption(data.acabados.sobrecubierta.acabado.id, data.acabados.sobrecubierta.acabado.name);
|
||||||
this.compAcabadoSobrecubiertaSelected.item.prop('disabled', false);
|
this.acabadosSobrecubierta.item.prop('disabled', false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#compAcabadoSobrecubiertaOrigen').val("");
|
$('#compAcabadoSobrecubiertaOrigen').val("");
|
||||||
this.compAcabadoSobrecubiertaSelected.empty();
|
this.acabadosSobrecubierta.empty();
|
||||||
this.compAcabadoSobrecubiertaSelected.item.prop('disabled', true);
|
this.acabadosSobrecubierta.item.prop('disabled', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.servicios.ferro == 1){
|
if (data.servicios.ferro == 1) {
|
||||||
$('#ferro').prop('checked', true);
|
$('#ferro').prop('checked', true);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#ferro').prop('checked', false);
|
$('#ferro').prop('checked', false);
|
||||||
}
|
}
|
||||||
if(data.servicios.ferroDigital == 1){
|
if (data.servicios.ferroDigital == 1) {
|
||||||
$('#ferroDigital').prop('checked', true);
|
$('#ferroDigital').prop('checked', true);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#ferroDigital').prop('checked', false);
|
$('#ferroDigital').prop('checked', false);
|
||||||
}
|
}
|
||||||
if(data.servicios.marcapaginas == 1){
|
if (data.servicios.marcapaginas == 1) {
|
||||||
$('#marcapaginas').prop('checked', true);
|
$('#marcapaginas').prop('checked', true);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#marcapaginas').prop('checked', false);
|
$('#marcapaginas').prop('checked', false);
|
||||||
}
|
}
|
||||||
if(data.servicios.prototipo == 1){
|
if (data.servicios.prototipo == 1) {
|
||||||
$('#prototipo').prop('checked', true);
|
$('#prototipo').prop('checked', true);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#prototipo').prop('checked', false);
|
$('#prototipo').prop('checked', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user