Files
safekat/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosGenerales.js

57 lines
1.7 KiB
JavaScript

import ClassSelect from '../../../components/select2.js';
class DatosGenerales{
constructor(domItem){
this.domItem = domItem;
this.id = this.domItem.find('#id');
this.fecha = this.domItem.find('#updated_at');
this.estado = this.domItem.find('#estado_id');
this.inc_rei = this.domItem.find('#incRei');
this.titulo = this.domItem.find('#titulo');
this.autor = this.domItem.find('#autor');
this.coleccion = this.domItem.find('#coleccion');
this.numeroEdicion = this.domItem.find('#numeroEdicion');
this.isbn = this.domItem.find('#isbn');
this.cliente = new ClassSelect($('#clienteId'), '/clientes/cliente/getSelect2', 'Seleccione cliente');
this.pais = new ClassSelect($('#paisId'), '/paises/menuitems2', 'Seleccione País');
this.referenciaCliente = this.domItem.find('#referenciaCliente');
}
init(){
this.cliente.init();
this.pais.init();
this.inc_rei.select2({
allowClear: false,
});
}
cargarDatos(datos){
this.id.val(datos.id);
this.fecha.val(datos.updated_at);
this.estado.val(datos.state);
this.inc_rei.val(datos.inc_rei).trigger('change');
this.titulo.val(datos.titulo);
this.autor.val(datos.autor);
this.coleccion.val(datos.coleccion);
this.numeroEdicion.val(datos.numero_edicion);
this.isbn.val(datos.isbn);
this.cliente.setOption(datos.cliente.id, datos.cliente.nombre);
this.pais.setOption(datos.pais, datos.pais_nombre);
this.referenciaCliente.val(datos.referenciaCliente);
}
}
export default DatosGenerales;