+
diff --git a/templates/base.html b/templates/base.html
index e15b4828..59650eb1 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -66,7 +66,7 @@
rel="stylesheet"
id="user-style-default">
{% endif %}
-
+
{% comment %} {% endcomment %}
@@ -83,9 +83,9 @@
{% block period_navigation %}
{% endblock period_navigation %}
-
- {% endblock %}
+ });
+ const data = await response.json();
+
+ data.forEach((trim) => {
+ const option = document.createElement("option");
+ option.value = trim.id_car_trim;
+ option.textContent = document.documentElement.lang === "en" ? trim.name : trim.name;
+ elements.trimSelect.appendChild(option);
+ });
+
+ if (elements.showSpecificationButton) {
+ elements.showSpecificationButton.disabled = !elements.trimSelect.value;
+ }
+}
+
+async function loadEquipment(trimId, elements) {
+ if (!elements?.equipmentSelect) return;
+
+ resetDropdown(elements.equipmentSelect, '{% trans "Select" %}');
+ if (elements.optionsContent) elements.optionsContent.innerHTML = "";
+
+ const response = await fetch(`${ajaxUrl}?action=get_equipments&trim_id=${trimId}`, {
+ headers: {
+ 'X-Requested-With': 'XMLHttpRequest',
+ 'X-CSRFToken': csrfToken
+ }
+ });
+ const data = await response.json();
+
+ data.forEach((equipment) => {
+ const option = document.createElement('option');
+ option.value = equipment.id_car_equipment;
+ option.textContent = equipment.name;
+ elements.equipmentSelect.appendChild(option);
+ });
+}
+
+async function loadSpecifications(trimId, elements) {
+ if (!elements?.specificationsContent) return;
+
+ elements.specificationsContent.innerHTML = "";
+ const response = await fetch(`${ajaxUrl}?action=get_specifications&trim_id=${trimId}`, {
+ headers: {
+ "X-Requested-With": "XMLHttpRequest",
+ "X-CSRFToken": csrfToken,
+ },
+ });
+ const data = await response.json();
+
+ data.forEach((spec) => {
+ const parentDiv = document.createElement("div");
+ parentDiv.innerHTML = `${spec.parent_name}`;
+ spec.specifications.forEach((s) => {
+ const specDiv = document.createElement("div");
+ specDiv.innerHTML = `• ${s.s_name}: ${s.s_value} ${s.s_unit}`;
+ parentDiv.appendChild(specDiv);
+ });
+ elements.specificationsContent.appendChild(parentDiv);
+ });
+}
+
+async function loadOptions(equipmentId, elements) {
+ if (!elements?.optionsContent) return;
+
+ elements.optionsContent.innerHTML = "";
+ const response = await fetch(`${ajaxUrl}?action=get_options&equipment_id=${equipmentId}`, {
+ headers: {
+ "X-Requested-With": "XMLHttpRequest",
+ "X-CSRFToken": csrfToken,
+ },
+ });
+ const data = await response.json();
+
+ data.forEach((parent) => {
+ const parentDiv = document.createElement("div");
+ parentDiv.innerHTML = `${parent.parent_name}`;
+ parent.options.forEach((option) => {
+ const optDiv = document.createElement("div");
+ optDiv.innerHTML = `• ${option.option_name}`;
+ parentDiv.appendChild(optDiv);
+ });
+ elements.optionsContent.appendChild(parentDiv);
+ });
+}
+
+// UI Helper functions
+function showLoading() {
+ Swal.fire({
+ title: "{% trans 'Please Wait' %}",
+ text: "{% trans 'Loading' %}...",
+ allowOutsideClick: false,
+ didOpen: () => {
+ Swal.showLoading();
+ },
+ });
+}
+
+function hideLoading() {
+ Swal.close();
+}
+
+function notify(tag, msg) {
+ Swal.fire({
+ icon: tag,
+ titleText: msg,
+ });
+}
+
+{% endblock customJS %}
\ No newline at end of file
- {% comment %}
+
- {% endcomment %}
+
{% block customCSS %}{% endblock %}
{% block content %}{% endblock content %}
{% block customJS %}{% endblock %}
@@ -154,7 +154,38 @@
document.getElementById('global-indicator')
];
});*/
-
+ let Toast = Swal.mixin({
+ toast: true,
+ position: "top-end",
+ showConfirmButton: false,
+ timer: 3000,
+ timerProgressBar: true,
+ didOpen: (toast) => {
+ toast.onmouseenter = Swal.stopTimer;
+ toast.onmouseleave = Swal.resumeTimer;
+ }
+ });
+ function notify(tag, msg) {
+ Toast.fire({
+ icon: tag,
+ titleText: msg
+ });
+ }
+document.addEventListener('htmx:afterRequest', function(evt) {
+ if(evt.detail.xhr.status == 403){
+ /* Notify the user of a 404 Not Found response */
+ notify("error", "You do not have permission to view this page");
+ }
+ if(evt.detail.xhr.status == 404){
+ /* Notify the user of a 404 Not Found response */
+ return alert("Error: Could Not Find Resource");
+ }
+ if (evt.detail.successful != true) {
+ console.log(evt)
+ /* Notify of an unexpected error, & print error to console */
+ notify("error", "Unexpected Error");
+ }
+});
{% comment %} {% block customJS %}{% endblock %} {% endcomment %}
diff --git a/templates/crm/leads/lead_detail.html b/templates/crm/leads/lead_detail.html
index 60b15496..9c93fecb 100644
--- a/templates/crm/leads/lead_detail.html
+++ b/templates/crm/leads/lead_detail.html
@@ -494,7 +494,8 @@
data-url="{% url 'update_note' request.dealer.slug note.pk %}"
data-bs-toggle="modal"
data-bs-target="#noteModal"
- data-note-title="{{ _("Update") }}">
+ data-note-title="{{ _('Update') }}">
+
{{ _("Update") }}