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 = {
@@ -763,9 +772,32 @@ class BaseService {
763
772
  getUserRole() {
764
773
  var _a;
765
774
  let user = (_a = this.storageService.getCurrentUser()) === null || _a === void 0 ? void 0 : _a.role;
766
- return user === undefined ? -1 : Math.floor(user / 10);
767
- }
768
- loginService(request) {
775
+ return user === undefined ? -1 : user;
776
+ }
777
+ jsonToArray(data) {
778
+ var response = [];
779
+ data.forEach((element) => {
780
+ var object = [];
781
+ for (var clave in element) {
782
+ if (element.hasOwnProperty(clave)) {
783
+ if (typeof element[clave] == 'object') {
784
+ element[clave] = this.subJsonToArray(element[clave]);
785
+ }
786
+ object.push(element[clave]);
787
+ }
788
+ }
789
+ response.push(object);
790
+ });
791
+ return response;
792
+ }
793
+ subJsonToArray(data) {
794
+ var object = '';
795
+ for (var clave in data) {
796
+ if (clave != 'code') {
797
+ object += '\n' + data[clave];
798
+ }
799
+ }
800
+ return object;
769
801
  }
770
802
  }
771
803
  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 });
@@ -780,29 +812,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
780
812
  class LoginFormComponent {
781
813
  constructor(fb, baseService) {
782
814
  this.baseService = baseService;
783
- this.background = true;
784
- this.email = new EventEmitter();
785
- this.password = new EventEmitter();
815
+ this.isLogged = new EventEmitter();
786
816
  this.loginForm = fb.group({
787
817
  email: ['', [Validators.required]],
788
818
  password: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(15)]],
789
819
  });
790
820
  }
791
821
  login(data) {
792
- this.baseService.webLogin(data.controls['email'].value, data.controls['password'].value);
793
- this.email.emit(data.controls['email'].value);
794
- this.password.emit(data.controls['password'].value);
795
- this.loginForm.controls['email'].setValue('');
796
- this.loginForm.controls['password'].setValue('');
822
+ this.baseService.webLogin(data.controls['email'].value, data.controls['password'].value).then((isLogged) => {
823
+ this.isLogged.emit(isLogged);
824
+ });
797
825
  }
798
826
  }
799
827
  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 });
800
- 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: `
801
- <div [ngClass]="{'with-background': background}" class="form-container">
802
-
803
- <img [src]="image" alt="wolf" width="150px">
828
+ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: LoginFormComponent, selector: "ipt-login-form", outputs: { isLogged: "isLogged" }, ngImport: i0, template: `
829
+ <div class="form-container">
804
830
 
805
- <h2>IPT PLATFORM</h2>
831
+ <h2 style="text-align: center;">IPT PLATFORM</h2>
806
832
  <hr>
807
833
 
808
834
  <form (ngSubmit)="login(loginForm)" [formGroup]="loginForm">
@@ -821,7 +847,6 @@ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
821
847
  </form>
822
848
 
823
849
  <div class="button-container">
824
- <a href="">Forget password</a>
825
850
  <ipt-button
826
851
  [label]="'Login'"
827
852
  [primary]="true"
@@ -830,23 +855,14 @@ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
830
855
  ></ipt-button>
831
856
  </div>
832
857
 
833
- <footer>
834
- <ipt-button
835
- [label]="'Register'"
836
- [primary]="false"
837
- ></ipt-button>
838
- </footer>
839
-
840
858
  </div>
841
- `, 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"] }] });
859
+ `, 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"] }] });
842
860
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: LoginFormComponent, decorators: [{
843
861
  type: Component,
844
862
  args: [{ selector: 'ipt-login-form', template: `
845
- <div [ngClass]="{'with-background': background}" class="form-container">
863
+ <div class="form-container">
846
864
 
847
- <img [src]="image" alt="wolf" width="150px">
848
-
849
- <h2>IPT PLATFORM</h2>
865
+ <h2 style="text-align: center;">IPT PLATFORM</h2>
850
866
  <hr>
851
867
 
852
868
  <form (ngSubmit)="login(loginForm)" [formGroup]="loginForm">
@@ -865,7 +881,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
865
881
  </form>
866
882
 
867
883
  <div class="button-container">
868
- <a href="">Forget password</a>
869
884
  <ipt-button
870
885
  [label]="'Login'"
871
886
  [primary]="true"
@@ -874,36 +889,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
874
889
  ></ipt-button>
875
890
  </div>
876
891
 
877
- <footer>
878
- <ipt-button
879
- [label]="'Register'"
880
- [primary]="false"
881
- ></ipt-button>
882
- </footer>
883
-
884
892
  </div>
885
893
  `, 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"] }]
886
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: BaseService }]; }, propDecorators: { background: [{
887
- type: Input
888
- }], image: [{
889
- type: Input
890
- }], email: [{
891
- type: Output
892
- }], password: [{
894
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: BaseService }]; }, propDecorators: { isLogged: [{
893
895
  type: Output
894
896
  }] } });
895
897
 
