mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
solucionados problemas en tarifas cliente
This commit is contained in:
@ -49,7 +49,7 @@ class tarifasClienteView {
|
|||||||
this.#initTable();
|
this.#initTable();
|
||||||
|
|
||||||
this.selectorPlantilla.init();
|
this.selectorPlantilla.init();
|
||||||
|
|
||||||
this.#getPlantillaPrecios();
|
this.#getPlantillaPrecios();
|
||||||
|
|
||||||
this.convertToTemplateBtn.on('click', function () {
|
this.convertToTemplateBtn.on('click', function () {
|
||||||
@ -188,15 +188,17 @@ class tarifasClienteView {
|
|||||||
this.editorTarifas.editor.on('postEdit', function (e, json, data, action) {
|
this.editorTarifas.editor.on('postEdit', function (e, json, data, action) {
|
||||||
self.#borrarPlantillaTarifa(self.clienteId);
|
self.#borrarPlantillaTarifa(self.clienteId);
|
||||||
self.selectorPlantilla.offChange();
|
self.selectorPlantilla.offChange();
|
||||||
|
self.selectorPlantilla.empty();
|
||||||
self.selectorPlantilla.setOption(0, 'Personalizado');
|
self.selectorPlantilla.setOption(0, 'Personalizado');
|
||||||
self.selectorPlantilla.onChange(self.#changePlantilla.bind(this));
|
self.selectorPlantilla.onChange(self.#changePlantilla.bind(self));
|
||||||
})
|
})
|
||||||
|
|
||||||
this.editorTarifas.editor.on('postCreate', function (e, json, data, action) {
|
this.editorTarifas.editor.on('postCreate', function (e, json, data, action) {
|
||||||
self.#borrarPlantillaTarifa(self.clienteId);
|
self.#borrarPlantillaTarifa(self.clienteId);
|
||||||
self.selectorPlantilla.offChange();
|
self.selectorPlantilla.offChange();
|
||||||
|
self.selectorPlantilla.empty();
|
||||||
self.selectorPlantilla.setOption(0, 'Personalizado');
|
self.selectorPlantilla.setOption(0, 'Personalizado');
|
||||||
self.selectorPlantilla.onChange(self.#changePlantilla.bind(this));
|
self.selectorPlantilla.onChange(self.#changePlantilla.bind(self));
|
||||||
})
|
})
|
||||||
|
|
||||||
this.editorTarifas.editor.on('postCancel', function (e, json, data) {
|
this.editorTarifas.editor.on('postCancel', function (e, json, data) {
|
||||||
@ -246,7 +248,9 @@ class tarifasClienteView {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
(data) => {
|
(data) => {
|
||||||
|
this.selectorPlantilla.offChange();
|
||||||
if (data !== null && typeof data === 'object') {
|
if (data !== null && typeof data === 'object') {
|
||||||
|
|
||||||
if (data.hasOwnProperty('id') && data.id != null)
|
if (data.hasOwnProperty('id') && data.id != null)
|
||||||
this.selectorPlantilla.setOption(data.id, data.nombre);
|
this.selectorPlantilla.setOption(data.id, data.nombre);
|
||||||
else {
|
else {
|
||||||
@ -254,6 +258,7 @@ class tarifasClienteView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
this.selectorPlantilla.setOption(0, 'Personalizado');
|
this.selectorPlantilla.setOption(0, 'Personalizado');
|
||||||
}
|
}
|
||||||
this.selectorPlantilla.onChange(this.#changePlantilla.bind(this));
|
this.selectorPlantilla.onChange(this.#changePlantilla.bind(this));
|
||||||
@ -268,6 +273,7 @@ class tarifasClienteView {
|
|||||||
#changePlantilla() {
|
#changePlantilla() {
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
const data = $('#plantillas').select2('data');
|
const data = $('#plantillas').select2('data');
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
if (data[0].id == 0) {
|
if (data[0].id == 0) {
|
||||||
@ -280,12 +286,14 @@ class tarifasClienteView {
|
|||||||
|
|
||||||
|
|
||||||
const id = data[0].id;
|
const id = data[0].id;
|
||||||
|
if(id == 0)
|
||||||
|
id = -1;
|
||||||
new Ajax(
|
new Ajax(
|
||||||
'/clienteprecios/changeplantilla',
|
'/clienteprecios/changeplantilla',
|
||||||
{
|
{
|
||||||
'cliente_id': self.clienteId,
|
'cliente_id': self.clienteId,
|
||||||
'plantilla_id': id,
|
'plantilla_id': id,
|
||||||
[this.csrf_token]: this.csrf_hash
|
[self.csrf_token]: self.csrf_hash
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user