IO-2151 Resolve issue removing CSR on conversion.
This commit is contained in:
@@ -43,14 +43,21 @@ export function JobsConvertButton({
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleConvert = async (values) => {
|
||||
const handleConvert = async ({ employee_csr, ...values }) => {
|
||||
if (parentFormIsFieldsTouched()) {
|
||||
alert(t("jobs.labels.savebeforeconversion"));
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
const res = await mutationConvertJob({
|
||||
variables: { jobId: job.id, ...values },
|
||||
variables: {
|
||||
jobId: job.id,
|
||||
job: {
|
||||
converted: true,
|
||||
...(bodyshop.enforce_conversion_csr ? { employee_csr } : {}),
|
||||
...values,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (values.ca_gst_registrant) {
|
||||
|
||||
@@ -1153,31 +1153,8 @@ export const UPDATE_JOBS = gql`
|
||||
`;
|
||||
|
||||
export const CONVERT_JOB_TO_RO = gql`
|
||||
mutation CONVERT_JOB_TO_RO(
|
||||
$jobId: uuid!
|
||||
$class: String
|
||||
$ins_co_nm: String!
|
||||
$ca_gst_registrant: Boolean
|
||||
$driveable: Boolean
|
||||
$towin: Boolean
|
||||
$referral_source: String
|
||||
$referral_source_extra: String
|
||||
$employee_csr: uuid
|
||||
) {
|
||||
update_jobs(
|
||||
where: { id: { _eq: $jobId } }
|
||||
_set: {
|
||||
converted: true
|
||||
ins_co_nm: $ins_co_nm
|
||||
class: $class
|
||||
ca_gst_registrant: $ca_gst_registrant
|
||||
towin: $towin
|
||||
driveable: $driveable
|
||||
referral_source: $referral_source
|
||||
referral_source_extra: $referral_source_extra
|
||||
employee_csr: $employee_csr
|
||||
}
|
||||
) {
|
||||
mutation CONVERT_JOB_TO_RO($jobId: uuid!, $job: jobs_set_input!) {
|
||||
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
||||
returning {
|
||||
id
|
||||
ro_number
|
||||
|
||||
Reference in New Issue
Block a user