diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 1fac37348..3d67ca6d0 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -11882,6 +11882,32 @@ + + sub_status + + + expired + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + sunday false @@ -13420,6 +13446,27 @@ + + PAG + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + PAL false diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index 6b1a8d303..bf4467758 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -41,7 +41,6 @@ export default function BillDetailEditcontainer() { billlines.forEach((il) => { delete il.__typename; - if (il.id) { updates.push( updateBillLine({ @@ -71,8 +70,11 @@ export default function BillDetailEditcontainer() { ); } }); - await Promise.all(updates); + + await refetch(); + form.resetFields(); + form.resetFields(); setUpdateLoading(false); }; @@ -92,32 +94,7 @@ export default function BillDetailEditcontainer() {
{ - return { - ...i, - joblineid: !!i.joblineid ? i.joblineid : "noline", - applicable_taxes: { - federal: - (i.applicable_taxes && i.applicable_taxes.federal) || - false, - state: - (i.applicable_taxes && i.applicable_taxes.state) || - false, - local: - (i.applicable_taxes && i.applicable_taxes.local) || - false, - }, - }; - }), - date: data.bills_by_pk ? moment(data.bills_by_pk.date) : null, - } - : {} - } + initialValues={transformData(data)} > + +
+ + ); + + return ( + + {backordered_eta} + {isAlreadyBackordered && ( + + )} + {loading && } + + ); +} + +export default connect(mapStateToProps, null)(PartsOrderBackorderEta); diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 009597238..78552bb98 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -14,6 +14,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; import { TemplateList } from "../../utils/TemplateConstants"; +import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component"; import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component"; import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container"; import PrintWrapper from "../print-wrapper/print-wrapper.component"; @@ -164,13 +165,13 @@ export function PartsOrderListTableComponent({ {text}, + render: (text, record) => ( + + ), }, { title: t("general.labels.actions"), diff --git a/client/src/components/rbac-wrapper/rbac-defaults.js b/client/src/components/rbac-wrapper/rbac-defaults.js index 7efcb53bd..0da32826f 100644 --- a/client/src/components/rbac-wrapper/rbac-defaults.js +++ b/client/src/components/rbac-wrapper/rbac-defaults.js @@ -48,7 +48,7 @@ const ret = { "shiftclock:view": 2, "shop:vendors": 2, - "shop:rbac": 5, + "shop:rbac": 1, "shop:templates": 4, "temporarydocs:view": 2, diff --git a/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx b/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx index 81b5093c4..6da4f06a2 100644 --- a/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx +++ b/client/src/components/rbac-wrapper/rbac-wrapper.component.jsx @@ -28,10 +28,12 @@ function RbacWrapper({ ...restProps }) { const { t } = useTranslation(); + if ( (requiredAuthLevel && requiredAuthLevel <= authLevel) || - (bodyshop.md_rbac && bodyshop.md_rbac[action] <= authLevel) || - (!!!bodyshop.md_rbac && rbacDefaults[action] <= authLevel) + ((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <= + authLevel || + (!bodyshop.md_rbac && rbacDefaults[action] <= authLevel) ) return
{React.cloneElement(children, restProps)}
; diff --git a/client/src/components/shop-info/shop-info.rbac.component.jsx b/client/src/components/shop-info/shop-info.rbac.component.jsx index d47634888..daa189843 100644 --- a/client/src/components/shop-info/shop-info.rbac.component.jsx +++ b/client/src/components/shop-info/shop-info.rbac.component.jsx @@ -2,11 +2,12 @@ import { Form, InputNumber } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component"; export default function ShopInfoRbacComponent({ form }) { const { t } = useTranslation(); return ( -
+ -
+ ); } diff --git a/client/src/components/shop-info/shop-info.scheduling.component.jsx b/client/src/components/shop-info/shop-info.scheduling.component.jsx index 6caf2d0f2..77647a62e 100644 --- a/client/src/components/shop-info/shop-info.scheduling.component.jsx +++ b/client/src/components/shop-info/shop-info.scheduling.component.jsx @@ -30,7 +30,7 @@ export default function ShopInfoSchedulingComponent({ form }) { }, ]} > - + - + {t("bodyshop.labels.apptcolors")} diff --git a/client/src/components/shop-sub-status/shop-sub-status.component.jsx b/client/src/components/shop-sub-status/shop-sub-status.component.jsx new file mode 100644 index 000000000..b6f04b836 --- /dev/null +++ b/client/src/components/shop-sub-status/shop-sub-status.component.jsx @@ -0,0 +1,33 @@ +import { Button, Result } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect(mapStateToProps, mapDispatchToProps)(ShopSubStatus); + +export function ShopSubStatus({ bodyshop }) { + const { t } = useTranslation(); + const { sub_status } = bodyshop; + return ( + { + alert("Not implemented yet."); + }} + > + {t("general.actions.submitticket")} + + } + /> + ); +} diff --git a/client/src/graphql/bodyshop.queries.js b/client/src/graphql/bodyshop.queries.js index 880e1402d..33d359845 100644 --- a/client/src/graphql/bodyshop.queries.js +++ b/client/src/graphql/bodyshop.queries.js @@ -80,6 +80,7 @@ export const QUERY_BODYSHOP = gql` use_fippa md_payment_types md_hour_split + sub_status employees { id first_name @@ -158,6 +159,7 @@ export const UPDATE_SHOP = gql` use_fippa md_payment_types md_hour_split + sub_status employees { id first_name diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js index 65de1f573..3559b4bc7 100644 --- a/client/src/graphql/parts-orders.queries.js +++ b/client/src/graphql/parts-orders.queries.js @@ -10,6 +10,24 @@ export const INSERT_NEW_PARTS_ORDERS = gql` } `; +export const MUTATION_UPDATE_BO_ETA = gql` + mutation MUTATION_UPDATE_BO_ETA( + $partsLineId: uuid! + $partsOrder: parts_order_lines_set_input + ) { + update_parts_order_lines( + where: { id: { _eq: $partsLineId } } + _set: $partsOrder + ) { + returning { + status + backordered_eta + id + } + } + } +`; + export const MUTATION_BACKORDER_PART_LINE = gql` mutation MUTATION_BACKORDER_PART_LINE( $jobLineId: uuid! diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 333c63cc9..ea7af17dc 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -12,8 +12,10 @@ import ChatAffixContainer from "../../components/chat-affix/chat-affix.container import ConflictComponent from "../../components/conflict/conflict.component"; import ErrorBoundary from "../../components/error-boundary/error-boundary.component"; import FcmNotification from "../../components/fcm-notification/fcm-notification.component"; +import ShopSubStatusComponent from "../../components/shop-sub-status/shop-sub-status.component"; //import FooterComponent from "../../components/footer/footer.component"; //Component Imports + import HeaderContainer from "../../components/header/header.container"; import JiraSupportComponent from "../../components/jira-support-widget/jira-support-widget.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; @@ -21,7 +23,10 @@ import PartnerPingComponent from "../../components/partner-ping/partner-ping.com import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container"; import TestComponent from "../../components/_test/test.component"; import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries"; -import { selectInstanceConflict } from "../../redux/user/user.selectors"; +import { + selectBodyshop, + selectInstanceConflict, +} from "../../redux/user/user.selectors"; import client from "../../utils/GraphQLClient"; import "./manage.page.styles.scss"; @@ -166,15 +171,198 @@ const stripePromise = new Promise((resolve, reject) => { const mapStateToProps = createStructuredSelector({ conflict: selectInstanceConflict, + bodyshop: selectBodyshop, }); -export function Manage({ match, conflict }) { +export function Manage({ match, conflict, bodyshop }) { const { t } = useTranslation(); useEffect(() => { document.title = t("titles.app"); }, [t]); + const AppRouteTable = ( + } + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + // + } + + + + + + + + + + + + + + + ); + + let PageContent; + + if (conflict) PageContent = ; + else if (bodyshop && bodyshop.sub_status !== "active") + PageContent = ; + else PageContent = AppRouteTable; + return (
@@ -183,233 +371,7 @@ export function Manage({ match, conflict }) { - - {conflict ? ( - - ) : ( - - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - // - } - - - - - - - - - - - - - - - )} - + {PageContent} diff --git a/client/src/pages/manage/manage.page.container.jsx b/client/src/pages/manage/manage.page.container.jsx index c7e06ecf3..c3e5903b6 100644 --- a/client/src/pages/manage/manage.page.container.jsx +++ b/client/src/pages/manage/manage.page.container.jsx @@ -1,15 +1,14 @@ import { useQuery } from "@apollo/client"; import React, { useEffect } from "react"; +import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; import AlertComponent from "../../components/alert/alert.component"; +import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries"; import { setBodyshop } from "../../redux/user/user.actions"; -import ManagePage from "./manage.page.component"; -import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; -import { useTranslation } from "react-i18next"; -import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; -import NoShop from "../../components/no-shop/no-shop.component"; +import ManagePage from "./manage.page.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop }); @@ -32,8 +31,6 @@ function ManagePageContainer({ match, setBodyshop, bodyshop }) { return ; if (error) return ; - if (bodyshop && bodyshop.notfound) return ; - return ; } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index fd4c94970..1a2fef3e2 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -559,8 +559,8 @@ "plate": "Plate Number", "purchasedate": "Purchase Date", "registrationexpires": "Registration Expires On", - "serviceenddate": "Service End Date", - "servicestartdate": "Service Start Date", + "serviceenddate": "Usage End Date", + "servicestartdate": "Usage Start Date", "status": "Status", "vin": "VIN", "year": "Year" @@ -764,6 +764,9 @@ "sendagain": "Send Again", "sendby": "Send By", "signin": "Sign In", + "sub_status": { + "expired": "The subscription for this shop has expired. Please contact technical support to reactivate the subscription. " + }, "sunday": "Sunday", "text": "Text", "thursday": "Thursday", @@ -861,6 +864,7 @@ "PAA": "Aftermarket", "PAC": "Rechromed", "PAE": "Existing", + "PAG": "Glass", "PAL": "LKQ", "PAM": "Remanufactured", "PAN": "New/OEM", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 8b119b68e..b360f802d 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -764,6 +764,9 @@ "sendagain": "", "sendby": "", "signin": "", + "sub_status": { + "expired": "" + }, "sunday": "", "text": "", "thursday": "", @@ -861,6 +864,7 @@ "PAA": "", "PAC": "", "PAE": "", + "PAG": "", "PAL": "", "PAM": "", "PAN": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 61f862c86..6809b4952 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -764,6 +764,9 @@ "sendagain": "", "sendby": "", "signin": "", + "sub_status": { + "expired": "" + }, "sunday": "", "text": "", "thursday": "", @@ -861,6 +864,7 @@ "PAA": "", "PAC": "", "PAE": "", + "PAG": "", "PAL": "", "PAM": "", "PAN": "", diff --git a/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/down.yaml b/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/down.yaml new file mode 100644 index 000000000..caca3a404 --- /dev/null +++ b/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "sub_status"; + type: run_sql diff --git a/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/up.yaml b/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/up.yaml new file mode 100644 index 000000000..7dd40c290 --- /dev/null +++ b/hasura/migrations/1615929091635_alter_table_public_bodyshops_add_column_sub_status/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "sub_status" text NOT NULL DEFAULT + 'active'; + type: run_sql diff --git a/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/down.yaml b/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/down.yaml new file mode 100644 index 000000000..5a5ac5eec --- /dev/null +++ b/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/down.yaml @@ -0,0 +1,78 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - imexshopid + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_hour_split + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_payment_types + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - messagingservicesid + - phone + - prodtargethrs + - production_config + - region_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - stripe_acct_id + - target_touchtime + - template_header + - textid + - updated_at + - use_fippa + - workingdays + - zip_post + computed_fields: [] + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/up.yaml b/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/up.yaml new file mode 100644 index 000000000..7541894cb --- /dev/null +++ b/hasura/migrations/1615929109833_update_permission_user_public_table_bodyshops/up.yaml @@ -0,0 +1,79 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - imexshopid + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_hour_split + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_payment_types + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - messagingservicesid + - phone + - prodtargethrs + - production_config + - region_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - stripe_acct_id + - sub_status + - target_touchtime + - template_header + - textid + - updated_at + - use_fippa + - workingdays + - zip_post + computed_fields: [] + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index 39ac4dae1..dfff958f5 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -777,6 +777,7 @@ tables: - state - state_tax_id - stripe_acct_id + - sub_status - target_touchtime - template_header - textid