Add validation for new stock
This commit is contained in:
parent
d61672dac4
commit
34c467d26e
|
@ -443,8 +443,11 @@ function cmd_add_inventory_click(id, e, node){
|
|||
}
|
||||
|
||||
win_add_inventory.init()
|
||||
$$('txt_add_id').setValue(row.id)
|
||||
$$('txt_add_key').setValue(row.clave)
|
||||
$$('txt_add_unit').setValue(row.unidad)
|
||||
$$('txt_add_description').setValue(row.descripcion)
|
||||
$$('win_add_inventory').show()
|
||||
|
||||
}
|
||||
|
||||
//~ Add products
|
||||
|
@ -697,11 +700,42 @@ function grid_partner_products_select(row_id, state){
|
|||
}
|
||||
|
||||
|
||||
function cmd_add_inventory_save_click(id, e, node){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cmd_add_inventory_cancel_click(id, e, node){
|
||||
$$('win_add_inventory').close()
|
||||
}
|
||||
|
||||
|
||||
function cmd_add_inventory_save_click(id, e, node){
|
||||
var id_product = $$('txt_add_id').getValue()
|
||||
var new_cant = $$('txt_new_cant').getValue()
|
||||
|
||||
if(new_cant<=0) {
|
||||
msg = 'La cantidad no puede ser cero'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
msg = '¿Estas seguro de guardar esta entrada? <br/><br/>\
|
||||
Esta acción no se puede deshacer'
|
||||
|
||||
webix.confirm({
|
||||
title: 'Agregar entrada',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
add_product_stock(id_product, new_cant)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function add_product_stock(id_product, new_cant){
|
||||
msg_ok(id_product)
|
||||
msg_ok(new_cant)
|
||||
$$('win_add_inventory').close()
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ var win_add_inventory = {
|
|||
width: 600,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Agregar manualmente',
|
||||
head: 'Agregar entrada manualmente',
|
||||
body: body_add_inventory,
|
||||
})
|
||||
$$('cmd_add_inventory_save').attachEvent('onItemClick', cmd_add_inventory_save_click)
|
||||
|
|
Loading…
Reference in New Issue