iptdevs-design-system 1.3.9 → 1.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,14 @@ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
8
  import Swal from 'sweetalert2';
9
9
  import * as i1$2 from '@angular/common/http';
10
10
  import { HttpHeaders } from '@angular/common/http';
11
+ import * as i4 from '@angular/material/sidenav';
12
+ import { MatSidenavModule } from '@angular/material/sidenav';
13
+ import * as i5 from '@angular/material/toolbar';
14
+ import { MatToolbarModule } from '@angular/material/toolbar';
15
+ import * as i6 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i7 from '@angular/material/list';
18
+ import { MatListModule } from '@angular/material/list';
11
19
  import * as i1$3 from '@angular/router';
12
20
 
13
21
  class AsideButtonComponent {
@@ -635,9 +643,10 @@ class UserService {
635
643
  this.generateRequestParams(token);
636
644
  return this.http.post(serviceUrl, this.httpOptions);
637
645
  }
638
- getUserByIdCard(value) {
639
- let serviceUrl = this.SERVICE_URL + 'user/id_card/' + value;
640
- return this.http.get(serviceUrl);
646
+ getRoutesForRole(token) {
647
+ let serviceUrl = this.SERVICE_URL + 'post/routes/role';
648
+ this.generateRequestParams(token);
649
+ return this.http.post(serviceUrl, this.httpOptions);
641
650
  }
642
651
  generateRequestParams(param) {
643
652
  this.httpOptions = {
@@ -762,9 +771,32 @@ class BaseService {
762
771
  }
763
772
  getUserRole() {
764
773
  let user = this.storageService.getCurrentUser()?.role;
765
- return user === undefined ? -1 : Math.floor(user / 10);
766
- }
767
- loginService(request) {
774
+ return user === undefined ? -1 : user;
775
+ }
776
+ jsonToArray(data) {
777
+ var response = [];
778
+ data.forEach((element) => {
779
+ var object = [];
780
+ for (var clave in element) {
781
+ if (element.hasOwnProperty(clave)) {
782
+ if (typeof element[clave] == 'object') {
783
+ element[clave] = this.subJsonToArray(element[clave]);
784
+ }
785
+ object.push(element[clave]);
786
+ }
787
+ }
788
+ response.push(object);
789
+ });
790
+ return response;
791
+ }
792
+ subJsonToArray(data) {
793
+ var object = '';
794
+ for (var clave in data) {
795
+ if (clave != 'code') {
796
+ object += '\n' + data[clave];
797
+ }
798
+ }
799
+ return object;
768
800
  }
769
801
  }
770
802
  BaseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: BaseService, deps: [{ token: UserService }, { token: StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -779,29 +811,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
779
811
  class LoginFormComponent {
780
812
  constructor(fb, baseService) {
781
813
  this.baseService = baseService;
782
- this.background = true;
783
- this.email = new EventEmitter();
784
- this.password = new EventEmitter();
814
+ this.isLogged = new EventEmitter();
785
815
  this.loginForm = fb.group({
786
816
  email: ['', [Validators.required]],
787
817
  password: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(15)]],
788
818
  });
789
819
  }
790
820
  login(data) {
791
- this.baseService.webLogin(data.controls['email'].value, data.controls['password'].value);
792
- this.email.emit(data.controls['email'].value);
793
- this.password.emit(data.controls['password'].value);
794
- this.loginForm.controls['email'].setValue('');
795
- this.loginForm.controls['password'].setValue('');
821
+ this.baseService.webLogin(data.controls['email'].value, data.controls['password'].value).then((isLogged) => {
822
+ this.isLogged.emit(isLogged);
823
+ });
796
824
  }
797
825
  }
798
826
  LoginFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: LoginFormComponent, deps: [{ token: i1$1.FormBuilder }, { token: BaseService }], target: i0.ɵɵFactoryTarget.Component });
799
- LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: LoginFormComponent, selector: "ipt-login-form", inputs: { background: "background", image: "image" }, outputs: { email: "email", password: "password" }, ngImport: i0, template: `
800
- <div [ngClass]="{'with-background': background}" class="form-container">
801
-
802
- <img [src]="image" alt="wolf" width="150px">
827
+ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: LoginFormComponent, selector: "ipt-login-form", outputs: { isLogged: "isLogged" }, ngImport: i0, template: `
828
+ <div class="form-container">
803
829
 
804
- <h2>IPT PLATFORM</h2>
830
+ <h2 style="text-align: center;">IPT PLATFORM</h2>
805
831
  <hr>
806
832
 
807
833
  <form (ngSubmit)="login(loginForm)" [formGroup]="loginForm">
@@ -820,7 +846,6 @@ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
820
846
  </form>
821
847
 
822
848
  <div class="button-container">
823
- <a href="">Forget password</a>
824
849
  <ipt-button
825
850
  [label]="'Login'"
826
851
  [primary]="true"
@@ -829,23 +854,14 @@ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
829
854
  ></ipt-button>
830
855
  </div>
831
856
 
832
- <footer>
833
- <ipt-button
834
- [label]="'Register'"
835
- [primary]="false"
836
- ></ipt-button>
837
- </footer>
838
-
839
857
  </div>
840
- `, isInline: true, styles: [".form-container{display:grid;grid-template-columns:1fr;justify-items:center;width:350px}.with-background{background-color:#fff;border-radius:25px;box-shadow:#32325d40 0 50px 100px -20px,#0000004d 0 30px 60px -30px}h2{color:#1c77f7}hr{width:80%}form{margin-bottom:60px;display:grid;grid-template-columns:1fr;grid-gap:30px;gap:30px;width:100%}.button-container{margin-bottom:70px;align-items:center;display:flex;gap:50px}footer{background-color:#1c77f7;border-top-left-radius:25px;border-top-right-radius:25px;width:100%;height:100px;display:flex;align-items:center;justify-content:center}\n"], components: [{ type: InputComponent, selector: "ipt-input", inputs: ["inputType", "placeHolder", "validateText", "list", "iconUrl", "control"] }, { type: ButtonComponent, selector: "ipt-button", inputs: ["primary", "size", "label", "buttonType", "isEnabled"], outputs: ["onClick"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
858
+ `, isInline: true, styles: [".form-container{display:grid;grid-template-columns:1fr;justify-items:center;width:350px}.with-background{background-color:#fff;border-radius:25px;box-shadow:#32325d40 0 50px 100px -20px,#0000004d 0 30px 60px -30px}h2{color:#1c77f7}hr{width:80%}form{margin-bottom:60px;display:grid;grid-template-columns:1fr;grid-gap:30px;gap:30px;width:100%}.button-container{margin-bottom:70px;align-items:center;display:flex;gap:50px}footer{background-color:#1c77f7;border-top-left-radius:25px;border-top-right-radius:25px;width:100%;height:100px;display:flex;align-items:center;justify-content:center}\n"], components: [{ type: InputComponent, selector: "ipt-input", inputs: ["inputType", "placeHolder", "validateText", "list", "iconUrl", "control"] }, { type: ButtonComponent, selector: "ipt-button", inputs: ["primary", "size", "label", "buttonType", "isEnabled"], outputs: ["onClick"] }], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
841
859
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: LoginFormComponent, decorators: [{
842
860
  type: Component,
843
861
  args: [{ selector: 'ipt-login-form', template: `
844
- <div [ngClass]="{'with-background': background}" class="form-container">
845
-
846
- <img [src]="image" alt="wolf" width="150px">
862
+ <div class="form-container">
847
863
 
848
- <h2>IPT PLATFORM</h2>
864
+ <h2 style="text-align: center;">IPT PLATFORM</h2>
849
865
  <hr>
850
866
 
851
867
  <form (ngSubmit)="login(loginForm)" [formGroup]="loginForm">
@@ -864,7 +880,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
864
880
  </form>
865
881
 
866
882
  <div class="button-container">
867
- <a href="">Forget password</a>
868
883
  <ipt-button
869
884
  [label]="'Login'"
870
885
  [primary]="true"
@@ -873,36 +888,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
873
888
  ></ipt-button>
874
889
  </div>
875
890
 
876
- <footer>
877
- <ipt-button
878
- [label]="'Register'"
879
- [primary]="false"
880
- ></ipt-button>
881
- </footer>
882
-
883
891
  </div>
884
892
  `, styles: [".form-container{display:grid;grid-template-columns:1fr;justify-items:center;width:350px}.with-background{background-color:#fff;border-radius:25px;box-shadow:#32325d40 0 50px 100px -20px,#0000004d 0 30px 60px -30px}h2{color:#1c77f7}hr{width:80%}form{margin-bottom:60px;display:grid;grid-template-columns:1fr;grid-gap:30px;gap:30px;width:100%}.button-container{margin-bottom:70px;align-items:center;display:flex;gap:50px}footer{background-color:#1c77f7;border-top-left-radius:25px;border-top-right-radius:25px;width:100%;height:100px;display:flex;align-items:center;justify-content:center}\n"] }]
885
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: BaseService }]; }, propDecorators: { background: [{
886
- type: Input
887
- }], image: [{
888
- type: Input
889
- }], email: [{
890
- type: Output
891
- }], password: [{
893
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: BaseService }]; }, propDecorators: { isLogged: [{
892
894
  type: Output
893
895
  }] } });
