update Employee field to show first and last name
This commit is contained in:
@@ -24,5 +24,52 @@ export const selectGettingRates = createSelector(
|
||||
);
|
||||
export const selectTechnician = createSelector(
|
||||
[selectEmployee],
|
||||
(employee) => employee.currentEmployee?.technician
|
||||
(employee) => {
|
||||
if (!employee.currentEmployee || !employee.currentEmployee.technician) {
|
||||
// console.info("selectTechnician returning null");
|
||||
return null;
|
||||
}
|
||||
// console.info("selectTechnician returning :", employee.currentEmployee.technician);
|
||||
return employee.currentEmployee.technician;
|
||||
}
|
||||
);
|
||||
export const selectEmployeeFirstName = createSelector(
|
||||
[selectTechnician],
|
||||
(techResults) => {
|
||||
if (!techResults || !techResults.first_name) {
|
||||
// console.info("selectEmployeeFirstName returning null");
|
||||
return null;
|
||||
}
|
||||
// console.info("selectEmployeeFirstName returning :", techResults.first_name);
|
||||
return techResults.first_name;
|
||||
}
|
||||
);
|
||||
export const selectEmployeeLastName = createSelector(
|
||||
[selectTechnician],
|
||||
(techResults) => {
|
||||
if (!techResults || !techResults.last_name) {
|
||||
// console.info("selectEmployeeLastName returning null");
|
||||
return null;
|
||||
}
|
||||
// console.info("selectEmployeeLastName returning :", techResults.last_name);
|
||||
return techResults.last_name;
|
||||
}
|
||||
);
|
||||
export const selectEmployeeFullName = createSelector(
|
||||
[selectEmployeeFirstName,selectEmployeeLastName],
|
||||
(fName,lName) => {
|
||||
if (!fName && !lName) {
|
||||
// console.warn("selectEmployeeFullName returning null");
|
||||
return null;
|
||||
}
|
||||
if (fName) {
|
||||
if(lName){
|
||||
return fName + " " + lName;
|
||||
} else {
|
||||
return fName;
|
||||
}
|
||||
} else {
|
||||
return lName;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user