finished igr file upload issue
This commit is contained in:
parent
cbe976d73a
commit
0d1d94ecf5
@ -708,6 +708,7 @@ function viewIGRDetails()
|
||||
|
||||
function UpdateIGR()
|
||||
{
|
||||
|
||||
$IGRNo = $this->request->getPost('igr');
|
||||
$PONo = $this->request->getPost('po');
|
||||
|
||||
@ -754,12 +755,13 @@ function viewIGRDetails()
|
||||
$fileupdated_count = 0;
|
||||
$fileupdated_name = [];
|
||||
|
||||
$fileNames = $this->request->getPost('file_name');
|
||||
$files = $this->request->getFiles();
|
||||
$fileNames = $this->request->getPost('file_name');
|
||||
$files = $this->request->getFileMultiple('emp_file');
|
||||
|
||||
if(isset($files['emp_file']))
|
||||
|
||||
if(isset($files))
|
||||
{
|
||||
foreach ($files['emp_file'] as $index => $file) {
|
||||
foreach ($files as $index => $file) {
|
||||
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
|
||||
@ -768,10 +770,10 @@ function viewIGRDetails()
|
||||
$newName = $file->getRandomName();
|
||||
$file->move($path, $newName);
|
||||
// Store the file information in the database
|
||||
$additionalFiles = array(
|
||||
'Remarks' => $finallyfilename,
|
||||
'FilePath' => $newName,
|
||||
'IGRNO' => $IGRNo,
|
||||
$additionalFiles = array(
|
||||
'Remarks' => $finallyfilename,
|
||||
'FilePath' => $newName,
|
||||
'IGRNO' => $IGRNo,
|
||||
'PONO' => $PONo
|
||||
);
|
||||
$lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles);
|
||||
@ -779,7 +781,7 @@ function viewIGRDetails()
|
||||
$fileupdated_count++;
|
||||
$fileupdated_name[] = $finallyfilename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -241,9 +241,17 @@
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
</div>
|
||||
<div class="form-row text-right">
|
||||
<div class="form-row text-left">
|
||||
<div class="form-group col-md-12">
|
||||
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); "><br>
|
||||
<br>
|
||||
<div class="form-group col-md-12">
|
||||
<label> Master IGR file</label>
|
||||
<br>
|
||||
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); ">
|
||||
<label id="MasterFileLabel" style="display:none;">
|
||||
<a><span></span><small></small></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -840,16 +848,16 @@
|
||||
<script>
|
||||
function appendFilesFileds(data) {
|
||||
var newRowHtml = `
|
||||
<div class="form-row pad">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-row pad mt-2">
|
||||
<div class=" col-md-4">
|
||||
<label class="col-form-label">File name</label>
|
||||
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<div class=" col-md-4">
|
||||
<label class="col-form-label">File</label>
|
||||
<input type="file" name="emp_file[]" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-md-4 p-4">
|
||||
<div class=" col-md-4" style="margin-top: 40px;">
|
||||
<button type="button" class="btn btn-danger waves-effect btn-sm" onclick="removeContact(this)">Remove</button>
|
||||
<button type="button" class="btn btn-primary waves-effect btn-sm a1" onclick="appendFilesFileds()">Add</button>
|
||||
</div>
|
||||
|
||||
@ -1029,16 +1029,21 @@
|
||||
formData.append('tableData', JSON.stringify(tableData));
|
||||
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
|
||||
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
||||
formData.append('file_name[]', $('#file_name').val());
|
||||
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
|
||||
if (empFiles) {
|
||||
|
||||
$('input[name="file_name[]"]').each(function() {
|
||||
formData.append('file_name[]', $(this).val());
|
||||
});
|
||||
|
||||
$('input[name="emp_file[]"]').each(function() {
|
||||
var empFiles = this.files;
|
||||
for (var i = 0; i < empFiles.length; i++) {
|
||||
formData.append('emp_file[]', empFiles[i]);
|
||||
console.log(empFiles[i]);
|
||||
}
|
||||
} else {
|
||||
console.log("ajax call");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//return false;
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
@ -1626,7 +1631,7 @@
|
||||
</div>
|
||||
<div class=" col-md-4">
|
||||
<label class="col-form-label" for="emp_file">File</label>
|
||||
<input type="file" id="emp_file" name="emp_file[]" class="form-control">
|
||||
<input type="file" id="emp_file" name="emp_file[]" multiple class="form-control">
|
||||
</div>
|
||||
<div class=" col-md-4" style="margin-top: 40px;">
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)">Remove</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user