Skip to content

Commit

Permalink
portal webpages
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalutu committed Jan 3, 2025
1 parent 7e8de8e commit 100f57e
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 8 deletions.
21 changes: 19 additions & 2 deletions rentals/rentals/doctype/driver/driver.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"actions": [],
"allow_guest_to_view": 1,
"allow_import": 1,
"allow_rename": 1,
"autoname": "format:DR-{###}",
Expand All @@ -13,7 +14,9 @@
"column_break_etkh",
"license_number",
"phone_number",
"profile_image"
"profile_image",
"is_published",
"route"
],
"fields": [
{
Expand Down Expand Up @@ -54,12 +57,25 @@
"fieldtype": "Data",
"label": "Full Name",
"read_only": 1
},
{
"default": "0",
"fieldname": "is_published",
"fieldtype": "Check",
"label": "is Published"
},
{
"fieldname": "route",
"fieldtype": "Data",
"label": "Route"
}
],
"has_web_view": 1,
"image_field": "profile_image",
"index_web_pages_for_search": 1,
"is_published_field": "is_published",
"links": [],
"modified": "2025-01-03 19:11:30.087229",
"modified": "2025-01-04 00:10:58.904191",
"modified_by": "Administrator",
"module": "Rentals",
"name": "Driver",
Expand All @@ -79,6 +95,7 @@
"write": 1
}
],
"route": "cars",
"show_title_field_in_link": 1,
"sort_field": "creation",
"sort_order": "DESC",
Expand Down
4 changes: 2 additions & 2 deletions rentals/rentals/doctype/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document
from frappe.website.website_generator import WebsiteGenerator


class Driver(Document):
class Driver(WebsiteGenerator):
def before_save(self):
self.full_name = f"{self.first_name} {self.last_name}"
7 changes: 7 additions & 0 deletions rentals/rentals/doctype/driver/templates/driver.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "templates/web.html" %}

{% block page_content %}
<h1>{{ title |e }}</h1>
{% endblock %}

<!-- this is a sample default web page template -->
4 changes: 4 additions & 0 deletions rentals/rentals/doctype/driver/templates/driver_row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<a href="/{{ doc.route |e }}">{{ (doc.title or doc.name) |e }}</a>
</div>
<!-- this is a sample default list template -->
5 changes: 5 additions & 0 deletions rentals/rentals/doctype/ride_booking/ride_booking.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ frappe.ui.form.on("Ride Booking", {

frappe.ui.form.on("Ride Booking Item", {
refresh(frm) {},

distance(frm, cdt, cdn) {
frm.trigger("update_total_amount");
},

items_remove(frm) {
frm.trigger("update_total_amount");
},
});
8 changes: 8 additions & 0 deletions rentals/rentals/doctype/vehicle/templates/vehicle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "templates/web.html" %} {% block page_content %}
<h1>{{ title |e }}</h1>
<h2>Color: {{color}}</h2>
<a class="btn btn-info" href="/order-a-ride/new?vehicle={{doc.name}}">Book a Ride</a>

{% endblock %}

<!-- this is a sample default web page template -->
4 changes: 4 additions & 0 deletions rentals/rentals/doctype/vehicle/templates/vehicle_row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<a href="/{{ doc.route |e }}">{{ (doc.title or doc.name) |e }}</a>
</div>
<!-- this is a sample default list template -->
22 changes: 20 additions & 2 deletions rentals/rentals/doctype/vehicle/vehicle.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"actions": [],
"allow_guest_to_view": 1,
"allow_import": 1,
"allow_rename": 1,
"autoname": "autoincrement",
Expand All @@ -13,7 +14,9 @@
"color",
"column_break_xqob",
"model",
"license_plate"
"license_plate",
"is_published",
"route"
],
"fields": [
{
Expand Down Expand Up @@ -59,11 +62,25 @@
"fieldtype": "Data",
"label": "Title",
"read_only": 1
},
{
"default": "0",
"fieldname": "is_published",
"fieldtype": "Check",
"label": "is Published"
},
{
"fieldname": "route",
"fieldtype": "Data",
"label": "Route",
"no_copy": 1
}
],
"has_web_view": 1,
"index_web_pages_for_search": 1,
"is_published_field": "is_published",
"links": [],
"modified": "2025-01-03 18:29:33.918122",
"modified": "2025-01-04 00:24:57.279258",
"modified_by": "Administrator",
"module": "Rentals",
"name": "Vehicle",
Expand All @@ -83,6 +100,7 @@
"write": 1
}
],
"route": "cabs",
"show_title_field_in_link": 1,
"sort_field": "creation",
"sort_order": "DESC",
Expand Down
4 changes: 2 additions & 2 deletions rentals/rentals/doctype/vehicle/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document
from frappe.website.website_generator import WebsiteGenerator


class Vehicle(Document):
class Vehicle(WebsiteGenerator):
def before_save(self):
self.set_title()

Expand Down
2 changes: 2 additions & 0 deletions rentals/www/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Hello World</h1>
<h2>{{username}}</h2>
4 changes: 4 additions & 0 deletions rentals/www/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
no_cache = 1

def get_context(context):
context.username = "Dan Kalutu"

0 comments on commit 100f57e

Please sign in to comment.