Ajustes página de Meus Veículos

This commit is contained in:
Matheus Albino Brunhara
2022-09-03 21:21:02 -03:00
parent 56c47e9116
commit 13238c4263

View File

@@ -17,13 +17,13 @@ import {
IonToolbar, IonToolbar,
} from "@ionic/react"; } from "@ionic/react";
import { Color } from "@ionic/core"; import { Color } from "@ionic/core";
import { carOutline } from "ionicons/icons"; import { carOutline, informationCircleOutline, peopleOutline } from "ionicons/icons";
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { useHistory, useLocation } from "react-router"; import { useHistory, useLocation } from "react-router";
import { UserContext } from "../App"; import { UserContext } from "../App";
import * as vansRoutes from "../services/api/vans"; import * as vehiclesRoutes from "../services/api/vehicles";
import sessionsService from "../services/functions/sessionsService"; import sessionsService from "../services/functions/sessionsService";
import { closeToast } from "../services/utils"; import { closeToast } from "../services/utils";
@@ -70,7 +70,7 @@ const MeusVeiculos: React.FC = () => {
userId = refreshSessionRes.userId; userId = refreshSessionRes.userId;
} }
vansRoutes vehiclesRoutes
.getByUserId(userId) .getByUserId(userId)
.then((response) => { .then((response) => {
if (response.status === "error") { if (response.status === "error") {
@@ -102,31 +102,37 @@ const MeusVeiculos: React.FC = () => {
<IonContent> <IonContent>
{vehiclesList ? ( {vehiclesList ? (
vehiclesList.map((vehicle, index) => { <>
return ( <IonCard color={"primary"}>
<IonCard key={index}> <IonCardContent>
<IonCardHeader> <IonIcon icon={informationCircleOutline} /> Toque em um veículo cadastrado para ver suas viagens e itinerários!
<IonCardTitle>{vehicle.plate}</IonCardTitle> </IonCardContent>
<IonCardSubtitle> </IonCard>
{vehicle.brand} - {vehicle.model} {vehiclesList.map((vehicle, index) => {
</IonCardSubtitle> return (
</IonCardHeader> <IonCard button key={index}>
{vehicle.locator_name ? ( <img src="https://s2.glbimg.com/-xUhYluyWnnnib57vy3QI1kD9oQ=/1200x/smart/filters:cover():strip_icc()/i.s3.glbimg.com/v1/AUTH_cf9d035bf26b4646b105bd958f32089d/internal_photos/bs/2020/y/E/vdU7J0TeAIC2kZONmgBQ/2018-09-04-sprintervanfoto.jpg" />
<IonCardHeader>
<IonCardTitle>
{vehicle.brand} {vehicle.model}
</IonCardTitle>
<IonCardSubtitle>Placa: {vehicle.plate}</IonCardSubtitle>
</IonCardHeader>
<> <>
<IonCardContent> <IonCardContent>
{vehicle.seats_number} assentos - Locador: {vehicle.locator_name} <IonIcon icon={peopleOutline} size={"small"} />{" "}
{vehicle.seats_number} assentos -{" "}
{vehicle.locator_name ? (
<>Locador: {vehicle.locator_name}</>
) : (
<>Não é alugado</>
)}
</IonCardContent> </IonCardContent>
</> </>
) : ( </IonCard>
<> );
<IonCardContent> })}
{vehicle.seats_number} assentos - Não é alugado </>
</IonCardContent>
</>
)}
</IonCard>
);
})
) : ( ) : (
<></> <></>
)} )}