user salary

dilmurod
Dilmurod 2 weeks ago
parent 147901540a
commit f7f12035b9

@ -75,10 +75,10 @@ const Stat = () => {
} }
}; };
const datePick = (a: any, b: any) => { const datePick = (dates: any) => {
if (b[0] && b[1]) { if (dates && dates[0] && dates[1]) {
setStartDate(`${b[0]} 00:00:00`); setStartDate(dates[0].startOf("day").format("YYYY-MM-DD HH:mm:ss"));
setEndDate(`${b[1]} 23:59:59`); setEndDate(dates[1].endOf("day").format("YYYY-MM-DD HH:mm:ss"));
} }
}; };
@ -89,22 +89,22 @@ const Stat = () => {
} else { } else {
const firstDate = date; const firstDate = date;
const secondDate = date?.add(1, "month"); const secondDate = date?.add(1, "month");
const yearStart = Number(firstDate?.year()); // const yearStart = Number(firstDate?.year());
const monthStart = Number(firstDate?.month()) + 1; // const monthStart = Number(firstDate?.month()) + 1;
const yearEnd = Number(secondDate?.year()); // const yearEnd = Number(secondDate?.year());
const monthEnd = Number(secondDate?.month()) + 1; // const monthEnd = Number(secondDate?.month()) + 1;
setStartDate(`${yearStart}-${monthStart}-01 00:00:00`); // setStartDate(`${yearStart}-${monthStart}-01 00:00:00`);
setEndDate(`${yearEnd}-${monthEnd}-01 00:00:00`); // setEndDate(`${yearEnd}-${monthEnd}-01 00:00:00`);
const formattedStartDate = firstDate.format("YYYY-MM-DD");
const formattedEndDate = secondDate.format("YYYY-MM-DD");
setStartDate(formattedStartDate);
setEndDate(formattedEndDate);
setForSalary(true); setForSalary(true);
} }
}; };
const clearDatePcker = () => {
setStartDate("");
setEndDate("");
};
const { data, refetch, isLoading } = useStatsData({ const { data, refetch, isLoading } = useStatsData({
search: search, search: search,
team: team, team: team,
@ -138,6 +138,10 @@ const Stat = () => {
}; };
const theme = localStorage.getItem("theme") === "true" ? true : false; const theme = localStorage.getItem("theme") === "true" ? true : false;
const disabledDate = (current: any) => {
return current && current >= moment().add(1, "month").startOf("month");
};
// const chartData = [ // const chartData = [
// { // {
// date: "2024-12-01", // date: "2024-12-01",
@ -226,8 +230,11 @@ const Stat = () => {
onChange={onChangeDate} onChange={onChangeDate}
picker="month" picker="month"
format={"MMMM"} format={"MMMM"}
disabledDate={disabledDate}
defaultValue={now} defaultValue={now}
style={{ marginRight: 10, width: 120, marginBottom: 10 }} style={{ marginRight: 10, width: 120, marginBottom: 10 }}
// value={datePickerValue}
// defaultValue={dayjs().startOf("month")}
/> />
<RangePicker style={{ width: 260 }} onCalendarChange={datePick} /> <RangePicker style={{ width: 260 }} onCalendarChange={datePick} />
</div> </div>
@ -252,7 +259,7 @@ const Stat = () => {
</div> </div>
<Select <Select
style={{ width: 260 }} style={{ width: 260 }}
placeholder="team" placeholder="Team"
onChange={(value: any) => setTeam(value)} onChange={(value: any) => setTeam(value)}
options={teamOptions} options={teamOptions}
/> />

@ -5,6 +5,7 @@ import {
RefetchOptions, RefetchOptions,
RefetchQueryFilters, RefetchQueryFilters,
} from "react-query"; } from "react-query";
import { QuestionCircleOutlined, QuestionOutlined } from "@ant-design/icons";
// @ts-ignore // @ts-ignore
import tagIcon from "../../assets/tagIcon.png"; import tagIcon from "../../assets/tagIcon.png";
@ -60,24 +61,31 @@ const StatTable = ({
key: "total_points", key: "total_points",
}, },
{ {
title: "Salary", title: (
<div>
<span>Salary</span> &nbsp;&nbsp;
<Tooltip title="The calculation of salary begins at the start of the month and continues to the current day. Select a month to review salary details for prior periods.">
<QuestionCircleOutlined />
</Tooltip>
</div>
),
dataIndex: "salary", dataIndex: "salary",
key: "salary", key: "salary",
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<Tooltip <Tooltip
title={ title={
<div> <div>
{record.salary_type === "Hybrid" ? ( {record.salary_type === "hybrid" ? (
<p> <p>
<strong>Base Amount:</strong>{" "} <strong>Base Amount:</strong> $
${record.salary_base_amount} {record.salary_base_amount}
</p> </p>
) : ( ) : (
"" ""
)} )}
<p> <p>
<strong>Performance based amount:</strong>{" "} <strong>Performance based amount:</strong> $
${record.salary - record.salary_base_amount} {record.performance_based_amount}
</p> </p>
</div> </div>
} }
@ -113,3 +121,5 @@ const StatTable = ({
}; };
export default StatTable; export default StatTable;
// The calculation of salary begins at the start of the month and continues to the current day. Select a month to review salary details for prior periods.

@ -87,13 +87,16 @@ const UserEdit = () => {
const [showInput, setShowInput] = useState(false); const [showInput, setShowInput] = useState(false);
const handleChange = (value: string) => { const handleChange = (value: string) => {
// Agar Hybrid bo'lsa, inputni ko'rsatish; Task based bo'lsa, yashirish if (data?.role.name === "Checker") {
setShowInput(value === "hybrid"); setShowInput(value === "hybrid");
}
}; };
useEffect(() => { useEffect(() => {
if (data?.salary_type === "hybrid") { if (data?.role.name === "Checker" && data?.salary_type === "hybrid") {
setShowInput(true); setShowInput(true);
} else if (data?.role.name !== "Checker") {
setShowInput(false);
} }
}, [data]); }, [data]);
@ -198,12 +201,12 @@ const UserEdit = () => {
</Col> </Col>
)} )}
{data.role.name === "Checker" && ( {data?.role?.name === "Checker" && (
<Col span={4}> <Col span={4}>
<Form.Item <Form.Item
wrapperCol={{ span: "100%" }} wrapperCol={{ span: "100%" }}
label="Salary type" label="Salary type"
name="salary_type" // Form ma'lumotlarini yuborish uchun 'name' qo'shilgan name="salary_type"
> >
<Select <Select
onChange={handleChange} onChange={handleChange}

Loading…
Cancel
Save