@@ -170,6 +170,10 @@ export class ViewTransactionComponent extends LoanAccountActionsBaseComponent im
170170 ) {
171171 this . allowUndo = false ;
172172 }
173+ if ( this . isWorkingCapital ) {
174+ this . allowEdition = false ;
175+ this . allowChargeback = false ;
176+ }
173177 } ) ;
174178 this . clientId = this . route . snapshot . params [ 'clientId' ] ;
175179 this . loanId = this . route . snapshot . params [ 'loanId' ] ;
@@ -291,27 +295,34 @@ export class ViewTransactionComponent extends LoanAccountActionsBaseComponent im
291295 if ( response . confirm ) {
292296 const locale = this . settingsService . language . code ;
293297 const dateFormat = this . settingsService . dateFormat ;
294- const data = {
295- transactionDate : this . dateUtils . formatDate (
296- this . transactionData . date && new Date ( this . transactionData . date ) ,
297- dateFormat
298- ) ,
299- transactionAmount : 0 ,
300- dateFormat,
301- locale
302- } ;
303298 const command = this . isWriteOff ( this . transactionType ) ? 'undowriteoff' : 'undo' ;
304- const transactionId = command === 'undowriteoff' ? null : this . transactionData . id ;
305- this . loansService
306- . executeLoansAccountTransactionsCommand ( accountId , command , data , transactionId )
307- . subscribe ( ( ) => {
308- this . router . navigate ( [ '../' ] , {
309- queryParams : {
310- productType : this . loanProductService . productType . value
311- } ,
312- relativeTo : this . route
313- } ) ;
299+ const navigateBack = ( ) =>
300+ this . router . navigate ( [ '../' ] , {
301+ queryParams : {
302+ productType : this . loanProductService . productType . value
303+ } ,
304+ relativeTo : this . route
314305 } ) ;
306+ if ( this . isWorkingCapital ) {
307+ const payload = { dateFormat, locale } ;
308+ this . loansService
309+ . applyWorkingCapitalLoanActionCommand ( accountId , payload , command , this . transactionData . id )
310+ . subscribe ( navigateBack ) ;
311+ } else {
312+ const data = {
313+ transactionDate : this . dateUtils . formatDate (
314+ this . transactionData . date && new Date ( this . transactionData . date ) ,
315+ dateFormat
316+ ) ,
317+ transactionAmount : 0 ,
318+ dateFormat,
319+ locale
320+ } ;
321+ const transactionId = command === 'undowriteoff' ? null : this . transactionData . id ;
322+ this . loansService
323+ . executeLoansAccountTransactionsCommand ( accountId , command , data , transactionId )
324+ . subscribe ( navigateBack ) ;
325+ }
315326 }
316327 } ) ;
317328 }
0 commit comments