fix publication

This commit is contained in:
peter.maquiran
2025-09-17 18:37:35 +01:00
parent 5f7295d41c
commit 3eecedb23f
64 changed files with 1043 additions and 873 deletions
@@ -5,10 +5,10 @@ import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { SessionStore } from 'src/app/store/session.service';
import { ActionRemoteRepositoryService } from 'src/app/module/actions/data/repository/action-remote-repository.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
@@ -60,9 +60,8 @@ export class EditActionPage implements OnInit {
private publicationsService: PublicationsService,
private toastService: ToastService,
private httpErrorHandle: HttpErrorHandle,
) {
}
private actionRemoteRepository: ActionRemoteRepositoryService
) {}
ngOnInit() {
this.getPublicationDetail();
@@ -73,11 +72,8 @@ export class EditActionPage implements OnInit {
}
getPublicationDetail() {
this.publicationsService.GetPresidentialAction(this.folderId).subscribe( res => {
this.folder = res;
console.log('FOLDER',this.folder)
this.dateControlStart = new FormControl(moment(new Date(this.folder.DateBegin)));
this.dateControlEnd = new FormControl(moment(new Date(this.folder.DateEnd)));
@@ -116,29 +112,27 @@ export class EditActionPage implements OnInit {
this.injectValidation();
this.runValidation();
let body = {
ProcessId: this.folderId,
Description: this.folder.Description,
Detail: this.folder.Detail,
DateBegin: this.folder.DateBegin,
DateEnd: this.folder.DateEnd,
ActionType: this.folder.ActionType,
}
const loader = this.toastService.loading()
try {
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close();
this.updateDesktopComponent.emit();
this.httpErrorHandle.httpsSucessMessagge('Editar Acção')
this.getActions.emit()
var result = await this.actionRemoteRepository.update({
userId: SessionStore.user.UserId,
description: this.folder.Description,
detail: this.folder.Detail,
location: "string",
dateBegin: this.folder.DateBegin,
dateEnd: this.folder.DateEnd,
actionType: "Evento",
processId: this.folder.ProcessId as any,
});
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
if(result.isOk()) {
this.close();
this.httpErrorHandle.httpsSucessMessagge('Editar Acção');
this.getActions.emit()
} else {
this.httpErrorHandle.httpStatusHandle(result.error)
}
loader.remove();
}
}