896
- class RegisterFormComponent {
897
- constructor() { }
898
+ class SidenavComponent {
899
+ constructor(userService, baseService, storageService) {
900
+ this.userService = userService;
901
+ this.baseService = baseService;
902
+ this.storageService = storageService;
903
+ this.pageChangeEvent = new EventEmitter();
904
+ this.routes = [];
905
+ }
898
906
  ngOnInit() {
907
+ var _a;
908
+ let user = (_a = this.storageService.getCurrentUser()) === null || _a === void 0 ? void 0 : _a.token;
909
+ let token = user === undefined ? '' : user;
910
+ this.userService.getRoutesForRole(token).subscribe(response => {
911
+ this.routes = this.baseService.jsonToArray(response.data);
912
+ });
913
+ }
914
+ clickPage(event) {
915
+ this.pageChangeEvent.emit(event);
899
916
  }
900
917
  }
901
- RegisterFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: RegisterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
902
- 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: [""] });
903
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: RegisterFormComponent, decorators: [{
918
+ 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 });
919
+ 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: `
920
+ <mat-sidenav #sidenav mode="push">
921
+ <mat-toolbar color="primary">
922
+ <span>{{department}}</span>
923
+ <span class="spacer"></span>
924
+ <button mat-icon-button (click)="sidenav.toggle()">
925
+ <mat-icon>Menu</mat-icon>
926
+ </button>
927
+ </mat-toolbar>
928
+
929
+ <mat-nav-list>
930
+ <nav class="flex-container-menu" (click)="sidenav.toggle()" *ngFor="let route of routes">
931
+ <ipt-aside-button
932
+ [buttonActive]="this.setPage === route.page"
933
+ [url]="route.url"
934
+ [type]="route.type"
935
+ [icon]="route.icon"
936
+ [text]="route.text"
937
+ (isClicked)="clickPage(route.page)"
938
+ >
939
+ </ipt-aside-button>
940
+ </nav>
941
+ </mat-nav-list>
942
+ </mat-sidenav>
943
+ `, 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"] }] });
944
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: SidenavComponent, decorators: [{
904
945
  type: Component,
905
- args: [{ selector: 'lib-register-form', template: "<p>register-form works!</p>\n", styles: [""] }]
906
- }], ctorParameters: function () { return []; } });
946
+ args: [{ selector: 'ipt-sidenav', template: `
947
+ <mat-sidenav #sidenav mode="push">
948
+ <mat-toolbar color="primary">
949
+ <span>{{department}}</span>
950
+ <span class="spacer"></span>
951
+ <button mat-icon-button (click)="sidenav.toggle()">
952
+ <mat-icon>Menu</mat-icon>
953
+ </button>
954
+ </mat-toolbar>
955
+
956
+ <mat-nav-list>
957
+ <nav class="flex-container-menu" (click)="sidenav.toggle()" *ngFor="let route of routes">
958
+ <ipt-aside-button
959
+ [buttonActive]="this.setPage === route.page"
960
+ [url]="route.url"
961
+ [type]="route.type"
962
+ [icon]="route.icon"
963
+ [text]="route.text"
964
+ (isClicked)="clickPage(route.page)"
965
+ >
966
+ </ipt-aside-button>
967
+ </nav>
968
+ </mat-nav-list>
969
+ </mat-sidenav>
970
+ `, styles: [""] }]
971
+ }], ctorParameters: function () { return [{ type: UserService }, { type: BaseService }, { type: StorageService }]; }, propDecorators: { department: [{
972
+ type: Input
973
+ }], setPage: [{
974
+ type: Input
975
+ }], pageChangeEvent: [{
976
+ type: Output
977
+ }] } });
907
978
 
908
979
  class ComponentsModule {
909
980
  }
@@ -919,10 +990,14 @@ ComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
919
990
  SelectComponent,
920
991
  TextLinkComponent,
921
992
  LoginFormComponent,
922
- RegisterFormComponent], imports: [CommonModule,
993
+ SidenavComponent], imports: [CommonModule,
923
994
  BrowserModule,
924
995
  FormsModule,
925
- ReactiveFormsModule], exports: [AsideButtonComponent,
996
+ ReactiveFormsModule,
997
+ MatSidenavModule,
998
+ MatToolbarModule,
999
+ MatIconModule,
1000
+ MatListModule], exports: [AsideButtonComponent,
926
1001
  ButtonComponent,
927
1002
  CheckboxComponent,
928
1003
  DatalistComponent,
@@ -932,12 +1007,17 @@ ComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
932
1007
  RadioComponent,
933
1008
  SelectComponent,
934
1009
  TextLinkComponent,
935
- LoginFormComponent] });
1010
+ LoginFormComponent,
1011
+ SidenavComponent] });
936
1012
  ComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ComponentsModule, imports: [[
937
1013
  CommonModule,
938
1014
  BrowserModule,
939
1015
  FormsModule,
940
1016
  ReactiveFormsModule,
1017
+ MatSidenavModule,
1018
+ MatToolbarModule,
1019
+ MatIconModule,
1020
+ MatListModule
941
1021
  ]] });
942
1022
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ComponentsModule, decorators: [{
943
1023
  type: NgModule,
@@ -954,13 +1034,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
954
1034
  SelectComponent,
955
1035
  TextLinkComponent,
956
1036
  LoginFormComponent,
957
- RegisterFormComponent,
1037
+ SidenavComponent,
958
1038
  ],
959
1039
  imports: [
960
1040
  CommonModule,
961
1041
  BrowserModule,
962
1042
  FormsModule,
963
1043
  ReactiveFormsModule,
1044
+ MatSidenavModule,
1045
+ MatToolbarModule,
1046
+ MatIconModule,
1047
+ MatListModule
964
1048
  ],
965
1049
  exports: [
966
1050
  AsideButtonComponent,
@@ -974,6 +1058,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
974
1058
  SelectComponent,
975
1059
  TextLinkComponent,
976
1060
  LoginFormComponent,
1061
+ SidenavComponent,
977
1062
  ]
978
1063
  }]
979
1064
  }] });
@@ -1207,5 +1292,5 @@ class UserLoginRs {
1207
1292
  * Generated bundle index. Do not edit.
1208
1293
  */
1209
1294
 
1210
- 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 };
1295
+ 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 };
1211
1296
  //# sourceMappingURL=iptdevs-design-system.mjs.map