mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve form validation
This commit is contained in:
+3
-3
@@ -128,12 +128,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="container-div" >
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class-no-height">
|
||||
<div class="ion-input-class-no-height" [class.input-error]="Form?.get('participantes')?.invalid && validateFrom ">
|
||||
<div class="list-people">
|
||||
<ion-item lines="none">
|
||||
<ion-list>
|
||||
@@ -154,7 +154,7 @@
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-people-cc.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class-no-height">
|
||||
<div class="ion-input-class-no-height" >
|
||||
<div class="list-people">
|
||||
<ion-item lines="none">
|
||||
<ion-list>
|
||||
|
||||
+19
-3
@@ -206,9 +206,9 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
// IsRecurring: new FormControl(this.postEvent.IsRecurring, [
|
||||
// Validators.required
|
||||
// ]),
|
||||
// participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [
|
||||
// Validators.required
|
||||
// ]),
|
||||
participantes: new FormControl(this.taskParticipantsCc, [
|
||||
Validators.required
|
||||
]),
|
||||
|
||||
})
|
||||
}
|
||||
@@ -236,6 +236,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
else if(this.postData.Priority=='99999864') {
|
||||
this.dispatchFolder.DeadlineType = 'Urgentíssimo';
|
||||
}
|
||||
|
||||
let attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
attendees = attendees.map(function(val) {
|
||||
return {
|
||||
@@ -261,6 +262,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
this.selectedTypes = this.toppingsValues
|
||||
}
|
||||
|
||||
let loader = this.toastService.loading()
|
||||
|
||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||
|
||||
switch (this.loggeduser.Profile) {
|
||||
@@ -289,10 +292,13 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||
|
||||
loader.remove()
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss();
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
@@ -319,10 +325,12 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
}
|
||||
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
|
||||
loader.remove()
|
||||
await this.toastService.successMessage('Pedido enviado');
|
||||
this.modalController.dismiss(action_parecer);
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
break;
|
||||
@@ -347,9 +355,12 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
}
|
||||
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
||||
|
||||
loader.remove()
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_deferimento);
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
@@ -382,12 +393,15 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
loader.remove()
|
||||
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
||||
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
@@ -413,12 +427,14 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
loader.remove()
|
||||
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado');
|
||||
this.modalController.dismiss(action_parecer_pr);
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -123,11 +123,18 @@ export class NewActionPage implements OnInit {
|
||||
ActionType: this.segment,
|
||||
}
|
||||
|
||||
|
||||
let loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.publication.CreatePublicationFolder(this.folder).toPromise();
|
||||
|
||||
loader.remove()
|
||||
this.toastService.successMessage("Ação presidencial criado");
|
||||
this.close();
|
||||
} catch (error) {
|
||||
|
||||
loader.remove()
|
||||
this.toastService.badRequest("Ação presidencial não criado");
|
||||
}
|
||||
|
||||
|
||||
@@ -125,4 +125,25 @@ export class ToastService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
loading() : HTMLDivElement {
|
||||
let loader: HTMLDivElement = document.createElement('div')
|
||||
loader.innerHTML = `
|
||||
|
||||
<div class="loading-blocker">
|
||||
<div class="loading-blocker-container">
|
||||
<img src="/assets/images/Blocks-loader.gif" width="250" />
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
document.body.append(loader)
|
||||
|
||||
loader.addEventListener('click', ()=>{
|
||||
// loader.remove()
|
||||
})
|
||||
return loader
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -342,9 +342,13 @@ export class NewEventPage implements OnInit {
|
||||
console.log(this.postEvent);
|
||||
|
||||
|
||||
let loader = this.toastService.loading()
|
||||
|
||||
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
async (id) => {
|
||||
|
||||
loader.remove()
|
||||
|
||||
this.showLoader = false
|
||||
|
||||
const eventId: any = id;
|
||||
@@ -382,6 +386,8 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
},
|
||||
error => {
|
||||
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.toastService.badRequest('Evento não criado')
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ export class NewActionPage implements OnInit {
|
||||
}
|
||||
|
||||
get dateValid() {
|
||||
if (window.innerWidth <= 800) {
|
||||
if (window.innerWidth >= 800) {
|
||||
return this.folder.DateBegin < this.folder.DateEnd? ['ok']: []
|
||||
} else {
|
||||
return ['ok']
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -1036,4 +1036,19 @@ ngx-mat-datetime-content{
|
||||
|
||||
.mat-form-field-infix, .mat-form-field-wrapper {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
|
||||
.loading-blocker {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #0000006b;
|
||||
|
||||
.loading-blocker-container {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user