186 lines
5.7 KiB
PHP
186 lines
5.7 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-->
|
|
<?php
|
|
$current_month = date('m');
|
|
$current_year = date('Y');
|
|
$current_day = date('d');
|
|
?>
|
|
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
<li class="active">Indent</li>
|
|
<li class="active">Bulk Indent Upload</li>
|
|
</ul>
|
|
<!-- End of breadcrumb -->
|
|
</div>
|
|
<div class="page-content">
|
|
<div id="flexigridDiv" class="table-responsiv">
|
|
<h4 style="font-size: 15px; text-align: center; font-weight: bold">Bulk Indent Upload</h4>
|
|
|
|
|
|
|
|
<div class="container">
|
|
<form action="" method="post" name="upload_indent_form" id="upload_indent_form" enctype="multipart/form-data">
|
|
<div class="panel panel-info" id="upload_indent">
|
|
<div class="panel-heading"><b>Upload Excel For Indent</b></div>
|
|
<div class="panel-body" style="height:300px">
|
|
<div class="form-group">
|
|
<div class="col-xs-3"></div>
|
|
<div class="col-xs-6">
|
|
<input type="file" id="id-input-file-2" name="file" accept=".xls,.xlsx" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="panel-footer">
|
|
<button type="submit" name="import" value="1" id="submit" class="btn btn-xs btn-primary">
|
|
Upload
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<style>
|
|
.outer-container {
|
|
background: #F0F0F0;
|
|
border: #e0dfdf 1px solid;
|
|
padding: 40px 20px;
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.btn-submit {
|
|
background: #333;
|
|
border: #1d1d1d 1px solid;
|
|
border-radius: 2px;
|
|
color: #f0f0f0;
|
|
cursor: pointer;
|
|
padding: 5px 20px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.input-group-addon {
|
|
height: 25px;
|
|
width: 30px;
|
|
padding: 0px 0px;
|
|
}
|
|
</style>
|
|
<script>
|
|
function download_indent_template() {
|
|
document.forms['indent_link_form'].target = '_blank';
|
|
document.forms['indent_link_form'].action = "indent_template_excel.php";
|
|
document.forms['indent_link_form'].method = 'POST';
|
|
document.forms['indent_link_form'].submit();
|
|
}
|
|
|
|
function show_link(repID) {
|
|
if (repID === 'indent_report') {
|
|
$("#indent_link").show();
|
|
} else {
|
|
$("#indent_link").hide();
|
|
}
|
|
|
|
if (repID === 'upload_indent') {
|
|
$("#upload_indent").show();
|
|
} else {
|
|
$("#upload_indent").hide();
|
|
}
|
|
}
|
|
$('#upload_indent_form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
|
|
// Show loading
|
|
var submitBtn = $(this).find('button[type="submit"]');
|
|
var originalText = submitBtn.html();
|
|
submitBtn.html('<i class="fa fa-spinner fa-spin"></i> Uploading...').prop('disabled', true);
|
|
|
|
$.ajax({
|
|
url: "upload_indent_detail_interm_script.php",
|
|
method: "POST",
|
|
data: new FormData(this),
|
|
contentType: false,
|
|
processData: false,
|
|
dataType: 'text', // Explicitly set dataType
|
|
success: function(data) {
|
|
console.log("Raw response:", data);
|
|
|
|
// Trim the response
|
|
data = data.trim();
|
|
|
|
if (data && data !== 'error' && !isNaN(data)) {
|
|
BootstrapDialog.alert('Upload successful! Redirecting...');
|
|
window.location = "show_temp_indent_upload_data.php?indent_interm_id=" + data;
|
|
} else {
|
|
console.error("Upload failed. Response:", data);
|
|
BootstrapDialog.alert('Failed to upload data. Error: ' + data);
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error("AJAX Error:", status, error);
|
|
BootstrapDialog.alert('AJAX Error: ' + error);
|
|
},
|
|
complete: function() {
|
|
// Reset button
|
|
submitBtn.html(originalText).prop('disabled', false);
|
|
}
|
|
});
|
|
});
|
|
</script>
|