brotherton-erpnext/erpnext/public/js/hub/components/edit_details_dialog.js

42 lines
926 B
JavaScript
Raw Normal View History

2019-12-19 14:41:37 +00:00
function edit_details_dialog(params) {
2019-12-01 19:39:59 +00:00
let dialog = new frappe.ui.Dialog({
title: __('Update Details'),
fields: [
{
2019-12-09 11:01:14 +00:00
label: 'Item Name',
fieldname: 'item_name',
fieldtype: 'Data',
2019-12-19 14:41:37 +00:00
default: params.defaults.item_name,
2019-12-09 11:01:14 +00:00
reqd: 1
2019-12-01 19:39:59 +00:00
},
{
2019-12-09 11:01:14 +00:00
label: 'Hub Category',
fieldname: 'hub_category',
fieldtype: 'Autocomplete',
2019-12-19 14:41:37 +00:00
default: params.defaults.hub_category,
2019-12-09 11:01:14 +00:00
options: [],
reqd: 1
2019-12-01 19:39:59 +00:00
},
{
2019-12-09 11:01:14 +00:00
label: 'Description',
fieldname: 'description',
fieldtype: 'Text',
2019-12-19 14:41:37 +00:00
default: params.defaults.description,
2019-12-09 11:01:14 +00:00
options: [],
reqd: 1
2019-12-01 19:39:59 +00:00
}
],
2019-12-19 14:41:37 +00:00
primary_action_label: params.primary_action.label || __('Update Details'),
primary_action: params.primary_action.fn
2019-12-01 19:39:59 +00:00
});
2019-12-09 11:01:14 +00:00
hub.call('get_categories').then(categories => {
categories = categories.map(d => d.name);
dialog.fields_dict.hub_category.set_data(categories);
});
2019-12-01 19:39:59 +00:00
return dialog;
}
2019-12-19 14:41:37 +00:00
export { edit_details_dialog };