mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user