def singleSupplementDataCenter(country, destination, trip_id, package_trip_id,
                               rate_card_id):

    # Fit the Package Bracket Price Form Class
    form = AddSingleSupplementData(request.form)

    # Fetch the Price Segment Data
    price_segment_data = adminPriceSegmentModel.priceSegmentFetchData()

    # Fetch admin_id
    admin_data = adminModel.adminIdFetchOne(session['username'])

    # Fetch Single Supplement Data
    single_supplement_data = adminSingleSupplementModel.singleSupplementFetchData(
        rate_card_id)

    # Fetch One Package Trip Data
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fetch The Rate Card Data
    rate_card_data = adminRateCardModel.rateCardDataFetchOne(rate_card_id)

    # Add the Data
    if request.method == 'POST' and form.validate():
        admin_id = admin_data['admin_id']
        min_pax = form.min_pax.data
        max_pax = form.max_pax.data
        price_per_person = form.price_per_person.data
        price_segment_id = form.price_segment_id.data
        rate_card_id = rate_card_id

        # Execute the query
        adminSingleSupplementModel.addSingleSupplementData(
            price_segment_id, admin_id, min_pax, max_pax, price_per_person,
            rate_card_id)

        # Send the notification
        flash('Single Supplement has been added', 'success')

        # Redirect
        return redirect(
            url_for('singleSupplementDataCenter',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id,
                    rate_card_id=rate_card_id))

    return render_template('admin/adminSingleSupplementDataCenter.html',
                           country=country,
                           destination=destination,
                           trip_id=trip_id,
                           package_trip_id=package_trip_id,
                           form=form,
                           price_segment_data=price_segment_data,
                           single_supplement_data=single_supplement_data,
                           rate_card_id=rate_card_id,
                           package_trip_data=package_trip_data,
                           rate_card_data=rate_card_data)
def componentPackageTripAddSightseeingTransfer(country, destination, trip_id,
                                               package_trip_id):

    # Fetch One Package Trip Data from package_trip_id
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fit the Add Component of Package Trip Form Class
    form = AddComponentPackageTripData(request.form)

    # FEtch the Sightseeing Transfer Data
    sightseeing_transfer_data = adminSightseeingTransferModel.sightseeingTransferFetchData(
        trip_id)

    # Add the Data
    if request.method == 'POST' and form.validate():
        day_no = form.day_no.data
        sightseeing_transfer_id = form.sightseeing_transfer_id.data

        # Fetch One the sightseeing_transfer refer to sightseeing_transfer_id
        sightseeing_transfer_fetch_one = adminSightseeingTransferModel.sightseeingTransferDataFetchOne(
            sightseeing_transfer_id)

        # Execute Query : add the itinerary
        adminItineraryModel.addItinerary(
            day_no, package_trip_id,
            sightseeing_transfer_fetch_one['sightseeing_transfer_title'],
            sightseeing_transfer_fetch_one['sightseeing_transfer_description'],
            "Sightseeing Transfer")

        # Fetch the Itinerary data
        itinerary_data = adminItineraryModel.lastUpdateItinerary()

        # Execute Query : add the data
        adminPackageTripTRSightseeingTransferModel.addPackageTripSightseeingTransferData(
            sightseeing_transfer_id, package_trip_id, day_no,
            itinerary_data['itinerary_id'])

        # Send notification
        flash('Sightseeing Transfer has been added as component', 'success')

        # redirect to the package trip component
        return redirect(
            url_for('componentPackageTrip',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id))

    return render_template(
        'admin/adminPackageTripTRAddSightseeingTransfer.html',
        form=form,
        package_trip_data=package_trip_data,
        country=country,
        destination=destination,
        trip_id=trip_id,
        package_trip_id=package_trip_id,
        sightseeing_transfer_data=sightseeing_transfer_data)
Exemple #3
0
def componentPackageTripAddDayExcursion(country, destination, trip_id,
                                        package_trip_id):

    # Fetch One Package Trip Data from package_trip_id
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fit the Add Component of Package Trip Form Class
    form = AddComponentPackageTripData(request.form)

    # Fetch the Day Excursion Data
    day_excursion_data = adminDayExcursionModel.dayExcursionDataFetchOneServiceId(
        trip_id)

    # Add the Data
    if request.method == 'POST' and form.validate():
        day_no = form.day_no.data
        day_excursion_id = form.day_excursion_id.data

        # Fetch One the Day Excursion Data
        day_excursion_fetch_one = adminDayExcursionModel.dayExcursionDataFetchOne(
            day_excursion_id)

        # Execute query : ad the Itinerary
        adminItineraryModel.addItinerary(
            day_no, package_trip_id,
            day_excursion_fetch_one['day_excursion_title'],
            day_excursion_fetch_one['day_excursions_description'],
            "Day Excursion")

        # Fetch the Itinerary Data
        itinerary_data = adminItineraryModel.lastUpdateItinerary()

        # Execute Query : add the data
        adminPackageTripTRDayExcursionModel.addPackageTripDayExcursionData(
            day_excursion_id, package_trip_id, day_no,
            itinerary_data['itinerary_id'])

        # send notification
        flash('Package Trip Component Added', 'success')

        return redirect(
            url_for('componentPackageTrip',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id))

    return render_template('admin/adminPackageTripTRAddDayExcursion.html',
                           country=country,
                           destination=destination,
                           trip_id=trip_id,
                           package_trip_id=package_trip_id,
                           package_trip_data=package_trip_data,
                           form=form,
                           day_excursion_data=day_excursion_data)
