mirror of
https://github.com/task-17-lct/frontend.git
synced 2025-02-22 11:20:33 +03:00
fix bug
This commit is contained in:
parent
2624ae4e32
commit
4aad1c68f0
|
@ -5,6 +5,10 @@ import { Button } from "../Button";
|
|||
|
||||
export const PanelRoute:React.FC<{value:any, index:number, index2: number, onChange:(oid:string)=>void}> = (props) =>{
|
||||
const [nearest, setNearest] = useState([])
|
||||
const onChange = (oid:string) =>{
|
||||
setNearest([])
|
||||
props.onChange(oid)
|
||||
}
|
||||
return <div>
|
||||
<img style={{width:'200px'}} src='/icons/not_found.jpeg'></img>
|
||||
<p>{props.value.point.description}</p>
|
||||
|
@ -18,7 +22,7 @@ export const PanelRoute:React.FC<{value:any, index:number, index2: number, onCha
|
|||
<div className="hotelCardRow">
|
||||
<div>{value.description.length > 50? value.description.slice(0,70)+'...': value.description}</div>
|
||||
</div>
|
||||
<Button className="btn-y" onClick={() => props.onChange(value.oid)}>Выбрать</Button>
|
||||
<Button className="btn-y" onClick={() => onChange(value.oid)}>Выбрать</Button>
|
||||
</div>
|
||||
</div>
|
||||
})
|
||||
|
|
|
@ -43,7 +43,21 @@ export const RouteCard:React.FC<RouteCardIE> = (props) =>{
|
|||
let navigate = useNavigate()
|
||||
let cntPlaces = 0
|
||||
const [changePoint, setChangePoint] = useState<any>()
|
||||
console.log(changePoint)
|
||||
|
||||
if (changePoint != undefined){
|
||||
for (let i = 0; i < props.options[changePoint.day].paths.length; i++) {
|
||||
console.log(props.options[changePoint.day].paths[i])
|
||||
if (props.options[changePoint.day].paths[i].point.oid == changePoint.point_to_change) {
|
||||
props.options[changePoint.day].paths[i] = changePoint.new_point;
|
||||
// i--;
|
||||
}
|
||||
}
|
||||
// if (cnt > 0){
|
||||
// props.options[changePoint.day].paths.push(changePoint.new_point)
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
props.options.forEach((route)=>{
|
||||
cntPlaces += route.paths.length
|
||||
})
|
||||
|
@ -109,18 +123,18 @@ export const RouteCard:React.FC<RouteCardIE> = (props) =>{
|
|||
// backend.get('route/list').then((e)=>console.log(e.data))
|
||||
let paths = props.rawProps.path
|
||||
|
||||
if (changePoint != undefined){
|
||||
console.log(paths[changePoint.day])
|
||||
// if (changePoint != undefined){
|
||||
// console.log(paths[changePoint.day])
|
||||
|
||||
for (let i = 0; i < paths[changePoint.day].paths.length; i++) {
|
||||
console.log(paths[changePoint.day].paths[i])
|
||||
if (paths[changePoint.day].paths[i].point.oid == changePoint.point_to_change) {
|
||||
paths[changePoint.day].paths.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
paths[changePoint.day].paths.push(changePoint.new_point)
|
||||
}
|
||||
// for (let i = 0; i < paths[changePoint.day].paths.length; i++) {
|
||||
// console.log(paths[changePoint.day].paths[i])
|
||||
// if (paths[changePoint.day].paths[i].point.oid == changePoint.point_to_change) {
|
||||
// paths[changePoint.day].paths.splice(i, 1);
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
// paths[changePoint.day].paths.push(changePoint.new_point)
|
||||
// }
|
||||
backend.post('route/save', {
|
||||
points:paths
|
||||
}).then((e)=>console.log(e.data))
|
||||
|
@ -133,18 +147,18 @@ export const RouteCard:React.FC<RouteCardIE> = (props) =>{
|
|||
|
||||
let paths = props.rawProps.path
|
||||
|
||||
if (changePoint != undefined){
|
||||
console.log(paths[changePoint.day])
|
||||
// if (changePoint != undefined){
|
||||
// console.log(paths[changePoint.day])
|
||||
|
||||
for (let i = 0; i < paths[changePoint.day].paths.length; i++) {
|
||||
console.log(paths[changePoint.day].paths[i])
|
||||
if (paths[changePoint.day].paths[i].point.oid == changePoint.point_to_change) {
|
||||
paths[changePoint.day].paths.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
paths[changePoint.day].paths.push(changePoint.new_point)
|
||||
}
|
||||
// for (let i = 0; i < paths[changePoint.day].paths.length; i++) {
|
||||
// console.log(paths[changePoint.day].paths[i])
|
||||
// if (paths[changePoint.day].paths[i].point.oid == changePoint.point_to_change) {
|
||||
// paths[changePoint.day].paths.splice(i, 1);
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
// paths[changePoint.day].paths.push(changePoint.new_point)
|
||||
// }
|
||||
backend.post('route/save', {
|
||||
points: paths
|
||||
}).then((e)=>backend.get('buy/' + e.data.id + '/add_to_buy/'))
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
|
||||
.tourCardSidebar{
|
||||
position: fixed !important;
|
||||
left: 0px;
|
||||
width: 40%;
|
||||
top:0px;
|
||||
border-radius: 0px 20px 20px 0px;
|
||||
padding: 50px;
|
||||
}
|
||||
|
||||
.tourcard-block{
|
||||
width: 400px;
|
||||
height: 548px;
|
||||
|
@ -77,14 +87,7 @@
|
|||
position: relative !important;
|
||||
}
|
||||
|
||||
.tourCardSidebar{
|
||||
position: fixed !important;
|
||||
left: 0px;
|
||||
width: 30%;
|
||||
top:0px;
|
||||
border-radius: 0px 20px 20px 0px;
|
||||
padding: 50px;
|
||||
}
|
||||
|
||||
|
||||
.sidebarContent{
|
||||
display: flex;
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
.tourCardSidebar{
|
||||
position: fixed !important;
|
||||
left: 0px;
|
||||
width: 30%;
|
||||
width: 40%;
|
||||
top:0px;
|
||||
border-radius: 0px 20px 20px 0px;
|
||||
padding: 50px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user