From c131bd1b257ddd13fef98ef0527da63ae86e1255 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Mon, 2 Dec 2019 01:09:59 +0530 Subject: [PATCH 1/4] feat(marketplace): edit item dialog --- .../js/hub/components/edit_details_dialog.js | 45 +++++++++++++++++++ erpnext/public/js/hub/pages/Item.vue | 37 ++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 erpnext/public/js/hub/components/edit_details_dialog.js diff --git a/erpnext/public/js/hub/components/edit_details_dialog.js b/erpnext/public/js/hub/components/edit_details_dialog.js new file mode 100644 index 0000000000..b341901fec --- /dev/null +++ b/erpnext/public/js/hub/components/edit_details_dialog.js @@ -0,0 +1,45 @@ +function EditDetailsDialog(primary_action, defaults) { + let dialog = new frappe.ui.Dialog({ + title: __('Update Details'), + fields: [ + { + "label": "Item Name", + "fieldname": "item_name", + "fieldtype": "Data", + "default": defaults.item_name, + "reqd": 1 + }, + { + "label": "Hub Category", + "fieldname": "hub_category", + "fieldtype": "Autocomplete", + "default": defaults.hub_category, + "options": [], + "reqd": 1 + }, + { + "label": "Description", + "fieldname": "description", + "fieldtype": "Text", + "default": defaults.description, + "options": [], + "reqd": 1 + } + ], + primary_action_label: primary_action.label || __('Update Details'), + primary_action: primary_action.fn, + }); + + hub.call('get_categories') + .then(categories => { + categories = categories.map(d => d.name); + dialog.fields_dict.hub_category.df.options = categories; + dialog.fields_dict.hub_category.set_options(); + }); + + return dialog; +} + +export { + EditDetailsDialog +}; \ No newline at end of file diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue index 841d0046db..b8399e30d6 100644 --- a/erpnext/public/js/hub/pages/Item.vue +++ b/erpnext/public/js/hub/pages/Item.vue @@ -35,6 +35,7 @@