Merge branch 'feature/payroll' into feature/america
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Dinero from "dinero.js";
|
||||
import { Card } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||
import _ from "lodash";
|
||||
import CustomTooltip from "./chart-custom-tooltip";
|
||||
|
||||
const graphProps = {
|
||||
@@ -71,7 +71,9 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
|
||||
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
val
|
||||
),
|
||||
) +
|
||||
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
1
|
||||
),
|
||||
accHrs: _.round(
|
||||
|
||||
@@ -15,6 +15,7 @@ import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycen
|
||||
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
||||
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
||||
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
||||
import ShopInfoTaskPresets from "./shop-info.task-presets.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -83,6 +84,12 @@ export function ShopInfoComponent({ bodyshop, form, saveLoading }) {
|
||||
<ShopInfoPartsScan form={form} />
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
<Tabs.TabPane
|
||||
key="task-presets"
|
||||
tab={t("bodyshop.labels.task-presets")}
|
||||
>
|
||||
<ShopInfoTaskPresets form={form} />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Col,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Row,
|
||||
Space,
|
||||
} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function ShopInfoTaskPresets({ form }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<LayoutFormRow header={t("bodyshop.labels.md_tasks_presets")}>
|
||||
<Form.List name={["md_tasks_presets", "presets"]}>
|
||||
{(fields, { add, remove, move }) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<LayoutFormRow noDivider>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.md_tasks_presets.name")}
|
||||
key={`${index}name`}
|
||||
name={[field.name, "name"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.md_tasks_presets.hourstype")}
|
||||
key={`${index}hourstype`}
|
||||
name={[field.name, "hourstype"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox.Group>
|
||||
<Row>
|
||||
<Col span={8}>
|
||||
<Checkbox
|
||||
value="LAB"
|
||||
style={{ lineHeight: "32px" }}
|
||||
>
|
||||
{t("joblines.fields.lbr_types.LAB")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Checkbox
|
||||
value="LAR"
|
||||
style={{ lineHeight: "32px" }}
|
||||
>
|
||||
{t("joblines.fields.lbr_types.LAR")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Checkbox
|
||||
value="LAM"
|
||||
style={{ lineHeight: "32px" }}
|
||||
>
|
||||
{t("joblines.fields.lbr_types.LAM")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Checkbox
|
||||
value="LAF"
|
||||
style={{ lineHeight: "32px" }}
|
||||
>
|
||||
{t("joblines.fields.lbr_types.LAF")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Checkbox
|
||||
value="LAG"
|
||||
style={{ lineHeight: "32px" }}
|
||||
>
|
||||
{t("joblines.fields.lbr_types.LAG")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
</Row>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.md_tasks_presets.percent")}
|
||||
key={`${index}percent`}
|
||||
name={[field.name, "percent"]}
|
||||
>
|
||||
<InputNumber min={0} max={100} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.md_tasks_presets.memo")}
|
||||
key={`${index}memo`}
|
||||
name={[field.name, "memo"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Space wrap>
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
<FormListMoveArrows
|
||||
move={move}
|
||||
index={index}
|
||||
total={fields.length}
|
||||
/>
|
||||
</Space>
|
||||
</LayoutFormRow>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("bodyshop.actions.add_task_preset")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</LayoutFormRow>
|
||||
);
|
||||
}
|
||||
@@ -52,6 +52,10 @@ export function TimeTickeTaskModalContainer({
|
||||
});
|
||||
|
||||
async function handleFinish(values) {
|
||||
console.log(
|
||||
"🚀 ~ file: time-ticket-task-modal.container.jsx:55 ~ handleFinish ~ values:",
|
||||
values
|
||||
);
|
||||
try {
|
||||
if (true) {
|
||||
const result = await insertTimeTicketApproval({
|
||||
@@ -112,7 +116,6 @@ export function TimeTickeTaskModalContainer({
|
||||
}, [context.jobid, queryJobInfo, visible]);
|
||||
|
||||
const calculateTimeTickets = (presetMemo) => {
|
||||
console.log("🚀 ~ file: time-ticket-task-modal.container.jsx:115 ~ calculateTimeTickets ~ presetMemo:", presetMemo)
|
||||
const formData = form.getFieldsValue();
|
||||
if (
|
||||
!formData.jobid ||
|
||||
@@ -147,7 +150,7 @@ export function TimeTickeTaskModalContainer({
|
||||
jobid: formData.jobid,
|
||||
rate: e.labor_rates[hourstype],
|
||||
actualhrs: 0,
|
||||
memo: presetMemo,
|
||||
memo: typeof presetMemo === "string" ? presetMemo : "",
|
||||
flat_rate: true,
|
||||
ciecacode: hourstype,
|
||||
cost_center:
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
import { Button, Dropdown } from "antd";
|
||||
import React from "react";
|
||||
|
||||
export default function TimeTicketsTasksPresets({
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(TimeTicketsTasksPresets);
|
||||
|
||||
export function TimeTicketsTasksPresets({
|
||||
bodyshop,
|
||||
form,
|
||||
calculateTimeTickets,
|
||||
}) {
|
||||
const handleClick = (props) => {
|
||||
const preset = samplePresets.find((p) => {
|
||||
const preset = bodyshop.md_tasks_presets?.presets?.find((p) => {
|
||||
return p.name === props.key;
|
||||
});
|
||||
|
||||
@@ -24,7 +40,12 @@ export default function TimeTicketsTasksPresets({
|
||||
<Dropdown
|
||||
trigger="click"
|
||||
menu={{
|
||||
items: samplePresets.map((p) => ({ label: p.name, key: p.name })),
|
||||
items: bodyshop.md_tasks_presets?.presets
|
||||
? bodyshop.md_tasks_presets?.presets?.map((p) => ({
|
||||
label: p.name,
|
||||
key: p.name,
|
||||
}))
|
||||
: [],
|
||||
onClick: handleClick,
|
||||
}}
|
||||
>
|
||||
@@ -33,19 +54,19 @@ export default function TimeTicketsTasksPresets({
|
||||
);
|
||||
}
|
||||
|
||||
const samplePresets = [
|
||||
{
|
||||
name: "Teardown",
|
||||
hourstype: ["LAB", "LAM"],
|
||||
percent: 10,
|
||||
memo: "Teardown Preset Task",
|
||||
},
|
||||
{
|
||||
name: "Disassembly",
|
||||
hourstype: ["LAB", "LAD"],
|
||||
percent: 20,
|
||||
memo: "Disassy Preset Claim",
|
||||
},
|
||||
{ name: "Body", hourstype: ["LAB", "LAD"], percent: 20 },
|
||||
{ name: "Prep", hourstype: ["LAR"], percent: 20 },
|
||||
];
|
||||
// const samplePresets = [
|
||||
// {
|
||||
// name: "Teardown",
|
||||
// hourstype: ["LAB", "LAM"],
|
||||
// percent: 10,
|
||||
// memo: "Teardown Preset Task",
|
||||
// },
|
||||
// {
|
||||
// name: "Disassembly",
|
||||
// hourstype: ["LAB", "LAD"],
|
||||
// percent: 20,
|
||||
// memo: "Disassy Preset Claim",
|
||||
// },
|
||||
// { name: "Body", hourstype: ["LAB", "LAD"], percent: 20 },
|
||||
// { name: "Prep", hourstype: ["LAR"], percent: 20 },
|
||||
// ];
|
||||
|
||||
Reference in New Issue
Block a user