mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Improve success message
This commit is contained in:
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
|
||||
import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component';
|
||||
import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
|
||||
@@ -76,12 +78,16 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
deletePost(){
|
||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
this.close();
|
||||
async deletePost(){
|
||||
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
@@ -114,4 +120,38 @@ export class PublicationDetailPage implements OnInit {
|
||||
}).then(modal => modal.present());
|
||||
}
|
||||
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest() {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: 'Processo não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
}
|
||||
|
||||
+48
-5
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
|
||||
import { ImageModalPage } from '../../gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from '../../new-publication/new-publication.page';
|
||||
|
||||
@@ -75,13 +76,20 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
deletePost(){
|
||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
||||
console.log(res);
|
||||
});
|
||||
this.close();
|
||||
|
||||
async deletePost(){
|
||||
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.successMessage()
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
console.log(this.publication);
|
||||
const modal = await this.modalController.create({
|
||||
@@ -110,4 +118,39 @@ export class PublicationDetailPage implements OnInit {
|
||||
}).then(modal => modal.present());
|
||||
}
|
||||
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest() {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: 'Processo não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,11 +46,13 @@ export class PublicationsService {
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
UpdatePublicationFolder(body:any){
|
||||
UpdatePublicationFolder(body:any) {
|
||||
const geturl = environment.apiURL + 'presidentialActions';
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
|
||||
return this.http.put<any>(`${geturl}`, body, options).toPromise().then(res =>{
|
||||
console.log(res);
|
||||
});
|
||||
@@ -89,10 +91,6 @@ export class PublicationsService {
|
||||
|
||||
/* params = params.set("id", publicationId); */
|
||||
|
||||
|
||||
console.log(params);
|
||||
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
/* params: params */
|
||||
@@ -119,6 +117,7 @@ export class PublicationsService {
|
||||
headers: this.headers,
|
||||
/* params: params */
|
||||
};
|
||||
|
||||
return this.http.put<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ export class PublicationsService {
|
||||
headers: this.headers,
|
||||
/* params: params */
|
||||
};
|
||||
return this.http.delete(`${geturl}`, options).toPromise();
|
||||
return this.http.delete(`${geturl}`, options)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+48
-6
@@ -4,6 +4,8 @@ import { Publication } from 'src/app/models/publication';
|
||||
import { ImageModalPage } from 'src/app/pages/publications/gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
|
||||
import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publication-detail-shared',
|
||||
@@ -81,12 +83,16 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
deletePost(){
|
||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
this.goBackToViewPublications.emit();
|
||||
async deletePost(){
|
||||
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.successMessage()
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
@@ -132,4 +138,40 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.goBackToViewPublications.emit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest() {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: 'Processo não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user