Add options for multi stock UI

This commit is contained in:
Mauricio Baeza 2021-07-22 21:24:04 -05:00
parent 8a615144a6
commit 8f7aaac563
3 changed files with 39 additions and 5 deletions

View File

@ -443,7 +443,8 @@ class Configuracion(BaseModel):
'chk_config_codigo_barras',
'chk_config_precio_con_impuestos',
'chk_llevar_inventario',
'chk_use_packing',
'chk_multi_stock',
# ~ 'chk_use_packing',
)
data = (Configuracion
.select()

View File

@ -95,7 +95,8 @@ var controllers = {
$$('chk_config_codigo_barras').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_precio_con_impuestos').attachEvent('onItemClick', chk_config_item_click)
$$('chk_llevar_inventario').attachEvent('onItemClick', chk_config_item_click)
$$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click)
$$('chk_multi_stock').attachEvent('onItemClick', chk_config_item_click)
//~ $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click)
//~ Complements
$$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click)
@ -518,6 +519,10 @@ function get_config_values(opt){
$$(key).setValue(values[key])
if(key=='chk_config_leyendas_fiscales'){
admin_config_other_options(key)
}else if(key=='chk_multi_stock'){
if($$(key).getValue()){
$$('chk_multi_stock').enable()
}
}
}
})
@ -2494,13 +2499,21 @@ function opt_make_pdf_from_on_change(new_value, old_value){
function admin_config_other_options(id){
var value = Boolean($$(id).getValue())
if(id=='chk_config_leyendas_fiscales'){
var value = Boolean($$(id).getValue())
if(value){
$$('cmd_admin_leyendas_fiscales').enable()
}else{
$$('cmd_admin_leyendas_fiscales').disable()
}
}else if(id=='chk_llevar_inventario'){
if(value){
$$('chk_multi_stock').enable()
}else{
$$('chk_multi_stock').setValue(0)
$$('chk_multi_stock').disable()
disable_config_option('chk_multi_stock')
}
}
}
@ -2910,3 +2923,21 @@ function grid_sucursales_click(id, e, node){
})
}
function disable_config_option(id){
var values = {}
values[id] = 0
webix.ajax().sync().post('/config', values, {
error: function(text, data, xhr) {
msg = 'Error al guardar la configuración'
msg_error(msg)
},
success: function(text, data, xhr) {
var values = data.json();
if (!values.ok){
msg_error(values.msg)
}
}
})
}

View File

@ -772,8 +772,10 @@ var options_admin_products = [
labelRight: 'Mostrar precio con impuestos'}]},
{cols: [{view: 'checkbox', id: 'chk_llevar_inventario', labelWidth: 15,
labelRight: 'Mostrar inventario'}]},
{cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15,
labelRight: 'Usar empaques'}]},
{cols: [{maxWidth: 30}, {view: 'checkbox', id: 'chk_multi_stock', labelWidth: 15,
labelRight: 'Multialmacen', disabled: true}]},
//~ {cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15,
//~ labelRight: 'Usar empaques', hidden: true}]},
]