Simplified profile page BOD-323

This commit is contained in:
Patrick Fic
2020-08-27 11:27:56 -07:00
parent 5c643515c0
commit 3150fdaade
13 changed files with 121 additions and 94 deletions

View File

@@ -19586,6 +19586,32 @@
</concept_node>
</children>
</folder_node>
<folder_node>
<name>labels</name>
<children>
<concept_node>
<name>activeshop</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>
</children>
</folder_node>
</children>
</folder_node>
<folder_node>
@@ -21464,6 +21490,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>profile</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>
<name>schedule</name>
<definition_loaded>false</definition_loaded>

View File

@@ -10,12 +10,13 @@ export default function ChatConversationTitle({ conversation }) {
<Space>
<strong>{conversation && conversation.phone_num}</strong>
<span>
{conversation.job_conversations.map(
(j) =>
`${j.job.ownr_fn || ""} ${j.job.ownr_ln || ""} ${
j.job.ownr_co_nm || ""
} | `
)}
{conversation &&
conversation.job_conversations.map(
(j) =>
`${j.job.ownr_fn || ""} ${j.job.ownr_ln || ""} ${
j.job.ownr_co_nm || ""
} | `
)}
</span>
</Space>
<div className="imex-flex-row imex-flex-row__margin">

View File

@@ -39,7 +39,10 @@ export default function ChatTagRoContainer({ conversation }) {
setVisible(false);
};
const existingJobTags = conversation.job_conversations.map((i) => i.jobid);
const existingJobTags =
conversation &&
conversation.job_conversations &&
conversation.job_conversations.map((i) => i.jobid);
const roOptions = data
? data.jobs.filter((job) => !existingJobTags.includes(job.id))

View File

@@ -170,9 +170,18 @@ function InvoiceEnterModalContainer({
(invoiceEnterModal.context.job &&
invoiceEnterModal.context.job.id) ||
null,
federal_tax_rate: bodyshop.invoice_tax_rates.federal_tax_rate || 0,
state_tax_rate: bodyshop.invoice_tax_rates.state_tax_rate || 0,
local_tax_rate: bodyshop.invoice_tax_rates.local_tax_rate || 0,
federal_tax_rate:
(bodyshop.invoice_tax_rates &&
bodyshop.invoice_tax_rates.federal_tax_rate) ||
0,
state_tax_rate:
(bodyshop.invoice_tax_rates &&
bodyshop.invoice_tax_rates.state_tax_rate) ||
0,
local_tax_rate:
(bodyshop.invoice_tax_rates &&
bodyshop.invoice_tax_rates.local_tax_rate) ||
0,
}}
>
<InvoiceFormContainer form={form} />

View File

@@ -1,20 +0,0 @@
import React from "react";
import { useTranslation } from "react-i18next";
import AlertComponent from "../alert/alert.component";
import ProfileMyComponent from "../profile-my/profile-my.component";
import ProfileShopsContainer from "../profile-shops/profile-shops.container";
export default function ProfileContent({ sidebarSelection }) {
const { t } = useTranslation();
switch (sidebarSelection.key) {
case "profile":
return <ProfileMyComponent />;
case "shops":
return <ProfileShopsContainer />;
default:
return (
<AlertComponent message={t("profile.errors.state")} type="error" />
);
}
}

View File

@@ -1,10 +1,10 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Table, Button } from "antd";
import { Table, Button, Typography } from "antd";
export default function ProfileShopsComponent({
loading,
data,
updateActiveShop
updateActiveShop,
}) {
const { t } = useTranslation();
@@ -14,14 +14,14 @@ export default function ProfileShopsComponent({
dataIndex: "shopname",
key: "shopname",
width: "25%",
render: (text, record) => <span>{record.bodyshop.shopname}</span>
render: (text, record) => <span>{record.bodyshop.shopname}</span>,
},
{
title: t("associations.fields.active"),
dataIndex: "active",
key: "active",
width: "25%",
render: (text, record) => <span>{record.active ? "Yes" : "No"}</span>
render: (text, record) => <span>{record.active ? "Yes" : "No"}</span>,
},
{
title: t("associations.labels.actions"),
@@ -36,15 +36,20 @@ export default function ProfileShopsComponent({
</Button>
)}
</span>
)
}
),
},
];
return (
<Table
title={() => (
<Typography.Title level={4}>
{t("profile.labels.activeshop")}
</Typography.Title>
)}
loading={loading}
size="small"
columns={columns.map(item => ({ ...item }))}
columns={columns.map((item) => ({ ...item }))}
rowKey="id"
dataSource={data}
/>

View File

@@ -1,35 +0,0 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Layout, Menu } from "antd";
import { UserOutlined, BankFilled } from "@ant-design/icons";
export default function ProfileSideBar({
sidebarSelection,
setSidebarSelection
}) {
const { t } = useTranslation();
const onMenuClick = e => {
setSidebarSelection({ ...sidebarSelection, key: e.key });
};
return (
<Layout.Sider>
<Menu
theme="dark"
selectedKeys={sidebarSelection.key}
onClick={onMenuClick}
mode="inline"
>
<Menu.Item key="profile">
<UserOutlined />
<span>{t("menus.profilesidebar.profile")}</span>
</Menu.Item>
<Menu.Item key="shops">
<BankFilled />
<span>{t("menus.profilesidebar.shops")}</span>
</Menu.Item>
</Menu>
</Layout.Sider>
);
}

