This commit is contained in:
Eudes Inácio
2021-07-07 10:43:25 +01:00
16 changed files with 284 additions and 90 deletions
@@ -136,6 +136,7 @@ export class NewEventPage implements OnInit {
};
}
close(){
this.modalController.dismiss();
}
@@ -188,8 +189,6 @@ export class NewEventPage implements OnInit {
this.runValidation()
if(this.Form.invalid) return false
console.log('passed')
if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true;
@@ -44,7 +44,7 @@
</div>
</div>
</div>
<div class="container-div width-100">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
@@ -65,12 +65,12 @@
<ion-select-option value="99999864"><b>Urgentíssimo</b> (8 horas para a execução da tarefa)</ion-select-option>
</ion-select>
<mat-form-field appearance="fill" class="width-100 d-none d-md-block" appearance="none">
<mat-select placeholder="Prazo*" [(ngModel)]="postData.Priority">
<mat-option [value]="99999861"><b>Normal</b> (4 dias para a execução da tarefa)</mat-option>
<mat-option [value]="99999862"><b>Urgente</b> (2 dias para a execução da tarefa)</mat-option>
<mat-option [value]="99999863"><b>Muito Urgente</b> (1 dia para a execução da tarefa)</mat-option>
<mat-option [value]="99999864"><b>Urgentíssimo</b> (8 horas para a execução da tarefa)</mat-option>
<mat-form-field class="width-100 d-none d-md-block" appearance="none">
<mat-select [(ngModel)]="postData.Priority">
<mat-option value="99999861"><b>Normal</b> (4 dias para a execução da tarefa)</mat-option>
<mat-option value="99999862"><b>Urgente</b> (2 dias para a execução da tarefa)</mat-option>
<mat-option value="99999863"><b>Muito Urgente</b> (1 dia para a execução da tarefa)</mat-option>
<mat-option value="99999864"><b>Urgentíssimo</b> (8 horas para a execução da tarefa)</mat-option>
</mat-select>
</mat-form-field>
@@ -110,7 +110,7 @@
class="width-100 d-block"
appearance="none">
<mat-select [(ngModel)]="selectedTypes" multiple placeholder="Selecione o tipo de evento*">
<mat-option *ngFor="let type of subjectTypes" [value]="type.Code">{{type.Description}}</mat-option>
<mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option>
</mat-select>
</mat-form-field>
</div>
@@ -128,7 +128,6 @@
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2">
<div class="ion-icon-class">
@@ -224,16 +224,16 @@ export class ExpedientTaskModalPage implements OnInit {
if(this.postData.Priority=='99999861'){
if(this.postData.Priority=='99999861') {
this.dispatchFolder.DeadlineType = 'Normal';
}
else if(this.postData.Priority=='99999862'){
else if(this.postData.Priority=='99999862') {
this.dispatchFolder.DeadlineType = 'Urgente';
}
else if(this.postData.Priority=='99999863'){
else if(this.postData.Priority=='99999863') {
this.dispatchFolder.DeadlineType = 'Muito Urgente';
}
else if(this.postData.Priority=='99999864'){
else if(this.postData.Priority=='99999864') {
this.dispatchFolder.DeadlineType = 'Urgentíssimo';
}
let attendees = this.taskParticipants.concat(this.taskParticipantsCc);
@@ -42,8 +42,7 @@ export class ExpedientesPrPage implements OnInit {
ngOnInit() {
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadList();
console.log('not run');
this.refreshing();
}
});
}
@@ -107,6 +106,12 @@ export class ExpedientesPrPage implements OnInit {
}
}
refreshing() {
setTimeout(() => {
this.LoadList();
}, 1500);
}
doRefresh(event) {
this.LoadList();
setTimeout(() => {
@@ -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]
@@ -18,7 +18,7 @@
</div>
<div class="ion-item-container">
<div class="ion-item-container" [class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
<ion-input [(ngModel)]="folder.Description" placeholder="Assunto" ></ion-input>
</div>
@@ -30,6 +30,7 @@
<div class="ion-input-class">
<ion-datetime
[(ngModel)]="folder.DateBegin"
class="d-block d-md-none"
placeholder="Início"
displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45"
@@ -37,6 +38,25 @@
min="2018"
max="2025">
</ion-datetime>
<mat-form-field class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date"
[formControl]="dateControlStart"
[min]="minDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div>
@@ -47,7 +67,8 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class">
<ion-datetime
<ion-datetime
class="d-block d-md-none"
[(ngModel)]="folder.DateEnd"
placeholder="Fim"
displayFormat="D MMM YYYY H:mm"
@@ -56,6 +77,25 @@
min="2018"
max="2025">
</ion-datetime>
<mat-form-field class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
[formControl]="dateControlEnd"
[min]="endMinDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div>
@@ -1,29 +1,76 @@
import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController } from '@ionic/angular';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { 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';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
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-action',
templateUrl: './new-action.page.html',
styleUrls: ['./new-action.page.scss'],
providers: [
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
]
})
export class NewActionPage implements OnInit {
folder: PublicationFolder;
segment:string;
Form: FormGroup;
validateFrom = false
public date: any;
public disabled = false;
public showSpinners = true;
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate = new Date().toISOString().slice(0,10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
showLoader = false
get dateStart () {
return this.dateControlStart.value
}
get dateEnd () {
return this.dateControlEnd.value
}
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)));
}
ngOnInit() {
@@ -34,7 +81,39 @@ export class NewActionPage implements OnInit {
console.log(ev.detail.value);
}
async save(){
get dateValid() {
if (window.innerWidth <= 800) {
return this.folder.DateBegin < this.folder.DateEnd? ['ok']: []
} else {
return ['ok']
}
}
runValidation() {
this.validateFrom = true
}
injectValidation() {
this.Form = new FormGroup({
Subject: new FormControl(this.folder.Description, [
Validators.required,
// Validators.minLength(4)
]),
Date: new FormControl(this.dateValid, [
Validators.required
]),
})
}
async save() {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
this.folder = {
ProcessId: null,
Description: this.folder.Description,
@@ -43,7 +122,6 @@ export class NewActionPage implements OnInit {
DateEnd: this.folder.DateEnd,
ActionType: this.segment,
}
console.log(this.folder);
try {
await this.publication.CreatePublicationFolder(this.folder).toPromise();
@@ -54,12 +132,9 @@ export class NewActionPage implements OnInit {
}
}
close(){
this.modalController.dismiss();
}
}
@@ -1,24 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { AlertController, ModalController, NavParams } from '@ionic/angular';
import { GalleryPage } from '../gallery/gallery.page';
import { ModalController, NavParams } from '@ionic/angular';
/* import {Plugins, CameraResultType, CameraSource} from '@capacitor/core'; */
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { PublicationsService } from 'src/app/services/publications.service';
import { Publication } from 'src/app/models/publication';
import { Image } from 'src/app/models/image';
import { ThrowStmt } from '@angular/compiler';
import { PhotoService } from 'src/app/services/photo.service';
import { AlertService } from 'src/app/services/alert.service';
//Capacitor
/* const { Camera } = Plugins; */
//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 { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ThemePalette } from '@angular/material/core';
@Component({
selector: 'app-new-publication',
@@ -26,6 +21,24 @@ import { ToastService } from 'src/app/services/toast.service';
styleUrls: ['./new-publication.page.scss'],
})
export class NewPublicationPage implements OnInit {
// date picker
public date: any;
public disabled = false;
public showSpinners = true;
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate = new Date().toISOString().slice(0,10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
public color: ThemePalette = 'primary';
Form: FormGroup;
validateFrom = false
showLoader: boolean;
publication: Publication;
pub: Publication = new Publication();
@@ -38,7 +51,6 @@ export class NewPublicationPage implements OnInit {
Defaultimage:any = '';
photo: SafeResourceUrl;
guestPicture:any;
@@ -46,7 +58,6 @@ export class NewPublicationPage implements OnInit {
capturedImage:any;
capturedImageTitle:any;
constructor(
private modalController: ModalController,
public photoService: PhotoService,
@@ -59,13 +70,14 @@ export class NewPublicationPage implements OnInit {
this.publicationType = this.navParams.get('publicationType');
this.folderId = this.navParams.get('folderId');
this.publicationTitle = 'Nova Publicação';
}
}
ngOnInit() {
this.setTitle();
this.clear();
// this.takePicture();
}
takePicture() {
const options: CameraOptions = {
quality: 90,
@@ -77,17 +89,17 @@ export class NewPublicationPage implements OnInit {
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.capturedImage = imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.capturedImage = imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
}, (err) => {
/* console.log(err); */
/* console.log(err); */
});
}
getPicture(){
getPicture() {
const options: CameraOptions = {
quality: 90,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
@@ -97,21 +109,46 @@ export class NewPublicationPage implements OnInit {
targetWidth: 720,
targetHeight: 720,
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.capturedImage = imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
}, (err) => {
}, (err) => {
/* console.log(err); */
});
});
}
async save(){
console.log('SAVE');
runValidation() {
this.validateFrom = true
}
injectValidation() {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
Validators.required,
// Validators.minLength(4)
]),
capturedImage: new FormControl(this.capturedImage, [
]),
Message: new FormControl(this.pub.Message, [
Validators.required
])
})
}
async save() {
if(this.publicationType == '3'){
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if(this.publicationType == '3') {
console.log(this.navParams.get('publication'));
if(this.capturedImage != '') {
@@ -139,7 +176,7 @@ export class NewPublicationPage implements OnInit {
}
}
else{
else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -165,7 +202,7 @@ export class NewPublicationPage implements OnInit {
}
}
else{
else {
this.publication = {
DateIndex: new Date(),
DocumentId:null,
@@ -194,15 +231,17 @@ export class NewPublicationPage implements OnInit {
}
close(){
close() {
this.modalController.dismiss().then(()=>{
this.showLoader=true;
});
}
clear(){
clear() {
this.capturedImage = '';
}
setTitle(){
setTitle() {
if(this.publicationType == '1') {
this.publicationTitle = 'Nova Publicação Rápida';
}
@@ -239,4 +278,4 @@ export class NewPublicationPage implements OnInit {
this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl));
} */
}
}
@@ -7,11 +7,6 @@ import { IonicModule } from '@ionic/angular';
import { PublicationsPageRoutingModule } from './publications-routing.module';
import { PublicationsPage } from './publications.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { ViewPublicationsPage } from 'src/app/shared/publication/view-publications/view-publications.page';
import { NewPublicationPage } from 'src/app/shared/publication/new-publication/new-publication.page';
import { PublicationDetailPage } from 'src/app/shared/publication/view-publications/publication-detail/publication-detail.page';
import { NewActionPage } from 'src/app/shared/publication/new-action/new-action.page';
import { ComponentsModule } from 'src/app/components/components.module';
import { ViewPublicationsPageModule } from 'src/app/shared/publication/view-publications/view-publications.module';
import { NewPublicationPageModule } from 'src/app/shared/publication/new-publication/new-publication.module';
@@ -20,7 +15,6 @@ import { PublicationDetailPageModule } from 'src/app/shared/publication/view-pub
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module';
@NgModule({
imports: [
CommonModule,