Files
doneit-web/.angular/cache/14.2.12/babel-webpack/0608eff35644539c2e974128bf435ff9.json
T
Eudes Inácio 53b71ea16f its working
2023-06-30 09:54:21 +01:00

1 line
27 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-publication.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./new-publication.page.scss?ngResource\";\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { PublicationsService } from 'src/app/services/publications.service';\nimport { Publication } from 'src/app/models/publication';\nimport { Image } from 'src/app/models/image';\nimport { PhotoService } from 'src/app/services/photo.service';\nimport { ToastService } from 'src/app/services/toast.service';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { Camera, CameraResultType, CameraSource } from '@capacitor/camera';\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service';\nlet NewPublicationPage = class NewPublicationPage {\n constructor(photoService, publications, toastService, ThemeService, httpErroHandle) {\n this.photoService = photoService;\n this.publications = publications;\n this.toastService = toastService;\n this.ThemeService = ThemeService;\n this.httpErroHandle = httpErroHandle;\n this.pub = new Publication();\n this.image = new Image();\n this.Defaultimage = '';\n this.validateFrom = false;\n this.publication = new Publication();\n this.closeDesktopComponent = new EventEmitter();\n this.openPublicationDetails = new EventEmitter();\n this.goBackToViewPublications = new EventEmitter();\n this.goBacktoPublicationDetails = new EventEmitter();\n this.capturedImage = '';\n this.photos = [];\n this.publicationTitle = 'Nova Publicação';\n }\n ngOnInit() {\n if (this.publicationType == '3') {\n this.getPublicationDetail();\n }\n this.setTitle();\n //this.clear();\n //this.takePicture();\n }\n\n getPublicationDetail() {\n this.showLoader = true;\n this.publications.GetPublicationById(this.publicationId).subscribe(res => {\n this.publication = {\n DateIndex: res.DateIndex,\n DocumentId: res.DocumentId,\n ProcessId: res.ProcessId,\n Title: res.Title,\n Message: res.Message,\n DatePublication: res.DatePublication,\n FileBase64: \"data:image/jpg;base64,\" + res.FileBase64,\n OriginalFileName: res.OriginalFileName,\n FileExtension: 'jpeg'\n };\n this.pub = this.publication;\n this.showLoader = false;\n });\n }\n takePicture() {\n var _this = this;\n return _asyncToGenerator(function* () {\n const capturedImage = yield Camera.getPhoto({\n quality: 90,\n // allowEditing: true,\n resultType: CameraResultType.Base64,\n source: CameraSource.Camera\n });\n _this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;\n _this.capturedImageTitle = capturedImage.path;\n //\n })();\n }\n\n laodPicture() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n const capturedImage = yield Camera.getPhoto({\n quality: 90,\n resultType: CameraResultType.Base64,\n source: CameraSource.Photos\n });\n _this2.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;\n _this2.capturedImageTitle = capturedImage.path;\n })();\n }\n runValidation() {\n this.validateFrom = true;\n }\n injectValidation() {\n this.Form = new UntypedFormGroup({\n Subject: new UntypedFormControl(this.pub.Title, [Validators.required\n // Validators.minLength(4)\n ]),\n\n Message: new UntypedFormControl(this.pub.Message, [Validators.required, Validators.maxLength(1000)])\n });\n }\n save() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n _this3.injectValidation();\n _this3.runValidation();\n if (_this3.Form.invalid) {\n return false;\n } else {}\n if (_this3.publicationType == '3') {\n if (_this3.capturedImage != '') {\n _this3.publication = {\n DateIndex: _this3.publication.DateIndex,\n DocumentId: _this3.publication.DocumentId,\n ProcessId: _this3.publication.ProcessId,\n Title: _this3.pub.Title,\n Message: _this3.pub.Message,\n DatePublication: _this3.publication.DatePublication,\n OriginalFileName: _this3.capturedImageTitle,\n FileBase64: _this3.capturedImage,\n FileExtension: 'jpeg'\n };\n const loader = _this3.toastService.loading();\n try {\n yield _this3.publications.UpdatePublication(_this3.publication.ProcessId, _this3.publication).toPromise();\n _this3.httpErroHandle.httpsSucessMessagge('Criar publicação');\n _this3.goBack();\n } catch (error) {\n _this3.httpErroHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n } else if (!_this3.publication.OriginalFileName) {\n //\n _this3.publication = {\n DateIndex: _this3.publication.DateIndex,\n DocumentId: _this3.publication.DocumentId,\n ProcessId: _this3.publication.ProcessId,\n Title: _this3.pub.Title,\n Message: _this3.pub.Message,\n DatePublication: _this3.publication.DatePublication,\n OriginalFileName: _this3.capturedImageTitle\n // OriginalFileName: this.publication.OriginalFileName,\n // FileBase64: this.publication.FileBase64,\n // FileExtension: 'jpeg',\n };\n\n const loader = _this3.toastService.loading();\n try {\n yield _this3.publications.UpdatePublication(_this3.publication.ProcessId, _this3.publication).toPromise();\n _this3.httpErroHandle.httpsSucessMessagge('Criar publicação');\n _this3.goBack();\n } catch (error) {\n _this3.httpErroHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n } else {\n _this3.publication = {\n DateIndex: _this3.publication.DateIndex,\n DocumentId: _this3.publication.DocumentId,\n ProcessId: _this3.publication.ProcessId,\n Title: _this3.pub.Title,\n Message: _this3.pub.Message,\n DatePublication: _this3.publication.DatePublication,\n OriginalFileName: _this3.capturedImageTitle,\n FileBase64: _this3.capturedImage,\n FileExtension: 'jpeg'\n };\n const loader = _this3.toastService.loading();\n try {\n yield _this3.publications.UpdatePublication(_this3.publication.ProcessId, _this3.publication).toPromise();\n _this3.httpErroHandle.httpsSucessMessagge('Criar publicação');\n _this3.goBack();\n } catch (error) {\n _this3.httpErroHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n }\n } else {\n let time = new Date();\n _this3.publication = {\n DateIndex: time,\n DocumentId: null,\n ProcessId: _this3.folderId,\n Title: _this3.pub.Title,\n Message: _this3.pub.Message,\n DatePublication: time,\n OriginalFileName: _this3.capturedImageTitle,\n FileBase64: _this3.capturedImage,\n FileExtension: 'jpeg'\n };\n const loader = _this3.toastService.loading();\n try {\n yield _this3.publications.CreatePublication(_this3.folderId, _this3.publication).toPromise();\n if (_this3.publicationTitle == '1') {} else if (_this3.publicationTitle == '2') {\n _this3.httpErroHandle.httpsSucessMessagge('Criar publicação');\n } else if (_this3.publicationTitle == '3') {\n _this3.httpErroHandle.httpsSucessMessagge('Editar publicação');\n }\n _this3.goBackToViewPublications.emit();\n } catch (error) {\n _this3.httpErroHandle.httpStatusHandle(error);\n } finally {\n loader.remove();\n }\n }\n })();\n }\n close() {\n this.goBack();\n }\n clear() {\n this.capturedImage = '';\n }\n setTitle() {\n if (this.publicationType == '1') {\n this.publicationTitle = 'Nova Publicação Rápida';\n } else if (this.publicationType == '2') {\n this.publicationTitle = 'Nova Publicação';\n } else if (this.publicationType == '3') {\n this.publicationTitle = 'Editar Publicação';\n this.pub = this.publication;\n }\n }\n goBack() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n if (_this4.publicationType == '2') {\n _this4.goBackToViewPublications.emit();\n } else {\n _this4.goBackToViewPublications.emit();\n //this.goBacktoPublicationDetails.emit();\n }\n })();\n }\n};\n\nNewPublicationPage.ctorParameters = () => [{\n type: PhotoService\n}, {\n type: PublicationsService\n}, {\n type: ToastService\n}, {\n type: ThemeService\n}, {\n type: HttpErrorHandle\n}];\nNewPublicationPage.propDecorators = {\n publicationType: [{\n type: Input\n }],\n folderId: [{\n type: Input\n }],\n publicationId: [{\n type: Input\n }],\n closeDesktopComponent: [{\n type: Output\n }],\n openPublicationDetails: [{\n type: Output\n }],\n goBackToViewPublications: [{\n type: Output\n }],\n goBacktoPublicationDetails: [{\n type: Output\n }]\n};\nNewPublicationPage = __decorate([Component({\n selector: 'app-new-publication',\n template: __NG_CLI_RESOURCE__0,\n styles: [__NG_CLI_RESOURCE__1]\n})], NewPublicationPage);\nexport { NewPublicationPage };","map":{"version":3,"mappings":";;;;AAAA,SAASA,SAAS,EAAUC,KAAK,EAAEC,MAAM,EAAEC,YAAY,QAAQ,eAAe;AAE9E,SAASC,mBAAmB,QA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,CAACF,gBAAgB,GAAG,iBAAiB;KAC1C,MACI,IAAG,IAAI,CAACE,eAAe,IAAI,GAAG,EAAE;MACnC,IAAI,CAACF,gBAAgB,GAAG,mBAAmB;MAC3C,IAAI,CAACoB,GAAG,GAAG,IAAI,CAACV,WAAW;;EAE/B;EAEMwC,MAAMA;IAAA;IAAA;MAEV,IAAGY,MAAI,CAAC5D,eAAe,IAAI,GAAG,EAAC;QAC7B4D,MAAI,CAACJ,wBAAwB,CAACC,IAAI,EAAE;OACrC,MAAM;QACLG,MAAI,CAACJ,wBAAwB,CAACC,IAAI,EAAE;QACpC;;IACD;EAEH;;;;;;;;;;;;;;;;UA3QCjF;EAAK;;UACLA;EAAK;;UACLA;EAAK;;UACLC;EAAM;;UACNA;EAAM;;UACNA;EAAM;;UACNA;EAAM;;AAvBIe,kBAAkB,eAL9BjB,SAAS,CAAC;EACTsF,QAAQ,EAAE,qBAAqB;EAC/BC,8BAA0C;;CAE3C,CAAC,GACWtE,kBAAkB;SAAlBA,kBAAkB","names":["Component","Input","Output","EventEmitter","PublicationsService","Publication","Image","PhotoService","ToastService","UntypedFormControl","UntypedFormGroup","Validators","ThemeService","Camera","CameraResultType","CameraSource","HttpErrorHandle","NewPublicationPage","constructor","photoService","publications","toastService","httpErroHandle","publicationTitle","ngOnInit","publicationType","getPublicationDetail","setTitle","showLoader","GetPublicationById","publicationId","subscribe","res","publication","DateIndex","DocumentId","ProcessId","Title","Message","DatePublication","FileBase64","OriginalFileName","FileExtension","pub","takePicture","capturedImage","getPhoto","quality","resultType","Base64","source","_this","base64String","capturedImageTitle","path","laodPicture","Photos","_this2","runValidation","validateFrom","injectValidation","Form","Subject","required","maxLength","save","_this3","invalid","loader","loading","UpdatePublication","toPromise","httpsSucessMessagge","goBack","error","httpStatusHandle","remove","time","Date","folderId","CreatePublication","goBackToViewPublications","emit","close","clear","_this4","selector","template"],"sourceRoot":"","sources":["C:\\Users\\eudes.inacio\\GabineteDigital\\gabinete-digital-fo\\src\\app\\shared\\publication\\new-publication\\new-publication.page.ts"],"sourcesContent":["import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';\r\nimport { SafeResourceUrl } from '@angular/platform-browser';\r\nimport { PublicationsService } from 'src/app/services/publications.service';\r\nimport { Publication } from 'src/app/models/publication';\r\nimport { Image } from 'src/app/models/image';\r\nimport { PhotoService } from 'src/app/services/photo.service';\r\nimport { ToastService } from 'src/app/services/toast.service';\r\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ThemeService } from 'src/app/services/theme.service';\r\nimport { Camera, CameraResultType, CameraSource} from '@capacitor/camera';\r\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service';\r\n@Component({\r\n selector: 'app-new-publication',\r\n templateUrl: './new-publication.page.html',\r\n styleUrls: ['./new-publication.page.scss'],\r\n})\r\nexport class NewPublicationPage implements OnInit {\r\n showLoader: boolean;\r\n pub: Publication = new Publication();\r\n image: Image = new Image();\r\n\r\n publicationTitle:string;\r\n imgUrl:any;\r\n\r\n Defaultimage:any = '';\r\n\r\n Form: UntypedFormGroup;\r\n validateFrom = false\r\n\r\n photo: SafeResourceUrl;\r\n\r\n publication: Publication = new Publication();\r\n\r\n @Input() publicationType: string;\r\n @Input() folderId: string;\r\n @Input() publicationId:string;\r\n @Output() closeDesktopComponent = new EventEmitter<any>();\r\n @Output() openPublicationDetails = new EventEmitter<any>();\r\n @Output() goBackToViewPublications = new EventEmitter<any>();\r\n @Output() goBacktoPublicationDetails = new EventEmitter<any>();\r\n\r\n guestPicture:any;\r\n\r\n capturedImage:any = '';\r\n capturedImageTitle:any;\r\n photos: any[] = [];\r\n\r\n constructor(\r\n public photoService: PhotoService,\r\n private publications: PublicationsService,\r\n private toastService: ToastService,\r\n public ThemeService: ThemeService,\r\n private httpErroHandle: HttpErrorHandle\r\n ) {\r\n this.publicationTitle = 'Nova Publicação';\r\n }\r\n\r\n ngOnInit() {\r\n if(this.publicationType == '3'){\r\n this.getPublicationDetail();\r\n }\r\n this.setTitle();\r\n //this.clear();\r\n //this.takePicture();\r\n }\r\n\r\n getPublicationDetail() {\r\n this.showLoader = true;\r\n this.publications.GetPublicationById(this.publicationId).subscribe( res =>{\r\n this.publication = {\r\n DateIndex: res.DateIndex,\r\n DocumentId: res.DocumentId,\r\n ProcessId:res.ProcessId,\r\n Title:res.Title,\r\n Message: res.Message,\r\n DatePublication: res.DatePublication,\r\n FileBase64: \"data:image/jpg;base64,\" + res.FileBase64,\r\n OriginalFileName: res.OriginalFileName,\r\n FileExtension: 'jpeg',\r\n }\r\n this.pub = this.publication;\r\n this.showLoader = false;\r\n });\r\n }\r\n\r\n\r\n async takePicture() {\r\n const capturedImage = await Camera.getPhoto({\r\n quality: 90,\r\n // allowEditing: true,\r\n resultType: CameraResultType.Base64,\r\n source: CameraSource.Camera\r\n });\r\n\r\n this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;\r\n this.capturedImageTitle = capturedImage.path;\r\n //\r\n }\r\n\r\n async laodPicture() {\r\n const capturedImage = await Camera.getPhoto({\r\n quality: 90,\r\n resultType: CameraResultType.Base64,\r\n source: CameraSource.Photos\r\n });\r\n\r\n this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;\r\n this.capturedImageTitle = capturedImage.path;\r\n }\r\n\r\n\r\n runValidation() {\r\n this.validateFrom = true\r\n }\r\n\r\n injectValidation() {\r\n\r\n this.Form = new UntypedFormGroup({\r\n Subject: new UntypedFormControl(this.pub.Title, [\r\n Validators.required,\r\n // Validators.minLength(4)\r\n ]),\r\n Message: new UntypedFormControl(this.pub.Message, [\r\n Validators.required,\r\n Validators.maxLength(1000)\r\n ])\r\n })\r\n }\r\n\r\n\r\n async save() {\r\n\r\n this.injectValidation()\r\n this.runValidation()\r\n\r\n if(this.Form.invalid) {\r\n return false\r\n } else {\r\n \r\n }\r\n\r\n if(this.publicationType == '3') {\r\n\r\n if(this.capturedImage != '') {\r\n\r\n this.publication = {\r\n DateIndex: this.publication.DateIndex,\r\n DocumentId:this.publication.DocumentId,\r\n ProcessId:this.publication.ProcessId,\r\n Title: this.pub.Title,\r\n Message: this.pub.Message,\r\n DatePublication: this.publication.DatePublication,\r\n OriginalFileName: this.capturedImageTitle,\r\n FileBase64: this.capturedImage,\r\n FileExtension: 'jpeg',\r\n }\r\n\r\n \r\n \r\n const loader = this.toastService.loading()\r\n\r\n try {\r\n await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()\r\n this.httpErroHandle.httpsSucessMessagge('Criar publicação')\r\n\r\n this.goBack();\r\n } catch (error) {\r\n this.httpErroHandle.httpStatusHandle(error)\r\n } finally {\r\n loader.remove()\r\n }\r\n\r\n }\r\n else if (!this.publication.OriginalFileName) { //\r\n this.publication = {\r\n DateIndex: this.publication.DateIndex,\r\n DocumentId:this.publication.DocumentId,\r\n ProcessId:this.publication.ProcessId,\r\n Title: this.pub.Title,\r\n Message: this.pub.Message,\r\n DatePublication: this.publication.DatePublication,\r\n OriginalFileName: this.capturedImageTitle,\r\n // OriginalFileName: this.publication.OriginalFileName,\r\n // FileBase64: this.publication.FileBase64,\r\n // FileExtension: 'jpeg',\r\n }\r\n const loader = this.toastService.loading()\r\n\r\n try {\r\n \r\n await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()\r\n\r\n this.httpErroHandle.httpsSucessMessagge('Criar publicação')\r\n\r\n this.goBack();\r\n } catch (error) {\r\n this.httpErroHandle.httpStatusHandle(error)\r\n } finally {\r\n loader.remove()\r\n }\r\n\r\n } else {\r\n this.publication = {\r\n DateIndex: this.publication.DateIndex,\r\n DocumentId:this.publication.DocumentId,\r\n ProcessId:this.publication.ProcessId,\r\n Title: this.pub.Title,\r\n Message: this.pub.Message,\r\n DatePublication: this.publication.DatePublication,\r\n OriginalFileName: this.capturedImageTitle,\r\n FileBase64: this.capturedImage,\r\n FileExtension: 'jpeg',\r\n }\r\n\r\n \r\n \r\n const loader = this.toastService.loading()\r\n\r\n try {\r\n await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()\r\n this.httpErroHandle.httpsSucessMessagge('Criar publicação')\r\n\r\n this.goBack();\r\n } catch (error) {\r\n this.httpErroHandle.httpStatusHandle(error)\r\n } finally {\r\n loader.remove()\r\n }\r\n\r\n }\r\n }\r\n else {\r\n\r\n let time = new Date()\r\n this.publication = {\r\n DateIndex: time,\r\n DocumentId: null,\r\n ProcessId:this.folderId,\r\n Title: this.pub.Title,\r\n Message: this.pub.Message,\r\n DatePublication: time,\r\n OriginalFileName: this.capturedImageTitle,\r\n FileBase64: this.capturedImage,\r\n FileExtension: 'jpeg',\r\n }\r\n\r\n const loader = this.toastService.loading()\r\n\r\n try {\r\n \r\n await this.publications.CreatePublication(this.folderId, this.publication).toPromise()\r\n if(this.publicationTitle == '1') {\r\n \r\n } else if (this.publicationTitle == '2') {\r\n this.httpErroHandle.httpsSucessMessagge('Criar publicação')\r\n } else if (this.publicationTitle == '3') {\r\n this.httpErroHandle.httpsSucessMessagge('Editar publicação')\r\n }\r\n \r\n\r\n this.goBackToViewPublications.emit();\r\n } catch (error) {\r\n this.httpErroHandle.httpStatusHandle(error)\r\n } finally {\r\n loader.remove()\r\n }\r\n\r\n }\r\n }\r\n\r\n close(){\r\n this.goBack();\r\n }\r\n\r\n clear(){\r\n this.capturedImage = '';\r\n }\r\n\r\n setTitle(){\r\n if(this.publicationType == '1') {\r\n this.publicationTitle = 'Nova Publicação Rápida';\r\n }\r\n else if(this.publicationType == '2') {\r\n this.publicationTitle = 'Nova Publicação';\r\n }\r\n else if(this.publicationType == '3') {\r\n this.publicationTitle = 'Editar Publicação';\r\n this.pub = this.publication;\r\n }\r\n }\r\n\r\n async goBack(){\r\n\r\n if(this.publicationType == '2'){\r\n this.goBackToViewPublications.emit();\r\n } else {\r\n this.goBackToViewPublications.emit();\r\n //this.goBacktoPublicationDetails.emit();\r\n }\r\n\r\n }\r\n\r\n}\r\n"]},"metadata":{},"sourceType":"module"}