Changes to web templates

This commit is contained in:
Jeremy Rangel
2025-02-17 22:53:49 -08:00
parent 0991b51fe0
commit d7f9ddb8dd
10 changed files with 217 additions and 14 deletions

View File

@ -36,3 +36,113 @@ def lead_magnet(email,subject,content):
except Exception as e:
frappe.log_error(f"Lead Creation Error: {str(e)}", "Lead API Error")
return {"success": False, "error": str(e)}
@frappe.whitelist(allow_guest=True)
def contact_form():
try:
# Extract data from the form submission
data = frappe.form_dict # Get request parameters
first_name = data.get("first_name")
last_name = data.get("last_name")
business_name = data.get("business_name")
email = data.get("email")
phone = data.get("phone")
subject = data.get("subject")
content = data.get("content")
department = data.get("department")
if not email or not subject or not content:
return {"success": False, "error": "Missing required parameters"}
reference_doctype = "Contact"
reference_name = None
if department and department.lower() == "sales":
# Look for a Lead with the given email
lead_name = frappe.db.get_value("Lead", {"email_id": email}, "name")
if lead_name:
# Update Lead status to 'Open'
frappe.db.set_value("Lead", lead_name, "status", "Open")
reference_doctype = "Lead"
reference_name = lead_name
else:
# Create a new Lead if not found
lead_doc = frappe.get_doc({
"doctype": "Lead",
"first_name": first_name or "Unknown",
"last_name": last_name or "",
"company_name": business_name or "",
"email_id": email,
"phone": phone or "",
"status": "Open"
})
lead_doc.insert(ignore_permissions=True)
reference_doctype = "Lead"
reference_name = lead_doc.name
if not reference_name:
# Check if a Contact with the given email exists by querying the Contact Email doctype
contact_email = frappe.db.get_value("Contact Email", {"email_id": email}, "parent")
if not contact_email:
# Create a new Contact if not found
contact_doc = frappe.get_doc({
"doctype": "Contact",
"first_name": first_name or "Unknown",
"status": "Open",
"email_ids": [
{
"email_id": email,
}
]
})
contact_doc.insert(ignore_permissions=True)
reference_name = contact_doc.name
else:
# If contact exists, we ensure the email is linked, but only if it isn't already
contact_doc = frappe.get_doc("Contact", contact_email)
existing_email = frappe.db.exists("Contact Email", {"parent": contact_doc.name, "email_id": email})
if not existing_email:
contact_doc.append("email_ids", {
"email_id": email,
"is_primary": 1 # Optional: Make it the primary email if needed
})
contact_doc.save(ignore_permissions=True)
reference_name = contact_doc.name
if department and department.lower() == "support":
# Create an Issue and link it to the Contact
issue_doc = frappe.get_doc({
"doctype": "Issue",
"subject": subject,
"description": content,
"raised_by": email,
"contact": reference_name
})
issue_doc.insert(ignore_permissions=True)
reference_doctype = "Issue"
reference_name = issue_doc.name
# Create a Communication linked to the determined reference doctype
communication = frappe.get_doc({
"doctype": "Communication",
"subject": subject,
"content": content,
"sender": email,
"sent_or_received": "Received",
"reference_doctype": reference_doctype,
"reference_name": reference_name
})
communication.insert(ignore_permissions=True)
return {"success": True, "message": "Lead, Contact, or Issue and communication recorded successfully", "reference_doctype": reference_doctype, "reference_name": reference_name}
except Exception as e:
frappe.log_error(f"Contact Form Error: {str(e)}", "Contact Form API Error")
return {"success": False, "error": str(e)}

Binary file not shown.

View File

