Merge branch 'steve/checkbox-for-export-invoice' into development

This commit is contained in:
Steve Ng
2023-10-09 14:16:57 +08:00
3 changed files with 25 additions and 3 deletions
@@ -56,9 +56,11 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading
*/
public function query()
{
return StatementTransactionOwner::whereNull('invoice_reference')
$data = StatementTransactionOwner::whereNull('invoice_reference')
->whereIn('type', [StatementTransactionOwnerType::SALES, StatementTransactionOwnerType::WALLET_TOP_UP])
->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED]);
if ($this->request->has('bankStatementOwnerId')) $data = $data->whereIn('id',json_decode($this->request->input('bankStatementOwnerId')));
return $data;
}
/**
@@ -113,6 +113,12 @@
</div>
<div class="col-1">{{ item.amount }}</div>
<div class="col-1 text-success" v-if="item.owners.approved.length">{{ [6, 7, 8, 9, 10, 11, 12, 13, 14].includes(item.owners.approved[0].type) ? 'Miscellaneous' : 'Approved' }}</div>
<!-- Pending Export tab for checkbox here -->
<div class="col-1" v-if="item.owners.approved.length === 1">
<input type="checkbox" class="request_export_item" v-model="selectAll" :value="item.owners.approved[0].id">
</div>
<div class="col-1 text-danger" v-if="!item.owners.approved.length">Pending...</div>
<div class="col-1" v-if="stage === 1">
<button class="btn btn-xs btn-outline-danger b-rad-none m-r-5 requestModal" data-type="deleteMappingTransaction">
@@ -148,6 +154,9 @@
section:{
type: String,
required: true
},
selectAll: {
type:Boolean
}
},
methods: {
@@ -87,12 +87,16 @@
</div>
</div>
<div class="col-1">Amount</div>
<div class="col-1" v-if="stage === 4"></div>
<div class="col-1" v-if="stage === 4">Select <input type="checkbox" v-model="selectAll">
</div>
</div>
</div>
</div>
<list-component ref="bankTransactionsList" section="bankTransactionSection" :endpoint="route('api.accounting.bank.transaction')" :options="this.filter">
<template slot="list" slot-scope="{data}">
<statement-transaction-component :data="data" :section="section" :stage="stage"></statement-transaction-component>
<statement-transaction-component :data="data" :section="section" :stage="stage" :selectAll="selectAll"></statement-transaction-component>
</template>
</list-component>
</div>
@@ -199,6 +203,7 @@ export default {
parameters: {},
section: 'bankTransactionSection',
mappedTrue: false,
selectAll: false,
}
},
validations: {
@@ -217,7 +222,13 @@ export default {
this.submit(this.route('api.import_receipts.upload'), 'post', this.section, true, false);
},
exportInvoiceToAutoCount(){
window.open(this.route('invoiceTransactions.export'), '_blank');
let bankStatementOwnerId = [];
$('.request_export_item:checked').each(function() {
bankStatementOwnerId.push($(this).val());
});
bankStatementOwnerId = JSON.stringify(bankStatementOwnerId);
window.open(this.route('invoiceTransactions.export')+'?bankStatementOwnerId='+bankStatementOwnerId, '_blank');
},
successHandler(){
this.step += 1;