projects/congarevenuecloud/elements/src/lib/files/files.component.ts
The files component is used for showing a list of attachments associated with an order in a table view.
import { FilesModule } from '@congarevenuecloud/elements';
@NgModule({
imports: [FilesModule, ...]
})
export class AppModule {}
```typescript
<apt-files
[recordId]="recordId"
></apt-files>
OnChanges
OnDestroy
changeDetection | ChangeDetectionStrategy.OnPush |
selector | apt-files |
styleUrls | ./files.component.scss |
templateUrl | ./files.component.html |
Methods |
Inputs |
constructor(storefrontService: StorefrontService, attachmentService: AttachmentService, fileService: FileService, productInformationService: ProductInformationService)
|
|||||||||||||||
Parameters :
|
orderGenerated |
Type : boolean
|
Flag to determine whether order is generated or not |
record |
Type : AObject
|
Represents the type of the object which is an instance of AObject |
recordId |
Type : string
|
Represents the identifier for the object |
download | ||||||||
download(file: IFile)
|
||||||||
Downloads the file represented by the provided IFile object. If the file is a standalone file, it is downloaded using the fileService. If the file is an attachment, its URL is retrieved using the productInformationService, and the file is opened in a new browser window.
Parameters :
Returns :
void
|
<h5 class="py-2 text-uppercase">
{{'DETAILS.ATTACHMENTS' | translate}}
<span *ngIf="fileList$ | async as fileList">({{fileList.length}})</span>
</h5>
<div class="row">
<div class="col">
<table class="table table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">File Size</th>
<th scope="col">Created Date</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let file of fileList$ | async">
<th scope="row">{{file.index}}</th>
<td><a class="text-underline" (click)="download(file)" target="_blank">{{file.title}}</a></td>
<td class="text-truncate">{{file.type}}</td>
<td>{{file.size}}</td>
<td>{{file.created_date | date:'short'}}</td>
</tr>
</tbody>
</table>
</div>
</div>
./files.component.scss