first commit day1 & day2
This commit is contained in:
parent
16b2ad7cf1
commit
04915b3909
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airline", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "prompt",
|
||||
"creation": "2024-06-16 11:10:17.363379",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"founding_year",
|
||||
"customer_care_number",
|
||||
"headquarters"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "founding_year",
|
||||
"fieldtype": "Int",
|
||||
"label": "Founding Year",
|
||||
"non_negative": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "customer_care_number",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Customer Care Number",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "headquarters",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Headquarters",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [
|
||||
{
|
||||
"link_doctype": "Airplane",
|
||||
"link_fieldname": "name"
|
||||
}
|
||||
],
|
||||
"modified": "2024-06-16 13:51:31.156362",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airline",
|
||||
"naming_rule": "Set by user",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class Airline(Document):
|
||||
pass
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirline(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airplane", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:{airline}-{###}",
|
||||
"creation": "2024-06-16 11:16:39.956469",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"model",
|
||||
"airline",
|
||||
"capacity"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "model",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Model",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "airline",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Airline",
|
||||
"options": "Airline",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "capacity",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Capacity",
|
||||
"non_negative": 1,
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-06-16 11:30:54.145867",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airplane",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class Airplane(Document):
|
||||
pass
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirplane(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airplane Flight", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,174 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_guest_to_view": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:{airplane}-{MM}-{YYYY}",
|
||||
"creation": "2024-07-14 11:12:26.517001",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"airplane",
|
||||
"column_break_havb",
|
||||
"status",
|
||||
"column_break_bfaw",
|
||||
"amended_from",
|
||||
"airport_details_section",
|
||||
"source_airport",
|
||||
"source_airport_code",
|
||||
"column_break_fbqe",
|
||||
"destination_airport",
|
||||
"destination_airport_code",
|
||||
"departure_details_section",
|
||||
"date_of_departure",
|
||||
"duration",
|
||||
"column_break_idnl",
|
||||
"time_of_departure",
|
||||
"published",
|
||||
"route"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "airplane",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Airplane",
|
||||
"options": "Airplane",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "date_of_departure",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Date of Departure",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "time_of_departure",
|
||||
"fieldtype": "Time",
|
||||
"in_list_view": 1,
|
||||
"label": "Time of Departure",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "duration",
|
||||
"fieldtype": "Duration",
|
||||
"in_list_view": 1,
|
||||
"label": "Duration",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "Scheduled",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "Scheduled\nCompleted\nCancelled"
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Airplane Flight",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_bfaw",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fetch_from": "source_airport.code",
|
||||
"fieldname": "source_airport_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Source Airport Code"
|
||||
},
|
||||
{
|
||||
"fetch_from": "destination_airport.code",
|
||||
"fieldname": "destination_airport_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Destination Airport Code"
|
||||
},
|
||||
{
|
||||
"fieldname": "source_airport",
|
||||
"fieldtype": "Link",
|
||||
"label": "Source Airport",
|
||||
"options": "Airport",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "destination_airport",
|
||||
"fieldtype": "Link",
|
||||
"label": "Destination Airport",
|
||||
"options": "Airport",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_havb",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "airport_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Airport Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_fbqe",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "departure_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Departure Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_idnl",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "published",
|
||||
"fieldtype": "Check",
|
||||
"label": "published"
|
||||
},
|
||||
{
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"label": "Route"
|
||||
}
|
||||
],
|
||||
"has_web_view": 1,
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_published_field": "published",
|
||||
"is_submittable": 1,
|
||||
"links": [
|
||||
{
|
||||
"link_doctype": "Airplane Ticket",
|
||||
"link_fieldname": "flight"
|
||||
}
|
||||
],
|
||||
"modified": "2024-07-21 19:30:05.323909",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airplane Flight",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"route": "flights",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.website.website_generator import WebsiteGenerator
|
||||
|
||||
|
||||
class AirplaneFlight(WebsiteGenerator):
|
||||
|
||||
def on_submit(self):
|
||||
self.status = 'Completed'
|
|
@ -0,0 +1,25 @@
|
|||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block page_content %}
|
||||
<h3>{{ title |e }}</h3>
|
||||
<div>
|
||||
<h4>Flight Details</h4>
|
||||
<li class="font-size-sm text-muted">Airline:{{ doc.airplane }}</li>
|
||||
<li class="font-size-sm text-muted">{{ doc.source_airport_code }} -> {{ doc.destination_airport_code }}</li>
|
||||
{% set duration = frappe.utils.format_duration(doc.duration) %}
|
||||
{% set date = frappe.utils.format_date(doc.date_of_departure, "d MMMM, YYYY") %}
|
||||
<li class="font-size-sm text-muted">{{ date }} | {{ doc.time_of_departure }}</li>
|
||||
<li class="font-size-sm text-muted">duration: {{ duration }}</li>
|
||||
{% set flight = title %}
|
||||
{% set flight_price = 2000.0 |float %}
|
||||
|
||||
|
||||
|
||||
<a class="btn btn-info" href="/book-flight-tickets-web-form/new?flight_price={{ flight_price }}&&flight={{ flight }}">Book flight</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<!-- this is a sample default web page template -->
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
<style>
|
||||
.list {
|
||||
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
margin: 5px;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
|
||||
<div class="list" >
|
||||
<h5>{{ doc.airplane }}</h5>
|
||||
<h5 class="font-size-sm text-muted">{{ doc.source_airport_code }} -> {{ doc.destination_airport_code }}</h5>
|
||||
{% set duration = frappe.utils.format_duration(doc.duration) %}
|
||||
{% set date = frappe.utils.format_date(doc.date_of_departure, "d MMMM, YYYY") %}
|
||||
<p class="font-size-sm text-muted">{{ date }} | {{ doc.time_of_departure }}| {{ duration }}</p>
|
||||
<a class="font-size-sm color:blue;" href="/{{ doc.route |e }}">View flight</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- this is a sample default list template -->
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirplaneFlight(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on("Airplane Ticket", {
|
||||
refresh(frm) {
|
||||
|
||||
},
|
||||
flight_price(frm) {
|
||||
var addonprice = 0.0;
|
||||
var total_price = 0.0;
|
||||
|
||||
if(frm.doc.flight_price)
|
||||
{
|
||||
$.each(frm.doc.items || [], function(i, d) {
|
||||
for (var addon in d.add_ons)
|
||||
{
|
||||
addonprice += addon.amount
|
||||
}
|
||||
total_price+= d.flight_price + addonprice;
|
||||
});
|
||||
|
||||
|
||||
frm.set_value("total_amount",total_price);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Airplane Ticket Add-on Item", {
|
||||
airplane_ticket_addon_item_add(frm,cdt,cdn)
|
||||
{
|
||||
let total_addon = 0;
|
||||
frm.doc.add_ons.forEach(addon =>{
|
||||
total_addon += addon.amount;
|
||||
});
|
||||
frm.set_value("total_amount",frm.doc.flight_price + total_addon);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,202 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:{flight}-{source_airport_code}-to-{destination_airport_code}-###",
|
||||
"creation": "2024-06-16 11:39:03.757608",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"passenger",
|
||||
"status",
|
||||
"column_break_vgrd",
|
||||
"flight",
|
||||
"seat",
|
||||
"section_break_gqwg",
|
||||
"source_airport_code",
|
||||
"column_break_izmz",
|
||||
"destination_airport_code",
|
||||
"section_break_hvlf",
|
||||
"add_ons",
|
||||
"section_break_rgek",
|
||||
"flight_price",
|
||||
"column_break_fxof",
|
||||
"total_amount",
|
||||
"departure_details_section",
|
||||
"departure_time",
|
||||
"departure_date",
|
||||
"column_break_eyvy",
|
||||
"duration_of_flight",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "passenger",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Passenger",
|
||||
"options": "Flight Passenger",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "flight.source_airport_code",
|
||||
"fieldname": "source_airport_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Source Airport Code",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "flight.destination_airport_code",
|
||||
"fieldname": "destination_airport_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Destination Airport Code",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "flight",
|
||||
"fieldtype": "Link",
|
||||
"label": "Flight",
|
||||
"options": "Airplane Flight",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "flight.date_of_departure",
|
||||
"fieldname": "departure_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Departure Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "flight.time_of_departure",
|
||||
"fieldname": "departure_time",
|
||||
"fieldtype": "Time",
|
||||
"label": "Departure Time",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "flight.duration",
|
||||
"fieldname": "duration_of_flight",
|
||||
"fieldtype": "Duration",
|
||||
"label": "Duration of Flight",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_vgrd",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "departure_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Departure Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_eyvy",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "Booked",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "Booked\nChecked-In\nBoarded"
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Airplane Ticket",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_hvlf",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Add ons"
|
||||
},
|
||||
{
|
||||
"fieldname": "add_ons",
|
||||
"fieldtype": "Table",
|
||||
"label": "add_ons",
|
||||
"options": "Airplane Ticket Add-on Item"
|
||||
},
|
||||
{
|
||||
"fieldname": "flight_price",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Flight Price",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount"
|
||||
},
|
||||
{
|
||||
"fieldname": "seat",
|
||||
"fieldtype": "Data",
|
||||
"label": "Seat",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_gqwg",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_izmz",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_rgek",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_fxof",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2024-07-22 18:33:53.217697",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airplane Ticket",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": [
|
||||
{
|
||||
"color": "Gray",
|
||||
"title": "Booked"
|
||||
},
|
||||
{
|
||||
"color": "Purple",
|
||||
"title": "Checked-In"
|
||||
},
|
||||
{
|
||||
"color": "Green",
|
||||
"title": "Boarded"
|
||||
}
|
||||
],
|
||||
"track_changes": 1
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
import random
|
||||
|
||||
|
||||
class AirplaneTicket(Document):
|
||||
|
||||
def validate(self):
|
||||
existing_addons = set()
|
||||
for addon in self.add_ons:
|
||||
addon_key = (addon.item)
|
||||
if addon_key in existing_addons:
|
||||
frappe.throw("Duplicate add-on found. Each add-on must be unique.")
|
||||
existing_addons.add(addon_key)
|
||||
|
||||
def before_validate(self):
|
||||
if len(self.add_ons) < len(set(self.add_ons)):
|
||||
frappe.throw("Duplicate add ons")
|
||||
else:
|
||||
total_addon = 0.0
|
||||
for addon in self.add_ons:
|
||||
total_addon = total_addon + addon.amount
|
||||
|
||||
self.total_amount = float(self.flight_price) + total_addon
|
||||
|
||||
|
||||
def before_submit(self):
|
||||
if self.status != 'Boarded':
|
||||
frappe.throw("Cannot submit if flight not boarded")
|
||||
|
||||
|
||||
def before_insert(self):
|
||||
seatsArray = (("A"),("B"),("C"),("D"),("E"))
|
||||
self.seat = f'{random.randrange(1,99)}{random.choice(seatsArray)}'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirplaneTicket(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airplane Ticket Add-on Item", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2024-07-11 14:43:59.264508",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"item",
|
||||
"amount"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount",
|
||||
"non_negative": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item",
|
||||
"options": "Airplane Ticket Add-on Type",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2024-07-22 19:07:25.689330",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airplane Ticket Add-on Item",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class AirplaneTicketAddonItem(Document):
|
||||
pass
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirplaneTicketAddonItem(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airplane Ticket Add-on Type", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "prompt",
|
||||
"creation": "2024-07-11 14:43:04.537186",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Data",
|
||||
"label": "Description",
|
||||
"unique": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-07-22 19:01:09.410218",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airplane Ticket Add-on Type",
|
||||
"naming_rule": "Set by user",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class AirplaneTicketAddonType(Document):
|
||||
pass
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirplaneTicketAddonType(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Airport", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "prompt",
|
||||
"creation": "2024-06-16 11:32:11.775771",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"code",
|
||||
"city",
|
||||
"country"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Code",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "city",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "City",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Country",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-06-16 11:33:04.571303",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Airport",
|
||||
"naming_rule": "Set by user",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class Airport(Document):
|
||||
pass
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestAirport(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2024, snehalatha and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Flight Passenger", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"actions": [],
|
||||
"autoname": "autoincrement",
|
||||
"creation": "2024-06-16 11:33:27.963861",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"first_name",
|
||||
"last_name",
|
||||
"full_name",
|
||||
"date_of_birth"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "first_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "First Name",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "last_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Last Name"
|
||||
},
|
||||
{
|
||||
"fieldname": "date_of_birth",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Date Of Birth",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "full_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Full Name",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-07-11 14:38:53.132726",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Flight Passenger",
|
||||
"naming_rule": "Autoincrement",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"show_title_field_in_link": 1,
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"title_field": "full_name"
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright (c) 2024, snehalatha and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class FlightPassenger(Document):
|
||||
|
||||
def before_validate(self):
|
||||
|
||||
if not self.last_name:
|
||||
self.full_name = self.first_name
|
||||
else:
|
||||
self.full_name = f"{self.first_name} {self.last_name}"
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2024, snehalatha and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestFlightPassenger(FrappeTestCase):
|
||||
pass
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"attach_print": 0,
|
||||
"channel": "System Notification",
|
||||
"condition": "doc.status == \"Scheduled\"",
|
||||
"creation": "2024-07-22 11:42:55.357114",
|
||||
"date_changed": "date_of_departure",
|
||||
"days_in_advance": 1,
|
||||
"docstatus": 0,
|
||||
"doctype": "Notification",
|
||||
"document_type": "Airplane Flight",
|
||||
"enabled": 1,
|
||||
"event": "Days Before",
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"message": "<p>Add your message here</p>\n",
|
||||
"message_type": "Markdown",
|
||||
"modified": "2024-07-22 12:21:55.059669",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "Flight Notification",
|
||||
"owner": "Administrator",
|
||||
"recipients": [
|
||||
{
|
||||
"receiver_by_document_field": "owner"
|
||||
}
|
||||
],
|
||||
"send_system_notification": 0,
|
||||
"send_to_all_assignees": 0,
|
||||
"subject": "Departs in 24 hours!"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<p>Add your message here</p>
|
|
@ -0,0 +1,5 @@
|
|||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
# do your magic here
|
||||
pass
|
|
@ -0,0 +1,3 @@
|
|||
frappe.ready(function() {
|
||||
// bind events here
|
||||
})
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"allow_comments": 0,
|
||||
"allow_delete": 0,
|
||||
"allow_edit": 0,
|
||||
"allow_incomplete": 0,
|
||||
"allow_multiple": 0,
|
||||
"allow_print": 0,
|
||||
"anonymous": 0,
|
||||
"apply_document_permissions": 0,
|
||||
"button_label": "Confirm",
|
||||
"condition_json": "[]",
|
||||
"creation": "2024-07-21 23:34:32.914741",
|
||||
"doc_type": "Airplane Ticket",
|
||||
"docstatus": 0,
|
||||
"doctype": "Web Form",
|
||||
"idx": 0,
|
||||
"introduction_text": "<div class=\"ql-editor read-mode\"><p>Fly with us!</p></div>",
|
||||
"is_standard": 1,
|
||||
"list_columns": [],
|
||||
"login_required": 0,
|
||||
"max_attachment_size": 0,
|
||||
"modified": "2024-07-21 23:48:46.923992",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "book-flight-ticket",
|
||||
"owner": "Administrator",
|
||||
"published": 1,
|
||||
"route": "book-flight-ticket-web-form",
|
||||
"show_attachments": 0,
|
||||
"show_list": 0,
|
||||
"show_sidebar": 0,
|
||||
"title": "Book Flight Ticket Web Form",
|
||||
"web_form_fields": [
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "passenger",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Passenger",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"options": "Flight Passenger",
|
||||
"precision": "",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"show_in_filter": 0
|
||||
},
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "flight",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Flight",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"options": "Airplane Flight",
|
||||
"precision": "",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"show_in_filter": 0
|
||||
},
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "flight_price",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"label": "Flight Price",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"precision": "",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"show_in_filter": 0
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
# do your magic here
|
||||
pass
|
|
@ -0,0 +1,3 @@
|
|||
frappe.ready(function() {
|
||||
// bind events here
|
||||
})
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"allow_comments": 0,
|
||||
"allow_delete": 0,
|
||||
"allow_edit": 0,
|
||||
"allow_incomplete": 0,
|
||||
"allow_multiple": 0,
|
||||
"allow_print": 0,
|
||||
"anonymous": 0,
|
||||
"apply_document_permissions": 0,
|
||||
"button_label": "Confirm",
|
||||
"condition_json": "[]",
|
||||
"creation": "2024-07-22 10:14:53.077024",
|
||||
"doc_type": "Airplane Ticket",
|
||||
"docstatus": 0,
|
||||
"doctype": "Web Form",
|
||||
"idx": 0,
|
||||
"introduction_text": "<div class=\"ql-editor read-mode\"><p>Fly with us!</p></div>",
|
||||
"is_standard": 1,
|
||||
"list_columns": [],
|
||||
"login_required": 0,
|
||||
"max_attachment_size": 0,
|
||||
"modified": "2024-07-23 10:50:44.460752",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Airplane mode",
|
||||
"name": "book-flight-tickets-web-form",
|
||||
"owner": "Administrator",
|
||||
"published": 1,
|
||||
"route": "book-flight-tickets-web-form",
|
||||
"show_attachments": 0,
|
||||
"show_list": 0,
|
||||
"show_sidebar": 0,
|
||||
"title": "Book Flight Tickets Web form",
|
||||
"web_form_fields": [
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "passenger",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Passenger",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"options": "Flight Passenger",
|
||||
"precision": "",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"show_in_filter": 0
|
||||
},
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "flight",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Flight",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"options": "Airplane Flight",
|
||||
"precision": "",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"show_in_filter": 0
|
||||
},
|
||||
{
|
||||
"allow_read_on_all_link_options": 0,
|
||||
"fieldname": "flight_price",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"label": "Flight Price",
|
||||
"max_length": 0,
|
||||
"max_value": 0,
|
||||
"precision": "",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"show_in_filter": 0
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
# do your magic here
|
||||
pass
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
{% block page_content %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Show Colored Rectangle</title>
|
||||
<style>
|
||||
#rectangle {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="rectangle" style="background-color:{{ frappe.form_dict.color }};"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
|
@ -0,0 +1,7 @@
|
|||
import frappe
|
||||
from frappe.website.render import render
|
||||
|
||||
def get_context(context):
|
||||
# Get the color query parameter from the request
|
||||
color = frappe.form_dict.get('color')
|
||||
context.color = color
|
Loading…
Reference in New Issue