mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
1 line
12 KiB
JSON
1 line
12 KiB
JSON
|
|
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./edit-action.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./edit-action.page.scss?ngResource\";\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport * as moment from 'moment';\nimport { PublicationFolder } from 'src/app/models/publicationfolder';\nimport { PublicationsService } from 'src/app/services/publications.service';\nimport { ToastService } from 'src/app/services/toast.service';\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service';\nlet EditActionPage = class EditActionPage {\n constructor(publicationsService, toastService, httpErrorHandle) {\n this.publicationsService = publicationsService;\n this.toastService = toastService;\n this.httpErrorHandle = httpErrorHandle;\n this.validateFrom = false;\n this.disabled = false;\n this.showSpinners = true;\n this.showSeconds = false;\n this.touchUi = false;\n this.enableMeridian = false;\n this.minDate = new Date().toISOString().slice(0, 10);\n this.endMinDate = new Date(new Date().getTime() + 15 * 60000);\n this.stepHour = 1;\n this.stepMinute = 15;\n this.stepSecond = 5;\n this.dateControlStart = new UntypedFormControl(moment(\"DD MM YYYY hh\"));\n this.dateControlEnd = new UntypedFormControl(moment(\"DD MM YYYY hh\"));\n this.currentDate = new Date();\n this.closeDesktopComponent = new EventEmitter();\n this.updateDesktopComponent = new EventEmitter();\n this.getActions = new EventEmitter();\n this.folder = new PublicationFolder();\n }\n ngOnInit() {\n this.getPublicationDetail();\n }\n close() {\n this.closeDesktopComponent.emit();\n }\n getPublicationDetail() {\n this.publicationsService.GetPresidentialAction(this.folderId).subscribe(res => {\n this.folder = res;\n this.dateControlStart = new UntypedFormControl(moment(new Date(this.folder.DateBegin)));\n this.dateControlEnd = new UntypedFormControl(moment(new Date(this.folder.DateEnd)));\n });\n }\n get dateValid() {\n if (window.innerWidth < 701) {\n return this.folder.DateBegin < this.folder.DateEnd ? ['ok'] : [];\n } else {\n return ['ok'];\n }\n }\n runValidation() {\n this.validateFrom = true;\n }\n injectValidation() {\n this.Form = new UntypedFormGroup({\n Subject: new UntypedFormControl(this.folder.Description, [Validators.required\n // Validators.minLength(4)\n ]),\n\n Date: new UntypedFormControl(this.dateValid, [Validators.required])\n });\n }\n save() {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this.injectValidation();\n _this.runValidation();\n let body = {\n ProcessId: _this.folderId,\n Description: _this.folder.Description,\n Detail: _this.folder.Detail,\n DateBegin: _this.folder.DateBegin,\n DateEnd: _this.folder.DateEnd,\n ActionType: _this.folder.ActionType\n };\n const loader = _this.toastService.loading();\n try {\n yield _this.publicationsService.UpdatePresidentialAction(body).toPromise();\n _this.close();\n _this.updateDesktopComponent.emit();\n _this.httpErrorHandle.httpsSucessMessagge('Editar Acção');\n _this.getActions.emit();\n } catch (error) {\n _this.httpErrorHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n })();\n }\n};\nEditActionPage.ctorParameters = () => [{\n type: PublicationsService\n}, {\n type: ToastService\n}, {\n type: HttpErrorHandle\n}];\nEditActionPage.propDecorators = {\n folderId: [{\n type: Input\n }],\n closeDesktopComponent: [{\n type: Output\n }],\n updateDesktopComponent: [{\n type: Output\n }],\n getActions: [{\n
|