mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Add loader and notification message
This commit is contained in:
+2
-2
@@ -5,12 +5,12 @@
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"start": "ng serve --port 4200",
|
||||
"build": "ng build",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"nice": "node server.js",
|
||||
"test": "jest --detectOpenHandles --runInBand"
|
||||
"test": "jest --runInBand"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="clearContact();openAddEvent();">
|
||||
<button class="btn-no-color cy-add-event" (click)="clearContact();openAddEvent();">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
|
||||
</button>
|
||||
|
||||
|
||||
+17
-34
@@ -255,6 +255,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
|
||||
|
||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
@@ -271,30 +272,20 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
let action_despacho = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
console.log(this.postData);
|
||||
|
||||
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||
try {
|
||||
|
||||
loader.remove()
|
||||
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss();
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
break;
|
||||
|
||||
@@ -309,7 +300,6 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs
|
||||
}
|
||||
|
||||
try {
|
||||
let action_parecer = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
@@ -318,14 +308,16 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
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')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
@@ -339,9 +331,6 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs
|
||||
}
|
||||
//console.log(this.postData);
|
||||
const loader1 = this.toastService.loading()
|
||||
|
||||
try {
|
||||
let action_deferimento = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
@@ -350,14 +339,16 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_deferimento);
|
||||
} catch (error) {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader1.remove()
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
@@ -381,9 +372,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs,
|
||||
}
|
||||
console.log(this.postData);
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
let action_despacho_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
@@ -393,14 +382,11 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
loader.remove()
|
||||
try {
|
||||
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')
|
||||
} finally {
|
||||
loader.remove()
|
||||
@@ -420,9 +406,6 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs
|
||||
}
|
||||
|
||||
const loader2 = this.toastService.loading()
|
||||
|
||||
try {
|
||||
let action_parecer_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
@@ -432,16 +415,16 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
|
||||
try {
|
||||
|
||||
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) {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader2.remove()
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -181,8 +181,6 @@
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
|
||||
</div>
|
||||
|
||||
{{ this.postEvent.EventRecurrence.Type }}
|
||||
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('dateOccurrence')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
|
||||
|
||||
@@ -134,8 +134,8 @@ export class NewEventPage implements OnInit {
|
||||
this.dateAdapter.setLocale('pt');
|
||||
this.loggeduser = userService.ValidatedUser;
|
||||
|
||||
this.dateControlStart = new FormControl(moment(new Date()));
|
||||
this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000)));
|
||||
this.postEvent.StartDate = new Date();
|
||||
this.postEvent.EndDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -342,8 +342,6 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
restoreDatepickerData() {
|
||||
if (this.postEvent) {
|
||||
this.dateControlStart = new FormControl(moment(this.postEvent.StartDate, "DD MM YYYY hh:mm"));
|
||||
this.dateControlEnd = new FormControl(moment(this.postEvent.EndDate, "DD MM YYYY hh:mm"));
|
||||
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence, "DD MM YYYY hh:mm"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,36 +4,10 @@ describe('Puppeteer tests', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
// await page.goto(process.env.PUPPETEER_HOST)
|
||||
|
||||
})
|
||||
|
||||
test('[table] login', async () => {
|
||||
|
||||
// const browser = await puppeteer.launch({headless: false});
|
||||
await page.setViewport({width: 1200, height: 720});
|
||||
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
||||
await page.waitForSelector('.btn-ok')
|
||||
|
||||
|
||||
await page.evaluate( () => {
|
||||
let a: HTMLInputElement = document.querySelector('input[type="text"]')
|
||||
a.value = ''
|
||||
|
||||
let b: HTMLInputElement = document.querySelector('input[type="password"')
|
||||
b.value = ''
|
||||
})
|
||||
|
||||
await page.type('input[type="text"]', environment.defaultuser);
|
||||
await page.type('input[type="password"]', environment.defaultuserpwd);
|
||||
// click and wait for navigation
|
||||
await Promise.all([
|
||||
page.click('.btn-ok'),
|
||||
// page.waitForNavigation({ waitUntil: 'networkidle0' }),
|
||||
]);
|
||||
|
||||
await page.waitForSelector('.circle')
|
||||
|
||||
expect(3 + 2).toBe(5);
|
||||
},30000);
|
||||
|
||||
test('[table] Clear Code button and set pin', async () => {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { environment } from '../src/environments/environment'
|
||||
|
||||
describe('Puppeteer tests', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
// await page.goto(process.env.PUPPETEER_HOST)
|
||||
})
|
||||
|
||||
|
||||
test('[table] create event', async () => {
|
||||
|
||||
// const browser = await puppeteer.launch({headless: false});
|
||||
await page.setViewport({width: 1200, height: 720});
|
||||
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
||||
await page.waitForSelector('ion-tab-bar ion-tab-button:nth-child(3)')
|
||||
await page.click('ion-tab-bar ion-tab-button:nth-child(3)')
|
||||
|
||||
await page.waitForSelector('ion-content ion-row .cy-add-event')
|
||||
await page.waitForSelector('app-new-event')
|
||||
|
||||
expect(3 + 2).toBe(5);
|
||||
},30000);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
import { environment } from './../src/environments/environment'
|
||||
|
||||
describe('Puppeteer tests', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
// await page.goto(process.env.PUPPETEER_HOST)
|
||||
})
|
||||
|
||||
test('login', async () => {
|
||||
|
||||
|
||||
expect(3 + 2).toBe(5);
|
||||
}, 30000);
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user