Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.

Commit

Permalink
feat(Number - Call filtering): Add bulk action to call filtering on n…
Browse files Browse the repository at this point in the history
…umber pages (easyHunting - xPabx)
  • Loading branch information
feoche committed Jan 5, 2018
1 parent 11b1262 commit 203d140
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCallsFilteringEasyHuntingCtrl", function ($stateParams, $q, OvhApiTelephony, ToastError) {
angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCallsFilteringEasyHuntingCtrl", function ($stateParams, $q, $translate, OvhApiTelephony, ToastError, telephonyBulk, Toast) {
"use strict";

var self = this;
Expand Down Expand Up @@ -102,4 +102,48 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCalls
}

init();

self.bulkDatas = {
billingAccount: $stateParams.billingAccount,
serviceName: $stateParams.serviceName,
infos: {
name: "screenListConditions",
actions: [{
name: "screenListConditions",
route: "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions",
method: "PUT",
params: null
}]
}
};

self.getBulkParams = function () {
return {
status: _.get(self, "screenStatus.modified")
};
};

self.onBulkSuccess = function (bulkResult) {
// display message of success or error
telephonyBulk.getToastInfos(bulkResult, {
fullSuccess: $translate.instant("telephony_line_calls_filtering_bulk_all_success"),
partialSuccess: $translate.instant("telephony_line_calls_filtering_bulk_some_success", {
count: bulkResult.success.length
}),
error: $translate.instant("telephony_line_calls_filtering_bulk_error")
}).forEach(function (toastInfo) {
Toast[toastInfo.type](toastInfo.message, {
hideAfter: null
});
});

// reset initial values to be able to modify again the options
OvhApiTelephony.Line().Lexi().resetAllCache();

init();
};

self.onBulkError = function (error) {
Toast.error([$translate.instant("telephony_line_calls_filtering_bulk_on_error"), _.get(error, "msg.data")].join(" "));
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ <h1 data-translate="telephony_alias_configuration_calls_filtering_title"></h1>
<div class="telecom-section-content"
data-ng-if="!MembersEasyHuntingCtrl.loaders.init">

<toast-message></toast-message>

<div class="row">

<!-- FILTERING ENABLE -->
Expand Down Expand Up @@ -41,6 +43,21 @@ <h1 data-translate="telephony_alias_configuration_calls_filtering_title"></h1>
<oui-loader data-ng-if="CallsFilteringEasyHuntingCtrl.screenStatus.isLoading"
data-size="m">
</oui-loader>
<div class="form-group mt-4">
<div class="row">
<div class="col-md-6">
<telephony-bulk-action data-billing-account="{{ CallsFilteringEasyHuntingCtrl.bulkDatas.billingAccount }}"
data-service-type="alias"
data-service-name="{{ CallsFilteringEasyHuntingCtrl.bulkDatas.serviceName }}"
data-custom-class="link d-block pl-0 mb-3"
data-bulk-infos="CallsFilteringEasyHuntingCtrl.bulkDatas.infos"
data-get-bulk-params="CallsFilteringEasyHuntingCtrl.getBulkParams"
data-on-success="CallsFilteringEasyHuntingCtrl.onBulkSuccess"
data-on-error="CallsFilteringEasyHuntingCtrl.onBulkError">
</telephony-bulk-action>
</div>
</div>
</div>
</div>
<!-- /.widget-presentation -->
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<translations>
<translation id="telephony_line_calls_filtering_bulk_all_success">Le filtrage d'appels a bien été appliqué aux services sélectionnés.</translation>
<translation id="telephony_line_calls_filtering_bulk_some_success">Le filtrage d'appels a bien été appliqué à {{ count }} des services sélectionnés.</translation>
<translation id="telephony_line_calls_filtering_bulk_error">Le filtrage d'appels n'a pas pu être appliqué au(x) service(s) suivant(s) :</translation>
<translation id="telephony_line_calls_filtering_bulk_on_error">Oups ! Une erreur est survenue lors de l'application du filtrage d'appels.</translation>
</translations>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCallsFilteringOldPabxCtrl", function ($stateParams, $q, OvhApiTelephony, ToastError) {
angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCallsFilteringOldPabxCtrl", function ($stateParams, $q, $translate, OvhApiTelephony, ToastError, telephonyBulk, Toast) {
"use strict";

var self = this;
Expand Down Expand Up @@ -100,4 +100,48 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationCalls
}

init();

self.bulkDatas = {
billingAccount: $stateParams.billingAccount,
serviceName: $stateParams.serviceName,
infos: {
name: "screen",
actions: [{
name: "screen",
route: "/telephony/{billingAccount}/screen/{serviceName}",
method: "PUT",
params: null
}]
}
};

self.getBulkParams = function () {
return {
incomingScreenList: _.get(self, "screenStatus.modified")
};
};

self.onBulkSuccess = function (bulkResult) {
// display message of success or error
telephonyBulk.getToastInfos(bulkResult, {
fullSuccess: $translate.instant("telephony_line_calls_filtering_bulk_all_success"),
partialSuccess: $translate.instant("telephony_line_calls_filtering_bulk_some_success", {
count: bulkResult.success.length
}),
error: $translate.instant("telephony_line_calls_filtering_bulk_error")
}).forEach(function (toastInfo) {
Toast[toastInfo.type](toastInfo.message, {
hideAfter: null
});
});

// reset initial values to be able to modify again the options
OvhApiTelephony.Line().Lexi().resetAllCache();

init();
};

self.onBulkError = function (error) {
Toast.error([$translate.instant("telephony_line_calls_filtering_bulk_on_error"), _.get(error, "msg.data")].join(" "));
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ <h1 data-translate="telephony_alias_configuration_calls_filtering_title"></h1>

<div class="telecom-section-content" data-ng-if="!$ctrl.loaders.init">

<toast-message></toast-message>

<div class="row">

<!-- FILTERING ENABLE -->
Expand All @@ -37,6 +39,21 @@ <h2 class="widget-presentation-title" data-translate="telephony_alias_configurat
<option value="blacklist" data-translate="telephony_alias_configuration_calls_filtering_list_black"></option>
</select>
</div>
<div class="form-group mt-4">
<div class="row">
<div class="col-md-6">
<telephony-bulk-action data-billing-account="{{ $ctrl.bulkDatas.billingAccount }}"
data-service-type="alias"
data-service-name="{{ $ctrl.bulkDatas.serviceName }}"
data-custom-class="link d-block pl-0 mb-3"
data-bulk-infos="$ctrl.bulkDatas.infos"
data-get-bulk-params="$ctrl.getBulkParams"
data-on-success="$ctrl.onBulkSuccess"
data-on-error="$ctrl.onBulkError">
</telephony-bulk-action>
</div>
</div>
</div>
</div>

</div> <!-- row -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<translations>
<translation id="telephony_line_calls_filtering_bulk_all_success">Le filtrage d'appels a bien été appliqué aux services sélectionnés.</translation>
<translation id="telephony_line_calls_filtering_bulk_some_success">Le filtrage d'appels a bien été appliqué à {{ count }} des services sélectionnés.</translation>
<translation id="telephony_line_calls_filtering_bulk_error">Le filtrage d'appels n'a pas pu être appliqué au(x) service(s) suivant(s) :</translation>
<translation id="telephony_line_calls_filtering_bulk_on_error">Oups ! Une erreur est survenue lors de l'application du filtrage d'appels.</translation>
</translations>

0 comments on commit 203d140

Please sign in to comment.