diff --git a/client/src/i18n/en/enterprise.json b/client/src/i18n/en/enterprise.json index 2ef74d828e..ada4dc3c27 100644 --- a/client/src/i18n/en/enterprise.json +++ b/client/src/i18n/en/enterprise.json @@ -1,8 +1,17 @@ -{"ENTERPRISE":{"ADD_ENTERPRISE":"Add Enterprise.", -"ALL_ENTERPRISES":"All Enterprises", -"CONFIGURATION_ENTERPRISE":"Configuration Enterprise", -"DESCRIPTION_1":"Manage the application Companies from here. For now clearing the enterprise is not taken into account.", -"DESCRIPTION_2":"Edit selected Enterprise", -"DESCRIPTION_3":"Add a new enterprise.", -"EDITING_ENTERPRISE":"Editing enterprise", -"TITLE":"Enterprise Management"}} \ No newline at end of file +{ + "ENTERPRISE": { + "ADD_ENTERPRISE" : "Add Enterprise.", + "ALL_ENTERPRISES" : "All Enterprises", + "CONFIGURATION_ENTERPRISE" : "Configuration Enterprise", + "DESCRIPTION_1" : "Manage the application Companies from here. For now clearing the enterprise is not taken into account.", + "DESCRIPTION_2" : "Edit selected enterprise", + "DESCRIPTION_3" : "Add a new enterprise.", + "EDITING_ENTERPRISE" : "Editing enterprise", + "TITLE" : "Enterprise Management", + "SETTINGS" : { + "TITLE" : "Enterprise Settings", + "ENABLE_PRICE_LOCK_LABEL" : "Lock Price Changes for Patient Invoicing", + "ENABLE_PRICE_LOCK_HELP_TEXT" : "Enabling this feature will disallow users from modifying the prices of inventory items in the Patient Invoice module." + } + } +} diff --git a/client/src/i18n/fr/enterprise.json b/client/src/i18n/fr/enterprise.json index eb60ecb21b..b65cda62b4 100644 --- a/client/src/i18n/fr/enterprise.json +++ b/client/src/i18n/fr/enterprise.json @@ -1,8 +1,17 @@ -{"ENTERPRISE":{"ADD_ENTERPRISE":"Ajouter entreprise", -"ALL_ENTERPRISES":"Tous les entriprises", -"CONFIGURATION_ENTERPRISE":"Configuration entreprise", -"DESCRIPTION_1":"Gerer les entreprises de l'application A partir d'ici. Pour l'instant effacement de l'entrerpise n'est pas prise en compte.", -"DESCRIPTION_2":"Modifier l'enterprise sélectionner", -"DESCRIPTION_3":"Ajouter une nouvelle entreprises", -"EDITING_ENTERPRISE":"Edition entreprise", -"TITLE":"Gestion des entreprises"}} \ No newline at end of file +{ + "ENTERPRISE" : { + "ADD_ENTERPRISE" : "Ajouter entreprise", + "ALL_ENTERPRISES" : "Tous les entriprises", + "CONFIGURATION_ENTERPRISE" : "Configuration entreprise", + "DESCRIPTION_1" : "Gerer les entreprises de l'application A partir d'ici. Pour l'instant effacement de l'entrerpise n'est pas prise en compte.", + "DESCRIPTION_2" : "Modifier l'enterprise sélectionner", + "DESCRIPTION_3" : "Ajouter une nouvelle entreprises", + "EDITING_ENTERPRISE" : "Edition entreprise", + "TITLE" : "Gestion des entreprises", + "SETTINGS" : { + "TITLE" : "Parametres de l'Enterprise", + "ENABLE_PRICE_LOCK_LABEL" : "Verrouiller les changements de prix pour la facturation des patients", + "ENABLE_PRICE_LOCK_HELP_TEXT" : "L'activation de cette fonctionnalité empêchera les utilisateurs de modifier les prix des articles en stock dans le module Facturation de Patients." + } + } +} diff --git a/client/src/js/components/bhYesNoRadios.js b/client/src/js/components/bhYesNoRadios.js index 9c21c80e5f..d32d472d06 100644 --- a/client/src/js/components/bhYesNoRadios.js +++ b/client/src/js/components/bhYesNoRadios.js @@ -1,24 +1,30 @@ angular.module('bhima.components') .component('bhYesNoRadios', { bindings : { - defaultValue : '@?', - value : '=', - label : '@?', + value : '<', + label : '@', helpText : '@?', onChangeCallback : '&', }, templateUrl : 'modules/templates/bhYesNoRadios.tmpl.html', - controller : YesNoRadio, + controller : YesNoRadioController, }); -function YesNoRadio() { +/** + * @function YesNoRadioController + * + * @description + * This component makes yes/no options a bit easier to navigate. + */ +function YesNoRadioController() { const $ctrl = this; - $ctrl.$onInit = function onInit() { - $ctrl.onChangeCallback = $ctrl.onChangeCallback; - $ctrl.defaultValue = $ctrl.defaultValue; - $ctrl.value = ($ctrl.defaultValue) ? 1 : 0; - $ctrl.label = $ctrl.label; - $ctrl.helpText = $ctrl.helpText; + + $ctrl.$onInit = () => { + $ctrl.value = Number.parseInt($ctrl.value, 10); + $ctrl.onChangeCallback = $ctrl.onChangeCallback || angular.noop; }; + $ctrl.onChange = (value) => { + $ctrl.onChangeCallback({ value }); + }; } diff --git a/client/src/js/services/ModalService.js b/client/src/js/services/ModalService.js index 3ed6a1ee15..ed60915ea1 100644 --- a/client/src/js/services/ModalService.js +++ b/client/src/js/services/ModalService.js @@ -24,9 +24,9 @@ ModalService.$inject = ['$uibModal']; * */ function ModalService(Modal) { - var service = this; + const service = this; - var modalParameters = { + const modalParameters = { size : 'md', backdrop : 'static', animation : false, @@ -89,9 +89,9 @@ function ModalService(Modal) { */ function confirm(prompt, options) { // default options for modal rendering - var opts = options || {}; + const opts = options || {}; - var instance = Modal.open({ + const instance = Modal.open({ animation : opts.animation || false, keyboard : opts.keyboard || true, size : opts.size || 'md', @@ -105,28 +105,30 @@ function ModalService(Modal) { function alert(prompt, options) { // default options for modal rendering - var opts = options || {}; + const opts = options || {}; - var instance = Modal.open({ + const instance = Modal.open({ animation : opts.animation || false, keyboard : opts.keyboard || true, size : opts.size || 'md', controller : 'AlertModalController as AlertModalCtrl', - resolve : { prompt : function provider() { return prompt;} }, - templateUrl : '/modules/templates/modals/alert.modal.html' + resolve : { prompt : () => prompt }, + templateUrl : '/modules/templates/modals/alert.modal.html', }); + + return instance.result; } /** * Select cashbox modal */ function openSelectCashbox(request) { - var params = angular.extend(modalParameters, { + const params = angular.extend(modalParameters, { templateUrl : 'modules/cash/modals/selectCashbox.modal.html', controller : 'SelectCashboxModalController as $ctrl', resolve : { - cashboxId : function cashboxIdProvider() { return request.cashboxId; } - } + cashboxId : function cashboxIdProvider() { return request.cashboxId; }, + }, }); return Modal.open(params).result; @@ -137,281 +139,223 @@ function ModalService(Modal) { */ function openUploadDocument(request) { - var params = angular.extend(modalParameters, { + const params = angular.extend(modalParameters, { templateUrl : 'modules/patients/documents/modals/documents.modal.html', controller : 'PatientDocumentsModalController', controllerAs : '$ctrl', - resolve : { - patientUuid : function patientProvider() { return request.patient_uuid; } - } + resolve : { patientUuid : () => request.patient_uuid }, }); - var instance = Modal.open(params); + const instance = Modal.open(params); return instance.result; } /** * Page for printing in Modal */ - function openReports(request) { - - var params = angular.extend(modalParameters, { - templateUrl : 'modules/templates/modals/reports.modal.html', - controller : 'ReportsModalController', - controllerAs : '$ctrl', - size : 'lg', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - } - - /** - * Inventory Group Actions - */ - function openInventoryGroupActions(request) { - - var params = angular.extend(modalParameters, { - templateUrl : 'modules/inventory/configuration/groups/modals/actions.tmpl.html', - controller : 'InventoryGroupsActionsModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** Inventory Types Modal for actions */ - function openInventoryTypeActions(request) { - - var params = angular.extend(modalParameters, { - templateUrl : 'modules/inventory/configuration/types/modals/actions.tmpl.html', - controller : 'InventoryTypeActionsModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** Inventory Units Modals for actions */ - function openInventoryUnitActions(data) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/inventory/configuration/units/modals/actions.tmpl.html', - controller : 'InventoryUnitActionsModalController', - controllerAs : '$ctrl', - resolve : { - data : function dataProvider() { return data; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** Inventory List Modals for actions */ - function openInventoryListActions(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/inventory/list/modals/actions.tmpl.html', - controller : 'InventoryListActionsModalController', - controllerAs : '$ctrl', - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** Find by Date interval modal */ - function openDateInterval(request) { - - var params = angular.extend(modalParameters, { - templateUrl : 'modules/templates/modals/dateInterval.tmpl.html', - controller : 'DateIntervalModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : true, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** - * confirm deletion modal - * @param {object} request - * The request parameter take : - * pattern: the text to match, - * elementName: the name translated of the element to delete (document, transaction) - * @example - * request = { - * pattern: '#HBB17', - * elementName: $translate.instant('FORM.LABELS.TRANSACTION') - * } - */ - function openConfirmDialog(request) { - - var params = angular.extend(modalParameters, { - templateUrl : 'modules/templates/modals/confirmDialog.modal.html', - controller : 'ConfirmDialogModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** project modal actions */ - function openProjectActions(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/templates/modals/project.modal.html', - controller : 'ProjectModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** transaction type modal actions */ - function openTransactionTypeActions(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/templates/modals/transactionType.modal.html', - controller : 'TransactionTypeModalController', - controllerAs : '$ctrl', - size : 'xs', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** closing fiscal year modal */ - function openClosingFiscalYear(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/fiscal/templates/modals/fiscal.closing.modal.html', - controller : 'ClosingFiscalYearModalController', - controllerAs : '$ctrl', - size : 'lg', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** searchCashPayment */ - function openSearchCashPayment(filters) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/cash/payments/templates/search.modal.html', - controller : 'SearchCashPaymentModalController', - controllerAs : '$ctrl', - size : 'md', - backdrop : 'static', - animation : false, - resolve : { - filters : function filtersProvider() { return filters; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** purchase order status */ - function openPurchaseOrderStatus(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/purchases/modals/status.tmpl.html', - controller : 'PurchaseOrderStatusModalController', - controllerAs : '$ctrl', - size : 'md', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - /** search purchase order */ - function openSearchPurchaseOrder(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/purchases/modals/search.tmpl.html', - controller : 'SearchPurchaseOrderModalController', - controllerAs : '$ctrl', - size : 'md', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } - - function openSelectFiscalYear(request) { - var params = angular.extend(modalParameters, { - templateUrl : 'modules/general-ledger/modals/search.tmpl.html', - controller : 'SearchFiscalYearModalController', - controllerAs : '$ctrl', - size : 'md', - backdrop : 'static', - animation : false, - resolve : { - data : function dataProvider() { return request; } - } - }); - - var instance = Modal.open(params); - return instance.result; - } + function openReports(request) { + + const params = angular.extend(modalParameters, { + templateUrl : 'modules/templates/modals/reports.modal.html', + controller : 'ReportsModalController', + controllerAs : '$ctrl', + size : 'lg', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** + * Inventory Group Actions + */ + function openInventoryGroupActions(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/inventory/configuration/groups/modals/actions.tmpl.html', + controller : 'InventoryGroupsActionsModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** Inventory Types Modal for actions */ + function openInventoryTypeActions(request) { + + const params = angular.extend(modalParameters, { + templateUrl : 'modules/inventory/configuration/types/modals/actions.tmpl.html', + controller : 'InventoryTypeActionsModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** Inventory Units Modals for actions */ + function openInventoryUnitActions(data) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/inventory/configuration/units/modals/actions.tmpl.html', + controller : 'InventoryUnitActionsModalController', + controllerAs : '$ctrl', + resolve : { data : () => data }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** Inventory List Modals for actions */ + function openInventoryListActions(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/inventory/list/modals/actions.tmpl.html', + controller : 'InventoryListActionsModalController', + controllerAs : '$ctrl', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** Find by Date interval modal */ + function openDateInterval(request) { + + const params = angular.extend(modalParameters, { + templateUrl : 'modules/templates/modals/dateInterval.tmpl.html', + controller : 'DateIntervalModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** + * confirm deletion modal + * @param {object} request + * The request parameter take : + * pattern: the text to match, + * elementName: the name translated of the element to delete (document, transaction) + * @example + * request = { + * pattern: '#HBB17', + * elementName: $translate.instant('FORM.LABELS.TRANSACTION') + * } + */ + function openConfirmDialog(request) { + + const params = angular.extend(modalParameters, { + templateUrl : 'modules/templates/modals/confirmDialog.modal.html', + controller : 'ConfirmDialogModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** project modal actions */ + function openProjectActions(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/templates/modals/project.modal.html', + controller : 'ProjectModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** transaction type modal actions */ + function openTransactionTypeActions(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/templates/modals/transactionType.modal.html', + controller : 'TransactionTypeModalController', + controllerAs : '$ctrl', + size : 'xs', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** closing fiscal year modal */ + function openClosingFiscalYear(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/fiscal/templates/modals/fiscal.closing.modal.html', + controller : 'ClosingFiscalYearModalController', + controllerAs : '$ctrl', + size : 'lg', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** searchCashPayment */ + function openSearchCashPayment(filters) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/cash/payments/templates/search.modal.html', + controller : 'SearchCashPaymentModalController', + controllerAs : '$ctrl', + resolve : { filters : () => filters }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** purchase order status */ + function openPurchaseOrderStatus(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/purchases/modals/status.tmpl.html', + controller : 'PurchaseOrderStatusModalController', + controllerAs : '$ctrl', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + /** search purchase order */ + function openSearchPurchaseOrder(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/purchases/modals/search.tmpl.html', + controller : 'SearchPurchaseOrderModalController', + controllerAs : '$ctrl', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } + + function openSelectFiscalYear(request) { + const params = angular.extend(modalParameters, { + templateUrl : 'modules/general-ledger/modals/search.tmpl.html', + controller : 'SearchFiscalYearModalController', + controllerAs : '$ctrl', + resolve : { data : () => request }, + }); + + const instance = Modal.open(params); + return instance.result; + } } diff --git a/client/src/modules/enterprises/enterprises.html b/client/src/modules/enterprises/enterprises.html index 8fe88b4a7e..21f0c67d23 100644 --- a/client/src/modules/enterprises/enterprises.html +++ b/client/src/modules/enterprises/enterprises.html @@ -50,7 +50,7 @@ - +