From f5f3d90c630f0a28f94ca82bce0ba4f6f64aa6b3 Mon Sep 17 00:00:00 2001 From: "snehalathad@aissel.com" Date: Tue, 30 Jul 2024 17:23:55 +0530 Subject: [PATCH] day3 and day4 assignment --- .../airplane_mode/doctype/airline/airline.js | 10 +- .../doctype/airline/airline.json | 41 ++++++- .../doctype/airplane/airplane.json | 105 ++++++++++++++++- .../airplane_flight/airplane_flight.json | 91 ++++++++++++++- .../airplane_ticket/airplane_ticket.js | 52 ++++++++- .../airplane_ticket/airplane_ticket.json | 47 +++++++- .../airplane_ticket/airplane_ticket.py | 69 ++++++----- .../airplane_ticket_add_on_type.json | 46 +++++++- .../doctype/airport/airport.json | 52 ++++++++- .../doctype/crew_members/__init__.py | 0 .../doctype/crew_members/crew_members.json | 31 +++++ .../doctype/crew_members/crew_members.py | 9 ++ .../doctype/flight_crew_members/__init__.py | 0 .../flight_crew_members.js | 8 ++ .../flight_crew_members.json | 65 +++++++++++ .../flight_crew_members.py | 9 ++ .../test_flight_crew_members.py | 9 ++ .../airplane_mode/report/__init__.py | 0 .../report/add_on_popularity/__init__.py | 0 .../add_on_popularity/add_on_popularity.json | 42 +++++++ .../report/airplanes_by_airline/__init__.py | 0 .../airplanes_by_airline.json | 28 +++++ .../report/airplanes_by_airlines/__init__.py | 0 .../airplanes_by_airlines.json | 39 +++++++ .../report/revenue_by_airline/__init__.py | 0 .../revenue_by_airline/revenue_by_airline.js | 8 ++ .../revenue_by_airline.json | 26 +++++ .../revenue_by_airline/revenue_by_airline.py | 62 ++++++++++ .../airport_shop_management/__init__.py | 0 .../doctype/__init__.py | 0 .../doctype/airport_shop/__init__.py | 0 .../doctype/airport_shop/airport_shop.js | 8 ++ .../doctype/airport_shop/airport_shop.json | 110 ++++++++++++++++++ .../doctype/airport_shop/airport_shop.py | 9 ++ .../airport_shop/templates/airport_shop.html | 24 ++++ .../templates/airport_shop_row.html | 25 ++++ .../doctype/airport_shop/test_airport_shop.py | 9 ++ .../doctype/contract_details/__init__.py | 0 .../contract_details/contract_details.js | 8 ++ .../contract_details/contract_details.json | 95 +++++++++++++++ .../contract_details/contract_details.py | 13 +++ .../contract_details/test_contract_details.py | 9 ++ .../doctype/rent_amount/__init__.py | 0 .../doctype/rent_amount/rent_amount.js | 8 ++ .../doctype/rent_amount/rent_amount.json | 44 +++++++ .../doctype/rent_amount/rent_amount.py | 9 ++ .../doctype/rent_amount/test_rent_amount.py | 9 ++ .../doctype/rent_payments/__init__.py | 0 .../doctype/rent_payments/rent_payments.js | 8 ++ .../doctype/rent_payments/rent_payments.json | 72 ++++++++++++ .../doctype/rent_payments/rent_payments.py | 9 ++ .../rent_payments/test_rent_payments.py | 9 ++ .../doctype/rent_reminders/__init__.py | 0 .../doctype/rent_reminders/rent_reminders.js | 8 ++ .../rent_reminders/rent_reminders.json | 47 ++++++++ .../doctype/rent_reminders/rent_reminders.py | 9 ++ .../rent_reminders/test_rent_reminders.py | 9 ++ .../doctype/shop_tenant/__init__.py | 0 .../doctype/shop_tenant/shop_tenant.js | 8 ++ .../doctype/shop_tenant/shop_tenant.json | 87 ++++++++++++++ .../doctype/shop_tenant/shop_tenant.py | 16 +++ .../doctype/shop_tenant/test_shop_tenant.py | 9 ++ airplane_mode/hooks.py | 6 +- airplane_mode/modules.txt | 3 +- airplane_mode/scheduler.py | 28 +++++ 65 files changed, 1511 insertions(+), 46 deletions(-) create mode 100644 airplane_mode/airplane_mode/doctype/crew_members/__init__.py create mode 100644 airplane_mode/airplane_mode/doctype/crew_members/crew_members.json create mode 100644 airplane_mode/airplane_mode/doctype/crew_members/crew_members.py create mode 100644 airplane_mode/airplane_mode/doctype/flight_crew_members/__init__.py create mode 100644 airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.js create mode 100644 airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.json create mode 100644 airplane_mode/airplane_mode/doctype/flight_crew_members/flight_crew_members.py create mode 100644 airplane_mode/airplane_mode/doctype/flight_crew_members/test_flight_crew_members.py create mode 100644 airplane_mode/airplane_mode/report/__init__.py create mode 100644 airplane_mode/airplane_mode/report/add_on_popularity/__init__.py create mode 100644 airplane_mode/airplane_mode/report/add_on_popularity/add_on_popularity.json create mode 100644 airplane_mode/airplane_mode/report/airplanes_by_airline/__init__.py create mode 100644 airplane_mode/airplane_mode/report/airplanes_by_airline/airplanes_by_airline.json create mode 100644 airplane_mode/airplane_mode/report/airplanes_by_airlines/__init__.py create mode 100644 airplane_mode/airplane_mode/report/airplanes_by_airlines/airplanes_by_airlines.json create mode 100644 airplane_mode/airplane_mode/report/revenue_by_airline/__init__.py create mode 100644 airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.js create mode 100644 airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.json create mode 100644 airplane_mode/airplane_mode/report/revenue_by_airline/revenue_by_airline.py create mode 100644 airplane_mode/airport_shop_management/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.js create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.json create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/airport_shop.py create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop.html create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop_row.html create mode 100644 airplane_mode/airport_shop_management/doctype/airport_shop/test_airport_shop.py create mode 100644 airplane_mode/airport_shop_management/doctype/contract_details/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/contract_details/contract_details.js create mode 100644 airplane_mode/airport_shop_management/doctype/contract_details/contract_details.json create mode 100644 airplane_mode/airport_shop_management/doctype/contract_details/contract_details.py create mode 100644 airplane_mode/airport_shop_management/doctype/contract_details/test_contract_details.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_amount/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.js create mode 100644 airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.json create mode 100644 airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_amount/test_rent_amount.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_payments/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.js create mode 100644 airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.json create mode 100644 airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_payments/test_rent_payments.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_reminders/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.js create mode 100644 airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.json create mode 100644 airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.py create mode 100644 airplane_mode/airport_shop_management/doctype/rent_reminders/test_rent_reminders.py create mode 100644 airplane_mode/airport_shop_management/doctype/shop_tenant/__init__.py create mode 100644 airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.js create mode 100644 airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.json create mode 100644 airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.py create mode 100644 airplane_mode/airport_shop_management/doctype/shop_tenant/test_shop_tenant.py create mode 100644 airplane_mode/scheduler.py 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 %} +

