Removed nivo package. Added saving info on multiple time ticket entry with issues BOD-224

This commit is contained in:
Patrick Fic
2020-08-04 16:37:16 -07:00
parent e8e7e76473
commit 0af4ffc9f0
6 changed files with 30 additions and 254 deletions

View File

@@ -1,61 +1,13 @@
import React from "react";
import { useTranslation } from "react-i18next";
import CardTemplate from "./job-detail-cards.template.component";
import { Pie } from "@nivo/pie";
export default function JobDetailCardsPartsComponent({ loading, data }) {
const { t } = useTranslation();
const commonProperties = {
width: 225,
height: 225,
margin: { top: 20, right: 30, bottom: 20, left: 30 },
animate: true
};
const cdata = [
{
id: "elixir",
label: "elixir",
value: 558,
color: "hsl(21, 70%, 50%)"
},
{
id: "erlang",
label: "erlang",
value: 443,
color: "hsl(91, 70%, 50%)"
},
{
id: "css",
label: "css",
value: 161,
color: "hsl(271, 70%, 50%)"
},
{
id: "python",
label: "python",
value: 305,
color: "hsl(33, 70%, 50%)"
},
{
id: "php",
label: "php",
value: 360,
color: "hsl(296, 70%, 50%)"
}
];
return (
<div>
<CardTemplate loading={loading} title={t("jobs.labels.cards.parts")}>
<Pie
{...commonProperties}
data={cdata}
innerRadius={0.5}
padAngle={2}
cornerRadius={5}
enableRadialLabels={false}
/>
Placeholder piechart.
</CardTemplate>
</div>
);

View File

@@ -1,4 +1,3 @@
import { Pie } from "@nivo/pie";
import React from "react";
export default function PartsStatusPie({ partsList }) {
@@ -22,12 +21,5 @@ export default function PartsStatusPie({ partsList }) {
};
});
const commonProperties = {
width: 250,
height: 250,
margin: { top: 40, right: 60, bottom: 40, left: 60 },
animate: true,
};
return <Pie {...commonProperties} data={pieData} innerRadius={0.5} />;
return <div>{JSON.stringify(pieData)}</div>;
}

View File

@@ -73,7 +73,11 @@ export function TimeTicketModalContainer({
});
if (timeTicketModal.actions.refetch) timeTicketModal.actions.refetch();
if (enterAgain) {
//Capture the existing information and repopulate it.
const prev = form.getFieldsValue(["jobid", "employeeid", "date"]);
form.resetFields();
form.setFieldsValue(prev);
} else {
toggleModalVisible();
}
@@ -151,16 +155,18 @@ export function TimeTicketModalContainer({
</Button>
{timeTicketModal.context && timeTicketModal.context.id ? null : (
<Button
type='primary'
type="primary"
onClick={() => {
setEnterAgain(true);
}}>
}}
>
{t("general.actions.saveandnew")}
</Button>
)}
</span>
}
destroyOnClose>
destroyOnClose
>
<Form
onFinish={handleFinish}
autoComplete={"off"}
@@ -179,7 +185,8 @@ export function TimeTicketModalContainer({
}
: { jobid: timeTicketModal.context.jobId || null }
}
onValuesChange={handleFieldsChange}>
onValuesChange={handleFieldsChange}
>
<TimeTicketModalComponent
form={form}
roAutoCompleteOptions={RoAutoCompleteData && RoAutoCompleteData.jobs}