Skip to content

Commit

Permalink
Merge pull request #1979 from OneCommunityGlobal/Chengyan-Phase2-Reus…
Browse files Browse the repository at this point in the history
…able-Purchase-Item-Form-Frontend

Chengyan phase2 reusable purchase item form frontend
  • Loading branch information
one-community authored Mar 18, 2024
2 parents 4a926e3 + 821b02d commit b9cb2ce
Show file tree
Hide file tree
Showing 17 changed files with 415 additions and 323 deletions.
26 changes: 23 additions & 3 deletions src/actions/bmdashboard/invTypeActions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
import axios from "axios";

import { ENDPOINTS } from "utils/URL";
import GET_MATERIAL_TYPES, { POST_BUILDING_MATERIAL_INVENTORY_TYPE, POST_ERROR_BUILDING_MATERIAL_INVENTORY_TYPE, RESET_POST_BUILDING_MATERIAL_INVENTORY_TYPE, GET_INV_BY_TYPE, GET_TOOL_TYPES } from "constants/bmdashboard/inventoryTypeConstants";

import GET_MATERIAL_TYPES, { POST_BUILDING_MATERIAL_INVENTORY_TYPE, POST_ERROR_BUILDING_MATERIAL_INVENTORY_TYPE, RESET_POST_BUILDING_MATERIAL_INVENTORY_TYPE, GET_INV_BY_TYPE, GET_TOOL_TYPES, GET_REUSABLE_TYPES } from "constants/bmdashboard/inventoryTypeConstants";
import { GET_ERRORS } from "constants/errors";

export const fetchMaterialTypes = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_MATERIAL_TYPES)
.then(res => {
dispatch(setInvTypes(res.data))
dispatch(setMaterialTypes(res.data))
})
.catch(err => {
dispatch(setErrors(err))
})
}
}

export const fetchReusableTypes = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_REUSABLE_TYPES)
.then(res => {
dispatch(setReusableTypes(res.data))
})
.catch(err => {
dispatch(setErrors(err))
Expand Down Expand Up @@ -74,13 +87,20 @@ export const resetPostBuildingInventoryTypeResult = () => {
}


export const setInvTypes = payload => {
export const setMaterialTypes = payload => {
return {
type: GET_MATERIAL_TYPES,
payload
}
}

export const setReusableTypes = payload => {
return {
type: GET_REUSABLE_TYPES,
payload
}
}

export const setToolTypes = payload => {
return {
type: GET_TOOL_TYPES,
Expand Down
12 changes: 11 additions & 1 deletion src/actions/bmdashboard/reusableActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ export const fetchAllReusables = () => {
dispatch(setErrors(err))
})
}
}
}

export const purchaseReusable = async (body) => {
return axios.post(ENDPOINTS.BM_PURCHASE_REUSABLES, body)
.then(res => res)
.catch((err) => {
if (err.response) return err.response
if (err.request) return err.request
return err.message
})
}

This file was deleted.

193 changes: 0 additions & 193 deletions src/components/BMDashboard/MaterialPurchaseRequest/PurchaseForm.jsx

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/BMDashboard/MaterialPurchaseRequest/index.js

This file was deleted.

Loading

0 comments on commit b9cb2ce

Please sign in to comment.