From 64e63aa41be56a161825b1242dfe475022250d08 Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Fri, 22 Nov 2024 18:45:29 +0530 Subject: [PATCH 1/2] feat: setting to make feedback mandatory --- desk/src/App.vue | 7 ++-- desk/src/pages/TicketCustomer.vue | 37 +++++++++++-------- desk/src/stores/config.ts | 4 ++ helpdesk/api/config.py | 1 + .../doctype/hd_settings/hd_settings.json | 16 +++++++- 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/desk/src/App.vue b/desk/src/App.vue index 37c20a52a..a56b0e0e1 100644 --- a/desk/src/App.vue +++ b/desk/src/App.vue @@ -2,16 +2,17 @@ + diff --git a/desk/src/stores/config.ts b/desk/src/stores/config.ts index 83b557bc4..f2c9064ef 100644 --- a/desk/src/stores/config.ts +++ b/desk/src/stores/config.ts @@ -20,6 +20,9 @@ export const useConfigStore = defineStore("config", () => { const preferKnowledgeBase = computed( () => !!parseInt(config.value.prefer_knowledge_base) ); + const isFeedbackMandatory = computed( + () => !!parseInt(config.value.is_feedback_mandatory) + ); socket.on("helpdesk:settings-updated", () => configRes.reload()); @@ -29,5 +32,6 @@ export const useConfigStore = defineStore("config", () => { preferKnowledgeBase, isSetupComplete, skipEmailWorkflow, + isFeedbackMandatory, }; }); diff --git a/helpdesk/api/config.py b/helpdesk/api/config.py index 1772ccf88..a431ea1df 100644 --- a/helpdesk/api/config.py +++ b/helpdesk/api/config.py @@ -8,6 +8,7 @@ def get_config(): "prefer_knowledge_base", "setup_complete", "skip_email_workflow", + "is_feedback_mandatory", ] res = frappe.get_value(doctype="HD Settings", fieldname=fields, as_dict=True) return res diff --git a/helpdesk/helpdesk/doctype/hd_settings/hd_settings.json b/helpdesk/helpdesk/doctype/hd_settings/hd_settings.json index 908fddf18..5bf9407ef 100644 --- a/helpdesk/helpdesk/doctype/hd_settings/hd_settings.json +++ b/helpdesk/helpdesk/doctype/hd_settings/hd_settings.json @@ -28,6 +28,8 @@ "column_break_zxek", "ticket_restrictions_section", "allow_anyone_to_create_tickets", + "feedback_section", + "is_feedback_mandatory", "section_break_duow", "auto_update_status", "workflow_tab", @@ -307,11 +309,23 @@ "fieldname": "auto_update_status", "fieldtype": "Check", "label": "Auto Update Status" + }, + { + "fieldname": "feedback_section", + "fieldtype": "Section Break", + "label": "Feedback" + }, + { + "default": "0", + "description": "If enabled, the feedback dialog will be shown, when a user tries to close a ticket. \nNote: User can't close a ticket without giving a feedback.", + "fieldname": "is_feedback_mandatory", + "fieldtype": "Check", + "label": "Make Feedback Mandatory" } ], "issingle": 1, "links": [], - "modified": "2024-11-22 16:50:02.831137", + "modified": "2024-11-22 17:25:40.112881", "modified_by": "Administrator", "module": "Helpdesk", "name": "HD Settings", From 76fea07b1f76d6cc3ad065cc2c9782c624dfd36f Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Fri, 22 Nov 2024 18:46:35 +0530 Subject: [PATCH 2/2] chore: code cleanup --- desk/src/pages/TicketCustomer.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desk/src/pages/TicketCustomer.vue b/desk/src/pages/TicketCustomer.vue index d4193cdca..e61d96cac 100644 --- a/desk/src/pages/TicketCustomer.vue +++ b/desk/src/pages/TicketCustomer.vue @@ -124,7 +124,7 @@ const send = createResource({ }, }); -async function handleClose() { +function handleClose() { if (showFeedback.value) { showFeedbackDialog.value = true; } else {