124 lines
4.2 KiB
PHP
124 lines
4.2 KiB
PHP
<div class="tab-pane fade" id="vehicle-docs-tab">
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div id="accordion" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h5 class="m-1">
|
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
|
aria-expanded="true">
|
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h5>
|
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
|
<div class="card-body">
|
|
<form class="parsley-examples" id="vehicle_file_upload_form" method="post"
|
|
enctype="multipart/form-data">
|
|
|
|
<input type="hidden" id="client_id_for_vehicle_file_upload" name="client_id">
|
|
<input type="hidden" id="vehicle_id_for_file_upload" name="vehicle_id">
|
|
|
|
<div class="form-group">
|
|
|
|
<div id="dynamic-form-container-for-vehicle-file-upload"></div>
|
|
|
|
<div class="form-group text-right m-b-0">
|
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
|
id="vehicle_file_upload_sbt_btn">Submit</button>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="collapseOne">
|
|
<div id="vehicle_file_table" class="card">
|
|
<div class="card-body">
|
|
<div class="row" style="padding-bottom: 10px;">
|
|
<div class="col-6" style="align-self: center;">
|
|
<h4 style="position: relative;">Vehicle File List</h4>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="table-responsive" style="overflow-x: auto;">
|
|
<table data-custom-table-css="second-table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th class="text-center">S.No </th>
|
|
<th>Docs Name </th>
|
|
<th>File Name </th>
|
|
<th>Action </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="vehicle_table_bd">
|
|
</tbody>
|
|
</table>
|
|
<div>
|
|
</div>
|
|
</div>
|
|
</div><!-- end col -->
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
$("#vehicle_file_upload_form").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var isValid = $('#vehicle_file_upload_form').parsley().validate();
|
|
if (!isValid) {
|
|
console.log('Form is Empty', 'Warning');
|
|
return ;
|
|
}
|
|
|
|
form_action = '<?= base_url("client/vehicle/create"); ?>';
|
|
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
var formData = new FormData($('#vehicle_file_upload_form')[0]);
|
|
|
|
$.ajax({
|
|
data:formData,
|
|
url: form_action,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(res) {
|
|
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
|
|
console.log(res);
|
|
|
|
if(res.status == true){
|
|
toastr.success(res.message, 'Success');
|
|
appendVehicleFileTableBody(res.vehicle_docs);
|
|
}else{
|
|
toastr.warning(res.message, 'Warning');
|
|
}
|
|
|
|
$('#vehicle_file_upload_form')[0].reset();
|
|
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|