894
896
 
895
- class RegisterFormComponent {
896
- constructor() { }
897
+ class SidenavComponent {
898
+ constructor(userService, baseService, storageService) {
899
+ this.userService = userService;
900
+ this.baseService = baseService;
901
+ this.storageService = storageService;
902
+ this.pageChangeEvent = new EventEmitter();
903
+ this.routes = [];
904
+ }
897
905
  ngOnInit() {
906
+ let user = this.storageService.getCurrentUser()?.token;
907
+ let token = user === undefined ? '' : user;
908
+ this.userService.getRoutesForRole(token).subscribe(response => {
909
+ this.routes = this.baseService.jsonToArray(response.data);
910
+ });
911
+ }
912
+ clickPage(event) {
913
+ this.pageChangeEvent.emit(event);
898
914
  }
899
915
  }
900
- RegisterFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: RegisterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
901
- RegisterFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: RegisterFormComponent, selector: "lib-register-form", ngImport: i0, template: "<p>register-form works!</p>\n", styles: [""] });
902
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: RegisterFormComponent, decorators: [{
916
+ SidenavComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: SidenavComponent, deps: [{ token: UserService }, { token: BaseService }, { token: StorageService }], target: i0.ɵɵFactoryTarget.Component });
917
+ SidenavComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: SidenavComponent, selector: "ipt-sidenav", inputs: { department: "department", setPage: "setPage" }, outputs: { pageChangeEvent: "pageChangeEvent" }, ngImport: i0, template: `
918
+ <mat-sidenav #sidenav mode="push">
919
+ <mat-toolbar color="primary">
920
+ <span>{{department}}</span>
921
+ <span class="spacer"></span>
922
+ <button mat-icon-button (click)="sidenav.toggle()">
923
+ <mat-icon>Menu</mat-icon>
924
+ </button>
925
+ </mat-toolbar>
926
+
927
+ <mat-nav-list>
928
+ <nav class="flex-container-menu" (click)="sidenav.toggle()" *ngFor="let route of routes">
929
+ <ipt-aside-button
930
+ [buttonActive]="this.setPage === route.page"
931
+ [url]="route.url"
932
+ [type]="route.type"
933
+ [icon]="route.icon"
934
+ [text]="route.text"
935
+ (isClicked)="clickPage(route.page)"
936
+ >
937
+ </ipt-aside-button>
938
+ </nav>
939
+ </mat-nav-list>
940
+ </mat-sidenav>
941
+ `, isInline: true, styles: [""], components: [{ type: i4.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { type: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i7.MatNavList, selector: "mat-nav-list", inputs: ["disableRipple", "disabled"], exportAs: ["matNavList"] }, { type: AsideButtonComponent, selector: "ipt-aside-button", inputs: ["icon", "text", "type", "url", "textColor", "buttonActive"], outputs: ["isClicked"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: SidenavComponent, decorators: [{
903
943
  type: Component,
904
- args: [{ selector: 'lib-register-form', template: "<p>register-form works!</p>\n", styles: [""] }]
905
- }], ctorParameters: function () { return []; } });
944
+ args: [{ selector: 'ipt-sidenav', template: `
945
+ <mat-sidenav #sidenav mode="push">
946
+ <mat-toolbar color="primary">
947
+ <span>{{department}}</span>
948
+ <span class="spacer"></span>
949
+ <button mat-icon-button (click)="sidenav.toggle()">
950
+ <mat-icon>Menu</mat-icon>
951
+ </button>
952
+ </mat-toolbar>
953
+
954
+ <mat-nav-list>
955
+ <nav class="flex-container-menu" (click)="sidenav.toggle()" *ngFor="let route of routes">
956
+ <ipt-aside-button
957
+ [buttonActive]="this.setPage === route.page"
958
+ [url]="route.url"
959
+ [type]="route.type"
960
+ [icon]="route.icon"
961
+ [text]="route.text"
962
+ (isClicked)="clickPage(route.page)"
963
+ >
964
+ </ipt-aside-button>
965
+ </nav>
966
+ </mat-nav-list>
967
+ </mat-sidenav>
968
+ `, styles: [""] }]
969
+ }], ctorParameters: function () { return [{ type: UserService }, { type: BaseService }, { type: StorageService }]; }, propDecorators: { department: [{
970
+ type: Input
971
+ }], setPage: [{
972
+ type: Input
973
+ }], pageChangeEvent: [{
974
+ type: Output
975
+ }] } });
906
976
 
