import { gql } from "@apollo/client"; export const QUERY_VEHICLE_BY_ID = gql` query QUERY_VEHICLE_BY_ID($id: uuid!) { vehicles_by_pk(id: $id) { created_at db_v_code id plate_no plate_st v_vin v_type v_trimcode v_tone v_stage v_prod_dt v_paint_codes v_options v_model_yr v_model_desc v_mldgcode v_makecode v_make_desc v_engine v_cond v_color v_bstyle updated_at trim_color notes jobs(order_by: { date_open: desc }) { id actual_completion ro_number ownr_co_nm ownr_fn ownr_ln owner { id } clm_no status clm_total } } } `; export const UPDATE_VEHICLE = gql` mutation UPDATE_VEHICLE($vehId: uuid!, $vehicle: vehicles_set_input!) { update_vehicles(where: { id: { _eq: $vehId } }, _set: $vehicle) { returning { id } } } `; export const DELETE_VEHICLE = gql` mutation DELETE_VEHICLE($id: uuid!) { delete_vehicles_by_pk(id: $id) { id } } `; export const QUERY_ALL_VEHICLES = gql` query QUERY_ALL_VEHICLES { vehicles { id plate_no plate_st v_vin v_model_yr v_model_desc v_make_desc v_color v_bstyle updated_at } } `; export const QUERY_ALL_VEHICLES_PAGINATED = gql` query QUERY_ALL_VEHICLES($search: String, $offset: Int, $limit: Int, $order: [vehicles_order_by!]!) { search_vehicles(args: { search: $search }, offset: $offset, limit: $limit, order_by: $order) { id plate_no plate_st v_vin v_model_yr v_model_desc v_make_desc v_color v_bstyle updated_at } search_vehicles_aggregate(args: { search: $search }) { aggregate { count(distinct: true) } } } `; export const SEARCH_VEHICLE_BY_VIN = gql` query SEARCH_VEHICLE_BY_VIN($vin: String!) { vehicles(where: { v_vin: { _ilike: $vin } }) { id plate_no plate_st v_vin v_model_yr v_model_desc v_make_desc v_color v_bstyle updated_at v_type v_trimcode v_tone v_stage v_prod_dt v_paint_codes v_options v_mldgcode v_makecode v_engine v_cond trim_color db_v_code } } `; export const SEARCH_VEHICLES = gql` query SEARCH_VEHICLES($search: String!) { search_vehicles(args: { search: $search }) { id plate_no plate_st v_vin v_model_yr v_model_desc v_make_desc v_color v_bstyle updated_at v_type v_trimcode v_tone v_stage v_prod_dt v_paint_codes v_options v_mldgcode v_makecode v_engine v_cond trim_color db_v_code } } `; export const SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE = gql` query SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE($id: uuid!) { vehicles_by_pk(id: $id) { id v_vin v_model_yr v_make_desc v_model_desc } } `; export const SEARCH_VEHICLES_FOR_AUTOCOMPLETE = gql` query SEARCH_VEHICLES_FOR_AUTOCOMPLETE($search: String) { search_vehicles(args: { search: $search }, limit: 25) { id v_vin v_model_yr v_make_desc v_model_desc } } `;