From 2bdcb69366a9f94e081ac5cdf219c55de09ae0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Alberto=20Hern=C3=A1ndez?= <44206706+josehernandezfintecheandomx@users.noreply.github.com> Date: Sat, 2 Sep 2023 16:28:01 -0600 Subject: [PATCH] Savings account transaction with datatables (#1858) Co-authored-by: Jose Alberto Hernandez --- .../core/shell/toolbar/toolbar.component.html | 2 +- src/app/core/utils/datatables.ts | 2 +- .../view-transaction.component.html | 57 +- .../view-transaction.component.scss | 5 + .../edit-loan-product.component.html | 4 +- .../edit-loan-product.component.ts | 2 + .../loan-product-preview-step.component.html | 4 +- .../loan-product-settings-step.component.ts | 1 + .../loan-product-terms-step.component.html | 16 +- .../general-tab/general-tab.component.html | 4 +- .../general-tab/general-tab.component.scss | 4 + .../saving-product-general-tab.component.html | 626 +++++++++--------- .../saving-product-general-tab.component.scss | 4 + .../savings-account-transaction.resolver.ts | 2 +- .../transactions-tab.component.html | 9 +- .../transactions-tab.component.ts | 4 +- ...s-transaction-datatable-tab.component.html | 1 + ...s-transaction-datatable-tab.component.scss | 0 ...ransaction-datatable-tab.component.spec.ts | 23 + ...ngs-transaction-datatable-tab.component.ts | 15 + ...ngs-transaction-general-tab.component.html | 90 +++ ...ngs-transaction-general-tab.component.scss | 14 + ...-transaction-general-tab.component.spec.ts | 23 + ...vings-transaction-general-tab.component.ts | 67 ++ .../view-transaction.component.html | 124 +--- .../view-transaction.component.scss | 59 +- .../view-transaction.component.ts | 73 +- src/app/savings/savings-routing.module.ts | 32 +- src/app/savings/savings.module.ts | 6 +- src/app/shared/shared.module.ts | 7 +- .../payment-detail-model.ts | 16 + .../transaction-payment-detail.component.html | 49 ++ .../transaction-payment-detail.component.scss | 14 + ...ansaction-payment-detail.component.spec.ts | 23 + .../transaction-payment-detail.component.ts | 18 + 35 files changed, 777 insertions(+), 623 deletions(-) create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.html create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.scss create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.spec.ts create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.ts create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.html create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.scss create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.spec.ts create mode 100644 src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.ts create mode 100644 src/app/shared/transaction-payment-detail/payment-detail-model.ts create mode 100644 src/app/shared/transaction-payment-detail/transaction-payment-detail.component.html create mode 100644 src/app/shared/transaction-payment-detail/transaction-payment-detail.component.scss create mode 100644 src/app/shared/transaction-payment-detail/transaction-payment-detail.component.spec.ts create mode 100644 src/app/shared/transaction-payment-detail/transaction-payment-detail.component.ts diff --git a/src/app/core/shell/toolbar/toolbar.component.html b/src/app/core/shell/toolbar/toolbar.component.html index 6b7c39835..a97992f0c 100644 --- a/src/app/core/shell/toolbar/toolbar.component.html +++ b/src/app/core/shell/toolbar/toolbar.component.html @@ -69,7 +69,7 @@ - + diff --git a/src/app/core/utils/datatables.ts b/src/app/core/utils/datatables.ts index d53d2850d..cdb5a7d20 100644 --- a/src/app/core/utils/datatables.ts +++ b/src/app/core/utils/datatables.ts @@ -14,7 +14,7 @@ export class Datatables { systemFields: string[] = ['id', 'created_at', 'updated_at']; - entitiesIdFields: string[] = ['client_id', 'savings_account_id', + entitiesIdFields: string[] = ['client_id', 'savings_account_id', 'savings_transaction_id', 'loan_id', 'group_id', 'center_id', 'office_id', 'product_loan_id', 'savings_product_id', 'share_product_id']; constructor(private dateUtils: Dates, diff --git a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.html b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.html index 4efdd2198..18f2544fb 100644 --- a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.html +++ b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.html @@ -118,60 +118,9 @@ - - - - -
- {{ 'Payment Type' | translate }} -
- -
- {{ transactionData.paymentDetailData.paymentType.name }} -
- -
- {{ 'Account No.' | translate }} -
- -
- {{ transactionData.paymentDetailData.accountNumber }} -
- -
- {{ 'Cheque Number' | translate }} -
- -
- {{ transactionData.paymentDetailData.checkNumber }} -
- -
- {{ 'Routing Code' | translate }} -
- -
- {{ transactionData.paymentDetailData.routingCode }} -
- -
- {{ 'Receipt No.' | translate }} -
- -
- {{ transactionData.paymentDetailData.receiptNumber }} -
- -
- {{ 'Bank No.' | translate }} -
- -
- {{ transactionData.paymentDetailData.bankNumber }} -
- -
- + +
diff --git a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.scss b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.scss index cdcd0f30c..902c3d3e5 100644 --- a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.scss +++ b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.scss @@ -7,6 +7,11 @@ margin: 1rem 0; word-wrap: break-word; } + + mifosx-transaction-payment-detail { + width: 100%; + margin-bottom: 20px; + } } } diff --git a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html index c25f01d3d..d3f51e0c9 100644 --- a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html +++ b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html @@ -46,7 +46,7 @@ - + SETTINGS @@ -59,7 +59,7 @@ - + PAYMENT ALLOCATION diff --git a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts index 987007b8a..b489e0a60 100644 --- a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts +++ b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts @@ -127,6 +127,8 @@ export class EditLoanProductComponent implements OnInit { ...this.loanProductChargesStep.loanProductCharges, ...this.loanProductAccountingStep.loanProductAccounting }; + // Default empty array + loanProduct['paymentAllocation'] = []; if (this.isAdvancedPaymentStrategy) { loanProduct['paymentAllocation'] = this.paymentAllocation; } diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html index 3c8386283..27a02a7f7 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html @@ -346,14 +346,14 @@ - + - +
Order Payment Allocation RuleOrder
{{ (idx + 1) }} {{ paymentAllocation.paymentAllocationRule }}{{ (idx + 1) }}
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts index 348f825ee..a5a3c9d0b 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts @@ -10,6 +10,7 @@ import { rangeValidator } from 'app/shared/validators/percentage.validator'; }) export class LoanProductSettingsStepComponent implements OnInit { + @Input() toEdit: boolean; @Input() loanProductsTemplate: any; @Input() isLinkedToFloatingInterestRates: UntypedFormControl; @Output() advancePaymentStrategy = new EventEmitter(); diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html index 926e1dccb..58068fc1d 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html @@ -28,12 +28,12 @@ -
- - Allow approval / disbursal above loan applied amount? - + + Allow approval / disbursal above loan applied amount? + - +
+ Over Amount Calculation Type @@ -42,7 +42,7 @@ - + Over Amount @@ -61,7 +61,7 @@ Minimum - + Minimum Value must be greater equal to than 0 @@ -113,7 +113,7 @@ Maximum - + Maximum Value must be greater equal to than 0 and must be greater than Minimum Principal diff --git a/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.html b/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.html index 12da93a2f..774556ae8 100644 --- a/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.html +++ b/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.html @@ -349,14 +349,14 @@ - + - +
Order Payment Allocation RuleOrder
{{ (idx + 1) }} {{ paymentAllocation.paymentAllocationRule }}{{ (idx + 1) }}
diff --git a/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.scss b/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.scss index 6df3c71cc..fafc40cc8 100644 --- a/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.scss +++ b/src/app/products/loan-products/view-loan-product/general-tab/general-tab.component.scss @@ -3,6 +3,10 @@ .tab-container { padding: 1%; margin: 1%; + + div: { + margin-top: 3px; + } } .mat-h3 { diff --git a/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.html b/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.html index 7402605c1..27bc0a7b7 100644 --- a/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.html +++ b/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.html @@ -1,353 +1,363 @@ -
-
+
- - +
-
+

{{ savingProduct.name }}

-

{{ savingProduct.name }}

+ + +

Details

+ + + +
+ Short Name: + {{ savingProduct.shortName }} +
+ +
+ Description: + {{ savingProduct.description }} +
+ +

Currency

+ + + +
+ Currency: + {{ savingProduct.currency.name }} +
+ +
+ Decimal Places: + {{ savingProduct.currency.decimalPlaces }} +
+ +
+ Currency in multiples of: + {{ savingProduct.currency.inMultiplesOf }} +
+ +

Terms

+ + + +
+ Nominal Annual Interest Rate: + {{ savingProduct.nominalAnnualInterestRate }} +
+ +
+ Interest Compounding Period: + {{ savingProduct.interestCompoundingPeriodType.value }} +
+ +
+ Interest Posting Period: + {{ savingProduct.interestPostingPeriodType.value }} +
+ +
+ Interest Calculated using: + {{ savingProduct.interestCalculationType.value }} +
+ +
+ Days in Year: + {{ savingProduct.interestCalculationDaysInYearType.value }} +
+ +

Settings

+ + + +
+ Minimum Opening Balance: + {{ savingProduct.minRequiredOpeningBalance }} +
+ +
+ Lock-in Period: + {{ savingProduct.lockinPeriodFrequency + ' ' + savingProduct.lockinPeriodFrequencyType.value + }} +
+ +
+ Apply Withdrawal Fee for Transfers: + {{ savingProduct.withdrawalFeeForTransfers ? 'Yes' : 'No' }} +
+ +
+ Balance Required for Interest Calculation: + {{ savingProduct.minBalanceForInterestCalculation }} +
+ +
+ Enforce Minimum Balance: + {{ savingProduct.enforceMinRequiredBalance ? 'Yes' : 'No' }} +
+ +
+ Minimum Balance: + {{ savingProduct.minRequiredBalance }} +
+ +
+ Withhold Tax is Applicable: + {{ savingProduct.withHoldTax ? 'Yes' : 'No' }} +
+ +
+ Tax Group: + {{ savingProduct.taxGroup.name }} +
+ +
+ Is Overdraft Allowed: + {{ savingProduct.allowOverdraft ? 'Yes' : 'No' }} +
+ +
+ Minimum Overdraft Required for Interest Calculation: + {{ savingProduct.minOverdraftForInterestCalculation }} +
+ +
+ Nominal Annual Interest for Overdraft: + {{ savingProduct.nominalAnnualInterestRateOverdraft }} +
+ +
+ Maximum Overdraft Amount Limit: + {{ savingProduct.overdraftLimit }} +
+ +
+ Enable Dormancy Tracking: + {{ savingProduct.isDormancyTrackingActive ? 'Yes' : 'No' }} +
+ +
+ Number of Days to Inactive sub-status: + {{ savingProduct.daysToInactive }} + Number of Days to Dormant sub-status: + {{ savingProduct.daysToDormancy }} + Number of Days to Escheat: + {{ savingProduct.daysToEscheat }} +
+ +
+ +

Charges

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name + {{ charge.name + ', ' + charge.currency.displaySymbol }} + Type + {{ charge.chargeCalculationType.value }} + Amount + {{ charge.amount }} + Collected On + {{ charge.chargeTimeType.value }} +
+ +
+ +

Accounting

+ + + +
+ Type: + {{ savingProduct.accountingRule.value }} +
+ +
+ +

Assets

+ +
+ Saving reference: + ({{ savingProduct.accountingMappings.savingsReferenceAccount.glCode }}) {{ + savingProduct.accountingMappings.savingsReferenceAccount.name }} + Overdraft portfolio: + ({{ savingProduct.accountingMappings.overdraftPortfolioControl.glCode }}) {{ + savingProduct.accountingMappings.overdraftPortfolioControl.name }} +
+ +

Liabilities

+ +
+ Saving control: + ({{ savingProduct.accountingMappings.savingsControlAccount.glCode }}) {{ + savingProduct.accountingMappings.savingsControlAccount.name }} + Savings transfers in suspense: + ({{ savingProduct.accountingMappings.transfersInSuspenseAccount.glCode }}) {{ + savingProduct.accountingMappings.transfersInSuspenseAccount.name }} +
+ Escheat liability: + ({{ savingProduct.accountingMappings.escheatLiabilityAccount.glCode }}) {{ + savingProduct.accountingMappings.escheatLiabilityAccount.name }} +
+
+ +

Expenses

+ +
+ Interest on savings: + ({{ savingProduct.accountingMappings.interestOnSavingsAccount.glCode }}) {{ + savingProduct.accountingMappings.interestOnSavingsAccount.name }} + Write-off: + ({{ savingProduct.accountingMappings.writeOffAccount.glCode }}) {{ + savingProduct.accountingMappings.writeOffAccount.name }} +
+ +

Income

+ +
+ Income from fees: + ({{ savingProduct.accountingMappings.incomeFromFeeAccount.glCode }}) {{ + savingProduct.accountingMappings.incomeFromFeeAccount.name }} + Income from penalties: + ({{ savingProduct.accountingMappings.incomeFromPenaltyAccount.glCode }}) {{ + savingProduct.accountingMappings.incomeFromPenaltyAccount.name }} + Overdraft Interest Income: + ({{ savingProduct.accountingMappings.incomeFromInterest.glCode }}) {{ + savingProduct.accountingMappings.incomeFromInterest.name }} +
+ +
+ +

Advanced Accounting Rules

-

Details

+
- +

Fund Sources for Payment Channels

-
- Short Name: - {{ savingProduct.shortName }} -
+ -
- Description: - {{ savingProduct.description }} -
- -

Currency

- - - -
- Currency: - {{ savingProduct.currency.name }} -
- -
- Decimal Places: - {{ savingProduct.currency.decimalPlaces }} -
- -
- Currency in multiples of: - {{ savingProduct.currency.inMultiplesOf }} -
- -

Terms

- - - -
- Nominal Annual Interest Rate: - {{ savingProduct.nominalAnnualInterestRate }} -
- -
- Interest Compounding Period: - {{ savingProduct.interestCompoundingPeriodType.value }} -
- -
- Interest Posting Period: - {{ savingProduct.interestPostingPeriodType.value }} -
- -
- Interest Calculated using: - {{ savingProduct.interestCalculationType.value }} -
- -
- Days in Year: - {{ savingProduct.interestCalculationDaysInYearType.value }} -
- -

Settings

- - - -
- Minimum Opening Balance: - {{ savingProduct.minRequiredOpeningBalance }} -
- -
- Lock-in Period: - {{ savingProduct.lockinPeriodFrequency + ' ' + savingProduct.lockinPeriodFrequencyType.value }} -
- -
- Apply Withdrawal Fee for Transfers: - {{ savingProduct.withdrawalFeeForTransfers ? 'Yes' : 'No' }} -
- -
- Balance Required for Interest Calculation: - {{ savingProduct.minBalanceForInterestCalculation }} -
- -
- Enforce Minimum Balance: - {{ savingProduct.enforceMinRequiredBalance ? 'Yes' : 'No' }} -
- -
- Minimum Balance: - {{ savingProduct.minRequiredBalance }} -
- -
- Withhold Tax is Applicable: - {{ savingProduct.withHoldTax ? 'Yes' : 'No' }} -
- -
- Tax Group: - {{ savingProduct.taxGroup.name }} -
- -
- Is Overdraft Allowed: - {{ savingProduct.allowOverdraft ? 'Yes' : 'No' }} -
- -
- Minimum Overdraft Required for Interest Calculation: - {{ savingProduct.minOverdraftForInterestCalculation }} -
- -
- Nominal Annual Interest for Overdraft: - {{ savingProduct.nominalAnnualInterestRateOverdraft }} -
- -
- Maximum Overdraft Amount Limit: - {{ savingProduct.overdraftLimit }} -
- -
- Enable Dormancy Tracking: - {{ savingProduct.isDormancyTrackingActive ? 'Yes' : 'No' }} -
- -
- Number of Days to Inactive sub-status: - {{ savingProduct.daysToInactive }} - Number of Days to Dormant sub-status: - {{ savingProduct.daysToDormancy }} - Number of Days to Escheat: - {{ savingProduct.daysToEscheat }} -
- -
- -

Charges

- - - -
- - - - + - - - + - - - - - - - - - - - - + +
Name - {{ charge.name + ', ' + charge.currency.displaySymbol }} + + Payment Type + {{ paymentFundSource.paymentType.name }} Type - {{ charge.chargeCalculationType.value }} + + Fund Source + ({{ paymentFundSource.fundSourceAccount.glCode }}) {{ paymentFundSource.fundSourceAccount.name }} Amount - {{ charge.amount }} - Collected On - {{ charge.chargeTimeType.value }} -
-

Accounting

+
- +

Fees to Specific Income Accounts

+ + + + + + + + + + + + + + + + +
Fees + {{ feesIncome.charge.name }} + Income Account + ({{ feesIncome.incomeAccount.glCode }}) {{ feesIncome.incomeAccount.name }} +
-
- Type: - {{ savingProduct.accountingRule.value }}
-
+
-

Assets

+

Penalties to Specific Income Accounts

-
- Saving reference: - ({{ savingProduct.accountingMappings.savingsReferenceAccount.glCode }}) {{ savingProduct.accountingMappings.savingsReferenceAccount.name }} - Overdraft portfolio: - ({{ savingProduct.accountingMappings.overdraftPortfolioControl.glCode }}) {{ savingProduct.accountingMappings.overdraftPortfolioControl.name }} -
+ -

Liabilities

+ + + + -
- Saving control: - ({{ savingProduct.accountingMappings.savingsControlAccount.glCode }}) {{ savingProduct.accountingMappings.savingsControlAccount.name }} - Savings transfers in suspense: - ({{ savingProduct.accountingMappings.transfersInSuspenseAccount.glCode }}) {{ savingProduct.accountingMappings.transfersInSuspenseAccount.name }} -
- Escheat liability: - ({{ savingProduct.accountingMappings.escheatLiabilityAccount.glCode }}) {{ savingProduct.accountingMappings.escheatLiabilityAccount.name }} -
-
+ + + + -

Expenses

+ + -
- Interest on savings: - ({{ savingProduct.accountingMappings.interestOnSavingsAccount.glCode }}) {{ savingProduct.accountingMappings.interestOnSavingsAccount.name }} - Write-off: - ({{ savingProduct.accountingMappings.writeOffAccount.glCode }}) {{ savingProduct.accountingMappings.writeOffAccount.name }} -
- -

Income

- -
- Income from fees: - ({{ savingProduct.accountingMappings.incomeFromFeeAccount.glCode }}) {{ savingProduct.accountingMappings.incomeFromFeeAccount.name }} - Income from penalties: - ({{ savingProduct.accountingMappings.incomeFromPenaltyAccount.glCode }}) {{ savingProduct.accountingMappings.incomeFromPenaltyAccount.name }} - Overdraft Interest Income: - ({{ savingProduct.accountingMappings.incomeFromInterest.glCode }}) {{ savingProduct.accountingMappings.incomeFromInterest.name }} -
- -
- -

Advanced Accounting Rules

- - - -
- -

Fund Sources for Payment Channels

- -
Penalty + {{ penaltyIncome.charge.name }} + Income Account + ({{ penaltyIncome.incomeAccount.glCode }}) {{ penaltyIncome.incomeAccount.name }} +
- - - - - - - - - - - - - - -
Payment Type - {{ paymentFundSource.paymentType.name }} - Fund Source - ({{ paymentFundSource.fundSourceAccount.glCode }}) {{ paymentFundSource.fundSourceAccount.name }} -
- -
- -
- -

Fees to Specific Income Accounts

- - - - - - - - - - - - - - - - -
Fees - {{ feesIncome.charge.name }} - Income Account - ({{ feesIncome.incomeAccount.glCode }}) {{ feesIncome.incomeAccount.name }} -
- -
- -
- -

Penalties to Specific Income Accounts

- - - - - - - - - - - - - - - - -
Penalty - {{ penaltyIncome.charge.name }} - Income Account - ({{ penaltyIncome.incomeAccount.glCode }}) {{ penaltyIncome.incomeAccount.name }} -
- -
- -
+
- +
- +
diff --git a/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.scss b/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.scss index 8f6633e58..e71120a64 100644 --- a/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.scss +++ b/src/app/products/saving-products/view-saving-product/saving-product-general-tab/saving-product-general-tab.component.scss @@ -3,6 +3,10 @@ .tab-container { padding: 1%; margin: 1%; + + div: { + margin-top: 3px; + } } .mat-h3 { diff --git a/src/app/savings/common-resolvers/savings-account-transaction.resolver.ts b/src/app/savings/common-resolvers/savings-account-transaction.resolver.ts index f30c75545..0f6db6813 100644 --- a/src/app/savings/common-resolvers/savings-account-transaction.resolver.ts +++ b/src/app/savings/common-resolvers/savings-account-transaction.resolver.ts @@ -26,7 +26,7 @@ export class SavingsAccountTransactionResolver implements Resolve { */ resolve(route: ActivatedRouteSnapshot): Observable { const savingAccountId = route.parent.paramMap.get('savingAccountId'); - const transactionId = route.paramMap.get('id'); + const transactionId = route.parent.paramMap.get('id'); return this.savingsService.getSavingsAccountTransaction(savingAccountId, transactionId); } diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html index 0a97121e5..9deac5d57 100644 --- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html +++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html @@ -44,12 +44,17 @@ {{ transaction.runningBalance | formatNumber }} - - View Reciept + + Actions + diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts index 8464efe7e..0919f6fdc 100644 --- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts +++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts @@ -20,7 +20,7 @@ export class TransactionsTabComponent implements OnInit { /** Transactions Data */ transactionsData: any; /** Columns to be displayed in transactions table. */ - displayedColumns: string[] = ['id', 'date', 'transactionType', 'debit', 'credit', 'balance', 'viewReciept']; + displayedColumns: string[] = ['id', 'date', 'transactionType', 'debit', 'credit', 'balance', 'actions']; /** Data source for transactions table. */ dataSource: MatTableDataSource; @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @@ -75,7 +75,7 @@ export class TransactionsTabComponent implements OnInit { if (transactionsData.transfer) { this.router.navigate([`account-transfers/account-transfers/${transactionsData.transfer.id}`], { relativeTo: this.route }); } else { - this.router.navigate([transactionsData.id], { relativeTo: this.route }); + this.router.navigate([transactionsData.id, 'general'], { relativeTo: this.route }); } } diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.html b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.html new file mode 100644 index 000000000..debe4eb19 --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.html @@ -0,0 +1 @@ +

savings-transaction-datatable-tab works!

diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.scss b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.spec.ts b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.spec.ts new file mode 100644 index 000000000..5ed60eb5b --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SavingsTransactionDatatableTabComponent } from './savings-transaction-datatable-tab.component'; + +describe('SavingsTransactionDatatableTabComponent', () => { + let component: SavingsTransactionDatatableTabComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SavingsTransactionDatatableTabComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SavingsTransactionDatatableTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.ts b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.ts new file mode 100644 index 000000000..2c29b2952 --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-datatable-tab/savings-transaction-datatable-tab.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'mifosx-savings-transaction-datatable-tab', + templateUrl: './savings-transaction-datatable-tab.component.html', + styleUrls: ['./savings-transaction-datatable-tab.component.scss'] +}) +export class SavingsTransactionDatatableTabComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.html b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.html new file mode 100644 index 000000000..f169c4ded --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.html @@ -0,0 +1,90 @@ +
+ + + + + + + +
+ +
+ + + + + +
+ +
+ Transaction Id +
+ +
+ {{ transactionData.id }} +
+ +
+ Type +
+ +
+ {{ transactionData.transactionType.value }} +
+ +
+ Transaction Date +
+ +
+ {{ transactionData.date | dateFormat }} +
+ +
+ Currency +
+ +
+ {{ transactionData.currency.name }} +
+ +
+ Amount +
+ +
+ {{ transactionData.amount | currency }} {{ transactionData.currency.code }} +
+ +
+ Note +
+ +
+ {{ transactionData.note }} +
+ + + + +
+ +
+ +
+
+ +
+ +
diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.scss b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.scss new file mode 100644 index 000000000..fb9843d66 --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.scss @@ -0,0 +1,14 @@ +.container { + max-width: 37rem; + .content { + div { + margin: 1rem 0; + word-wrap: break-word; + } + + mifosx-transaction-payment-detail { + width: 100%; + margin-bottom: 20px; + } + } +} diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.spec.ts b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.spec.ts new file mode 100644 index 000000000..410f95fe9 --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SavingsTransactionGeneralTabComponent } from './savings-transaction-general-tab.component'; + +describe('SavingsTransactionGeneralTabComponent', () => { + let component: SavingsTransactionGeneralTabComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SavingsTransactionGeneralTabComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SavingsTransactionGeneralTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.ts b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.ts new file mode 100644 index 000000000..4c331ffc8 --- /dev/null +++ b/src/app/savings/savings-account-view/transactions/view-transaction/savings-transaction-general-tab/savings-transaction-general-tab.component.ts @@ -0,0 +1,67 @@ +import { Component, OnInit } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Dates } from 'app/core/utils/dates'; +import { ReleaseAmountDialogComponent } from 'app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component'; +import { UndoTransactionDialogComponent } from 'app/savings/savings-account-view/custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component'; +import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; + +@Component({ + selector: 'mifosx-savings-transaction-general-tab', + templateUrl: './savings-transaction-general-tab.component.html', + styleUrls: ['./savings-transaction-general-tab.component.scss'] +}) +export class SavingsTransactionGeneralTabComponent implements OnInit { + + accountId: string; + transactionId: string; + transactionData: any; + + constructor(private savingsService: SavingsService, + private route: ActivatedRoute, + private dateUtils: Dates, + private router: Router, + public dialog: MatDialog, + private settingsService: SettingsService) { + this.route.data.subscribe((data: { savingsAccountTransaction: any }) => { + this.accountId = this.route.parent.snapshot.params['savingAccountId']; + this.transactionData = data.savingsAccountTransaction; + }); + } + + ngOnInit(): void { + } + + releaseAmount(): void { + const releaseAmountDialogRef = this.dialog.open(ReleaseAmountDialogComponent); + releaseAmountDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + const data = {}; + this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'releaseAmount', data, this.transactionData.id).subscribe(() => { + this.router.navigate(['../..'], { relativeTo: this.route }); + }); + } + }); + } + + undoTransaction(): void { + const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent); + undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; + const data = { + transactionDate: this.dateUtils.formatDate(this.transactionData.date && new Date(this.transactionData.date), dateFormat), + transactionAmount: 0, + dateFormat, + locale + }; + this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, this.transactionData.id).subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + +} diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html index e578a8d57..af16e478f 100644 --- a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html +++ b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html @@ -1,110 +1,18 @@ -