Skip to content

Commit

Permalink
Merge pull request #2352 from OneCommunityGlobal/development
Browse files Browse the repository at this point in the history
Frontend Release to Main [3.60]
  • Loading branch information
one-community authored Jun 13, 2024
2 parents b69068b + 3499ec4 commit ac21225
Show file tree
Hide file tree
Showing 48 changed files with 1,268 additions and 1,044 deletions.
30 changes: 10 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"redux-concatenate-reducers": "^1.0.0",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
"tinymce": "^5.10.9",
"tinymce": "^7.0.0",
"uuid": "^9.0.1"
},
"scripts": {
Expand Down
31 changes: 30 additions & 1 deletion src/actions/bmdashboard/equipmentActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import { ENDPOINTS } from "utils/URL";
import GET_EQUIPMENT_BY_ID from 'constants/bmdashboard/equipmentConstants';
import GET_EQUIPMENT_BY_ID,{SET_EQUIPMENTS}from 'constants/bmdashboard/equipmentConstants';
import { GET_ERRORS } from 'constants/errors';

export const fetchEquipmentById = (equipmentId) => {
Expand All @@ -16,6 +16,25 @@ export const fetchEquipmentById = (equipmentId) => {
}
}

export const fetchAllEQUIPMENTS = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_EQUIPMENTS)
.then(res => {
dispatch(setEquipments(res.data))
})
.catch(err => {
dispatch(setErrors(err))
})
}
}

export const setEquipments = payload => {
return {
type: SET_EQUIPMENTS,
payload
}
}

export const addEquipmentType = async (body) => {
return axios.post(`${ENDPOINTS.BM_INVTYPE_ROOT}/equipment`, body)
.then(res => res)
Expand All @@ -38,4 +57,14 @@ export const setErrors = payload => {
type: GET_ERRORS,
payload
}
}

export const purchaseEquipment = async (body) => {
return axios.post(ENDPOINTS.BM_EQUIPMENT_PURCHASE, body)
.then(res => res)
.catch((err) => {
if (err.response) return err.response
if (err.request) return err.request
return err.message
})
}
23 changes: 21 additions & 2 deletions src/actions/bmdashboard/invTypeActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
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 ,GET_CONSUMABLE_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_CONSUMABLE_TYPES, GET_EQUIPMENT_TYPES, GET_REUSABLE_TYPES } from "constants/bmdashboard/inventoryTypeConstants";
import { POST_TOOLS_LOG, POST_ERROR_TOOLS_LOG, RESET_POST_TOOLS_LOG } from 'constants/bmdashboard/toolsConstants';

import { GET_ERRORS } from "constants/errors";

export const fetchMaterialTypes = () => {
Expand All @@ -17,7 +16,20 @@ export const fetchMaterialTypes = () => {
}
}

export const fetchEquipmentTypes = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_EQUIPMENT_TYPES)
.then(res => {
dispatch(setEquipmentTypes(res.data))
})
.catch(err => {
dispatch(setErrors(err))
})
}
}

export const fetchReusableTypes = () => {
console.log("fetchReusableTypes");
return async dispatch => {
axios.get(ENDPOINTS.BM_REUSABLE_TYPES)
.then(res => {
Expand Down Expand Up @@ -157,6 +169,13 @@ export const setMaterialTypes = payload => {
}
}

export const setEquipmentTypes = payload => {
return {
type: GET_EQUIPMENT_TYPES,
payload
}
}

export const setReusableTypes = payload => {
return {
type: GET_REUSABLE_TYPES,
Expand Down
Loading

0 comments on commit ac21225

Please sign in to comment.