11import { Component , OnInit } from '@angular/core' ;
22import { WinboxService } from '@rbtech/angular-winbox' ;
33import { SimpleComponentComponent } from './simple-component/simple-component.component' ;
4+ import { SidebarMenuModel } from '@rbtechdev/angular-sidebar' ;
5+ import { ModalYesNoComponent } from './modal-yes-no/modal-yes-no.component' ;
6+ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' ;
7+ import { faQuestion } from '@fortawesome/free-solid-svg-icons/faQuestion' ;
48
59@Component ( {
610 selector : 'rbtech-root' ,
@@ -9,24 +13,116 @@ import { SimpleComponentComponent } from './simple-component/simple-component.co
913} )
1014export class AppComponent implements OnInit {
1115 title = 'winbox-example-app' ;
16+ faIcon = faQuestion ;
17+ menu : SidebarMenuModel = {
18+ sidebarTitle : 'SIDEBAR' ,
19+ status : '' ,
20+ username : 'USER' ,
21+ subtitle : 'Admin' ,
22+ sidebarTitleHref : '/home' ,
23+ sidebarUsrPicSrc : 'assets/user.png' ,
24+ placeholderSearch : 'Cerca...' ,
25+ isSearchVisible : true ,
26+ contentMenus : [
27+ {
28+ title : 'HEADER' ,
29+ type : 'header' ,
30+ visible : true ,
31+ badge : {
32+ visible : true ,
33+ class : 'badge bg-secondary' ,
34+ text : '4' ,
35+ } ,
36+ } ,
37+ {
38+ title : 'MENU 1' ,
39+ type : 'simple' ,
40+ visible : true ,
41+ icon : this . faIcon ,
42+ href : '/s' ,
43+ } ,
44+ {
45+ title : 'HEADER' ,
46+ type : 'header' ,
47+ visible : true ,
48+ } ,
49+ {
50+ title : 'MENU 1' ,
51+ type : 'dropdown' ,
52+ visible : true ,
53+ icon : this . faIcon ,
54+ href : '#' ,
55+ badge : {
56+ visible : true ,
57+ class : 'badge bg-secondary' ,
58+ text : '4' ,
59+ } ,
60+ subMenus : [
61+ {
62+ title : 'SUBMENU 1' ,
63+ visible : true ,
64+ href : '/g' ,
65+ badge : {
66+ visible : true ,
67+ class : 'badge bg-secondary' ,
68+ text : 'New' ,
69+ } ,
70+ } ,
71+ ] ,
72+ } ,
73+ ] ,
74+ footerMenus : [
75+ {
76+ type : 'simple' ,
77+ icon : this . faIcon ,
78+ } ,
79+ {
80+ type : 'dropdown' ,
81+ icon : this . faIcon ,
82+ dropdownHeaderTitle : 'Hello' ,
83+ href : '#' ,
84+ dropdownItems : [
85+ {
86+ text : 'HELLO' ,
87+ icon : this . faIcon ,
88+ subtitle : 'HELLO S' ,
89+ } ,
90+ ] ,
91+ } ,
92+ ] ,
93+ } ;
1294
13- constructor ( private winboxService : WinboxService ) { }
95+ constructor (
96+ private winboxService : WinboxService ,
97+ private modalService : NgbModal
98+ ) { }
1499
15100 ngOnInit ( ) : void {
16- this . winboxService . openWinBox < SimpleComponentComponent > (
17- {
18- title : 'Test' ,
19- height : '90%' ,
20- width : '40%' ,
21- x : 'center' ,
22- y : 'center' ,
23- index : 1057 ,
24- onclose : ( ) : boolean => {
25- return true ;
101+ const winboxInstance =
102+ this . winboxService . openWinBox < SimpleComponentComponent > (
103+ {
104+ title : 'Test' ,
105+ height : '90%' ,
106+ width : '40%' ,
107+ x : 'center' ,
108+ y : 'center' ,
109+ index : 1057 ,
110+ onclose : ( ) : boolean => {
111+ const modal = this . modalService . open ( ModalYesNoComponent ) ;
112+ modal . componentInstance . title = 'Titolo' ;
113+ modal . componentInstance . message = 'Vuoi chiudere winbox?' ;
114+ winboxInstance . winBox . minimize ( true ) ;
115+
116+ modal . result
117+ . then ( ( ) => {
118+ winboxInstance . winBox . close ( true ) ;
119+ } )
120+ . catch ( ( ) => winboxInstance . winBox . maximize ( false ) ) ;
121+ return false ;
122+ } ,
26123 } ,
27- } ,
28- SimpleComponentComponent
29- ) ;
124+ SimpleComponentComponent
125+ ) ;
30126 this . winboxService . showLastWinbox ( ) ;
31127 }
32128}
0 commit comments