Added additional stats and ticket printing to all time tickets screen BOD-191
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
import { Select, Tag } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState, forwardRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
const { Option } = Select;
|
||||
//To be used as a form element only.
|
||||
|
||||
const EmployeeSearchSelect = ({
|
||||
value,
|
||||
onChange,
|
||||
options,
|
||||
onSelect,
|
||||
onBlur,
|
||||
}) => {
|
||||
const EmployeeSearchSelect = (
|
||||
{ value, onChange, options, onSelect, onBlur },
|
||||
ref
|
||||
) => {
|
||||
const [option, setOption] = useState(value);
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
@@ -28,25 +25,23 @@ const EmployeeSearchSelect = ({
|
||||
width: 400,
|
||||
}}
|
||||
onChange={setOption}
|
||||
optionFilterProp="search"
|
||||
optionFilterProp='search'
|
||||
onSelect={onSelect}
|
||||
onBlur={onBlur}
|
||||
>
|
||||
onBlur={onBlur}>
|
||||
{options
|
||||
? options.map((o) => (
|
||||
<Option
|
||||
key={o.id}
|
||||
value={o.id}
|
||||
search={`${o.employee_number} ${o.first_name} ${o.last_name}`}
|
||||
discount={o.discount}
|
||||
>
|
||||
discount={o.discount}>
|
||||
<div style={{ display: "flex" }}>
|
||||
{`${o.employee_number} ${o.first_name} ${o.last_name}`}
|
||||
<Tag color="blue">{o.cost_center}</Tag>
|
||||
<Tag color="red">
|
||||
<Tag color='blue'>{o.cost_center}</Tag>
|
||||
<Tag color='red'>
|
||||
<CurrencyFormatter>{o.base_rate}</CurrencyFormatter>
|
||||
</Tag>
|
||||
<Tag color="green">
|
||||
<Tag color='green'>
|
||||
{o.flat_rate
|
||||
? t("timetickets.labels.flat_rate")
|
||||
: t("timetickets.labels.straight_time")}
|
||||
@@ -58,4 +53,4 @@ const EmployeeSearchSelect = ({
|
||||
</Select>
|
||||
);
|
||||
};
|
||||
export default EmployeeSearchSelect;
|
||||
export default forwardRef(EmployeeSearchSelect);
|
||||
|
||||
Reference in New Issue
Block a user