Skip to content

Commit

Permalink
feat(functions): implement "batch create" for functions
Browse files Browse the repository at this point in the history
Implements the same style of batch creates used on the account modal for
creating functions.
  • Loading branch information
jniles committed Jan 2, 2025
1 parent 0d8054b commit a67a7ba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
31 changes: 16 additions & 15 deletions client/src/i18n/en/employee.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"EMPLOYEE" : {
"ACTIVE_EMPLOYEE" : "Active Employee",
"CONFIGURATION": "Employee Configuration",
"EDIT" : "Update Employee Details",
"EMPLOYEES" : "All Employees",
"EMPLOYEE_DETAILS" : "Employee Details",
"HOSPITAL_DATA" : "Hospital Data",
"INACTIVE_EMPLOYEE" : "Inactive Employee",
"INFO" : "The employee management tool can be used to create, view and update employees and their information. Employees listed here are implicitly setup for credit and available for integration to modules such as /payroll/",
"REGISTER" : "Register Employee",
"REGISTRATION_FORM" : "Registration Form",
"TITLE":"Employee Management",
"NO_GRADE":"No grade assigned",
"VIEW_EMPLOYEE" : "View Employee"
}
"EMPLOYEE": {
"ACTIVE_EMPLOYEE": "Active Employee",
"CONFIGURATION": "Employee Configuration",
"EDIT": "Update Employee Details",
"EMPLOYEES": "All Employees",
"EMPLOYEE_DETAILS": "Employee Details",
"HOSPITAL_DATA": "Hospital Data",
"INACTIVE_EMPLOYEE": "Inactive Employee",
"INFO": "The employee management tool can be used to create, view and update employees and their information. Employees listed here are implicitly setup for credit and available for integration to modules such as /payroll/",
"REGISTER": "Register Employee",
"REGISTRATION_FORM": "Registration Form",
"TITLE": "Employee Management",
"NO_GRADE": "No grade assigned",
"VIEW_EMPLOYEE": "View Employee",
"CREATE_ANOTHER": "Create Another"
}
}
23 changes: 15 additions & 8 deletions client/src/modules/functions/modals/function.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@
</div>
</div>

<div class="modal-footer">
<button data-method="cancel" type="button" class="btn btn-default" ng-click="FunctionModalCtrl.closeModal()">
<span translate>FORM.BUTTONS.CANCEL</span>
</button>

<bh-loading-button loading-state="FunctionForm.$loading">
<span translate>FORM.BUTTONS.SUBMIT</span>
</bh-loading-button>
<div class="modal-footer">
<!-- allows a user to keep creating new values -->
<div class="checkbox" style="display : inline-block" ng-if="FunctionModalCtrl.isCreateState">
<label>
<input type="checkbox" ng-model="FunctionModalCtrl.batchCreate"> <span translate>EMPLOYEE.CREATE_ANOTHER</span>
</label>
</div>

<button data-method="cancel" type="button" class="btn btn-default" ng-click="FunctionModalCtrl.closeModal()">
<span translate>FORM.BUTTONS.CANCEL</span>
</button>

<bh-loading-button loading-state="FunctionForm.$loading">
<span translate>FORM.BUTTONS.SUBMIT</span>
</bh-loading-button>
</div>
</form>
8 changes: 7 additions & 1 deletion client/src/modules/functions/modals/function.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function FunctionModalController($state, Functions, Notify, AppCache, params) {
}

vm.isCreateState = vm.stateParams.isCreateState;
vm.batchCreate = false;

// exposed methods to the controller
vm.submit = submit;
Expand Down Expand Up @@ -46,7 +47,12 @@ function FunctionModalController($state, Functions, Notify, AppCache, params) {
.then(() => {
const translateKey = (vm.isCreateState) ? 'PROFESSION.CREATED' : 'PROFESSION.UPDATED';
Notify.success(translateKey);
$state.go('functions', null, { reload: true });

if (vm.batchCreate) {
$state.go('functions.create');
} else {
$state.go('functions', null, { reload: true });
}
})
.catch(Notify.handleError);
}
Expand Down

0 comments on commit a67a7ba

Please sign in to comment.