Merge branch 'feature/module_1' into development
This commit is contained in:
@@ -985,6 +985,17 @@ class AccountTransferCheckView(APIView):
|
||||
print("request.user is ", request.user)
|
||||
try:
|
||||
obj = IAmPrincipalExtendedData.objects.get(principal=request.user)
|
||||
except IAmPrincipalExtendedData.DoesNotExist:
|
||||
# Create a dummy serializer record
|
||||
obj = {
|
||||
'principal': request.user.id,
|
||||
'is_onboarded': False,
|
||||
'is_transferred': False,
|
||||
'transferred_on': None,
|
||||
'pwd_changed_post_transfer': False
|
||||
}
|
||||
return ApiResponse.success(message=constants.SUCCESS, data=obj)
|
||||
|
||||
except Exception as e:
|
||||
error_response = {
|
||||
"status": status.HTTP_404_NOT_FOUND,
|
||||
|
||||
@@ -370,7 +370,7 @@ class CreateCustomerForm(forms.Form):
|
||||
widget=forms.widgets.SelectMultiple(
|
||||
attrs={"class": "form_select js-example-basic-multiple"}
|
||||
),
|
||||
required=False,
|
||||
required=True,
|
||||
label='Preferences'
|
||||
)
|
||||
free_start_date = forms.DateField(
|
||||
@@ -397,7 +397,7 @@ class UpdateCustomerForm(forms.Form):
|
||||
widget=forms.widgets.SelectMultiple(
|
||||
attrs={"class": "form_select js-example-basic-multiple"}
|
||||
),
|
||||
required=False,
|
||||
required=True,
|
||||
label='Preferences'
|
||||
)
|
||||
free_start_date = forms.DateField(
|
||||
|
||||
@@ -610,9 +610,16 @@ class CustomerCreateView(LoginRequiredMixin, generic.View):
|
||||
print(request.POST)
|
||||
# return redirect(self.success_url)
|
||||
form = self.form_class(request.POST)
|
||||
context = self.get_context_data(form=form)
|
||||
if not form.is_valid():
|
||||
context = self.get_context_data(form=form)
|
||||
return render(request, self.template_name, context=context)
|
||||
|
||||
free_subscription = Subscription.objects.filter(is_free=True, active=True).first()
|
||||
|
||||
if not free_subscription:
|
||||
messages.error(self.request, "Create a free subscription record for admin in manage subscription")
|
||||
return render(request, self.template_name, context=context)
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
# save principal data
|
||||
@@ -647,7 +654,7 @@ class CustomerCreateView(LoginRequiredMixin, generic.View):
|
||||
principal=principal_obj,
|
||||
grace_period_end_date=PrincipalSubscription.generate_grace_period_end_date(form.cleaned_data.get("free_end_date")),
|
||||
is_paid=True,
|
||||
subscription=Subscription.objects.filter(is_free=True, active=True).first()
|
||||
subscription=free_subscription
|
||||
)
|
||||
|
||||
messages.success(self.request, constants.REGISTRATION_SUCCESS)
|
||||
@@ -968,6 +975,10 @@ class CustomerImportView(LoginRequiredMixin, generic.View):
|
||||
principal_type = IAmPrincipalType.objects.get(name=resource_action.PRINCIPAL_TYPE_EVENT_MANAGER)
|
||||
free_subscription = Subscription.objects.filter(is_free=True, active=True).first()
|
||||
|
||||
if not free_subscription:
|
||||
messages.error(self.request, "Create a free subscription record for admin in manage subscription")
|
||||
return render(request, self.template_name, context=context)
|
||||
|
||||
for idx, row in enumerate(ws.iter_rows(min_row=2, values_only=True), start=2):
|
||||
first_name, last_name, email, preferences, start_date, end_date = row
|
||||
print(f"{first_name}, {last_name, email, preferences, start_date, end_date}")
|
||||
|
||||
@@ -119,7 +119,7 @@ class SubscriptionView(LoginRequiredMixin, generic.ListView):
|
||||
context_object_name = "subscription_obj"
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset().filter(deleted=False, active=True)
|
||||
queryset = super().get_queryset().filter(deleted=False, active=True).prefetch_related("principal_types")
|
||||
return queryset.order_by("-created_on")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
@@ -43,7 +43,9 @@ mysqlclient==2.2.4
|
||||
numpy==1.26.4
|
||||
oauthlib==3.2.2
|
||||
onesignal-sdk==2.0.0
|
||||
openpyxl==3.1.4
|
||||
orjson==3.9.15
|
||||
pandas==2.2.2
|
||||
phonenumbers==8.13.30
|
||||
pillow==10.2.0
|
||||
pyasn1==0.5.1
|
||||
@@ -67,7 +69,7 @@ sqlparse==0.4.4
|
||||
stripe==8.2.0
|
||||
tqdm==4.66.2
|
||||
Twisted==23.10.0
|
||||
# twisted-iocpsupport==1.0.4
|
||||
twisted-iocpsupport==1.0.4
|
||||
txaio==23.1.1
|
||||
typing_extensions==4.9.0
|
||||
tzdata==2024.1
|
||||
|
||||
@@ -52,10 +52,6 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
// var f3 = flatpickr(document.getElementById('id_free_period'), {
|
||||
// mode: "range"
|
||||
// });
|
||||
|
||||
var start_date = flatpickr(document.getElementById('id_free_start_date'), {
|
||||
// minDate: "today",
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
@@ -70,7 +66,6 @@
|
||||
$('.js-example-basic-multiple').select2({
|
||||
placeholder: 'Select options',
|
||||
allowClear: true,
|
||||
tags: true, // Allow the user to enter custom tags
|
||||
tokenSeparators: [',', ' '], // Customize token separators
|
||||
closeOnSelect: false // Keep the dropdown open after selection
|
||||
});
|
||||
@@ -91,48 +86,34 @@
|
||||
return /^[a-zA-Z]/.test(value); // Check if the value starts with a letter
|
||||
}, "Please start with a letter.");
|
||||
|
||||
// Add custom validation method for greater than start date
|
||||
$.validator.addMethod("greaterThanStartDate", function(value, element) {
|
||||
var startDate = $('#id_free_start_date').val();
|
||||
if (!startDate || !value) {
|
||||
return true;
|
||||
}
|
||||
return new Date(value) > new Date(startDate);
|
||||
}, "The end date must be after the start date.");
|
||||
|
||||
|
||||
|
||||
$("#addCustomer").validate({
|
||||
rules: {
|
||||
first_name: {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
maxlength:15,
|
||||
noSpecialChars: true,
|
||||
startsWithLetter: true,
|
||||
noSpace: true
|
||||
},
|
||||
last_name: {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
maxlength: 15,
|
||||
noSpecialChars: true,
|
||||
startsWithLetter: true,
|
||||
noSpace: true
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
validEmail: true,
|
||||
// remote: {
|
||||
// url: "{% url 'accounts:customer_check_email' %}", // Replace with your actual URL for the view
|
||||
// type: "POST",
|
||||
// data: {
|
||||
// email: function() {
|
||||
// return $("#id_email").val();
|
||||
// }
|
||||
// },
|
||||
// beforeSend: function(xhr) {
|
||||
// xhr.setRequestHeader('X-CSRFToken', $('input[name="csrfmiddlewaretoken"]').val());
|
||||
// },
|
||||
// success: function(data) {
|
||||
// console.log(date)
|
||||
// // Handle successful email check (optional)
|
||||
// // You can remove this if you only need to display the error message
|
||||
// },
|
||||
// error: function(response) {
|
||||
// console.log(response)
|
||||
// }
|
||||
// },
|
||||
},
|
||||
preferences: {
|
||||
required: true,
|
||||
@@ -150,14 +131,12 @@
|
||||
messages: {
|
||||
first_name: {
|
||||
required: "Please enter your first name.",
|
||||
minlength: "First name must be at least 2 characters.",
|
||||
maxlength: "First name must not exceed 20 characters.",
|
||||
noSpecialChars: "Please enter only letters and spaces.",
|
||||
startsWithLetter: "First name must start with a letter."
|
||||
},
|
||||
last_name: {
|
||||
required: "Please enter your last name.",
|
||||
minlength: "Last name must be at least 2 characters.",
|
||||
maxlength: "First name must not exceed 20 characters.",
|
||||
noSpecialChars: "Please enter only letters and spaces.",
|
||||
startsWithLetter: "Last name must start with a letter."
|
||||
@@ -178,16 +157,6 @@
|
||||
greaterThanStartDate: "The end date must be after the start date."
|
||||
}
|
||||
},
|
||||
customMethods: {
|
||||
greaterThanStartDate: function(element) {
|
||||
var startDate = $("#id_free_start_date").datepicker("getDate"); // Assuming you're using datepicker
|
||||
var endDate = $(element).datepicker("getDate");
|
||||
if (!endDate || !startDate) {
|
||||
return true; // Allow if either date is not selected (prevents errors)
|
||||
}
|
||||
return endDate > startDate;
|
||||
}
|
||||
},
|
||||
errorElement: 'div',
|
||||
errorPlacement: function(error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
@@ -201,11 +170,27 @@
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
form.submit();
|
||||
// Check if form is valid before submission
|
||||
if ($(form).valid()) {
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger validation for select2 fields on change
|
||||
$('#id_preferences').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
|
||||
// Trigger validation for flatpickr fields on change
|
||||
$('#id_free_start_date').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
$('#id_free_end_date').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -61,10 +61,6 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
// var f3 = flatpickr(document.getElementById('id_free_period'), {
|
||||
// mode: "range"
|
||||
// });
|
||||
|
||||
var start_date = flatpickr(document.getElementById('id_free_start_date'), {
|
||||
// minDate: "today",
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
@@ -79,7 +75,6 @@
|
||||
$('.js-example-basic-multiple').select2({
|
||||
placeholder: 'Select options',
|
||||
allowClear: true,
|
||||
tags: true, // Allow the user to enter custom tags
|
||||
tokenSeparators: [',', ' '], // Customize token separators
|
||||
closeOnSelect: false // Keep the dropdown open after selection
|
||||
});
|
||||
@@ -94,54 +89,40 @@
|
||||
$.validator.addMethod("noSpecialChars", function(value, element) {
|
||||
return /^[a-zA-Z\s]*$/.test(value); // Allow only letters and whitespace
|
||||
}, "Please enter only letters and spaces.");
|
||||
|
||||
|
||||
// Add custom validation method to check for starting with a letter
|
||||
$.validator.addMethod("startsWithLetter", function(value, element) {
|
||||
return /^[a-zA-Z]/.test(value); // Check if the value starts with a letter
|
||||
}, "Please start with a letter.");
|
||||
|
||||
// Add custom validation method for greater than start date
|
||||
$.validator.addMethod("greaterThanStartDate", function(value, element) {
|
||||
var startDate = $('#id_free_start_date').val();
|
||||
if (!startDate || !value) {
|
||||
return true;
|
||||
}
|
||||
return new Date(value) > new Date(startDate);
|
||||
}, "The end date must be after the start date.");
|
||||
|
||||
|
||||
|
||||
$("#addCustomer").validate({
|
||||
rules: {
|
||||
first_name: {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
maxlength:15,
|
||||
noSpecialChars: true,
|
||||
startsWithLetter: true,
|
||||
noSpace: true
|
||||
},
|
||||
last_name: {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
maxlength: 15,
|
||||
noSpecialChars: true,
|
||||
startsWithLetter: true,
|
||||
noSpace: true
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
validEmail: true,
|
||||
// remote: {
|
||||
// url: "{% url 'accounts:customer_check_email' %}", // Replace with your actual URL for the view
|
||||
// type: "POST",
|
||||
// data: {
|
||||
// email: function() {
|
||||
// return $("#id_email").val();
|
||||
// }
|
||||
// },
|
||||
// beforeSend: function(xhr) {
|
||||
// xhr.setRequestHeader('X-CSRFToken', $('input[name="csrfmiddlewaretoken"]').val());
|
||||
// },
|
||||
// success: function(data) {
|
||||
// console.log(date)
|
||||
// // Handle successful email check (optional)
|
||||
// // You can remove this if you only need to display the error message
|
||||
// },
|
||||
// error: function(response) {
|
||||
// console.log(response)
|
||||
// }
|
||||
// },
|
||||
},
|
||||
preferences: {
|
||||
required: true,
|
||||
@@ -159,14 +140,12 @@
|
||||
messages: {
|
||||
first_name: {
|
||||
required: "Please enter your first name.",
|
||||
minlength: "First name must be at least 2 characters.",
|
||||
maxlength: "First name must not exceed 20 characters.",
|
||||
noSpecialChars: "Please enter only letters and spaces.",
|
||||
startsWithLetter: "First name must start with a letter."
|
||||
},
|
||||
last_name: {
|
||||
required: "Please enter your last name.",
|
||||
minlength: "Last name must be at least 2 characters.",
|
||||
maxlength: "First name must not exceed 20 characters.",
|
||||
noSpecialChars: "Please enter only letters and spaces.",
|
||||
startsWithLetter: "Last name must start with a letter."
|
||||
@@ -187,16 +166,6 @@
|
||||
greaterThanStartDate: "The end date must be after the start date."
|
||||
}
|
||||
},
|
||||
// customMethods: {
|
||||
// greaterThanStartDate: function(element) {
|
||||
// var startDate = $("#id_free_start_date").datepicker("getDate"); // Assuming you're using datepicker
|
||||
// var endDate = $(element).datepicker("getDate");
|
||||
// if (!endDate || !startDate) {
|
||||
// return true; // Allow if either date is not selected (prevents errors)
|
||||
// }
|
||||
// return endDate > startDate;
|
||||
// }
|
||||
// },
|
||||
errorElement: 'div',
|
||||
errorPlacement: function(error, element) {
|
||||
error.addClass('invalid-feedback');
|
||||
@@ -210,11 +179,27 @@
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
form.submit();
|
||||
// Check if form is valid before submission
|
||||
if ($(form).valid()) {
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger validation for select2 fields on change
|
||||
$('#id_preferences').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
|
||||
// Trigger validation for flatpickr fields on change
|
||||
$('#id_free_start_date').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
$('#id_free_end_date').on('change', function() {
|
||||
$(this).valid();
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
);
|
||||
return FilePond.create(document.getElementById(selector),{
|
||||
allowMultiple: allowMultiple,
|
||||
acceptedFileTypes: ['image/*'],
|
||||
storeAsFile: true,
|
||||
dropOnPage: true
|
||||
});
|
||||
@@ -198,6 +199,29 @@
|
||||
// Handle principal change
|
||||
handlePrincipalChange();
|
||||
|
||||
// Add custom validation method for greater than start date
|
||||
$.validator.addMethod("greaterThanStartDate", function(value, element) {
|
||||
var startDate = $('#id_free_start_date').val();
|
||||
if (!startDate || !value) {
|
||||
return true;
|
||||
}
|
||||
return new Date(value) > new Date(startDate);
|
||||
}, "The end date must be after the start date.");
|
||||
|
||||
$.validator.addMethod("greaterThanFromTime", function(value, element){
|
||||
var startDateVal = $("#id_start_date").val();
|
||||
var endDateVal = $("#id_end_date").val();
|
||||
var fromTime = $("#id_from_time").val();
|
||||
var toTime = $(element).val();
|
||||
if (!toTime || !fromTime) {
|
||||
return true; // Allow if either time is not selected (prevents errors)
|
||||
}
|
||||
if (startDateVal !== endDateVal) {
|
||||
return true
|
||||
}
|
||||
return toTime > fromTime;
|
||||
},"End time must be greater than start time on the same day")
|
||||
|
||||
// Initialize jQuery Validate
|
||||
$("#eventForm").validate({
|
||||
rules: {
|
||||
@@ -215,25 +239,23 @@
|
||||
},
|
||||
image: {
|
||||
required: true,
|
||||
accept: "image/*"
|
||||
},
|
||||
event_images: {
|
||||
required: true,
|
||||
accept: "image/*"
|
||||
},
|
||||
start_date: {
|
||||
required: true,
|
||||
date: true
|
||||
},
|
||||
end_date: {
|
||||
required: true,
|
||||
date: true
|
||||
greaterThanStartDate: true
|
||||
},
|
||||
from_time: {
|
||||
required: true
|
||||
},
|
||||
to_time: {
|
||||
required: true
|
||||
required: true,
|
||||
greaterThanFromTime: true
|
||||
},
|
||||
category:{
|
||||
required: true
|
||||
@@ -267,19 +289,15 @@
|
||||
},
|
||||
image: {
|
||||
required: "Please upload a thumbnail",
|
||||
accept: "Please upload a valid image file"
|
||||
},
|
||||
event_images: {
|
||||
required: "Please upload event images",
|
||||
accept: "Please upload valid image files"
|
||||
},
|
||||
start_date: {
|
||||
required: "Please select a start date",
|
||||
date: "Please enter a valid date"
|
||||
},
|
||||
end_date: {
|
||||
required: "Please select an end date",
|
||||
date: "Please enter a valid date",
|
||||
greaterThanStartDate: "The end date must be after or equal to the start date."
|
||||
},
|
||||
from_time: {
|
||||
@@ -302,30 +320,7 @@
|
||||
required: "Please select a age group"
|
||||
},
|
||||
tags: {
|
||||
required: "Please enter tags"
|
||||
}
|
||||
},
|
||||
customMethods: {
|
||||
greaterThanStartDate: function(element) {
|
||||
var startDate = $("#id_start_date").datepicker("getDate"); // Assuming you're using datepicker
|
||||
var endDate = $(element).datepicker("getDate");
|
||||
if (!endDate || !startDate) {
|
||||
return true; // Allow if either date is not selected (prevents errors)
|
||||
}
|
||||
return endDate >= startDate;
|
||||
},
|
||||
greaterThanFromTime: function(element){
|
||||
var startDateVal = $("#id_start_date").val();
|
||||
var endDateVal = $("#id_end_date").val();
|
||||
var fromTime = $("#id_from_time").val();
|
||||
var toTime = $(element).val();
|
||||
if (!toTime || !fromTime) {
|
||||
return true; // Allow if either time is not selected (prevents errors)
|
||||
}
|
||||
if (startDateVal !== endDateVal) {
|
||||
return true
|
||||
}
|
||||
return toTime > fromTime;
|
||||
required: "Please enter tags"
|
||||
}
|
||||
},
|
||||
errorElement: "div",
|
||||
@@ -344,7 +339,6 @@
|
||||
$(element).addClass("is-valid").removeClass("is-invalid");
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
|
||||
// Disable the submit button to prevent multiple submissions
|
||||
$('button[type="submit"]').prop('disabled', true);
|
||||
form.submit();
|
||||
|
||||
@@ -50,9 +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"
|
||||
<th class="checkbox-column sorting_asc" tabindex="0"
|
||||
aria-controls="style-3" aria-sort="ascending"
|
||||
style="width: 69.2656px;"> Customer Type</th> {% endcomment %}
|
||||
style="width: 69.2656px;"> Customer Type</th>
|
||||
<th class="checkbox-column sorting_asc" tabindex="0"
|
||||
aria-controls="style-3" aria-sort="ascending"
|
||||
style="width: 69.2656px;"> Free for Admin </th>
|
||||
@@ -70,7 +70,15 @@
|
||||
<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>
|
||||
{% if data_obj.principal_types.all %}
|
||||
{% for data in data_obj.principal_types.all %}
|
||||
<span class="badge badge-primary">{{ data.name }}</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<span class="badge badge-danger">No user type</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<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>
|
||||
|
||||
@@ -67,13 +67,29 @@
|
||||
|
||||
|
||||
<script>
|
||||
// Function to initialize FilePond
|
||||
function initializeFilePond(selector, allowMultiple = false) {
|
||||
FilePond.registerPlugin(
|
||||
FilePondPluginImagePreview,
|
||||
FilePondPluginImageExifOrientation,
|
||||
FilePondPluginFileValidateSize
|
||||
);
|
||||
return FilePond.create(document.getElementById(selector),{
|
||||
allowMultiple: allowMultiple,
|
||||
acceptedFileTypes: ['image/*'],
|
||||
storeAsFile: true,
|
||||
dropOnPage: true
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
// initialize filepond
|
||||
var image = initializeFilePond('id_image');
|
||||
var image = "#id_image"
|
||||
var pond = initializeFilePond('id_image');
|
||||
pond.required = true;
|
||||
var imageUrl = "{% if form.image.value %}{{ form.image.value.url }}{% endif %}";
|
||||
if (imageUrl){
|
||||
image.addFile(imageUrl)
|
||||
pond.addFile(imageUrl)
|
||||
}
|
||||
|
||||
// Validate the form
|
||||
@@ -90,7 +106,6 @@
|
||||
},
|
||||
image: {
|
||||
required: true,
|
||||
accept: "image/*"
|
||||
},
|
||||
latitude: {
|
||||
required: true,
|
||||
@@ -112,8 +127,7 @@
|
||||
required: "Please enter an address"
|
||||
},
|
||||
image: {
|
||||
required: "Please upload an image",
|
||||
accept: "Please upload a valid image file"
|
||||
required: "Please upload an image"
|
||||
},
|
||||
latitude: {
|
||||
required: "Please enter a latitude",
|
||||
@@ -145,21 +159,23 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger validation for FilePond field on file change
|
||||
pond.on("addfile", function(error, file){
|
||||
if (error){
|
||||
$(image).addClass("is_invalid").removeClass("is-valid");
|
||||
}else {
|
||||
$(image).removeClass("is_invalid").addClass('is_valid');
|
||||
}
|
||||
$("#venueForm").validate().element(image)
|
||||
})
|
||||
pond.on('removefile', function(error, file) {
|
||||
$(image).addClass('is-invalid').removeClass('is-valid');
|
||||
$('#venueForm').validate().element(image);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// Function to initialize FilePond
|
||||
function initializeFilePond(selector, allowMultiple = false) {
|
||||
FilePond.registerPlugin(
|
||||
FilePondPluginImagePreview,
|
||||
FilePondPluginImageExifOrientation,
|
||||
FilePondPluginFileValidateSize
|
||||
);
|
||||
return FilePond.create(document.getElementById(selector),{
|
||||
allowMultiple: allowMultiple,
|
||||
storeAsFile: true,
|
||||
dropOnPage: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user