import { gql } from "@apollo/client"; export const QUERY_JOBS_FOR_EXPORT = gql` query QUERY_JOBS_FOR_EXPORT($invoicedStatus: String!) { jobs(where: { date_exported: { _is_null: true }, status: { _eq: $invoicedStatus } }) { id ro_number ownr_fn ownr_ln ownr_co_nm date_invoiced date_exported status v_model_desc v_make_desc v_model_yr v_color clm_total clm_no ins_co_nm exportlogs { id successful } } } `; export const QUERY_BILLS_FOR_EXPORT = gql` query QUERY_BILLS_FOR_EXPORT { bills(where: { exported: { _eq: false }, isinhouse: { _eq: false } }) { id exported date invoice_number is_credit_memo total exportlogs { id successful } job { id ro_number } vendor { name id } } } `; export const QUERY_PAYMENTS_FOR_EXPORT = gql` query QUERY_PAYMENTS_FOR_EXPORT { payments(where: { exportedat: { _is_null: true } }, order_by: { created_at: desc }) { id amount job { ro_number id ownr_fn ownr_ln ownr_co_nm } payer memo exportedat stripeid created_at transactionid paymentnum date type exportlogs { id successful } } } `; export const INSERT_EXPORT_LOG = gql` mutation INSERT_EXPORT_LOG($logs: [exportlog_insert_input!]!) { insert_exportlog(objects: $logs) { affected_rows } } `; export const QUERY_PHONEBOOK_PAGINATED = gql` query QUERY_PHONEBOOK_PAGINATED($search: String, $offset: Int, $limit: Int, $order: [phonebook_order_by!]) { search_phonebook(offset: $offset, limit: $limit, order_by: $order, args: { search: $search }) { id created_at firstname lastname phone1 phone2 state zip fax email country company city category address2 address1 } search_phonebook_aggregate(args: { search: $search }) { aggregate { count(distinct: true) } } } `; export const QUERY_EXPORT_LOG_PAGINATED = gql` query QUERY_ALL_EXPORTLOG_PAGINATED($search: String, $offset: Int, $limit: Int, $order: [exportlog_order_by!]) { search_exportlog(offset: $offset, limit: $limit, order_by: $order, args: { search: $search }) { id job { ro_number id } payment { id paymentnum } bill { invoice_number id } successful message created_at useremail } search_exportlog_aggregate(args: { search: $search }) { aggregate { count(distinct: true) } } } `;