Functionality to add prices as a client, and view them as a provider

This commit is contained in:
Alexander Wong
2018-02-07 15:52:29 -07:00
parent e6ee51f481
commit 631d1f6d39
13 changed files with 875 additions and 4 deletions

View File

@@ -0,0 +1,78 @@
import {
IS_SENDING_PRICE_REQUEST,
SET_PRICE_REQUEST_ERROR,
CLEAR_PRICE_REQUEST_ERROR,
SET_PRICE_REQUEST_SUCCESS,
CLEAR_PRICE_REQUEST_SUCCESS,
SET_GET_EMPLOYEE_UUID,
SET_GET_WORKTYPE_UUID,
SET_FORM_PRICE_AMOUNT
} from "../../constants/price.constants";
import { parseError } from "../common.actions";
export function isSendingPriceRequest(sendingRequest) {
return {
type: IS_SENDING_PRICE_REQUEST,
data: sendingRequest
};
}
export function setPriceRequestError(exception) {
let error = parseError(exception);
if (error.amount) {
error["Amount"] = error.amount;
delete error["amount"];
}
if (error.get_employee_uuid) {
error["Employee"] = error.get_employee_uuid;
delete error["get_employee_uuid"];
}
if (error.get_work_type_uuid) {
error["WorkType"] = error.get_work_type_uuid;
delete error["get_work_type_uuid"];
}
return {
type: SET_PRICE_REQUEST_ERROR,
data: error
};
}
export function clearPriceRequestError() {
return {
type: CLEAR_PRICE_REQUEST_ERROR
};
}
export function setPriceRequestSuccess(response) {
return {
type: SET_PRICE_REQUEST_SUCCESS,
data: response.detail || response
};
}
export function clearPriceRequestSuccess() {
return {
type: CLEAR_PRICE_REQUEST_SUCCESS
};
}
export function setGetEmployeeUUID(uuid) {
return {
type: SET_GET_EMPLOYEE_UUID,
data: uuid
};
}
export function setGetWorktypeUUID(uuid) {
return {
type: SET_GET_WORKTYPE_UUID,
data: uuid
};
}
export function setFormPriceAmount(amount) {
return {
type: SET_FORM_PRICE_AMOUNT,
data: amount
};
}

View File

@@ -0,0 +1,26 @@
import {
CREATE_PRICE_REQUEST,
UPDATE_PRICE_REQUEST,
DELETE_PRICE_REQUEST
} from "../../constants/price.constants";
export function createPriceRequest(postBody) {
return {
type: CREATE_PRICE_REQUEST,
data: postBody
};
}
export function updatePriceRequest(payload) {
return {
type: UPDATE_PRICE_REQUEST,
data: payload
};
}
export function deletePriceRequest(payload) {
return {
type: DELETE_PRICE_REQUEST,
data: payload
};
}