907
977
  class ComponentsModule {
908
978
  }
@@ -918,10 +988,14 @@ ComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
918
988
  SelectComponent,
919
989
  TextLinkComponent,
920
990
  LoginFormComponent,
921
- RegisterFormComponent], imports: [CommonModule,
991
+ SidenavComponent], imports: [CommonModule,
922
992
  BrowserModule,
923
993
  FormsModule,
924
- ReactiveFormsModule], exports: [AsideButtonComponent,
994
+ ReactiveFormsModule,
995
+ MatSidenavModule,
996
+ MatToolbarModule,
997
+ MatIconModule,
998
+ MatListModule], exports: [AsideButtonComponent,
925
999
  ButtonComponent,
926
1000
  CheckboxComponent,
927
1001
  DatalistComponent,
@@ -931,12 +1005,17 @@ ComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
931
1005
  RadioComponent,
932
1006
  SelectComponent,
933
1007
  TextLinkComponent,
934
- LoginFormComponent] });
1008
+ LoginFormComponent,
1009
+ SidenavComponent] });
935
1010
  ComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ComponentsModule, imports: [[
936
1011
  CommonModule,
937
1012
  BrowserModule,
938
1013
  FormsModule,
939
1014
  ReactiveFormsModule,
1015
+ MatSidenavModule,
1016
+ MatToolbarModule,
1017
+ MatIconModule,
1018
+ MatListModule
940
1019
  ]] });
