mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Improve
This commit is contained in:
@@ -18,6 +18,7 @@ import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { ViewPublicationsPage } from '../view-publications/view-publications.page';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-publication',
|
||||
@@ -52,6 +53,7 @@ export class NewPublicationPage implements OnInit {
|
||||
private navParams: NavParams,
|
||||
private publications: PublicationsService,
|
||||
private camera: Camera,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
|
||||
this.publicationType = this.navParams.get('publicationType');
|
||||
@@ -107,10 +109,10 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
async save(){
|
||||
if(this.publicationType == '3'){
|
||||
if(this.publicationType == '3') {
|
||||
console.log(this.navParams.get('publication'));
|
||||
|
||||
if(this.capturedImage != ''){
|
||||
if(this.capturedImage != '') {
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
DocumentId:this.publication.DocumentId,
|
||||
@@ -122,10 +124,18 @@ export class NewPublicationPage implements OnInit {
|
||||
FileBase64: this.capturedImage,
|
||||
FileExtension: 'jpeg',
|
||||
}
|
||||
console.log('Edit change image');
|
||||
console.log(this.publication);
|
||||
this.publications.UpdatePublication(this.publication.ProcessId, this.publication);
|
||||
this.close();
|
||||
|
||||
try {
|
||||
console.log(this.publication);
|
||||
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
this.publication = {
|
||||
@@ -141,8 +151,16 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
/* console.log('Edit - keep image');
|
||||
console.log(this.publication); */
|
||||
this.publications.UpdatePublication(this.publication.ProcessId, this.publication);
|
||||
this.close();
|
||||
try {
|
||||
console.log(this.publication);
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -163,6 +181,19 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log(this.publication); */
|
||||
this.publications.CreatePublication(this.folderId, this.publication);
|
||||
this.close();
|
||||
|
||||
|
||||
try {
|
||||
console.log(this.publication);
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user