IO-306 Furhter dashboard development
This commit is contained in:
@@ -10532,6 +10532,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>errors</name>
|
<name>errors</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>refreshrequired</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>updatinglayout</name>
|
<name>updatinglayout</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -32,13 +32,9 @@ export default function DashboardMonthlyLaborSales({ data, ...cardProps }) {
|
|||||||
return {
|
return {
|
||||||
name: t(`joblines.fields.lbr_types.${key.toUpperCase()}`),
|
name: t(`joblines.fields.lbr_types.${key.toUpperCase()}`),
|
||||||
value: laborData[key].getAmount() / 100,
|
value: laborData[key].getAmount() / 100,
|
||||||
// color: pieColor(i.status),
|
color: pieColor(key.toUpperCase()),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: monthly-parts-sales.component.jsx ~ line 34 ~ chartData",
|
|
||||||
chartData
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title={t("dashboard.titles.monthlylaborsales")} {...cardProps}>
|
<Card title={t("dashboard.titles.monthlylaborsales")} {...cardProps}>
|
||||||
@@ -72,36 +68,56 @@ export const DashboardMonthlyRevenueGraphGql = `
|
|||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const pieColor = (type) => {
|
||||||
|
if (type === "LAA") return "lightgreen";
|
||||||
|
else if (type === "LAB") return "dodgerblue";
|
||||||
|
else if (type === "LAD") return "aliceblue";
|
||||||
|
else if (type === "LAE") return "seafoam";
|
||||||
|
else if (type === "LAG") return "chartreuse";
|
||||||
|
else if (type === "LAF") return "magenta";
|
||||||
|
else if (type === "LAM") return "gold";
|
||||||
|
else if (type === "LAR") return "crimson";
|
||||||
|
else if (type === "LAU") return "slategray";
|
||||||
|
else if (type === "LA1") return "slategray";
|
||||||
|
else if (type === "LA2") return "slategray";
|
||||||
|
else if (type === "LA3") return "slategray";
|
||||||
|
else if (type === "LA4") return "slategray";
|
||||||
|
return "slategray";
|
||||||
|
};
|
||||||
|
|
||||||
const renderActiveShape = (props) => {
|
const renderActiveShape = (props) => {
|
||||||
const RADIAN = Math.PI / 180;
|
//const RADIAN = Math.PI / 180;
|
||||||
const {
|
const {
|
||||||
cx,
|
cx,
|
||||||
cy,
|
cy,
|
||||||
midAngle,
|
//midAngle,
|
||||||
innerRadius,
|
innerRadius,
|
||||||
outerRadius,
|
outerRadius,
|
||||||
startAngle,
|
startAngle,
|
||||||
endAngle,
|
endAngle,
|
||||||
fill,
|
fill,
|
||||||
payload,
|
payload,
|
||||||
percent,
|
// percent,
|
||||||
value,
|
value,
|
||||||
} = props;
|
} = props;
|
||||||
const sin = Math.sin(-RADIAN * midAngle);
|
// const sin = Math.sin(-RADIAN * midAngle);
|
||||||
const cos = Math.cos(-RADIAN * midAngle);
|
// const cos = Math.cos(-RADIAN * midAngle);
|
||||||
const sx = cx + (outerRadius + 10) * cos;
|
// // const sx = cx + (outerRadius + 10) * cos;
|
||||||
const sy = cy + (outerRadius + 10) * sin;
|
// const sy = cy + (outerRadius + 10) * sin;
|
||||||
const mx = cx + (outerRadius + 30) * cos;
|
// const mx = cx + (outerRadius + 30) * cos;
|
||||||
const my = cy + (outerRadius + 30) * sin;
|
// const my = cy + (outerRadius + 30) * sin;
|
||||||
const ex = mx + (cos >= 0 ? 1 : -1) * 22;
|
// //const ex = mx + (cos >= 0 ? 1 : -1) * 22;
|
||||||
const ey = my;
|
// const ey = my;
|
||||||
const textAnchor = cos >= 0 ? "start" : "end";
|
//const textAnchor = cos >= 0 ? "start" : "end";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<g>
|
<g>
|
||||||
<text x={cx} y={cy} dy={8} textAnchor="middle" fill={fill}>
|
<text x={cx} y={cy} dy={0} textAnchor="middle" fill={fill}>
|
||||||
{payload.name}
|
{payload.name}
|
||||||
</text>
|
</text>
|
||||||
|
<text x={cx} y={cy} dy={16} textAnchor="middle" fill={fill}>
|
||||||
|
{Dinero({ amount: Math.round(value * 100) }).toFormat()}
|
||||||
|
</text>
|
||||||
<Sector
|
<Sector
|
||||||
cx={cx}
|
cx={cx}
|
||||||
cy={cy}
|
cy={cy}
|
||||||
@@ -120,29 +136,28 @@ const renderActiveShape = (props) => {
|
|||||||
outerRadius={outerRadius + 10}
|
outerRadius={outerRadius + 10}
|
||||||
fill={fill}
|
fill={fill}
|
||||||
/>
|
/>
|
||||||
<path
|
|
||||||
d={`M${sx},${sy}L${mx},${my}L${ex},${ey}`}
|
|
||||||
stroke={fill}
|
|
||||||
fill="none"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<text
|
|
||||||
x={ex + (cos >= 0 ? 1 : -1) * 12}
|
|
||||||
y={ey}
|
|
||||||
textAnchor={textAnchor}
|
|
||||||
fill="#333"
|
|
||||||
>
|
|
||||||
{payload.name}
|
|
||||||
</text>
|
|
||||||
<text
|
|
||||||
x={ex + (cos >= 0 ? 1 : -1) * 12}
|
|
||||||
y={ey}
|
|
||||||
dy={18}
|
|
||||||
textAnchor={textAnchor}
|
|
||||||
fill="#999"
|
|
||||||
>
|
|
||||||
{Dinero({ amount: Math.round(value * 100) }).toFormat()}
|
|
||||||
</text>
|
|
||||||
</g>
|
</g>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
// <path
|
||||||
|
// d={`M${sx},${sy}L${mx},${my}L${ex},${ey}`}
|
||||||
|
// stroke={fill}
|
||||||
|
// fill="none"
|
||||||
|
// />;
|
||||||
|
// <text
|
||||||
|
// x={ex + (cos >= 0 ? 1 : -1) * 12}
|
||||||
|
// y={ey}
|
||||||
|
// textAnchor={textAnchor}
|
||||||
|
// fill="#333"
|
||||||
|
// >
|
||||||
|
// {payload.name}
|
||||||
|
// </text>
|
||||||
|
// <text
|
||||||
|
// x={ex + (cos >= 0 ? 1 : -1) * 12}
|
||||||
|
// y={ey}
|
||||||
|
// dy={18}
|
||||||
|
// textAnchor={textAnchor}
|
||||||
|
// fill="#999"
|
||||||
|
// >
|
||||||
|
// {Dinero({ amount: Math.round(value * 100) }).toFormat()}
|
||||||
|
// </text>
|
||||||
|
|||||||
@@ -29,13 +29,9 @@ export default function DashboardMonthlyPartsSales({ data, ...cardProps }) {
|
|||||||
return {
|
return {
|
||||||
name: t(`joblines.fields.part_types.${key.toUpperCase()}`),
|
name: t(`joblines.fields.part_types.${key.toUpperCase()}`),
|
||||||
value: partData[key].getAmount() / 100,
|
value: partData[key].getAmount() / 100,
|
||||||
// color: pieColor(i.status),
|
color: pieColor(key.toUpperCase()),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: monthly-parts-sales.component.jsx ~ line 34 ~ chartData",
|
|
||||||
chartData
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title={t("dashboard.titles.monthlypartssales")} {...cardProps}>
|
<Card title={t("dashboard.titles.monthlypartssales")} {...cardProps}>
|
||||||
@@ -68,37 +64,55 @@ export default function DashboardMonthlyPartsSales({ data, ...cardProps }) {
|
|||||||
export const DashboardMonthlyRevenueGraphGql = `
|
export const DashboardMonthlyRevenueGraphGql = `
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
const pieColor = (type) => {
|
||||||
|
if (type === "PAA") return "darkgreen";
|
||||||
|
else if (type === "PAC") return "green";
|
||||||
|
else if (type === "PAE") return "gold";
|
||||||
|
else if (type === "PAG") return "seafoam";
|
||||||
|
else if (type === "PAL") return "chartreuse";
|
||||||
|
else if (type === "PAM") return "magenta";
|
||||||
|
else if (type === "PAN") return "crimson";
|
||||||
|
else if (type === "PAO") return "gold";
|
||||||
|
else if (type === "PAP") return "crimson";
|
||||||
|
else if (type === "PAR") return "indigo";
|
||||||
|
else if (type === "PAS") return "dodgerblue";
|
||||||
|
else if (type === "PASL") return "dodgerblue";
|
||||||
|
return "slategray";
|
||||||
|
};
|
||||||
|
|
||||||
const renderActiveShape = (props) => {
|
const renderActiveShape = (props) => {
|
||||||
const RADIAN = Math.PI / 180;
|
// const RADIAN = Math.PI / 180;
|
||||||
const {
|
const {
|
||||||
cx,
|
cx,
|
||||||
cy,
|
cy,
|
||||||
midAngle,
|
// midAngle,
|
||||||
innerRadius,
|
innerRadius,
|
||||||
outerRadius,
|
outerRadius,
|
||||||
startAngle,
|
startAngle,
|
||||||
endAngle,
|
endAngle,
|
||||||
fill,
|
fill,
|
||||||
payload,
|
payload,
|
||||||
percent,
|
// percent,
|
||||||
value,
|
value,
|
||||||
} = props;
|
} = props;
|
||||||
const sin = Math.sin(-RADIAN * midAngle);
|
// const sin = Math.sin(-RADIAN * midAngle);
|
||||||
const cos = Math.cos(-RADIAN * midAngle);
|
// const cos = Math.cos(-RADIAN * midAngle);
|
||||||
const sx = cx + (outerRadius + 10) * cos;
|
// const sx = cx + (outerRadius + 10) * cos;
|
||||||
const sy = cy + (outerRadius + 10) * sin;
|
//const sy = cy + (outerRadius + 10) * sin;
|
||||||
const mx = cx + (outerRadius + 30) * cos;
|
// const mx = cx + (outerRadius + 30) * cos;
|
||||||
const my = cy + (outerRadius + 30) * sin;
|
//const my = cy + (outerRadius + 30) * sin;
|
||||||
const ex = mx + (cos >= 0 ? 1 : -1) * 22;
|
// const ex = mx + (cos >= 0 ? 1 : -1) * 22;
|
||||||
const ey = my;
|
// const ey = my;
|
||||||
const textAnchor = cos >= 0 ? "start" : "end";
|
// const textAnchor = cos >= 0 ? "start" : "end";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<g>
|
<g>
|
||||||
<text x={cx} y={cy} dy={8} textAnchor="middle" fill={fill}>
|
<text x={cx} y={cy} dy={0} textAnchor="middle" fill={fill}>
|
||||||
{payload.name}
|
{payload.name}
|
||||||
</text>
|
</text>
|
||||||
|
<text x={cx} y={cy} dy={16} textAnchor="middle" fill={fill}>
|
||||||
|
{Dinero({ amount: Math.round(value * 100) }).toFormat()}
|
||||||
|
</text>
|
||||||
<Sector
|
<Sector
|
||||||
cx={cx}
|
cx={cx}
|
||||||
cy={cy}
|
cy={cy}
|
||||||
@@ -117,29 +131,6 @@ const renderActiveShape = (props) => {
|
|||||||
outerRadius={outerRadius + 10}
|
outerRadius={outerRadius + 10}
|
||||||
fill={fill}
|
fill={fill}
|
||||||
/>
|
/>
|
||||||
<path
|
|
||||||
d={`M${sx},${sy}L${mx},${my}L${ex},${ey}`}
|
|
||||||
stroke={fill}
|
|
||||||
fill="none"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<text
|
|
||||||
x={ex + (cos >= 0 ? 1 : -1) * 12}
|
|
||||||
y={ey}
|
|
||||||
textAnchor={textAnchor}
|
|
||||||
fill="#333"
|
|
||||||
>
|
|
||||||
{payload.name}
|
|
||||||
</text>
|
|
||||||
<text
|
|
||||||
x={ex + (cos >= 0 ? 1 : -1) * 12}
|
|
||||||
y={ey}
|
|
||||||
dy={18}
|
|
||||||
textAnchor={textAnchor}
|
|
||||||
fill="#999"
|
|
||||||
>
|
|
||||||
{Dinero({ amount: Math.round(value * 100) }).toFormat()}
|
|
||||||
</text>
|
|
||||||
</g>
|
</g>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
|
|||||||
type="monotone"
|
type="monotone"
|
||||||
name="Accumulated Sales"
|
name="Accumulated Sales"
|
||||||
dataKey="accSales"
|
dataKey="accSales"
|
||||||
fill="#8884d8"
|
fill="#3CB371"
|
||||||
stroke="#8884d8"
|
stroke="#3CB371"
|
||||||
/>
|
/>
|
||||||
<Bar
|
<Bar
|
||||||
name="Daily Sales"
|
name="Daily Sales"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Card, Typography } from "antd";
|
|
||||||
import { SyncOutlined } from "@ant-design/icons";
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
|
import { Card } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export default function DashboardRefreshRequired(props) {
|
export default function DashboardRefreshRequired(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -11,14 +11,14 @@ export default function DashboardRefreshRequired(props) {
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SyncOutlined />
|
<SyncOutlined style={{ fontSize: "300%", margin: "1rem" }} />
|
||||||
<Typography.Title level={4}>
|
<div>{t("dashboard.errors.refreshrequired")}</div>
|
||||||
{t("dashboard.errors.refreshrequired")}
|
|
||||||
</Typography.Title>
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -198,15 +198,19 @@ const componentList = {
|
|||||||
label: "Production Dollars",
|
label: "Production Dollars",
|
||||||
component: DashboardTotalProductionDollars,
|
component: DashboardTotalProductionDollars,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
w: 2,
|
w: 1,
|
||||||
h: 1,
|
h: 1,
|
||||||
|
minW: 2,
|
||||||
|
minH: 1,
|
||||||
},
|
},
|
||||||
ProductionHours: {
|
ProductionHours: {
|
||||||
label: "Production Hours",
|
label: "Production Hours",
|
||||||
component: DashboardTotalProductionHours,
|
component: DashboardTotalProductionHours,
|
||||||
gqlFragment: DashboardTotalProductionHoursGql,
|
gqlFragment: DashboardTotalProductionHoursGql,
|
||||||
w: 2,
|
w: 3,
|
||||||
h: 1,
|
h: 1,
|
||||||
|
minW: 3,
|
||||||
|
minH: 1,
|
||||||
},
|
},
|
||||||
ProjectedMonthlySales: {
|
ProjectedMonthlySales: {
|
||||||
label: "Projected Monthly Sales",
|
label: "Projected Monthly Sales",
|
||||||
@@ -214,6 +218,8 @@ const componentList = {
|
|||||||
gqlFragment: DashboardProjectedMonthlySalesGql,
|
gqlFragment: DashboardProjectedMonthlySalesGql,
|
||||||
w: 2,
|
w: 2,
|
||||||
h: 1,
|
h: 1,
|
||||||
|
minW: 2,
|
||||||
|
minH: 1,
|
||||||
},
|
},
|
||||||
MonthlyRevenueGraph: {
|
MonthlyRevenueGraph: {
|
||||||
label: "Monthly Sales Graph",
|
label: "Monthly Sales Graph",
|
||||||
@@ -254,12 +260,15 @@ const componentList = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createDashboardQuery = (state) => {
|
const createDashboardQuery = (state) => {
|
||||||
const componentBasedAdditions = state.layout
|
const componentBasedAdditions =
|
||||||
.map((item, index) => componentList[item.i].gqlFragment || "")
|
state &&
|
||||||
.join("");
|
Array.isArray(state.layout) &&
|
||||||
|
state.layout
|
||||||
|
.map((item, index) => componentList[item.i].gqlFragment || "")
|
||||||
|
.join("");
|
||||||
return gql`
|
return gql`
|
||||||
query QUERY_DASHBOARD_DETAILS {
|
query QUERY_DASHBOARD_DETAILS {
|
||||||
${componentBasedAdditions}
|
${componentBasedAdditions || ""}
|
||||||
monthly_sales: jobs(where: {_and: [{date_invoiced: {_gte: "${moment()
|
monthly_sales: jobs(where: {_and: [{date_invoiced: {_gte: "${moment()
|
||||||
.startOf("month")
|
.startOf("month")
|
||||||
.format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment()
|
.format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment()
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
|||||||
where: { scheduled_completion: { _gte: $start, _lte: $end } }
|
where: { scheduled_completion: { _gte: $start, _lte: $end } }
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
|
|
||||||
ro_number
|
ro_number
|
||||||
scheduled_completion
|
scheduled_completion
|
||||||
labhrs: joblines_aggregate(
|
labhrs: joblines_aggregate(
|
||||||
@@ -250,15 +249,9 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arrJobs: jobs(
|
arrJobs: jobs(where: { scheduled_in: { _gte: $start, _lte: $end } }) {
|
||||||
where: {
|
|
||||||
scheduled_in: { _gte: $start, _lte: $end }
|
|
||||||
removed: { _eq: false }
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
id
|
id
|
||||||
scheduled_in
|
scheduled_in
|
||||||
|
|
||||||
ro_number
|
ro_number
|
||||||
labhrs: joblines_aggregate(
|
labhrs: joblines_aggregate(
|
||||||
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
||||||
|
|||||||
@@ -668,6 +668,7 @@
|
|||||||
"addcomponent": "Add Component"
|
"addcomponent": "Add Component"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
"refreshrequired": "You must refresh the dashboard data to see this component.",
|
||||||
"updatinglayout": "Error saving updated layout {{message}}"
|
"updatinglayout": "Error saving updated layout {{message}}"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
@@ -668,6 +668,7 @@
|
|||||||
"addcomponent": ""
|
"addcomponent": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
"refreshrequired": "",
|
||||||
"updatinglayout": ""
|
"updatinglayout": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
@@ -668,6 +668,7 @@
|
|||||||
"addcomponent": ""
|
"addcomponent": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
"refreshrequired": "",
|
||||||
"updatinglayout": ""
|
"updatinglayout": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
Reference in New Issue
Block a user