diff --git a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.html b/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.html deleted file mode 100644 index 7b355db468..0000000000 --- a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.html +++ /dev/null @@ -1,31 +0,0 @@ - -
- arrow_back_ios - arrow_forward_ios -
-
- - - - - -
- - - - -
- - -
- add_circle - remove_circle - zoom_out_map -
-
-
-
-
-
- Loading attachments.. -
diff --git a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.scss b/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.scss deleted file mode 100644 index 964696b010..0000000000 --- a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.scss +++ /dev/null @@ -1,87 +0,0 @@ -.preview-attachments { - &--container { - min-height: 30vh; - min-width: 90vw; - max-height: 30vh; - max-width: 90vw; - border: 1px solid; - background-color: white !important; - border-radius: 4px; - z-index: 12; - } - - &--controls { - position: relative; - z-index: 99; - } - - &--container { - min-height: 320px; - width: 100%; - padding: 10px; - border: 1px solid #e5e5e5; - border-radius: 4px; - margin-top: 8px; - } - - // &--slider { - // margin: 0; - // padding: 0; - // left: -26px; - // } - - &--slide { - width: auto !important; - } - - &--go-back { - position: absolute; - top: 20vh; - background-color: rgba(0, 0, 0, 0.5); - text-align: center; - border-radius: 50%; - font-size: 18px; - padding: 12px; - height: 40px; - width: 40px; - color: white; - } - - &--go-forward { - position: absolute; - top: 20vh; - left: 80vw; - background-color: rgba(0, 0, 0, 0.5); - text-align: center; - border-radius: 50%; - font-size: 18px; - padding: 12px; - height: 40px; - width: 40px; - color: white; - } - - &--delete { - padding: 0 8px; - } - - &--image { - height: 300px; - width: 300px; - } - - &--pdf-controls { - position: fixed; - bottom: 0; - right: 10%; - z-index: 10; - } - - &--seconady-action-icons { - display: block; - margin-bottom: 8px; - text-align: center; - font-size: 24px; - color: #4a4a4a; - } -} diff --git a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.spec.ts b/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.spec.ts deleted file mode 100644 index aac9304cf4..0000000000 --- a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { FyPreviewAttachmentsComponent } from './fy-preview-attachments.component'; - -xdescribe('FyPreviewAttachmentsComponent', () => { - let component: FyPreviewAttachmentsComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [FyPreviewAttachmentsComponent], - imports: [IonicModule.forRoot()], - }).compileComponents(); - - fixture = TestBed.createComponent(FyPreviewAttachmentsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }) - ); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.ts b/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.ts deleted file mode 100644 index 2d4d6f59ff..0000000000 --- a/src/app/shared/components/fy-preview-attachments/fy-preview-attachments.component.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Component, OnInit, Input, ViewChild } from '@angular/core'; -import { Observable, from } from 'rxjs'; -import { FileService } from 'src/app/core/services/file.service'; -import { switchMap, tap, concatMap, map, reduce } from 'rxjs/operators'; -import { DomSanitizer } from '@angular/platform-browser'; - -@Component({ - selector: 'app-fy-preview-attachments', - templateUrl: './fy-preview-attachments.component.html', - styleUrls: ['./fy-preview-attachments.component.scss'], -}) -export class FyPreviewAttachmentsComponent implements OnInit { - @Input() txnId: string; - - @ViewChild('slides') imageSlides: any; - - sliderOptions: any; - - attachments$: Observable; - - activeIndex = 0; - - zoomScale: number; - - constructor(private fileService: FileService, private sanitizer: DomSanitizer) {} - - getReceiptExtension(name) { - let res = null; - - if (name) { - const filename = name.toLowerCase(); - const idx = filename.lastIndexOf('.'); - - if (idx > -1) { - res = filename.substring(idx + 1, filename.length); - } - } - - return res; - } - - getReceiptDetails(file) { - const ext = this.getReceiptExtension(file.name); - const res = { - type: 'unknown', - thumbnail: 'img/fy-receipt.svg', - }; - - if (ext && ['pdf'].indexOf(ext) > -1) { - res.type = 'pdf'; - res.thumbnail = 'img/fy-pdf.svg'; - } else if (ext && ['png', 'jpg', 'jpeg', 'gif'].indexOf(ext) > -1) { - res.type = 'image'; - res.thumbnail = file.url; - } - - return res; - } - - zoomIn() { - this.zoomScale += 0.25; - } - - zoomOut() { - this.zoomScale -= 0.25; - } - - resetZoom() { - this.zoomScale = 0.5; - } - - ngOnInit() { - this.zoomScale = 0.5; - this.sliderOptions = { - zoom: { - maxRatio: 1, - }, - }; - - this.attachments$ = this.fileService.findByTransactionId(this.txnId).pipe( - switchMap((fileObjs) => from(fileObjs)), - concatMap((fileObj: any) => - this.fileService.downloadUrl(fileObj.id).pipe( - map((downloadUrl) => { - fileObj.url = downloadUrl; - this.sanitizer.bypassSecurityTrustUrl(fileObj.url); - const details = this.getReceiptDetails(fileObj); - fileObj.type = details.type; - fileObj.thumbnail = details.thumbnail; - return fileObj; - }) - ) - ), - reduce((acc, curr) => acc.concat(curr), []) - ); - } - - goToNextSlide() { - this.imageSlides.slideNext(); - } - - goToPrevSlide() { - this.imageSlides.slidePrev(); - } -} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 2118c959b8..98f691e078 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -52,7 +52,6 @@ import { FyPolicyViolationComponent } from './components/fy-policy-violation/fy- import { FormButtonValidationDirective } from './directive/form-button-validation.directive'; import { FormatDateDirective } from './directive/format-date.directive'; -import { FyPreviewAttachmentsComponent } from './components/fy-preview-attachments/fy-preview-attachments.component'; import { PinchZoomModule } from 'ngx13-pinch-zoom'; import { PdfViewerModule } from 'ng2-pdf-viewer'; import { FyZeroStateComponent } from './components/fy-zero-state/fy-zero-state.component'; @@ -170,13 +169,10 @@ import { AutofocusDirective } from './directive/autofocus.directive'; ViewCommentComponent, AuditHistoryComponent, StatusesDiffComponent, - FyPreviewAttachmentsComponent, FyZeroStateComponent, - FyPreviewAttachmentsComponent, FyPopupComponent, FyApproverComponent, ApproverDialogComponent, - FyPreviewAttachmentsComponent, FyCategoryIconComponent, FyMenuIconComponent, FyPolicyViolationInfoComponent, @@ -313,12 +309,9 @@ import { AutofocusDirective } from './directive/autofocus.directive'; StatusesDiffComponent, FormButtonValidationDirective, MatProgressSpinnerModule, - FyPreviewAttachmentsComponent, FyZeroStateComponent, - FyPreviewAttachmentsComponent, FyPopupComponent, FyApproverComponent, - FyPreviewAttachmentsComponent, FyCategoryIconComponent, FyMenuIconComponent, FyPolicyViolationInfoComponent,