feature/IO-3045-Product-Fruits-Tours-Modifications - Add in roles prop on Product fruits, tie the usage of it to a new db bodyshop var tours_enabled.
This commit is contained in:
@@ -142,11 +142,10 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline
|
|||||||
>
|
>
|
||||||
<ProductFruitsWrapper
|
<ProductFruitsWrapper
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
workspaceCode={InstanceRenderMgr({
|
bodyshop={bodyshop}
|
||||||
imex: null,
|
workspaceCode={bodyshop?.tours_enabled ? "9BkbEseqNqxw8jUH" : ""}
|
||||||
rome: "9BkbEseqNqxw8jUH"
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<NotificationProvider>
|
<NotificationProvider>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { ProductFruits } from "react-product-fruits";
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import { ProductFruits } from "react-product-fruits";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
const ProductFruitsWrapper = React.memo(({ currentUser, bodyshop, workspaceCode }) => {
|
||||||
|
const featureProps = bodyshop?.features
|
||||||
|
? Object.entries(bodyshop.features).reduce((acc, [key, value]) => {
|
||||||
|
acc[key] = value === true || (typeof value === "string" && dayjs(value).isAfter(dayjs()));
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
: {};
|
||||||
|
|
||||||
const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => {
|
|
||||||
return (
|
return (
|
||||||
workspaceCode &&
|
workspaceCode &&
|
||||||
currentUser?.authorized === true &&
|
currentUser?.authorized === true &&
|
||||||
@@ -14,7 +22,8 @@ const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => {
|
|||||||
language="en"
|
language="en"
|
||||||
user={{
|
user={{
|
||||||
email: currentUser.email,
|
email: currentUser.email,
|
||||||
username: currentUser.email
|
username: currentUser.email,
|
||||||
|
props: featureProps
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -28,5 +37,6 @@ ProductFruitsWrapper.propTypes = {
|
|||||||
authorized: PropTypes.bool,
|
authorized: PropTypes.bool,
|
||||||
email: PropTypes.string
|
email: PropTypes.string
|
||||||
}),
|
}),
|
||||||
workspaceCode: PropTypes.string
|
workspaceCode: PropTypes.string,
|
||||||
|
bodyshop: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
logo_img_path
|
logo_img_path
|
||||||
md_ro_statuses
|
md_ro_statuses
|
||||||
md_order_statuses
|
md_order_statuses
|
||||||
|
tours_enabled
|
||||||
md_functionality_toggles
|
md_functionality_toggles
|
||||||
shopname
|
shopname
|
||||||
state
|
state
|
||||||
@@ -186,6 +187,7 @@ export const UPDATE_SHOP = gql`
|
|||||||
phone
|
phone
|
||||||
federal_tax_id
|
federal_tax_id
|
||||||
id
|
id
|
||||||
|
tours_enabled
|
||||||
insurance_vendor_id
|
insurance_vendor_id
|
||||||
logo_img_path
|
logo_img_path
|
||||||
md_ro_statuses
|
md_ro_statuses
|
||||||
|
|||||||
@@ -965,6 +965,7 @@
|
|||||||
- insurance_vendor_id
|
- insurance_vendor_id
|
||||||
- intakechecklist
|
- intakechecklist
|
||||||
- intellipay_config
|
- intellipay_config
|
||||||
|
- intellipay_merchant_id
|
||||||
- jc_hourly_rates
|
- jc_hourly_rates
|
||||||
- jobsizelimit
|
- jobsizelimit
|
||||||
- last_name_first
|
- last_name_first
|
||||||
@@ -1023,6 +1024,7 @@
|
|||||||
- template_header
|
- template_header
|
||||||
- textid
|
- textid
|
||||||
- timezone
|
- timezone
|
||||||
|
- tours_enabled
|
||||||
- tt_allow_post_to_invoiced
|
- tt_allow_post_to_invoiced
|
||||||
- tt_enforce_hours_for_tech_console
|
- tt_enforce_hours_for_tech_console
|
||||||
- updated_at
|
- updated_at
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."bodyshops" add column "tours_enabled" boolean
|
||||||
|
-- not null default 'true';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."bodyshops" add column "tours_enabled" boolean
|
||||||
|
not null default 'true';
|
||||||
Reference in New Issue
Block a user