358 lines
6.4 KiB
JavaScript
358 lines
6.4 KiB
JavaScript
import { gql } from "@apollo/client";
|
|
|
|
export const QUERY_TICKETS_BY_JOBID = gql`
|
|
query QUERY_TICKETS_BY_JOBID($jobid: uuid!) {
|
|
timetickets(
|
|
where: { jobid: { _eq: $jobid } }
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
cost_center
|
|
ciecacode
|
|
rate
|
|
productivehrs
|
|
id
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
employee {
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_TIME_TICKETS_IN_RANGE = gql`
|
|
query QUERY_TIME_TICKETS_IN_RANGE($start: date!, $end: date!) {
|
|
timetickets(
|
|
where: { date: { _gte: $start, _lte: $end } }
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
ciecacode
|
|
clockoff
|
|
clockon
|
|
cost_center
|
|
created_at
|
|
created_by
|
|
date
|
|
id
|
|
rate
|
|
productivehrs
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_TIME_TICKETS_TECHNICIAN_IN_RANGE = gql`
|
|
query QUERY_TIME_TICKETS_TECHNICIAN_IN_RANGE(
|
|
$employeeid: uuid!
|
|
$start: date!
|
|
$end: date!
|
|
$fixedStart: date!
|
|
$fixedEnd: date!
|
|
) {
|
|
timetickets(
|
|
where: {
|
|
date: { _gte: $start, _lte: $end }
|
|
employeeid: { _eq: $employeeid }
|
|
}
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
ciecacode
|
|
clockoff
|
|
clockon
|
|
cost_center
|
|
created_at
|
|
created_by
|
|
date
|
|
id
|
|
rate
|
|
productivehrs
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
}
|
|
}
|
|
fixedperiod: timetickets(
|
|
where: {
|
|
date: { _gte: $fixedStart, _lte: $fixedEnd }
|
|
employeeid: { _eq: $employeeid }
|
|
}
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
ciecacode
|
|
clockoff
|
|
clockon
|
|
cost_center
|
|
created_at
|
|
created_by
|
|
date
|
|
id
|
|
rate
|
|
productivehrs
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|
query QUERY_TIME_TICKETS_IN_RANGE_SB(
|
|
$start: date!
|
|
$end: date!
|
|
$fixedStart: date!
|
|
$fixedEnd: date!
|
|
$jobStart: timestamptz!
|
|
$jobEnd: timestamptz!
|
|
) {
|
|
timetickets(
|
|
where: {
|
|
date: { _gte: $start, _lte: $end }
|
|
cost_center: { _neq: "timetickets.labels.shift" }
|
|
}
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
ciecacode
|
|
clockoff
|
|
clockon
|
|
cost_center
|
|
created_at
|
|
created_by
|
|
date
|
|
id
|
|
rate
|
|
actualhrs
|
|
productivehrs
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
}
|
|
}
|
|
fixedperiod: timetickets(
|
|
where: {
|
|
date: { _gte: $fixedStart, _lte: $fixedEnd }
|
|
cost_center: { _neq: "timetickets.labels.shift" }
|
|
}
|
|
order_by: { date: desc_nulls_first }
|
|
) {
|
|
actualhrs
|
|
ciecacode
|
|
clockoff
|
|
clockon
|
|
cost_center
|
|
created_at
|
|
created_by
|
|
date
|
|
id
|
|
rate
|
|
productivehrs
|
|
memo
|
|
jobid
|
|
flat_rate
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
last_name
|
|
}
|
|
}
|
|
jobs(
|
|
where: {
|
|
date_invoiced: { _is_null: true }
|
|
ro_number: { _is_null: false }
|
|
voided: { _eq: false }
|
|
_or: [
|
|
{ actual_completion: { _gte: $jobStart, _lte: $jobEnd } }
|
|
{ actual_delivery: { _gte: $jobStart, _lte: $jobEnd } }
|
|
]
|
|
}
|
|
) {
|
|
id
|
|
joblines(order_by: { line_no: asc }, where: { removed: { _eq: false } }) {
|
|
convertedtolbr
|
|
convertedtolbr_data
|
|
mod_lb_hrs
|
|
mod_lbr_ty
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const INSERT_NEW_TIME_TICKET = gql`
|
|
mutation INSERT_NEW_TIME_TICKET(
|
|
$timeTicketInput: [timetickets_insert_input!]!
|
|
) {
|
|
insert_timetickets(objects: $timeTicketInput) {
|
|
returning {
|
|
id
|
|
created_by
|
|
clockon
|
|
clockoff
|
|
employeeid
|
|
productivehrs
|
|
actualhrs
|
|
ciecacode
|
|
date
|
|
memo
|
|
flat_rate
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const UPDATE_TIME_TICKET = gql`
|
|
mutation UPDATE_TIME_TICKET(
|
|
$timeticketId: uuid!
|
|
$timeticket: timetickets_set_input!
|
|
) {
|
|
update_timetickets(
|
|
where: { id: { _eq: $timeticketId } }
|
|
_set: $timeticket
|
|
) {
|
|
returning {
|
|
id
|
|
clockon
|
|
clockoff
|
|
employeeid
|
|
productivehrs
|
|
actualhrs
|
|
ciecacode
|
|
created_at
|
|
updated_at
|
|
jobid
|
|
date
|
|
flat_rate
|
|
memo
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_ACTIVE_TIME_TICKETS = gql`
|
|
query QUERY_ACTIVE_TIME_TICKETS($employeeId: uuid) {
|
|
timetickets(
|
|
order_by: { date: desc_nulls_first }
|
|
where: {
|
|
_and: {
|
|
clockoff: { _is_null: true }
|
|
employeeid: { _eq: $employeeId }
|
|
clockon: { _is_null: false }
|
|
jobid: { _is_null: false }
|
|
}
|
|
}
|
|
) {
|
|
id
|
|
clockon
|
|
memo
|
|
cost_center
|
|
flat_rate
|
|
jobid
|
|
job {
|
|
id
|
|
ownr_fn
|
|
ownr_ln
|
|
ownr_co_nm
|
|
v_model_desc
|
|
v_make_desc
|
|
v_model_yr
|
|
ro_number
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_ACTIVE_SHIFT_TIME_TICKETS = gql`
|
|
query QUERY_ACTIVE_SHIFT_TIME_TICKETS($employeeId: uuid) {
|
|
timetickets(
|
|
where: {
|
|
_and: {
|
|
clockoff: { _is_null: true }
|
|
employeeid: { _eq: $employeeId }
|
|
clockon: { _is_null: false }
|
|
jobid: { _is_null: true }
|
|
}
|
|
}
|
|
) {
|
|
id
|
|
clockon
|
|
memo
|
|
jobid
|
|
job {
|
|
id
|
|
ownr_fn
|
|
ownr_ln
|
|
ownr_co_nm
|
|
v_model_desc
|
|
v_make_desc
|
|
v_model_yr
|
|
ro_number
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const DELETE_TIME_TICKET = gql`
|
|
mutation DELETE_TIME_TICKET($id: uuid!) {
|
|
delete_timetickets_by_pk(id: $id) {
|
|
id
|
|
}
|
|
}
|
|
`;
|