WIP for viewing CSI question sets BOD-380
This commit is contained in:
@@ -4004,6 +4004,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>csiq</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>customtemplates</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -4025,6 +4046,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>employees</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>intake</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -4088,6 +4130,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>licensing</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>notemplatesavailable</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -6499,6 +6562,32 @@
|
||||
<folder_node>
|
||||
<name>csi</name>
|
||||
<children>
|
||||
<folder_node>
|
||||
<name>actions</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>activate</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>
|
||||
<folder_node>
|
||||
<name>errors</name>
|
||||
<children>
|
||||
@@ -7877,6 +7966,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>view</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>
|
||||
<folder_node>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import React from "react";
|
||||
import { Form } from "antd";
|
||||
import ConfigFormComponents from "../config-form-components/config-form-components.component";
|
||||
|
||||
export default function ShopCsiConfigForm({ selectedCsi }) {
|
||||
console.log("ShopCsiConfigForm -> selectedCsi", selectedCsi);
|
||||
const readOnly = !!selectedCsi;
|
||||
const [form] = Form.useForm();
|
||||
const handleFinish = (values) => {
|
||||
console.log("values :>> ", values);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
The Config Form {readOnly}
|
||||
{selectedCsi && (
|
||||
<Form form={form} onFinish={handleFinish}>
|
||||
<ConfigFormComponents
|
||||
readOnly={selectedCsi}
|
||||
componentList={selectedCsi.config}
|
||||
/>
|
||||
</Form>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { CheckCircleFilled } from "@ant-design/icons";
|
||||
import { Button, Col, List, Row } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useQuery } from "react-apollo";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { GET_ALL_QUESTION_SETS } from "../../graphql/csi.queries";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import ShopCsiConfigForm from "../shop-csi-config-form/shop-csi-config-form.component";
|
||||
|
||||
export default function ShopCsiConfig() {
|
||||
const { loading, error, data } = useQuery(GET_ALL_QUESTION_SETS);
|
||||
const [selectedCsi, setselectedCsi] = useState(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
return (
|
||||
<div>
|
||||
The Config Form
|
||||
<Row>
|
||||
<Col span={3}>
|
||||
<List
|
||||
dataSource={data ? data.csiquestions : []}
|
||||
renderItem={(item) => (
|
||||
<List.Item>
|
||||
<DateFormatter>{item.created_at}</DateFormatter>
|
||||
{item.csis_aggregate.aggregate.count}
|
||||
<Button onClick={() => setselectedCsi(item)}>
|
||||
{t("general.actions.view")}
|
||||
</Button>
|
||||
{item.current ? (
|
||||
<CheckCircleFilled />
|
||||
) : (
|
||||
<Button>{t("csi.actions.activate")}</Button>
|
||||
)}
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={21}>
|
||||
<ShopCsiConfigForm selectedCsi={selectedCsi} />
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -22,6 +22,22 @@ export const COMPLETE_SURVEY = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_ALL_QUESTION_SETS = gql`
|
||||
query GET_ALL_QUESTION_SETS {
|
||||
csiquestions(order_by: { created_at: desc }) {
|
||||
id
|
||||
created_at
|
||||
config
|
||||
current
|
||||
csis_aggregate {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_CURRENT_QUESTIONSET_ID = gql`
|
||||
query GET_CURRENT_QUESTIONSET_ID {
|
||||
csiquestions(where: { current: { _eq: true } }) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ShopEmployeesContainer from "../../components/shop-employees/shop-employees.container";
|
||||
import ShopInfoContainer from "../../components/shop-info/shop-info.container";
|
||||
import ShopCsiConfig from "../../components/shop-csi-config/shop-csi-config.component";
|
||||
|
||||
export default function ShopPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -12,15 +13,18 @@ export default function ShopPage() {
|
||||
|
||||
return (
|
||||
<Tabs>
|
||||
<Tabs.TabPane tab="Shop Info" key="info">
|
||||
<Tabs.TabPane tab={t("bodyshop.labels.shopinfo")} key="info">
|
||||
<ShopInfoContainer />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="Employees" key="employees">
|
||||
<Tabs.TabPane tab={t("bodyshop.labels.employees")} key="employees">
|
||||
<ShopEmployeesContainer />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="Licensing" key="licensing">
|
||||
<Tabs.TabPane tab={t("bodyshop.labels.licensing")} key="licensing">
|
||||
Licensing
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab={t("bodyshop.labels.csiq")} key="csiq">
|
||||
<ShopCsiConfig />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -262,10 +262,13 @@
|
||||
"accountingtiers": "Number of Tiers to Use for Export",
|
||||
"alljobstatuses": "All Job Statuses",
|
||||
"allopenjobstatuses": "All Open Job Statuses",
|
||||
"csiq": "CSI Questions",
|
||||
"customtemplates": "Custom Templates",
|
||||
"employees": "Employees",
|
||||
"intake": "Job Intake",
|
||||
"jobstatuses": "Job Statuses",
|
||||
"laborrates": "Labor Rates",
|
||||
"licensing": "Licensing",
|
||||
"notemplatesavailable": "No templates available to add.",
|
||||
"orderstatuses": "Order Statuses",
|
||||
"rbac": "Role Based Access Control",
|
||||
@@ -424,6 +427,9 @@
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
"actions": {
|
||||
"activate": "Activate"
|
||||
},
|
||||
"errors": {
|
||||
"creating": "Error creating survey {{message}}",
|
||||
"notconfigured": "You do not have any current CSI Question Sets configured.",
|
||||
@@ -530,7 +536,8 @@
|
||||
"save": "Save",
|
||||
"saveandnew": "Save and New",
|
||||
"submit": "Submit",
|
||||
"submitticket": "Submit a Support Ticket"
|
||||
"submitticket": "Submit a Support Ticket",
|
||||
"view": "View"
|
||||
},
|
||||
"itemtypes": {
|
||||
"contract": "CC Contract",
|
||||
|
||||
@@ -262,10 +262,13 @@
|
||||
"accountingtiers": "",
|
||||
"alljobstatuses": "",
|
||||
"allopenjobstatuses": "",
|
||||
"csiq": "",
|
||||
"customtemplates": "",
|
||||
"employees": "",
|
||||
"intake": "",
|
||||
"jobstatuses": "",
|
||||
"laborrates": "",
|
||||
"licensing": "",
|
||||
"notemplatesavailable": "",
|
||||
"orderstatuses": "",
|
||||
"rbac": "",
|
||||
@@ -424,6 +427,9 @@
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
"actions": {
|
||||
"activate": ""
|
||||
},
|
||||
"errors": {
|
||||
"creating": "",
|
||||
"notconfigured": "",
|
||||
@@ -530,7 +536,8 @@
|
||||
"save": "Salvar",
|
||||
"saveandnew": "",
|
||||
"submit": "",
|
||||
"submitticket": ""
|
||||
"submitticket": "",
|
||||
"view": ""
|
||||
},
|
||||
"itemtypes": {
|
||||
"contract": "",
|
||||
|
||||
@@ -262,10 +262,13 @@
|
||||
"accountingtiers": "",
|
||||
"alljobstatuses": "",
|
||||
"allopenjobstatuses": "",
|
||||
"csiq": "",
|
||||
"customtemplates": "",
|
||||
"employees": "",
|
||||
"intake": "",
|
||||
"jobstatuses": "",
|
||||
"laborrates": "",
|
||||
"licensing": "",
|
||||
"notemplatesavailable": "",
|
||||
"orderstatuses": "",
|
||||
"rbac": "",
|
||||
@@ -424,6 +427,9 @@
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
"actions": {
|
||||
"activate": ""
|
||||
},
|
||||
"errors": {
|
||||
"creating": "",
|
||||
"notconfigured": "",
|
||||
@@ -530,7 +536,8 @@
|
||||
"save": "sauvegarder",
|
||||
"saveandnew": "",
|
||||
"submit": "",
|
||||
"submitticket": ""
|
||||
"submitticket": "",
|
||||
"view": ""
|
||||
},
|
||||
"itemtypes": {
|
||||
"contract": "",
|
||||
|
||||
Reference in New Issue
Block a user