diff --git a/app/javascript/dashboard/api/captain/notificationTemplates.js b/app/javascript/dashboard/api/captain/notificationTemplates.js index 2a5fbac48..b98bd0173 100644 --- a/app/javascript/dashboard/api/captain/notificationTemplates.js +++ b/app/javascript/dashboard/api/captain/notificationTemplates.js @@ -1,30 +1,29 @@ -/* global axios */ import ApiClient from '../ApiClient'; -class CaptainNotificationTemplatesAPI extends ApiClient { +class NotificationTemplatesAPI extends ApiClient { constructor() { - super('captain/units', { accountScoped: true }); + super('inboxes', { accountScoped: true }); } - getTemplates(unitId) { - return axios.get(`${this.url}/${unitId}/notification_templates`); + getAll(inboxId) { + return this.get(`${inboxId}/notification_templates`); } - createTemplate(unitId, data) { - return axios.post(`${this.url}/${unitId}/notification_templates`, { + create(inboxId, data) { + return this.post(`${inboxId}/notification_templates`, { notification_template: data, }); } - updateTemplate(unitId, id, data) { - return axios.patch(`${this.url}/${unitId}/notification_templates/${id}`, { + update(inboxId, id, data) { + return this.patch(`${inboxId}/notification_templates/${id}`, { notification_template: data, }); } - deleteTemplate(unitId, id) { - return axios.delete(`${this.url}/${unitId}/notification_templates/${id}`); + delete(inboxId, id) { + return this.delete(`${inboxId}/notification_templates/${id}`); } } -export default new CaptainNotificationTemplatesAPI(); +export default new NotificationTemplatesAPI(); diff --git a/app/javascript/dashboard/i18n/locale/en/captain.json b/app/javascript/dashboard/i18n/locale/en/captain.json index c70a4c2d8..85fce456a 100644 --- a/app/javascript/dashboard/i18n/locale/en/captain.json +++ b/app/javascript/dashboard/i18n/locale/en/captain.json @@ -476,6 +476,13 @@ "DELETE": { "SUCCESS": "Notification removed.", "ERROR": "Error removing notification." + }, + "INBOX_LABEL": "Select inbox", + "NO_CAPTAIN_INBOXES": "No inboxes with Captain configured.", + "SELECT_INBOX_HINT": "Click an inbox above to view and configure its templates.", + "EMPTY": { + "TITLE": "No templates configured", + "DESC": "Create automatic message templates for this inbox." } } } diff --git a/app/javascript/dashboard/i18n/locale/pt_BR/captain.json b/app/javascript/dashboard/i18n/locale/pt_BR/captain.json index 4d0f2c60b..d3b3806dd 100644 --- a/app/javascript/dashboard/i18n/locale/pt_BR/captain.json +++ b/app/javascript/dashboard/i18n/locale/pt_BR/captain.json @@ -477,6 +477,13 @@ "DELETE": { "SUCCESS": "Notificação removida.", "ERROR": "Erro ao remover notificação." + }, + "INBOX_LABEL": "Selecione a caixa de entrada", + "NO_CAPTAIN_INBOXES": "Nenhuma caixa de entrada com Captain configurado.", + "SELECT_INBOX_HINT": "Clique em uma caixa de entrada acima para ver e configurar os templates.", + "EMPTY": { + "TITLE": "Nenhum template configurado", + "DESC": "Crie templates de mensagem automática para esta caixa de entrada." } } } diff --git a/app/javascript/dashboard/routes/dashboard/settings/captain/captain.routes.js b/app/javascript/dashboard/routes/dashboard/settings/captain/captain.routes.js index 5a89b37bd..91f75deb3 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/captain/captain.routes.js +++ b/app/javascript/dashboard/routes/dashboard/settings/captain/captain.routes.js @@ -79,7 +79,7 @@ export default { }, }, { - path: 'units/:unitId/notifications', + path: 'notifications', name: 'captain_settings_notifications', component: NotificationsIndex, meta: { diff --git a/app/javascript/dashboard/routes/dashboard/settings/captain/notifications/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/captain/notifications/Index.vue index 7bf2184a9..10123e2f8 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/captain/notifications/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/captain/notifications/Index.vue @@ -1,6 +1,5 @@