This commit is contained in:
Peter Maquiran
2021-07-26 15:19:03 +01:00
parent 3f007be25e
commit 85f6df2f0e
16 changed files with 852 additions and 197 deletions
@@ -140,7 +140,7 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
Validators.required,
// Validators.required,
// Validators.minLength(4)
]),
Message: new FormControl(this.pub.Message, [
@@ -158,11 +158,10 @@ export class NewPublicationPage implements OnInit {
if(this.Form.invalid) return false
if(this.publicationType == '3') {
alert('3')
if(this.capturedImage != '') {
alert('2')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -180,7 +179,6 @@ export class NewPublicationPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
@@ -193,7 +191,7 @@ export class NewPublicationPage implements OnInit {
}
else if (!this.publication.OriginalFileName) {
alert('1')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -219,15 +217,42 @@ export class NewPublicationPage implements OnInit {
loader.remove()
}
} else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle,
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
console.log('Edit change image');
console.log(this.publication);
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
}
else {
let time = new Date()
this.publication = {
DateIndex: time,
DocumentId:null,
DocumentId: null,
ProcessId:this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,