278 lines
4.7 KiB
JavaScript
278 lines
4.7 KiB
JavaScript
import gql from "graphql-tag";
|
|
|
|
export const INSERT_NEW_JOB = gql`
|
|
mutation INSERT_JOB($job: [jobs_insert_input!]!) {
|
|
insert_jobs(objects: $job) {
|
|
returning {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_ALL_JOBS_PAGINATED = gql`
|
|
query QUERY_ALL_JOBS_PAGINATED(
|
|
$offset: Int
|
|
$limit: Int
|
|
$order: [jobs_order_by!]
|
|
) {
|
|
jobs(offset: $offset, limit: $limit, order_by: $order) {
|
|
ownr_fn
|
|
ownr_ln
|
|
v_vin
|
|
v_model_yr
|
|
v_model
|
|
v_makedesc
|
|
id
|
|
ins_co_nm
|
|
clm_no
|
|
close_date
|
|
updated_at
|
|
requires_reimport
|
|
}
|
|
jobs_aggregate {
|
|
aggregate {
|
|
count(distinct: true)
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const SEARCH_JOBS_PAGINATED = gql`
|
|
query SEARCH_JOBS_PAGINATED(
|
|
$offset: Int
|
|
$limit: Int
|
|
$search: String
|
|
$startDate: date
|
|
$endDate: date
|
|
$closeDateIsNull: Boolean
|
|
) {
|
|
search_jobs(
|
|
offset: $offset
|
|
limit: $limit
|
|
args: { enddate: $endDate, search: $search, startdate: $startDate }
|
|
where: { close_date: { _is_null: $closeDateIsNull } }
|
|
) {
|
|
ownr_fn
|
|
ownr_ln
|
|
v_vin
|
|
v_model_yr
|
|
v_model
|
|
v_makedesc
|
|
id
|
|
ins_co_nm
|
|
clm_no
|
|
updated_at
|
|
close_date
|
|
requires_reimport
|
|
}
|
|
search_jobs_aggregate(
|
|
args: { enddate: $endDate, search: $search, startdate: $startDate }
|
|
where: { close_date: { _is_null: $closeDateIsNull } }
|
|
) {
|
|
aggregate {
|
|
count(distinct: true)
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_JOB_BY_PK = gql`
|
|
query QUERY_JOB_BY_PK($jobId: uuid!) {
|
|
jobs_by_pk(id: $jobId) {
|
|
ownr_fn
|
|
ownr_ln
|
|
v_vin
|
|
v_model_yr
|
|
v_model
|
|
v_makedesc
|
|
id
|
|
ins_co_nm
|
|
clm_no
|
|
clm_total
|
|
ro_number
|
|
updated_at
|
|
group
|
|
group_verified
|
|
v_age
|
|
v_type
|
|
loss_date
|
|
close_date
|
|
updated_at
|
|
requires_reimport
|
|
created_at
|
|
v_mileage
|
|
g_bett_amt
|
|
joblines(order_by: { line_no: asc }) {
|
|
id
|
|
line_no
|
|
act_price
|
|
db_price
|
|
line_desc
|
|
line_ind
|
|
oem_partno
|
|
part_qty
|
|
part_type
|
|
unq_seq
|
|
price_diff
|
|
price_diff_pc
|
|
ignore
|
|
db_ref
|
|
alerts
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_JOB_BY_CLM_NO = gql`
|
|
query QUERY_JOB_BY_CLM_NO($clm_no: String!) {
|
|
jobs(where: { clm_no: { _eq: $clm_no } }) {
|
|
id
|
|
close_date
|
|
requires_reimport
|
|
joblines {
|
|
id
|
|
act_price
|
|
db_price
|
|
line_desc
|
|
line_ind
|
|
oem_partno
|
|
part_qty
|
|
part_type
|
|
unq_seq
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_CLOSE_DATE_BY_CLM_NO = gql`
|
|
query QUERY_CLOSE_DATE_BY_CLM_NO($clm_no: String!) {
|
|
jobs(where: { clm_no: { _eq: $clm_no } }) {
|
|
id
|
|
close_date
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const UPDATE_JOB = gql`
|
|
mutation UPDATE_JOB($jobId: uuid!, $job: jobs_set_input!) {
|
|
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
|
returning {
|
|
ownr_fn
|
|
ownr_ln
|
|
v_vin
|
|
v_model_yr
|
|
v_model
|
|
v_makedesc
|
|
id
|
|
ins_co_nm
|
|
clm_no
|
|
clm_total
|
|
ro_number
|
|
updated_at
|
|
created_at
|
|
close_date
|
|
v_age
|
|
group
|
|
group_verified
|
|
requires_reimport
|
|
v_mileage
|
|
joblines(order_by: { line_no: asc }) {
|
|
id
|
|
act_price
|
|
db_price
|
|
line_desc
|
|
line_ind
|
|
oem_partno
|
|
part_qty
|
|
part_type
|
|
unq_seq
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const DELETE_JOB = gql`
|
|
mutation DELETE_JOB($jobId: uuid!) {
|
|
delete_jobs_by_pk(id: $jobId) {
|
|
id
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_JOB_ESTIMATE_SCRUBBER = gql`
|
|
query QUERY_JOB_ESTIMATE_SCRUBBER($jobId: uuid!) {
|
|
jobs_by_pk(id: $jobId) {
|
|
ownr_fn
|
|
ownr_ln
|
|
v_vin
|
|
v_model_yr
|
|
v_model
|
|
v_makedesc
|
|
id
|
|
ins_co_nm
|
|
clm_no
|
|
clm_total
|
|
ro_number
|
|
updated_at
|
|
group
|
|
group_verified
|
|
v_age
|
|
v_type
|
|
loss_date
|
|
close_date
|
|
updated_at
|
|
requires_reimport
|
|
created_at
|
|
v_mileage
|
|
rates
|
|
totals
|
|
ded_amt
|
|
loss_desc
|
|
ownr_addr1
|
|
ownr_city
|
|
ownr_ph1
|
|
v_stage
|
|
supp_amt
|
|
g_bett_amt
|
|
bodyshop {
|
|
id
|
|
post_zip
|
|
phone
|
|
}
|
|
joblines(order_by: {line_no: asc}) {
|
|
line_no
|
|
line_ind
|
|
db_ref
|
|
line_desc
|
|
part_type
|
|
glass_flag
|
|
oem_partno
|
|
db_price
|
|
act_price
|
|
price_j
|
|
part_qty
|
|
mod_lbr_ty
|
|
db_hrs
|
|
mod_lb_hrs
|
|
lbr_inc
|
|
lbr_op
|
|
lbr_hrs_j
|
|
lbr_amt
|
|
misc_amt
|
|
price_inc
|
|
tax_part
|
|
cert_part
|
|
alt_partno
|
|
lbr_op_j
|
|
}
|
|
}
|
|
}
|
|
|
|
`;
|
|
|
|
//Missing Fields?
|
|
//db_date
|
|
//all rf_Fields
|