IO-920 Required referral fields.

This commit is contained in:
Patrick Fic
2021-04-26 15:32:16 -07:00
parent e8db267a18
commit a408de0b90
16 changed files with 399 additions and 10 deletions

View File

@@ -3145,6 +3145,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>enforce_referral</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>federal_tax_id</name> <name>federal_tax_id</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -94,6 +94,26 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
</Select> </Select>
</Form.Item> </Form.Item>
)} )}
{bodyshop.enforce_referral && (
<Form.Item
name={"referral_source"}
label={t("jobs.fields.referralsource")}
rules={[
{
required: bodyshop.enforce_referral,
message: t("general.validation.required"),
},
]}
>
<Select>
{bodyshop.md_referral_sources.map((s) => (
<Select.Option key={s} value={s}>
{s}
</Select.Option>
))}
</Select>
</Form.Item>
)}
<Form.Item <Form.Item
label={t("jobs.fields.ca_gst_registrant")} label={t("jobs.fields.ca_gst_registrant")}
name="ca_gst_registrant" name="ca_gst_registrant"

View File

@@ -93,6 +93,12 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
<Form.Item <Form.Item
label={t("jobs.fields.referralsource")} label={t("jobs.fields.referralsource")}
name="referral_source" name="referral_source"
rules={[
{
required: job.converted && bodyshop.enforce_referral,
message: t("general.validation.required"),
},
]}
> >
<Select disabled={jobRO} allowClear> <Select disabled={jobRO} allowClear>
{bodyshop.md_referral_sources.map((s) => ( {bodyshop.md_referral_sources.map((s) => (

View File

@@ -354,6 +354,13 @@ export default function ShopInfoGeneral({ form }) {
> >
<Select mode="tags" /> <Select mode="tags" />
</Form.Item> </Form.Item>
<Form.Item
name={["enforce_referral"]}
label={t("bodyshop.fields.enforce_referral")}
valuePropName="checked"
>
<Switch />
</Form.Item>
<Form.Item <Form.Item
name={["target_touchtime"]} name={["target_touchtime"]}
label={t("bodyshop.fields.target_touchtime")} label={t("bodyshop.fields.target_touchtime")}

View File

@@ -83,6 +83,7 @@ export const QUERY_BODYSHOP = gql`
sub_status sub_status
jobsizelimit jobsizelimit
md_ccc_rates md_ccc_rates
enforce_referral
employees { employees {
id id
active active
@@ -165,6 +166,7 @@ export const UPDATE_SHOP = gql`
sub_status sub_status
jobsizelimit jobsizelimit
md_ccc_rates md_ccc_rates
enforce_referral
employees { employees {
id id
first_name first_name

View File

@@ -878,6 +878,7 @@ export const CONVERT_JOB_TO_RO = gql`
$ca_gst_registrant: Boolean $ca_gst_registrant: Boolean
$driveable: Boolean $driveable: Boolean
$towin: Boolean $towin: Boolean
$referral_source: String
) { ) {
update_jobs( update_jobs(
where: { id: { _eq: $jobId } } where: { id: { _eq: $jobId } }
@@ -888,6 +889,7 @@ export const CONVERT_JOB_TO_RO = gql`
ca_gst_registrant: $ca_gst_registrant ca_gst_registrant: $ca_gst_registrant
towin: $towin towin: $towin
driveable: $driveable driveable: $driveable
referral_source: $referral_source
} }
) { ) {
returning { returning {
@@ -896,6 +898,7 @@ export const CONVERT_JOB_TO_RO = gql`
converted converted
class class
ins_co_nm ins_co_nm
referral_source
} }
} }
} }

View File

@@ -207,6 +207,7 @@
}, },
"email": "General Shop Email", "email": "General Shop Email",
"enforce_class": "Enforce Class on Conversion?", "enforce_class": "Enforce Class on Conversion?",
"enforce_referral": "Enforce Referrals",
"federal_tax_id": "Federal Tax ID (GST/HST)", "federal_tax_id": "Federal Tax ID (GST/HST)",
"inhousevendorid": "In House Vendor ID", "inhousevendorid": "In House Vendor ID",
"insurance_vendor_id": "Insurance Vendor ID", "insurance_vendor_id": "Insurance Vendor ID",

View File

@@ -207,6 +207,7 @@
}, },
"email": "", "email": "",
"enforce_class": "", "enforce_class": "",
"enforce_referral": "",
"federal_tax_id": "", "federal_tax_id": "",
"inhousevendorid": "", "inhousevendorid": "",
"insurance_vendor_id": "", "insurance_vendor_id": "",

View File

@@ -207,6 +207,7 @@
}, },
"email": "", "email": "",
"enforce_class": "", "enforce_class": "",
"enforce_referral": "",
"federal_tax_id": "", "federal_tax_id": "",
"inhousevendorid": "", "inhousevendorid": "",
"insurance_vendor_id": "", "insurance_vendor_id": "",

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "enforce_referral";
type: run_sql

View File

@@ -0,0 +1,6 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "enforce_referral" boolean NOT
NULL DEFAULT false;
type: run_sql

View File

@@ -0,0 +1,81 @@
- 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
- jobsizelimit
- logo_img_path
- md_categories
- md_ccc_rates
- 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

View File

@@ -0,0 +1,82 @@
- 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
- enforce_referral
- federal_tax_id
- id
- imexshopid
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- jobsizelimit
- logo_img_path
- md_categories
- md_ccc_rates
- 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

View File

@@ -0,0 +1,75 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
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
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_ccc_rates
- 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
- phone
- prodtargethrs
- production_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- target_touchtime
- updated_at
- use_fippa
- workingdays
- zip_post
filter:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,76 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
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
- enforce_referral
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_ccc_rates
- 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
- phone
- prodtargethrs
- production_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- target_touchtime
- updated_at
- use_fippa
- workingdays
- zip_post
filter:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -204,11 +204,9 @@ tables:
- shopid - shopid
- useremail - useremail
filter: filter:
bodyshop: user:
associations: authid:
user: _eq: X-Hasura-User-Id
authid:
_eq: X-Hasura-User-Id
update_permissions: update_permissions:
- role: user - role: user
permission: permission:
@@ -216,9 +214,11 @@ tables:
- active - active
- authlevel - authlevel
filter: filter:
user: bodyshop:
authid: associations:
_eq: X-Hasura-User-Id user:
authid:
_eq: X-Hasura-User-Id
check: null check: null
- table: - table:
schema: public schema: public
@@ -762,6 +762,7 @@ tables:
- deliverchecklist - deliverchecklist
- email - email
- enforce_class - enforce_class
- enforce_referral
- federal_tax_id - federal_tax_id
- id - id
- imexshopid - imexshopid
@@ -831,6 +832,7 @@ tables:
- deliverchecklist - deliverchecklist
- email - email
- enforce_class - enforce_class
- enforce_referral
- federal_tax_id - federal_tax_id
- id - id
- inhousevendorid - inhousevendorid