TEAM 4 (ARDC Poster Execution) Old Script
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m22s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m22s
Details
This commit is contained in:
parent
54a81a3c0a
commit
d5c4ade30b
|
|
@ -192,7 +192,7 @@
|
||||||
@include('layouts.shared/footer-script')
|
@include('layouts.shared/footer-script')
|
||||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||||
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
||||||
{{-- <script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function($){
|
jQuery(document).ready(function($){
|
||||||
$('[data-toggle="select2"]').select2();
|
$('[data-toggle="select2"]').select2();
|
||||||
$('#field-user_id').change(function(){
|
$('#field-user_id').change(function(){
|
||||||
|
|
@ -328,163 +328,9 @@
|
||||||
plandateField.setAttribute("min","2026-10-01");
|
plandateField.setAttribute("min","2026-10-01");
|
||||||
plandateField.setAttribute('max', today);
|
plandateField.setAttribute('max', today);
|
||||||
});
|
});
|
||||||
</script> --}}
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
jQuery(document).ready(function($){
|
|
||||||
// 1. Select2 initialize करा
|
|
||||||
$('[data-toggle="select2"]').select2();
|
|
||||||
|
|
||||||
|
|
||||||
let savedContactId = "{{ $questions->firstWhere('code', 'contact_id')->value ?? '' }}";
|
|
||||||
|
|
||||||
// 2. User ID Change Event
|
|
||||||
$('#field-user_id').on('change', function(){
|
|
||||||
let selectedOption = $('option:selected', this);
|
|
||||||
let tmname = selectedOption.text().trim();
|
|
||||||
$('input[name="tm_name"]').val(tmname);
|
|
||||||
|
|
||||||
let hierarchy = selectedOption.attr('hierarchy');
|
|
||||||
$('#field-hierarchy_id').val(hierarchy);
|
|
||||||
|
|
||||||
|
|
||||||
if (!hierarchy) {
|
|
||||||
$('#field-contact_id').html('<option value=""> -- Select -- </option>').trigger('change');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#pageloader").fadeIn();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: '/form/getdoctorlist?partition={{$form->partition ?? ""}}&hierarchy=' + hierarchy,
|
|
||||||
success: function( data ) {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
|
|
||||||
let contactSelect = $('#field-contact_id');
|
|
||||||
contactSelect.empty();
|
|
||||||
contactSelect.append($("<option></option>").attr("value", '').text('-- Select --'));
|
|
||||||
|
|
||||||
if(Array.isArray(data)) {
|
|
||||||
data.forEach(function(itm) {
|
|
||||||
if(itm.contact && itm.contact.ardc_camps_ardc_poster_execution_dr_tagging &&
|
|
||||||
itm.contact.ardc_camps_ardc_poster_execution_dr_tagging.toLowerCase() === 'yes') {
|
|
||||||
|
|
||||||
let isSelected = (savedContactId && savedContactId == itm.value) ? true : false;
|
|
||||||
|
|
||||||
let opt = $("<option></option>")
|
|
||||||
.attr("msl_code", itm.contact.legacy_code || '')
|
|
||||||
.attr("speciality", itm.contact.speciality || '')
|
|
||||||
.attr("value", itm.value)
|
|
||||||
.text(itm.display);
|
|
||||||
|
|
||||||
if(isSelected) {
|
|
||||||
opt.prop('selected', true);
|
|
||||||
}
|
|
||||||
contactSelect.append(opt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
contactSelect.trigger('change');
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#field-contact_id').on('change', function() {
|
|
||||||
let selected = $('option:selected', this);
|
|
||||||
let mslCode = selected.attr('msl_code') || '';
|
|
||||||
let speciality = selected.attr('speciality') || '';
|
|
||||||
|
|
||||||
$('#field-msl_code').val(mslCode);
|
|
||||||
$('#field-speciality').val(speciality);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#field-msl_code, #field-speciality').attr('readonly', true);
|
|
||||||
|
|
||||||
|
|
||||||
if ($('#field-user_id').length) {
|
|
||||||
$('#field-user_id').trigger('change');
|
|
||||||
}
|
|
||||||
|
|
||||||
// File validation
|
|
||||||
$('#field-file_upload').on('change', function () {
|
|
||||||
let file = this.files[0];
|
|
||||||
if (file) {
|
|
||||||
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
|
||||||
let maxSize = 10 * 1024 * 1024; // 10 MB
|
|
||||||
|
|
||||||
if (!allowedTypes.includes(file.type)) {
|
|
||||||
alert('Only PNG, JPG, and JPEG files are allowed.');
|
|
||||||
$(this).val('');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (file.size > maxSize) {
|
|
||||||
alert('File size should not exceed 10 MB.');
|
|
||||||
$(this).val('');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#field-city, #field-state, #field-departmental_head_name').on('input', function () {
|
|
||||||
this.value = this.value.replace(/[^a-zA-Z\s]/g, '');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Form Submit
|
|
||||||
$('#report-form').on('submit', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
$("#pageloader").fadeIn();
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: '/form/ajaxsubmit',
|
|
||||||
data: new FormData(this),
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function( data ) {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
if(data.status == 'success') {
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Great!',
|
|
||||||
text: 'Your data is successfully submitted!',
|
|
||||||
icon: 'success'
|
|
||||||
}).then(() => {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
$('#report-form').trigger("reset");
|
|
||||||
} else {
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'error',
|
|
||||||
title: 'Data not submitted',
|
|
||||||
text: 'Something went wrong, please try again after some time!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Date restriction
|
|
||||||
var today = new Date();
|
|
||||||
var dd = String(today.getDate()).padStart(2, '0');
|
|
||||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
|
||||||
var yyyy = today.getFullYear();
|
|
||||||
today = yyyy + '-' + mm + '-' + dd;
|
|
||||||
|
|
||||||
var plandateField = document.getElementById('field-record_date');
|
|
||||||
if(plandateField) {
|
|
||||||
plandateField.setAttribute("min","2026-10-01");
|
|
||||||
plandateField.setAttribute('max', today);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue