csrtechnew.ohctech.in/upload_enquiry_excel.php
2025-04-14 13:28:09 +05:30

153 lines
5.7 KiB
PHP

<?php
include('techsyn_header.php');
error_reporting(E_ERROR | E_WARNING | E_PARSE);
?>
<!-- Main Content Container for sidebar 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'); ?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="active">Beneficiary Enquiry List</li>
<li class="active">Upload Excel</li>
</ul>
</div>
</div>
<div class="container">
<form action="" method="post" name="frmExcelImport" id="frmExcelImport" enctype="multipart/form-data">
<div class="panel panel-info" style="margin-top:50px">
<div class="panel-heading"><b>Upload Excel For Beneficiary Enquiry</b></div>
<div class="panel-body" style="height:300px">
<div class="form-group text-center">
<div class="col-xs-12">
<label for="id-input-file-2" class="custom-file-upload">
<input type="file" id="id-input-file-2" name="file" accept=".xls,.xlsx" required />
Choose Excel File
</label>
<span id="file-name" style="margin-left: 10px; font-weight: bold;"></span>
</div>
</div>
</div>
<div class="panel-footer text-center">
<button type="submit" name="import" value="1" id="submit" class="btn btn-xs btn-primary">
Upload
</button>
</div>
</div>
</form>
</div>
<?php include('techsyn_footer.php'); ?>
<style>
body {
font-family: Arial;
width: 100%;
}
.outer-container {
background: #F0F0F0;
border: #e0dfdf 1px solid;
padding: 40px 20px;
border-radius: 2px;
}
.custom-file-upload {
display: inline-block;
padding: 10px 20px;
cursor: pointer;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
transition: background-color 0.3s, border-color 0.3s;
color: #333;
}
.custom-file-upload:hover {
background-color: #e7e7e7;
border-color: #bbb;
}
input[type="file"] {
display: none; /* Hide the default file input */
}
.tutorial-table {
margin-top: 40px;
font-size: 0.8em;
border-collapse: collapse;
width: 100%;
}
.tutorial-table th {
background: #f0f0f0;
border-bottom: 1px solid #dddddd;
padding: 8px;
text-align: left;
}
.tutorial-table td {
background: #FFF;
border-bottom: 1px solid #dddddd;
padding: 8px;
text-align: left;
}
#response {
padding: 10px;
margin-top: 10px;
border-radius: 2px;
display: none;
}
.success {
background: #c7efd9;
border: #bbe2cd 1px solid;
}
.error {
background: #fbcfcf;
border: #f3c6c7 1px solid;
}
div#response.display-block {
display: block;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#id-input-file-2').on('change', function() {
// Get the file name
var fileName = $(this).val().split('\\').pop();
// Display the file name
$('#file-name').text(fileName);
});
$('#frmExcelImport').on('submit', function(event) {
event.preventDefault();
$.ajax({
url: "upload_excel_enquiry_script_interm.php",
method: "POST",
data: new FormData(this),
contentType: false,
processData: false,
dataType: 'json',
success: function(data) {
console.log(data);
if (data) {
// Redirect on success
window.location.href = 'upload_excel_enquery_inermed.php';
} else {
// Show error message if provided
BootstrapDialog.alert(data.message || 'Upload failed. Please try again.');
}
},
error: function() {
BootstrapDialog.alert('Data uploading failed');
}
});
});
});
</script>
</div>
</div>