diff --git a/src/app/pages/agenda/new-event/new-event.module.ts b/src/app/pages/agenda/new-event/new-event.module.ts index a9818ea24..ef2b17b44 100644 --- a/src/app/pages/agenda/new-event/new-event.module.ts +++ b/src/app/pages/agenda/new-event/new-event.module.ts @@ -7,6 +7,22 @@ import { IonicModule } from '@ionic/angular'; import { NewEventPageRoutingModule } from './new-event-routing.module'; import { NewEventPage } from './new-event.page'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatInputModule } from '@angular/material/input'; + +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'; @NgModule({ imports: [ @@ -14,6 +30,23 @@ import { NewEventPage } from './new-event.page'; FormsModule, IonicModule, NewEventPageRoutingModule, + MatDatepickerModule, + MatInputModule, + MatNativeDateModule, + // + NgxMatDatetimePickerModule, + NgxMatTimepickerModule, + NgxMatNativeDateModule, + // + + NgxMatMomentModule, + // BrowserAnimationsModule, + // MatRadioModule, + MatSelectModule, + //MatRadioModule, + //MatCheckboxModule, + MatButtonModule, + ReactiveFormsModule ], declarations: [NewEventPage] }) 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 494eb4a21..efb0cdbe5 100644 --- a/src/app/pages/agenda/new-event/new-event.page.html +++ b/src/app/pages/agenda/new-event/new-event.page.html @@ -18,39 +18,30 @@ - -
-
+
-
- - Calendário do Presidente da República - Meu calendário - +
+ + + + + + Calendário do Presidente da República + + + Meu calendário + + + + +
- - - -
@@ -60,38 +51,26 @@
- - -
- -
-
+
-
- - Oficial - Pessoal - +
+ + + + + Oficial + + + Pessoal + + + +
@@ -105,20 +84,30 @@
-->
-
+
-
- - Reunião - Viagem - Conferência - Encontro - +
+ + + + + + Reunião + + + Viagem + + + Conferência + + + Encontro + + + +
@@ -133,78 +122,110 @@
-->
-
+
-
- - - + +
+ + + + + + + +
-
+
-
- +
+ + + + + + + - > - -
-
+
-
- - {{recurring.Description}} - +
+ + + + + {{recurring.Description}} + + + +
-
-
+
+
-
- - - +
+ + + + + + +
@@ -218,15 +239,9 @@
- Adicionar intervenientes* -
- - - {{participant.Name}} - - -
-
+ Adicionar intervenientes* + {{participant.Name}} +
@@ -246,15 +261,9 @@
- Com conhecimento -
- - - {{participant.Name}} - - -
-
+ Com conhecimento + {{participant.Name}} +
diff --git a/src/app/pages/agenda/new-event/new-event.page.scss b/src/app/pages/agenda/new-event/new-event.page.scss index 905df261e..2cd5492f2 100644 --- a/src/app/pages/agenda/new-event/new-event.page.scss +++ b/src/app/pages/agenda/new-event/new-event.page.scss @@ -16,7 +16,7 @@ ion-content{ padding: 30px 20px 0px 20px; color:#000; transform: translate3d(0, 1px, 0); - + .title-content{ margin: 0px auto; overflow: auto; @@ -59,7 +59,7 @@ ion-content{ } .container-div{ margin-bottom: 15px; - overflow: auto; + //overflow: auto; } .ion-item-class-2{ display: flex; @@ -91,9 +91,9 @@ ion-content{ flex: 1; } .list-people{ - width: 256px; + width: 250px; float: left; - + } .add-people{ width: 45px; @@ -154,7 +154,7 @@ ion-content{ --color:#ffffff; margin:10px; } - + .text-input{ width: 100%; border: 1px solid #ebebeb; @@ -162,7 +162,7 @@ ion-content{ padding: 0 !important; border-radius: 5px; } - + /* Error Messages */ .error{ color:red; @@ -178,7 +178,7 @@ ion-content{ - + .app-name{ background: var(--title-text-color); border-radius: 18px; @@ -195,8 +195,8 @@ ion-content{ -ms-border-radius: 18px; -o-border-radius: 18px; } - - + + .close-button { display: none; height: 20px; @@ -215,4 +215,4 @@ ion-content{ } .icon-time{ color: #797979b0; -} \ No newline at end of file +} 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 e12eb9365..dd6468e00 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -15,13 +15,28 @@ import { SearchPage } from '../../search/search.page'; import { ThemePalette } from '@angular/material/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { EventRecurrence } from 'src/app/models/agenda/eventrecurrence.model'; -import { ThemeService } from 'src/app/services/theme.service' - +import { ThemeService } from 'src/app/services/theme.service'; +import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; +import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; +const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { + parse: { + dateInput: "YYYY-MMMM-DD HH:mm" + }, + display: { + dateInput: "DD MMM YYYY H:mm", + monthYearLabel: "MMM YYYY", + dateA11yLabel: "LL", + monthYearA11yLabel: "MMMM YYYY" + } +} @Component({ selector: 'app-new-event', templateUrl: './new-event.page.html', styleUrls: ['./new-event.page.scss'], + providers: [ + { provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS }, + ] }) export class NewEventPage implements OnInit { @@ -61,6 +76,14 @@ export class NewEventPage implements OnInit { members:any; CalendarName; + public listColors = ['primary', 'accent', 'warn']; + public stepHours = [1, 2, 3, 4, 5]; + public stepMinutes = [1, 5, 10, 15, 20, 25]; + public stepSeconds = [1, 5, 10, 15, 20, 25]; + + autoStartTime; + autoEndTime; + constructor( private modalController: ModalController, private navParams: NavParams, @@ -82,8 +105,21 @@ export class NewEventPage implements OnInit { this.selectedDate = this.navParams.get('eventSelectedDate'); this.taskParticipants = this.navParams.get('attendees'); - this.postEvent.StartDate = new Date() - this.postEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000)) + let now = new Date(); + + if(now.getMinutes() <= 30){ + this.autoStartTime = new Date(now.setMinutes(30)); + this.postEvent.StartDate = this.autoStartTime; + this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000); + this.postEvent.EndDate = this.autoEndTime; + } + else{ + this.autoStartTime = new Date(now.setHours(now.getHours()+1)); + this.autoStartTime = new Date(this.autoStartTime.setMinutes(0)); + this.postEvent.StartDate = this.autoStartTime; + this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000); + this.postEvent.EndDate = this.autoEndTime; + } } ngOnInit() { @@ -91,16 +127,11 @@ export class NewEventPage implements OnInit { this.CalendarName = this.loggeduser.Profile; this.selectedRecurringType = "-1"; console.log(this.postEvent); + console.log(this.selectedSegment); + this.getRecurrenceTypes(); - /* console.log(this.profile); */ - - let selectedStartdDate = this.selectedDate; - let selectedEndDate = new Date(this.selectedDate); - /* Set + 30minutes to seleted datetime */ - selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ; - if(this.selectedSegment != "Combinada"){ this.postEvent ={ EventId: '', @@ -108,9 +139,9 @@ export class NewEventPage implements OnInit { Body: this.eventBody, Location: '', CalendarId: '', - CalendarName: '', - StartDate: selectedStartdDate, - EndDate: new Date(selectedEndDate), + CalendarName: 'Oficial', + StartDate: this.autoStartTime, + EndDate: this.autoEndTime, EventType: 'Reunião', Attendees: null, IsMeeting: false, @@ -120,7 +151,7 @@ export class NewEventPage implements OnInit { Organizer: '', Category: 'Reunião', HasAttachments: false, - EventRecurrence: {Type:'-1'}, + EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime}, }; } else{ @@ -131,8 +162,8 @@ export class NewEventPage implements OnInit { Location: '', CalendarId: '', CalendarName: 'Oficial', - StartDate: selectedStartdDate, - EndDate: new Date(selectedEndDate), + StartDate: this.autoStartTime, + EndDate: this.autoEndTime, EventType: 'Reunião', Attendees: null, IsMeeting: false, @@ -142,7 +173,7 @@ export class NewEventPage implements OnInit { Organizer: '', Category: 'Reunião', HasAttachments: false, - EventRecurrence: {Type:'-1'}, + EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime}, }; } @@ -224,6 +255,28 @@ export class NewEventPage implements OnInit { }) } + openInicio() { + let input: any = document.querySelector('#new-inicio') + if(input) { + console.log(input) + input.click() + } + } + + openFim() { + let input: any = document.querySelector('#new-fim') + if(input) { + input.click() + } + } + + openLastOccurrence() { + let input: any = document.querySelector('#last-occurrence') + if(input) { + input.click() + } + } + async save() { this.injectValidation() this.runValidation() 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 9617957b1..612b59506 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -98,7 +98,9 @@ export class NewEventPage implements OnInit { @ViewChild('picker1') picker1: any; Form: FormGroup; - validateFrom = false + validateFrom = false; + autoStartTime; + autoEndTime; public options = [ { value: true, label: 'True' }, @@ -129,8 +131,22 @@ export class NewEventPage implements OnInit { this.loggeduser = userService.ValidatedUser; this.postEvent = new Event(); - this.postEvent.StartDate = new Date() - this.postEvent.EndDate = new Date(new Date().getTime() + 15 * 60000); + let now = new Date(); + + if(now.getMinutes() <= 30){ + this.autoStartTime = new Date(now.setMinutes(30)); + this.postEvent.StartDate = this.autoStartTime; + this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000); + this.postEvent.EndDate = this.autoEndTime; + } + else{ + this.autoStartTime = new Date(now.setHours(now.getHours()+1)); + this.autoStartTime = new Date(this.autoStartTime.setMinutes(0)); + this.postEvent.StartDate = this.autoStartTime; + this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000); + this.postEvent.EndDate = this.autoEndTime; + } + } ngOnInit() { @@ -143,14 +159,6 @@ export class NewEventPage implements OnInit { this.eventBody = { BodyType : "1", Text : ""}; this.postEvent.Body = this.eventBody; - /* console.log(this.profile); */ - - let selectedStartdDate = this.selectedDate; - let selectedEndDate = new Date(this.selectedDate); - /* Set + 30minutes to seleted datetime */ - selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ; - - if(this.selectedSegment != "Combinada"){ this.postEvent ={ EventId: '', @@ -159,8 +167,8 @@ export class NewEventPage implements OnInit { Location: '', CalendarId: '', CalendarName: 'Oficial', - StartDate: selectedStartdDate, - EndDate: new Date(selectedEndDate), + StartDate: this.autoStartTime, + EndDate: this.autoEndTime, EventType: 'Reunião', Attendees: null, IsMeeting: false, @@ -170,7 +178,7 @@ export class NewEventPage implements OnInit { Organizer: '', Category: 'Reunião', HasAttachments: false, - EventRecurrence: {Type:'-1'}, + EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime}, }; } else{ @@ -181,8 +189,8 @@ export class NewEventPage implements OnInit { Location: '', CalendarId: '', CalendarName: 'Oficial', - StartDate: selectedStartdDate, - EndDate: new Date(selectedEndDate), + StartDate: this.autoStartTime, + EndDate: this.autoEndTime, EventType: 'Reunião', Attendees: null, IsMeeting: false, @@ -192,7 +200,7 @@ export class NewEventPage implements OnInit { Organizer: '', Category: 'Reunião', HasAttachments: false, - EventRecurrence: {Type:'-1'}, + EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime}, }; }