@ -0,0 +1,56 @@
{
"__unsaved": 1,
"creation": "2024-08-12 15:26:23.140620",
"docstatus": 0,
"doctype": "Web Template",
"template": "<section class=\"rd-twnety-five-seventy-five-accordion-one sec_padding\"><div class=\"container\"><div class=\"rd-heading-row\">{% if heading %}<h2 class=\"text-center\">{{heading}}</h2>{% endif %}{% if sub_heading %}<p class=\"text-center\">{{sub_heading}}</p>{% endif %}</div><div class=\"row\"><div class=\"col-lg-5\"><img src=\"{{featured_image}}\"></div><div class=\"col-lg-7 rd-accordion-column\"><div class=\"accordion d-flex flex-column ps-4\" id=\"accordionExample\">{% for accordion in accordion_tabs %}<div class=\"accordion-item wow fadeInUp\" data-wow-delay=\"0.5s\" style=\"visibility: visible; animation-delay: 0.5s; animation-name: fadeInUp;\"><p class=\"accordion-header d-flex justify-content-between\" id=\"heading{{ loop.index }}\"><button class=\"accordion-button collapsed d-flex justify-content-between\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapse{{ loop.index }}\" aria-expanded=\"false\" aria-controls=\"collapse{{ loop.index }}\">{{ accordion.accordion_heading }}</button></p><div id=\"collapse{{ loop.index }}\" class=\"accordion-collapse collapse\" aria-labelledby=\"heading{{ loop.index }}\" data-bs-parent=\"#accordionExample\"><div class=\"accordion-body\">{{ accordion.accordion_content }}</div></div></div>{% endfor %}</div></div></div></div></section>",
"fields": [
{
"fieldname": "heading",
"fieldtype": "Data",
"label": "Heading",
"reqd": 0
},
{
"fieldname": "sub_heading",
"fieldtype": "Data",
"label": "Sub Heading",
"reqd": 0
},
{
"fieldname": "featured_image",
"fieldtype": "Attach Image",
"label": "Featured Image",
"reqd": 0
},
{
"fieldname": "accordion_tabs",
"fieldtype": "Table Break",
"label": "Accordion Tabs",
"reqd": 0
},
{
"fieldname": "accordion_heading",
"fieldtype": "Data",
"label": "Accordion Heading",
"reqd": 0
},
{
"fieldname": "accordion_content",
"fieldtype": "Text",
"label": "According Content"
}
],
"idx": 0,
"modified": "2022-03-21 14:30:14.405261",
"modified_by": "Administrator",
"module": "Website",
"name": "25/75 Accordion Section - 1",
"owner": "Administrator",
"standard": 0,
"type": "Component"
}

View File

