135 lines
4.9 KiB
PHP
135 lines
4.9 KiB
PHP
<?php include('techsyn_header.php'); ?>
|
|
<!-- Main Content Container for side bar and body-->
|
|
<div class="main-container ace-save-state" id="main-container">
|
|
<script type="text/javascript">
|
|
try {
|
|
ace.settings.loadState('main-container')
|
|
} catch (e) {}
|
|
</script>
|
|
<?php include('techsyn_sidebar.php'); ?>
|
|
|
|
<!--breadcrumb-->
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
<li>
|
|
<i class="ace-icon fa fa-home home-icon"></i>
|
|
<a href="#">Enrollment</a>
|
|
</li>
|
|
<li class="active">Batch Enrollment</li>
|
|
</ul>
|
|
</div>
|
|
<div class="page-content">
|
|
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
|
|
<form id="procurement_form" method="post">
|
|
<!-- box-body-->
|
|
<div class="box-body">
|
|
<!-- Main Form -->
|
|
<form id="procurement_form" method="post" enctype="multipart/form-data">
|
|
<div class="box-body">
|
|
<div id="uploadDocs">
|
|
<div class="container" style="max-width: 800px; margin-top: 30px;">
|
|
<div class="form-group">
|
|
<label for="file">Upload File:</label>
|
|
<div class="row">
|
|
<label for="stage">Stage</label>
|
|
<div class="col-sm-3">
|
|
<select class="form-control" name="stage" id="stage">
|
|
<option value="disable">Please Select Option</option>
|
|
<option value="first_stage">First Stage</option>
|
|
<option value="first_stage">Second Stage</option>
|
|
<option value="third_stage">Third Stage</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>File</th>
|
|
<th>File Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><input type="file" class="form-control" name="userfile" id="file"></td>
|
|
<td><input type="text" class="form-control" name="file_name" id="file_name"></td>
|
|
<td><input type="text" class="form-control" name="file_desc" id="file_desc"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="text-center mt-4">
|
|
<button class="btn btn-primary" type="button" id="save_button">
|
|
<i class="ace-icon fa fa-save"></i> Save
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Placeholder for success/error messages -->
|
|
<div id="message"></div>
|
|
|
|
<!-- Table to display uploaded documents -->
|
|
<div id="uploaded_docs">
|
|
<!-- The content here will be updated dynamically by AJAX -->
|
|
</div>
|
|
|
|
|
|
</div></form></div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Load uploaded documents on page load
|
|
loadDocuments();
|
|
|
|
// Handle form submission via AJAX
|
|
$('#save_button').on('click', function() {
|
|
let formData = new FormData($('#procurement_form')[0]); // Get form data
|
|
formData.append('emp_id', <?php echo json_encode($_REQUEST['emp_id']); ?>);
|
|
|
|
$.ajax({
|
|
url: 'save_document.php', // Server-side script to handle saving
|
|
type: 'POST',
|
|
data: formData,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function(response) {
|
|
$('#message').html('<div class="alert alert-success">Document uploaded successfully.</div>');
|
|
loadDocuments(); // Reload the uploaded documents table
|
|
},
|
|
error: function() {
|
|
$('#message').html('<div class="alert alert-danger">Failed to upload document.</div>');
|
|
}
|
|
});
|
|
});
|
|
|
|
// Function to load uploaded documents
|
|
function loadDocuments() {
|
|
$.ajax({
|
|
url: 'get_documents.php',
|
|
type: 'GET',
|
|
data: { emp_id: <?php echo json_encode($_REQUEST['emp_id']); ?> },
|
|
success: function(data) {
|
|
$('#uploaded_docs').html(data);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
#modal-add-ailment {
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|