Merge branch 'bulk-download-white-form' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0

This commit is contained in:
edmondlang
2023-10-18 15:55:30 +08:00
6 changed files with 17 additions and 8 deletions
@@ -42,12 +42,13 @@ class BulkDownloadSupplierWhiteFormsLogic
}
$zip_file = "{$zipDirectory}/currency_vendor_orders_{$request->input('startDate')}_to_{$request->input('endDate')}_{$companyReference}.zip";
$zip = new ZipArchive();
if ($zip->open($zip_file, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
foreach($groups as $group) {
$document = $group->documents()->where('document_type', DocumentType::CURRENCY_VENDOR_ORDER)->whereNull('deleted_at')->first()->files()->first();
$zip->addFile(Storage::disk('documents')->path($document->file->file_info->original->file), $group->reference . '.pdf');
$created_at = $group->created_at->format('Y-m-d');
$zip->addFile(Storage::disk('documents')->path($document->file->file_info->original->file), $created_at . "_" . $group->amount . "_" . $group->reference . '.pdf');
}
$zip->close();
@@ -7,7 +7,7 @@
<div class="col mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
<validation-wrapper-component selectable :validator="$v.parameters.supplier">
<label>Supplier</label>
<selectable-component :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="exportSupplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="parameters.supplier"></selectable-component>
<selectable-component :disableOnFetch="true" :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="exportSupplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="parameters.supplier"></selectable-component>
</validation-wrapper-component>
</div>
<div class="col mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
@@ -24,7 +24,7 @@
<div class="col padding-0">
<validation-wrapper-component selectable :validator="$v.filterSupplier">
<label>Supplier</label>
<selectable-component :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="supplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="filterSupplier"></selectable-component>
<selectable-component :disableOnFetch="true" :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="supplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="filterSupplier"></selectable-component>
</validation-wrapper-component>
</div>
<div class="col-2 p-l-0">
@@ -1,5 +1,5 @@
<template>
<select class="form-control">
<select class="form-control" :disabled="this.options.length === 0 && this.disableOnFetch">
<option disabled></option>
</select>
</template>
@@ -13,6 +13,10 @@
},
value: {
required: false
},
disableOnFetch: {
type: Boolean,
default: false
}
},
mounted(){
@@ -1,5 +1,5 @@
<template>
<select-component :options="$store.getters.getSelectableList(section)" :value="value" @input="(val) => {$emit('input', val)}"></select-component>
<select-component :disableOnFetch="disableOnFetch" :options="$store.getters.getSelectableList(section)" :value="value" @input="(val) => {$emit('input', val)}"></select-component>
</template>
<script>
@@ -23,6 +23,10 @@
valueColumn: {
type: String,
required: true
},
disableOnFetch: {
type: Boolean,
default: false
}
},
created(){
+2 -2
View File
@@ -14,7 +14,7 @@ export default {
success = response.ok;
if (response.headers.get("content-type") === "application/zip") {
const fileName = response.headers.get('Content-Disposition').split('filename=')[1];
const fileName = response.headers.get('Content-Disposition').split('filename=')[1].replaceAll('"', '');
response.blob().then(response => {
if (!success) {
@@ -27,7 +27,7 @@ export default {
const link = document.createElement('a');
link.href = window.URL.createObjectURL(response);
link.download = fileName;
link.download = fileName.trim();
link.click();
this.successHandler(response)
});