| </div> | </div> | ||||
| <div className="col-md-2"> | <div className="col-md-2"> | ||||
| <div className="form-group"> | <div className="form-group"> | ||||
| <Select options={prices} value={{ name: requestObject.price, label: requestObject.price }} onChange={handleChangePriceType} /> | |||||
| <Select options={prices} onChange={handleChangePriceType} placeholder={t('createScrapeRequest.PricePlaceholder')} /> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div className="col-md-2"> | <div className="col-md-2"> | ||||
| <div className="form-group"> | <div className="form-group"> | ||||
| <Select className="cursor-pointer" value={{ name: requestObject.beds, label: requestObject.beds }} options={beds} onChange={handleChangeBedType} /> | |||||
| <Select className="cursor-pointer" options={beds} onChange={handleChangeBedType} placeholder={t('createScrapeRequest.BedsPlaceholder')}/> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div className="col-md-2"> | <div className="col-md-2"> | ||||
| <Select className="cursor-pointer" value={{ name: requestObject.type, label: requestObject.type }} options={types} onChange={handleChangeFilterType} /> | |||||
| <Select className="cursor-pointer" options={types} onChange={handleChangeFilterType} placeholder={t('createScrapeRequest.TypePlaceholder')} /> | |||||
| </div> | </div> | ||||
| <div className="col-md-2"> | <div className="col-md-2"> | ||||
| <Select className="cursor-pointer" value={{ name: requestObject.lifestyle, label: requestObject.lifestyle }} options={lifeStyles} onChange={handleChangeLifeStyleType} /> | |||||
| <Select className="cursor-pointer" options={lifeStyles} onChange={handleChangeLifeStyleType} placeholder={t('createScrapeRequest.LifestylePlaceholder')}/> | |||||
| </div> | </div> | ||||
| <div className="col-md-1"> | <div className="col-md-1"> | ||||
| <button type="button" onClick={() => { handleRequest(requestObject); setRequestObject({ location: '' }) }} className="btn btn-outline-primary cursor-pointer">Request</button> | <button type="button" onClick={() => { handleRequest(requestObject); setRequestObject({ location: '' }) }} className="btn btn-outline-primary cursor-pointer">Request</button> |
| <tr> | <tr> | ||||
| <td> | <td> | ||||
| <p> | <p> | ||||
| {console.log(scrape)} | |||||
| </p><h3><Link to={{ | </p><h3><Link to={{ | ||||
| pathname: SCRAPE_RESULTS_PAGE, | |||||
| pathname: SCRAPE_RESULTS_PAGE.replace(':id', scrape._id), | |||||
| id: scrape._id | id: scrape._id | ||||
| }}>#{index} {scrape.location}</Link></h3> | }}>#{index} {scrape.location}</Link></h3> | ||||
| <span className="text-muted">Count {scrape.count} +</span> | <span className="text-muted">Count {scrape.count} +</span> |
| export const HOME_PAGE = '/home'; | export const HOME_PAGE = '/home'; | ||||
| export const ERROR_PAGE = '/error-page'; | export const ERROR_PAGE = '/error-page'; | ||||
| export const NOT_FOUND_PAGE = '/not-found'; | export const NOT_FOUND_PAGE = '/not-found'; | ||||
| export const SCRAPE_RESULTS_PAGE = '/scrape-results'; | |||||
| export const SCRAPE_RESULTS_PAGE = '/scrape-results/:id'; |
| export default function getHours(officeHours) { | export default function getHours(officeHours) { | ||||
| var day = new Date().getDay(); | var day = new Date().getDay(); | ||||
| var value = null; | |||||
| if(officeHours === undefined && officeHours.length < 3 ){ | if(officeHours === undefined && officeHours.length < 3 ){ | ||||
| return null; | |||||
| value = null; | |||||
| } | } | ||||
| else if(day === Saturday){ | else if(day === Saturday){ | ||||
| return officeHours[SaturdayType].hours; | |||||
| value = officeHours[SaturdayType]; | |||||
| } | } | ||||
| else if(day === Sunday){ | else if(day === Sunday){ | ||||
| return officeHours[SundayType].hours; | |||||
| value = officeHours[SundayType]; | |||||
| } | } | ||||
| else { | else { | ||||
| return officeHours[WorkingDayType].hours; | |||||
| value = officeHours[WorkingDayType]; | |||||
| } | } | ||||
| return value !== null && value !==undefined ? value.hours: null ; | |||||
| } | } |
| }, | }, | ||||
| createScrapeRequest: { | createScrapeRequest: { | ||||
| Title: "Request new scrappe", | Title: "Request new scrappe", | ||||
| LocationPlaceholder : "Location or Point of Interest" | |||||
| LocationPlaceholder : "Location or Point of Interest", | |||||
| PricePlaceholder: "price", | |||||
| BedsPlaceholder:"beds", | |||||
| LifestylePlaceholder :"lifestyle", | |||||
| TypePlaceholder: "type" | |||||
| }, | }, | ||||
| scrapeRequests: { | scrapeRequests: { | ||||
| Title: "Scrappes", | Title: "Scrappes", |
| import React, { useEffect, useState } from 'react'; | import React, { useEffect, useState } from 'react'; | ||||
| import { getByIdScrappe } from '../../request/scrappe'; | import { getByIdScrappe } from '../../request/scrappe'; | ||||
| import { Link } from "react-router-dom"; | |||||
| import { Link , useParams } from "react-router-dom"; | |||||
| import ScrappeDetails from '../../components/ScrappeDetails/ScrappeDetails' | import ScrappeDetails from '../../components/ScrappeDetails/ScrappeDetails' | ||||
| import ScrappeResult from '../../components/ScrappeResult/ScrappeResult' | import ScrappeResult from '../../components/ScrappeResult/ScrappeResult' | ||||
| import PropTypes from 'prop-types'; | |||||
| //import PropTypes from 'prop-types'; | |||||
| const ScrapeResultsPage = ({ location }) => { | |||||
| const ScrapeResultsPage = () => { | |||||
| let { id } = useParams() | |||||
| const [scrappeResults, setScrappeResults] = useState() | const [scrappeResults, setScrappeResults] = useState() | ||||
| const [scrappeDetails, setScrappeDetails] = useState() | const [scrappeDetails, setScrappeDetails] = useState() | ||||
| useEffect(() => { | useEffect(() => { | ||||
| <<<<<<< HEAD | |||||
| getByIdScrappe(location.id) | getByIdScrappe(location.id) | ||||
| .then(res => { | .then(res => { | ||||
| ======= | |||||
| getByIdScrappe(id) | |||||
| .then(res => { | |||||
| >>>>>>> 7774b91b3ce86cc28579305f9cdcae42501ac95c | |||||
| setScrappeDetails(res.data) | setScrappeDetails(res.data) | ||||
| if (res.data.status === 'done') | if (res.data.status === 'done') | ||||
| return ( | return ( | ||||
| <> | <> | ||||
| <<<<<<< HEAD | |||||
| ======= | |||||
| {console.log(id)} | |||||
| >>>>>>> 7774b91b3ce86cc28579305f9cdcae42501ac95c | |||||
| <nav className="main-header navbar navbar-expand-md navbar-light navbar-white"> | <nav className="main-header navbar navbar-expand-md navbar-light navbar-white"> | ||||
| <div className="container"> | <div className="container"> | ||||
| ); | ); | ||||
| }; | }; | ||||
| ScrapeResultsPage.propTypes = { | |||||
| location: PropTypes.object | |||||
| }; | |||||
| // ScrapeResultsPage.propTypes = { | |||||
| // location: PropTypes.object | |||||
| // }; | |||||
| export default ScrapeResultsPage; | export default ScrapeResultsPage; |