예제 #1
0
def insertFlight():
    departure = request.form.get('departure')
    arrival = request.form.get('arrival')
    idPlane = request.form.get('idPlane')
    flightDepartureDatetime = request.form.get('flightDepartureDatetime')
    flightArrivalDatetime = request.form.get('flightArrivalDatetime')
    percentDiscount = request.form.get('percentDiscount')
    plane = Plane.SelectPlaneID(idPlane)
    flight = Flight("NULL", departure, arrival, plane, flightDepartureDatetime,
                    flightArrivalDatetime, percentDiscount)
    flight.InsertFlight()
    return redirect('/flight')
예제 #2
0
def confirmarReserva():
    idFlight = request.args.get('idFlight')
    idSeat = request.args.get('idSeat')
    flight = Flight.SelectFlightsID(idFlight)
    return render_template('personalizarViaje.html',
                           flight=flight,
                           idSeat=idSeat)
예제 #3
0
def elegirSalida():
    listaVuelos = Flight.SelectFlights()
    listaSalidas = []
    for item in listaVuelos:
        if item.departure not in listaSalidas:
            listaSalidas.append(item.departure)
    return render_template('elegirSalida.html', listaSalidas=listaSalidas)
예제 #4
0
def insertFlightUser():
    idFlight = request.form.get('idFlight')
    idUser = request.form.get('idUser')
    seatNumber = request.form.get('seatNumber')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(idUser)
    seat = Seats.SelectSeatsID(seatNumber)
    flightUser = FlightUser(flight, user, seat)
    flightUser.InsertFlightUser()
    return redirect('/flightUser')
예제 #5
0
def reservarViaje():
    idFlight = request.form.get('idFlight')
    idSeat = request.form.get('idSeat')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(session['idUser'])
    seat = Seats.SelectSeatsID(idSeat)
    flightUser = FlightUser(flight, user, seat)
    if flightUser not in FlightUser.SelectFlightUser():
        flightUser.InsertFlightUser()
    return redirect('home')
예제 #6
0
def elegirLLegada():
    salida = request.form.get('salida')
    listaFlight = Flight.BuscarSalida(salida)
    listaLLegadas = []
    for item in listaFlight:
        if item.arrival not in listaLLegadas:
            listaLLegadas.append(item.arrival)
    return render_template('elegirLLegada.html',
                           listaLLegadas=listaLLegadas,
                           salida=salida)
예제 #7
0
def personalizarViaje():
    salida = request.form.get('salida')
    llegada = request.form.get('llegada')
    fechaIda = request.form.get('fechaIda')
    fechaVuelta = request.form.get('fechaVuelta')
    idSeat = request.form.get('asiento')

    flight = Flight.BuscarViaje(salida, llegada, fechaIda, fechaVuelta)

    return render_template('personalizarViaje.html',
                           flight=flight,
                           idSeat=idSeat)
예제 #8
0
def editFlightUser():
    oldIDFlight = request.form.get('oldIDFlight')
    oldIDUser = request.form.get('oldIDUser')
    idFlight = request.form.get('idFlight')
    idUser = request.form.get('idUser')
    seatNumber = request.form.get('seatNumber')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(idUser)
    seat = Seats.SelectSeatsID(seatNumber)
    flightUser = FlightUser.SelectFlightUserID(oldIDFlight, oldIDUser)
    flightUser.UpdateFlightUser(flight, user, seat)
    return redirect('/flightUser')
예제 #9
0
def elegirFechaIda():
    salida = request.form.get('salida')
    llegada = request.form.get('llegada')
    listaFlight = Flight.BuscarSalidaLLegada(salida, llegada)
    listaFechaIda = []
    for item in listaFlight:
        if item.flightDepartureDatetime not in listaFechaIda:
            listaFechaIda.append(item.flightDepartureDatetime)
    return render_template('elegirFechaIda.html',
                           listaFechaIda=listaFechaIda,
                           llegada=llegada,
                           salida=salida)
예제 #10
0
def editFlight():
    idFlight = request.form.get('idFlight')
    departure = request.form.get('departure')
    arrival = request.form.get('arrival')
    idPlane = request.form.get('idPlane')
    flightDepartureDatetime = request.form.get('flightDepartureDatetime')
    flightArrivalDatetime = request.form.get('flightArrivalDatetime')
    percentDiscount = request.form.get('percentDiscount')
    plane = Plane.SelectPlaneID(idPlane)
    flight = Flight.SelectFlightsID(idFlight)
    flight.UpdateFlight(departure, arrival, plane, flightDepartureDatetime,
                        flightArrivalDatetime, percentDiscount)
    return redirect('/flight')
예제 #11
0
def elegirAsiento():
    salida = request.form.get('salida')
    llegada = request.form.get('llegada')
    fechaIda = request.form.get('fechaIda')
    fechaVuelta = request.form.get('fechaVuelta')
    listaFlight = Flight.BuscarSalidaLLegadaFechaIdaFechaVuelta(
        salida, llegada, fechaIda, fechaVuelta)
    asientos = Seats.SelectSeats()
    listaAsientos = []
    for item in listaFlight:
        for item2 in asientos:
            if item2.Model.code == item.Plane.Model.code:
                listaAsientos.append(item2)
    return render_template('elegirAsiento.html',
                           listaAsientos=listaAsientos,
                           salida=salida,
                           llegada=llegada,
                           fechaIda=fechaIda,
                           fechaVuelta=fechaVuelta)
예제 #12
0
def deleteFlight():
    idFlight = request.args.get('idFlight')
    Flight.DeleteFlight(idFlight)
    return redirect('/flight')
예제 #13
0
def flight():
    listaFlight = Flight.SelectFlights()
    return render_template('Flight.html', listaFlight=listaFlight)
예제 #14
0
    idUser = request.form.get('idUser')
    seatNumber = request.form.get('seatNumber')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(idUser)
    seat = Seats.SelectSeatsID(seatNumber)
    flightUser = FlightUser.SelectFlightUserID(oldIDFlight, oldIDUser)
    flightUser.UpdateFlightUser(flight, user, seat)
    return redirect('/flightUser')


@app.route('/flightUser/deleteFlightUser', methods=['GET'])
def deleteFlightUser():
    idFlight = request.args.get('idFlight')
    idUser = request.args.get('idUser')
    FlightUser.DeleteFlightUser(idFlight, idUser)
    return redirect('/flightUser')


if __name__ == '__main__':
    app.run(debug=True)

listaVuelos = Flight.SelectFlights()
listaSalidas = []
for item in listaVuelos:

    if item.departure not in listaSalidas:
        listaSalidas.append(item.departure)
        print(item.idFlight)
        print(item.departure)
for item in listaSalidas:
    pass
 def GetFlightUser(dic):
     flight = Flight.SelectFlightsID(dic["idFlight"])
     user = User.SelectUserID(dic["idUser"])
     seat = Seats.SelectSeatsID(dic["seatNumber"])
     return flight, user, seat