@ -25,6 +25,6 @@
"name": "3 Blog Section - 1",
"owner": "Administrator",
"standard": 0,
"template":"<section class=\"blog-area pt-120 pb-120\">\n\t<div class=\"container\">\n\t\t<div class=\"section-header text-center mb-60\">\n\t\t\t<h5 class=\"wow fadeInUp\" data-wow-delay=\"00ms\" data-wow-duration=\"1500ms\">\n\t\t\t\t<img class=\"me-1\" src=\"https://gratech.coevs.com/assets/general/images/8CWx8hxBlsFPblsrbKXm.png\" alt=\"icon\">\n\t\t\t\t{{sub_heading}}\n\t\t\t</h5>\n\t\t\t<h2 class=\"wow fadeInUp\" data-wow-delay=\"200ms\" data-wow-duration=\"1500ms\"> {{heading}} </h2>\n\t\t</div>\n\t\t<div class=\"row g-4\">\n\t\t {% set blogs = frappe.get_all('Blog Post',filters={'published':1}, fields=[\"*\"], order_by='',page_length=3) %}\n\t\t {% for blog in blogs %}\n\t\t\t <div class=\"col-xl-4 col-lg-6 col-md-6 wow fadeInUp\" data-wow-delay=\"100ms\"\n\t\t\t data-wow-duration=\"1500ms\">\n\t\t\t\t<div class=\"blog__item\">\n\t\t\t\t\t<a href=\"https://gratech.coevs.com/blog/keep-your-business-safe-ensure-high-availability\" class=\"blog__image d-block image\">\n\t\t\t\t\t\t<img class=\"component-blog-cover\" src=\"https://gratech.coevs.com/assets/general/images/x9Rjxh5b3w3Z3HhdpJ7a.jpg\" alt=\"image\">\n\t\t\t\t\t\t<div class=\"blog-tag\">\n\t\t\t\t\t\t\t<h3 class=\"text-white\">{{blog.published_on.strftime(\"%d\")}}</h3>\n\t\t\t\t\t\t\t<span class=\"text-white\">{{blog.published_on.strftime(\"%b\")}}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t\t<div class=\"blog__content\">\n\t\t\t\t\t\t<ul class=\"blog-info\" style=\"margin-bottom:20px;padding-bottom:20px\">\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"\n\t\t\t\t\t\t\t\t xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M14.5436 5.19275C14.5436 7.69093 12.499 9.7355 10.0008 9.7355C7.50268 9.7355 5.45811 7.69093 5.45811 5.19275C5.45811 2.69457 7.50264 0.65 10.0008 0.65C12.499 0.65 14.5436 2.69458 14.5436 5.19275Z\"\n\t\t\t\t\t\t\t\t\tstroke=\"#3C72FC\" stroke-width=\"1.3\" />\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M18.2644 14.6706C18.1052 14.9458 17.9241 15.2073 17.7169 15.4766L17.7168 15.4765L17.7089 15.4873C17.4204 15.8788 17.0845 16.2373 16.7295 16.5924C16.4326 16.8892 16.0933 17.186 15.7568 17.4385C14.0794 18.6911 12.0622 19.3499 9.97818 19.3499C7.8984 19.3499 5.8851 18.6938 4.2098 17.4461C3.84591 17.1504 3.51371 16.8792 3.2269 16.5924L3.21993 16.5854L3.21276 16.5787C2.85667 16.2436 2.54242 15.8877 2.24749 15.4874L2.24751 15.4873L2.24417 15.4829C2.06196 15.24 1.87324 14.9756 1.71923 14.7169C1.83622 14.4559 1.98458 14.1847 2.14525 13.9526L2.14536 13.9527L2.15288 13.9413C3.06988 12.5556 4.53709 11.6388 6.16646 11.4148L6.18604 11.4121L6.20542 11.4082C6.2309 11.4031 6.29498 11.4117 6.34551 11.4496L6.3455 11.4496L6.34951 11.4525C7.41654 12.2401 8.68633 12.6453 10.0008 12.6453C11.3153 12.6453 12.5851 12.2401 13.6522 11.4525L13.6522 11.4525L13.6562 11.4496C13.6716 11.438 13.7404 11.408 13.8492 11.4167C15.4689 11.6435 16.9121 12.5568 17.8525 13.9468L17.8524 13.9469L17.8564 13.9526C18.0166 14.1839 18.1557 14.4231 18.2644 14.6706Z\"\n\t\t\t\t\t\t\t\t\tstroke=\"#3C72FC\" stroke-width=\"1.3\" />\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t<span>{% set author = frappe.get_doc('Blogger',blog.blogger ) %}{{author.name}}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<h3><a href=\"{{blog.route}}\" class=\"primary-hover\">{{blog.title}}</a></h3>\n\t\t\t\t\t\t<a class=\"mt-25 read-more-btn\" href=\"{{blog.route}}\">Read More <i\n\t\t\t\t\t\t\t\tclass=\"fa-regular fa-arrow-right-long\"></i></a>\n\t\t\t\t\t</div></div></div>\n\t\t {% endfor %}\n\t\t</div>\n\t</div>\n</section>",
"type": "Component"
"template":"<section class=\"blog-area pt-120 pb-120\">\n\t<div class=\"container\">\n\t\t<div class=\"section-header text-center mb-60\">\n\t\t\t<h5 class=\"wow fadeInUp\" data-wow-delay=\"00ms\" data-wow-duration=\"1500ms\">\n\t\t\t\t<img class=\"me-1\" src=\"https://gratech.coevs.com/assets/general/images/8CWx8hxBlsFPblsrbKXm.png\" alt=\"icon\">\n\t\t\t\t{{sub_heading}}\n\t\t\t</h5>\n\t\t\t<h2 class=\"wow fadeInUp\" data-wow-delay=\"200ms\" data-wow-duration=\"1500ms\"> {{heading}} </h2>\n\t\t</div>\n\t\t<div class=\"row g-4\">\n\t\t {% set blogs = frappe.get_all('Blog Post', filters={'published': 1}, fields=[\"*\"], order_by='published_on desc', page_length=3) %}\n\t\t {% for blog in blogs %}\n\t\t\t <div class=\"col-xl-4 col-lg-6 col-md-6 wow fadeInUp\" data-wow-delay=\"100ms\"\n\t\t\t data-wow-duration=\"1500ms\">\n\t\t\t\t<div class=\"blog__item card\">\n\t\t\t\t\t<a href=\"{{ blog.route }}\" class=\"blog__image d-block image\">\n\t\t\t\t\t\t<img class=\"component-blog-cover\" src=\"{{ blog.cover_image }}\" alt=\"image\">\n\t\t\t\t\t\t<div class=\"blog-tag\">\n\t\t\t\t\t\t\t<h3 class=\"text-white\">{{ blog.published_on.strftime(\"%d\") }}</h3>\n\t\t\t\t\t\t\t<span class=\"text-white\">{{ blog.published_on.strftime(\"%b\") }}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t\t<div class=\"blog__content\">\n\t\t\t\t\t\t<ul class=\"blog-info\" style=\"margin-bottom:20px;padding-bottom:20px\">\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"\n\t\t\t\t\t\t\t\t xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M14.5436 5.19275C14.5436 7.69093 12.499 9.7355 10.0008 9.7355C7.50268 9.7355 5.45811 7.69093 5.45811 5.19275C5.45811 2.69457 7.50264 0.65 10.0008 0.65C12.499 0.65 14.5436 2.69458 14.5436 5.19275Z\"\n\t\t\t\t\t\t\t\t\tstroke=\"#3C72FC\" stroke-width=\"1.3\" />\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M18.2644 14.6706C18.1052 14.9458 17.9241 15.2073 17.7169 15.4766L17.7168 15.4765L17.7089 15.4873C17.4204 15.8788 17.0845 16.2373 16.7295 16.5924C16.4326 16.8892 16.0933 17.186 15.7568 17.4385C14.0794 18.6911 12.0622 19.3499 9.97818 19.3499C7.8984 19.3499 5.8851 18.6938 4.2098 17.4461C3.84591 17.1504 3.51371 16.8792 3.2269 16.5924L3.21993 16.5854L3.21276 16.5787C2.85667 16.2436 2.54242 15.8877 2.24749 15.4874L2.24751 15.4873L2.24417 15.4829C2.06196 15.24 1.87324 14.9756 1.71923 14.7169C1.83622 14.4559 1.98458 14.1847 2.14525 13.9526L2.14536 13.9527L2.15288 13.9413C3.06988 12.5556 4.53709 11.6388 6.16646 11.4148L6.18604 11.4121L6.20542 11.4082C6.2309 11.4031 6.29498 11.4117 6.34551 11.4496L6.3455 11.4496L6.34951 11.4525C7.41654 12.2401 8.68633 12.6453 10.0008 12.6453C11.3153 12.6453 12.5851 12.2401 13.6522 11.4525L13.6522 11.4525L13.6562 11.4496C13.6716 11.438 13.7404 11.408 13.8492 11.4167C15.4689 11.6435 16.9121 12.5568 17.8525 13.9468L17.8524 13.9469L17.8564 13.9526C18.0166 14.1839 18.1557 14.4231 18.2644 14.6706Z\"\n\t\t\t\t\t\t\t\t\tstroke=\"#3C72FC\" stroke-width=\"1.3\" />\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t<span>{% set author = frappe.get_doc('Blogger',blog.blogger ) %}{{author.name}}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<h3><a href=\"{{blog.route}}\" class=\"primary-hover\">{{blog.title}}</a></h3>\n\t\t\t\t\t\t<a class=\"mt-25 read-more-btn\" href=\"{{blog.route}}\">Read More <i\n\t\t\t\t\t\t\t\tclass=\"fa-regular fa-arrow-right-long\"></i></a>\n\t\t\t\t\t</div></div></div>\n\t\t {% endfor %}\n\t\t</div>\n\t</div>\n</section>"
, "type": "Component"
}

