@@ -141,16 +141,21 @@ class VenueForm(forms.ModelForm):
|
||||
label="Non-transfer user list",
|
||||
required=True
|
||||
)
|
||||
image = forms.ImageField(required=True)
|
||||
latitude = forms.DecimalField(
|
||||
widget=forms.NumberInput()
|
||||
)
|
||||
longitude = forms.DecimalField(
|
||||
widget=forms.NumberInput()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Venue
|
||||
fields = [
|
||||
"principal",
|
||||
"title",
|
||||
# "description",
|
||||
"address",
|
||||
"image",
|
||||
# "url",
|
||||
"latitude",
|
||||
"longitude",
|
||||
]
|
||||
|
||||
@@ -521,7 +521,7 @@ class CustomerVenueFilterView(LoginRequiredMixin, generic.View):
|
||||
pk = request.GET.get("pk", None)
|
||||
if not pk:
|
||||
return JsonResponseUtil.error(message="Non transfer user list field is required")
|
||||
obj = self.model.objects.filter(principal=pk)
|
||||
obj = self.model.objects.filter(principal=pk, active=True)
|
||||
if not obj.exists():
|
||||
return JsonResponseUtil.error(message="No venue found for the given user.")
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class SubscriptionCreateOrUpdateView(LoginRequiredMixin, generic.View):
|
||||
|
||||
# This code ensures that only one free plan can be created by checking for existing free plans before saving a new one.
|
||||
if form.cleaned_data.get("is_free"):
|
||||
if self.model.objects.filter(Q(is_free=True) & Q(active=True)).exists:
|
||||
if self.model.objects.filter(Q(is_free=True) & Q(active=True)).exists():
|
||||
messages.error(self.request, "A free plan is already available. Please deactivate the existing one before creating a new one.")
|
||||
context = self.get_context_data(form=form)
|
||||
return render(request, self.template_name, context=context)
|
||||
|
||||
@@ -61,13 +61,13 @@
|
||||
<div class="col-md-3">End Date</div>
|
||||
<div class="col-md-9">{% if principal_subscription %}{{ principal_subscription.end_date }}{% else %}No subscription found{% endif %}</div>
|
||||
</div>
|
||||
{% if principal_obj.extended_data and not principal_obj.extended_data.transferred and principal_obj.extended_data.onboarded and principal_obj.principal_type.name == 'event_manager' %}
|
||||
<div class="col text-end">
|
||||
<a class="btn btn-dark mb-2 me-4" href="{% url 'accounts:customer_transfer' principal_obj.id %}">
|
||||
Transfer Account
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if principal_obj.extended_data and not principal_obj.extended_data.is_transferred and principal_obj.extended_data.is_onboarded and principal_obj.principal_type.name == 'event_manager' %}
|
||||
<div class="col text-end">
|
||||
<a class="btn btn-dark mb-2 me-4" href="{% url 'accounts:customer_transfer' principal_obj.id %}">
|
||||
Transfer Account
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if principal_obj.extended_data and not principal_obj.extended_data.transferred and principal_obj.extended_data.onboarded and principal_obj.principal_type.name == 'event_manager' %}
|
||||
{% if principal_obj.extended_data and not principal_obj.extended_data.is_transferred and principal_obj.extended_data.is_onboarded and principal_obj.principal_type.name == 'event_manager' %}
|
||||
<div class="col text-end">
|
||||
<a class="btn btn-dark mb-2 me-4" href="{% url 'accounts:customer_transfer' principal_obj.id %}">
|
||||
Transfer Account
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</a>
|
||||
|
||||
<a class="btn btn-dark mb-2 me-md-4" href="{% url 'accounts:import_customer_data' %}">
|
||||
import
|
||||
Import
|
||||
</a>
|
||||
|
||||
<a class="btn btn-dark mb-2 me-md-4" href="{% url 'accounts:export_customer_data' %}">
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
{% include "cdn_through_html/filepond_cdn_css.html" %}
|
||||
{% include "cdn_through_html/flatpicker_cdn_css.html" %}
|
||||
{% include "cdn_through_html/quill_cdn_css.html" %}
|
||||
{% include "cdn_through_html/tagify_cdn_css.html" %}
|
||||
{% include "cdn_through_html/sweetalert2_cdn_css.html" %}
|
||||
{{form.media}}
|
||||
@@ -60,20 +59,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
// Function to initialize Quill editor
|
||||
function initializeQuillEditor(selector, placeholder) {
|
||||
return new Quill(selector, {
|
||||
modules: {
|
||||
toolbar: [
|
||||
[{ header: [1, 2, false] }],
|
||||
['bold', 'italic', 'underline'],
|
||||
['image', 'code-block']
|
||||
]
|
||||
},
|
||||
placeholder: placeholder,
|
||||
theme: 'snow' // or 'bubble'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Function to initialize FilePond
|
||||
function initializeFilePond(selector, allowMultiple = false) {
|
||||
@@ -106,13 +92,13 @@
|
||||
function handlePrincipalChange() {
|
||||
$("#id_principal").change(function(){
|
||||
var selectedPrincipalId = $(this).val();
|
||||
|
||||
// clear existing venue options
|
||||
|
||||
// Clear existing venue options
|
||||
$("#id_venue").empty().append($("<option value='' selected=''>---------</option>"));
|
||||
|
||||
if (selectedPrincipalId){
|
||||
|
||||
if (selectedPrincipalId) {
|
||||
$.ajax({
|
||||
url: "{% url 'manage_events:venue_customer_filter'%}",
|
||||
url: "{% url 'manage_events:venue_customer_filter' %}",
|
||||
type: "GET",
|
||||
data: { pk: selectedPrincipalId },
|
||||
success: function(data) {
|
||||
@@ -120,6 +106,12 @@
|
||||
$.each(data.data, function(index, venue) {
|
||||
$("#id_venue").append($("<option></option>").val(venue.id).text(venue.title));
|
||||
});
|
||||
|
||||
// Preselect the venue if a value is already selected
|
||||
var selectedVenueId = $("#id_venue").data('selected-venue');
|
||||
if (selectedVenueId) {
|
||||
$("#id_venue").val(selectedVenueId);
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
console.error("Error fetching venue data:", textStatus, errorThrown);
|
||||
@@ -134,14 +126,22 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Store the selected venue data
|
||||
var selectedVenueId = "{{ form.venue.value }}";
|
||||
$("#id_venue").data('selected-venue', selectedVenueId);
|
||||
|
||||
// Trigger change event if a principal value is already selected
|
||||
var selectedPrincipalId = $("#id_principal").val();
|
||||
if (selectedPrincipalId) {
|
||||
$("#id_principal").trigger("change");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Set multiple attribute for event images
|
||||
document.getElementById('id_event_images').setAttribute('multiple', '');
|
||||
|
||||
// Initialize Quill editor
|
||||
var quill = initializeQuillEditor('#description', 'Write description...');
|
||||
|
||||
// Initialize FilePond
|
||||
var thumbnail = initializeFilePond('id_image');
|
||||
@@ -347,8 +347,7 @@
|
||||
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
event.prevent()
|
||||
//form.submit();
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<th class="checkbox-column sorting_asc" tabindex="0"
|
||||
aria-controls="style-3" aria-sort="ascending"
|
||||
style="width: 69.2656px;"> Amount </th>
|
||||
{% comment %} <th class="checkbox-column sorting_asc" tabindex="0"
|
||||
aria-controls="style-3" aria-sort="ascending"
|
||||
style="width: 69.2656px;"> Customer Type</th> {% endcomment %}
|
||||
<th class="checkbox-column sorting_asc" tabindex="0"
|
||||
aria-controls="style-3" aria-sort="ascending"
|
||||
style="width: 69.2656px;"> Free for Admin </th>
|
||||
@@ -67,6 +70,8 @@
|
||||
<td>{{data_obj.title}}</td>
|
||||
<td>{{data_obj.plan.days}}</td>
|
||||
<td>{{data_obj.amount}}</td>
|
||||
{% comment %} <td>{{data_obj.principal_types.name}}</td> {% endcomment %}
|
||||
|
||||
<td class="text-center">
|
||||
<span class="shadow-none badge {% if data_obj.is_free %}badge-primary{% else %}badge-danger{% endif %}">{{data_obj.is_free}}</span>
|
||||
</td>
|
||||
@@ -86,8 +91,9 @@
|
||||
<path
|
||||
d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z">
|
||||
</path>
|
||||
</svg></a></li>
|
||||
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
{% block stylesheet %}
|
||||
<!-- include required css cdn link through html here -->
|
||||
|
||||
<style>
|
||||
/* Inline CSS for removing number input spinners */
|
||||
input[type="number"]::-webkit-outer-spin-button,
|
||||
input[type="number"]::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% include "cdn_through_html/filepond_cdn_css.html" %}
|
||||
{{form.media}}
|
||||
|
||||
@@ -47,14 +60,9 @@
|
||||
|
||||
{% block javascript %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- include required css cdn link through html here -->
|
||||
|
||||
{% include "cdn_through_html/filepond_cdn_js.html" %}
|
||||
|
||||
{% include "cdn_through_html/jquery_validate_cdn_js.html" %}
|
||||
|
||||
|
||||
@@ -76,7 +84,6 @@
|
||||
},
|
||||
title: {
|
||||
required: true,
|
||||
noSpace: true
|
||||
},
|
||||
address: {
|
||||
required: true
|
||||
|
||||
Reference in New Issue
Block a user