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