day3 and day4 assignment

This commit is contained in:
snehalathad@aissel.com 2024-07-30 17:23:55 +05:30
parent 04915b3909
commit f5f3d90c63
65 changed files with 1511 additions and 46 deletions

View File

@ -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");
},
});

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -36,3 +36,53 @@ frappe.ui.form.on("Airplane Ticket Add-on Item", {
frm.set_value("total_amount",frm.doc.flight_price + total_addon);
}
});
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")
}
});

View File

@ -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",

View File

@ -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.check_capacity()
self.total_amount = float(self.flight_price) + total_addon
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_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.')

View File

@ -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",

View File

@ -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",

View File

@ -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": []
}

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -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

View File

@ -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"
}
]
}

View File

@ -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"
}
]
}

View File

@ -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"
}
]
}

View File

@ -0,0 +1,8 @@
// Copyright (c) 2024, snehalatha and contributors
// For license information, please see license.txt
frappe.query_reports["Revenue By Airline"] = {
"filters": [
]
};

View File

@ -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"
}
]
}

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -0,0 +1,24 @@
{% extends "templates/web.html" %}
{% block page_content %}
<h3>{{ title |e }}</h3>
<div>
<h4>Shop Details</h4>
<li class="font-size-sm text-muted">Shop Name:{{ doc.shop_name }}</li>
<li class="font-size-sm text-muted">Shop Number:{{ doc.shop_number }}</li>
<li class="font-size-sm text-muted">Shop Area :{{ doc.shop_area }}</li>
<li class="font-size-sm text-muted padding:2px">Available :{{ doc.type }}</li>
{% set shop = title %}
{% set rent = 15000.0 |float %}
<a class="btn btn-info" href="/book-airport-shop/new?shop={{ shop }}&&rent_amount={{ rent }}">Book Shop</a>
</div>
{% endblock %}
<!-- this is a sample default web page template -->

View File

@ -0,0 +1,25 @@
<style>
.list {
color: black;
border: 1px solid black;
border-radius: 10px;
margin: 5px;
padding: 10px;
}
</style>
<div>
{% if doc.status == "Available" %}
<div class="list" >
<h5>{{ doc.shop_name }}</h5>
<h5 class="font-size-sm text-muted">At:{{ doc.airport }}</h5>
<a class="font-size-sm color:blue;" href="/{{ doc.route |e }}">View Shop</a>
</div>
{% endif %}
<div></div>
</div>
<!-- this is a sample default list template -->

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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

View File

@ -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

View File

@ -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) {
// },
// });

View File

@ -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": []
}

View File

@ -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}"

View File

@ -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

View File

@ -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"

View File

@ -1 +1,2 @@
Airplane mode
Airport shop management

View File

@ -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"