From 7747070ef067e7c458e7357e6efac2566e4bcdb0 Mon Sep 17 00:00:00 2001 From: feoche Date: Thu, 21 Dec 2017 11:39:05 +0100 Subject: [PATCH] feat(Line - Contact): Add bulk action to contact edit - review --- ...lecom-telephony-service-contact.controller.js | 16 ++++++++-------- .../telecom-telephony-service-contact.html | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.controller.js b/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.controller.js index 3507c1824..1a88a9f83 100644 --- a/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.controller.js +++ b/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.controller.js @@ -25,7 +25,6 @@ angular.module("managerApp").controller("TelecomTelephonyServiceContactCtrl", fu function init () { self.isLoading = true; - self.isBulkLoading = true; self.isEditing = false; self.wayNumberExtraEnum = [ "bis", "ter", "quater", "quinquies", "sexto", "septimo", "octimo", "nono", @@ -33,8 +32,11 @@ angular.module("managerApp").controller("TelecomTelephonyServiceContactCtrl", fu "W", "X", "Y", "Z" ]; self.directoryCodes = null; - return fetchDirectory().then(function (directory) { - self.directory = directory; + return $q.all({ + infos: OvhApiTelephony.Lexi().schema().$promise, + directory: fetchDirectory() + }).then(function (res) { + self.directory = res.directory; self.directoryForm = angular.copy(self.directory); self.cityList = [{ name: self.directory.city }]; self.onPostCodeChange(); @@ -43,14 +45,12 @@ angular.module("managerApp").controller("TelecomTelephonyServiceContactCtrl", fu self.directoryCodes = result; }); } + + self.directoryProperties = _.get(res.infos, "models['telephony.DirectoryInfo'].properties"); return null; }).catch(function (err) { return new ToastError(err); }).finally(function () { - OvhApiTelephony.Lexi().schema({}, {}).$promise.then(function (infos) { - self.directoryProperties = _.get(infos, "models['telephony.DirectoryInfo'].properties"); - self.isBulkLoading = false; - }); self.isLoading = false; }); } @@ -124,7 +124,7 @@ angular.module("managerApp").controller("TelecomTelephonyServiceContactCtrl", fu }; self.getBulkParams = function () { - return _.pick(self.directory, function (value, key) { + return _.pick(self.directoryForm, function (value, key) { return _.get(self.directoryProperties, [key, "readOnly"]) === 0; }); }; diff --git a/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.html b/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.html index 5ac419415..867e9b2c1 100644 --- a/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.html +++ b/client/app/telecom/telephony/service/contact/telecom-telephony-service-contact.html @@ -720,10 +720,9 @@