Skip to content

Commit

Permalink
fixes merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoooc committed Feb 18, 2024
2 parents 7c25d2c + 6ec72b5 commit 351817e
Show file tree
Hide file tree
Showing 115 changed files with 3,588 additions and 611 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* text=auto eol=lf
*.png binary
# * text=auto eol=lf
# *.png binary
5 changes: 5 additions & 0 deletions package-lock.json

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

Binary file modified public/pfp-default-header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/pfp-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 0 additions & 20 deletions src/__tests__/GeneratePdfReport.test.js

This file was deleted.

8 changes: 6 additions & 2 deletions src/__tests__/mockStates.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export const userProfileMock = {
_id: '5edf141c78f1380017b829a6',
emailPubliclyAccessible: true,
phoneNumberPubliclyAccessible: true,
personalBestMaxHrs: 50,
badgeCollection: [],
infringements: [
{
Expand Down Expand Up @@ -590,6 +591,9 @@ export const userProfileMock = {
},
mediaUrl: 'http://dropbox.com',
weeklySummariesCount: 0,
savedTangibleHrs:[
0,0,0,0,0,0,0,0
],
};

export const timeEntryMock = {
Expand Down Expand Up @@ -627,7 +631,7 @@ export const timeEntryMock = {
{
_id: '5f2e1c7ab0186f202baf9d20',
notes:
'<p>d g g sg sd gs dg ag dg c jh&nbsp;</p>\n<p><a href="https://docs.google.com/document/d/1AQVluo0JNhAsqul-Zv1aNMhjX2eGuHKMCoGcvCI7XU4/edit">https://docs.google.com/document/d/1AQVluo0JNhAsqul-Zv1aNMhjX2eGuHKMCoGcvCI7XU4/edit#</a></p>\n<p>&nbsp;</p>',
'<p>d g g sg sd gs dg ag dg c jh&nbsp;</p>\n<p><a href="https://docs.google.com/document/d/1AQVluo0JNhAsqul-Zv1aNMhjX2eGuHKMCoGcvCI7XU4/edit">https://docs.google.com/document/d/1AQVluo0JNhAsqul-Zv1aNMhjX2eGuHKMCoGcvCI7XU4/edit#</a></p>\n<p>&nbsp;</p>',
isTangible: true,
personId: '5edf141c78f1380017b829a6',
projectId: '5e606e4f37477100173680ac',
Expand Down Expand Up @@ -1276,5 +1280,5 @@ export const rolesMock = {
}

describe('Stop Error', () => {
it('should not error out due to no tests (mockStates.js)', () => {});
it('should not error out due to no tests (mockStates.js)', () => { });
});
6 changes: 3 additions & 3 deletions src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { rootReducers as reducer } from '../store';

const middleware = [thunk];

function renderWithProvider(
export function renderWithProvider(
ui,
{ initialState, store = createStore(reducer), ...renderOptions } = {},
) {
Expand Down Expand Up @@ -85,8 +85,8 @@ export function sleep(ms) {
// re-export everything
export * from '@testing-library/react';
// override render method
export { renderWithProvider };
// export { renderWithProvider };

describe('Stop Error', () => {
it('should not error out due to no tests (utils.js)', () => {});
it('should not error out due to no tests (utils.js)', () => { });
});
22 changes: 20 additions & 2 deletions src/actions/bmdashboard/invTypeActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +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 } 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 } from "constants/bmdashboard/inventoryTypeConstants";
import { GET_ERRORS } from "constants/errors";

export const fetchMaterialTypes = () => {
Expand All @@ -16,6 +16,18 @@ export const fetchMaterialTypes = () => {
}
}

export const fetchToolTypes = () => {
return async dispatch => {
axios
.get(ENDPOINTS.BM_TOOL_TYPES)
.then(res => {
dispatch(setToolTypes(res.data));
})
.catch(err => {
dispatch(setErrors(err));
});
};
};
export const fetchInvTypeByType = (type) => {
const url = ENDPOINTS.BM_INVTYPE_TYPE(type);
return async dispatch => {
Expand Down Expand Up @@ -69,6 +81,12 @@ export const setInvTypes = payload => {
}
}

export const setToolTypes = payload => {
return {
type: GET_TOOL_TYPES,
payload,
};
};
export const setInvTypesByType = payload => {

return {
Expand All @@ -82,4 +100,4 @@ export const setErrors = payload => {
type: GET_ERRORS,
payload
}
}
}
17 changes: 14 additions & 3 deletions src/actions/bmdashboard/toolActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ export const fetchToolById = (toolId) => {
dispatch(setTool(res.data))
})
.catch(error => {
dispatch(setErrors(error))
})
dispatch(setErrors(error))
})
}
}

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

export const setTool = payload => {
return {
type: GET_TOOL_BY_ID,
Expand All @@ -25,7 +36,7 @@ export const setTool = payload => {
}

export const setErrors = payload => {
return {
return {
type: GET_ERRORS,
payload
}
Expand Down
17 changes: 6 additions & 11 deletions src/actions/information.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ENDPOINTS } from '../utils/URL';
// Get infoCollections
export const getInfoCollections = () => {
const url = ENDPOINTS.INFO_COLLECTIONS;
return async (dispatch) => {
return async dispatch => {
try {
const response = await axios.get(url);
dispatch(fetchInfosSuccess(response.data));
Expand All @@ -17,10 +17,9 @@ export const getInfoCollections = () => {
};

// Add new info collection
export const addInfoCollection = (newInfo) => {

export const addInfoCollection = newInfo => {
const url = ENDPOINTS.INFO_COLLECTIONS;
return async (dispatch) => {
return async dispatch => {
try {
const response = await axios.post(url, newInfo);
return response.status;
Expand All @@ -33,7 +32,7 @@ export const addInfoCollection = (newInfo) => {
// Update info collection
export const updateInfoCollection = (infoId, updatedInfo) => {
const url = ENDPOINTS.INFO_COLLECTION(infoId);
return async (dispatch) => {
return async dispatch => {
try {
const response = await axios.put(url, updatedInfo);
dispatch(updateInfoSuccess(response.data));
Expand All @@ -45,9 +44,9 @@ export const updateInfoCollection = (infoId, updatedInfo) => {
};

// Delete info collection by id
export const deleteInfoCollectionById = (infoId) => {
export const deleteInfoCollectionById = infoId => {
const url = ENDPOINTS.INFO_COLLECTION(infoId);
return async (dispatch) => {
return async dispatch => {
try {
const response = await axios.delete(url);
dispatch(deleteInfoSuccess(infoId));
Expand All @@ -64,7 +63,6 @@ export const deleteInfoSuccess = infoId => ({
payload: infoId,
});


// Actions creators
export const fetchInfosSuccess = infoCollectionsData => ({
type: actions.FETCH_INFOS_SUCCESS,
Expand All @@ -75,6 +73,3 @@ export const updateInfoSuccess = updatedInfo => ({
type: actions.UPDATE_INFO_SUCCESS,
payload: updatedInfo,
});



68 changes: 36 additions & 32 deletions src/actions/projectMembers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Author: Henry Ng - 02/03/20
******************************************************************************* */
import axios from 'axios';
import * as types from "../constants/projectMembership";
import * as types from '../constants/projectMembership';
import { searchWithAccent } from 'utils/search';
import { ENDPOINTS } from '../utils/URL';
/** *****************************************
Expand All @@ -16,13 +16,12 @@ export const getAllUserProfiles = () => {
await dispatch(findUsersStart());
request
.then(res => {
const {members} = getState().projectMembers;
const { members } = getState().projectMembers;
const users = res.data.map(user => {
if (!members.find(member => member._id === user._id)) {
return (user = { ...user, assigned: false });
}
return (user = { ...user, assigned: true });

}
return (user = { ...user, assigned: true });
});
// console.log(users);
dispatch(foundUsers(users));
Expand All @@ -38,32 +37,38 @@ export const getAllUserProfiles = () => {
* Call API to find a user profile
*/
export const findUserProfiles = keyword => {
const request = axios.get(ENDPOINTS.USER_PROFILES);
// Creates an array containing the first and last name and filters out whitespace
const fullName = keyword.split(' ').filter(name => name !== '');

return async (dispatch, getState) => {
await dispatch(findUsersStart());
request
.then(res => {
if (keyword.trim() !== '') {
let users = res.data.filter(user =>
searchWithAccent(user.firstName, keyword) || searchWithAccent(user.lastName, keyword)
);
const {members} = getState().projectMembers;
users = users.map(user => {
if (!members.find(member => member._id === user._id)) {
return (user = { ...user, assigned: false });
}
return (user = { ...user, assigned: true });

});
dispatch(foundUsers(users));
} else {
dispatch(foundUsers([]));
}
})
.catch(err => {
dispatch(findUsersError(err));
});
try {
let response;
if (fullName[0] && fullName[1]) {
response = await axios.get(
ENDPOINTS.USER_PROFILE_BY_FULL_NAME(`${fullName[0]} ${fullName[1]}`),
);
} else {
response = await axios.get(ENDPOINTS.USER_PROFILE_BY_SINGLE_NAME(fullName[0]));
console.log(response);
}
await dispatch(findUsersStart());
if (keyword !== '') {
let users = response.data;
const { members } = getState().projectMembers;
users = users.map(user => {
if (!members.find(member => member._id === user._id)) {
return (user = { ...user, assigned: false });
}
return (user = { ...user, assigned: true });
});
dispatch(foundUsers(users));
} else {
dispatch(foundUsers([]));
}
} catch (error) {
dispatch(foundUsers([]));
dispatch(findUsersError(error));
}
};
};

Expand Down Expand Up @@ -95,9 +100,9 @@ export const getProjectActiveUser = () => {
await dispatch(findUsersStart());
request
.then(res => {
const {members} = getState().projectMembers;
const { members } = getState().projectMembers;
const users = res.data.filter(user => {
return (members.find(member => member._id === user._id) && user.isActive === true)
return members.find(member => member._id === user._id) && user.isActive === true;
});
dispatch(foundUsers(users));
})
Expand Down Expand Up @@ -254,4 +259,3 @@ export const addNewMemberError = err => {
err,
};
};

Loading

0 comments on commit 351817e

Please sign in to comment.