mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
1 line
16 KiB
JSON
1 line
16 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 \"./new-action.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./new-action.page.scss?ngResource\";\nimport { Component, EventEmitter, Output } from '@angular/core';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\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 NewActionPage = class NewActionPage {\n constructor(publication, toastService, httpErrorHandle) {\n this.publication = publication;\n this.toastService = toastService;\n this.httpErrorHandle = httpErrorHandle;\n this.disabled = false;\n this.showSpinners = true;\n this.showSeconds = false;\n this.touchUi = false;\n this.enableMeridian = false;\n this.stepHour = 1;\n this.stepMinute = 15;\n this.stepSecond = 5;\n this.currentDate = new Date();\n this.endMinDate = new Date(new Date().getTime() + 15 * 60000);\n this.validateFrom = false;\n this.closeDesktopComponent = new EventEmitter();\n this.getActions = new EventEmitter();\n this.folder = new PublicationFolder();\n this.setStartDate();\n this.setEndDate();\n }\n ngOnInit() {\n this.segment = \"Evento\";\n }\n segmentChanged(ev) {}\n get dateValid() {\n var validado;\n if (window.innerWidth <= 800) {\n if (this.folder.DateBegin < this.folder.DateEnd && new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime()) {\n validado = true;\n } else {\n validado = false;\n }\n return validado == true ? ['ok'] : [];\n } else {\n return ['ok'];\n }\n }\n runValidation() {\n this.validateFrom = true;\n if (new Date(this.folder.DateBegin).getTime() > new Date(this.folder.DateEnd).getTime()) {\n this.toastService._badRequest(\"A data de início não pode ser superior a data de fim\");\n }\n }\n injectValidation() {\n this.Form = new UntypedFormGroup({\n Subject: new UntypedFormControl(this.folder.Description, [Validators.required\n //Validators.minLength(1)\n ]),\n\n Date: new UntypedFormControl(this.dateValid, [Validators.required]),\n Detail: new UntypedFormControl(this.folder.Detail, [Validators.required])\n });\n }\n save() {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this.injectValidation();\n _this.runValidation();\n if (_this.Form.invalid) {\n return false;\n } else {}\n _this.folder = {\n ProcessId: null,\n Description: _this.folder.Description,\n Detail: _this.folder.Detail,\n DateBegin: _this.folder.DateBegin,\n DateEnd: _this.folder.DateEnd,\n ActionType: _this.segment\n };\n const loader = _this.toastService.loading();\n try {\n yield _this.publication.CreatePublicationFolder(_this.folder).toPromise();\n _this.close();\n _this.httpErrorHandle.httpsSucessMessagge('Acção criada');\n _this.getActions.emit();\n } catch (error) {\n _this.httpErrorHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n })();\n }\n close() {\n this.closeDesktopComponent.emit();\n }\n round() {\n let date = new Date();\n const minutes = date.getMinutes();\n date.setSeconds(0);\n if (minutes % 15 != 0) {\n if (minutes > 45) {\n date.setMinutes(60);\n } else if (minutes > 30) {\n date.setMinutes(45);\n } else if (minutes > 15) {\n date.setMinutes(30);\n } else if (minutes > 0) {\n date.setMinutes(15);\n }\n }\n return date;\n }\n roundTimeQuarterHour() {\n let
|