mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 08:10:32 +00:00
Compare commits
10 Commits
bugs-bashi
...
revert-888
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92a5086f1f | ||
|
|
1bf9038ddc | ||
|
|
2736b76ced | ||
|
|
9e921b074f | ||
|
|
0f377e19f3 | ||
|
|
5d872798ff | ||
|
|
0ef78a19fe | ||
|
|
70b0a4833c | ||
|
|
ead4fc9b97 | ||
|
|
a91a7c612f |
@@ -1,5 +1,6 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsNotEmpty, IsOptional, IsPositive, IsString } from 'class-validator';
|
import { ToNumber, IsOptional } from '@/common/decorators/Validators';
|
||||||
|
import { IsDateString, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
||||||
import { IsDate } from 'class-validator';
|
import { IsDate } from 'class-validator';
|
||||||
import { IsNumber } from 'class-validator';
|
import { IsNumber } from 'class-validator';
|
||||||
|
|
||||||
@@ -10,8 +11,13 @@ export class CreditNoteRefundDto {
|
|||||||
description: 'The id of the from account',
|
description: 'The id of the from account',
|
||||||
example: 1,
|
example: 1,
|
||||||
})
|
})
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'The id of the from account',
|
||||||
|
example: 1,
|
||||||
|
})
|
||||||
fromAccountId: number;
|
fromAccountId: number;
|
||||||
|
|
||||||
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsPositive()
|
@IsPositive()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@@ -21,6 +27,7 @@ export class CreditNoteRefundDto {
|
|||||||
})
|
})
|
||||||
amount: number;
|
amount: number;
|
||||||
|
|
||||||
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsPositive()
|
@IsPositive()
|
||||||
@@ -30,23 +37,23 @@ export class CreditNoteRefundDto {
|
|||||||
})
|
})
|
||||||
exchangeRate?: number;
|
exchangeRate?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'The reference number of the credit note refund',
|
description: 'The reference number of the credit note refund',
|
||||||
example: '123456',
|
example: '123456',
|
||||||
})
|
})
|
||||||
referenceNo: string;
|
referenceNo: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'The description of the credit note refund',
|
description: 'The description of the credit note refund',
|
||||||
example: 'Credit note refund',
|
example: 'Credit note refund',
|
||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@IsDate()
|
@IsDateString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'The date of the credit note refund',
|
description: 'The date of the credit note refund',
|
||||||
@@ -54,6 +61,7 @@ export class CreditNoteRefundDto {
|
|||||||
})
|
})
|
||||||
date: Date;
|
date: Date;
|
||||||
|
|
||||||
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import { renderCreditNotePaperTemplateHtml } from '@bigcapital/pdf-templates';
|
||||||
import { GetCreditNoteService } from './GetCreditNote.service';
|
import { GetCreditNoteService } from './GetCreditNote.service';
|
||||||
import { CreditNoteBrandingTemplate } from './CreditNoteBrandingTemplate.service';
|
import { CreditNoteBrandingTemplate } from './CreditNoteBrandingTemplate.service';
|
||||||
import { transformCreditNoteToPdfTemplate } from '../utils';
|
import { transformCreditNoteToPdfTemplate } from '../utils';
|
||||||
import { CreditNote } from '../models/CreditNote';
|
import { CreditNote } from '../models/CreditNote';
|
||||||
import { ChromiumlyTenancy } from '@/modules/ChromiumlyTenancy/ChromiumlyTenancy.service';
|
import { ChromiumlyTenancy } from '@/modules/ChromiumlyTenancy/ChromiumlyTenancy.service';
|
||||||
import { TemplateInjectable } from '@/modules/TemplateInjectable/TemplateInjectable.service';
|
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import { PdfTemplateModel } from '@/modules/PdfTemplate/models/PdfTemplate';
|
import { PdfTemplateModel } from '@/modules/PdfTemplate/models/PdfTemplate';
|
||||||
import { CreditNotePdfTemplateAttributes } from '../types/CreditNotes.types';
|
import { CreditNotePdfTemplateAttributes } from '../types/CreditNotes.types';
|
||||||
@@ -15,7 +15,6 @@ import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
|||||||
export class GetCreditNotePdf {
|
export class GetCreditNotePdf {
|
||||||
/**
|
/**
|
||||||
* @param {ChromiumlyTenancy} chromiumlyTenancy - Chromiumly tenancy service.
|
* @param {ChromiumlyTenancy} chromiumlyTenancy - Chromiumly tenancy service.
|
||||||
* @param {TemplateInjectable} templateInjectable - Template injectable service.
|
|
||||||
* @param {GetCreditNote} getCreditNoteService - Get credit note service.
|
* @param {GetCreditNote} getCreditNoteService - Get credit note service.
|
||||||
* @param {CreditNoteBrandingTemplate} creditNoteBrandingTemplate - Credit note branding template service.
|
* @param {CreditNoteBrandingTemplate} creditNoteBrandingTemplate - Credit note branding template service.
|
||||||
* @param {EventEmitter2} eventPublisher - Event publisher service.
|
* @param {EventEmitter2} eventPublisher - Event publisher service.
|
||||||
@@ -24,7 +23,6 @@ export class GetCreditNotePdf {
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private readonly chromiumlyTenancy: ChromiumlyTenancy,
|
private readonly chromiumlyTenancy: ChromiumlyTenancy,
|
||||||
private readonly templateInjectable: TemplateInjectable,
|
|
||||||
private readonly getCreditNoteService: GetCreditNoteService,
|
private readonly getCreditNoteService: GetCreditNoteService,
|
||||||
private readonly creditNoteBrandingTemplate: CreditNoteBrandingTemplate,
|
private readonly creditNoteBrandingTemplate: CreditNoteBrandingTemplate,
|
||||||
private readonly eventPublisher: EventEmitter2,
|
private readonly eventPublisher: EventEmitter2,
|
||||||
@@ -36,23 +34,40 @@ export class GetCreditNotePdf {
|
|||||||
private readonly pdfTemplateModel: TenantModelProxy<
|
private readonly pdfTemplateModel: TenantModelProxy<
|
||||||
typeof PdfTemplateModel
|
typeof PdfTemplateModel
|
||||||
>,
|
>,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves sale invoice pdf content.
|
* Retrieves credit note html content.
|
||||||
|
* @param {number} creditNoteId - Credit note id.
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
public async getCreditNoteHtml(creditNoteId: number): Promise<string> {
|
||||||
|
const brandingAttributes =
|
||||||
|
await this.getCreditNoteBrandingAttributes(creditNoteId);
|
||||||
|
|
||||||
|
// Map attributes to match the React component props
|
||||||
|
// The branding template returns companyLogoUri, but type may have companyLogo
|
||||||
|
const props = {
|
||||||
|
...brandingAttributes,
|
||||||
|
companyLogoUri:
|
||||||
|
(brandingAttributes as any).companyLogoUri ||
|
||||||
|
(brandingAttributes as any).companyLogo ||
|
||||||
|
'',
|
||||||
|
};
|
||||||
|
|
||||||
|
return renderCreditNotePaperTemplateHtml(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves credit note pdf content.
|
||||||
* @param {number} creditNoteId - Credit note id.
|
* @param {number} creditNoteId - Credit note id.
|
||||||
* @returns {Promise<[Buffer, string]>}
|
* @returns {Promise<[Buffer, string]>}
|
||||||
*/
|
*/
|
||||||
public async getCreditNotePdf(
|
public async getCreditNotePdf(
|
||||||
creditNoteId: number,
|
creditNoteId: number,
|
||||||
): Promise<[Buffer, string]> {
|
): Promise<[Buffer, string]> {
|
||||||
const brandingAttributes =
|
|
||||||
await this.getCreditNoteBrandingAttributes(creditNoteId);
|
|
||||||
const htmlContent = await this.templateInjectable.render(
|
|
||||||
'modules/credit-note-standard',
|
|
||||||
brandingAttributes,
|
|
||||||
);
|
|
||||||
const filename = await this.getCreditNoteFilename(creditNoteId);
|
const filename = await this.getCreditNoteFilename(creditNoteId);
|
||||||
|
const htmlContent = await this.getCreditNoteHtml(creditNoteId);
|
||||||
|
|
||||||
const document =
|
const document =
|
||||||
await this.chromiumlyTenancy.convertHtmlContent(htmlContent);
|
await this.chromiumlyTenancy.convertHtmlContent(htmlContent);
|
||||||
|
|||||||
@@ -2,19 +2,35 @@ import { Injectable } from '@nestjs/common';
|
|||||||
import { DeleteRefundVendorCreditService } from './commands/DeleteRefundVendorCredit.service';
|
import { DeleteRefundVendorCreditService } from './commands/DeleteRefundVendorCredit.service';
|
||||||
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
||||||
import { CreateRefundVendorCredit } from './commands/CreateRefundVendorCredit.service';
|
import { CreateRefundVendorCredit } from './commands/CreateRefundVendorCredit.service';
|
||||||
import { IRefundVendorCreditDTO } from './types/VendorCreditRefund.types';
|
|
||||||
import { RefundVendorCreditDto } from './dtos/RefundVendorCredit.dto';
|
import { RefundVendorCreditDto } from './dtos/RefundVendorCredit.dto';
|
||||||
|
import { GetRefundVendorCreditsService } from './queries/GetRefundVendorCredits.service';
|
||||||
|
import { IRefundVendorCreditPOJO } from './types/VendorCreditRefund.types';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class VendorCreditsRefundApplication {
|
export class VendorCreditsRefundApplication {
|
||||||
/**
|
/**
|
||||||
* @param {CreateRefundVendorCredit} createRefundVendorCreditService
|
* @param {CreateRefundVendorCredit} createRefundVendorCreditService
|
||||||
* @param {DeleteRefundVendorCreditService} deleteRefundVendorCreditService
|
* @param {DeleteRefundVendorCreditService} deleteRefundVendorCreditService
|
||||||
|
* @param {GetRefundVendorCreditsService} getRefundVendorCreditsService
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private readonly createRefundVendorCreditService: CreateRefundVendorCredit,
|
private readonly createRefundVendorCreditService: CreateRefundVendorCredit,
|
||||||
private readonly deleteRefundVendorCreditService: DeleteRefundVendorCreditService,
|
private readonly deleteRefundVendorCreditService: DeleteRefundVendorCreditService,
|
||||||
) {}
|
private readonly getRefundVendorCreditsService: GetRefundVendorCreditsService,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the vendor credit refunds graph.
|
||||||
|
* @param {number} vendorCreditId - Vendor credit id.
|
||||||
|
* @returns {Promise<IRefundVendorCreditPOJO[]>}
|
||||||
|
*/
|
||||||
|
public getVendorCreditRefunds(
|
||||||
|
vendorCreditId: number,
|
||||||
|
): Promise<IRefundVendorCreditPOJO[]> {
|
||||||
|
return this.getRefundVendorCreditsService.getVendorCreditRefunds(
|
||||||
|
vendorCreditId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a refund vendor credit.
|
* Creates a refund vendor credit.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Body, Controller, Delete, Param, Post } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||||
import { VendorCreditsRefundApplication } from './VendorCreditsRefund.application';
|
import { VendorCreditsRefundApplication } from './VendorCreditsRefund.application';
|
||||||
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
import { RefundVendorCredit } from './models/RefundVendorCredit';
|
||||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
@@ -9,7 +9,22 @@ import { RefundVendorCreditDto } from './dtos/RefundVendorCredit.dto';
|
|||||||
export class VendorCreditsRefundController {
|
export class VendorCreditsRefundController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly vendorCreditsRefundApplication: VendorCreditsRefundApplication,
|
private readonly vendorCreditsRefundApplication: VendorCreditsRefundApplication,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the vendor credit refunds graph.
|
||||||
|
* @param {number} vendorCreditId - Vendor credit id.
|
||||||
|
* @returns {Promise<IRefundVendorCreditPOJO[]>}
|
||||||
|
*/
|
||||||
|
@Get(':vendorCreditId/refund')
|
||||||
|
@ApiOperation({ summary: 'Retrieve the vendor credit refunds graph.' })
|
||||||
|
public getVendorCreditRefunds(
|
||||||
|
@Param('vendorCreditId') vendorCreditId: string,
|
||||||
|
) {
|
||||||
|
return this.vendorCreditsRefundApplication.getVendorCreditRefunds(
|
||||||
|
Number(vendorCreditId),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a refund vendor credit.
|
* Creates a refund vendor credit.
|
||||||
@@ -17,7 +32,7 @@ export class VendorCreditsRefundController {
|
|||||||
* @param {IRefundVendorCreditDTO} refundVendorCreditDTO
|
* @param {IRefundVendorCreditDTO} refundVendorCreditDTO
|
||||||
* @returns {Promise<RefundVendorCredit>}
|
* @returns {Promise<RefundVendorCredit>}
|
||||||
*/
|
*/
|
||||||
@Post(':vendorCreditId/refunds')
|
@Post(':vendorCreditId/refund')
|
||||||
@ApiOperation({ summary: 'Create a refund for the given vendor credit.' })
|
@ApiOperation({ summary: 'Create a refund for the given vendor credit.' })
|
||||||
public async createRefundVendorCredit(
|
public async createRefundVendorCredit(
|
||||||
@Param('vendorCreditId') vendorCreditId: string,
|
@Param('vendorCreditId') vendorCreditId: string,
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
import { IsOptional, ToNumber } from '@/common/decorators/Validators';
|
||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Min } from 'class-validator';
|
import { IsDateString, Min } from 'class-validator';
|
||||||
import { IsString } from 'class-validator';
|
import { IsString } from 'class-validator';
|
||||||
import { IsDate } from 'class-validator';
|
import { IsDate } from 'class-validator';
|
||||||
import { IsNotEmpty, IsNumber, IsOptional, IsPositive } from 'class-validator';
|
import { IsNotEmpty, IsNumber, IsPositive } from 'class-validator';
|
||||||
|
|
||||||
export class RefundVendorCreditDto {
|
export class RefundVendorCreditDto {
|
||||||
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@@ -32,6 +34,7 @@ export class RefundVendorCreditDto {
|
|||||||
})
|
})
|
||||||
depositAccountId: number;
|
depositAccountId: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
@@ -40,7 +43,7 @@ export class RefundVendorCreditDto {
|
|||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@IsDate()
|
@IsDateString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'The date of the refund',
|
description: 'The date of the refund',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { Position, Checkbox, InputGroup } from '@blueprintjs/core';
|
import { Position, Checkbox, InputGroup } from '@blueprintjs/core';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@@ -7,23 +7,29 @@ import intl from 'react-intl-universal';
|
|||||||
import { isUndefined } from 'lodash';
|
import { isUndefined } from 'lodash';
|
||||||
|
|
||||||
import { useAutofocus } from '@/hooks';
|
import { useAutofocus } from '@/hooks';
|
||||||
import { T, Choose, ListSelect } from '@/components';
|
import { T, Choose } from '@/components';
|
||||||
|
import { Select } from '@/components/Forms';
|
||||||
import { momentFormatter } from '@/utils';
|
import { momentFormatter } from '@/utils';
|
||||||
|
|
||||||
function AdvancedFilterEnumerationField({ options, value, ...rest }) {
|
function AdvancedFilterEnumerationField({ options, value, ...rest }) {
|
||||||
|
const selectedItem = useMemo(
|
||||||
|
() => options.find((opt) => opt.key === value) || null,
|
||||||
|
[options, value],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListSelect
|
<Select
|
||||||
items={options}
|
items={options}
|
||||||
selectedItem={value}
|
selectedItem={selectedItem}
|
||||||
popoverProps={{
|
popoverProps={{
|
||||||
fill: true,
|
fill: true,
|
||||||
inline: true,
|
inline: true,
|
||||||
minimal: true,
|
minimal: true,
|
||||||
captureDismiss: true,
|
captureDismiss: true,
|
||||||
}}
|
}}
|
||||||
defaultText={<T id={'filter.select_option'} />}
|
placeholder={<T id={'filter.select_option'} />}
|
||||||
textProp={'label'}
|
textAccessor={'label'}
|
||||||
selectedItemProp={'key'}
|
valueAccessor={'key'}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ const mapActionsToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const withAccountsTableActions = connect(null, mapActionsToProps);
|
export const withAccountsTableActions = connect(null, mapActionsToProps);
|
||||||
export const withAccountsActions = withAccountsTableActions;
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
@@ -59,6 +60,7 @@ export default function OtherIncomeFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Col,
|
Col,
|
||||||
Row,
|
Row,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FMoneyInputGroup,
|
FMoneyInputGroup,
|
||||||
@@ -55,6 +56,7 @@ export default function OwnerContributionFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FMoneyInputGroup,
|
FMoneyInputGroup,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
@@ -48,6 +49,7 @@ export default function TransferFromAccountFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
@@ -46,6 +47,7 @@ export default function OtherExpnseFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
@@ -48,6 +49,7 @@ export default function OwnerDrawingsFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
FMoneyInputGroup,
|
FMoneyInputGroup,
|
||||||
@@ -51,6 +52,7 @@ export default function TransferToAccountFormFields() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
ExchangeRateMutedField,
|
ExchangeRateMutedField,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
InputPrependText,
|
InputPrependText,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
@@ -104,6 +105,7 @@ function CustomerOpeningBalanceFields({
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
FeatureCan,
|
FeatureCan,
|
||||||
ExchangeRateMutedField,
|
ExchangeRateMutedField,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
FDateInput,
|
FDateInput,
|
||||||
@@ -61,6 +62,7 @@ function QuickPaymentMadeFormFields({
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
FeatureCan,
|
FeatureCan,
|
||||||
ExchangeRateMutedField,
|
ExchangeRateMutedField,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FFormGroup,
|
FFormGroup,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
FTextArea,
|
FTextArea,
|
||||||
@@ -61,6 +62,7 @@ function QuickPaymentReceiveFormFields({
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ import {
|
|||||||
FeatureCan,
|
FeatureCan,
|
||||||
FInputGroup,
|
FInputGroup,
|
||||||
FMoneyInputGroup,
|
FMoneyInputGroup,
|
||||||
|
FDateInput,
|
||||||
|
FFormGroup,
|
||||||
|
FTextArea,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import {
|
import {
|
||||||
inputIntent,
|
inputIntent,
|
||||||
@@ -66,16 +69,13 @@ function RefundCreditNoteFormFields({
|
|||||||
<FeatureCan feature={Features.Branches}>
|
<FeatureCan feature={Features.Branches}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
<FormGroup
|
<FFormGroup name={'branch_id'} label={<T id={'branch'} />}>
|
||||||
label={<T id={'branch'} />}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FFormGroup>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<BranchRowDivider />
|
<BranchRowDivider />
|
||||||
@@ -84,29 +84,23 @@ function RefundCreditNoteFormFields({
|
|||||||
<Row>
|
<Row>
|
||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
{/* ------------- Refund date ------------- */}
|
{/* ------------- Refund date ------------- */}
|
||||||
<FastField name={'date'}>
|
|
||||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
|
||||||
<FFormGroup
|
<FFormGroup
|
||||||
name={'date'}
|
name={'date'}
|
||||||
label={<T id={'refund_credit_note.dialog.refund_date'} />}
|
label={<T id={'refund_credit_note.dialog.refund_date'} />}
|
||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
fill
|
fill
|
||||||
>
|
>
|
||||||
<DateInput
|
<FDateInput
|
||||||
|
name={'date'}
|
||||||
{...momentFormatter('YYYY/MM/DD')}
|
{...momentFormatter('YYYY/MM/DD')}
|
||||||
value={tansformDateValue(value)}
|
|
||||||
onChange={handleDateChange((formattedDate) => {
|
|
||||||
form.setFieldValue('date', formattedDate);
|
|
||||||
})}
|
|
||||||
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
leftIcon: <Icon icon={'date-range'} />,
|
leftIcon: <Icon icon={'date-range'} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
)}
|
|
||||||
</FastField>
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
{/* ------------ Form account ------------ */}
|
{/* ------------ Form account ------------ */}
|
||||||
<FFormGroup
|
<FFormGroup
|
||||||
@@ -114,6 +108,7 @@ function RefundCreditNoteFormFields({
|
|||||||
label={<T id={'refund_credit_note.dialog.from_account'} />}
|
label={<T id={'refund_credit_note.dialog.from_account'} />}
|
||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
fill
|
fill
|
||||||
|
fastField
|
||||||
>
|
>
|
||||||
<FAccountsSuggestField
|
<FAccountsSuggestField
|
||||||
name={'from_account_id'}
|
name={'from_account_id'}
|
||||||
@@ -126,6 +121,7 @@ function RefundCreditNoteFormFields({
|
|||||||
ACCOUNT_TYPE.CASH,
|
ACCOUNT_TYPE.CASH,
|
||||||
ACCOUNT_TYPE.FIXED_ASSET,
|
ACCOUNT_TYPE.FIXED_ASSET,
|
||||||
]}
|
]}
|
||||||
|
fastField
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -137,6 +133,7 @@ function RefundCreditNoteFormFields({
|
|||||||
label={<T id={'refund_credit_note.dialog.amount'} />}
|
label={<T id={'refund_credit_note.dialog.amount'} />}
|
||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
fill
|
fill
|
||||||
|
fastField
|
||||||
>
|
>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<InputPrependText text={values.currency_code} />
|
<InputPrependText text={values.currency_code} />
|
||||||
@@ -144,6 +141,7 @@ function RefundCreditNoteFormFields({
|
|||||||
name={'amount'}
|
name={'amount'}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
inputRef={(ref) => (amountFieldRef.current = ref)}
|
inputRef={(ref) => (amountFieldRef.current = ref)}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</ControlGroup>
|
</ControlGroup>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
@@ -161,21 +159,19 @@ function RefundCreditNoteFormFields({
|
|||||||
</If>
|
</If>
|
||||||
|
|
||||||
{/* ------------ Reference No. ------------ */}
|
{/* ------------ Reference No. ------------ */}
|
||||||
<FFormGroup name={'reference_no'} label={<T id={'reference_no'} />} fill>
|
<FFormGroup name={'reference_no'} label={<T id={'reference_no'} />} fill fastField>
|
||||||
<FInputGroup name={'reference_no'} minimal fill />
|
<FInputGroup name={'reference_no'} minimal fill />
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|
||||||
{/* --------- Statement --------- */}
|
{/* --------- Statement --------- */}
|
||||||
<FastField name={'description'}>
|
<FFormGroup
|
||||||
{({ form, field, meta: { error, touched } }) => (
|
name={'description'}
|
||||||
<FormGroup
|
|
||||||
label={<T id={'refund_credit_note.dialog.description'} />}
|
label={<T id={'refund_credit_note.dialog.description'} />}
|
||||||
className={'form-group--description'}
|
fill
|
||||||
|
fastField
|
||||||
>
|
>
|
||||||
<TextArea growVertically={true} {...field} />
|
<FTextArea name={'description'} growVertically fill fastField />
|
||||||
</FormGroup>
|
</FFormGroup>
|
||||||
)}
|
|
||||||
</FastField>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -183,7 +179,12 @@ function RefundCreditNoteFormFields({
|
|||||||
export default compose(withCurrentOrganization())(RefundCreditNoteFormFields);
|
export default compose(withCurrentOrganization())(RefundCreditNoteFormFields);
|
||||||
|
|
||||||
export const BranchRowDivider = styled.div`
|
export const BranchRowDivider = styled.div`
|
||||||
|
--x-divider-color: #ebf1f6;
|
||||||
|
|
||||||
|
.bp4-dark & {
|
||||||
|
--x-divider-color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: #ebf1f6;
|
background: var(--x-divider-color);
|
||||||
margin-bottom: 13px;
|
margin-bottom: 13px;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ function RefundVendorCreditFormFields({
|
|||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|
||||||
{/* --------- Statement --------- */}
|
{/* --------- Statement --------- */}
|
||||||
<FFormGroup name={'description'} fill fastField>
|
<FFormGroup name={'description'} label={<T id={'refund_vendor_credit.dialog.description'} />} fill fastField>
|
||||||
<FTextArea name={'description'} growVertically={true} fastField />
|
<FTextArea name={'description'} growVertically fill fastField />
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -162,7 +162,12 @@ function RefundVendorCreditFormFields({
|
|||||||
export default compose(withCurrentOrganization())(RefundVendorCreditFormFields);
|
export default compose(withCurrentOrganization())(RefundVendorCreditFormFields);
|
||||||
|
|
||||||
export const BranchRowDivider = styled.div`
|
export const BranchRowDivider = styled.div`
|
||||||
|
--x-divider-color: #ebf1f6;
|
||||||
|
|
||||||
|
.bp4-dark & {
|
||||||
|
--x-divider-color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: #ebf1f6;
|
background: var(--x-divider-color);
|
||||||
margin-bottom: 13px;
|
margin-bottom: 13px;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
ExchangeRateMutedField,
|
ExchangeRateMutedField,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
|
BranchSelectButton,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
InputPrependText,
|
InputPrependText,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
@@ -102,6 +103,7 @@ function VendorOpeningBalanceFormFields({
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
|
input={BranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -15,5 +15,3 @@ export const withItemCategories = (mapState) => {
|
|||||||
};
|
};
|
||||||
return connect(mapStateToProps);
|
return connect(mapStateToProps);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const withItemsCategories = withItemCategories;
|
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const withBillsActions = connect(null, mapDispatchToProps);
|
export const withBillsActions = connect(null, mapDispatchToProps);
|
||||||
export const withBillActions = withBillsActions;
|
|
||||||
|
|||||||
@@ -18,5 +18,3 @@ export const withPaymentMade = (mapState) => {
|
|||||||
};
|
};
|
||||||
return connect(mapStateToProps);
|
return connect(mapStateToProps);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const withPaymentMades = withPaymentMade;
|
|
||||||
|
|||||||
@@ -29,4 +29,4 @@ const mapDispatchToProps = (dispatch, props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const withRouteActions = connect(null, mapDispatchToProps)
|
export const withRouteActions = connect(null, mapDispatchToProps);
|
||||||
@@ -10,7 +10,7 @@ import { SubscriptionPlansPeriod } from '@/store/plans/plans.reducer';
|
|||||||
import styles from './SetupSubscription.module.scss';
|
import styles from './SetupSubscription.module.scss';
|
||||||
|
|
||||||
interface SubscriptionPlansPeriodsSwitchCombinedProps
|
interface SubscriptionPlansPeriodsSwitchCombinedProps
|
||||||
extends WithSubscriptionPlansActionsProps {}
|
extends WithSubscriptionPlansActionsProps { }
|
||||||
|
|
||||||
function SubscriptionPlansPeriodSwitcherRoot({
|
function SubscriptionPlansPeriodSwitcherRoot({
|
||||||
// #withSubscriptionPlansActions
|
// #withSubscriptionPlansActions
|
||||||
|
|||||||
257
shared/pdf-templates/src/components/CreditNotePaperTemplate.tsx
Normal file
257
shared/pdf-templates/src/components/CreditNotePaperTemplate.tsx
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
import {
|
||||||
|
PaperTemplate,
|
||||||
|
PaperTemplateProps,
|
||||||
|
PaperTemplateTotalBorder,
|
||||||
|
} from './PaperTemplate';
|
||||||
|
import { Box } from '../lib/layout/Box';
|
||||||
|
import { Text } from '../lib/text/Text';
|
||||||
|
import { Stack } from '../lib/layout/Stack';
|
||||||
|
import { Group } from '../lib/layout/Group';
|
||||||
|
import {
|
||||||
|
DefaultPdfTemplateTerms,
|
||||||
|
DefaultPdfTemplateItemDescription,
|
||||||
|
DefaultPdfTemplateItemName,
|
||||||
|
DefaultPdfTemplateAddressBilledTo,
|
||||||
|
DefaultPdfTemplateAddressBilledFrom,
|
||||||
|
} from './_constants';
|
||||||
|
|
||||||
|
interface CreditNoteLine {
|
||||||
|
item?: string;
|
||||||
|
description?: string;
|
||||||
|
quantity?: string;
|
||||||
|
rate?: string;
|
||||||
|
total?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreditNotePaperTemplateProps extends PaperTemplateProps {
|
||||||
|
primaryColor?: string;
|
||||||
|
secondaryColor?: string;
|
||||||
|
|
||||||
|
// Company
|
||||||
|
showCompanyLogo?: boolean;
|
||||||
|
companyLogoUri?: string;
|
||||||
|
|
||||||
|
companyName?: string;
|
||||||
|
|
||||||
|
// Credit Note number
|
||||||
|
showCreditNoteNumber?: boolean;
|
||||||
|
creditNoteNumebr?: string;
|
||||||
|
creditNoteNumberLabel?: string;
|
||||||
|
|
||||||
|
// Credit Note date
|
||||||
|
showCreditNoteDate?: boolean;
|
||||||
|
creditNoteDate?: string;
|
||||||
|
creditNoteDateLabel?: string;
|
||||||
|
|
||||||
|
// Address
|
||||||
|
showCustomerAddress?: boolean;
|
||||||
|
customerAddress?: string;
|
||||||
|
|
||||||
|
showCompanyAddress?: boolean;
|
||||||
|
companyAddress?: string;
|
||||||
|
|
||||||
|
billedToLabel?: string;
|
||||||
|
|
||||||
|
// Entries
|
||||||
|
lineItemLabel?: string;
|
||||||
|
lineQuantityLabel?: string;
|
||||||
|
lineRateLabel?: string;
|
||||||
|
lineTotalLabel?: string;
|
||||||
|
|
||||||
|
// Subtotal
|
||||||
|
showSubtotal?: boolean;
|
||||||
|
subtotalLabel?: string;
|
||||||
|
subtotal?: string;
|
||||||
|
|
||||||
|
// Total
|
||||||
|
showTotal?: boolean;
|
||||||
|
totalLabel?: string;
|
||||||
|
total?: string;
|
||||||
|
|
||||||
|
// Customer Note
|
||||||
|
showCustomerNote?: boolean;
|
||||||
|
customerNote?: string;
|
||||||
|
customerNoteLabel?: string;
|
||||||
|
|
||||||
|
// Terms & Conditions
|
||||||
|
showTermsConditions?: boolean;
|
||||||
|
termsConditions?: string;
|
||||||
|
termsConditionsLabel?: string;
|
||||||
|
|
||||||
|
lines?: Array<CreditNoteLine>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CreditNotePaperTemplate({
|
||||||
|
// # Colors
|
||||||
|
primaryColor,
|
||||||
|
secondaryColor,
|
||||||
|
|
||||||
|
// # Company
|
||||||
|
companyName = 'Bigcapital Technology, Inc.',
|
||||||
|
|
||||||
|
showCompanyLogo = true,
|
||||||
|
companyLogoUri = '',
|
||||||
|
|
||||||
|
// # Credit Note number
|
||||||
|
creditNoteNumberLabel = 'Credit Note Number',
|
||||||
|
creditNoteNumebr = '346D3D40-0001',
|
||||||
|
showCreditNoteNumber = true,
|
||||||
|
|
||||||
|
// # Credit Note date
|
||||||
|
creditNoteDate = 'September 3, 2024',
|
||||||
|
creditNoteDateLabel = 'Credit Note Date',
|
||||||
|
showCreditNoteDate = true,
|
||||||
|
|
||||||
|
// Address
|
||||||
|
showCustomerAddress = true,
|
||||||
|
customerAddress = DefaultPdfTemplateAddressBilledTo,
|
||||||
|
|
||||||
|
showCompanyAddress = true,
|
||||||
|
companyAddress = DefaultPdfTemplateAddressBilledFrom,
|
||||||
|
|
||||||
|
billedToLabel = 'Billed To',
|
||||||
|
|
||||||
|
// Entries
|
||||||
|
lineItemLabel = 'Item',
|
||||||
|
lineQuantityLabel = 'Qty',
|
||||||
|
lineRateLabel = 'Rate',
|
||||||
|
lineTotalLabel = 'Total',
|
||||||
|
|
||||||
|
// Subtotal
|
||||||
|
subtotalLabel = 'Subtotal',
|
||||||
|
showSubtotal = true,
|
||||||
|
subtotal = '1000.00',
|
||||||
|
|
||||||
|
// Total
|
||||||
|
totalLabel = 'Total',
|
||||||
|
showTotal = true,
|
||||||
|
total = '$1000.00',
|
||||||
|
|
||||||
|
// Customer Note
|
||||||
|
showCustomerNote = true,
|
||||||
|
customerNote = '',
|
||||||
|
customerNoteLabel = 'Customer Note',
|
||||||
|
|
||||||
|
// Terms & Conditions
|
||||||
|
termsConditionsLabel = 'Terms & Conditions',
|
||||||
|
showTermsConditions = true,
|
||||||
|
termsConditions = DefaultPdfTemplateTerms,
|
||||||
|
|
||||||
|
lines = [
|
||||||
|
{
|
||||||
|
item: DefaultPdfTemplateItemName,
|
||||||
|
description: DefaultPdfTemplateItemDescription,
|
||||||
|
rate: '1',
|
||||||
|
quantity: '1000',
|
||||||
|
total: '$1000.00',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
...props
|
||||||
|
}: CreditNotePaperTemplateProps) {
|
||||||
|
return (
|
||||||
|
<PaperTemplate
|
||||||
|
primaryColor={primaryColor}
|
||||||
|
secondaryColor={secondaryColor}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<Stack spacing={24}>
|
||||||
|
<Group align="start" spacing={10}>
|
||||||
|
<Stack flex={1}>
|
||||||
|
<PaperTemplate.BigTitle title={'Credit Note'} />
|
||||||
|
|
||||||
|
<PaperTemplate.TermsList>
|
||||||
|
{showCreditNoteNumber && (
|
||||||
|
<PaperTemplate.TermsItem label={creditNoteNumberLabel}>
|
||||||
|
{creditNoteNumebr}
|
||||||
|
</PaperTemplate.TermsItem>
|
||||||
|
)}
|
||||||
|
{showCreditNoteDate && (
|
||||||
|
<PaperTemplate.TermsItem label={creditNoteDateLabel}>
|
||||||
|
{creditNoteDate}
|
||||||
|
</PaperTemplate.TermsItem>
|
||||||
|
)}
|
||||||
|
</PaperTemplate.TermsList>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{companyLogoUri && showCompanyLogo && (
|
||||||
|
<PaperTemplate.Logo logoUri={companyLogoUri} />
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<PaperTemplate.AddressesGroup>
|
||||||
|
{showCompanyAddress && (
|
||||||
|
<PaperTemplate.Address>
|
||||||
|
<Box dangerouslySetInnerHTML={{ __html: companyAddress }} />
|
||||||
|
</PaperTemplate.Address>
|
||||||
|
)}
|
||||||
|
{showCustomerAddress && (
|
||||||
|
<PaperTemplate.Address>
|
||||||
|
<strong>{billedToLabel}</strong>
|
||||||
|
<Box dangerouslySetInnerHTML={{ __html: customerAddress }} />
|
||||||
|
</PaperTemplate.Address>
|
||||||
|
)}
|
||||||
|
</PaperTemplate.AddressesGroup>
|
||||||
|
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<PaperTemplate.Table
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
label: lineItemLabel,
|
||||||
|
accessor: (data) => (
|
||||||
|
<Stack spacing={2}>
|
||||||
|
<Text>{data.item}</Text>
|
||||||
|
{data.description && (
|
||||||
|
<Text color={'#5f6b7c'} fontSize={12}>
|
||||||
|
{data.description}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
),
|
||||||
|
thStyle: { width: '60%' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: lineQuantityLabel,
|
||||||
|
accessor: 'quantity',
|
||||||
|
align: 'right',
|
||||||
|
},
|
||||||
|
{ label: lineRateLabel, accessor: 'rate', align: 'right' },
|
||||||
|
{ label: lineTotalLabel, accessor: 'total', align: 'right' },
|
||||||
|
]}
|
||||||
|
data={lines}
|
||||||
|
/>
|
||||||
|
<PaperTemplate.Totals>
|
||||||
|
{showSubtotal && (
|
||||||
|
<PaperTemplate.TotalLine
|
||||||
|
label={subtotalLabel}
|
||||||
|
amount={subtotal}
|
||||||
|
border={PaperTemplateTotalBorder.Gray}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{showTotal && (
|
||||||
|
<PaperTemplate.TotalLine
|
||||||
|
label={totalLabel}
|
||||||
|
amount={total}
|
||||||
|
border={PaperTemplateTotalBorder.Dark}
|
||||||
|
style={{ fontWeight: 500 }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</PaperTemplate.Totals>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Stack spacing={0}>
|
||||||
|
{showCustomerNote && customerNote && (
|
||||||
|
<PaperTemplate.Statement label={customerNoteLabel}>
|
||||||
|
{customerNote}
|
||||||
|
</PaperTemplate.Statement>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{showTermsConditions && termsConditions && (
|
||||||
|
<PaperTemplate.Statement label={termsConditionsLabel}>
|
||||||
|
{termsConditions}
|
||||||
|
</PaperTemplate.Statement>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</PaperTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export * from './components/PaperTemplate';
|
export * from './components/PaperTemplate';
|
||||||
export * from './components/InvoicePaperTemplate';
|
export * from './components/InvoicePaperTemplate';
|
||||||
|
export * from './components/CreditNotePaperTemplate';
|
||||||
export * from './components/EstimatePaperTemplate';
|
export * from './components/EstimatePaperTemplate';
|
||||||
export * from './components/ReceiptPaperTemplate';
|
export * from './components/ReceiptPaperTemplate';
|
||||||
export * from './components/PaymentReceivedPaperTemplate';
|
export * from './components/PaymentReceivedPaperTemplate';
|
||||||
@@ -7,6 +8,7 @@ export * from './components/FinancialSheetTemplate';
|
|||||||
export * from './components/ExportResourceTableTemplate';
|
export * from './components/ExportResourceTableTemplate';
|
||||||
|
|
||||||
export * from './renders/render-invoice-paper-template';
|
export * from './renders/render-invoice-paper-template';
|
||||||
|
export * from './renders/render-credit-note-paper-template';
|
||||||
export * from './renders/render-estimate-paper-template';
|
export * from './renders/render-estimate-paper-template';
|
||||||
export * from './renders/render-receipt-paper-template';
|
export * from './renders/render-receipt-paper-template';
|
||||||
export * from './renders/render-payment-received-paper-template';
|
export * from './renders/render-payment-received-paper-template';
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import {
|
||||||
|
CreditNotePaperTemplate,
|
||||||
|
CreditNotePaperTemplateProps,
|
||||||
|
} from '../components/CreditNotePaperTemplate';
|
||||||
|
import { renderSSR } from './render-ssr';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders credit note paper template html.
|
||||||
|
* @param {CreditNotePaperTemplateProps} props
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export const renderCreditNotePaperTemplateHtml = (
|
||||||
|
props: CreditNotePaperTemplateProps
|
||||||
|
) => {
|
||||||
|
return renderSSR(<CreditNotePaperTemplate {...props} />);
|
||||||
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user