Exemple #4
0
def componentPackageTripEditDayExcursion(country, destination, trip_id,
                                         package_trip_id, itinerary_id):

    # Fetch One Package Trip Data from package_trip_id
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fit the Add Component of Package Trip Form Class
    form = AddComponentPackageTripData(request.form)

    # Fetch the Itinerary Data
    itinerary_data = adminItineraryModel.itineraryFetchDataFromId(itinerary_id)

    # Populate Package Trip Component from fields
    form.day_no.data = itinerary_data['day_no']

    # Update Package Trip Data
    if request.method == 'POST' and form.validate():

        # asign the variable value from request form value
        day_no = request.form['day_no']

        # Execute query for update Day No of Itinerary Table
        adminItineraryModel.updateDayNo(day_no, itinerary_id)

        # Execute query for update Day No of Day Excursion Transaction
        adminPackageTripTRDayExcursionModel.updatePackageTripDayExcursionData(
            day_no, itinerary_id)

        # Send notification to the dashboard
        flash('Package Trip Compnent has been updated', 'success')

        return redirect(
            url_for('componentPackageTrip',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id))

    return render_template('admin/adminPackageTripTREditDayExcursion.html',
                           country=country,
                           destination=destination,
                           trip_id=trip_id,
                           package_trip_id=package_trip_id,
                           package_trip_data=package_trip_data,
                           form=form,
                           itinerary_data=itinerary_data)
def editPackageBracketPrice(country, destination, trip_id, package_trip_id,
                            rate_card_id, package_bracket_price_id):
    # Fit the Package Bracket Price Form Class
    form = AddPackageBracketPriceData(request.form)

    # Fetch the Price Segment Data
    price_segment_data = adminPriceSegmentModel.priceSegmentFetchData()

    # Fetch One Package Trip Data
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fetch One Package Bracket Price Data
    package_bracket_price_data_fo = adminPackageBracketPriceModel.packageBracketPriceFetchOne(
        package_bracket_price_id)

    # Fetch The Rate Card Data
    rate_card_data = adminRateCardModel.rateCardDataFetchOne(rate_card_id)

    # Populate Day Excursion form fields
    form.min_pax.data = package_bracket_price_data_fo['min_pax']
    form.max_pax.data = package_bracket_price_data_fo['max_pax']
    form.price_per_person.data = package_bracket_price_data_fo[
        'price_per_person']

    # Update Package Bracket Price
    if request.method == 'POST' and form.validate():

        # asign the variable value from request form value
        min_pax = request.form['min_pax']
        max_pax = request.form['max_pax']
        price_per_person = request.form['price_per_person']
        price_segment_id = request.form['price_segment_id']

        # Execute the query
        adminPackageBracketPriceModel.updatePackageBracketPriceData(
            min_pax, max_pax, price_per_person, price_segment_id,
            package_bracket_price_id)

        # Send the notification to the dashboard
        flash('Package Bracket Price has been updated', 'success')

        # retur the the certain page
        return redirect(
            url_for('packageBracketPrice',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id,
                    rate_card_id=rate_card_id))

    return render_template(
        'admin/adminPackageBracketPriceDataCenterEdit.html',
        country=country,
        destination=destination,
        trip_id=trip_id,
        package_trip_id=package_trip_id,
        form=form,
        price_segment_data=price_segment_data,
        rate_card_id=rate_card_id,
        package_bracket_price_data_fo=package_bracket_price_data_fo,
        package_trip_data=package_trip_data,
        rate_card_data=rate_card_data)
def editSingleSupplement(country, destination, trip_id, package_trip_id,
                         rate_card_id, single_supplement_id):

    # Fit the Single Supplement Form class
    form = AddSingleSupplementData(request.form)

    # Fetch the Price Segment Data
    price_segment_data = adminPriceSegmentModel.priceSegmentFetchData()

    # Fetch One Single Supplement Data
    single_supplement_data_fo = adminSingleSupplementModel.singleSupplementFetchOne(
        single_supplement_id)

    # Fetch One Package Trip Data
    package_trip_data = adminPackageTripModel.packageTripDataFetchOne(
        package_trip_id)

    # Fetch The Rate Card Data
    rate_card_data = adminRateCardModel.rateCardDataFetchOne(rate_card_id)

    # Populate Single Supplement Form Fields
    form.min_pax.data = single_supplement_data_fo['min_pax']
    form.max_pax.data = single_supplement_data_fo['max_pax']
    form.price_per_person.data = single_supplement_data_fo['price_per_person']

    # Update Package Bracket Price
    if request.method == 'POST' and form.validate():

        # asign the variable value from request form value
        min_pax = request.form['min_pax']
        max_pax = request.form['max_pax']
        price_per_person = request.form['price_per_person']
        price_segment_id = request.form['price_segment_id']

        # Execute the query
        adminSingleSupplementModel.updateSingleSupplementData(
            min_pax, max_pax, price_per_person, price_segment_id,
            single_supplement_id)

        # Send the notification to the dashboard
        flash('Single Supplement has been updated', 'success')

        # Redirect
        return redirect(
            url_for('singleSupplementDataCenter',
                    country=country,
                    destination=destination,
                    trip_id=trip_id,
                    package_trip_id=package_trip_id,
                    rate_card_id=rate_card_id))

    return render_template('admin/adminSingleSupplementDataCenterEdit.html',
                           country=country,
                           destination=destination,
                           trip_id=trip_id,
                           package_trip_id=package_trip_id,
                           form=form,
                           price_segment_data=price_segment_data,
                           rate_card_id=rate_card_id,
                           single_supplement_data_fo=single_supplement_data_fo,
                           package_trip_data=package_trip_data,
                           rate_card_data=rate_card_data)