forked from elmau/empresa-libre
57 lines
2.5 KiB
JavaScript
57 lines
2.5 KiB
JavaScript
|
|
|
|
var controllers = {
|
|
init: function(){
|
|
//~ Main
|
|
$$('menu_user').attachEvent('onMenuItemClick', menu_user_click);
|
|
//~ Partner
|
|
$$('cmd_new_partner').attachEvent('onItemClick', cmd_new_partner_click);
|
|
$$('cmd_new_contact').attachEvent('onItemClick', cmd_new_contact_click);
|
|
$$('cmd_edit_partner').attachEvent('onItemClick', cmd_edit_partner_click);
|
|
$$('cmd_delete_partner').attachEvent('onItemClick', cmd_delete_partner_click);
|
|
$$('cmd_save_partner').attachEvent('onItemClick', cmd_save_partner_click);
|
|
$$('cmd_cancel_partner').attachEvent('onItemClick', cmd_cancel_partner_click);
|
|
$$('cmd_cancel_contact').attachEvent('onItemClick', cmd_cancel_contact_click);
|
|
//~ $$('grid_partners').attachEvent('onItemClick', grid_partners_click);
|
|
$$('postal_code').attachEvent('onKeyPress', postal_code_key_press);
|
|
$$('postal_code').attachEvent('onTimedKeyPress', postal_code_key_up);
|
|
$$('colonia').attachEvent('onFocus', colonia_on_focus)
|
|
//~ Products
|
|
$$("cmd_new_product").attachEvent("onItemClick", cmd_new_product_click);
|
|
$$("cmd_edit_product").attachEvent("onItemClick", cmd_edit_product_click);
|
|
$$("cmd_delete_product").attachEvent("onItemClick", cmd_delete_product_click);
|
|
$$("cmd_save_product").attachEvent("onItemClick", cmd_save_product_click);
|
|
$$("cmd_cancel_product").attachEvent("onItemClick", cmd_cancel_product_click);
|
|
//~ Invoices
|
|
$$("cmd_new_invoice").attachEvent("onItemClick", cmd_new_invoice_click);
|
|
$$("cmd_edit_invoice").attachEvent("onItemClick", cmd_edit_invoice_click);
|
|
$$("cmd_delete_invoice").attachEvent("onItemClick", cmd_delete_invoice_click);
|
|
$$("cmd_save_invoice").attachEvent("onItemClick", cmd_save_invoice_click);
|
|
$$("cmd_cancel_invoice").attachEvent("onItemClick", cmd_cancel_invoice_click);
|
|
|
|
get_partners()
|
|
}
|
|
};
|
|
|
|
function get_partners(){
|
|
webix.ajax().get("/partners", {}, {
|
|
error: function(text, data, xhr) {
|
|
webix.message({ type:"error", text: "Error al consultar"});
|
|
},
|
|
success: function(text, data, xhr) {
|
|
var values = data.json();
|
|
$$("grid_partners").clearAll();
|
|
if (values.ok){
|
|
$$("grid_partners").parse(values.rows, 'json');
|
|
};
|
|
}
|
|
});
|
|
}
|
|
|
|
function menu_user_click(id, e, node){
|
|
if (id == 1){
|
|
window.location = '/logout';
|
|
return
|
|
}
|
|
}
|