import gql from "graphql-tag"; export const INSERT_NEW_CONTRACT = gql` mutation INSERT_NEW_CONTRACT($contract: [cccontracts_insert_input!]!) { insert_cccontracts(objects: $contract) { returning { id } } } `; export const UPDATE_CONTRACT = gql` mutation UPDATE_CONTRACT( $contractId: uuid! $cccontract: cccontracts_set_input! ) { update_cccontracts(where: { id: { _eq: $contractId } }, _set: $cccontract) { returning { id } } } `; export const RETURN_CONTRACT = gql` mutation RETURN_CONTRACT( $contractId: uuid! $cccontract: cccontracts_set_input! $courtesycarid: uuid! $courtesycar: courtesycars_set_input! ) { update_cccontracts(where: { id: { _eq: $contractId } }, _set: $cccontract) { returning { id } } update_courtesycars( where: { id: { _eq: $courtesycarid } } _set: $courtesycar ) { returning { id } } } `; export const QUERY_CONTRACT_BY_PK = gql` query QUERY_CONTRACT_BY_PK($id: uuid!) { cccontracts_by_pk(id: $id) { actualreturn agreementnumber cc_cardholder cc_expiry cc_num courtesycarid driver_addr1 driver_city driver_addr2 driver_dlexpiry driver_dlnumber driver_dlst driver_dob driver_fn driver_ln driver_ph1 driver_state driver_zip id jobid job { id est_number ro_number v_make_desc v_model_desc ownr_fn ownr_ln ownr_co_nm scheduled_completion } kmend kmstart scheduledreturn start status updated_at courtesycar { id fleetnumber make model year plate } } } `; export const QUERY_ACTIVE_CONTRACTS = gql` query QUERY_ACTIVE_CONTRACTS { cccontracts(where: { status: { _neq: "contracts.status.returned" } }) { agreementnumber courtesycarid driver_fn driver_ln driver_ph1 id jobid job { id est_number ro_number ownr_fn ownr_ln ownr_co_nm } scheduledreturn start status courtesycar { id fleetnumber make model year plate } } } `;