File

projects/congarevenuecloud/elements/src/lib/button/generate-document/generate-document.component.ts

Description

The Generate-document component is used to generate the document for a custom Order.

Usage

Example :
import { ButtonModule } from '@congarevenuecloud/elements';

@NgModule({
imports: [ButtonModule, ...]
})
export class AppModule {}
Example :
// Basic Usage
```typescript
<apt-generate-document
             [record]="order"
></apt-generate-document>
Example :

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(attachmentService: AttachmentService, modalService: BsModalService, templateService: TemplateService, exceptionService: ExceptionService)
Parameters :
Name Type Optional
attachmentService AttachmentService No
modalService BsModalService No
templateService TemplateService No
exceptionService ExceptionService No

Inputs

record
Type : Order | Quote

The input record is used for details of order or quote, doc need to generate for

Outputs

onStatusUpdate
Type : EventEmitter<any>

Event emitter for update of generated document.

Methods

generateDocument
generateDocument(event: GenerateDocument)

Method gets invoked on click of Generate button which calls generateDocument method to create custom document for order/quote

Parameters :
Name Type Optional Description
event GenerateDocument No

represents the template for document generation.

Returns : void
onFormatChange
onFormatChange(format: "PDF" | "PDF/A" | "DOCX")

Determines format of the document to be generated. which can be one of three options: 'PDF', 'PDF/A', or 'DOCX'.

Parameters :
Name Type Optional Description
format "PDF" | "PDF/A" | "DOCX" No

It specifies the format of the document, which can be one of three options: 'PDF', 'PDF/A', or 'DOCX'.

Returns : void
onTemplateChange
onTemplateChange(event: Template)

Method updates the template for the document to be generated.

Parameters :
Name Type Optional Description
event Template No

represents the selected template.

Returns : void
openModal
openModal()

To open the modal dialog

Returns : void

Properties

disableGenFormBtn
Type : boolean
Default value : false
formatList
Type : []
Default value : ['PDF', 'PDF/A', 'DOCX']

picklist values for formats

generateDocObj
Type : GenerateDocument
Default value : { template: null, documentFormat: null, includeWatermark: false }

two-way data binding object.

modalRef
Type : BsModalRef

refrence for modal dialog

templateList
Type : Array<TemplateList>
Default value : []

picklist values for templates

<button class="btn btn-link text-primary" (click)="openModal()" *ngIf="type==='Order'; else generateQuote"
  [disabled]="disableGenFormBtn || record.hasErrors">{{'DETAILS.GENERATE_ORDER' | translate}}</button>

<ng-template #generateQuote>
  <button
    [ngClass]="record?.Approval_Stage === 'Approved'  ? 'btn btn-primary btn-raised px-4 py-2' : 'btn-link btn text-primary px-2 ml-auto'"
    (click)="openModal()">{{'DETAILS.GENERATE_QUOTE' |
    translate}}</button>
</ng-template>

<ng-template #docGenTemplate>
  <div class="modal-header d-flex flex-row-reverse px-0 pb-1">
    <div class="btn-wrapper d-flex align-items-center">
      <button type="button" class="close pull-right close-button" aria-label="Close" (click)="modalRef.hide()">
        <span aria-hidden="true">&times;</span>
      </button>
    </div>
  </div>
  <div class="modal-body bg-white flex-column justify-content-center">
    <h4 *ngIf="type==='Order'; else Quote" class="modal-title font-weight-bold pb-3">
      {{'DETAILS.GENERATE_ORDER' | translate}}
    </h4>
    <ng-template #Quote>
      <h4 class="modal-title font-weight-bold pb-3">
        {{'DETAILS.GENERATE_QUOTE' | translate}}
      </h4>
    </ng-template>

    <label>{{'DETAILS.TEMPLATE' | translate}} *</label>
    <ng-select [items]="templateList" bindLabel="name" [(ngModel)]="templateName" (change)="onTemplateChange($event)">
    </ng-select>
    <label class="mt-4">{{'DETAILS.FILE_FORMAT' | translate}} *</label>
    <ng-select [items]="formatList" [(ngModel)]="generateDocObj.documentFormat"
      (change)="onFormatChange($event)"></ng-select>
    <div class="form-group custom-control custom-checkbox pl-3 pt-3 m-0">
      <input type="checkbox" [checked]="watermark_checked" id="watermark" class="custom-control-input"
        [(ngModel)]="watermark_checked"
        (ngModelChange)="watermark_checked ? generateDocObj.includeWatermark = true: generateDocObj.includeWatermark = false">
      <label class="ml-2 custom-control-label pt-1" for="watermark">{{'DETAILS.INCLUDE_WATERMARK' |
        translate}}</label>
    </div>
  </div>
  <div class="modal-footer bg-white border-top">
    <button class="btn btn-link text-uppercase" (click)="modalRef.hide()">{{'COMMON.CANCEL' | translate}}</button>
    <button class="btn btn-primary btn-raised text-uppercase" type="button" (click)="generateDocument(generateDocObj)"
      [disabled]="disableGenModalBtn">{{'DETAILS.GENERATE' | translate}}</button>
  </div>
</ng-template>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""