View File

@ -29,12 +29,7 @@
"label": "Accordion Tabs",
"reqd": 0
},
{
"fieldname": "accordion_id",
"fieldtype": "Data",
"label": "Accordion ID",
"reqd": 1
},
{
"fieldname": "accordion_heading",
"fieldtype": "Data",

View File

@ -0,0 +1,28 @@
{
"__unsaved": 1,
"creation": "2024-08-12 15:26:23.140620",
"docstatus": 0,
"doctype": "Web Template",
"template": "<section><div class=\"container\"><div class=\"row\"><div class=\"col-md-8\">{{left_column_html}}</div><div class=\"col-md-4\">{{right_column_html}}</div></div></div></section>",
"fields": [
{
"fieldname": "left_column_html",
"fieldtype": "Code",
"label": "Left Column HTML"
},
{
"fieldname": "right_column_html",
"fieldtype": "Code",
"label": "Right Column HTML"
}
],
"idx": 0,
"modified": "2022-03-21 14:30:14.405261",
"modified_by": "Administrator",
"module": "Website",
"name": "75/25 HTML Section - 1",
"owner": "Administrator",
"standard": 0,
"type": "Component"
}

View File

@ -3,7 +3,7 @@
"name": "Page Heading - 1",
"module": "Website",
"type": "Component",
"template":"<section class=\"page-heading-1\"><div class=\"container text-center\"><h1 class=\"rd text-gradient-1\">{{heading}}</h1><h2 class=\"rd\">{{sub_heading}}</h2><a class=\"rd-button-one\" href=\"{{cta_url}}\">{{cta_text}}</a></div></section>",
"template":"<section class=\"page-heading-1\"><div class=\"container text-center\"><h1 class=\"rd text-gradient-1\">{{heading}}</h1><h2 class=\"rd\">{{sub_heading}}</h2>{% if cta_url %}<a class=\"rd-button-one\" href=\"{{cta_url}}\">{{cta_text}}</a>{% endif %}</div></section>",
"fields": [
{
"fieldname": "heading",

View File

@ -3,7 +3,7 @@
"name": "Page Heading - 2",
"module": "Website",
"type": "Component",
"template":"<section class=\"rd-page-heading-2\"><div class=\"container text-center\"><h1 class=\"rd-heading\">{{heading}}</h1><p class=\"rd-sub-heading\">{{sub_heading}}</p>{{lead_form_code}}<img src=\"{{featured_image}}\"/></div></section>",
"template":"<section class=\"rd-page-heading-2\"><div class=\"container text-center\"><h1 class=\"rd-heading\">{{heading}}</h1><p class=\"rd-sub-heading\">{{sub_heading}}</p>{% if lead_form_code %}{{lead_form_code}}{% endif %}{% if featured_image %}<img src=\"{{featured_image}}\" alt=\"{{featured_image}}\"/>{% endif %}</div></section>",
"fields": [
{
"fieldname": "heading",

View File

@ -4,11 +4,16 @@ section {background:#01071C}
.row {margin-bottom:20px;row-gap:20px}
.rd-heading-row {margin-bottom:40px}
.rd.card {background-color:#1C2037}
h1,h2,h3,h4,h5,h6,p {color:white}
h2.rd {color:#E0E0E0}
.card {border:none}
h1,h2,h3,h4,h5,h6,p,h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, span {color:white}
.rd-button-one {padding:10px 20px;font-weight:bold;border-radius:3px;color:black;background-image: linear-gradient(134deg, #008AFC 27%, #97F8F4 100%)}
.text-gradient-1 {background-clip:text;-webkit-background-clip: text !important;padding-top:10px;padding-bottom:20px;background: -webkit-linear-gradient(#119CFF, #97F8F4);-webkit-text-fill-color: transparent}
.card {background-color:#1C2037;padding:20px}
button:not(.accordion-button),.rd-button:not(.accordion-button) {padding:10px;border-radius:5px;width:100%;border:none;background-color:#119CFF;background-image: linear-gradient(134deg, #008AFC 27%, #97F8F4 100%);}
/* ----- FORMS AND INPUTS ------- */
label {color:#A5A5A5;font-size:14px}
input,select {color:#A5A5A5;width:100%;border:0!important;padding:20px; border-radius:5px;background-color:#1C2037;border:1px solid #87868636}
/* ----- Gradients ----- */
.rd-background-gradient-1 {background-color:transparent;background-image:linear-gradient(45deg, #119Cff 0%, #97F8F4 100%)
}
@ -29,6 +34,9 @@ nav.rd-navbar-1 .navbar-toggler svg {stroke:white}
.rd-navbar-1 #navbarSupportedContent a {font-size:1rem;font-weight:400}
}
.nav-item.active {border-bottom:none!important}
.nav-item.active a {color:#119CFF}
/* ------- Sections --------*/
/* ------- 50/50 Accordion Section - 1 ---------*/
section.rd-fifty-fifty-accordion-one {background:#01071C;position:relative;z-index:1}
@ -131,7 +139,7 @@ section.rd-page-heading-2 {padding-top:255px;padding-bottom:120px}
/* ---------- Multi Cards Section - 1 ---------- */
.rd-multi-cards-section-one {row-gap:20px}
.rd-multi-cards-section-one .card {background:#1C2037;border-radius:10px;padding:20px;min-height:300px}
.rd-multi-cards-section-one .card {background:#1C2037;border-radius:10px;min-height:300px}
.rd-multi-cards-section-one .card-body {padding:0;margin-top:20px}
.rd-multi-cards-section-one h2 {font-size:3rem;margin-bottom:60px;color:white}
.rd-multi-cards-section-one .card-img-top {border-radius:10px}
@ -170,4 +178,10 @@ footer.rd-footer-1 .rd-heading {font-size:3rem;font-weight:bold}
footer.rd-footer-1 .rd-sub-heading {font-size:1.5rem;color:white}
footer.rd-footer-1 ul {padding:0;list-style:none;margin-top:10px}
footer.rd-footer-1 ul li {color:white}
footer.rd-footer-1 .rd-footer-column-heading {color:white;font-weight:bold}
footer.rd-footer-1 .rd-footer-column-heading {color:white;font-weight:bold}
/* Frappe Website Bundle Override */
.blog-card .card {border:none}
.blog-card span.text-dark {color:white !important}
.blog-card .text-muted a{color:white !important}