TT#39942 PBXConfig: Saving a field after editing several fields result in only the last one saved

Change-Id: I98b5fd89390bff24814daf5934ba33accb188163
changes/23/37623/5
Carlo Venusino 6 years ago
parent 7e815644cd
commit 7ae7e49233

@ -52,12 +52,12 @@
v-model="changes.max_queue_length" v-model="changes.max_queue_length"
:error="$v.changes.max_queue_length.$error" :error="$v.changes.max_queue_length.$error"
@input="$v.changes.max_queue_length.$touch" @input="$v.changes.max_queue_length.$touch"
@keyup.enter="saveMaxQueueLength" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasMaxQueueLengthChanged && !$v.changes.max_queue_length.$error" v-if="hasMaxQueueLengthChanged && !$v.changes.max_queue_length.$error"
@click="saveMaxQueueLength" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -78,12 +78,12 @@
:suffix="$t('pbxConfig.seconds')" :suffix="$t('pbxConfig.seconds')"
:error="$v.changes.queue_wrap_up_time.$error" :error="$v.changes.queue_wrap_up_time.$error"
@input="$v.changes.queue_wrap_up_time.$touch" @input="$v.changes.queue_wrap_up_time.$touch"
@keyup.enter="saveQueueWrapUpTime" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasQueueWrapUpTimeChanged && !$v.changes.queue_wrap_up_time.$error" v-if="hasQueueWrapUpTimeChanged && !$v.changes.queue_wrap_up_time.$error"
@click="saveQueueWrapUpTime" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -252,33 +252,31 @@
this.$emit('expand'); this.$emit('expand');
} }
}, },
saveMaxQueueLength() { resetMaxQueueLength() {
this.changes.max_queue_length = this.getDefaultData().max_queue_length;
},
resetQueueWrapUpTime() {
this.changes.queue_wrap_up_time = this.getDefaultData().queue_wrap_up_time;
},
getDefaultData() {
return {
max_queue_length: this.callQueue.max_queue_length || this.defaultMaxQueueLength,
queue_wrap_up_time: this.callQueue.queue_wrap_up_time || this.defaultQueueWrapUpTime
}
},
save(){
if(this.hasMaxQueueLengthChanged && !this.$v.changes.max_queue_length.$error) { if(this.hasMaxQueueLengthChanged && !this.$v.changes.max_queue_length.$error) {
this.$emit('save-max-queue-length', { this.$emit('save-max-queue-length', {
callQueueId: this.callQueue.id, callQueueId: this.callQueue.id,
maxQueueLength: this.changes.max_queue_length maxQueueLength: this.changes.max_queue_length
}); });
} }
},
resetMaxQueueLength() {
this.changes.max_queue_length = this.getDefaultData().max_queue_length;
},
saveQueueWrapUpTime() {
if(this.hasQueueWrapUpTimeChanged && !this.$v.changes.queue_wrap_up_time.$error) { if(this.hasQueueWrapUpTimeChanged && !this.$v.changes.queue_wrap_up_time.$error) {
this.$emit('save-queue-wrap-up-time', { this.$emit('save-queue-wrap-up-time', {
callQueueId: this.callQueue.id, callQueueId: this.callQueue.id,
queueWrapUpTime: this.changes.queue_wrap_up_time queueWrapUpTime: this.changes.queue_wrap_up_time
}); });
} }
},
resetQueueWrapUpTime() {
this.changes.queue_wrap_up_time = this.getDefaultData().queue_wrap_up_time;
},
getDefaultData() {
return {
max_queue_length: this.callQueue.max_queue_length || this.defaultMaxQueueLength,
queue_wrap_up_time: this.callQueue.queue_wrap_up_time || this.defaultQueueWrapUpTime
}
} }
}, },
watch: { watch: {

@ -47,12 +47,12 @@
<q-input <q-input
dark dark
v-model="changes.stationName" v-model="changes.stationName"
@keyup.enter="saveStationName" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasStationNameChanged" v-if="hasStationNameChanged"
@click="saveStationName" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -68,12 +68,12 @@
<q-input <q-input
dark dark
v-model="changes.identifier" v-model="changes.identifier"
@keyup.enter="saveIdentifier" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasIdentifierChanged" v-if="hasIdentifierChanged"
@click="saveIdentifier" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -99,7 +99,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasProfileChanged" v-if="hasProfileChanged"
@click="saveProfile" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -214,39 +214,15 @@
this.$emit('expand'); this.$emit('expand');
} }
}, },
saveStationName() {
this.$emit('save-station-name', {
deviceId: this.device.id,
stationName: this.changes.stationName
});
},
resetStationName() { resetStationName() {
this.changes.stationName = this.device.station_name; this.changes.stationName = this.device.station_name;
}, },
saveIdentifier(){
this.$emit('save-identifier', {
deviceId: this.device.id,
identifier: this.changes.identifier
});
},
resetIdentifier() { resetIdentifier() {
this.changes.identifier = this.device.identifier; this.changes.identifier = this.device.identifier;
}, },
saveProfile() {
this.$emit('save-profile', {
deviceId: this.device.id,
profileId: this.changes.profile
});
},
resetProfile() { resetProfile() {
this.changes.profile = this.device.profile_id; this.changes.profile = this.device.profile_id;
}, },
saveKeys(keys) {
this.$emit('save-keys', {
deviceId: this.device.id,
keys: keys
});
},
selectedDeviceProfile(profileId) { selectedDeviceProfile(profileId) {
this.changes.profile = profileId; this.changes.profile = profileId;
}, },
@ -255,6 +231,32 @@
this.$refs.listItem.closePopoverMenu(); this.$refs.listItem.closePopoverMenu();
} }
this.$emit('remove'); this.$emit('remove');
},
saveKeys(keys) {
this.$emit('save-keys', {
deviceId: this.device.id,
keys: keys
});
},
save(){
if(this.hasStationNameChanged){
this.$emit('save-station-name', {
deviceId: this.device.id,
stationName: this.changes.stationName
});
}
if(this.hasIdentifierChanged){
this.$emit('save-identifier', {
deviceId: this.device.id,
identifier: this.changes.identifier
});
}
if(this.hasProfileChanged){
this.$emit('save-profile', {
deviceId: this.device.id,
profileId: this.changes.profile
});
}
} }
}, },
watch: { watch: {

@ -69,12 +69,12 @@
<q-input <q-input
dark dark
v-model="changes.name" v-model="changes.name"
@keyup.enter="saveName" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasNameChanged" v-if="hasNameChanged"
@click="saveName" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -91,12 +91,12 @@
<q-input <q-input
dark dark
v-model="changes.extension" v-model="changes.extension"
@keyup.enter="saveExtension" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasExtensionChanged" v-if="hasExtensionChanged"
@click="saveExtension" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -129,7 +129,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasHuntPolicyChanged" v-if="hasHuntPolicyChanged"
@click="saveHuntPolicy" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -146,12 +146,12 @@
<q-input <q-input
dark dark
v-model="changes.huntTimeout" v-model="changes.huntTimeout"
@keyup.enter="saveHuntTimeout" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasHuntTimeoutChanged" v-if="hasHuntTimeoutChanged"
@click="saveHuntTimeout" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -174,7 +174,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasAliasNumbersChanged" v-if="hasAliasNumbersChanged"
@click="saveAliasNumbers" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -197,7 +197,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasSeatsChanged" v-if="hasSeatsChanged"
@click="saveSeats" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -219,7 +219,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasSoundSetChanged" v-if="hasSoundSetChanged"
@click="saveSoundSet" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -380,51 +380,61 @@
this.$emit('expand'); this.$emit('expand');
} }
}, },
saveName() { resetName() {
this.changes.name = this.group.display_name;
},
resetExtension() {
this.changes.extension = this.group.pbx_extension;
},
resetHuntPolicy() {
this.changes.huntPolicy = this.group.pbx_hunt_policy;
},
resetHuntTimeout() {
this.changes.huntTimeout = this.group.pbx_hunt_timeout;
},
resetAliasNumbers() {
this.changes.aliasNumbers = this.getAliasNumberIds();
},
resetSeats() {
this.changes.seats = this.getSeatIds();
},
resetSoundSet() {
this.changes.soundSet = this.getSoundSetId();
},
deleteSeat() {
if(this.$refs.listItem) {
this.$refs.listItem.closePopoverMenu();
}
this.$emit('remove');
},
jumpToCallQueue() {
this.$emit('jump-to-call-queue', this.group);
},
save(){
if(this.hasNameChanged) { if(this.hasNameChanged) {
this.$emit('save-name', { this.$emit('save-name', {
groupId: this.group.id, groupId: this.group.id,
groupName: this.changes.name groupName: this.changes.name
}); });
} }
},
resetName() {
this.changes.name = this.group.display_name;
},
saveExtension() {
if(this.hasExtensionChanged) { if(this.hasExtensionChanged) {
this.$emit('save-extension', { this.$emit('save-extension', {
groupId: this.group.id, groupId: this.group.id,
groupExtension: this.changes.extension groupExtension: this.changes.extension
}); });
} }
},
resetExtension() {
this.changes.extension = this.group.pbx_extension;
},
saveHuntPolicy(){
if(this.hasHuntPolicyChanged) { if(this.hasHuntPolicyChanged) {
this.$emit('save-hunt-policy', { this.$emit('save-hunt-policy', {
groupId: this.group.id, groupId: this.group.id,
groupHuntPolicy: this.changes.huntPolicy groupHuntPolicy: this.changes.huntPolicy
}); });
} }
},
resetHuntPolicy() {
this.changes.huntPolicy = this.group.pbx_hunt_policy;
},
saveHuntTimeout(){
if(this.hasHuntTimeoutChanged) { if(this.hasHuntTimeoutChanged) {
this.$emit('save-hunt-timeout', { this.$emit('save-hunt-timeout', {
groupId: this.group.id, groupId: this.group.id,
groupHuntTimeout: this.changes.huntTimeout groupHuntTimeout: this.changes.huntTimeout
}); });
} }
},
resetHuntTimeout() {
this.changes.huntTimeout = this.group.pbx_hunt_timeout;
},
saveAliasNumbers() {
if(this.hasAliasNumbersChanged) { if(this.hasAliasNumbersChanged) {
this.$emit('save-alias-numbers', { this.$emit('save-alias-numbers', {
groupId: this.group.id, groupId: this.group.id,
@ -432,40 +442,18 @@
unassignedNumbers: _.difference(this.getAliasNumberIds(), this.changes.aliasNumbers) unassignedNumbers: _.difference(this.getAliasNumberIds(), this.changes.aliasNumbers)
}); });
} }
},
resetAliasNumbers() {
this.changes.aliasNumbers = this.getAliasNumberIds();
},
saveSeats() {
if(this.hasSeatsChanged) { if(this.hasSeatsChanged) {
this.$emit('save-seats', { this.$emit('save-seats', {
groupId: this.group.id, groupId: this.group.id,
seatIds: this.changes.seats seatIds: this.changes.seats
}); });
} }
},
resetSeats() {
this.changes.seats = this.getSeatIds();
},
saveSoundSet() {
if(this.hasSoundSetChanged) { if(this.hasSoundSetChanged) {
this.$emit('save-sound-set', { this.$emit('save-sound-set', {
groupId: this.group.id, groupId: this.group.id,
soundSetId: this.changes.soundSet soundSetId: this.changes.soundSet
}); });
} }
},
resetSoundSet() {
this.changes.soundSet = this.getSoundSetId();
},
deleteSeat() {
if(this.$refs.listItem) {
this.$refs.listItem.closePopoverMenu();
}
this.$emit('remove');
},
jumpToCallQueue() {
this.$emit('jump-to-call-queue', this.group);
} }
}, },
watch: { watch: {

@ -77,12 +77,12 @@
<q-input <q-input
dark dark
v-model="changes.name" v-model="changes.name"
@keyup.enter="saveName" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasNameChanged" v-if="hasNameChanged"
@click="saveName" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -99,12 +99,12 @@
<q-input <q-input
dark dark
v-model="changes.extension" v-model="changes.extension"
@keyup.enter="saveExtension" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasExtensionChanged" v-if="hasExtensionChanged"
@click="saveExtension" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -138,7 +138,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasAliasNumbersChanged" v-if="hasAliasNumbersChanged"
@click="saveAliasNumbers" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -161,7 +161,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasGroupsChanged" v-if="hasGroupsChanged"
@click="saveGroups" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -183,7 +183,7 @@
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasSoundSetChanged" v-if="hasSoundSetChanged"
@click="saveSoundSet" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -335,29 +335,43 @@
this.$emit('expand'); this.$emit('expand');
} }
}, },
saveName() { resetName() {
this.changes.name = this.seat.display_name;
},
resetExtension() {
this.changes.extension = this.seat.pbx_extension;
},
resetAliasNumbers() {
this.changes.aliasNumbers = this.getAliasNumberIds();
},
resetGroups() {
this.changes.groups = this.getGroupIds();
},
resetSoundSet() {
this.changes.soundSet = this.getSoundSetId();
},
deleteSeat() {
if(this.$refs.listItem) {
this.$refs.listItem.closePopoverMenu();
}
this.$emit('remove');
},
jumpToCallQueue() {
this.$emit('jump-to-call-queue', this.seat);
},
save(){
if(this.hasNameChanged) { if(this.hasNameChanged) {
this.$emit('save-name', { this.$emit('save-name', {
seatId: this.seat.id, seatId: this.seat.id,
seatName: this.changes.name seatName: this.changes.name
}); });
} }
},
resetName() {
this.changes.name = this.seat.display_name;
},
saveExtension() {
if(this.hasExtensionChanged) { if(this.hasExtensionChanged) {
this.$emit('save-extension', { this.$emit('save-extension', {
seatId: this.seat.id, seatId: this.seat.id,
seatExtension: this.changes.extension seatExtension: this.changes.extension
}); });
} }
},
resetExtension() {
this.changes.extension = this.seat.pbx_extension;
},
saveAliasNumbers() {
if(this.hasAliasNumbersChanged) { if(this.hasAliasNumbersChanged) {
this.$emit('save-alias-numbers', { this.$emit('save-alias-numbers', {
seatId: this.seat.id, seatId: this.seat.id,
@ -365,40 +379,19 @@
unassignedNumbers: _.difference(this.getAliasNumberIds(), this.changes.aliasNumbers) unassignedNumbers: _.difference(this.getAliasNumberIds(), this.changes.aliasNumbers)
}); });
} }
},
resetAliasNumbers() {
this.changes.aliasNumbers = this.getAliasNumberIds();
},
saveGroups() {
if(this.hasGroupsChanged) { if(this.hasGroupsChanged) {
this.$emit('save-groups', { this.$emit('save-groups', {
seatId: this.seat.id, seatId: this.seat.id,
groupIds: this.changes.groups groupIds: this.changes.groups
}); });
} }
},
resetGroups() {
this.changes.groups = this.getGroupIds();
},
saveSoundSet() {
if(this.hasSoundSetChanged) { if(this.hasSoundSetChanged) {
this.$emit('save-sound-set', { this.$emit('save-sound-set', {
seatId: this.seat.id, seatId: this.seat.id,
soundSetId: this.changes.soundSet soundSetId: this.changes.soundSet
}); });
} }
},
resetSoundSet() {
this.changes.soundSet = this.getSoundSetId();
},
deleteSeat() {
if(this.$refs.listItem) {
this.$refs.listItem.closePopoverMenu();
}
this.$emit('remove');
},
jumpToCallQueue() {
this.$emit('jump-to-call-queue', this.seat);
} }
}, },
watch: { watch: {

@ -46,12 +46,12 @@
v-model="changes.name" v-model="changes.name"
:error="$v.changes.name.$error" :error="$v.changes.name.$error"
@input="$v.changes.name.$touch" @input="$v.changes.name.$touch"
@keyup.enter="saveName" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasNameChanged && !$v.changes.name.$error" v-if="hasNameChanged && !$v.changes.name.$error"
@click="saveName" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -70,12 +70,12 @@
v-model="changes.description" v-model="changes.description"
:error="$v.changes.description.$error" :error="$v.changes.description.$error"
@input="$v.changes.description.$touch" @input="$v.changes.description.$touch"
@keyup.enter="saveDescription" @keyup.enter="save"
/> />
<csc-fade> <csc-fade>
<csc-form-save-button <csc-form-save-button
v-if="hasDescriptionChanged && !$v.changes.description.$error" v-if="hasDescriptionChanged && !$v.changes.description.$error"
@click="saveDescription" @click="save"
/> />
</csc-fade> </csc-fade>
<csc-fade> <csc-fade>
@ -235,25 +235,9 @@
contract_default: this.soundSet.contract_default contract_default: this.soundSet.contract_default
} }
}, },
saveName() {
if(this.hasNameChanged) {
this.$emit('save-name', {
soundSetId: this.soundSet.id,
name: this.changes.name
});
}
},
resetName() { resetName() {
this.changes.name = this.getDefaultData().name; this.changes.name = this.getDefaultData().name;
}, },
saveDescription() {
if(this.hasDescriptionChanged) {
this.$emit('save-description', {
soundSetId: this.soundSet.id,
description: this.changes.description
});
}
},
resetDescription() { resetDescription() {
this.changes.description = this.getDefaultData().description; this.changes.description = this.getDefaultData().description;
}, },
@ -269,6 +253,20 @@
}, },
toggleLoopPlay(options) { toggleLoopPlay(options) {
this.$emit('toggle-loop-play', options); this.$emit('toggle-loop-play', options);
},
save(){
if(this.hasNameChanged) {
this.$emit('save-name', {
soundSetId: this.soundSet.id,
name: this.changes.name
});
}
if(this.hasDescriptionChanged) {
this.$emit('save-description', {
soundSetId: this.soundSet.id,
description: this.changes.description
});
}
} }
}, },
watch: { watch: {

Loading…
Cancel
Save