diff --git a/airplane_mode/airplane_mode/doctype/airline/airline.js b/airplane_mode/airplane_mode/doctype/airline/airline.js index 2687640..200eb38 100644 --- a/airplane_mode/airplane_mode/doctype/airline/airline.js +++ b/airplane_mode/airplane_mode/doctype/airline/airline.js @@ -1,8 +1,8 @@ // Copyright (c) 2024, snehalatha and contributors // For license information, please see license.txt -// frappe.ui.form.on("Airline", { -// refresh(frm) { - -// }, -// }); +frappe.ui.form.on("Airline", { + refresh(frm) { + frm.add_web_link(frm.doc.website, "See on website"); + }, +}); diff --git a/airplane_mode/airplane_mode/doctype/airline/airline.json b/airplane_mode/airplane_mode/doctype/airline/airline.json index ebc778b..62980c7 100644 --- a/airplane_mode/airplane_mode/doctype/airline/airline.json +++ b/airplane_mode/airplane_mode/doctype/airline/airline.json @@ -39,7 +39,7 @@ "link_fieldname": "name" } ], - "modified": "2024-06-16 13:51:31.156362", + "modified": "2024-07-26 10:08:17.491380", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airline", @@ -57,6 +57,45 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1 } ], "sort_field": "creation", diff --git a/airplane_mode/airplane_mode/doctype/airplane/airplane.json b/airplane_mode/airplane_mode/doctype/airplane/airplane.json index 25f4bb0..4057d32 100644 --- a/airplane_mode/airplane_mode/doctype/airplane/airplane.json +++ b/airplane_mode/airplane_mode/doctype/airplane/airplane.json @@ -8,7 +8,14 @@ "field_order": [ "model", "airline", - "capacity" + "capacity", + "initial_audit_completed", + "flight_crew_members_section", + "captain", + "first_officer", + "column_break_ajqj", + "flight_medic", + "flight_attendant" ], "fields": [ { @@ -33,11 +40,51 @@ "label": "Capacity", "non_negative": 1, "reqd": 1 + }, + { + "default": "0", + "fieldname": "initial_audit_completed", + "fieldtype": "Check", + "label": " Initial Audit Completed", + "permlevel": 1 + }, + { + "fieldname": "flight_crew_members_section", + "fieldtype": "Section Break", + "label": "Flight Crew Members" + }, + { + "fieldname": "captain", + "fieldtype": "Link", + "label": "Captain", + "options": "Flight Crew Members" + }, + { + "fieldname": "first_officer", + "fieldtype": "Link", + "label": "First Officer", + "options": "Flight Crew Members" + }, + { + "fieldname": "flight_medic", + "fieldtype": "Link", + "label": "Flight Medic", + "options": "Flight Crew Members" + }, + { + "fieldname": "flight_attendant", + "fieldtype": "Link", + "label": "Flight Attendant", + "options": "Flight Crew Members" + }, + { + "fieldname": "column_break_ajqj", + "fieldtype": "Column Break" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-06-16 11:30:54.145867", + "modified": "2024-07-30 15:44:56.907253", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airplane", @@ -55,6 +102,60 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "delete": 1, + "email": 1, + "export": 1, + "permlevel": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1 } ], "sort_field": "creation", diff --git a/airplane_mode/airplane_mode/doctype/airplane_flight/airplane_flight.json b/airplane_mode/airplane_mode/doctype/airplane_flight/airplane_flight.json index 40fec0b..7b94167 100644 --- a/airplane_mode/airplane_mode/doctype/airplane_flight/airplane_flight.json +++ b/airplane_mode/airplane_mode/doctype/airplane_flight/airplane_flight.json @@ -21,10 +21,17 @@ "departure_details_section", "date_of_departure", "duration", + "gate_no", "column_break_idnl", "time_of_departure", "published", - "route" + "route", + "crew_member_details_section", + "captain", + "first_officer", + "column_break_nilz", + "flight_medic", + "flight_attendant" ], "fields": [ { @@ -135,6 +142,44 @@ "fieldname": "route", "fieldtype": "Data", "label": "Route" + }, + { + "fieldname": "crew_member_details_section", + "fieldtype": "Section Break", + "label": "Crew Member Details" + }, + { + "fetch_from": "airplane.captain", + "fieldname": "captain", + "fieldtype": "Data", + "label": "Captain" + }, + { + "fetch_from": "airplane.first_officer", + "fieldname": "first_officer", + "fieldtype": "Data", + "label": "First Officer" + }, + { + "fetch_from": "airplane.flight_medic", + "fieldname": "flight_medic", + "fieldtype": "Data", + "label": "Flight Medic" + }, + { + "fetch_from": "airplane.flight_attendant", + "fieldname": "flight_attendant", + "fieldtype": "Data", + "label": "Flight Attendant" + }, + { + "fieldname": "gate_no", + "fieldtype": "Data", + "label": "Gate No" + }, + { + "fieldname": "column_break_nilz", + "fieldtype": "Column Break" } ], "has_web_view": 1, @@ -147,7 +192,7 @@ "link_fieldname": "flight" } ], - "modified": "2024-07-21 19:30:05.323909", + "modified": "2024-07-30 15:30:24.142830", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airplane Flight", @@ -165,6 +210,48 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1 } ], "route": "flights", diff --git a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.js b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.js index 39ad85e..b19f007 100644 --- a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.js +++ b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.js @@ -35,4 +35,54 @@ frappe.ui.form.on("Airplane Ticket Add-on Item", { }); frm.set_value("total_amount",frm.doc.flight_price + total_addon); } -}); \ No newline at end of file +}); + +frappe.ui.form.on('Airplane Ticket', { + refresh: function(frm) { + frm.add_custom_button(__('Assign Seat'), function() { + let d = new frappe.ui.Dialog({ + title: __('Assign Seat'), + fields: [ + { + label: __('Seat Number'), + fieldname: 'seat_number', + fieldtype: 'Data' + } + ], + primary_action_label: __('Assign'), + primary_action(values) { + frm.set_value('seat', values.seat_number); + d.hide(); + } + }); + + d.show(); + }, 'Actions').addClass(".btn-primary") + frm.add_custom_button(__('Assign Gate No.'), function() { + let d = new frappe.ui.Dialog({ + title: __('Assign Gate No.'), + fields: [ + { + label: __('Gate Number'), + fieldname: 'gate_no', + fieldtype: 'Data' + } + ], + primary_action_label: __('Assign'), + primary_action(values) { + if(frm.doc.status == "Checked-In") + { + frm.set_value('gate_no', values.gate_no); + } + else{ + frappe.throw("Passanger has not checked-In") + } + + d.hide(); + } + }); + + d.show(); + }, 'Actions').addClass(".btn-primary") + } +}); diff --git a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.json b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.json index 78b1357..dd85386 100644 --- a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.json +++ b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.json @@ -1,7 +1,7 @@ { "actions": [], "allow_rename": 1, - "autoname": "format:{flight}-{source_airport_code}-to-{destination_airport_code}-###", + "autoname": "format:{flight}-{source_airport_code}-to-{destination_airport_code}-{###}", "creation": "2024-06-16 11:39:03.757608", "doctype": "DocType", "engine": "InnoDB", @@ -11,6 +11,7 @@ "column_break_vgrd", "flight", "seat", + "gate_no", "section_break_gqwg", "source_airport_code", "column_break_izmz", @@ -157,12 +158,19 @@ { "fieldname": "column_break_fxof", "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.status===\"Checked-In\"", + "fetch_from": "flight.gate_no", + "fieldname": "gate_no", + "fieldtype": "Data", + "label": "Gate No." } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-07-22 18:33:53.217697", + "modified": "2024-07-30 15:26:34.234774", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airplane Ticket", @@ -180,6 +188,41 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1, + "write": 1 } ], "sort_field": "creation", diff --git a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.py b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.py index 158e9a5..7b6f512 100644 --- a/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.py +++ b/airplane_mode/airplane_mode/doctype/airplane_ticket/airplane_ticket.py @@ -8,36 +8,49 @@ 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 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") + self.check_capacity() + + 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 += 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)}' + def before_insert(self): + seatsArray = ["A", "B", "C", "D", "E"] + self.seat = f'{random.randrange(1, 99)}{random.choice(seatsArray)}' + + + + + def check_capacity(self): + airplaneflight = frappe.get_doc('Airplane Flight', {'name': self.flight}) + airplane = frappe.get_doc('Airplane', {'name': airplaneflight.airplane}) + + capacity = airplane.capacity + existing_tickets = frappe.db.count('Airplane Ticket', {'flight': self.flight}) - - - - + if existing_tickets > capacity: + frappe.throw(f'The number of tickets for flight {self.flight} exceeds the capacity of the airplane.') + + + + \ No newline at end of file diff --git a/airplane_mode/airplane_mode/doctype/airplane_ticket_add_on_type/airplane_ticket_add_on_type.json b/airplane_mode/airplane_mode/doctype/airplane_ticket_add_on_type/airplane_ticket_add_on_type.json index d3ca3b9..b9c8d3e 100644 --- a/airplane_mode/airplane_mode/doctype/airplane_ticket_add_on_type/airplane_ticket_add_on_type.json +++ b/airplane_mode/airplane_mode/doctype/airplane_ticket_add_on_type/airplane_ticket_add_on_type.json @@ -18,7 +18,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-07-22 19:01:09.410218", + "modified": "2024-07-26 10:03:49.138738", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airplane Ticket Add-on Type", @@ -36,6 +36,50 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1 } ], "sort_field": "creation", diff --git a/airplane_mode/airplane_mode/doctype/airport/airport.json b/airplane_mode/airplane_mode/doctype/airport/airport.json index a04d08c..deb6639 100644 --- a/airplane_mode/airplane_mode/doctype/airport/airport.json +++ b/airplane_mode/airplane_mode/doctype/airport/airport.json @@ -34,8 +34,17 @@ } ], "index_web_pages_for_search": 1, - "links": [], - "modified": "2024-06-16 11:33:04.571303", + "links": [ + { + "link_doctype": "Airport Shop", + "link_fieldname": "airport" + }, + { + "link_doctype": "Contract Details", + "link_fieldname": "shop" + } + ], + "modified": "2024-07-29 16:09:36.027953", "modified_by": "Administrator", "module": "Airplane mode", "name": "Airport", @@ -53,6 +62,45 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Airport Authority Personnel", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Flight Crew Member", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Travel Agent", + "share": 1 } ], "sort_field": "creation", diff --git a/airplane_mode/airplane_mode/doctype/crew_members/__init__.py b/airplane_mode/airplane_mode/doctype/crew_members/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/doctype/crew_members/crew_members.json b/airplane_mode/airplane_mode/doctype/crew_members/crew_members.json new file mode 100644 index 0000000..682ee31 --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/crew_members/crew_members.json @@ -0,0 +1,31 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2024-07-26 17:41:03.180747", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "crew_member" + ], + "fields": [ + { + "fieldname": "crew_member", + "fieldtype": "Link", + "label": "Crew Member", + "options": "Flight Crew Members" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2024-07-29 12:59:40.059092", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "crew members", + "owner": "Administrator", + "permissions": [], + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/doctype/crew_members/crew_members.py b/airplane_mode/airplane_mode/doctype/crew_members/crew_members.py new file mode 100644 index 0000000..18b59a3 --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/crew_members/crew_members.py @@ -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 crewmembers(Document): + pass diff --git a/airplane_mode/airplane_mode/doctype/flight_crew_members/__init__.py b/airplane_mode/airplane_mode/doctype/flight_crew_members/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.js b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.js new file mode 100644 index 0000000..8a96b16 --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Flight Crew Members", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.json b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.json new file mode 100644 index 0000000..6b06fbc --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.json @@ -0,0 +1,65 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{designation}-{name1}", + "creation": "2024-07-26 16:44:02.451203", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "crew_member_details_section", + "name1", + "designation", + "contact_number" + ], + "fields": [ + { + "fieldname": "name1", + "fieldtype": "Data", + "label": "Name", + "unique": 1 + }, + { + "fieldname": "designation", + "fieldtype": "Select", + "in_list_view": 1, + "in_preview": 1, + "label": "Designation", + "options": "Captain\nFirst Officer\nFlight Attendant\nFlight Medic" + }, + { + "fieldname": "contact_number", + "fieldtype": "Phone", + "label": "Contact Number" + }, + { + "fieldname": "crew_member_details_section", + "fieldtype": "Section Break", + "label": "Crew Member Details" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2024-07-30 16:49:07.201949", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "Flight Crew Members", + "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": [] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.py b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.py new file mode 100644 index 0000000..23d1265 --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.py @@ -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 FlightCrewMembers(Document): + pass diff --git a/airplane_mode/airplane_mode/doctype/flight_crew_members/test_flight_crew_members.py b/airplane_mode/airplane_mode/doctype/flight_crew_members/test_flight_crew_members.py new file mode 100644 index 0000000..9ad9595 --- /dev/null +++ b/airplane_mode/airplane_mode/doctype/flight_crew_members/test_flight_crew_members.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestFlightCrewMembers(FrappeTestCase): + pass diff --git a/airplane_mode/airplane_mode/report/__init__.py b/airplane_mode/airplane_mode/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/report/add_on_popularity/__init__.py b/airplane_mode/airplane_mode/report/add_on_popularity/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/report/add_on_popularity/add_on_popularity.json b/airplane_mode/airplane_mode/report/add_on_popularity/add_on_popularity.json new file mode 100644 index 0000000..105e6b7 --- /dev/null +++ b/airplane_mode/airplane_mode/report/add_on_popularity/add_on_popularity.json @@ -0,0 +1,42 @@ +{ + "add_total_row": 0, + "columns": [ + { + "fieldname": "item", + "fieldtype": "Link", + "label": "Add-On Type", + "options": "Airplane Ticket Add-on Item", + "width": 0 + }, + { + "fieldname": "count", + "fieldtype": "Int", + "label": "Sold Count", + "width": 0 + } + ], + "creation": "2024-07-24 17:06:12.117276", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letterhead": null, + "modified": "2024-07-26 14:12:25.342850", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "Add-on Popularity", + "owner": "Administrator", + "prepared_report": 0, + "query": "select item,count(*) as count from `tabAirplane Ticket Add-on Item` Group by item ORDER BY count(*) DESC ;", + "ref_doctype": "Airplane Ticket Add-on Type", + "reference_report": "", + "report_name": "Add-on Popularity", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/report/airplanes_by_airline/__init__.py b/airplane_mode/airplane_mode/report/airplanes_by_airline/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/report/airplanes_by_airline/airplanes_by_airline.json b/airplane_mode/airplane_mode/report/airplanes_by_airline/airplanes_by_airline.json new file mode 100644 index 0000000..b66506b --- /dev/null +++ b/airplane_mode/airplane_mode/report/airplanes_by_airline/airplanes_by_airline.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2024-07-23 17:54:28.525337", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "json": "{}", + "letterhead": null, + "modified": "2024-07-26 11:45:41.837832", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "Airplanes By Airline", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Airplane", + "reference_report": "", + "report_name": "Airplanes By Airline", + "report_type": "Report Builder", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/report/airplanes_by_airlines/__init__.py b/airplane_mode/airplane_mode/report/airplanes_by_airlines/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/report/airplanes_by_airlines/airplanes_by_airlines.json b/airplane_mode/airplane_mode/report/airplanes_by_airlines/airplanes_by_airlines.json new file mode 100644 index 0000000..372edd4 --- /dev/null +++ b/airplane_mode/airplane_mode/report/airplanes_by_airlines/airplanes_by_airlines.json @@ -0,0 +1,39 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2024-07-26 11:22:34.548100", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "json": "{\"filters\":[],\"fields\":[[\"airline\",\"Airplane\"],[\"_aggregate_column\",\"Airplane\"]],\"order_by\":\"`tabAirplane`.creation desc\",\"add_totals_row\":0,\"page_length\":20,\"column_widths\":{\"airline\":120,\"_aggregate_column\":200},\"group_by\":{\"group_by\":\"`tabAirplane`.`airline`\",\"aggregate_function\":\"count\"}}", + "letterhead": null, + "modified": "2024-07-26 11:46:49.553325", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "Airplanes By Airlines", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Airplane", + "report_name": "Airplanes By Airlines", + "report_type": "Report Builder", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Airport Authority Personnel" + }, + { + "role": "Fleet Manager" + }, + { + "role": "Travel Agent" + }, + { + "role": "Flight Crew Member" + } + ] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/report/revenue_by_airline/__init__.py b/airplane_mode/airplane_mode/report/revenue_by_airline/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.js b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.js new file mode 100644 index 0000000..68c1d8d --- /dev/null +++ b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +frappe.query_reports["Revenue By Airline"] = { + "filters": [ + + ] +}; diff --git a/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.json b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.json new file mode 100644 index 0000000..3b2d90c --- /dev/null +++ b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.json @@ -0,0 +1,26 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2024-07-24 17:17:31.331459", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letterhead": null, + "modified": "2024-07-25 11:43:36.156947", + "modified_by": "Administrator", + "module": "Airplane mode", + "name": "Revenue By Airline", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Airplane", + "report_name": "Revenue By Airline", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.py b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.py new file mode 100644 index 0000000..785f80e --- /dev/null +++ b/airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.py @@ -0,0 +1,62 @@ +# Copyright (c) 2024, snehalatha and contributors +# For license information, please see license.txt + +import frappe + +def execute(filters=None): + columns = [ + { + "fieldtype": "Link", + "options": "Airline", + "label": "Airline", + "fieldname": "airline" + }, + { + "fieldtype": "Currency", + "label": "Revenue", + "fieldname": "total_amount" + } + ] + + # Fetch all airlines + all_airlines = frappe.get_all("Airline", fields=["name"]) + airline_revenue = {airline['name']: 0.0 for airline in all_airlines} + + # Fetch all airplane ticket details + airplanedetails = frappe.get_all("Airplane Ticket", fields=["total_amount", "flight"]) + + total_revenue = 0.0 + + for ticket in airplanedetails: + airplaneflight = frappe.get_doc('Airplane Flight', ticket['flight']) + airplane = frappe.get_doc('Airplane', airplaneflight.airplane) + airline = airplane.airline + + airline_revenue[airline] += ticket['total_amount'] + total_revenue += ticket['total_amount'] + + data = [{"airline": airline, "total_amount": revenue} for airline, revenue in airline_revenue.items()] + + chart = { + "data": { + "labels": [d["airline"] for d in data], + "datasets": [ + { + "values": [d["total_amount"] for d in data] + } + ] + }, + "type": "donut" + } + + report_summary = [ + { + "value": total_revenue, + "indicator": "Green", + "label": "Total Revenue", + "datatype": "Currency", + "currency": "INR" + } + ] + + return columns, data, None, chart, report_summary diff --git a/airplane_mode/airport_shop_management/__init__.py b/airplane_mode/airport_shop_management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/__init__.py b/airplane_mode/airport_shop_management/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/__init__.py b/airplane_mode/airport_shop_management/doctype/airport_shop/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.js b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.js new file mode 100644 index 0000000..bd03af6 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Airport Shop", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.json b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.json new file mode 100644 index 0000000..c6dba36 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.json @@ -0,0 +1,110 @@ +{ + "actions": [], + "allow_guest_to_view": 1, + "allow_rename": 1, + "autoname": "format:{shop_number}-{shop_name}", + "creation": "2024-07-29 15:42:09.403809", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "shop_name", + "shop_number", + "status", + "column_break_qzfz", + "shop_area", + "airport", + "type", + "published", + "route" + ], + "fields": [ + { + "fieldname": "shop_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Shop Name", + "reqd": 1 + }, + { + "fieldname": "shop_number", + "fieldtype": "Data", + "label": "Shop Number", + "reqd": 1 + }, + { + "fieldname": "column_break_qzfz", + "fieldtype": "Column Break" + }, + { + "fieldname": "shop_area", + "fieldtype": "Int", + "label": "Shop Area", + "reqd": 1 + }, + { + "fieldname": "airport", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Airport", + "options": "Airport", + "reqd": 1 + }, + { + "default": "Available", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "options": "Available\nOccupied" + }, + { + "default": "For-Rent", + "fieldname": "type", + "fieldtype": "Select", + "in_list_view": 1, + "in_preview": 1, + "label": "Type", + "options": "For-Rent\nFor-Lease" + }, + { + "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", + "links": [], + "modified": "2024-07-30 12:31:53.628854", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Airport Shop", + "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": "shops", + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.py b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.py new file mode 100644 index 0000000..e3b8c6d --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and contributors +# For license information, please see license.txt + +# import frappe +from frappe.website.website_generator import WebsiteGenerator + + +class AirportShop(WebsiteGenerator): + pass diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop.html b/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop.html new file mode 100644 index 0000000..16e6cf3 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop.html @@ -0,0 +1,24 @@ +{% extends "templates/web.html" %} + +{% block page_content %} +