added missing fuctionallity
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import TimeTicketsActionTypes from "./timetickets.types";
|
||||
|
||||
export const setTimeTicket = (timeTicket) => ({
|
||||
type: TimeTicketsActionTypes.SET_TIME_TICKET,
|
||||
payload: timeTicket,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import TimeTicketsActionTypes from "./timetickets.types";
|
||||
|
||||
const INITIAL_STATE = {
|
||||
timeTicket: null,
|
||||
timeTickets: [],
|
||||
timeTicketJobId: null,
|
||||
ttjobid:null,
|
||||
timeticketjobid: null,
|
||||
timeTicketJob: null,
|
||||
uploadTimeTicketInProgress: false,
|
||||
uploadTimeTicketError: null,
|
||||
@@ -14,22 +13,19 @@ const timeTicketsReducer = (state = INITIAL_STATE, action) => {
|
||||
case TimeTicketsActionTypes.SET_TIME_TICKET:
|
||||
return {
|
||||
...state,
|
||||
timeTicket: action.payload,
|
||||
timeTicket: action.payload
|
||||
};
|
||||
case TimeTicketsActionTypes.SET_TIME_TICKET_JOB_ID:
|
||||
return {
|
||||
...state,
|
||||
timeTicketJobId: action.payload,
|
||||
};
|
||||
return { ...state,timeticketjobid: action.payload };
|
||||
case TimeTicketsActionTypes.SET_TIME_TICKET_JOB:
|
||||
return {
|
||||
...state,
|
||||
timeTicketJob: action.payload,
|
||||
timeTicketJob: action.payload
|
||||
};
|
||||
case TimeTicketsActionTypes.TIME_TICKET_CREATE_START:
|
||||
return {
|
||||
...state,
|
||||
uploadTimeTicketInProgress: true,
|
||||
uploadTimeTicketInProgress: true
|
||||
};
|
||||
case TimeTicketsActionTypes.TIME_TICKET_CREATE_SUCCESS:
|
||||
return {
|
||||
|
||||
@@ -29,39 +29,39 @@ export function* insertNewTimeTicket({ payload: { timeTicketInput } }) {
|
||||
// pin: pin,
|
||||
// });
|
||||
// const { valid, data, error } = response.data;
|
||||
const result = yield client.mutate({
|
||||
mutation: INSERT_NEW_TIME_TICKET,
|
||||
variables: {
|
||||
timeTicketInput: [
|
||||
// {
|
||||
// bodyshopid: bodyshop.id,
|
||||
// employeeid: technician.id,
|
||||
// date: moment(theTime).format("YYYY-MM-DD"),
|
||||
// clockon: moment(theTime),
|
||||
// jobid: values.jobid,
|
||||
// cost_center: values.cost_center,
|
||||
// ciecacode:
|
||||
// bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
// ? values.cost_center
|
||||
// : Object.keys(
|
||||
// bodyshop.md_responsibility_centers.defaults.costs
|
||||
// ).find((key) => {
|
||||
// return (
|
||||
// bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
// values.cost_center
|
||||
// );
|
||||
// }),
|
||||
// },
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(result);
|
||||
const { valid, data, error } = result.data;
|
||||
if (valid) {
|
||||
yield put(timeTicketCreateSuccess(data));
|
||||
} else {
|
||||
yield put(timeTicketCreateFailure(error));
|
||||
}
|
||||
// const result = yield client.mutate({
|
||||
// mutation: INSERT_NEW_TIME_TICKET,
|
||||
// variables: {
|
||||
// timeTicketInput: [
|
||||
// // {
|
||||
// // bodyshopid: bodyshop.id,
|
||||
// // employeeid: technician.id,
|
||||
// // date: moment(theTime).format("YYYY-MM-DD"),
|
||||
// // clockon: moment(theTime),
|
||||
// // jobid: values.jobid,
|
||||
// // cost_center: values.cost_center,
|
||||
// // ciecacode:
|
||||
// // bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
// // ? values.cost_center
|
||||
// // : Object.keys(
|
||||
// // bodyshop.md_responsibility_centers.defaults.costs
|
||||
// // ).find((key) => {
|
||||
// // return (
|
||||
// // bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
// // values.cost_center
|
||||
// // );
|
||||
// // }),
|
||||
// // },
|
||||
// ],
|
||||
// },
|
||||
// });
|
||||
// console.log(result);
|
||||
// const { valid, data, error } = result.data;
|
||||
// if (valid) {
|
||||
// yield put(timeTicketCreateSuccess(data));
|
||||
// } else {
|
||||
// yield put(timeTicketCreateFailure(error));
|
||||
// }
|
||||
} catch (error) {
|
||||
yield put(timeTicketCreateFailure(error));
|
||||
}
|
||||
|
||||
@@ -14,3 +14,4 @@ export const selectCurrentTimeTicket = createSelector(
|
||||
[selectTimeTicketsState],
|
||||
(timeTickets) => timeTickets.timeTicket
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user