diff --git a/package.json b/package.json index 2780dd856..11875f507 100644 --- a/package.json +++ b/package.json @@ -156,4 +156,4 @@ "url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git" }, "license": "ISC" -} \ No newline at end of file +} diff --git a/src/app/guards/login.guard.spec.ts b/src/app/guards/login.guard.spec.ts new file mode 100644 index 000000000..38aefa049 --- /dev/null +++ b/src/app/guards/login.guard.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { LoginGuard } from './login.guard'; + +describe('LoginGuard', () => { + let guard: LoginGuard; + + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(LoginGuard); + }); + + it('should be created', () => { + expect(guard).toBeTruthy(); + }); +}); diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts new file mode 100644 index 000000000..b73610840 --- /dev/null +++ b/src/app/guards/login.guard.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class LoginGuard implements CanActivate { + constructor( private router:Router) { + + } + canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + + if(window.location.pathname == '/' && localStorage.getItem('UserData') != null ) { + this.router.navigate(['/home/events']); + return false + } else { + + return true + } + } + +} diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index 9175c38c7..13f9bc094 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from '../guards/auth.guard'; import { HomeGuard } from '../guards/home.guard'; +import { LoginGuard } from '../guards/login.guard'; import { GroupMessagesPage } from '../pages/chat/group-messages/group-messages.page'; import { MessagesPage } from '../pages/chat/messages/messages.page'; import { ProcessesResolverService } from '../resolvers/processes-resolver.service'; @@ -13,7 +14,6 @@ const routes: Routes = [ { path: 'home', component: HomePage, - /* canActivate: [HomeGuard], */ resolve: { userData: UserDataResolver }, @@ -80,16 +80,17 @@ const routes: Routes = [ ], }, - { - path: 'login', - children: [ - { - path:'', - loadChildren: ()=> import('../pages/login/login.module').then(m => m.LoginPageModule) - }, - ], + // { + // path: 'login', + // children: [ + // { + // path:'', + // loadChildren: ()=> import('../pages/login/login.module').then(m => m.LoginPageModule) + // }, + // ], + // canActivate: [LoginGuard] - }, + // }, { path: 'agenda', children: [ @@ -367,11 +368,6 @@ const routes: Routes = [ ], canActivate: [AuthGuard] - }, - { - path: '', - redirectTo: '/home/events', - pathMatch: 'full', } ]; diff --git a/src/app/index/index-routing.module.ts b/src/app/index/index-routing.module.ts index 3f55beadb..6d90f05c2 100644 --- a/src/app/index/index-routing.module.ts +++ b/src/app/index/index-routing.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { IndexGuard } from '../guards/index.guard'; +import { LoginGuard } from '../guards/login.guard'; import { IndexPage } from './index.page'; const routes: Routes = [ @@ -15,7 +16,8 @@ const routes: Routes = [ }, */ { path: '', - loadChildren: ()=> import('../pages/login/login.module').then(m => m.LoginPageModule) + loadChildren: ()=> import('../pages/login/login.module').then(m => m.LoginPageModule), + canActivate: [LoginGuard] }, ] } diff --git a/src/app/pages/chat/new-group/contacts/contacts.page.ts b/src/app/pages/chat/new-group/contacts/contacts.page.ts index b2d114651..850e1a4cf 100644 --- a/src/app/pages/chat/new-group/contacts/contacts.page.ts +++ b/src/app/pages/chat/new-group/contacts/contacts.page.ts @@ -17,7 +17,7 @@ export class ContactsPage implements OnInit { headers: HttpHeaders; options:any; - contacts: Contact[] = [ + contacts = [ { first: 'Ana', last: 'Manuel', diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html index eeec4d60b..714f59e17 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html @@ -9,24 +9,41 @@
-
+
+
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
-
+
- - - Campo obrigatório - +
+
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
@@ -34,7 +51,7 @@
-
+
- + Oficial @@ -79,11 +96,11 @@ value="2020-11-19T11:06Z"> - + @@ -105,7 +122,7 @@
-
+
- + @@ -168,6 +185,7 @@ value="false" interface="action-sheet" required + appearance="none" > @@ -263,9 +281,7 @@
-
-
diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.scss b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.scss index 7a4a2d624..24d21b73b 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.scss +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.scss @@ -205,4 +205,4 @@ .close-button { display: block !important; } -} \ No newline at end of file +} diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 51a31a44f..13ca787db 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -14,7 +14,7 @@ import { User } from 'src/app/models/user.model'; import { AuthService } from 'src/app/services/auth.service'; import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; import { ToastService } from 'src/app/services/toast.service'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import * as _moment from 'moment'; import * as _rollupMoment from 'moment'; import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; @@ -54,8 +54,11 @@ export class BookMeetingModalPage implements OnInit { public showSeconds = false; public touchUi = false; public enableMeridian = false; - public minDate: any; - public maxDate: any; + public minDate = new Date(); + + // curent timestamp + 15 minutes + public endMinDate = new Date(new Date().getTime() + 15 * 60000); + public stepHour = 1; public stepMinute = 5; public stepSecond = 5; @@ -63,6 +66,10 @@ export class BookMeetingModalPage implements OnInit { public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); + Form: FormGroup; + validateFrom = false + + showLoader = false get dateStart () { @@ -134,6 +141,9 @@ export class BookMeetingModalPage implements OnInit { /* Set + 30minutes to seleted datetime */ let selectedEndDate = new Date(); /* this.postData.EndDate = new Date(selectedEndDate.setMinutes(new Date().getMinutes() + 30)); */ + + this.dateControlStart = new FormControl(moment(new Date())); + this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); } ngOnInit() { @@ -157,8 +167,40 @@ export class BookMeetingModalPage implements OnInit { window.history.back(); } + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.postData.Subject, [ + Validators.required, + // Validators.minLength(4) + ]), + Location: new FormControl(this.postData.Location, [ + Validators.required, + ]), + CalendarName: new FormControl(this.postData.CalendarName, [ + Validators.required + ]) + // participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ + // Validators.required + // ]), + + }) + } + + async saveTask(){ - // issue12323423 + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + + let Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.eventBody={ diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html index 7983b307f..7563a0b3a 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html @@ -4,10 +4,22 @@ {{modalTitle[taskType]}} -
+ +
+
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
@@ -16,18 +28,29 @@
-
+
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
-
+
Urgentíssimo (8 horas para a execução da tarefa) - + Normal (4 dias para a execução da tarefa) Urgente (2 dias para a execução da tarefa) @@ -54,12 +77,24 @@
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
-
+
+ class="width-100 d-none d-md-block" + appearance="none"> {{type.Description}} @@ -81,6 +117,18 @@
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
@@ -155,7 +203,6 @@
-
{ if(params["params"].SerialNumber) { @@ -164,6 +155,11 @@ export class ExpedienteDetailPage implements OnInit { }); }) + + + console.log('this.task', this.task) + console.log('this.task.DocumentURL', this.task.DocumentURL) + }); @@ -185,9 +181,10 @@ export class ExpedienteDetailPage implements OnInit { } } - viewDocument(){ + viewDocument() { this.processes.GetDocumentUrl(this.task.DocId, this.task.FsId).subscribe(res=>{ const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); + const browser = this.iab.create(url,"_blank"); browser.show(); diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html index aef08ebf8..ade072d39 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html @@ -70,7 +70,7 @@ - + Oficial @@ -111,7 +111,7 @@ > - + - + diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index 34e38c31d..f8217e43e 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -179,7 +179,7 @@ export class EditEventPage implements OnInit { Validators.required ]), participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ - Validators.required + // Validators.required ]), }) diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index 681ac04e3..073538d0a 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -134,7 +134,7 @@ export class NewEventPage implements OnInit { this.loggeduser = userService.ValidatedUser; this.dateControlStart = new FormControl(moment(new Date())); - this.dateControlEnd = new FormControl(moment(new Date())); + this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); } ngOnInit() { @@ -252,7 +252,7 @@ export class NewEventPage implements OnInit { Validators.required ]), participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ - Validators.required + // Validators.required ]), }) diff --git a/src/app/shared/chat/new-group/contacts/contacts.page.ts b/src/app/shared/chat/new-group/contacts/contacts.page.ts index b2d114651..da4de0c8a 100644 --- a/src/app/shared/chat/new-group/contacts/contacts.page.ts +++ b/src/app/shared/chat/new-group/contacts/contacts.page.ts @@ -17,7 +17,7 @@ export class ContactsPage implements OnInit { headers: HttpHeaders; options:any; - contacts: Contact[] = [ + contacts = [ { first: 'Ana', last: 'Manuel', @@ -61,7 +61,6 @@ export class ContactsPage implements OnInit { this.headers = this.headers.set('Accept','application/json'); this.headers = this.headers.set('content-type','application/json'); - } ngOnInit() { diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.spec.ts b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.spec.ts index 509415955..fe2cdeef9 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.spec.ts +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.spec.ts @@ -1,19 +1,19 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; -import { EditEventPage } from './edit-event.page'; +import { EditEventToApproveComponent } from './edit-event.page'; describe('EditEventPage', () => { - let component: EditEventPage; - let fixture: ComponentFixture; + let component: EditEventToApproveComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ EditEventPage ], + declarations: [ EditEventToApproveComponent ], imports: [IonicModule.forRoot()] }).compileComponents(); - fixture = TestBed.createComponent(EditEventPage); + fixture = TestBed.createComponent(EditEventToApproveComponent); component = fixture.componentInstance; fixture.detectChanges(); })); diff --git a/src/app/shared/headers/header-no-search/profile/profile.page.ts b/src/app/shared/headers/header-no-search/profile/profile.page.ts index 23bd43dd5..f2f905825 100644 --- a/src/app/shared/headers/header-no-search/profile/profile.page.ts +++ b/src/app/shared/headers/header-no-search/profile/profile.page.ts @@ -110,6 +110,8 @@ export class ProfileComponent implements OnInit { } logout() { + // clear local storage + window.localStorage.clear(); this.router.navigate(['/']); } diff --git a/src/global.scss b/src/global.scss index 53d6fe325..f63fca173 100644 --- a/src/global.scss +++ b/src/global.scss @@ -960,11 +960,11 @@ background: rgb(92, 92, 92); .date-hour-picker { margin-top: -6px; - + label#mat-form-field-label-7 { display: none; } - + .span.ng-tns-c193-4, .ng-star-inserted { // display: none; } @@ -972,7 +972,7 @@ background: rgb(92, 92, 92); .ng-star-inserted{ // display: none; position: absolute; - width: 447px; + width: 100%; height: 43px; opacity: 0; button { @@ -980,7 +980,15 @@ background: rgb(92, 92, 92); height: 100%; } } -} + button { + width: 100%; + height: 100%; + } + + .mat-datepicker-toggle, mat-datepicker-toggle { + width: 100%; + } + } .mat-active span { color: #0d89d1 !important; @@ -1018,3 +1026,10 @@ ngx-mat-datetime-content{ } } + + +// angular material inputs + +.mat-form-field-infix, .mat-form-field-wrapper { + padding: 0px !important; +} \ No newline at end of file