167 lines
3.0 KiB
JavaScript
167 lines
3.0 KiB
JavaScript
import gql from "graphql-tag";
|
|
|
|
export const QUERY_TICKETS_BY_JOBID = gql`
|
|
query QUERY_TICKETS_BY_JOBID($jobid: uuid!) {
|
|
timetickets(where: { jobid: { _eq: $jobid } }) {
|
|
actualhrs
|
|
cost_center
|
|
ciecacode
|
|
rate
|
|
productivehrs
|
|
id
|
|
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
|
|
date
|
|
id
|
|
rate
|
|
productivehrs
|
|
memo
|
|
job {
|
|
id
|
|
ro_number
|
|
}
|
|
employeeid
|
|
employee {
|
|
id
|
|
employee_number
|
|
first_name
|
|
cost_center
|
|
last_name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const INSERT_NEW_TIME_TICKET = gql`
|
|
mutation INSERT_NEW_TIME_TICKET(
|
|
$timeTicketInput: [timetickets_insert_input!]!
|
|
) {
|
|
insert_timetickets(objects: $timeTicketInput) {
|
|
returning {
|
|
id
|
|
clockon
|
|
clockoff
|
|
employeeid
|
|
productivehrs
|
|
actualhrs
|
|
ciecacode
|
|
date
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_ACTIVE_TIME_TICKETS = gql`
|
|
query QUERY_ACTIVE_TIME_TICKETS($employeeId: uuid) {
|
|
timetickets(
|
|
where: {
|
|
_and: {
|
|
clockoff: { _is_null: true }
|
|
employeeid: { _eq: $employeeId }
|
|
clockon: { _is_null: false }
|
|
jobid: { _is_null: false }
|
|
}
|
|
}
|
|
) {
|
|
id
|
|
clockon
|
|
memo
|
|
job {
|
|
id
|
|
est_number
|
|
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
|
|
job {
|
|
id
|
|
est_number
|
|
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
|
|
}
|
|
}
|
|
`;
|