From 9c0f77790c96daad675fb17d743199612402fea7 Mon Sep 17 00:00:00 2001 From: JiaSheng Date: Tue, 26 Dec 2023 22:31:33 +0800 Subject: [PATCH] add filters to statement mapping --- .../sections/TransactionsMappingComponent.vue | 74 ++++++++++++------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue b/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue index bb19b908..eb12f809 100644 --- a/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue +++ b/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue @@ -76,26 +76,30 @@ -
-
-
- - - - -
-
- - - - -
-
-
- - Search - -
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
+ + Search +
@@ -231,6 +235,7 @@ export default { parameters: { startDate: '', endDate: '', + account: '', }, type: null, stage: null, @@ -252,6 +257,7 @@ export default { endDate: { required }, + account: {}, }, files: { // required // todo-new: set required if is pdf section @@ -300,6 +306,17 @@ export default { this.files = []; this.parameters = {}; }, + getAccountId(){ + if (this.parameters.account) { + if (this.parameters.account.includes('568603010762')) { + return 4; + } + if (this.parameters.account.includes('8881040198515')) { + return 5; + } + } + return false; + }, startMapping(stage){ this.stage = stage; @@ -307,16 +324,17 @@ export default { if(this.type === 1){ switch(this.stage){ case 1: - this.filter = {min_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {min_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} + break; case 2: - this.filter = {min_amount: 0, is_mapped: true, is_mapped_with_multiple: true, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {min_amount: 0, is_mapped: true, is_mapped_with_multiple: true, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} break; case 3: - this.filter = {min_amount: 0, is_mapped_false_or_mapped_but_status_in: [4], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {min_amount: 0, is_mapped_false_or_mapped_but_status_in: [4], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} break; case 4: - this.filter = {min_amount: 0, is_mapped: true, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [2], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {min_amount: 0, is_mapped: true, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [2], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} if (typeof this.parameters.startDate != 'undefined' && this.parameters.startDate != '') this.filter = {...this.filter, ...{statement_transaction_posting_start: this.parameters.startDate}}; @@ -328,16 +346,16 @@ export default { if(this.type === 2){ switch(this.stage){ case 1: - this.filter = {max_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [3, 5],statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {max_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [3, 5],statement_transaction_owner_status_in: [1], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} break; case 2: - this.filter = {max_amount: 0, is_mapped: true, is_mapped_with_multiple: true, statement_transaction_owner_type_in: [3, 5], statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {max_amount: 0, is_mapped: true, is_mapped_with_multiple: true, statement_transaction_owner_type_in: [3, 5], statement_transaction_owner_status_in: [1], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} break; case 3: - this.filter = {max_amount: 0, is_mapped: false, per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {max_amount: 0, is_mapped: false, ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, ...this.parameters.startDate && {statement_transaction_posting_start: this.parameters.startDate}, ...this.parameters.endDate && {statement_transaction_posting_end: this.parameters.endDate}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} break; case 4: - this.filter = {max_amount: 0, is_mapped: true, statement_transaction_owner_type_in: [3, 5], statement_transaction_owner_status_in: [2], per_page: 100, order_by: {column: 'posting_date', DESC: true}} + this.filter = {max_amount: 0, is_mapped: true, statement_transaction_owner_type_in: [3, 5], statement_transaction_owner_status_in: [2], ...this.parameters.account && {statement_transaction_account_id: this.getAccountId()}, per_page: 100, order_by: {column: 'posting_date', DESC: true}} if (typeof this.parameters.startDate != 'undefined' && this.parameters.startDate != '') this.filter = {...this.filter, ...{statement_transaction_posting_start: this.parameters.startDate}};