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