Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bhima person display name #676

Merged
merged 6 commits into from
Aug 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@
"DUE" : "Payment Due",
"EDIT" : "Edit",
"EMAIL" : "Email",
"EMPLOYEE_NAME" : "Employee name",
"EMPLOYER" : "Employer",
"END" : "End",
"END_DATE" : "End Date",
Expand Down Expand Up @@ -434,6 +435,7 @@
"LAST_PAGE" : "Last Page Visited",
"LOCATION_REGISTER" : "Location Register",
"LOCKED" : "Locked",
"LOGIN" : "Login",
"LOSS_ACCOUNT" : "Loss Account",
"MALE" : "Male",
"MARITAL_STATUS" : "Martial Status",
Expand Down
2 changes: 2 additions & 0 deletions client/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
"DUE" : "Payment Due",
"EDIT" : "Editer",
"EMAIL" : "Email",
"EMPLOYEE_NAME" : "Nom de l'employé",
"EMPLOYER" : "Employeur",
"END" : "Fin",
"END_DATE" : "Date de fin",
Expand Down Expand Up @@ -426,6 +427,7 @@
"LAST_PAGE" : "La dernière page visitée",
"LOCATION_REGISTER" : "Enregistrer une localisation",
"LOCKED" : "Bloquée",
"LOGIN" : "Login",
"LOSS_ACCOUNT" : "Compte perte",
"MALE" : "Homme",
"MARITAL_STATUS" : "Etat Civil",
Expand Down
8 changes: 3 additions & 5 deletions client/src/js/components/bhEmployeeFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function employeeFinderController (employeeService, Appcache){

ctrl.searchOptions = [
{key : 'code', label : 'EMPLOYEE.CODE', placeHolder : 'EMPLOYEE.SEARCH_BY_CODE'},
{key : 'names', label : 'EMPLOYEE.NAME', placeHolder : 'EMPLOYEE.SEARCH_BY_NAME'}
{key : 'display_name', label : 'EMPLOYEE.NAME', placeHolder : 'EMPLOYEE.SEARCH_BY_NAME'}
];

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ function employeeFinderController (employeeService, Appcache){
*
*@param {String} text The token to use for research
*
* @description take a token and look the employee by code or names according to the option choosen
* @description take a token and look the employee by code or display_name according to the option choosen
*/

function search (text) {
Expand All @@ -93,9 +93,7 @@ function employeeFinderController (employeeService, Appcache){

function formatEmployee (employee) {
return [
employee.prenom,
employee.name,
employee.postnom,
employee.display_name,
'[' + employee.code_employee + ']'
].join(' ');
}
Expand Down
6 changes: 3 additions & 3 deletions client/src/js/components/bhFindPatient.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ function FindPatientComponent(Patients, AppCache, Notify) {
/**
* @method searchByName
*
* @param {string} text Patient name (first_name, middle_name or last_name)
* @param {string} text Patient name (display_name)
*
* @description This function make a call to BHIMA API for getting patients
* according the name (first_name, middle_name or last_name).
* according the name (display_name).
*
* @return {Array} An array of patients
*/
Expand Down Expand Up @@ -193,7 +193,7 @@ function FindPatientComponent(Patients, AppCache, Notify) {
* @returns {string} The formatted patient name
*/
function formatPatient(p) {
return p ? p.first_name + ' ' + p.last_name + ' ' + p.middle_name : '';
return p ? p.display_name : '';
}

/**
Expand Down
6 changes: 3 additions & 3 deletions client/src/js/components/bhFindSupplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ function FindSupplierComponent(SupplierService) {
/**
* @method searchByName
*
* @param {string} text Supplier name
* @param {string} text Supplier display_name
*
* @description This function make a call to BHIMA API for getting suppliers
* according the name of supplier.
* according the display_name of supplier.
*
* @return {Array} An array of suppliers
*/
Expand All @@ -49,7 +49,7 @@ function FindSupplierComponent(SupplierService) {

// format query string parameters
var options = {
name : text.toLowerCase(),
display_name : text.toLowerCase(),
limit : LIMIT
};

Expand Down
4 changes: 0 additions & 4 deletions client/src/js/directives/findemployee.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ angular.module('bhima.directives')
}

function extractMetaData(employeeData) {

employeeData.forEach(function(employee) {
employee.name = employee.prenom + ' ' + employee.name;
});
return employeeData;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/js/services/EmployeeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function EmployeeService($http, util) {

/**
* @desc It search for employee from the database
* @param {String} key, can be code or names
* @param {String} key, can be code or display_name
* @return {String} value a token taped by the user.
* @example
* service.search(code, value)
Expand Down
50 changes: 9 additions & 41 deletions client/src/partials/employees/employees.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<td>
<i ng-if="!item.code_employees" class="glyphicon glyphicon-minus-sign"></i> {{ item.code_employees }}
</td>
<td>{{ item.displayName}} </td>
<td>{{ item.display_name}} </td>
<td>{{ item.fonction_txt }}</td>
<td>{{ item.code_grade }}</td>
<td><i class="glyphicon glyphicon-ok" ng-if="!!item.locked"></i></td>
Expand All @@ -83,26 +83,10 @@ <h4>{{ 'EMPLOYEE.TITLE' | translate }}</h4>
<div class="panel-body">
<form class="panel-body" name="CreateForm" ng-submit="EmployeeCtrl.submit(CreateForm.$invalid)" bh-form-defaults novalidate>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.prenom.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.FIRST_NAME' | translate }}</label>
<input type="text" class="form-control" name="prenom" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-prenom" ng-model="EmployeeCtrl.employee.prenom" required>
<div class="help-block" ng-messages="CreateForm.prenom.$error" ng-show="CreateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.name.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.NAME' | translate }}</label>
<input type="text" class="form-control" name="name" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-name" ng-model="EmployeeCtrl.employee.name" required>
<div class="help-block" ng-messages="CreateForm.name.$error" ng-show="CreateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.postnom.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.LAST_NAME' | translate }}</label>
<input type="text" class="form-control" name="postnom" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-postnom" ng-model="EmployeeCtrl.employee.postnom" required>
<div class="help-block" ng-messages="CreateForm.postnom.$error" ng-show="CreateForm.$submitted">
<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.display_name.$invalid }">
<label class="control-label" for="bhima-employee-display_name">{{ 'FORM.LABELS.EMPLOYEE_NAME' | translate }}</label>
<input type="text" class="form-control" name="display_name" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-display_name" ng-model="EmployeeCtrl.employee.display_name" required>
<div class="help-block" ng-messages="CreateForm.display_name.$error" ng-show="CreateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>
Expand Down Expand Up @@ -271,26 +255,10 @@ <h4>{{ 'EMPLOYEE.TITLE' | translate }}</h4>
<div class="panel-body">
<form class="panel-body" name="UpdateForm" ng-submit="EmployeeCtrl.submit(UpdateForm.$invalid)" bh-form-defaults novalidate>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.prenom.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.FIRST_NAME' | translate }}</label>
<input type="text" class="form-control" name="prenom" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-prenom" ng-model="EmployeeCtrl.employee.prenom" required>
<div class="help-block" ng-messages="UpdateForm.prenom.$error" ng-show="UpdateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.name.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.NAME' | translate }}</label>
<input type="text" class="form-control" name="name" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-name" ng-model="EmployeeCtrl.employee.name" required>
<div class="help-block" ng-messages="UpdateForm.name.$error" ng-show="UpdateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.postnom.$invalid }">
<label class="control-label" for="bhima-employee-prenom">{{ 'FORM.LABELS.LAST_NAME' | translate }}</label>
<input type="text" class="form-control" name="postnom" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-postnom" ng-model="EmployeeCtrl.employee.postnom" required>
<div class="help-block" ng-messages="UpdateForm.postnom.$error" ng-show="UpdateForm.$submitted">
<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.display_name.$invalid }">
<label class="control-label" for="bhima-employee-display_name">{{ 'FORM.LABELS.EMPLOYEE_NAME' | translate }}</label>
<input type="text" class="form-control" name="display_name" ng-maxlength="EmployeeCtrl.maxLength" id="bhima-employee-display_name" ng-model="EmployeeCtrl.employee.display_name" required>
<div class="help-block" ng-messages="UpdateForm.display_name.$error" ng-show="UpdateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>
Expand Down
12 changes: 0 additions & 12 deletions client/src/partials/employees/employees.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ function EmployeeController(Employees, Services, Grades, Functions, CreditorGrou
function refreshEmployees() {
return Employees.read()
.then(function (data) {
data.forEach(function (employee) {
employee.displayName = employee.prenom;

if (employee.prenom) {
employee.displayName += ', ' + employee.name;
}

if (employee.postnom) {
employee.displayName += ' - ' + employee.postnom;
}
});

vm.employees = data;
vm.loading = false;
});
Expand Down
2 changes: 1 addition & 1 deletion client/src/partials/fiscal/fiscal.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h4 style="margin-top : 0px;">
<i class="fa fa-clock-o"></i> {{ "FORM.INFO.CREATED" | translate }} <span am-time-ago="fiscal.created_at"></span>
{{ "FORM.INFO.BY" | translate }}
<a href="">
<i class="fa fa-user"></i> {{ fiscal.first }} {{ fiscal.last }}
<i class="fa fa-user"></i> {{ fiscal.display_name }}
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/partials/patient_invoice/patientInvoice.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ol class="headercrumb">
<li class="static">{{ "TREE.FINANCE" | translate }}</li>
<li class="title">{{ "PATIENT_INVOICE.PAGE_TITLE" | translate }}</li>
<li class="title" ng-show="PatientInvoiceCtrl.Invoice.recipient">{{ PatientInvoiceCtrl.Invoice.recipient.first_name }}</li>
<li class="title" ng-show="PatientInvoiceCtrl.Invoice.recipient">{{ PatientInvoiceCtrl.Invoice.recipient.display_name }}</li>
</ol>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/partials/patient_invoice/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function InvoiceRegistryController(Invoices, Notify, Session, util, Receipt, App
{ field : 'patientNames', displayName : 'TABLE.COLUMNS.PATIENT', headerCellFilter : 'translate' },
{ field : 'cost', displayName : 'TABLE.COLUMNS.COST', headerCellFilter : 'translate', cellTemplate: costTemplate },
{ field : 'serviceName', displayName : 'TABLE.COLUMNS.SERVICE', headerCellFilter : 'translate' },
{ field : 'createdBy', displayName : 'TABLE.COLUMNS.BY', headerCellFilter : 'translate' },
{ field : 'display_name', displayName : 'TABLE.COLUMNS.BY', headerCellFilter : 'translate' },
{ name : 'Actions', displayName : '', cellTemplate : invoiceActionsTemplate }
],
enableSorting : true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
class="form-control"
name="user"
ng-model="ModalCtrl.params.user_id"
ng-options="u.id as u.displayName for u in ModalCtrl.users | orderBy:'displayName'">
ng-options="u.id as u.display_name for u in ModalCtrl.users | orderBy:'display_name'">
<option value="" disabled>{{ 'FORM.SELECT.USER' | translate }}</option>
</select>
</div>
Expand Down
38 changes: 5 additions & 33 deletions client/src/partials/patients/edit/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,43 +110,15 @@
</div>
</div>

<!-- Last Name -->
<!-- Display Name -->
<div
class="form-group has-feedback"
ng-class="{'has-error' : patientDetails.last_name.$invalid && patientDetails.$submitted}">
ng-class="{'has-error' : patientDetails.display_name.$invalid && patientDetails.$submitted}">

<label for="second-name" class="col-md-3 control-label">{{ "FORM.LABELS.SECOND_NAME" | translate }} </label>
<label for="display_name" class="col-md-3 control-label">{{ "FORM.LABELS.SECOND_NAME" | translate }} </label>
<div class="col-md-9">
<input id="second-name" class="form-control" ng-maxlength="PatientEditCtrl.length150" name="last_name" ng-model="PatientEditCtrl.medical.last_name" required>
<div class="help-block" ng-messages="patientDetails.last_name.$error" ng-show="patientDetails.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>
</div>

<!-- Middle Name -->
<div
class="form-group has-feedback"
ng-class="{'has-error' : patientDetails.middle_name.$invalid && patientDetails.$submitted}">

<label for="middle-name" class="col-md-3 control-label">{{ "FORM.LABELS.MIDDLE_NAME" | translate }}</label>
<div class="col-md-9">
<input id="middle-name" class="form-control" name="middle_name" ng-maxlength="PatientEditCtrl.length150" ng-model="PatientEditCtrl.medical.middle_name" required>
<div class="help-block" ng-messages="patientDetails.middle_name.$error" ng-show="patientDetails.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>
</div>

<!-- First Name -->
<div
class="form-group has-feedback"
ng-class="{'has-error' : patientDetails.first_name.$invalid && patientDetails.$submitted}">

<label for="new-first-name" class="col-md-3 control-label">{{ "FORM.LABELS.FIRST_NAME" | translate }}</label>
<div class="col-md-9">
<input id="new-first-name" class="form-control" name="first_name" ng-maxlength="PatientEditCtrl.length150" ng-model="PatientEditCtrl.medical.first_name">
<div class="help-block" ng-messages="patientDetails.first_name.$error" ng-show="patientDetails.$submitted">
<input id="display_name" class="form-control" ng-maxlength="PatientEditCtrl.length150" name="display_name" ng-model="PatientEditCtrl.medical.display_name" required>
<div class="help-block" ng-messages="patientDetails.display_name.$error" ng-show="patientDetails.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions client/src/partials/patients/edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function PatientEdit($stateParams, patients, util, moment, Notify, ScrollTo, Gro
patient.dob = new Date(patient.dob);

// Assign name
patient.name = patient.first_name.concat(
' ', patient.middle_name,
' ', patient.last_name);
patient.name = patient.display_name;

patient.displayGender = patient.sex;
patient.displayAge = moment().diff(patient.dob, 'years');
Expand Down
2 changes: 1 addition & 1 deletion client/src/partials/patients/record/patient_record.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function PatientRecordController($stateParams, Patients, Notify, moment, Upload,
}

/** @todo move to service or mysql query */
vm.patient.name = [vm.patient.first_name, vm.patient.middle_name, vm.patient.last_name].join(' ');
vm.patient.name = vm.patient.display_name;
vm.patient.age = moment().diff(vm.patient.dob, 'years');
})
.catch(function (error) {
Expand Down
Loading