941
1020
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ComponentsModule, decorators: [{
942
1021
  type: NgModule,
@@ -953,13 +1032,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
953
1032
  SelectComponent,
954
1033
  TextLinkComponent,
955
1034
  LoginFormComponent,
956
- RegisterFormComponent,
1035
+ SidenavComponent,
957
1036
  ],
958
1037
  imports: [
959
1038
  CommonModule,
960
1039
  BrowserModule,
961
1040
  FormsModule,
962
1041
  ReactiveFormsModule,
1042
+ MatSidenavModule,
1043
+ MatToolbarModule,
1044
+ MatIconModule,
1045
+ MatListModule
963
1046
  ],
964
1047
  exports: [
965
1048
  AsideButtonComponent,
@@ -973,6 +1056,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
973
1056
  SelectComponent,
974
1057
  TextLinkComponent,
975
1058
  LoginFormComponent,
1059
+ SidenavComponent,
976
1060
  ]
977
1061
  }]
978
1062
  }] });
@@ -1206,5 +1290,5 @@ class UserLoginRs {
1206
1290
  * Generated bundle index. Do not edit.
1207
1291
  */
1208
1292
 
1209
- export { AsideButtonComponent, BaseService, ButtonComponent, CheckboxComponent, ComponentsModule, CoreModule, CourseService, DatalistComponent, DesignSystemModule, InputComponent, LevelButtonComponent, LevelTextComponent, LoginFormComponent, ParameterService, RadioComponent, RedirectGuard, SelectComponent, Session, StorageService, SwitchService, TextLinkComponent, UserLoginRs, UserRs, UserService };
1293
+ export { AsideButtonComponent, BaseService, ButtonComponent, CheckboxComponent, ComponentsModule, CoreModule, CourseService, DatalistComponent, DesignSystemModule, InputComponent, LevelButtonComponent, LevelTextComponent, LoginFormComponent, ParameterService, RadioComponent, RedirectGuard, SelectComponent, Session, SidenavComponent, StorageService, SwitchService, TextLinkComponent, UserLoginRs, UserRs, UserService };
1210
1294
  //# sourceMappingURL=iptdevs-design-system.mjs.map