1
0
This commit is contained in:
Ahmed Bouhuolia
2026-03-26 18:04:33 +02:00
parent 8b59f28125
commit 2e90e3cc5b
12 changed files with 65 additions and 19 deletions
@@ -0,0 +1,12 @@
exports.up = function(knex) {
return knex.schema.alterTable('contacts', table => {
table.string('code').nullable().unique();
});
};
exports.down = function(knex) {
return knex.schema.alterTable('contacts', table => {
table.dropColumn('code');
});
};
@@ -155,4 +155,13 @@ export class CreateCustomerDto extends ContactAddressDto {
@IsOptional() @IsOptional()
@IsBoolean() @IsBoolean()
active?: boolean; active?: boolean;
@ApiProperty({
required: false,
description: 'Customer code',
example: 'CUST-001',
})
@IsOptional()
@IsString()
code?: string;
} }
@@ -63,4 +63,9 @@ export class EditCustomerDto extends ContactAddressDto {
@IsOptional() @IsOptional()
@IsBoolean() @IsBoolean()
active?: boolean; active?: boolean;
@ApiProperty({ required: false, description: 'Customer code' })
@IsOptional()
@IsString()
code?: string;
} }
@@ -70,6 +70,8 @@ export class Customer extends TenantBaseModel {
note: string; note: string;
active: boolean; active: boolean;
code?: string;
/** /**
* Query builder. * Query builder.
*/ */
@@ -32,6 +32,7 @@ export interface ICustomerNewDTO extends IContactAddressDTO {
note?: string; note?: string;
active?: boolean; active?: boolean;
code?: string;
} }
export interface ICustomerEditDTO extends IContactAddressDTO { export interface ICustomerEditDTO extends IContactAddressDTO {
@@ -50,6 +51,7 @@ export interface ICustomerEditDTO extends IContactAddressDTO {
note?: string; note?: string;
active?: boolean; active?: boolean;
code?: string;
} }
export interface ICustomersFilter extends IDynamicListFilter { export interface ICustomersFilter extends IDynamicListFilter {
@@ -115,4 +115,13 @@ export class CreateVendorDto extends ContactAddressDto {
@IsOptional() @IsOptional()
@IsBoolean() @IsBoolean()
active?: boolean; active?: boolean;
@ApiProperty({
required: false,
description: 'Vendor code',
example: 'VEND-001',
})
@IsOptional()
@IsString()
code?: string;
} }
@@ -60,4 +60,9 @@ export class EditVendorDto extends ContactAddressDto {
@IsOptional() @IsOptional()
@IsBoolean() @IsBoolean()
active?: boolean; active?: boolean;
@ApiProperty({ required: false, description: 'Vendor code' })
@IsOptional()
@IsString()
code?: string;
} }
@@ -71,6 +71,8 @@ export class Vendor extends TenantBaseModel {
note: string; note: string;
active: boolean; active: boolean;
code?: string;
/** /**
* Query builder. * Query builder.
*/ */
@@ -31,6 +31,7 @@ export interface IVendorNewDTO extends IContactAddressDTO {
note?: string; note?: string;
active?: boolean; active?: boolean;
code?: string;
} }
export interface IVendorEditDTO extends IContactAddressDTO { export interface IVendorEditDTO extends IContactAddressDTO {
salutation?: string; salutation?: string;
@@ -46,6 +47,7 @@ export interface IVendorEditDTO extends IContactAddressDTO {
note?: string; note?: string;
active?: boolean; active?: boolean;
code?: string;
} }
export interface IVendorsFilter extends IDynamicListFilter { export interface IVendorsFilter extends IDynamicListFilter {
@@ -79,9 +79,8 @@ export function CustomerFormBasicSection({}) {
{/*----------- Display Name -----------*/} {/*----------- Display Name -----------*/}
<FFormGroup <FFormGroup
name={'display_name'} name={'display_name'}
label={ label={<T id={'display_name'} />}
<T id={'display_name'} /> helperText="This is the name that appears on invoices and emails."
}
inline inline
fill fill
> >
@@ -9,20 +9,6 @@ import {
useCustomerFormContext, useCustomerFormContext,
} from './CustomerFormProvider'; } from './CustomerFormProvider';
/**
* Customer form page loading.
* @returns {JSX}
*/
function CustomerFormPageLoading({ children }) {
const { isFormLoading } = useCustomerFormContext();
return (
<DashboardInsider loading={isFormLoading}>
{children}
</DashboardInsider>
);
}
/** /**
* Customer form page. * Customer form page.
* @returns {JSX} * @returns {JSX}
@@ -30,6 +16,7 @@ function CustomerFormPageLoading({ children }) {
export default function CustomerFormPage() { export default function CustomerFormPage() {
const history = useHistory(); const history = useHistory();
const { id } = useParams(); const { id } = useParams();
const { isFormLoading } = useCustomerFormContext();
const customerId = parseInt(id, 10); const customerId = parseInt(id, 10);
@@ -46,14 +33,14 @@ export default function CustomerFormPage() {
return ( return (
<CustomerFormProvider customerId={customerId}> <CustomerFormProvider customerId={customerId}>
<CustomerFormPageLoading> <DashboardInsider loading={isFormLoading}>
<Box mx={'auto'} maxWidth={800}> <Box mx={'auto'} maxWidth={800}>
<CustomerFormFormik <CustomerFormFormik
onSubmitSuccess={handleSubmitSuccess} onSubmitSuccess={handleSubmitSuccess}
onCancel={handleFormCancel} onCancel={handleFormCancel}
/> />
</Box> </Box>
</CustomerFormPageLoading> </DashboardInsider>
</CustomerFormProvider> </CustomerFormProvider>
); );
} }
@@ -49,6 +49,18 @@ export function VendorFormBasicSection({}) {
</ControlGroup> </ControlGroup>
</FFormGroup> </FFormGroup>
<FFormGroup
name={'vendor_code'}
label={'Vendor Code'}
helperText="Add a unique account number to identify, reference and search for the contact."
inline
fill
>
<FInputGroup
name={'vendor_code'}
fill />
</FFormGroup>
{/*----------- Company Name -----------*/} {/*----------- Company Name -----------*/}
<FFormGroup <FFormGroup
name={'company_name'} name={'company_name'}