-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stock): implement depot selection modal
This commit implements a depot selection modal for the stock modules. The depot is cached between sessions, but if there is no depot, a user is immediately directed to the open modal to choose a depot. This modal cannot be dismissed if the user has not chosen a depot. Additionally, a dropdown menu has been implemented on the stock page to put the "Change Depot" switch in. Ideally, this should also clear and reset the stock form. However, since that isn't even implemented for the "submit" button, this feature will be added later. The prototype has been implemented on the Stock Entry page.
- Loading branch information
Showing
13 changed files
with
379 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
{ | ||
"DEPOT": { | ||
"ADD_DEPOT": "Add a Depot", | ||
"ALL_DEPOTS": "All Depots", | ||
"CREATED":"Depot created with success", | ||
"DELETED":"Depot deleted with success", | ||
"DELETE":"Delete", | ||
"DEPOTS_LIST": "Depots list", | ||
"DESCRIPTION": "This module allows you to List, Create, Edit and Delete a Depot", | ||
"EDIT_DEPOT": "Edit the information in a Depot", | ||
"ENTITY" : "Depot", | ||
"LABEL":"Depot", | ||
"MAIN": { | ||
"TITLE": "Depot Management" | ||
}, | ||
"NO_DEPOT": "No Depot", | ||
"NOT_ALLOWED_ACTIONS":"Protected Depot, you cannot perform modification on this depot", | ||
"TITLE": "Depot Management", | ||
"UPDATED":"Depot updated with success", | ||
"WAREHOUSE":"Warehouse" | ||
} | ||
"DEPOT" : { | ||
"ADD_DEPOT" : "Add a Depot", | ||
"ALL_DEPOTS" : "All Depots", | ||
"CREATED" : "Depot created with success", | ||
"CHANGE" : "Change Depot", | ||
"DELETED" : "Depot deleted with success", | ||
"DELETE" : "Delete", | ||
"DEPOTS_LIST" : "Depots list", | ||
"DESCRIPTION" : "This module allows you to List, Create, Edit and Delete a Depot", | ||
"EDIT_DEPOT" : "Edit the information in a Depot", | ||
"ENTITY" : "Depot", | ||
"LABEL" : "Depot", | ||
"MAIN" : { | ||
"TITLE" : "Depot Management" | ||
}, | ||
"NO_DEPOT" : "No Depot", | ||
"NOT_ALLOWED_ACTIONS" : "This depot is protect. You cannot modify its properties.", | ||
"TITLE" : "Depot Management", | ||
"UPDATED" : "Depot updated with success", | ||
"WAREHOUSE" : "Warehouse" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
{ | ||
"DEPOT": { | ||
"ADD_DEPOT": "Ajouter un dépôt", | ||
"ALL_DEPOTS": "Tous les dépôts", | ||
"CREATED":"Dépôt crée avec succès", | ||
"DELETED":"Dépôt supprimer avec succès", | ||
"DELETE":"Supprimer", | ||
"DEPOTS_LIST": "Liste des dépôts", | ||
"DESCRIPTION": "Ce module vous permet de Lister, Creer, Modifier et Supprimer un dépôt", | ||
"EDIT_DEPOT": "Editer les informations d'un dépôt", | ||
"ENTITY" : "Depot", | ||
"LABEL":"Dépôt", | ||
"MAIN": { | ||
"TITLE": "Gestion des dépôts" | ||
}, | ||
"NO_DEPOT": "Aucun dépôt", | ||
"NOT_ALLOWED_ACTIONS":"Ce dépôt est protégé, vous ne pouvez effectuer des modifications sur ce dépôt", | ||
"TITLE": "Gestion des dépôts", | ||
"UPDATED":"Dépôt mise à jour avec succès", | ||
"WAREHOUSE":"Entrepôts" | ||
} | ||
"DEPOT" : { | ||
"ADD_DEPOT" : "Ajouter un dépôt", | ||
"ALL_DEPOTS" : "Tous les dépôts", | ||
"CREATED" : "Dépôt crée avec succès", | ||
"CHANGE" : "Changer Dépôt", | ||
"DELETED" : "Dépôt supprimer avec succès", | ||
"DELETE" : "Supprimer", | ||
"DEPOTS_LIST" : "Liste des dépôts", | ||
"DESCRIPTION" : "Ce module vous permet de Lister, Creer, Modifier et Supprimer un dépôt", | ||
"EDIT_DEPOT" : "Editer les informations d'un dépôt", | ||
"ENTITY" : "Dépôt", | ||
"LABEL" : "Dépôt", | ||
"MAIN" : { | ||
"TITLE" : "Gestion des dépôts" | ||
}, | ||
"NO_DEPOT" : "Aucun dépôt", | ||
"NOT_ALLOWED_ACTIONS" : "Ce dépôt est protégé, vous ne pouvez effectuer des modifications sur ce dépôt", | ||
"TITLE" : "Gestion des dépôts", | ||
"UPDATED" : "Dépôt mise à jour avec succès", | ||
"WAREHOUSE" : "Entrepôts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
angular.module('bhima.controllers') | ||
.controller('SelectDepotModalController', SelectDepotModalController); | ||
|
||
SelectDepotModalController.$inject = [ | ||
'$uibModalInstance', 'DepotService', 'NotifyService', 'depot', | ||
]; | ||
|
||
/** | ||
* This modal selects a depot from the list of all depots. | ||
*/ | ||
function SelectDepotModalController(Instance, Depots, Notify, depot) { | ||
var vm = this; | ||
|
||
// bind the depot passed into the controller | ||
vm.depot = depot; | ||
vm.selectDepot = selectDepot; | ||
vm.hasSelectedDepot = hasSelectedDepot; | ||
vm.loading = false; | ||
|
||
// this is a one-time message shown to the user if they do not have a cached depot. | ||
vm.hasNoDefaultDepot = !angular.isDefined(depot); | ||
|
||
vm.submit = function submit() { Instance.close(vm.depot); }; | ||
vm.cancel = function cancel() { Instance.dismiss(); }; | ||
|
||
// loads a new set of depots from the server. | ||
function startup() { | ||
toggleLoadingIndicator(); | ||
|
||
Depots.read() | ||
.then(function (depots) { | ||
vm.depots = depots; | ||
}) | ||
.catch(Notify.handleError) | ||
.finally(toggleLoadingIndicator); | ||
} | ||
|
||
// fired when a user selects a depot from a list | ||
function selectDepot(uuid) { | ||
var selected; | ||
|
||
vm.depots.forEach(function (d) { | ||
if (d.uuid === uuid) { selected = d; } | ||
}); | ||
|
||
vm.depot = selected; | ||
} | ||
|
||
function toggleLoadingIndicator() { | ||
vm.loading = !vm.loading; | ||
} | ||
|
||
function hasSelectedDepot() { | ||
return vm.depot && vm.depot.uuid; | ||
} | ||
|
||
// start up the module | ||
startup(); | ||
} |
Oops, something went wrong.