| } | } | ||||
| }, [filters.companies.selectedCompaniesLocally]); | }, [filters.companies.selectedCompaniesLocally]); | ||||
| console.log("Comapnies", filters.companies) | |||||
| return ( | return ( | ||||
| <FilterSubDropdown | <FilterSubDropdown | ||||
| searchPlaceholder={t("filters.company.placeholder")} | searchPlaceholder={t("filters.company.placeholder")} |
| const filters = props.filters; | const filters = props.filters; | ||||
| const allLocations = useMemo(() => filters.locations.allLocations || [], [filters.locations]) | const allLocations = useMemo(() => filters.locations.allLocations || [], [filters.locations]) | ||||
| console.log("allLocations", allLocations); | |||||
| useImperativeHandle(ref, () => ({ | useImperativeHandle(ref, () => ({ | ||||
| closeSection: () => { | closeSection: () => { |
| locationRef.current.closeSection(); | locationRef.current.closeSection(); | ||||
| companyRef.current.closeSection(); | companyRef.current.closeSection(); | ||||
| }; | }; | ||||
| console.log(offers); | |||||
| return ( | return ( | ||||
| <FilterCardContainer | <FilterCardContainer | ||||
| filtersOpened={props.filtersOpened} | filtersOpened={props.filtersOpened} |
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <MiniChatCardContainer selected={props.selected} onClick={changeChat}> | <MiniChatCardContainer selected={props.selected} onClick={changeChat}> | ||||
| <ProfileImage | <ProfileImage |
| type: USERS_DELETE_TYPE, | type: USERS_DELETE_TYPE, | ||||
| }); | }); | ||||
| }; | }; | ||||
| // console.log(props.profile); | |||||
| const blockUser = () => { | const blockUser = () => { | ||||
| setDeleteOrEditModal({ | setDeleteOrEditModal({ | ||||
| show: true, | show: true, |
| const ProfileMainInfo = (props) => { | const ProfileMainInfo = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const { isMobile } = useIsMobile(); | const { isMobile } = useIsMobile(); | ||||
| console.log(props.profile); | |||||
| const goToUser = () => { | const goToUser = () => { | ||||
| if (isAdminRoute()) { | if (isAdminRoute()) { | ||||
| history.push( | history.push( | ||||
| ); | ); | ||||
| } | } | ||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <ProfileMainInfoContainer isAdmin={props.isAdmin}> | <ProfileMainInfoContainer isAdmin={props.isAdmin}> | ||||
| <AvatarImageContainer> | <AvatarImageContainer> |
| const handleRemove = () => { | const handleRemove = () => { | ||||
| setRemoveModalOpened(true); | setRemoveModalOpened(true); | ||||
| }; | }; | ||||
| console.log(props); | |||||
| const review = useMemo(() => { | const review = useMemo(() => { | ||||
| if (props.givingReview) { | if (props.givingReview) { | ||||
| return { | return { |
| const GivenReviewsHeader = (props) => { | const GivenReviewsHeader = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <GivenReviewsHeaderContainer hasGivenReview={props.hasGivenReview}> | <GivenReviewsHeaderContainer hasGivenReview={props.hasGivenReview}> | ||||
| <CompanyLabel>{t("reviews.givenHeaderTitle")} </CompanyLabel> | <CompanyLabel>{t("reviews.givenHeaderTitle")} </CompanyLabel> |
| changePage={handleChangePage} | changePage={handleChangePage} | ||||
| > | > | ||||
| <ChatPagingText> | <ChatPagingText> | ||||
| {(paging.currentPage - 1) * 6 + 1}- | |||||
| {chats?.length > 0 ? (paging.currentPage - 1) * 6 + 1 : 0}- | |||||
| {(paging.currentPage - 1) * 6 + chats.length} | {(paging.currentPage - 1) * 6 + chats.length} | ||||
| </ChatPagingText> | </ChatPagingText> | ||||
| </Paging> | </Paging> |
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log("newm", props); | |||||
| if (mineProfileBlocked) { | if (mineProfileBlocked) { | ||||
| return <NotAllowedChat mineProfileBlocked />; | return <NotAllowedChat mineProfileBlocked />; | ||||
| } | } |
| // Handling search when user is on marketplace and when he is not | // Handling search when user is on marketplace and when he is not | ||||
| const handleSearch = (value) => { | const handleSearch = (value) => { | ||||
| if (isAdminRoute()) { | if (isAdminRoute()) { | ||||
| console.log("admin"); | |||||
| search.setSearchStringManually(value); | search.setSearchStringManually(value); | ||||
| } else { | } else { | ||||
| if (!routeMatches(HOME_PAGE) && !routeMatches(BASE_PAGE)) { | if (!routeMatches(HOME_PAGE) && !routeMatches(BASE_PAGE)) { | ||||
| <LogoHorizontal /> | <LogoHorizontal /> | ||||
| </LogoContainer> | </LogoContainer> | ||||
| <SearchInput ref={searchRef} handleSearch={handleSearch} /> | |||||
| <SearchInput ref={searchRef} handleSearch={handleSearch} user={user} /> | |||||
| {routeMatches(ABOUT_PAGE) && <AboutHeader />} | {routeMatches(ABOUT_PAGE) && <AboutHeader />} | ||||
| {user ? ( | {user ? ( |
| return ( | return ( | ||||
| <SearchInputContainer | <SearchInputContainer | ||||
| fullWidth | fullWidth | ||||
| wider={!props.user} | |||||
| InputProps={{ | InputProps={{ | ||||
| endAdornment: ( | endAdornment: ( | ||||
| <EndIcon size="36px"> | <EndIcon size="36px"> | ||||
| SearchInput.propTypes = { | SearchInput.propTypes = { | ||||
| handleSearch: PropTypes.func, | handleSearch: PropTypes.func, | ||||
| user: PropTypes.bool, | |||||
| }; | }; | ||||
| export default SearchInput; | export default SearchInput; |
| display: block; | display: block; | ||||
| width: 80%; | width: 80%; | ||||
| height: 46px; | height: 46px; | ||||
| ${props => props.wider && `flex: 3;`} | |||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| & div { | & div { | ||||
| height: 46px; | height: 46px; |
| }); | }); | ||||
| const handleChangeSelect = (event) => { | const handleChangeSelect = (event) => { | ||||
| console.log(sorting); | |||||
| sorting?.changeSorting(event.target.value); | sorting?.changeSorting(event.target.value); | ||||
| }; | }; | ||||
| const handleClickCategory = () => { | const handleClickCategory = () => { | ||||
| const goBack = () => { | const goBack = () => { | ||||
| history.goBack(); | history.goBack(); | ||||
| }; | }; | ||||
| console.log(headerString); | |||||
| return ( | return ( | ||||
| <> | <> |
| const MarketPlace = (props) => { | const MarketPlace = (props) => { | ||||
| const [isGrid, setIsGrid] = useState(false); | const [isGrid, setIsGrid] = useState(false); | ||||
| const offers = props.offers; | const offers = props.offers; | ||||
| console.log("MARKETPLACE"); | |||||
| return ( | return ( | ||||
| <MarketPlaceContainer> | <MarketPlaceContainer> | ||||
| <Header | <Header |
| const DeleteCategory = (props) => { | const DeleteCategory = (props) => { | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| console.log(props.category); | |||||
| const handleCancel = () => { | const handleCancel = () => { | ||||
| props.setOpenedDeleteModal(false); | props.setOpenedDeleteModal(false); | ||||
| }; | }; |
| if (next !== clickedOnNext) setClickedOnNext(next); | if (next !== clickedOnNext) setClickedOnNext(next); | ||||
| formik.handleSubmit(); | formik.handleSubmit(); | ||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <BackdropComponent | <BackdropComponent |
| if (offer?.offer?.userId?.toString() === userId?.toString()) return true; | if (offer?.offer?.userId?.toString() === userId?.toString()) return true; | ||||
| return false; | return false; | ||||
| }, [offer, userId]); | }, [offer, userId]); | ||||
| console.log(offer); | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| {isLoadingOfferContent || isLoadingOfferContent === undefined ? ( | {isLoadingOfferContent || isLoadingOfferContent === undefined ? ( |
| }; | }; | ||||
| const handleSearch = () => { | const handleSearch = () => { | ||||
| if (props.isAdmin) { | if (props.isAdmin) { | ||||
| console.log(searchRef.current.value); | |||||
| if (props.handleSearch) props.handleSearch(searchRef.current.value); | if (props.handleSearch) props.handleSearch(searchRef.current.value); | ||||
| else search.searchOffersImmediately(searchRef.current.value); | else search.searchOffersImmediately(searchRef.current.value); | ||||
| } else { | } else { |
| const reviews = useSelector(selectSelectedReviews); | const reviews = useSelector(selectSelectedReviews); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const [value, setValue] = useState(); | const [value, setValue] = useState(); | ||||
| console.log(reviews); | |||||
| const changeValue = (event) => { | const changeValue = (event) => { | ||||
| if (props.isAdmin) { | if (props.isAdmin) { | ||||
| console.log("sortiranje: ", event.target.value); | |||||
| // if(event.target.value.value === 1) { | // if(event.target.value.value === 1) { | ||||
| // dispatch(setReviews(reviews.givenReviews)); | // dispatch(setReviews(reviews.givenReviews)); | ||||
| // } else { | // } else { |
| // } | // } | ||||
| }, [props.profileReviews, routeMatch]); | }, [props.profileReviews, routeMatch]); | ||||
| const lastThreeReviews = useMemo(() => { | const lastThreeReviews = useMemo(() => { | ||||
| console.log("isGiven", isGiven); | |||||
| if (props.isAdmin) { | if (props.isAdmin) { | ||||
| if (isGiven) { | if (isGiven) { | ||||
| return reviews.givenReviews; | return reviews.givenReviews; | ||||
| }, [props.profileReviews, offer, props.isProfileReviews, reviews, isGiven]); | }, [props.profileReviews, offer, props.isProfileReviews, reviews, isGiven]); | ||||
| const handleChangeSorting = (newSortOption) => { | const handleChangeSorting = (newSortOption) => { | ||||
| console.log("newSortOption",newSortOption); | |||||
| listRef.current.scrollTo({ top: 0, behaviour: "smooth" }); | listRef.current.scrollTo({ top: 0, behaviour: "smooth" }); | ||||
| if (props.isAdmin) { | if (props.isAdmin) { | ||||
| if (newSortOption.value === 1) { | if (newSortOption.value === 1) { | ||||
| } | } | ||||
| }; | }; | ||||
| console.log(sortRef.current?.sortValue); | |||||
| console.log(lastThreeReviews); | |||||
| return ( | return ( | ||||
| <UserReviewsContainer className={props.className}> | <UserReviewsContainer className={props.className}> | ||||
| {!props.givingReview && | {!props.givingReview && |
| Array.isArray(selectedCompaniesRedux) ? selectedCompaniesRedux : [] | Array.isArray(selectedCompaniesRedux) ? selectedCompaniesRedux : [] | ||||
| ); | ); | ||||
| console.log('allcompanies', allCompaniesRedux); | |||||
| const allCompanies = useMemo(() => | const allCompanies = useMemo(() => | ||||
| Array.isArray(allCompaniesRedux) ? allCompaniesRedux : [] | Array.isArray(allCompaniesRedux) ? allCompaniesRedux : [] | ||||
| ); | ); |
| const apply = () => { | const apply = () => { | ||||
| filters.apply(); | filters.apply(); | ||||
| console.log("ovde"); | |||||
| const newQueryString = makeQueryStringHelper( | const newQueryString = makeQueryStringHelper( | ||||
| filters, | filters, | ||||
| paging, | paging, | ||||
| }; | }; | ||||
| const applyFilters = () => { | const applyFilters = () => { | ||||
| console.log("applyfilters"); | |||||
| setFiltersCleared(true); | setFiltersCleared(true); | ||||
| }; | }; | ||||
| const clearFiltersAndApply = () => { | const clearFiltersAndApply = () => { | ||||
| clear(); | clear(); | ||||
| console.log("clearfiltersandapply filterscleared"); | |||||
| setFiltersCleared(true); | setFiltersCleared(true); | ||||
| }; | }; | ||||
| const clearOnlyFiltersAndApply = () => { | const clearOnlyFiltersAndApply = () => { | ||||
| filters.clear(); | filters.clear(); | ||||
| paging.changePage(1); | paging.changePage(1); | ||||
| console.log("clearonlyfiltersandapply filterscleared"); | |||||
| setFiltersCleared(true); | setFiltersCleared(true); | ||||
| }; | }; |
| }; | }; | ||||
| }, []); | }, []); | ||||
| const handleSearch = (value) => { | const handleSearch = (value) => { | ||||
| console.log(value); | |||||
| dispatch(setManualSearchString(value)); | dispatch(setManualSearchString(value)); | ||||
| }; | }; | ||||
| const categoriesToShow = useMemo(() => { | const categoriesToShow = useMemo(() => { |
| }; | }; | ||||
| }, []); | }, []); | ||||
| const handleSearch = (value) => { | const handleSearch = (value) => { | ||||
| console.log(value); | |||||
| dispatch(setManualSearchString(value)); | dispatch(setManualSearchString(value)); | ||||
| }; | }; | ||||
| const locationsToShow = useMemo(() => { | const locationsToShow = useMemo(() => { |
| }, []); | }, []); | ||||
| const handleSearch = (value) => { | const handleSearch = (value) => { | ||||
| console.log(value); | |||||
| dispatch(setManualSearchString(value)); | dispatch(setManualSearchString(value)); | ||||
| }; | }; | ||||
| } | } | ||||
| return []; | return []; | ||||
| }, [category, manualSearchString, sorting.selectedSortOptionLocally]); | }, [category, manualSearchString, sorting.selectedSortOptionLocally]); | ||||
| console.log("subc", categories); | |||||
| const goBack = () => { | const goBack = () => { | ||||
| history.goBack(); | history.goBack(); | ||||
| }; | }; |
| }; | }; | ||||
| const handleSearch = (data) => { | const handleSearch = (data) => { | ||||
| console.log(data); | |||||
| paging.changePage(1); | paging.changePage(1); | ||||
| setSearchValue(data); | setSearchValue(data); | ||||
| }; | }; |
| import { useHistory } from "react-router-dom"; | import { useHistory } from "react-router-dom"; | ||||
| export const ChatMessagesPage = () => { | export const ChatMessagesPage = () => { | ||||
| const history = useHistory(); | const history = useHistory(); | ||||
| console.log("rerender"); | |||||
| const goBack = () => { | const goBack = () => { | ||||
| history.goBack(); | history.goBack(); | ||||
| }; | }; |
| ); | ); | ||||
| function addLoader(state, action) { | function addLoader(state, action) { | ||||
| // console.log("ADD", "state: ", state, "action: ", action); | |||||
| let loaderCount = state.loaderCount; | let loaderCount = state.loaderCount; | ||||
| let actionType = action.payload.replace("[FETCH]", ""); | let actionType = action.payload.replace("[FETCH]", ""); | ||||
| if (!state[actionType]) { | if (!state[actionType]) { | ||||
| } | } | ||||
| function removeLoader(state, action) { | function removeLoader(state, action) { | ||||
| // console.log("REMOVE", "state: ", state, "action: ", action); | |||||
| let actionType = action.payload | let actionType = action.payload | ||||
| .replace("[SUCCESS]", "") | .replace("[SUCCESS]", "") | ||||
| .replace("[ERROR]", ""); | .replace("[ERROR]", ""); |
| function* fetchCategories() { | function* fetchCategories() { | ||||
| try { | try { | ||||
| const { data } = yield call(attemptFetchCategories); | |||||
| yield put(setCategories(data)); | |||||
| const data = yield call(attemptFetchCategories); | |||||
| console.log("ASDFASDF", data); | |||||
| if (!data?.data) throw new Error(); | |||||
| yield put(setCategories(data.data)); | |||||
| yield put(fetchCategoriesSuccess()); | yield put(fetchCategoriesSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchCategoriesError()); | yield put(fetchCategoriesError()); |
| function* fetchLocations() { | function* fetchLocations() { | ||||
| try { | try { | ||||
| const { data } = yield call(attemptFetchLocations); | |||||
| yield put(setLocations(data.value)); | |||||
| const data = yield call(attemptFetchLocations); | |||||
| if (!data?.data) throw new Error(); | |||||
| yield put(setLocations(data.data.value)); | |||||
| yield put(fetchLocationsSuccess()); | yield put(fetchLocationsSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchLocationsError()); | yield put(fetchLocationsError()); |
| function* fetchOneOffer(payload) { | function* fetchOneOffer(payload) { | ||||
| try { | try { | ||||
| const data = yield call(attemptFetchOneOffer, payload.payload); | const data = yield call(attemptFetchOneOffer, payload.payload); | ||||
| yield put(fetchOneOfferSuccess(data.data)); | |||||
| if (!data?.data) throw new Error() | |||||
| yield put(fetchOneOfferSuccess(data?.data)); | |||||
| } catch (e) { | } catch (e) { | ||||
| console.log(e.response.status); | |||||
| console.log(e?.response?.status); | |||||
| // if (e.response.status === 400) { | // if (e.response.status === 400) { | ||||
| // yield call(history.push, NOT_FOUND_PAGE); | // yield call(history.push, NOT_FOUND_PAGE); | ||||
| // } | // } |
| import { sortCategoriesEnum } from "../../enums/sortEnum"; | import { sortCategoriesEnum } from "../../enums/sortEnum"; | ||||
| export const adminSortMethod = (arrayOfItems, manualSearchString, sorting) => { | export const adminSortMethod = (arrayOfItems, manualSearchString, sorting) => { | ||||
| console.log(arrayOfItems); | |||||
| console.log(sorting); | |||||
| let arrayOfItemsToReturn = [...arrayOfItems]; | let arrayOfItemsToReturn = [...arrayOfItems]; | ||||
| if (manualSearchString) | if (manualSearchString) | ||||
| arrayOfItemsToReturn = arrayOfItems.filter( | arrayOfItemsToReturn = arrayOfItems.filter( | ||||
| const secondCreated = new Date( | const secondCreated = new Date( | ||||
| b?._created || new Date(1970, 1).toISOString() | b?._created || new Date(1970, 1).toISOString() | ||||
| ); | ); | ||||
| console.log(firstCreated); | |||||
| return firstCreated - secondCreated; | return firstCreated - secondCreated; | ||||
| }); | }); | ||||
| } | } |
| ); | ); | ||||
| arrayOfProperties.forEach((property) => { | arrayOfProperties.forEach((property) => { | ||||
| if (!secondQueryObject.has(property)) { | if (!secondQueryObject.has(property)) { | ||||
| // console.log("ovde je doslo query: ", property); | |||||
| // thirdQueryObject.append(property, secondQueryObject.get(property)); | |||||
| thirdQueryObject.append(property, firstQueryObject.get(property)); | thirdQueryObject.append(property, firstQueryObject.get(property)); | ||||
| } else { | |||||
| // console.log("ovde ispod: ", property); | |||||
| } | } | ||||
| }); | }); | ||||
| if (queryObject.has(KEY_COMPANY)) { | if (queryObject.has(KEY_COMPANY)) { | ||||
| const arrayOfCompanies = queryObject.getAll(KEY_COMPANY); | const arrayOfCompanies = queryObject.getAll(KEY_COMPANY); | ||||
| arrayOfCompanies.forEach((item) => { | arrayOfCompanies.forEach((item) => { | ||||
| console.log(item); | |||||
| newQueryObject.append(KEY_COMPANY, item); | newQueryObject.append(KEY_COMPANY, item); | ||||
| }); | }); | ||||
| } | } | ||||
| filters.companies.selectedCompanies.forEach((company, index) => { | filters.companies.selectedCompanies.forEach((company, index) => { | ||||
| // Checking if item is last | // Checking if item is last | ||||
| console.log(company); | |||||
| if (index + 1 === filters.companies.selectedCompanies.length) { | if (index + 1 === filters.companies.selectedCompanies.length) { | ||||
| companiesString += company.companyName; | companiesString += company.companyName; | ||||
| } else { | } else { |