154 lines
8.1 KiB
PHP
154 lines
8.1 KiB
PHP
<div class="card-toolbar">
|
|
<!--begin::Toolbar-->
|
|
<div class="d-flex justify-content-start" data-kt-filemanager-table-toolbar="base">
|
|
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#kt_modal_upload">
|
|
<span class="svg-icon svg-icon-2">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
<path opacity="0.3" d="M10 4H21C21.6 4 22 4.4 22 5V7H10V4Z" fill="black" />
|
|
<path d="M10.4 3.60001L12 6H21C21.6 6 22 6.4 22 7V19C22 19.6 21.6 20 21 20H3C2.4 20 2 19.6 2 19V4C2 3.4 2.4 3 3 3H9.20001C9.70001 3 10.2 3.20001 10.4 3.60001ZM16 11.6L12.7 8.29999C12.3 7.89999 11.7 7.89999 11.3 8.29999L8 11.6H11V17C11 17.6 11.4 18 12 18C12.6 18 13 17.6 13 17V11.6H16Z" fill="black" />
|
|
<path opacity="0.3" d="M11 11.6V17C11 17.6 11.4 18 12 18C12.6 18 13 17.6 13 17V11.6H11Z" fill="black" />
|
|
</svg>
|
|
</span>Upload Files
|
|
</button>
|
|
</div>
|
|
<div class="d-flex justify-content-end align-items-center d-none" data-kt-filemanager-table-toolbar="selected">
|
|
<div class="fw-bolder me-5">
|
|
<span class="me-2" data-kt-filemanager-table-select="selected_count"></span>Selected</div>
|
|
<button type="button" class="btn btn-danger" data-kt-filemanager-table-select="delete_selected">Delete Selected</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="kt_modal_upload" tabindex="-1" aria-hidden="true">
|
|
<!--begin::Modal dialog-->
|
|
<div class="modal-dialog modal-dialog-centered mw-650px">
|
|
<!--begin::Modal content-->
|
|
<div class="modal-content">
|
|
<!--begin::Form-->
|
|
<form action="/proj/thisjob" method='POST' enctype="multipart/form-data">
|
|
<input type='hidden' name='uploadForm' value='1'>
|
|
<input type='hidden' name='jobID' value='<?php echo $jobID; ?>'>
|
|
<input type='hidden' name='contractId' value='<?php echo $contract_id; ?>'>
|
|
|
|
<!--begin::Modal header-->
|
|
<div class="modal-header">
|
|
<!--begin::Modal title-->
|
|
<h2 class="fw-bolder">Upload files</h2>
|
|
<!--end::Modal title-->
|
|
<!--begin::Close-->
|
|
<div class="btn btn-icon btn-sm btn-active-icon-primary" data-bs-dismiss="modal">
|
|
<!--begin::Svg Icon | path: icons/duotune/arrows/arr061.svg-->
|
|
<span class="svg-icon svg-icon-1">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
<rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" />
|
|
<rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" />
|
|
</svg>
|
|
</span>
|
|
<!--end::Svg Icon-->
|
|
</div>
|
|
<!--end::Close-->
|
|
</div>
|
|
<!--end::Modal header-->
|
|
<!--begin::Modal body-->
|
|
<div class="modal-body pt-10 pb-15 px-lg-17">
|
|
<!--begin::Input group-->
|
|
<div class="form-group">
|
|
<!--begin::Dropzone-->
|
|
<div class="dropzone dropzone-queue mb-2" id="kt_modal_upload_dropzone">
|
|
<!--begin::Controls-->
|
|
<div class="dropzone-panel mb-4">
|
|
<!-- a class="dropzone-select btn btn-sm btn-primary me-2">Attach files</a -->
|
|
<input class="dropzone-select btn btn-sm btn-primary me-2" type='file' name='fileToUpload[]' multiple="" id="fileToUpload[]" onchange="fileToUploadChanged(this)">
|
|
<!-- a class="dropzone-upload btn btn-sm btn-light-primary me-2">Upload All</a>
|
|
<a class="dropzone-remove-all btn btn-sm btn-light-primary">Remove All</a -->
|
|
<br><div id="fileToUploadList"></div>
|
|
<br><input class="dropzone-select btn btn-sm btn-primary me-2" type='submit' value='Upload' name='upload' />
|
|
</div>
|
|
<!--end::Controls-->
|
|
<!--begin::Items-->
|
|
<div class="dropzone-items wm-200px">
|
|
<div class="dropzone-item p-5" style="display:none">
|
|
<!--begin::File-->
|
|
<div class="dropzone-file">
|
|
<div class="dropzone-filename text-dark" title="some_image_file_name.jpg">
|
|
<span data-dz-name="">some_image_file_name.jpg</span>
|
|
<strong>(
|
|
<span data-dz-size="">340kb</span>)</strong>
|
|
</div>
|
|
<div class="dropzone-error mt-0" data-dz-errormessage=""></div>
|
|
</div>
|
|
<!--end::File-->
|
|
<!--begin::Progress-->
|
|
<div class="dropzone-progress">
|
|
<div class="progress bg-light-primary">
|
|
<div class="progress-bar bg-primary" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" data-dz-uploadprogress=""></div>
|
|
</div>
|
|
</div>
|
|
<!--end::Progress-->
|
|
<!--begin::Toolbar-->
|
|
<div class="dropzone-toolbar">
|
|
<span class="dropzone-start">
|
|
<i class="bi bi-play-fill fs-3"></i>
|
|
</span>
|
|
<span class="dropzone-cancel" data-dz-remove="" style="display: none;">
|
|
<i class="bi bi-x fs-3"></i>
|
|
</span>
|
|
<span class="dropzone-delete" data-dz-remove="">
|
|
<i class="bi bi-x fs-1"></i>
|
|
</span>
|
|
</div>
|
|
<!--end::Toolbar-->
|
|
</div>
|
|
</div>
|
|
<!--end::Items-->
|
|
</div>
|
|
<!--end::Dropzone-->
|
|
<!--begin::Hint-->
|
|
<span class="form-text fs-6 text-muted">There is a file size limit [<?php echo UPLOAD_FILE_SIZE; ?> MB]. Split large files into smaller size</span>
|
|
|
|
<!--end::Hint-->
|
|
</div>
|
|
<!--end::Input group-->
|
|
</div>
|
|
<!--end::Modal body-->
|
|
</form>
|
|
<!--end::Form-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--end::Modal - Upload File-->
|
|
|
|
<script type="text/javascript">
|
|
<!--
|
|
function fileToUploadChanged(e) {
|
|
var fileToUploadList = document.getElementById('fileToUploadList');
|
|
fileToUploadList.innerHTML = '';
|
|
e.files.forEach(file => {
|
|
//alert(file.name);
|
|
fileToUploadList.innerHTML += '<br><b>' + file.name + '</b> - ' + humanFileSize(file.size) + ' (' + file.type + ')';
|
|
});
|
|
}
|
|
|
|
function humanFileSize(bytes, si=false, dp=1) {
|
|
const thresh = si ? 1000 : 1024;
|
|
|
|
if (Math.abs(bytes) < thresh) {
|
|
return bytes + ' B';
|
|
}
|
|
|
|
const units = si
|
|
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
let u = -1;
|
|
const r = 10**dp;
|
|
|
|
do {
|
|
bytes /= thresh;
|
|
++u;
|
|
} while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
|
|
|
|
|
|
return bytes.toFixed(dp) + ' ' + units[u];
|
|
}
|
|
|
|
// -->
|
|
</script>
|