Skip to content

Commit

Permalink
chore(employees): rework employee registration page
Browse files Browse the repository at this point in the history
Moves the rubrics for payroll lower in the "Optional Information"
section for better consistency.  It also cleans up the controller's
eslint issues.
  • Loading branch information
jniles committed Jan 1, 2025
1 parent 96d2b58 commit 898522a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 35 deletions.
50 changes: 21 additions & 29 deletions client/src/modules/employees/registration/employees.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<!-- ng-if to stop flickering on load -->
<span
ng-if="EmployeeCtrl.isUpdating"
style="margin-left : 5px"
class="label label-warning text-uppercase">
ng-if="EmployeeCtrl.isUpdating"
style="margin-left : 5px"
class="label label-warning text-uppercase">
<span translate>FORM.LABELS.EDIT</span>
</span>
</div>
Expand Down Expand Up @@ -464,21 +464,10 @@ <h4 translate>FORM.LABELS.CURRENT_LOCATION</h4>
id="individual_salary"
currency-id="EmployeeCtrl.enterprise.currency_id"
model="EmployeeCtrl.employee.individual_salary"
min = 0>
min = 0
horizontal = "true">
</bh-currency-input>

<div ng-repeat="rubric in EmployeeCtrl.rubrics">
<bh-currency-input
data-payment-currency-input
label="{{rubric.label}}"
id="{{rubric.abbr}}"
currency-id="EmployeeCtrl.enterprise.currency_id"
model="EmployeeCtrl.employee.payroll[rubric.id]"
required ="false"
min = 0>
</bh-currency-input>
</div>

<!-- Employee bank -->
<div
class="form-group"
Expand Down Expand Up @@ -515,20 +504,23 @@ <h4 translate>FORM.LABELS.CURRENT_LOCATION</h4>
</div>
</div>

<!-- Employee locked state
<div class="form-group"
ng-class="{'has-error' : OptionalForm.locked.$invalid && EmployeeRegistrationForm.$submitted}">
<label class="control-label">
<input
type="checkbox"
name="locked"
ng-true-value="1"
ng-false-value="0"
ng-model="EmployeeCtrl.employee.locked">
<span translate>FORM.LABELS.LOCKED</span>
</label>
<h4 class="text-capitalize" translate>FORM.LABELS.RUBRICS</h4>

<!-- TODO(@jniles): are all employee rubrics really currency values? -->

<!-- loop through rubrics and display them -->
<div ng-repeat="rubric in EmployeeCtrl.rubrics">
<bh-currency-input
data-payment-currency-input
label="{{rubric.label}}"
id="{{rubric.abbr}}"
currency-id="EmployeeCtrl.enterprise.currency_id"
model="EmployeeCtrl.employee.payroll[rubric.id]"
required ="false"
min = 0
horizontal = "true">
</bh-currency-input>
</div>
-->
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions client/src/modules/employees/registration/employees.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ angular.module('bhima.controllers')
EmployeeController.$inject = [
'EmployeeService', 'ServiceService', 'GradeService', 'FunctionService', 'TitleService',
'CreditorGroupService', 'util', 'NotifyService', '$state',
'bhConstants', 'ReceiptModal', 'SessionService', 'RubricService', 'PatientService',
'bhConstants', 'ReceiptModal', 'SessionService', 'RubricService', 'PatientService', 'moment',
];

function EmployeeController(Employees, Services, Grades, Functions, Titles, CreditorGroups, util, Notify,
$state, bhConstants, Receipts, Session, Rubrics, Patients) {
$state, bhConstants, Receipts, Session, Rubrics, Patients, moment) {
const vm = this;
const referenceUuid = $state.params.uuid;
const { saveAsEmployee } = $state.params;
Expand All @@ -32,7 +32,7 @@ function EmployeeController(Employees, Services, Grades, Functions, Titles, Cred
vm.employee = employee;
vm.employee.payroll = {};

/**
/*
/* Finds the amounts of all Rubrics (advantage) defined by employees,
/* these rubrics are those whose value Is defined by employee? is true
*/
Expand Down Expand Up @@ -87,8 +87,8 @@ function EmployeeController(Employees, Services, Grades, Functions, Titles, Cred
// Assign name
employee.name = employee.display_name;
employee.displayGender = employee.sex;
// eslint-disable-next-line no-undef
employee.displayAge = moment().diff(employee.dob, 'years');

}

function onSelectGrade(element) {
Expand All @@ -97,7 +97,7 @@ function EmployeeController(Employees, Services, Grades, Functions, Titles, Cred
}
}

// Expose lenths from util
// Expose lengths from util
vm.length20 = util.length20;

// Expose validation rule for date
Expand All @@ -106,7 +106,6 @@ function EmployeeController(Employees, Services, Grades, Functions, Titles, Cred
minDate : bhConstants.dates.minDOB,
};

// const yearOptions = bhConstants.yearOptions;
const { dayOptions } = bhConstants;

setupRegistration();
Expand Down Expand Up @@ -138,6 +137,7 @@ function EmployeeController(Employees, Services, Grades, Functions, Titles, Cred
const currentOptions = dayOptions;

// set the database flag to track if a date is set to JAN 01 or if the date is unknown
// TODO(@jniles): I don't think this is necessary in the case of employees. We require a DOB.
vm.employee.dob_unknown_date = !vm.fullDateEnabled;

angular.merge(vm.datepickerOptions, currentOptions);
Expand Down

0 comments on commit 898522a

Please sign in to comment.