@@ -5,15 +5,29 @@ import {
5
5
OnInit ,
6
6
} from '@angular/core' ;
7
7
8
- import { ComponentLayerRef , LayerRef , LayerService } from '@vcl/ng-vcl' ;
8
+ import { LayerRef , LayerService } from '@vcl/ng-vcl' ;
9
9
10
10
import { ROUTER } from '@console-core/config' ;
11
+ import {
12
+ IoRestorecommerceFulfillmentParcel ,
13
+ Maybe ,
14
+ } from '@console-core/graphql' ;
11
15
import { IFulfillment } from '@console-core/types' ;
12
16
17
+ import { FulfilmentLabelModalComponent } from './view/fulfillment-label-modal.component' ;
18
+
13
19
@Component ( {
14
20
selector : 'app-module-fulfillment-view-details' ,
15
21
templateUrl : './fulfillment-view-details.component.html' ,
16
22
changeDetection : ChangeDetectionStrategy . OnPush ,
23
+ styles : [
24
+ `
25
+ .clickable-label {
26
+ color: #ffae44;
27
+ cursor: pointer;
28
+ }
29
+ ` ,
30
+ ] ,
17
31
standalone : false ,
18
32
} )
19
33
export class FulfillmentViewDetailsComponent implements OnInit {
@@ -27,74 +41,30 @@ export class FulfillmentViewDetailsComponent implements OnInit {
27
41
constructor ( private layerService : LayerService ) { }
28
42
29
43
ngOnInit ( ) : void {
30
- this . labelModalLayer = this . layerService . create ( LabelModalComponent , {
31
- closeOnBackdropClick : false ,
32
- closeOnEscape : false ,
33
- } ) ;
44
+ this . labelModalLayer = this . layerService . create (
45
+ FulfilmentLabelModalComponent ,
46
+ {
47
+ closeOnBackdropClick : false ,
48
+ closeOnEscape : false ,
49
+ }
50
+ ) ;
34
51
}
35
52
36
- onClickLabel ( ) {
53
+ onClickLabel ( parcelId : Maybe < string > | undefined ) {
54
+ const parcels = ( this . fulfillment . packaging ?. parcels ||
55
+ [ ] ) as IoRestorecommerceFulfillmentParcel [ ] ;
56
+
57
+ const parcel = parcels . find ( ( parcel ) => parcel . id === parcelId ) ;
58
+
37
59
this . labelModalLayer
38
60
. open ( {
39
61
data : {
40
62
title : '' ,
63
+ parcel,
41
64
} ,
42
65
} )
43
66
. subscribe ( ( result ) => {
44
67
console . log ( result ?. value ) ;
45
68
} ) ;
46
69
}
47
70
}
48
-
49
- @Component ( {
50
- selector : 'app-module-fulfillment-label-modal' ,
51
- template : `
52
- <vcl-panel-dialog
53
- [showCloseButton]="true"
54
- (close)="close()"
55
- >
56
- <vcl-panel-title>Label</vcl-panel-title>
57
- <vcl-data-list
58
- mode="none"
59
- [noBorder]="true"
60
- >
61
- <!-- <vcl-data-list-header>
62
- <h2>Kittens</h2>
63
- </vcl-data-list-header> -->
64
- <vcl-data-list-item>
65
- <ng-container *ngTemplateOutlet="labelPropTemplate"></ng-container>
66
- </vcl-data-list-item>
67
- </vcl-data-list>
68
- </vcl-panel-dialog>
69
-
70
- <ng-template #labelPropTemplate>
71
- <div class="flex row justify-content-between align-items-center">
72
- <span>Quantity</span>
73
- <span>4</span>
74
- </div>
75
- </ng-template>
76
- ` ,
77
- styles : [
78
- `
79
- vcl-data-list-item {
80
- display: flex;
81
- flex-direction: column;
82
- }
83
- ` ,
84
- ] ,
85
- changeDetection : ChangeDetectionStrategy . OnPush ,
86
- standalone : false ,
87
- } )
88
- export class LabelModalComponent {
89
- constructor ( private layer : ComponentLayerRef ) { }
90
-
91
- get title ( ) {
92
- return this . layer . data . title ;
93
- }
94
-
95
- close ( value ?: string ) {
96
- this . layer . close ( {
97
- value,
98
- } ) ;
99
- }
100
- }
0 commit comments