mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Add loader and notification message
This commit is contained in:
+2
-2
@@ -5,12 +5,12 @@
|
|||||||
"homepage": "https://ionicframework.com/",
|
"homepage": "https://ionicframework.com/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve --port 4200",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"nice": "node server.js",
|
"nice": "node server.js",
|
||||||
"test": "jest --detectOpenHandles --runInBand"
|
"test": "jest --runInBand"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||||
</button>
|
</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>
|
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|||||||
+126
-143
@@ -255,120 +255,11 @@ export class ExpedientTaskModalPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||||
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
switch (this.loggeduser.Profile) {
|
switch (this.loggeduser.Profile) {
|
||||||
case 'MDGPR':
|
case 'MDGPR':
|
||||||
if(this.taskParticipants.length > 0) {
|
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,
|
|
||||||
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();
|
|
||||||
|
|
||||||
loader.remove()
|
|
||||||
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;
|
|
||||||
|
|
||||||
case '1':
|
|
||||||
this.postData = {
|
|
||||||
DistributionType: "Paralelo",
|
|
||||||
CountryCode: 'AO',
|
|
||||||
Priority: this.postData.Priority,
|
|
||||||
UserEmail: this.loggeduser.Email,
|
|
||||||
UsersSelected: attendees,
|
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
AttachmentList: docs
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
let action_parecer = {
|
|
||||||
"serialNumber": this.task.serialNumber,
|
|
||||||
"action": "Tratado",
|
|
||||||
"ActionTypeId": 92,
|
|
||||||
"dataFields": {
|
|
||||||
"Note": "",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
case '2':
|
|
||||||
this.postData = {
|
|
||||||
DistributionType: "Paralelo",
|
|
||||||
CountryCode: 'AO',
|
|
||||||
Priority: this.postData.Priority,
|
|
||||||
UserEmail: this.loggeduser.Email,
|
|
||||||
UsersSelected: attendees,
|
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
AttachmentList: docs
|
|
||||||
}
|
|
||||||
//console.log(this.postData);
|
|
||||||
const loader1 = this.toastService.loading()
|
|
||||||
|
|
||||||
try {
|
|
||||||
let action_deferimento = {
|
|
||||||
"serialNumber": this.task.serialNumber,
|
|
||||||
"action": "Tratado",
|
|
||||||
"ActionTypeId": 93,
|
|
||||||
"dataFields": {
|
|
||||||
"Note": "",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
|
||||||
await this.toastService.successMessage('Processo efetuado');
|
|
||||||
this.modalController.dismiss(action_deferimento);
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
await this.toastService.badRequest('Processo não efetuado')
|
|
||||||
} finally {
|
|
||||||
loader1.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('this.taskResult', this.taskResult);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.alertController.presentAlert("Lista de i-ntervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'PR':
|
|
||||||
switch (this.taskType) {
|
switch (this.taskType) {
|
||||||
case '0':
|
case '0':
|
||||||
this.postData = {
|
this.postData = {
|
||||||
@@ -380,27 +271,16 @@ export class ExpedientTaskModalPage implements OnInit {
|
|||||||
DispatchFolder: this.dispatchFolder,
|
DispatchFolder: this.dispatchFolder,
|
||||||
AttachmentList: docs,
|
AttachmentList: docs,
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.postData);
|
console.log(this.postData);
|
||||||
const loader = this.toastService.loading()
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let action_despacho_pr = {
|
|
||||||
"serialNumber": this.task.serialNumber,
|
|
||||||
"action": "Tratado",
|
|
||||||
"ActionTypeId": 99999881 ,
|
|
||||||
"dataFields": {
|
|
||||||
"Note": "",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loader.remove()
|
|
||||||
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
|
||||||
|
|
||||||
|
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||||
await this.toastService.successMessage('Processo efetuado');
|
await this.toastService.successMessage('Processo efetuado');
|
||||||
this.modalController.dismiss(action_despacho_pr);
|
this.modalController.dismiss();
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loader.remove()
|
|
||||||
await this.toastService.badRequest('Processo não efetuado')
|
await this.toastService.badRequest('Processo não efetuado')
|
||||||
} finally {
|
} finally {
|
||||||
loader.remove()
|
loader.remove()
|
||||||
@@ -420,33 +300,136 @@ export class ExpedientTaskModalPage implements OnInit {
|
|||||||
AttachmentList: docs
|
AttachmentList: docs
|
||||||
}
|
}
|
||||||
|
|
||||||
const loader2 = this.toastService.loading()
|
let action_parecer = {
|
||||||
|
"serialNumber": this.task.serialNumber,
|
||||||
|
"action": "Tratado",
|
||||||
|
"ActionTypeId": 92,
|
||||||
|
"dataFields": {
|
||||||
|
"Note": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let action_parecer_pr = {
|
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
|
||||||
"serialNumber": this.task.serialNumber,
|
await this.toastService.successMessage('Pedido enviado');
|
||||||
"action": "Tratado",
|
this.modalController.dismiss(action_parecer);
|
||||||
"ActionTypeId": 99999881,
|
|
||||||
"dataFields": {
|
|
||||||
"Note": "",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
} catch (error) {
|
||||||
|
|
||||||
await this.toastService.badRequest('Processo não efetuado')
|
await this.toastService.badRequest('Processo não efetuado')
|
||||||
} finally {
|
} finally {
|
||||||
loader2.remove()
|
loader.remove()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '2':
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
AttachmentList: docs
|
||||||
|
}
|
||||||
|
//console.log(this.postData);
|
||||||
|
let action_deferimento = {
|
||||||
|
"serialNumber": this.task.serialNumber,
|
||||||
|
"action": "Tratado",
|
||||||
|
"ActionTypeId": 93,
|
||||||
|
"dataFields": {
|
||||||
|
"Note": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
||||||
|
this.toastService.successMessage('Processo efetuado');
|
||||||
|
this.modalController.dismiss(action_deferimento);
|
||||||
|
} catch (error) {
|
||||||
|
await this.toastService.badRequest('Processo não efetuado')
|
||||||
|
} finally {
|
||||||
|
loader.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('this.taskResult', this.taskResult);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.alertController.presentAlert("Lista de i-ntervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'PR':
|
||||||
|
switch (this.taskType) {
|
||||||
|
case '0':
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
AttachmentList: docs,
|
||||||
|
}
|
||||||
|
console.log(this.postData);
|
||||||
|
|
||||||
|
let action_despacho_pr = {
|
||||||
|
"serialNumber": this.task.serialNumber,
|
||||||
|
"action": "Tratado",
|
||||||
|
"ActionTypeId": 99999881 ,
|
||||||
|
"dataFields": {
|
||||||
|
"Note": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
||||||
|
await this.toastService.successMessage('Processo efetuado');
|
||||||
|
this.modalController.dismiss(action_despacho_pr);
|
||||||
|
} catch (error) {
|
||||||
|
await this.toastService.badRequest('Processo não efetuado')
|
||||||
|
} finally {
|
||||||
|
loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('this.taskResult', this.taskResult);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '1':
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
AttachmentList: docs
|
||||||
|
}
|
||||||
|
|
||||||
|
let action_parecer_pr = {
|
||||||
|
"serialNumber": this.task.serialNumber,
|
||||||
|
"action": "Tratado",
|
||||||
|
"ActionTypeId": 99999881,
|
||||||
|
"dataFields": {
|
||||||
|
"Note": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
loader.remove()
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttachments() {
|
getAttachments() {
|
||||||
|
|||||||
@@ -181,8 +181,6 @@
|
|||||||
<div class="ion-icon-class">
|
<div class="ion-icon-class">
|
||||||
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
|
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ this.postEvent.EventRecurrence.Type }}
|
|
||||||
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('dateOccurrence')?.invalid && validateFrom ">
|
<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>
|
<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.dateAdapter.setLocale('pt');
|
||||||
this.loggeduser = userService.ValidatedUser;
|
this.loggeduser = userService.ValidatedUser;
|
||||||
|
|
||||||
this.dateControlStart = new FormControl(moment(new Date()));
|
this.postEvent.StartDate = new Date();
|
||||||
this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000)));
|
this.postEvent.EndDate = new Date(new Date().getTime() + 15 * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -342,8 +342,6 @@ export class NewEventPage implements OnInit {
|
|||||||
|
|
||||||
restoreDatepickerData() {
|
restoreDatepickerData() {
|
||||||
if (this.postEvent) {
|
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"))
|
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence, "DD MM YYYY hh:mm"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,36 +4,10 @@ describe('Puppeteer tests', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
// await page.goto(process.env.PUPPETEER_HOST)
|
// 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 () => {
|
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