exports.FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID = ` query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID( $mssid: String! $phone: String! ) { bodyshops(where: { messagingservicesid: { _eq: $mssid } }) { id conversations(where: { phone_num: { _eq: $phone } }) { id } } } `; exports.INSERT_MESSAGE = ` mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) { insert_messages(objects: $msg) { returning { conversation { bodyshop { associations(where: {active: {_eq: true}}) { user { fcmtokens } } } } } } } `; exports.UPDATE_MESSAGE_STATUS = ` mutation UPDATE_MESSAGE($msid: String!, $fields: messages_set_input!) { update_messages(where: { msid: { _eq: $msid } }, _set: $fields) { returning { id } } } `; exports.QUERY_JOBS_FOR_RECEIVABLES_EXPORT = ` query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) { jobs(where: {id: {_in: $ids}}) { id job_totals date_invoiced date_closed ro_number clm_total clm_no invoice_allocation ownerid ownr_ln ownr_fn ownr_addr1 ownr_addr2 ownr_zip ownr_city ownr_st ins_co_nm job_totals rate_la1 rate_la2 rate_la3 rate_la4 rate_laa rate_lab rate_lad rate_lae rate_laf rate_lag rate_lam rate_lar rate_las rate_lau rate_ma2s rate_ma2t rate_ma3s rate_mabl rate_macs rate_mahw rate_mapa rate_mash rate_matd class owner { accountingid } joblines(where:{removed: {_eq:false}}) { id line_desc part_type act_price mod_lb_hrs mod_lbr_ty part_qty op_code_desc profitcenter_labor profitcenter_part } } bodyshops(where: {associations: {active: {_eq: true}}}) { id md_responsibility_centers accountingconfig } } `; exports.QUERY_BILLS_FOR_PAYABLES_EXPORT = ` query QUERY_BILLS_FOR_PAYABLES_EXPORT($bills: [uuid!]!) { bills(where: {id: {_in: $bills}}) { id date due_date federal_tax_rate invoice_number is_credit_memo job { id ro_number clm_no ownr_fn ownr_ln ownr_co_nm bodyshop{ md_responsibility_centers } } billlines{ id cost_center actual_cost applicable_taxes } state_tax_rate local_tax_rate total vendor{ id name } } } `; exports.QUERY_PAYMENTS_FOR_EXPORT = ` query QUERY_PAYMENTS_FOR_EXPORT($payments: [uuid!]!) { payments(where: {id: {_in: $payments}}) { id created_at jobid job { id ro_number ins_co_nm owner{ accountingid } ownr_fn ownr_ln ownr_co_nm bodyshop{ accountingconfig md_responsibility_centers } } transactionid memo amount stripeid exportedat stripeid type payer } } `; exports.QUERY_UPCOMING_APPOINTMENTS = ` query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) { jobs_by_pk(id: $jobId) { bodyshop { ssbuckets target_touchtime workingdays } jobhrs: joblines_aggregate { aggregate { sum { mod_lb_hrs } } } } appointments(where: {_and: {canceled: {_eq: false}, start: {_gte: $now}}}) { start isintake id block job { joblines_aggregate { aggregate { sum { mod_lb_hrs } } } } } jobs(where: {inproduction: {_eq: true}}) { id scheduled_completion labhrs: joblines_aggregate(where: {mod_lbr_ty: {_eq: "LAB"}}) { aggregate { sum { mod_lb_hrs } } } larhrs: joblines_aggregate(where: {mod_lbr_ty: {_eq: "LAR"}}) { aggregate { sum { mod_lb_hrs } } } } } `; exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employeeId: String!) { employees(where: {_and: {shopid: {_eq: $shopId}, employee_number: {_eq: $employeeId}}}) { last_name first_name employee_number id cost_center pin } }`;