@@ -12,6 +12,7 @@ import { MatSelect, MatSelectChange } from '@angular/material/select';
1212import { UbsAdminConfirmStatusChangePopUpComponent } from '../../ubs-admin-confirm-status-change-pop-up/ubs-admin-confirm-status-change-pop-up.component' ;
1313import { Store } from '@ngrx/store' ;
1414import { SetCursorWaite } from 'src/app/store/actions/ubs-admin.actions' ;
15+ import { AddOrderNotTakenOutReasonComponent } from '@ubs/ubs-admin/components/add-order-not-taken-out-reason/add-order-not-taken-out-reason.component' ;
1516
1617@Component ( {
1718 selector : 'app-table-cell-select' ,
@@ -116,6 +117,7 @@ export class TableCellSelectComponent implements OnInit {
116117 return ;
117118 }
118119
120+ const isNotTakenOut = [ 'Not taken out' , 'Не вивезли' ] . includes ( this . newOption ) ;
119121 const isCancelOption = [ 'Canceled' , 'Скасовано' ] . includes ( this . newOption ) ;
120122 const isConfirmOption = [ 'Сформовано' , 'Formed' , 'Confirmed' , 'Підтверджено' , 'Привезе сам' , 'Brought by himself' ] . includes (
121123 this . newOption
@@ -125,6 +127,8 @@ export class TableCellSelectComponent implements OnInit {
125127 this . openConfirmPopUp ( ) ;
126128 } else if ( isCancelOption ) {
127129 this . openCancelPopUp ( ) ;
130+ } else if ( isNotTakenOut ) {
131+ this . notTakenOutOpenPop ( ) ;
128132 } else if ( this . checkStatus && this . showPopUp ) {
129133 this . checkIfStatusConfirmed ( ) ;
130134 } else {
@@ -220,6 +224,21 @@ export class TableCellSelectComponent implements OnInit {
220224 } ) ;
221225 }
222226
227+ notTakenOutOpenPop ( ) : void {
228+ this . dialog
229+ . open ( AddOrderNotTakenOutReasonComponent , {
230+ hasBackdrop : true ,
231+ data : {
232+ id : this . id
233+ }
234+ } )
235+ . afterClosed ( )
236+ . pipe ( take ( 1 ) )
237+ . subscribe ( ( res ) => {
238+ res ? this . save ( ) : this . cancel ( ) ;
239+ } ) ;
240+ }
241+
223242 private filterStatuses ( ) : void {
224243 if ( this . nameOfColumn === 'orderStatus' ) {
225244 this . optional = this . orderService . getAvailableOrderStatuses ( this . key , this . optional ) ;
@@ -234,6 +253,6 @@ export class TableCellSelectComponent implements OnInit {
234253 }
235254
236255 private findKeyForNewOption ( ) : number {
237- return this . optional . findIndex ( ( item ) => item [ this . lang ] === this . newOption ) ;
256+ return this . optional . findIndex ( ( item ) => item [ this . lang === 'ua' ? 'uk' : this . lang ] === this . newOption ) ;
238257 }
239258}
0 commit comments