diff --git a/rangeldigital/__pycache__/api.cpython-313.pyc b/rangeldigital/__pycache__/api.cpython-313.pyc index 61251b8..32bae9f 100644 Binary files a/rangeldigital/__pycache__/api.cpython-313.pyc and b/rangeldigital/__pycache__/api.cpython-313.pyc differ diff --git a/rangeldigital/api.py b/rangeldigital/api.py index cbb2a4d..831a8a6 100644 --- a/rangeldigital/api.py +++ b/rangeldigital/api.py @@ -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)} diff --git a/rangeldigital/dump.rdb b/rangeldigital/dump.rdb index ceb93a9..25d77ba 100644 Binary files a/rangeldigital/dump.rdb and b/rangeldigital/dump.rdb differ diff --git a/rangeldigital/fixtures/web_template_25_75_accordtion_section_1.json b/rangeldigital/fixtures/web_template_25_75_accordtion_section_1.json new file mode 100644 index 0000000..7e49b8c --- /dev/null +++ b/rangeldigital/fixtures/web_template_25_75_accordtion_section_1.json @@ -0,0 +1,56 @@ + +{ + "__unsaved": 1, + "creation": "2024-08-12 15:26:23.140620", + "docstatus": 0, + "doctype": "Web Template", + "template": "
{% if heading %}

{{heading}}

{% endif %}{% if sub_heading %}

{{sub_heading}}

{% endif %}
{% for accordion in accordion_tabs %}

{{ accordion.accordion_content }}
{% endfor %}
", + "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" + } \ No newline at end of file diff --git a/rangeldigital/fixtures/web_template_3_blog_section_1.json b/rangeldigital/fixtures/web_template_3_blog_section_1.json index 9c9a844..1b90202 100644 --- a/rangeldigital/fixtures/web_template_3_blog_section_1.json +++ b/rangeldigital/fixtures/web_template_3_blog_section_1.json @@ -25,6 +25,6 @@ "name": "3 Blog Section - 1", "owner": "Administrator", "standard": 0, - "template":"
\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t\"icon\"\n\t\t\t\t{{sub_heading}}\n\t\t\t
\n\t\t\t

{{heading}}

\n\t\t
\n\t\t
\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
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\"image\"\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

{{blog.published_on.strftime(\"%d\")}}

\n\t\t\t\t\t\t\t{{blog.published_on.strftime(\"%b\")}}\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t
  • \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{% set author = frappe.get_doc('Blogger',blog.blogger ) %}{{author.name}}\n\t\t\t\t\t\t
  • \n\t\t\t\t\t\t
\n\t\t\t\t\t\t

{{blog.title}}

\n\t\t\t\t\t\tRead More \n\t\t\t\t\t
\n\t\t {% endfor %}\n\t\t
\n\t
\n
", - "type": "Component" +"template":"
\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t\"icon\"\n\t\t\t\t{{sub_heading}}\n\t\t\t
\n\t\t\t

{{heading}}

\n\t\t
\n\t\t
\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
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\"image\"\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

{{ blog.published_on.strftime(\"%d\") }}

\n\t\t\t\t\t\t\t{{ blog.published_on.strftime(\"%b\") }}\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t
  • \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{% set author = frappe.get_doc('Blogger',blog.blogger ) %}{{author.name}}\n\t\t\t\t\t\t
  • \n\t\t\t\t\t\t
\n\t\t\t\t\t\t

{{blog.title}}

\n\t\t\t\t\t\tRead More \n\t\t\t\t\t
\n\t\t {% endfor %}\n\t\t
\n\t
\n
" +, "type": "Component" } diff --git a/rangeldigital/fixtures/web_template_50_50_accordion_1.json b/rangeldigital/fixtures/web_template_50_50_accordion_1.json index e22bdf1..8f0704f 100644 --- a/rangeldigital/fixtures/web_template_50_50_accordion_1.json +++ b/rangeldigital/fixtures/web_template_50_50_accordion_1.json @@ -29,12 +29,7 @@ "label": "Accordion Tabs", "reqd": 0 }, - { - "fieldname": "accordion_id", - "fieldtype": "Data", - "label": "Accordion ID", - "reqd": 1 - }, + { "fieldname": "accordion_heading", "fieldtype": "Data", diff --git a/rangeldigital/fixtures/web_template_75_25_html_section_1.json b/rangeldigital/fixtures/web_template_75_25_html_section_1.json new file mode 100644 index 0000000..24dbfec --- /dev/null +++ b/rangeldigital/fixtures/web_template_75_25_html_section_1.json @@ -0,0 +1,28 @@ +{ + "__unsaved": 1, + "creation": "2024-08-12 15:26:23.140620", + "docstatus": 0, + "doctype": "Web Template", + "template": "
{{left_column_html}}
{{right_column_html}}
", + "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" + } \ No newline at end of file diff --git a/rangeldigital/fixtures/web_template_page_heading_1.json b/rangeldigital/fixtures/web_template_page_heading_1.json index da03a52..07de9ef 100644 --- a/rangeldigital/fixtures/web_template_page_heading_1.json +++ b/rangeldigital/fixtures/web_template_page_heading_1.json @@ -3,7 +3,7 @@ "name": "Page Heading - 1", "module": "Website", "type": "Component", -"template":"

{{heading}}

{{sub_heading}}

{{cta_text}}
", +"template":"

{{heading}}

{{sub_heading}}

{% if cta_url %}{{cta_text}}{% endif %}
", "fields": [ { "fieldname": "heading", diff --git a/rangeldigital/fixtures/web_template_page_heading_2.json b/rangeldigital/fixtures/web_template_page_heading_2.json index ac70d01..702865f 100644 --- a/rangeldigital/fixtures/web_template_page_heading_2.json +++ b/rangeldigital/fixtures/web_template_page_heading_2.json @@ -3,7 +3,7 @@ "name": "Page Heading - 2", "module": "Website", "type": "Component", -"template":"

{{heading}}

{{sub_heading}}

{{lead_form_code}}
", +"template":"

{{heading}}

{{sub_heading}}

{% if lead_form_code %}{{lead_form_code}}{% endif %}{% if featured_image %}\"{{featured_image}}\"/{% endif %}
", "fields": [ { "fieldname": "heading", diff --git a/rangeldigital/public/css/rangeldigital.css b/rangeldigital/public/css/rangeldigital.css index fc42bd9..501c8f2 100644 --- a/rangeldigital/public/css/rangeldigital.css +++ b/rangeldigital/public/css/rangeldigital.css @@ -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} \ No newline at end of file +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} \ No newline at end of file