{{ title |e }}

+
+

Shop Details

+
  • Shop Name:{{ doc.shop_name }}
  • +
  • Shop Number:{{ doc.shop_number }}
  • +
  • Shop Area :{{ doc.shop_area }}
  • +
  • Available :{{ doc.type }}
  • + + {% set shop = title %} + {% set rent = 15000.0 |float %} + + + + Book Shop + + + +
    +{% endblock %} + + \ No newline at end of file diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop_row.html b/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop_row.html new file mode 100644 index 0000000..f990922 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/templates/airport_shop_row.html @@ -0,0 +1,25 @@ + + +
    + {% if doc.status == "Available" %} +
    +
    {{ doc.shop_name }}
    +
    At:{{ doc.airport }}
    + + + View Shop +
    + {% endif %} + +
    +
    + diff --git a/airplane_mode/airport_shop_management/doctype/airport_shop/test_airport_shop.py b/airplane_mode/airport_shop_management/doctype/airport_shop/test_airport_shop.py new file mode 100644 index 0000000..cede3e2 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/airport_shop/test_airport_shop.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestAirportShop(FrappeTestCase): + pass diff --git a/airplane_mode/airport_shop_management/doctype/contract_details/__init__.py b/airplane_mode/airport_shop_management/doctype/contract_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.js b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.js new file mode 100644 index 0000000..d5efeed --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Contract Details", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.json b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.json new file mode 100644 index 0000000..12a18b7 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.json @@ -0,0 +1,95 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{shop}-contract", + "creation": "2024-07-29 15:43:51.359191", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "tenant_name", + "shop", + "contract_expiry_date", + "column_break_vazm", + "type", + "rent_amount", + "lease_amount" + ], + "fields": [ + { + "fieldname": "tenant_name", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Tenant Name", + "options": "Shop Tenant", + "reqd": 1 + }, + { + "fieldname": "shop", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Shop ", + "options": "Airport Shop", + "reqd": 1 + }, + { + "depends_on": "eval:doc.type===\"For-Rent\"", + "description": "per month", + "fieldname": "rent_amount", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Rent Amount", + "options": "Rent Amount", + "read_only": 1 + }, + { + "fieldname": "contract_expiry_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Contract Expiry Date", + "reqd": 1 + }, + { + "default": "For-Rent", + "fetch_from": "shop.type", + "fieldname": "type", + "fieldtype": "Select", + "label": "Type", + "options": "For-Rent\nFor-Lease" + }, + { + "fieldname": "column_break_vazm", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.type===\"For-Lease\"", + "fieldname": "lease_amount", + "fieldtype": "Currency", + "label": "Lease Amount" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2024-07-29 18:01:51.981589", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Contract Details", + "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/airport_shop_management/doctype/contract_details/contract_details.py b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.py new file mode 100644 index 0000000..0786f43 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/contract_details/contract_details.py @@ -0,0 +1,13 @@ +# Copyright (c) 2024, snehalatha and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + + +class ContractDetails(Document): + + def before_validate(self): + rent_amt = frappe.get_doc('Rent Amount') + self.rent_amount = rent_amt.rent_amount + diff --git a/airplane_mode/airport_shop_management/doctype/contract_details/test_contract_details.py b/airplane_mode/airport_shop_management/doctype/contract_details/test_contract_details.py new file mode 100644 index 0000000..b12e67c --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/contract_details/test_contract_details.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestContractDetails(FrappeTestCase): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_amount/__init__.py b/airplane_mode/airport_shop_management/doctype/rent_amount/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.js b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.js new file mode 100644 index 0000000..48d70cc --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Rent Amount", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.json b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.json new file mode 100644 index 0000000..0ca70e3 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.json @@ -0,0 +1,44 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{rent_amount}", + "creation": "2024-07-29 17:16:51.957848", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "rent_amount" + ], + "fields": [ + { + "fieldname": "rent_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Rent Amount ", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2024-07-29 17:18:36.559227", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Rent Amount", + "naming_rule": "Expression", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 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/airport_shop_management/doctype/rent_amount/rent_amount.py b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.py new file mode 100644 index 0000000..ce672ff --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_amount/rent_amount.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 RentAmount(Document): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_amount/test_rent_amount.py b/airplane_mode/airport_shop_management/doctype/rent_amount/test_rent_amount.py new file mode 100644 index 0000000..be6b9fb --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_amount/test_rent_amount.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestRentAmount(FrappeTestCase): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_payments/__init__.py b/airplane_mode/airport_shop_management/doctype/rent_payments/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.js b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.js new file mode 100644 index 0000000..4f907ad --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Rent Payments", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.json b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.json new file mode 100644 index 0000000..462e74f --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.json @@ -0,0 +1,72 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{shop}-{received_date}", + "creation": "2024-07-30 12:20:24.037360", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "shop", + "tenant_name", + "amount", + "payment_status", + "received_date" + ], + "fields": [ + { + "fieldname": "shop", + "fieldtype": "Link", + "label": "Shop", + "options": "Contract Details" + }, + { + "fetch_from": "shop.tenant_name", + "fieldname": "tenant_name", + "fieldtype": "Data", + "label": "Tenant Name", + "read_only": 1 + }, + { + "fieldname": "payment_status", + "fieldtype": "Select", + "label": "Payment Status", + "options": "Received\nNot Received" + }, + { + "fieldname": "received_date", + "fieldtype": "Date", + "label": "Received Date" + }, + { + "fetch_from": "shop.rent_amount", + "fieldname": "amount", + "fieldtype": "Data", + "label": "Amount" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2024-07-30 12:27:48.995456", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Rent Payments", + "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/airport_shop_management/doctype/rent_payments/rent_payments.py b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.py new file mode 100644 index 0000000..e7aa537 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_payments/rent_payments.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 RentPayments(Document): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_payments/test_rent_payments.py b/airplane_mode/airport_shop_management/doctype/rent_payments/test_rent_payments.py new file mode 100644 index 0000000..de8e04d --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_payments/test_rent_payments.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestRentPayments(FrappeTestCase): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_reminders/__init__.py b/airplane_mode/airport_shop_management/doctype/rent_reminders/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.js b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.js new file mode 100644 index 0000000..3cf48f5 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Rent Reminders", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.json b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.json new file mode 100644 index 0000000..10661c7 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.json @@ -0,0 +1,47 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2024-07-29 18:27:54.663221", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "rent_reminder_section", + "is_enabled" + ], + "fields": [ + { + "fieldname": "rent_reminder_section", + "fieldtype": "Section Break", + "label": "Rent Reminder" + }, + { + "default": "0", + "fieldname": "is_enabled", + "fieldtype": "Check", + "label": "Is Enabled?" + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2024-07-29 18:28:31.259766", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Rent Reminders", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 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/airport_shop_management/doctype/rent_reminders/rent_reminders.py b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.py new file mode 100644 index 0000000..e4f57e5 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_reminders/rent_reminders.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 RentReminders(Document): + pass diff --git a/airplane_mode/airport_shop_management/doctype/rent_reminders/test_rent_reminders.py b/airplane_mode/airport_shop_management/doctype/rent_reminders/test_rent_reminders.py new file mode 100644 index 0000000..36c704f --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/rent_reminders/test_rent_reminders.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestRentReminders(FrappeTestCase): + pass diff --git a/airplane_mode/airport_shop_management/doctype/shop_tenant/__init__.py b/airplane_mode/airport_shop_management/doctype/shop_tenant/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.js b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.js new file mode 100644 index 0000000..3267086 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.js @@ -0,0 +1,8 @@ +// Copyright (c) 2024, snehalatha and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Shop Tenant", { +// refresh(frm) { + +// }, +// }); diff --git a/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.json b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.json new file mode 100644 index 0000000..c74ec6a --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.json @@ -0,0 +1,87 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{first_name}", + "creation": "2024-07-29 15:38:43.846918", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "tenant_information_section", + "first_name", + "last_name", + "full_name", + "email", + "contact_no" + ], + "fields": [ + { + "fieldname": "first_name", + "fieldtype": "Data", + "in_filter": 1, + "in_global_search": 1, + "in_list_view": 1, + "in_preview": 1, + "label": "First Name", + "reqd": 1 + }, + { + "fieldname": "last_name", + "fieldtype": "Data", + "in_global_search": 1, + "in_list_view": 1, + "in_preview": 1, + "label": "Last Name" + }, + { + "fieldname": "full_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Full Name", + "read_only": 1 + }, + { + "fieldname": "email", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Email", + "reqd": 1 + }, + { + "fieldname": "contact_no", + "fieldtype": "Phone", + "in_list_view": 1, + "label": "Contact no", + "reqd": 1 + }, + { + "fieldname": "tenant_information_section", + "fieldtype": "Section Break", + "label": "Tenant Information" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2024-07-29 17:28:52.339154", + "modified_by": "Administrator", + "module": "Airport shop management", + "name": "Shop Tenant", + "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/airport_shop_management/doctype/shop_tenant/shop_tenant.py b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.py new file mode 100644 index 0000000..db545a9 --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/shop_tenant/shop_tenant.py @@ -0,0 +1,16 @@ +# Copyright (c) 2024, snehalatha and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class ShopTenant(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}" diff --git a/airplane_mode/airport_shop_management/doctype/shop_tenant/test_shop_tenant.py b/airplane_mode/airport_shop_management/doctype/shop_tenant/test_shop_tenant.py new file mode 100644 index 0000000..ad7e12b --- /dev/null +++ b/airplane_mode/airport_shop_management/doctype/shop_tenant/test_shop_tenant.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, snehalatha and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestShopTenant(FrappeTestCase): + pass diff --git a/airplane_mode/hooks.py b/airplane_mode/hooks.py index 532431e..666ea81 100644 --- a/airplane_mode/hooks.py +++ b/airplane_mode/hooks.py @@ -132,7 +132,11 @@ app_license = "mit" # Scheduled Tasks # --------------- - +scheduler_events = { + "monthly": [ + "airplane_mode.scheduler.send_email_reminders" + ] +} # scheduler_events = { # "all": [ # "airplane_mode.tasks.all" diff --git a/airplane_mode/modules.txt b/airplane_mode/modules.txt index b62874d..15e97b3 100644 --- a/airplane_mode/modules.txt +++ b/airplane_mode/modules.txt @@ -1 +1,2 @@ -Airplane mode \ No newline at end of file +Airplane mode +Airport shop management \ No newline at end of file diff --git a/airplane_mode/scheduler.py b/airplane_mode/scheduler.py new file mode 100644 index 0000000..821315b --- /dev/null +++ b/airplane_mode/scheduler.py @@ -0,0 +1,28 @@ + +import frappe +from frappe import sendmail +from frappe.utils import nowdate +from frappe.core.doctype.communication.email import make + +def send_email_reminders(): + + reminder = frappe.get_doc('Rent Reminders') + if(reminder.is_enabled): + records = frappe.get_all('Contract Details', filters={ + 'type': 'For-Rent', + },fields=["*"]) + for record in records: + subject = "Reminder: Rent Amount" + message = f"Dear Tenant, please pay the rent amount on time." + tenant = frappe.get_doc("Shop Tenant",{"first_name",record.tenant_name}) + recipients = [ tenant.email ] + + # Send email + comm = sendmail( + recipients= recipients, + subject=subject, + message=message, + ) + return comm + else: + return "Reminder not enabled"