app.component.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  2. <!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
  3. <!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
  4. <!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * -->
  5. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  6. <!-- * * * * * * * * * Delete the template below * * * * * * * * * -->
  7. <!-- * * * * * * * to get started with your project! * * * * * * * -->
  8. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  9. <style>
  10. </style>
  11. <mat-toolbar class="toolbar" color="primary">
  12. <div class="toolbar-container">
  13. <button mat-icon-button aria-label="menu">
  14. <mat-icon>menu</mat-icon>
  15. </button>
  16. <button mat-icon-button [routerLink]="'/'">
  17. <mat-icon>home</mat-icon>
  18. </button>
  19. <h2 id="title"><i>{{pbTitle.getTitle()}}</i></h2>
  20. <div class="right-toolbar-panel">
  21. <ng-container *ngTemplateOutlet="toolbarItems"/>
  22. </div>
  23. </div>
  24. </mat-toolbar>
  25. <mat-toolbar class="mobile-toolbar" color="primary">
  26. <ng-container *ngTemplateOutlet="toolbarItems"/>
  27. </mat-toolbar>
  28. <ng-template #toolbarItems>
  29. @for (item of [
  30. {id:'home',icon:'home',link:'/',title:'Home',key:'home_page'},
  31. {id:'notifs',icon:'notifications',title:'Notifications',key:'notifs',menu:notifications},
  32. {id:'user',icon:'account_circle',menu:userMenu,title:'User & Settings',key:'#{user} & #{settings}'}
  33. ]; track $index) {
  34. @switch (true) {
  35. @case (item.link !== undefined) {
  36. <div id="{{item.id}}" class="toolbar-item" [routerLink]="item.link" replaceUrl="{{item.id==='home'?'true':'false'}}">
  37. <mat-icon>{{item.icon}}</mat-icon>
  38. <mat-label>{{(item.key|tr:item.title)}}</mat-label>
  39. </div>
  40. }
  41. @case (item.id === 'user') {
  42. <div id="{{item.id}}" class="toolbar-item" [matMenuTriggerFor]="item.menu">
  43. @if (loginService?.user?.pictures?.length > 0) {
  44. <img title="{{'profile_pic'|tr:'Profile Picture'}}" class="profile-pic" src="{{loginService?.user?.pictures[0]?.value}}">
  45. }
  46. @else {
  47. <mat-icon id="{{item.key}}-icon">{{item.icon}}</mat-icon>
  48. }
  49. <mat-label>{{(item.key|tr:item.title)}}</mat-label>
  50. </div>
  51. }
  52. @case (item.menu !== undefined) {
  53. <div id="{{item.id}}" class="toolbar-item" [matMenuTriggerFor]="item.menu">
  54. <mat-icon id="{{item.key}}-icon">{{item.icon}}</mat-icon>
  55. <mat-label>{{(item.key|tr:item.title)}}</mat-label>
  56. @if (item.key === 'notifs' && notificationCount > 0) {
  57. <div class="count">{{notificationCount}}</div>
  58. }
  59. </div>
  60. }
  61. @default {
  62. <div id="{{item.id}}" class="toolbar-item">
  63. <mat-icon>{{item.icon}}</mat-icon>
  64. <mat-label>{{(item.key|tr:item.title)}}</mat-label>
  65. </div>
  66. }
  67. }
  68. }
  69. </ng-template>
  70. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  71. <!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
  72. <!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
  73. <!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
  74. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  75. <!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
  76. <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
  77. <div [ngClass]="theme" class="container">
  78. <div class="main">
  79. <router-outlet></router-outlet>
  80. </div>
  81. </div>
  82. <footer>
  83. © {{currentDate.getFullYear()}}
  84. {{cs.getLabel('companyName.full','Software Optima Sdn. Bhd.')}}
  85. <a class="version-short" href="../assets/realease_notes.html" target="_blank">(ver. {{cs.info?.version}})</a>
  86. </footer>
  87. <!--menus-->
  88. <mat-menu #userMenu="matMenu">
  89. <button mat-menu-item>{{'my_account'|tr:'My Account'}}</button>
  90. <button mat-menu-item [matMenuTriggerFor]="settings">{{'settings'|tr:'Settings'}}</button>
  91. <button mat-menu-item (click)="loginService.logout()" [disabled]="!loginService.user">
  92. <mat-icon>logout</mat-icon>
  93. {{'logout'|tr:'Logout'}}</button>
  94. </mat-menu>
  95. <mat-menu #settings="matMenu">
  96. <button mat-menu-item [matMenuTriggerFor]="themes">{{'theme'|tr:'Theme'}}</button>
  97. <button mat-menu-item [matMenuTriggerFor]="language">{{'language'|tr:'Language'}}</button>
  98. </mat-menu>
  99. <mat-menu #themes="matMenu">
  100. <button mat-menu-item [matMenuTriggerFor]="lightThemes">{{'light'|tr:'Light'}}</button>
  101. <button mat-menu-item [matMenuTriggerFor]="darkThemes">{{'dark'|tr:'Dark'}}</button>
  102. </mat-menu>
  103. <mat-menu #lightThemes="matMenu">
  104. @for(theme of [
  105. {name:'theme',label:'main'|tr:'Blue',color:"#3F51B6"},
  106. {name:'theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
  107. ]; track $index) {
  108. <button mat-menu-item (click)="cs.theming.changeTheme(theme.name)">
  109. <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
  110. {{theme.label}}</button>
  111. }
  112. </mat-menu>
  113. <mat-menu #darkThemes="matMenu">
  114. @for(theme of [
  115. {name:'dark-theme',label:'main'|tr:'Blue',color:"#3F51B6"},
  116. {name:'dark-theme-pink',label:'pink'|tr:'Pink',color:"#e91e63"}
  117. ]; track $index) {
  118. <button mat-menu-item (click)="cs.theming.changeTheme(theme.name)">
  119. <mat-icon style="color:{{theme.color}}">fiber_manual_record</mat-icon>
  120. {{theme.label}}</button>
  121. }
  122. </mat-menu>
  123. <mat-menu #language="matMenu">
  124. @for(lang of [
  125. {name:'en',label:'English',picture:'https://cdn.swopt.com/media/images/flags/GBR.png'},
  126. {name:'zh',label:'简体中文',picture:'https://cdn.swopt.com/media/images/flags/CHN.png'},
  127. {name:'ms',label:'Melayu',picture:'https://cdn.swopt.com/media/images/flags/MAS.png'}
  128. ];track $index) {
  129. <button mat-menu-item (click)="changeLanguage(lang.name)">
  130. <div class="language-flag" [style.background-image]="'url('+lang.picture+')'">&nbsp;</div>
  131. {{lang.label}}
  132. </button>
  133. }
  134. </mat-menu>
  135. <mat-menu #notifications="matMenu">
  136. <notification (click)="$event.stopPropagation()"/>
  137. </mat-menu>