tidy up transactions exports

This commit is contained in:
edmondlang
2022-03-22 00:23:24 +08:00
parent 7857063a56
commit 15cde500d1
5 changed files with 136 additions and 27 deletions
@@ -0,0 +1,83 @@
<template>
<div class="row m-b-20">
<div class="col">
<div class="row">
<div class="col">
<div class="row m-l-0 m-r-0">
<div class="col-12 col-md mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
<validation-wrapper-component :validator="$v.parameters.startDate">
<label class="all-caps">Start Date</label>
<date-picker-component :parameters="parameters" v-model.lazy="parameters.startDate"></date-picker-component>
</validation-wrapper-component>
</div>
<div class="col-12 col-md mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
<validation-wrapper-component :validator="$v.parameters.endDate">
<label class="all-caps">End Date</label>
<date-picker-component :parameters="parameters" v-model.lazy="parameters.endDate"></date-picker-component>
</validation-wrapper-component>
</div>
<div class="col-12 col-md-auto p-l-3 p-r-3 p-md-0">
<div class="btn btn-lg btn-primary fs-11 w-100 h-100 d-flex justify-content-center align-items-center" @click="downloadReport()">
<span>
<i class="fa fa-cloud-download fs-20" style="margin-top: 8px;"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from "../../../general/mixins/componentHandler";
import { required } from "vuelidate/lib/validators";
export default {
props: {
section:{
type: String,
required: true
}
},
data(){
return {
parameters: {
startDate: '',
endDate: '',
},
}
},
validations: {
parameters: {
startDate: {
required
},
endDate: {
required
},
}
},
methods: {
downloadReport(){
var apiRoute = '';
if(!this.validate()){ return; }
switch(this.section) {
case 'paymentsReportSection':
apiRoute = route('paymentTransactions.export');
break;
case 'walletsReportSection':
apiRoute = route('walletTransactions.export');
break;
}
window.open(apiRoute + '?startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank');
},
updateDocumentType(documentType) {
this.parameters.type = documentType;
this.selectedDocumentStatus = !this.selectedDocumentStatus
}
},
mixins: [componentHandler]
};
</script>
@@ -1,31 +1,44 @@
<template>
<div class="row" @keyup.enter="submitForm">
<div class="col ml-md-3 ml-0 mt-md-0 mt-3 bg-white padding-15">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
<div class="row" v-show="!$store.getters.isLoading(section)">
<div class="col">
<div class="row m-b-10">
<div class="row">
<div class="col">
<div class="row" @keyup.enter="submitForm">
<div class="col ml-md-3 ml-0 mt-md-0 mt-3 bg-white padding-15">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
<div class="row" v-show="!$store.getters.isLoading(section)">
<div class="col">
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Debtors</div>
</div>
</div>
<error-message-component class="m-b-20" :error="error"></error-message-component>
<div class="row">
<div class="col">
<file-input-component :validator="$v.files" v-model="files">
<template slot="label">
<div class="font-heading fs-11 text-primary all-caps">Debtor Excel</div>
</template>
</file-input-component>
</div>
</div>
<div class="row m-t-20">
<div class="col">
<div class="row">
<div class="row m-b-10">
<div class="col">
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Upload & Update</button>
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Debtors</div>
</div>
</div>
<error-message-component class="m-b-20" :error="error"></error-message-component>
<div class="row">
<div class="col">
<file-input-component :validator="$v.files" v-model="files">
<template slot="label">
<div class="font-heading fs-11 text-primary all-caps">Debtor Excel</div>
</template>
</file-input-component>
</div>
</div>
<div class="row m-t-20">
<div class="col">
<div class="row">
<div class="col">
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Upload & Update</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-20">
<div class="col ml-md-3 ml-0">
<div class="row">
<div class="col">
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="downloadReport()">Download Null Debtors Report</button>
</div>
</div>
</div>
@@ -57,7 +70,10 @@
};
this.submit(this.route('api.debtor.import'), 'post', this.section, true, false)
}
},
downloadReport(){
window.open(route('nullDebtor.export'), '_blank');
},
},
mixins: [ModalFromHandler]
+5
View File
@@ -1,5 +1,10 @@
@extends('layouts.base_portal')
@section('inner_content')
<div class="row">
<div class="col-12 col-md-6 no-padding">
<download-billing-with-dates-component section="paymentsReportSection"></download-billing-withdates-component>
</div>
</div>
<div class="row">
<div class="col bg-white p-t-15 p-b-15">
<div class="row no-margin">
@@ -3,6 +3,11 @@
@section('inner_content')
<div class="row">
<div class="col">
<div class="row">
<div class="col-12 col-md-6">
<download-billing-with-dates-component section="walletsReportSection"></download-billing-withdates-component>
</div>
</div>
<div class="row tabsContainer" v-if="$store.getters.isAdmin">
<div class="col">
<div class="row m-l-0 m-r-0 d-flex">
+3 -3
View File
@@ -143,9 +143,9 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor');
Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions');
Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions');
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('nullDebtor.export');
Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export');
Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions')->name('walletTransactions.export');
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);