diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 73dc21b82..c0f9e9d66 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,141 +1,142 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { ChatPage } from './pages/chat/chat.page'; -import { MessagesPage } from './pages/chat/messages/messages.page'; - -const routes: Routes = [ - { - path: '', - loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule) - }, - { - path: '', - loadChildren: () => import('./home/home.module').then( m => m.HomePageModule) - }, - { - path: 'empty-chat', - loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule) - }, - { - path: 'empty-container', - loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule) - }, - { - path: 'events-to-approve', - loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule) - }, - { - path: 'expedients', - loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule) - }, - { - path: 'document-detail', - loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule) - }, - { - path: 'edit-group', - loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule) - }, - { - path: 'pedidos', - loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule) - }, - { - path: 'event-list', - loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule) - }, - { - path: 'despachos', - loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule) - }, - { - path: 'create-process', - loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule) - }, - { - path: 'pendentes', - loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule) - }, - { - path: 'delegar', - loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule) - }, - { - path: 'add-note', - loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule) - }, - { - path: 'dar-parecer', - loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule) - }, - { - path: 'opts-expediente', - loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule) - }, - { - path: 'despachos-pr', - loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule) - }, - { - path: 'diplomas', - loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule) - }, - { - path: 'expedientes-pr', - loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule) - }, - { - path: 'diplomas-assinar', - loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule) - }, - { - path: 'opts-expediente-pr', - loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule) - }, - { - path: 'despachos-options', - loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule) - }, - { - path: 'despachos-pr-options', - loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule) - }, - { - path: 'deploma-options', - loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule) - }, - { - path: 'pin', - loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule) - }, - { - path: 'fingerprint', - loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule) - }, - { - path: 'new-event', - loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule) - }, - { - path: 'event-list', - loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule) - }, - { - path: 'approve-event', - loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule) - }, - { - path: 'bad-request', - loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule) - }, - { - path: 'success-message', - loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule) - }, - { - path: 'forward', - loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule) - }, { +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { ChatPage } from './pages/chat/chat.page'; +import { MessagesPage } from './pages/chat/messages/messages.page'; + +const routes: Routes = [ + { + path: '', + loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule) + }, + { + path: '', + loadChildren: () => import('./home/home.module').then( m => m.HomePageModule) + }, + { + path: 'empty-chat', + loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule) + }, + { + path: 'empty-container', + loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule) + }, + { + path: 'events-to-approve', + loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule) + }, + { + path: 'expedients', + loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule) + }, + { + path: 'document-detail', + loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule) + }, + { + path: 'edit-group', + loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule) + }, + { + path: 'pedidos', + loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule) + }, + { + path: 'event-list', + loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule) + }, + { + path: 'despachos', + loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule) + }, + { + path: 'create-process', + loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule) + }, + { + path: 'pendentes', + loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule) + }, + { + path: 'delegar', + loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule) + }, + { + path: 'add-note', + loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule) + }, + { + path: 'dar-parecer', + loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule) + }, + { + path: 'opts-expediente', + loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule) + }, + { + path: 'despachos-pr', + loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule) + }, + { + path: 'diplomas', + loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule) + }, + { + path: 'expedientes-pr', + loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule) + }, + { + path: 'diplomas-assinar', + loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule) + }, + { + path: 'opts-expediente-pr', + loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule) + }, + { + path: 'despachos-options', + loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule) + }, + { + path: 'despachos-pr-options', + loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule) + }, + { + path: 'deploma-options', + loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule) + }, + { + path: 'pin', + loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule) + }, + { + path: 'fingerprint', + loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule) + }, + { + path: 'new-event', + loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule) + }, + { + path: 'event-list', + loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule) + }, + { + path: 'approve-event', + loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule) + }, + { + path: 'bad-request', + loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule) + }, + { + path: 'success-message', + loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule) + }, + { + path: 'forward', + loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule) + }, + { path: 'edit-event-to-approve', loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule) }, @@ -148,18 +149,18 @@ const routes: Routes = [ loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule) }, - - - /* { - path: 'chat', - component: ChatPage - } */ - -]; -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} + + + /* { + path: 'chat', + component: ChatPage + } */ + +]; +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1ec231733..d1f38ce15 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -58,7 +58,7 @@ import { ProcessesResolverService } from './resolvers/processes-resolver.service provide: DateAdapter, useFactory: adapterFactory }), - IonicModule.forRoot(), + IonicModule.forRoot({animated: false}), IonicStorageModule.forRoot(), AppRoutingModule, HttpClientModule, diff --git a/src/app/modals/create-process/create-process.page.html b/src/app/modals/create-process/create-process.page.html index 229c9aaf2..1b7e61a2d 100644 --- a/src/app/modals/create-process/create-process.page.html +++ b/src/app/modals/create-process/create-process.page.html @@ -4,7 +4,7 @@ {{modalTitle[taskType]}} -
+
@@ -13,7 +13,7 @@
-
+
@@ -27,26 +27,17 @@
-
+
- + Normal (4 dias para a execução da tarefa) Urgente (2 dias para a execução da tarefa) Muito Urgente (1 dia para a execução da tarefa) Urgentíssimo (8 horas para a execução da tarefa) -
-
-
-
-
-
- -
-
- - + + Normal Urgente Muito Urgente @@ -58,6 +49,36 @@
+
+
+
+ +
+
+ + + + + {{type.Description}} + + +
+
+
+ +
diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index a1e807243..bc178d265 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -14,7 +14,7 @@ import { SearchPage } from 'src/app/pages/search/search.page'; import { User } from 'src/app/models/user.model'; 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 { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; @@ -69,6 +69,9 @@ export class CreateProcessPage implements OnInit { adding: "intervenient" | "CC" = "intervenient"; profile: string; + Form: FormGroup; + validateFrom = false + emptyTextDescription = "Sem intervenientes selecionados"; showEmptyContainer = true; @@ -162,8 +165,43 @@ export class CreateProcessPage implements OnInit { this.modalController.dismiss(null); } - async saveTask(){ + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.postData.DispatchFolder.Subject, [ + Validators.required, + // Validators.minLength(4) + ]), + Message: new FormControl(this.postData.DispatchFolder.Message, [ + Validators.required, + ]), + Priority: new FormControl(this.postData.Priority, [ + Validators.required, + ]), + participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ + // Validators.required + ]), + selectedTypes: new FormControl(this.selectedTypes, [ + Validators.required, + ]), + + }) + } + + async saveTask() { + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + + if(this.postData.Priority=='99999861') { this.dispatchFolder.DeadlineType = 'Normal'; } @@ -199,73 +237,69 @@ export class CreateProcessPage implements OnInit { this.dispatchFolder.SubjectTypes = this.selectedTypes; switch (this.loggeduser.Profile) { case 'MDGPR': - if(this.taskParticipants.length > 0) { - switch (this.taskType) { - case '0': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log('this.postData', this.postData, this.taskType); - - try { - await this.processes.postDespatcho(this.postData).toPromise(); - this.FinalizarDespacho('Despacho criado'); - } catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - - break; - case '1': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log(this.postData); - try { - await this.processes.postParecer(this.postData).toPromise(); - this.FinalizarParecer('Pedido de Parecer enviado'); - } - catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - - break; - case '2': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log(this.postData); - - try { - await this.processes.postDeferimento(this.postData).toPromise(); - this.FinalizarDeferimento('Pedido de deferimento enviado'); - } - catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - break; + switch (this.taskType) { + case '0': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, } - this.modalController.dismiss(); - } - else { - this.toastService.badRequest('Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.'); - } - + console.log('this.postData', this.postData, this.taskType); + + try { + await this.processes.postDespatcho(this.postData).toPromise(); + this.FinalizarDespacho('Despacho criado'); + } catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + + break; + case '1': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + } + console.log(this.postData); + + try { + await this.processes.postParecer(this.postData).toPromise(); + this.FinalizarParecer('Pedido de Parecer enviado'); + } + catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + + break; + case '2': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + } + console.log(this.postData); + + try { + await this.processes.postDeferimento(this.postData).toPromise(); + this.FinalizarDeferimento('Pedido de deferimento enviado'); + } + catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + break; + } + this.modalController.dismiss(); + break; case 'PR': diff --git a/src/app/pages/agenda/edit-event/edit-event.page.html b/src/app/pages/agenda/edit-event/edit-event.page.html index 857f0b406..7f978618c 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.html +++ b/src/app/pages/agenda/edit-event/edit-event.page.html @@ -123,7 +123,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2021" - max="2022" + max="2025" > @@ -144,7 +144,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2021" - max="2022" + max="2025" > diff --git a/src/app/pages/agenda/new-event/new-event.page.html b/src/app/pages/agenda/new-event/new-event.page.html index cc79a31c1..30e841b56 100644 --- a/src/app/pages/agenda/new-event/new-event.page.html +++ b/src/app/pages/agenda/new-event/new-event.page.html @@ -77,7 +77,6 @@
- {{ postEvent.Categories[0] }}
Campo obrigatório.
@@ -117,15 +116,15 @@
-
+
@@ -138,15 +137,16 @@
-
+
diff --git a/src/app/pages/agenda/new-event/new-event.page.ts b/src/app/pages/agenda/new-event/new-event.page.ts index b3490dfba..e02c6e206 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -14,7 +14,6 @@ import { AttendeesPageModal } from '../../events/attendees/attendees.page'; import { SearchPage } from '../../search/search.page'; import { ThemePalette } from '@angular/material/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; -import * as moment from 'moment'; @Component({ @@ -31,7 +30,7 @@ export class NewEventPage implements OnInit { public showSeconds = false; public touchUi = false; public enableMeridian = false; - public minDate = new Date(); + public minDate = new Date().toISOString().slice(0,10) public endMinDate = new Date(new Date().getTime() + 15 * 60000); public stepHour = 1; public stepMinute = 5; @@ -146,6 +145,15 @@ export class NewEventPage implements OnInit { this.validateFrom = true } + + get dateValid() { + if (window.innerWidth <= 800) { + return this.postEvent.StartDate < this.postEvent.EndDate? ['ok']: [] + } else { + return ['ok'] + } + } + injectValidation() { this.Form = new FormGroup({ @@ -159,6 +167,9 @@ export class NewEventPage implements OnInit { CalendarName: new FormControl(this.postEvent.CalendarName, [ Validators.required ]), + Date: new FormControl(this.dateValid, [ + Validators.required + ]), Categories: new FormControl(this.postEvent.Categories[0], [ Validators.required ]), 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 714f59e17..535832bdb 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 @@ -83,7 +83,7 @@
-
+
@@ -122,7 +122,7 @@
-
+
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 13ca787db..b8df83005 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 @@ -55,6 +55,7 @@ export class BookMeetingModalPage implements OnInit { public touchUi = false; public enableMeridian = false; public minDate = new Date(); + public ionicMinDate = new Date().toISOString().slice(0,10) // curent timestamp + 15 minutes public endMinDate = new Date(new Date().getTime() + 15 * 60000); @@ -172,6 +173,14 @@ export class BookMeetingModalPage implements OnInit { this.validateFrom = true } + get dateValid() { + if (window.innerWidth <= 800) { + return this.postData.StartDate < this.postData.EndDate? ['ok']: [] + } else { + return ['ok'] + } + } + injectValidation() { this.Form = new FormGroup({ @@ -184,7 +193,10 @@ export class BookMeetingModalPage implements OnInit { ]), CalendarName: new FormControl(this.postData.CalendarName, [ Validators.required - ]) + ]), + Date: new FormControl(this.dateValid, [ + Validators.required + ]), // participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ // Validators.required // ]), @@ -195,8 +207,11 @@ export class BookMeetingModalPage implements OnInit { async saveTask(){ - this.injectValidation() - this.runValidation() + if(this.loggeduser.Profile == 'MDGPR') { + this.injectValidation() + this.runValidation() + } + if(this.Form.invalid) return false 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 7563a0b3a..35d8b3c39 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 @@ -57,7 +57,7 @@ interface="action-sheet" Cancel-text="Cancelar" required - class="d-md-none" + class="d-block d-md-none" > Normal (4 dias para a execução da tarefa) Urgente (2 dias para a execução da tarefa) @@ -95,22 +95,21 @@
- + - + {{type.Description}} diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts index 0713dfec8..77d486654 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts @@ -166,7 +166,7 @@ export class ExpedientTaskModalPage implements OnInit { this.modalController.dismiss(null); } - getSubjectType(){ + getSubjectType() { this.processes.GetSubjectType().subscribe(res=>{ console.log(res); this.subjectTypes = res; @@ -191,12 +191,12 @@ export class ExpedientTaskModalPage implements OnInit { Location: new FormControl(this.postData.DispatchFolder.Message, [ Validators.required, ]), - selectedTypes: new FormControl(this.toppingsValues, [ + selectedTypes: new FormControl(this.selectedTypes, [ Validators.required, ]), Priority: new FormControl(this.postData.Priority, [ Validators.required, - ]) + ]), // CalendarName: new FormControl(this.postEvent.CalendarName, [ // Validators.required // ]), @@ -215,10 +215,14 @@ export class ExpedientTaskModalPage implements OnInit { async saveTask(){ - this.injectValidation() - this.runValidation() + if(this.loggeduser.Profile == 'MDGPR') { + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + } + - if(this.Form.invalid) return false if(this.postData.Priority=='99999861'){ this.dispatchFolder.DeadlineType = 'Normal'; diff --git a/src/app/pages/publications/new-action/new-action.page.html b/src/app/pages/publications/new-action/new-action.page.html index 1b6d8c16a..c0c33141f 100644 --- a/src/app/pages/publications/new-action/new-action.page.html +++ b/src/app/pages/publications/new-action/new-action.page.html @@ -35,7 +35,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022"> + max="2025">
@@ -54,7 +54,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022"> + max="2025">
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 ade072d39..740177c72 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 @@ -107,7 +107,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022" + max="2025" > @@ -145,7 +145,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022" + max="2025" > diff --git a/src/app/shared/gabinete-digital/despachos/despachos.page.ts b/src/app/shared/gabinete-digital/despachos/despachos.page.ts index d08ca6b85..bfbbb6d2f 100644 --- a/src/app/shared/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/shared/gabinete-digital/despachos/despachos.page.ts @@ -62,14 +62,14 @@ export class DespachosPage implements OnInit { } ngOnInit() { - //Inicializar segment - this.segment = "despachos"; - this.LoadList(); - this.router.events.forEach((event) => { - if(event instanceof NavigationEnd && event.url == this.router.url) { - this.doRefresh(); - } - }); + //Inicializar segment + this.segment = "despachos"; + this.LoadList(); + this.router.events.forEach((event) => { + if(event instanceof NavigationEnd && event.url == this.router.url) { + this.doRefresh(); + } + }); } diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html index a3a2551a3..a8f44e586 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html @@ -120,7 +120,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022" + max="2025" > diff --git a/src/app/shared/publication/edit-action/edit-action.page.html b/src/app/shared/publication/edit-action/edit-action.page.html index 21ceb8f32..ecf256aaa 100644 --- a/src/app/shared/publication/edit-action/edit-action.page.html +++ b/src/app/shared/publication/edit-action/edit-action.page.html @@ -37,7 +37,7 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022"> + max="2025">
diff --git a/src/app/shared/publication/new-action/new-action.module.ts b/src/app/shared/publication/new-action/new-action.module.ts index d5d868f49..d6c742824 100644 --- a/src/app/shared/publication/new-action/new-action.module.ts +++ b/src/app/shared/publication/new-action/new-action.module.ts @@ -8,12 +8,40 @@ import { NewActionPageRoutingModule } from './new-action-routing.module'; import { NewActionPage } from './new-action.page'; + +import { MatNativeDateModule } from '@angular/material/core'; +import { + NgxMatDatetimePickerModule, + NgxMatNativeDateModule, + NgxMatTimepickerModule +} from '@angular-material-components/datetime-picker'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatSelectModule } from '@angular/material/select'; +import { NgxMatMomentModule } from '@angular-material-components/moment-adapter'; +import { MAT_DATE_LOCALE } from '@angular/material/core'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatInputModule } from '@angular/material/input'; +import { MatDialogModule } from '@angular/material/dialog'; + @NgModule({ imports: [ CommonModule, FormsModule, IonicModule, - NewActionPageRoutingModule + NewActionPageRoutingModule, + // Angular material + MatDatepickerModule, + MatInputModule, + MatNativeDateModule, + NgxMatDatetimePickerModule, + NgxMatTimepickerModule, + NgxMatNativeDateModule, + NgxMatMomentModule, + MatSelectModule, + MatButtonModule, + ReactiveFormsModule, + MatDialogModule, ], exports: [NewActionPage], declarations: [NewActionPage] diff --git a/src/app/shared/publication/new-action/new-action.page.html b/src/app/shared/publication/new-action/new-action.page.html index 40e9946b8..68b0171d1 100644 --- a/src/app/shared/publication/new-action/new-action.page.html +++ b/src/app/shared/publication/new-action/new-action.page.html @@ -20,7 +20,7 @@
-
+
@@ -31,14 +31,34 @@
+ max="2025"> + + + + + + + + +
@@ -50,15 +70,33 @@
+ max="2025"> + + + + + + + +
diff --git a/src/app/shared/publication/new-action/new-action.page.ts b/src/app/shared/publication/new-action/new-action.page.ts index 703b32a77..805da6cc1 100644 --- a/src/app/shared/publication/new-action/new-action.page.ts +++ b/src/app/shared/publication/new-action/new-action.page.ts @@ -1,5 +1,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { AnimationController, ModalController } from '@ionic/angular'; +import * as moment from 'moment'; import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationsService } from 'src/app/services/publications.service'; import { ToastService } from 'src/app/services/toast.service'; @@ -15,16 +17,35 @@ export class NewActionPage implements OnInit { folder: PublicationFolder; segment:string; + public minDate = new Date(); + public endMinDate = new Date(new Date().getTime() + 15 * 60000); + + Form: FormGroup; + validateFrom = false + public dateControlStart = new FormControl(moment("DD MM YYYY hh")); + public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); + + @Output() closeDesktopComponent= new EventEmitter(); constructor( - private modalController: ModalController, private publication: PublicationsService, - private animationController: AnimationController, private toastService: ToastService ) { this.folder = new PublicationFolder(); + + this.dateControlStart = new FormControl(moment(new Date())); + this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); + + } + + get dateStart () { + return this.dateControlStart.value + } + + get dateEnd () { + return this.dateControlEnd.value } ngOnInit() { @@ -35,7 +56,30 @@ export class NewActionPage implements OnInit { console.log(ev.detail.value); } + + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.folder.Description, [ + Validators.required, + // Validators.minLength(4) + ]) + }) + } + + async save() { + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + this.folder = { ProcessId: null, Description: this.folder.Description, diff --git a/src/app/shared/publication/new-publication/new-publication.page.html b/src/app/shared/publication/new-publication/new-publication.page.html index a0fb02be2..a5e8a1bf5 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.html +++ b/src/app/shared/publication/new-publication/new-publication.page.html @@ -12,15 +12,13 @@
-
+
- -
-
+
diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 2d82d4b0d..fe3630948 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -13,12 +13,8 @@ import { PhotoService } from 'src/app/services/photo.service'; //Cordova import { Camera, CameraOptions } from '@ionic-native/camera/ngx'; -import { PublicationFolder } from 'src/app/models/publicationfolder'; -import { ViewPublicationsPage } from '../view-publications/view-publications.page'; -import { LoadingService } from 'src/app/services/loading.service'; -import { BadRequestPage } from '../../popover/bad-request/bad-request.page'; -import { SuccessMessagePage} from '../../popover/success-message/success-message.page'; import { ToastService } from 'src/app/services/toast.service'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; @Component({ selector: 'app-new-publication', @@ -35,6 +31,8 @@ export class NewPublicationPage implements OnInit { Defaultimage:any = ''; + Form: FormGroup; + validateFrom = false photo: SafeResourceUrl; @@ -139,7 +137,30 @@ export class NewPublicationPage implements OnInit { }); } + + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.pub.Title, [ + Validators.required, + // Validators.minLength(4) + ]) + }) + } + + async save(){ + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + if(this.publicationType == '3'){ if(this.capturedImage != '') {