mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +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 { ModalController, NavParams } from '@ionic/angular';
|
||||||
import { Publication } from 'src/app/models/publication';
|
import { Publication } from 'src/app/models/publication';
|
||||||
import { PublicationsService } from 'src/app/services/publications.service';
|
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 { ImageModalPage } from '../gallery/image-modal/image-modal.page';
|
||||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||||
|
|
||||||
@@ -76,12 +78,16 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePost(){
|
async deletePost(){
|
||||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
|
||||||
console.log(res);
|
try {
|
||||||
|
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||||
});
|
this.successMessage()
|
||||||
this.close();
|
this.close();
|
||||||
|
} catch (error) {
|
||||||
|
this.badRequest()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async editPost(publicationType:any) {
|
async editPost(publicationType:any) {
|
||||||
@@ -114,4 +120,38 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}).then(modal => modal.present());
|
}).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 { ModalController, NavParams } from '@ionic/angular';
|
||||||
import { Publication } from 'src/app/models/publication';
|
import { Publication } from 'src/app/models/publication';
|
||||||
import { PublicationsService } from 'src/app/services/publications.service';
|
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 { ImageModalPage } from '../../gallery/image-modal/image-modal.page';
|
||||||
import { NewPublicationPage } from '../../new-publication/new-publication.page';
|
import { NewPublicationPage } from '../../new-publication/new-publication.page';
|
||||||
|
|
||||||
@@ -75,13 +76,20 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePost(){
|
|
||||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
async deletePost(){
|
||||||
console.log(res);
|
|
||||||
});
|
try {
|
||||||
this.close();
|
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||||
|
this.successMessage()
|
||||||
|
this.goBackToViewPublications.emit();
|
||||||
|
} catch (error) {
|
||||||
|
this.badRequest()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async editPost(publicationType:any) {
|
async editPost(publicationType:any) {
|
||||||
console.log(this.publication);
|
console.log(this.publication);
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
@@ -110,4 +118,39 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}).then(modal => modal.present());
|
}).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)
|
return this.http.post<any>(`${geturl}`, body, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePublicationFolder(body:any){
|
UpdatePublicationFolder(body:any) {
|
||||||
const geturl = environment.apiURL + 'presidentialActions';
|
const geturl = environment.apiURL + 'presidentialActions';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.http.put<any>(`${geturl}`, body, options).toPromise().then(res =>{
|
return this.http.put<any>(`${geturl}`, body, options).toPromise().then(res =>{
|
||||||
console.log(res);
|
console.log(res);
|
||||||
});
|
});
|
||||||
@@ -89,10 +91,6 @@ export class PublicationsService {
|
|||||||
|
|
||||||
/* params = params.set("id", publicationId); */
|
/* params = params.set("id", publicationId); */
|
||||||
|
|
||||||
|
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
/* params: params */
|
/* params: params */
|
||||||
@@ -119,6 +117,7 @@ export class PublicationsService {
|
|||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
/* params: params */
|
/* params: params */
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.http.put<any>(`${geturl}`, body, options)
|
return this.http.put<any>(`${geturl}`, body, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ export class PublicationsService {
|
|||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
/* params: params */
|
/* 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 { 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 { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page';
|
||||||
import { PublicationsService } from 'src/app/services/publications.service';
|
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({
|
@Component({
|
||||||
selector: 'app-publication-detail-shared',
|
selector: 'app-publication-detail-shared',
|
||||||
@@ -81,12 +83,16 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePost(){
|
async deletePost(){
|
||||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
|
||||||
console.log(res);
|
try {
|
||||||
|
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||||
});
|
this.successMessage()
|
||||||
this.goBackToViewPublications.emit();
|
this.goBackToViewPublications.emit();
|
||||||
|
} catch (error) {
|
||||||
|
this.badRequest()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async editPost(publicationType:any) {
|
async editPost(publicationType:any) {
|
||||||
@@ -132,4 +138,40 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
this.goBackToViewPublications.emit();
|
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