From 1848e474b069d4a9f626b3f7cce6d3238f585902 Mon Sep 17 00:00:00 2001 From: Sumit Bhanushali Date: Tue, 21 May 2024 09:13:14 +0530 Subject: [PATCH] redesign: canned response --- .../canned-response/CannedResponseModal.vue | 93 +++++++++++ desk/src/components/canned-response/index.js | 1 + desk/src/pages/CannedResponses.vue | 147 ++++++++++++++---- desk/src/utils.ts | 9 +- .../hd_canned_response.json | 12 +- .../hd_canned_response/hd_canned_response.py | 36 ++++- 6 files changed, 262 insertions(+), 36 deletions(-) create mode 100644 desk/src/components/canned-response/CannedResponseModal.vue diff --git a/desk/src/components/canned-response/CannedResponseModal.vue b/desk/src/components/canned-response/CannedResponseModal.vue new file mode 100644 index 000000000..3f43ee3e9 --- /dev/null +++ b/desk/src/components/canned-response/CannedResponseModal.vue @@ -0,0 +1,93 @@ + + + diff --git a/desk/src/components/canned-response/index.js b/desk/src/components/canned-response/index.js index af2f285aa..671875525 100644 --- a/desk/src/components/canned-response/index.js +++ b/desk/src/components/canned-response/index.js @@ -1,2 +1,3 @@ export { default as AddNewCannedResponseDialog } from "./AddNewCannedResponseDialog.vue"; export { default as CannedResponseInfo } from "./CannedResponseInfo.vue"; +export { default as CannedResponseModal } from "./CannedResponseModal.vue"; diff --git a/desk/src/pages/CannedResponses.vue b/desk/src/pages/CannedResponses.vue index 56f266b53..434ac00cb 100644 --- a/desk/src/pages/CannedResponses.vue +++ b/desk/src/pages/CannedResponses.vue @@ -9,7 +9,13 @@ label="Create" theme="gray" variant="solid" - @click="showNewDialog = true" + @click=" + () => { + title = null; + message = null; + showNewDialog = true; + } + " > - - +
+
+
+
+ {{ cannedResponse.title }} +
+ +
+ +
+
+ +
+ {{ getUser(cannedResponse.owner).full_name }} +
+
+ +
+ {{ dayjs.tz(cannedResponse.modified).fromNow() }} +
+
+
+
+
+ + diff --git a/desk/src/utils.ts b/desk/src/utils.ts index 02dc44967..f87f1e027 100644 --- a/desk/src/utils.ts +++ b/desk/src/utils.ts @@ -1,4 +1,4 @@ -import { useClipboard } from "@vueuse/core"; +import { useClipboard, useDateFormat } from "@vueuse/core"; import { toast } from "frappe-ui"; /** @@ -39,3 +39,10 @@ export function getAssign(s: string): string | undefined { const arr = Array.isArray(assignJson) ? assignJson : []; return arr.slice(-1).pop(); } + +export function dateFormat(date, format) { + const _format = format || "DD-MM-YYYY HH:mm:ss"; + return useDateFormat(date, _format).value; +} + +export const dateTooltipFormat = "ddd, MMM D, YYYY h:mm A"; diff --git a/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.json b/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.json index e0752420e..a7ee7b463 100644 --- a/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.json +++ b/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.json @@ -1,7 +1,6 @@ { "actions": [], - "allow_rename": 1, - "autoname": "field:title", + "autoname": "hash", "creation": "2022-11-03 17:19:47.135176", "doctype": "DocType", "editable_grid": 1, @@ -25,11 +24,11 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-03-12 12:05:42.429658", + "modified": "2024-05-21 00:23:20.975019", "modified_by": "Administrator", "module": "Helpdesk", "name": "HD Canned Response", - "naming_rule": "By fieldname", + "naming_rule": "Random", "owner": "Administrator", "permissions": [ { @@ -59,5 +58,6 @@ ], "sort_field": "modified", "sort_order": "DESC", - "states": [] -} + "states": [], + "title_field": "title" +} \ No newline at end of file diff --git a/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.py b/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.py index 526f523ab..16f5245ca 100644 --- a/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.py +++ b/helpdesk/helpdesk/doctype/hd_canned_response/hd_canned_response.py @@ -6,4 +6,38 @@ class HDCannedResponse(Document): - pass + def default_list_data(): + + columns = [ + { + 'label': 'Title', + 'type': 'Data', + 'key': 'title', + 'width': '5rem', + }, + { + 'label': 'Message', + 'type': 'Text Editor', + 'key': 'message', + 'width': '25rem', + }, + { + 'label': 'Owner', + 'type': 'Link', + 'key': 'owner', + 'width': '5rem', + }, + { + 'label': 'Modified On', + 'type': 'Datetime', + 'key': 'modified', + 'width': '5rem', + } + ] + rows = [ + "title", + "message", + "owner", + "modified" + ] + return {'columns': columns, 'rows': rows}