diff --git a/client/src/modules/depots/modals/depot.modal.html b/client/src/modules/depots/modals/depot.modal.html
index 0f6cb09d31..6cb4d73b97 100644
--- a/client/src/modules/depots/modals/depot.modal.html
+++ b/client/src/modules/depots/modals/depot.modal.html
@@ -153,12 +153,30 @@
-
DEPOT.NO_DEPOT
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/src/modules/depots/modals/depot.modal.js b/client/src/modules/depots/modals/depot.modal.js
index 1a7fa1524e..6bca1e85e7 100644
--- a/client/src/modules/depots/modals/depot.modal.js
+++ b/client/src/modules/depots/modals/depot.modal.js
@@ -9,6 +9,7 @@ function DepotModalController($state, Depots, Notify, Session, params) {
const vm = this;
vm.depot = {};
+
vm.identifier = params.uuid;
vm.isCreateState = params.isCreateState;
vm.enable_strict_depot_distribution = Session.stock_settings.enable_strict_depot_distribution;
@@ -22,10 +23,24 @@ function DepotModalController($state, Depots, Notify, Session, params) {
vm.depot.parent_uuid = params.parentUuid;
}
+ Depots.read()
+ .then(depots => {
+ vm.depots = depots;
+ })
+ .catch(Notify.handleError);
+
if (!vm.isCreateState) {
if (!vm.identifier) { return; }
Depots.read(vm.identifier)
.then(depot => {
+ depot.allowed_distribution_depots.forEach(depotDist => {
+ vm.depots.forEach(d => {
+ if (d.uuid === depotDist) {
+ d.checked = 1;
+ }
+ });
+ });
+
vm.depot = depot;
// make sure hasLocation is set
@@ -66,6 +81,12 @@ function DepotModalController($state, Depots, Notify, Session, params) {
return 0;
}
+ vm.depot.allowed_distribution_depots = [];
+
+ vm.depots.forEach(depot => {
+ if (depot.checked) vm.depot.allowed_distribution_depots.push(depot.uuid);
+ });
+
Depots.clean(vm.depot);
if (vm.hasLocation === 0) {