14 lines
411 B
JavaScript
14 lines
411 B
JavaScript
export const getEmployeeFromPrice = (priceUUID, selfUser) => {
|
|
const employees = selfUser && selfUser.client && selfUser.client.employees;
|
|
let matchEmployee = null;
|
|
employees.forEach(employee => {
|
|
const priceMatch = employee.prices.filter(price => {
|
|
return price.uuid === priceUUID;
|
|
});
|
|
if (priceMatch.length > 0) {
|
|
matchEmployee = employee;
|
|
}
|
|
});
|
|
return matchEmployee;
|
|
};
|