View File

@@ -8,22 +8,24 @@ import ManagePage from "./manage.page.component";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import { useTranslation } from "react-i18next";
const mapDispatchToProps = dispatch => ({
setBodyshop: bs => dispatch(setBodyshop(bs))
const mapDispatchToProps = (dispatch) => ({
setBodyshop: (bs) => dispatch(setBodyshop(bs)),
});
function ManagePageContainer({ match, setBodyshop }) {
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
fetchPolicy: "network-only"
fetchPolicy: "network-only",
});
const { t } = useTranslation();
useEffect(() => {
if (data) setBodyshop(data.bodyshops[0]);
}, [data, setBodyshop]);
if (loading)
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
if (error) return <AlertComponent message={error.message} type='error' />;
if (error) return <AlertComponent message={error.message} type="error" />;
return <ManagePage match={match} />;
}

View File

@@ -1,11 +1,22 @@
import React, { useEffect } from "react";
import ProfilePage from "./profile.page";
import { useTranslation } from "react-i18next";
export default function ProfileContainerPage() {
import { connect } from "react-redux";
import { setBreadcrumbs } from "../../redux/application/application.actions";
import ProfilePage from "./profile.page";
const mapDispatchToProps = (dispatch) => ({
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
});
export function ProfileContainerPage({ setBreadcrumbs }) {
const { t } = useTranslation();
useEffect(() => {
setBreadcrumbs([
{ link: "/manage/profile", label: t("titles.bc.profile") },
]);
document.title = t("titles.profile");
}, [t]);
}, [t, setBreadcrumbs]);
return <ProfilePage />;
}
export default connect(null, mapDispatchToProps)(ProfileContainerPage);

View File

@@ -1,20 +1,12 @@
import { Layout } from "antd";
import React, { useState } from "react";
import ProfileContent from "../../components/profile-content/profile-content.component";
import ProfileSideBar from "../../components/profile-sidebar/profile-sidebar.component";
import React from "react";
import ProfileMyComponent from "../../components/profile-my/profile-my.component";
import ProfileShopsContainer from "../../components/profile-shops/profile-shops.container";
export default function ProfilePage() {
const [sidebarSelection, setSidebarSelection] = useState({ key: "profile" });
return (
<Layout>
<ProfileSideBar
sidebarSelection={sidebarSelection}
setSidebarSelection={setSidebarSelection}
/>
<Layout.Content>
<ProfileContent sidebarSelection={sidebarSelection} />
</Layout.Content>
</Layout>
<div>
<ProfileMyComponent />
<ProfileShopsContainer />;
</div>
);
}

View File

@@ -1203,6 +1203,9 @@
"profile": {
"errors": {
"state": "Error reading page state. Please refresh."
},
"labels": {
"activeshop": "Active Shop"
}
},
"scoreboard": {
@@ -1326,6 +1329,7 @@
"payments-all": "All Payments",
"productionboard": "Production Board - Visual",
"productionlist": "Production Board - List",
"profile": "My Profile",
"schedule": "Schedule",
"scoreboard": "Scoreboard",
"shop": "Manage my Shop ({{shopname}})",

View File

@@ -1203,6 +1203,9 @@
"profile": {
"errors": {
"state": "Error al leer el estado de la página. Porfavor refresca."
},
"labels": {
"activeshop": ""
}
},
"scoreboard": {
@@ -1326,6 +1329,7 @@
"payments-all": "",
"productionboard": "",
"productionlist": "",
"profile": "",
"schedule": "",
"scoreboard": "",
"shop": "",

View File

@@ -1203,6 +1203,9 @@
"profile": {
"errors": {
"state": "Erreur lors de la lecture de l'état de la page. Rafraichissez, s'il vous plait."
},
"labels": {
"activeshop": ""
}
},
"scoreboard": {
@@ -1326,6 +1329,7 @@
"payments-all": "",
"productionboard": "",
"productionlist": "",
"profile": "",
"schedule": "",
"scoreboard": "",
"shop": "",