diff --git a/app/javascript/dashboard/api/helpCenter/categories.js b/app/javascript/dashboard/api/helpCenter/categories.js index c5cb40cd4..b6eae3f32 100644 --- a/app/javascript/dashboard/api/helpCenter/categories.js +++ b/app/javascript/dashboard/api/helpCenter/categories.js @@ -15,8 +15,11 @@ class CategoriesAPI extends PortalsAPI { return axios.post(`${this.url}/${portalSlug}/categories`, categoryObj); } - update({ portalSlug, categoryObj }) { - return axios.patch(`${this.url}/${portalSlug}/categories`, categoryObj); + update({ portalSlug, categoryId, categoryObj }) { + return axios.patch( + `${this.url}/${portalSlug}/categories/${categoryId}`, + categoryObj + ); } delete({ portalSlug, categoryId }) { diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json index d5ab8c8eb..cdee6bbe2 100644 --- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json +++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json @@ -139,6 +139,20 @@ "TITLE": "Locales" } }, + "CATEGORIES": { + "TITLE": "Categories in", + "NEW_CATEGORY": "New category", + "TABLE": { + "NAME": "Name", + "DESCRIPTION": "Description", + "LOCALE": "Locale", + "ARTICLE_COUNT": "No. of articles", + "ACTION_BUTTON": { + "EDIT": "Edit category", + "DELETE": "Delete category" + } + } + }, "EDIT_BASIC_INFO": { "BUTTON_TEXT": "Update basic settings" } @@ -353,6 +367,43 @@ "SUCCESS_MESSAGE": "Category created successfully", "ERROR_MESSAGE": "Unable to create category" } + }, + "EDIT": { + "TITLE": "Edit a category", + "SUB_TITLE": "Editing a category will update the category in the public facing portal.", + "PORTAL": "Portal", + "LOCALE": "Locale", + "NAME": { + "LABEL": "Name", + "PLACEHOLDER": "Category name", + "HELP_TEXT": "The category name will be used in the public facing portal to categorize articles.", + "ERROR": "Name is required" + }, + "SLUG": { + "LABEL": "Slug", + "PLACEHOLDER": "Category slug for urls", + "HELP_TEXT": "app.chatwoot.com/portal/my-portal/en-US/categories/my-slug", + "ERROR": "Slug is required" + }, + "DESCRIPTION": { + "LABEL": "Description", + "PLACEHOLDER": "Give a short description about the category.", + "ERROR": "Description is required" + }, + "BUTTONS": { + "CREATE": "Update category", + "CANCEL": "Cancel" + }, + "API": { + "SUCCESS_MESSAGE": "Category updated successfully", + "ERROR_MESSAGE": "Unable to update category" + } + }, + "DELETE": { + "API": { + "SUCCESS_MESSAGE": "Category deleted successfully", + "ERROR_MESSAGE": "Unable to delete category" + } } } } diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue index 4f9b30d97..4d60d108b 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue @@ -37,6 +37,7 @@ /> + + + + + + + + + + + + + + + + + + + + +
+ {{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.NAME') }} + + {{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.DESCRIPTION') }} + + {{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.LOCALE') }} + + {{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ARTICLE_COUNT') }} + +
+
+ {{ category.name }} + + {{ category.description }} + + {{ category.locale }} + + {{ category.meta.articles_count }} + + + +
+ + + + + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue index ecd03c1b6..ea3bb4aff 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue @@ -1,3 +1,198 @@