Skip to content

Commit

Permalink
Merge branch 'development' into Peterson_Implement_toast_when_user_is…
Browse files Browse the repository at this point in the history
…_already_in_a_team
  • Loading branch information
peterson337 authored Jun 7, 2024
2 parents 8dfccc2 + 2c3f5d8 commit 3400b9a
Show file tree
Hide file tree
Showing 213 changed files with 5,500 additions and 2,126 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ src/components/common/**
src/components/Header/**
src/components/BMDashboard/BMHeader/**
src/components/MonthlyEffort/**

src/components/PermissionsManagement/**
src/components/ProfileLinks/**
src/components/Projects/**
src/components/Reports/**
Expand All @@ -35,7 +33,6 @@ src/components/TeamMemberTasks/**
src/components/Teams/**
src/components/TeamLocations/**
src/components/Timelog/**
src/components/UpdatePassword/**
src/components/UserManagement/**
src/components/UserProfile/**
src/components/Announcements/**
Expand Down
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ module.exports = {
'react/display-name': 'off',
'react/no-direct-mutation-state': 'off',
'react/no-unknown-property': 'off',
'react/destructuring-assignment': 'off',
'react/react-in-jsx-scope': 'off',
'import/no-duplicates': 'off',
'import/no-named-as-default': 'off',
'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'no-alert': 'error',
'no-console': 'error',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
Expand Down
6 changes: 0 additions & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@ src/__tests__/**

src/components/App.jsx
src/components/AutoReload/**



src/components/Header/**
src/components/Inventory/**
src/components/Memberships/**
src/components/MonthlyEffort/**
src/components/NewProfileLink/**

src/components/PermissionsManagement/**
src/components/ProfileLinks/**
src/components/Projects/**
src/components/Reports/**
Expand All @@ -39,7 +34,6 @@ src/components/TeamLocations/**
src/components/TeamMemberTasks/**
src/components/Teams/**
src/components/Timelog/**
src/components/UpdatePassword/**
src/components/UserManagement/**
src/components/UserProfile/**
src/components/Announcements/**
3 changes: 1 addition & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"jwt-decode": "^2.2.0",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"lz-string": "^1.5.0",
"moment": "^2.29.2",
"moment-timezone": "^0.5.33",
"pdfmake": "^0.1.65",
Expand Down
5 changes: 4 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="%PUBLIC_URL%/index.css" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />

<script
src="https://cdn.tiny.cloud/1/1rsz7lmakcvzg8trwjy91zht48pj4oubz8jrdyqxbbr63pvs/tinymce/5/tinymce.min.js"
referrerpolicy="origin"
></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/AssignBadgePopup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import AssignBadgePopup from 'components/Badge/AssignBadgePopup';
import { Provider } from 'react-redux';
import { themeMock } from './mockStates';

const mockStore = configureStore([thunk]);

Expand All @@ -24,6 +25,7 @@ const mockSubmit = jest.fn();
const renderComponent = () => {
const store = mockStore({
badge: { allBadgeData: mockallBadgeData },
theme: themeMock,
});

return render(
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/mockAdminState.js
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,7 @@ export default {
'updatePassword',
'deleteUserProfile',
'infringementAuthorizer',
'manageAdminLinks',
// WBS
'postWbs',
'deleteWbs',
Expand Down Expand Up @@ -1795,6 +1796,7 @@ export default {
'getTimeZoneAPIKey',
'checkLeadTeamOfXplus',
'editTeamCode',
'manageAdminLinks',
],
},
]
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/mockStates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ export const rolesMock = {
'postUserProfile',
'putUserProfile',
'putUserProfileImportantInfo',
'manageAdminLinks',
'changeUserStatus',
'updatePassword',
'deleteUserProfile',
Expand Down Expand Up @@ -1260,6 +1261,7 @@ export const rolesMock = {
'putUserProfileImportantInfo',
'deleteUserProfile',
'infringementAuthorizer',
'manageAdminLinks',
'postWbs',
'deleteWbs',
'getAllInvInProjectWBS',
Expand Down
41 changes: 41 additions & 0 deletions src/actions/bmdashboard/invTypeActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
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 { 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 Down Expand Up @@ -32,9 +34,11 @@ export const fetchToolTypes = () => {
axios
.get(ENDPOINTS.BM_TOOL_TYPES)
.then(res => {
// console.log("tool types: ", res)
dispatch(setToolTypes(res.data));
})
.catch(err => {
// console.log("fetchToolTypes err: ", err)
dispatch(setErrors(err));
});
};
Expand Down Expand Up @@ -180,5 +184,42 @@ export const setErrors = payload => {
payload
}
};
//
export const postToolsLog = payload => {
return async dispatch => {
axios
.post(ENDPOINTS.BM_LOG_TOOLS, payload)
.then(res => {
// eslint-disable-next-line no-console
// eslint-disable-next-line no-use-before-define
dispatch(setToolsLogResult(res.data));
})
.catch(err => {
dispatch(
// setPostErrorToolsLog(JSON.stringify(err.response.data) || 'Sorry! Some error occurred!'),
// eslint-disable-next-line no-use-before-define
setPostErrorToolsLog(err.response.data || 'Sorry! Some error occurred!'),
);
});
};
};

export const setToolsLogResult = payload => {
return {
type: POST_TOOLS_LOG,
payload,
};
};

export const setPostErrorToolsLog = payload => {
return {
type: POST_ERROR_TOOLS_LOG,
payload,
};
};

export const resetPostToolsLog = () => {
return {
type: RESET_POST_TOOLS_LOG,
};
};
57 changes: 41 additions & 16 deletions src/actions/bmdashboard/toolActions.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import axios from 'axios';
import { ENDPOINTS } from 'utils/URL';
import GET_TOOL_BY_ID from 'constants/bmdashboard/toolsConstants';
import { GET_ERRORS } from 'constants/errors';
import GET_TOOL_BY_ID, { GET_TOOLS } from '../../constants/bmdashboard/toolsConstants';
import { GET_ERRORS } from '../../constants/errors';
import { ENDPOINTS } from '../../utils/URL';

export const fetchTools = () => {
const url = ENDPOINTS.BM_TOOLS;
return async dispatch => {
axios
.get(url)
.then(res => {
// eslint-disable-next-line no-use-before-define
dispatch(setTools(res.data));
})
.catch(error => {
// eslint-disable-next-line no-console
console.log('err: ', error.response.data.message);
// eslint-disable-next-line no-use-before-define
dispatch(setErrors(error));
});
};
};

export const fetchToolById = (toolId) => {
export const fetchToolById = toolId => {
const url = ENDPOINTS.BM_TOOL_BY_ID(toolId);
return async dispatch => {
axios.get(url)
axios
.get(url)
.then(res => {
dispatch(setTool(res.data))
dispatch(setTool(res.data));
})
.catch(error => {
dispatch(setErrors(error))
})
}
}
dispatch(setErrors(error));
});
};
};

export const purchaseTools = async body => {
return axios
Expand All @@ -28,16 +46,23 @@ export const purchaseTools = async body => {
});
};

export const setTools = payload => {
return {
type: GET_TOOLS,
payload,
};
};

export const setTool = payload => {
return {
type: GET_TOOL_BY_ID,
payload
}
}
payload,
};
};

export const setErrors = payload => {
return {
type: GET_ERRORS,
payload
}
}
payload,
};
};
1 change: 1 addition & 0 deletions src/components/BMDashboard/ItemList/ItemListView.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

.select_input {
display: flex;
background-color: blanchedalmond;
align-items: flex-end;
width: 300px;
column-gap: 1rem;
Expand Down
10 changes: 8 additions & 2 deletions src/components/BMDashboard/ItemList/SelectItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Form, FormGroup, Label, Input } from 'reactstrap';

export default function SelectItem({ items, selectedProject, selectedItem, setSelectedItem }) {
export default function SelectItem({
items,
selectedProject,
selectedItem,
setSelectedItem,
label,
}) {
let itemSet = [];
if (items.length) {
if (selectedProject === 'all') itemSet = [...new Set(items.map(m => m.itemType?.name))];
Expand All @@ -16,7 +22,7 @@ export default function SelectItem({ items, selectedProject, selectedItem, setSe
<Form>
<FormGroup className="select_input">
<Label htmlFor="select-material" style={{ marginLeft: '10px' }}>
Material:
{label ? `${label}:` : 'Material:'}
</Label>
<Input
id="select-item"
Expand Down
Loading

0 comments on commit 3400b9a

Please sign in to comment.