@@ -1,172 +1,172 @@
|
||||
import { gql } from "@apollo/client";
|
||||
import {gql} from "@apollo/client";
|
||||
|
||||
export const INSERT_NEW_COURTESY_CAR = gql`
|
||||
mutation INSERT_NEW_COURTESY_CAR(
|
||||
$courtesycar: [courtesycars_insert_input!]!
|
||||
) {
|
||||
insert_courtesycars(objects: $courtesycar) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
mutation INSERT_NEW_COURTESY_CAR(
|
||||
$courtesycar: [courtesycars_insert_input!]!
|
||||
) {
|
||||
insert_courtesycars(objects: $courtesycar) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_AVAILABLE_CC = gql`
|
||||
query QUERY_AVAILABLE_CC($today: date) {
|
||||
courtesycars(
|
||||
where: {
|
||||
_or: [
|
||||
{ serviceenddate: { _is_null: true } }
|
||||
{ serviceenddate: { _gt: $today } }
|
||||
]
|
||||
status: { _eq: "courtesycars.status.in" }
|
||||
}
|
||||
) {
|
||||
color
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
make
|
||||
mileage
|
||||
model
|
||||
notes
|
||||
nextservicekm
|
||||
nextservicedate
|
||||
plate
|
||||
readiness
|
||||
status
|
||||
year
|
||||
query QUERY_AVAILABLE_CC($today: date) {
|
||||
courtesycars(
|
||||
where: {
|
||||
_or: [
|
||||
{ serviceenddate: { _is_null: true } }
|
||||
{ serviceenddate: { _gt: $today } }
|
||||
]
|
||||
status: { _eq: "courtesycars.status.in" }
|
||||
}
|
||||
) {
|
||||
color
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
make
|
||||
mileage
|
||||
model
|
||||
notes
|
||||
nextservicekm
|
||||
nextservicedate
|
||||
plate
|
||||
readiness
|
||||
status
|
||||
year
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CHECK_CC_FLEET_NUMBER = gql`
|
||||
query CHECK_VENDOR_NAME($name: String!) {
|
||||
courtesycars_aggregate(where: { fleetnumber: { _ilike: $name } }) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
nodes {
|
||||
id
|
||||
}
|
||||
query CHECK_VENDOR_NAME($name: String!) {
|
||||
courtesycars_aggregate(where: { fleetnumber: { _ilike: $name } }) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
nodes {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const QUERY_ALL_CC = gql`
|
||||
query QUERY_ALL_CC {
|
||||
courtesycars {
|
||||
color
|
||||
created_at
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
insuranceexpires
|
||||
leaseenddate
|
||||
make
|
||||
mileage
|
||||
model
|
||||
nextservicedate
|
||||
nextservicekm
|
||||
notes
|
||||
plate
|
||||
purchasedate
|
||||
readiness
|
||||
registrationexpires
|
||||
serviceenddate
|
||||
servicestartdate
|
||||
status
|
||||
vin
|
||||
year
|
||||
cccontracts(
|
||||
where: { status: { _eq: "contracts.status.out" } }
|
||||
order_by: { contract_date: desc }
|
||||
limit: 1
|
||||
) {
|
||||
id
|
||||
scheduledreturn
|
||||
job {
|
||||
id
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
ro_number
|
||||
query QUERY_ALL_CC {
|
||||
courtesycars {
|
||||
color
|
||||
created_at
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
insuranceexpires
|
||||
leaseenddate
|
||||
make
|
||||
mileage
|
||||
model
|
||||
nextservicedate
|
||||
nextservicekm
|
||||
notes
|
||||
plate
|
||||
purchasedate
|
||||
readiness
|
||||
registrationexpires
|
||||
serviceenddate
|
||||
servicestartdate
|
||||
status
|
||||
vin
|
||||
year
|
||||
cccontracts(
|
||||
where: { status: { _eq: "contracts.status.out" } }
|
||||
order_by: { contract_date: desc }
|
||||
limit: 1
|
||||
) {
|
||||
id
|
||||
scheduledreturn
|
||||
job {
|
||||
id
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_CC_BY_PK = gql`
|
||||
query QUERY_CC_BY_PK(
|
||||
$id: uuid!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
$order: [cccontracts_order_by!]!
|
||||
) {
|
||||
courtesycars_by_pk(id: $id) {
|
||||
bodyshopid
|
||||
color
|
||||
created_at
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
insuranceexpires
|
||||
leaseenddate
|
||||
make
|
||||
mileage
|
||||
model
|
||||
nextservicedate
|
||||
nextservicekm
|
||||
notes
|
||||
plate
|
||||
purchasedate
|
||||
readiness
|
||||
registrationexpires
|
||||
serviceenddate
|
||||
servicestartdate
|
||||
status
|
||||
vin
|
||||
year
|
||||
cccontracts_aggregate {
|
||||
aggregate {
|
||||
count(distinct: true)
|
||||
query QUERY_CC_BY_PK(
|
||||
$id: uuid!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
$order: [cccontracts_order_by!]!
|
||||
) {
|
||||
courtesycars_by_pk(id: $id) {
|
||||
bodyshopid
|
||||
color
|
||||
created_at
|
||||
dailycost
|
||||
damage
|
||||
fleetnumber
|
||||
fuel
|
||||
id
|
||||
insuranceexpires
|
||||
leaseenddate
|
||||
make
|
||||
mileage
|
||||
model
|
||||
nextservicedate
|
||||
nextservicekm
|
||||
notes
|
||||
plate
|
||||
purchasedate
|
||||
readiness
|
||||
registrationexpires
|
||||
serviceenddate
|
||||
servicestartdate
|
||||
status
|
||||
vin
|
||||
year
|
||||
cccontracts_aggregate {
|
||||
aggregate {
|
||||
count(distinct: true)
|
||||
}
|
||||
}
|
||||
cccontracts(offset: $offset, limit: $limit, order_by: $order) {
|
||||
agreementnumber
|
||||
driver_fn
|
||||
driver_ln
|
||||
id
|
||||
kmstart
|
||||
kmend
|
||||
scheduledreturn
|
||||
start
|
||||
status
|
||||
job {
|
||||
id
|
||||
ownr_ln
|
||||
ownr_fn
|
||||
ownr_co_nm
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cccontracts(offset: $offset, limit: $limit, order_by: $order) {
|
||||
agreementnumber
|
||||
driver_fn
|
||||
driver_ln
|
||||
id
|
||||
kmstart
|
||||
kmend
|
||||
scheduledreturn
|
||||
start
|
||||
status
|
||||
job {
|
||||
id
|
||||
ownr_ln
|
||||
ownr_fn
|
||||
ownr_co_nm
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_CC = gql`
|
||||
mutation UPDATE_CC($ccId: uuid!, $cc: courtesycars_set_input!) {
|
||||
update_courtesycars(where: { id: { _eq: $ccId } }, _set: $cc) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
mutation UPDATE_CC($ccId: uuid!, $cc: courtesycars_set_input!) {
|
||||
update_courtesycars(where: { id: { _eq: $ccId } }, _set: $cc) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user