TT#47509 Create new SoundSet

Change-Id: Iad49631cbed6b231847af6cefa22ea2a2d4c29a0
changes/42/28242/9
Robert Axelsen 6 years ago
parent 81dcafe8e4
commit fa7f91faab

@ -268,7 +268,7 @@ export function deleteDestinationFromDestinationset(options) {
deleteDestinationsetById(options.id).then((res) => {
resolve(res);
}).catch((err) => {
console.log(err);
reject(err);
});
}
else {

@ -743,6 +743,15 @@ export function editSoundSetFields(id, fields) {
});
});
}
export function createSoundSet(soundSet) {
return new Promise((resolve, reject)=>{
Vue.http.post('api/soundsets/', soundSet).then(() => {
resolve();
}).catch((err)=>{
reject(err);
});
});
}
export function setSoundSetName(id, value) {
return editSoundSetFields(id, { name: value });

@ -4,7 +4,6 @@
:count="maxLength"
:helper="helperMessage"
:error-label="errorMessage"
:disabled="!enabled"
>
<q-input
ref="inputField"

@ -26,7 +26,7 @@
color="primary"
icon="done"
@click="save()"
:disabled="saveDisabled"
:disable="saveDisabled"
>
{{ $t('buttons.save') }}
</q-btn>
@ -81,12 +81,12 @@
}
},
props: [
'disabled',
'disable',
'loading'
],
computed: {
saveDisabled() {
return this.numberError|| this.disabled || this.loading;
return this.numberError|| this.disable || this.loading;
}
},
methods: {

@ -17,7 +17,7 @@
>
<q-item-side v-if="!isMobile">
<q-field
:disabled="loading"
:disable="loading"
>
<q-toggle
:value="ownPhone"

@ -4,11 +4,11 @@
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
v-model="data.subscriber_id"
chips
clearable
v-model="data.subscriber_id"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.queueExtensionName')"
:options="options"
/>
@ -16,36 +16,36 @@
<q-field :error-label="maxQueueLengthErrorMessage">
<q-input
dark
@input="$v.data.max_queue_length.$touch"
@blur="$v.data.max_queue_length.$touch"
clearable
autofocus
v-model="data.max_queue_length"
:error="$v.data.max_queue_length.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.max_queue_length"
autofocus
:float-label="$t('pbxConfig.queueLength')"
clearable
:suffix="$t('pbxConfig.callers')"
@input="$v.data.max_queue_length.$touch"
@blur="$v.data.max_queue_length.$touch"
/>
</q-field>
<q-field :error-label="wrapUpTimeErrorMessage">
<q-input
dark
@input="$v.data.queue_wrap_up_time.$touch"
@blur="$v.data.queue_wrap_up_time.$touch"
clearable
v-model="data.queue_wrap_up_time"
:error="$v.data.queue_wrap_up_time.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.queue_wrap_up_time"
:float-label="$t('pbxConfig.wrapUpTime')"
clearable
:suffix="$t('pbxConfig.seconds')"
@input="$v.data.queue_wrap_up_time.$touch"
@blur="$v.data.queue_wrap_up_time.$touch"
/>
</q-field>
<div class="csc-form-actions row justify-center">
<q-btn
v-if="!loading"
flat
v-if="!loading"
color="default"
icon="clear"
@mousedown.native="cancel()"
@ -53,9 +53,9 @@
{{ $t('buttons.cancel') }}
</q-btn>
<q-btn
v-if="!loading"
:disabled="$v.data.$invalid"
flat
v-if="!loading"
:disable="$v.data.$invalid"
color="primary"
icon="person"
@click="save()"

@ -78,7 +78,9 @@
import CscPbxCallQueue from './CscPbxCallQueue'
import CscPbxCallQueueAddForm from './CscPbxCallQueueAddForm'
import CscRemoveDialog from '../../CscRemoveDialog'
import { mapGetters } from 'vuex'
import {
mapGetters
} from 'vuex'
import {
QField,
QInput,
@ -94,7 +96,12 @@
QSpinnerDots,
QBtn
} from 'quasar-framework'
import { scroll } from 'quasar-framework'
import {
showToast
} from '../../../helpers/ui'
import {
scroll
} from 'quasar-framework'
const { getScrollTarget, setScrollPosition } = scroll
export default {
components: {
@ -136,7 +143,8 @@
'isUpdating',
'updateItemId',
'removeState',
'isRemoving'
'isRemoving',
'lastAddedCallQueue'
]),
isMobile() {
return Platform.is.mobile;
@ -208,6 +216,8 @@
addState(state) {
if (state === 'succeeded') {
this.disableAddForm();
showToast(this.$t('pbxConfig.toasts.addedCallQueueToast',
{ name: this.lastAddedCallQueue }));
}
},
callQueueGroupsAndSeats(state) {

@ -7,7 +7,7 @@
@blur="$v.data.station_name.$touch"
:error="$v.data.station_name.$error"
v-model="data.station_name"
:disabled="loading"
:disable="loading"
:readonly="loading"
autofocus
:float-label="$t('pbxConfig.deviceStationName')"
@ -21,7 +21,7 @@
@blur="$v.data.identifier.$touch"
:error="$v.data.identifier.$error"
v-model="data.identifier"
:disabled="loading"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.deviceIdentifier')"
clearable
@ -55,7 +55,7 @@
color="primary"
icon="done"
@click="save()"
:disabled="$v.data.$invalid || !data.profile_id"
:disable="$v.data.$invalid || !data.profile_id"
>
{{ $t('buttons.save') }}
</q-btn>

@ -111,7 +111,7 @@
icon="fa-filter"
color="negative"
@click="resetFilter()"
:disabled="!hasFilters"
:disable="!hasFilters"
>{{ $t('pbxConfig.resetFilters') }}</q-btn>
</div>
</div>

@ -3,65 +3,65 @@
<q-field :error-label="groupNameErrorMessage">
<q-input
dark
@input="$v.data.name.$touch"
@blur="$v.data.name.$touch"
clearable
autofocus
v-model="data.name"
:error="$v.data.name.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.name"
autofocus
:float-label="$t('pbxConfig.groupName')"
clearable
@input="$v.data.name.$touch"
@blur="$v.data.name.$touch"
/>
</q-field>
<q-field :error-label="extensionErrorMessage">
<q-input
dark
@input="$v.data.extension.$touch"
@blur="$v.data.extension.$touch"
clearable
v-model="data.extension"
:error="$v.data.extension.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.extension"
:float-label="$t('pbxConfig.extension')"
clearable
@input="$v.data.extension.$touch"
@blur="$v.data.extension.$touch"
/>
</q-field>
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
radio
v-model="data.huntPolicy"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.huntPolicy')"
:options="huntPolicyOptions"
radio
/>
</q-field>
<q-field :error-label="huntTimeoutErrorMessage">
<q-input
dark
@input="$v.data.huntTimeout.$touch"
clearable
v-model="data.huntTimeout"
:error="$v.data.huntTimeout.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.huntTimeout"
clearable
:float-label="$t('pbxConfig.huntTimeout')"
:suffix="$t('pbxConfig.seconds')"
:min="1"
:max="3600"
@input="$v.data.huntTimeout.$touch"
/>
</q-field>
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
v-model="data.aliasNumbers"
multiple
chips
clearable
v-model="data.aliasNumbers"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.aliasNumbers')"
:options="aliasNumberOptions"
/>
@ -69,20 +69,20 @@
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
v-model="data.seats"
multiple
chips
clearable
v-model="data.seats"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.seats')"
:options="seatOptions"
/>
</q-field>
<div class="csc-form-actions row justify-center">
<q-btn
v-if="!loading"
flat
v-if="!loading"
color="default"
icon="clear"
@mousedown.native="cancel()"
@ -90,11 +90,11 @@
{{ $t('buttons.cancel') }}
</q-btn>
<q-btn
v-if="!loading"
:disabled="$v.data.$invalid"
flat
v-if="!loading"
color="primary"
icon="group"
:disable="$v.data.$invalid"
@click="save()"
>
{{ $t('pbxConfig.createGroup') }}
@ -115,11 +115,6 @@
numeric
} from 'vuelidate/lib/validators'
import {
QCard,
QCardTitle,
QCardMain,
QCardActions,
QCardSeparator,
QBtn,
QInnerLoading,
QSpinnerMat,
@ -138,11 +133,6 @@
'loading',
],
components: {
QCard,
QCardTitle,
QCardMain,
QCardActions,
QCardSeparator,
QBtn,
QInnerLoading,
QSpinnerMat,

@ -62,8 +62,8 @@
:alias-number-options="aliasNumberOptions"
:seat-options="seatOptions"
:hunt-policy-options="huntPolicyOptions"
@remove="removeGroupDialog"
:loading="isItemLoading(group.id)"
@remove="removeGroupDialog"
@save-name="setGroupName"
@save-extension="setGroupExtension"
@save-hunt-policy="setGroupHuntPolicy"
@ -185,7 +185,7 @@
},
seatOptions() {
let seats = [];
this.seats.forEach((seat)=>{
this.seats.forEach((seat) => {
seats.push({
label: seat.display_name ? seat.display_name : seat.username,
sublabel: this.$t('pbxConfig.extension') + ': ' + seat.pbx_extension,

@ -3,39 +3,39 @@
<q-field :error-label="seatNameErrorMessage">
<q-input
dark
@input="$v.data.name.$touch"
@blur="$v.data.name.$touch"
clearable
autofocus
v-model="data.name"
:error="$v.data.name.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.name"
autofocus
:float-label="$t('pbxConfig.name')"
clearable
@input="$v.data.name.$touch"
@blur="$v.data.name.$touch"
/>
</q-field>
<q-field :error-label="extensionErrorMessage">
<q-input
dark
@input="$v.data.extension.$touch"
@blur="$v.data.extension.$touch"
clearable
v-model="data.extension"
:error="$v.data.extension.$error"
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="data.extension"
:float-label="$t('pbxConfig.extension')"
clearable
@input="$v.data.extension.$touch"
@blur="$v.data.extension.$touch"
/>
</q-field>
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
v-model="data.aliasNumbers"
multiple
chips
clearable
v-model="data.aliasNumbers"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.aliasNumbers')"
:options="aliasNumberOptions"
/>
@ -43,20 +43,20 @@
<q-field>
<q-select
dark
:disabled="loading"
:readonly="loading"
v-model="data.groups"
multiple
chips
clearable
v-model="data.groups"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.groups')"
:options="groupOptions"
/>
</q-field>
<div class="csc-form-actions row justify-center">
<q-btn
v-if="!loading"
flat
v-if="!loading"
color="default"
icon="clear"
@mousedown.native="cancel()"
@ -64,11 +64,11 @@
{{ $t('buttons.cancel') }}
</q-btn>
<q-btn
v-if="!loading"
:disabled="$v.data.$invalid"
flat
v-if="!loading"
color="primary"
icon="person"
:disable="$v.data.$invalid"
@click="save()"
>
{{ $t('pbxConfig.createSeat') }}
@ -87,11 +87,6 @@
numeric
} from 'vuelidate/lib/validators'
import {
QCard,
QCardTitle,
QCardMain,
QCardActions,
QCardSeparator,
QBtn,
QInnerLoading,
QSpinnerMat,
@ -109,11 +104,6 @@
'loading'
],
components: {
QCard,
QCardTitle,
QCardMain,
QCardActions,
QCardSeparator,
QBtn,
QInnerLoading,
QSpinnerMat,

@ -20,8 +20,8 @@
v-show="addFormEnabled"
>
<csc-pbx-seat-add-form
class="col-xs-12 col-md-6 csc-list-form"
ref="addForm"
class="col-xs-12 col-md-6 csc-list-form"
:alias-number-options="aliasNumberOptions"
:group-options="groupOptions"
:loading="isAdding"
@ -92,8 +92,12 @@
import CscRemoveDialog from '../../CscRemoveDialog'
import aliasNumberOptions from '../../../mixins/alias-number-options'
import itemError from '../../../mixins/item-error'
import { mapGetters } from 'vuex'
import { showToast } from '../../../helpers/ui'
import {
mapGetters
} from 'vuex'
import {
showToast
} from '../../../helpers/ui'
import {
QChip,
QCard,

@ -18,7 +18,6 @@
</template>
<script>
import _ from 'lodash'
import CscPbxSoundItem from './CscPbxSoundItem'
import {
QList,
@ -34,7 +33,8 @@
export default {
name: 'csc-pbx-sound-group',
props: {
group: Object
group: Object,
groupLabel: String
},
components: {
CscPbxSoundItem,
@ -55,11 +55,6 @@
mounted() {
},
computed: {
groupLabel() {
let regex = /[-_]/g;
let name = _.capitalize(this.group.name.replace(regex, ' '));
return name;
}
},
methods: {
},

@ -91,6 +91,7 @@
<csc-pbx-sound-group
v-for="(group, index) in set.groups"
:group="group"
:group-label="groupLabel(group.name)"
:key="index"
/>
</q-item-tile>
@ -144,7 +145,12 @@
import {
maxLength
} from 'vuelidate/lib/validators'
import { showGlobalError } from '../../../helpers/ui'
import {
mapGetters
} from 'vuex'
import {
showGlobalError
} from '../../../helpers/ui'
export default {
name: 'csc-pbx-sound-set',
props: {
@ -183,6 +189,9 @@
},
},
computed: {
...mapGetters('pbxConfig', [
'groupLabel'
]),
itemClasses() {
let classes = ['csc-list-item'];
if (this.expanded) {

@ -0,0 +1,277 @@
<template>
<div class="csc-form csc-pbx-seat-add-form">
<q-field
:error-label="nameErrorMessage"
class="csc-form-field"
>
<q-input
dark
autofocus
v-model="data.name"
:error="$v.data.name.$error"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.name')"
@input="$v.data.name.$touch"
@blur="$v.data.name.$touch"
clearable
/>
</q-field>
<q-field
:error-label="descriptionErrorMessage"
class="csc-form-field"
>
<q-input
dark
clearable
v-model="data.description"
:error="$v.data.description.$error"
:disable="loading"
:readonly="loading"
:float-label="$t('pbxConfig.description')"
@input="$v.data.description.$touch"
@blur="$v.data.description.$touch"
/>
</q-field>
<q-field
class="csc-form-field"
>
<q-toggle
v-model="data.contract_default"
checked-icon="check_circle"
unchecked-icon="check_circle"
:class="contractDefaultClasses"
:disable="loading"
:label="$t('pbxConfig.defaultForSubscribers')"
/>
</q-field>
<q-field
class="csc-form-field"
>
<q-toggle
v-model="data.copy_from_default"
checked-icon="move_to_inbox"
unchecked-icon="move_to_inbox"
:class="loadFilesClasses"
:disable="loading"
:label="$t('pbxConfig.loadFiles')"
@input="toggleLoadFiles"
/>
</q-field>
<q-field
class="csc-form-field"
>
<q-toggle
v-model="data.loopplay"
checked-icon="loop"
unchecked-icon="loop"
:class="loopplayClasses"
:disable="loading || !data.copy_from_default"
:label="$t('pbxConfig.playingInLoop')"
/>
</q-field>
<q-field
class="csc-form-field"
>
<q-select
dark
chips
clearable
v-model="data.language"
:disable="loading || !data.copy_from_default"
:readonly="loading"
:float-label="$t('pbxConfig.language')"
:options="languageOptions"
/>
</q-field>
<div class="csc-form-actions row justify-center">
<q-btn
flat
v-if="!loading"
color="default"
icon="clear"
@mousedown.native="cancel()"
>
{{ $t('buttons.cancel') }}
</q-btn>
<q-btn
flat
v-if="!loading"
color="primary"
icon="group"
:disable="$v.data.$invalid || !data.language"
@click="save()"
>
{{ $t('pbxConfig.createSoundSet') }}
</q-btn>
</div>
<q-inner-loading :visible="loading">
<q-spinner-mat size="60px" color="primary" />
</q-inner-loading>
</div>
</template>
<script>
import {
required,
maxLength
} from 'vuelidate/lib/validators'
import {
QBtn,
QInnerLoading,
QSpinnerMat,
QField,
QInput,
QSelect,
QIcon,
QToggle
} from 'quasar-framework'
export default {
name: 'csc-pbx-sound-set-add-form',
props: [
'loading'
],
components: {
QBtn,
QInnerLoading,
QSpinnerMat,
QField,
QInput,
QSelect,
QIcon,
QToggle
},
validations: {
data: {
name: {
required,
maxLength: maxLength(64)
},
description: {
required,
maxLength: maxLength(255)
}
}
},
data () {
return {
data: this.getDefaults(),
languageOptions: [
{
value: 'en',
label: 'English'
},
{
value: 'es',
label: 'Spanish'
},
{
value: 'ru',
label: 'Russian'
},
{
value: 'it',
label: 'Italian'
},
{
value: 'ro',
label: 'Romanian'
},
{
value: 'de',
label: 'German'
}
]
}
},
computed: {
nameErrorMessage() {
if (!this.$v.data.name.required) {
return this.$t('validationErrors.fieldRequired', {
field: this.$t('pbxConfig.name')
});
}
else if (!this.$v.data.name.maxLength) {
return this.$t('validationErrors.maxLength', {
field: this.$t('pbxConfig.name'),
maxLength: this.$v.data.name.$params.maxLength.max
});
}
},
descriptionErrorMessage() {
if (!this.$v.data.description.required) {
return this.$t('validationErrors.fieldRequired', {
field: this.$t('pbxConfig.description')
});
}
else if (!this.$v.data.description.maxLength) {
return this.$t('validationErrors.maxLength', {
field: this.$t('pbxConfig.description'),
maxLength: this.$v.data.description.$params.maxLength.max
});
}
},
contractDefaultClasses() {
let classes = [];
if (this.contract_default) {
classes.push('csc-toggle-enabled');
}
else {
classes.push('csc-toggle-disabled');
}
return classes;
},
loadFilesClasses() {
let classes = [];
if (this.copy_from_default) {
classes.push('csc-toggle-enabled');
}
else {
classes.push('csc-toggle-disabled');
}
return classes;
},
loopplayClasses() {
let classes = [];
if (this.loopplay) {
classes.push('csc-toggle-enabled');
}
else {
classes.push('csc-toggle-disabled');
}
return classes;
}
},
methods: {
getDefaults() {
return {
name: '',
loopplay: false,
replace_existing: false,
language: 'en',
contract_default: false,
copy_from_default: false,
description: ''
}
},
cancel() {
this.$emit('cancel');
},
save() {
this.$emit('save', this.data);
},
reset() {
this.data = this.getDefaults();
this.$v.$reset();
},
toggleLoadFiles() {
this.data.language = 'en';
this.data.loopplay = false;
}
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import '../../../themes/quasar.variables.styl';
</style>

@ -11,6 +11,31 @@
:size="40"
/>
</div>
<div
v-show="addFormEnabled"
class="row justify-center"
>
<csc-pbx-sound-set-add-form
ref="addForm"
class="col-xs-12 col-md-6 csc-list-form"
:loading="isAdding"
@save="addSoundSet"
@cancel="disableAddForm"
/>
</div>
<div
v-show="!addFormEnabled"
class="row justify-center"
>
<q-btn
flat
color="primary"
icon="add"
@click="enableAddForm"
>
{{ $t('pbxConfig.addSoundSet') }}
</q-btn>
</div>
<q-list
striped-odd
no-border
@ -48,6 +73,7 @@
import CscPage from '../../CscPage'
import CscPbxSoundSet from './CscPbxSoundSet'
import CscRemoveDialog from '../../CscRemoveDialog'
import CscPbxSoundSetAddForm from './CscPbxSoundSetAddForm'
import {
mapGetters
} from 'vuex'
@ -66,6 +92,7 @@
CscPage,
CscPbxSoundSet,
CscRemoveDialog,
CscPbxSoundSetAddForm,
QList,
QBtn,
QInnerLoading,
@ -73,7 +100,8 @@
},
data () {
return {
currentRemovingSoundSet: null
currentRemovingSoundSet: null,
addFormEnabled: false,
}
},
mounted() {
@ -88,7 +116,10 @@
'updateItemId',
'updateState',
'lastUpdatedField',
'isListLoadingVisible'
'isListLoadingVisible',
'isAdding',
'addState',
'lastAddedSoundSet'
]),
isMobile() {
return !!Platform.is.mobile;
@ -121,9 +152,29 @@
isItemLoading(setId) {
return (this.isUpdating && this.updateItemId + "" === setId + "") ||
this.soundSetFilesLoading(setId) || this.isSoundSetsRequesting;
},
resetAddForm() {
this.$refs.addForm.reset();
},
enableAddForm() {
this.resetAddForm();
this.addFormEnabled = true;
},
disableAddForm() {
this.resetAddForm();
this.addFormEnabled = false;
},
addSoundSet(soundSet) {
this.$store.dispatch('pbxConfig/createSoundSet', soundSet);
}
},
watch: {
addState(state) {
if (state === 'succeeded') {
this.disableAddForm();
showToast(this.$t('pbxConfig.toasts.addedSoundSetToast', { name: this.lastAddedSoundSet }));
}
},
updateState(state) {
if (state === 'succeeded') {
showToast(this.$t('pbxConfig.toasts.changedFieldToast', this.lastUpdatedField));

@ -4,7 +4,7 @@
<q-field>
<q-select
dark
:disabled="loading"
:disable="loading"
:readonly="loading"
v-model="slot"
:float-label="$t('speedDial.slot')"

@ -23,7 +23,7 @@
<csc-sound-file-upload
ref="uploadBusy"
icon="music_note"
file-types=".wav,.mp3"
file-types=".wav,.mp3,.ogg"
:float-label="$t('voicebox.label.busyGreeting')"
:value="busyGreetingLabel"
:progress="uploadBusyProgress"
@ -39,7 +39,7 @@
<csc-sound-file-upload
ref="uploadUnavail"
icon="music_note"
file-types=".wav,.mp3"
file-types=".wav,.mp3,.ogg"
:float-label="$t('voicebox.label.unavailGreeting')"
:value="unavailGreetingLabel"
:progress="uploadUnavailProgress"

@ -400,7 +400,9 @@
"updatedStationName": "Updated station name to {name}",
"updatedProfile": "Updated model of device {name}",
"updatedIdentifier": "Updated identifier to {identifier}",
"createdDevice": "Created device {name} successfully"
"createdDevice": "Created device {name} successfully",
"addedCallQueueToast": "Added call queue configuration for {name}",
"addedSoundSetToast": "Added sound set {name}"
},
"addDevice": "Add device",
"addDeviceShort": "Add",
@ -444,7 +446,11 @@
"playingInLoop": "Playing in loop",
"playInLoop": "Play sound in loop",
"dontPlayInLoop": "Don't play sound in loop",
"defaultForSubscribers": "Default For Subscribers"
"defaultForSubscribers": "Default For Subscribers",
"loadFiles": "Load Files",
"createSoundSet": "Create sound set",
"addSoundSet": "Add Sound Set",
"language": "Language"
},
"callBlocking": {
"privacyEnabledToast": "Your number is hidden to the callee",

@ -45,7 +45,8 @@ import {
setSoundSetDescription,
setSoundSetContractDefault,
getSoundSetWithFiles,
playSoundFile
playSoundFile,
createSoundSet
} from '../../api/pbx-config'
export default {
@ -467,7 +468,7 @@ export default {
if (!_.isNull(config.queue_wrap_up_time) && config.queue_wrap_up_time.length === 0) {
config.queue_wrap_up_time = null;
}
context.commit('addItemRequesting', config);
context.commit('addItemRequesting', data);
addCallQueueConfig(data.id, config).then(() => {
return context.dispatch('listCallQueueGroupsAndSeats', true);
}).then(() => {
@ -612,7 +613,7 @@ export default {
},
saveSoundSetDescription(context, set) {
context.commit('updateItemRequesting', set);
context.commit('lastUpdatedField', {name: set.name, type: 'sound set name'});
context.commit('lastUpdatedField', {name: set.description, type: 'sound set description'});
setSoundSetDescription(set.id, set.description).then(() => {
return context.dispatch('reloadSoundSet', set);
}).then(() => {
@ -660,5 +661,15 @@ export default {
}).catch((err) => {
context.commit('playSoundFileFailed', err.message);
});
},
createSoundSet(context, soundSet) {
context.commit('addItemRequesting', soundSet);
createSoundSet(soundSet).then(() => {
return context.dispatch('listSoundSets');
}).then(() => {
context.commit('addItemSucceeded');
}).catch((err) => {
context.commit('addItemFailed', err.message);
});
}
}

@ -350,5 +350,24 @@ export default {
return (id) => {
return state.lastPlayed + '' === id + '';
}
},
lastAddedCallQueue(state, getters) {
let lastAddedItem = '';
if (state.addItem) {
let added = _.find(getters.callQueueGroupsAndSeatsOptions, (option) => {
return option.value == state.addItem.id
});
lastAddedItem = added ? added.label : '';
}
return lastAddedItem;
},
lastAddedSoundSet(state) {
return state.addItem ? state.addItem.name : '';
},
groupLabel() {
return (name) => {
let regex = /[-_]/g;
return _.capitalize(name.replace(regex, ' '));
}
}
}

@ -539,5 +539,20 @@ export default {
playSoundFileFailed(state, err) {
state.playSoundFileState = RequestState.failed;
state.playSoundFileError = err;
},
createSoundSetRequesting(state, soundSet) {
state.createSoundSetState = RequestState.requesting;
state.createSoundSetItem = soundSet;
state.createSoundSetError = null;
},
createSoundSetSucceeded(state) {
state.createSoundSetState = RequestState.succeeded;
},
createSoundSetFailed(state, error) {
state.createSoundSetState = RequestState.failed;
state.createSoundSetError = error;
},
lastAddedCallQueue(state, callQueue) {
state.lastAddedCallQueue = callQueue.name;
}
}

@ -91,5 +91,9 @@ export default {
playSoundFileState: RequestState.initiated,
playSoundFileError: null,
soundFileUrls: {},
lastPlayed: null
lastPlayed: null,
createSoundSetState: RequestState.initiated,
createSoundSetItem: null,
createSoundSetError: null,
lastAddedCallQueue: null
}

Loading…
Cancel
Save