diff --git a/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertCondition.vue b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertCondition.vue new file mode 100644 index 000000000..d24433022 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertCondition.vue @@ -0,0 +1,87 @@ + + + + {{ label }} + + + + + + {{ + $t( + 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.CONDITIONS.CONDITION_ONE' + ) + }} + + + + + + {{ + $t( + 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.CONDITIONS.CONDITION_TWO' + ) + }} + + + + + + diff --git a/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertEvent.vue b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertEvent.vue new file mode 100644 index 000000000..083b90d93 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertEvent.vue @@ -0,0 +1,105 @@ + + + + {{ label }} + + + + + + {{ + $t( + 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.NONE' + ) + }} + + + + + + {{ + $t( + 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.ASSIGNED' + ) + }} + + + + + + {{ + $t( + 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.ALL_CONVERSATIONS' + ) + }} + + + + + + diff --git a/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertTone.vue b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertTone.vue new file mode 100644 index 000000000..508e25088 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioAlertTone.vue @@ -0,0 +1,52 @@ + + + + {{ tone.label }} + + + + diff --git a/app/javascript/dashboard/routes/dashboard/settings/personal/AudioNotifications.vue b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioNotifications.vue index cafa955f4..034e590c7 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/personal/AudioNotifications.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/personal/AudioNotifications.vue @@ -1,154 +1,31 @@ - - - {{ tone.label }} - - + @change="handleAudioToneChange" + /> - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.TITLE' - ) - }} - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.NONE' - ) - }} - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.ASSIGNED' - ) - }} - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.ALERT_TYPE.ALL_CONVERSATIONS' - ) - }} - - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.CONDITIONS.TITLE' - ) - }} - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.CONDITIONS.CONDITION_ONE' - ) - }} - - - - - - {{ - $t( - 'PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.CONDITIONS.CONDITION_TWO' - ) - }} - - - - + + + @@ -157,29 +34,23 @@ import { mapGetters } from 'vuex'; import alertMixin from 'shared/mixins/alertMixin'; import configMixin from 'shared/mixins/configMixin'; import uiSettingsMixin from 'dashboard/mixins/uiSettings'; -import FormSelect from 'v3/components/Form/Select.vue'; +import AudioAlertTone from './AudioAlertTone.vue'; +import AudioAlertEvent from './AudioAlertEvent.vue'; +import AudioAlertCondition from './AudioAlertCondition.vue'; export default { components: { - FormSelect, + AudioAlertEvent, + AudioAlertTone, + AudioAlertCondition, }, mixins: [alertMixin, configMixin, uiSettingsMixin], data() { return { - enableAudioAlerts: false, + audioAlert: '', playAudioWhenTabIsInactive: false, alertIfUnreadConversationExist: false, alertTone: 'ding', - alertTones: [ - { - value: 'ding', - label: 'Ding', - }, - { - value: 'bell', - label: 'Bell', - }, - ], }; }, computed: { @@ -200,21 +71,21 @@ export default { methods: { notificationUISettings(uiSettings) { const { - enable_audio_alerts: enableAudio = false, + enable_audio_alerts: audioAlert = '', always_play_audio_alert: alwaysPlayAudioAlert, alert_if_unread_assigned_conversation_exist: alertIfUnreadConversationExist, notification_tone: alertTone, } = uiSettings; - this.enableAudioAlerts = enableAudio; + this.audioAlert = audioAlert; this.playAudioWhenTabIsInactive = !alwaysPlayAudioAlert; this.alertIfUnreadConversationExist = alertIfUnreadConversationExist; this.alertTone = alertTone || 'ding'; }, handleAudioInput(e) { - this.enableAudioAlerts = e.target.value; + this.audioAlert = e.target.value; this.updateUISettings({ - enable_audio_alerts: this.enableAudioAlerts, + enable_audio_alerts: this.audioAlert, }); this.showAlert(this.$t('PROFILE_SETTINGS.FORM.API.UPDATE_SUCCESS')); }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/personal/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/personal/Index.vue index 4a979e50e..ca0792b3e 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/personal/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/personal/Index.vue @@ -102,11 +102,6 @@