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()
@IsBoolean()
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()
@IsBoolean()
active?: boolean;
@ApiProperty({ required: false, description: 'Customer code' })
@IsOptional()
@IsString()
code?: string;
}
@@ -70,6 +70,8 @@ export class Customer extends TenantBaseModel {
note: string;
active: boolean;
code?: string;
/**
* Query builder.
*/
@@ -32,6 +32,7 @@ export interface ICustomerNewDTO extends IContactAddressDTO {
note?: string;
active?: boolean;
code?: string;
}
export interface ICustomerEditDTO extends IContactAddressDTO {
@@ -50,6 +51,7 @@ export interface ICustomerEditDTO extends IContactAddressDTO {
note?: string;
active?: boolean;
code?: string;
}
export interface ICustomersFilter extends IDynamicListFilter {
@@ -115,4 +115,13 @@ export class CreateVendorDto extends ContactAddressDto {
@IsOptional()
@IsBoolean()
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()
@IsBoolean()
active?: boolean;
@ApiProperty({ required: false, description: 'Vendor code' })
@IsOptional()
@IsString()
code?: string;
}
@@ -71,6 +71,8 @@ export class Vendor extends TenantBaseModel {
note: string;
active: boolean;
code?: string;
/**
* Query builder.
*/
@@ -31,6 +31,7 @@ export interface IVendorNewDTO extends IContactAddressDTO {
note?: string;
active?: boolean;
code?: string;
}
export interface IVendorEditDTO extends IContactAddressDTO {
salutation?: string;
@@ -46,6 +47,7 @@ export interface IVendorEditDTO extends IContactAddressDTO {
note?: string;
active?: boolean;
code?: string;
}
export interface IVendorsFilter extends IDynamicListFilter {
@@ -79,9 +79,8 @@ export function CustomerFormBasicSection({}) {
{/*----------- Display Name -----------*/}
<FFormGroup
name={'display_name'}
label={
<T id={'display_name'} />
}
label={<T id={'display_name'} />}
helperText="This is the name that appears on invoices and emails."
inline
fill
>
@@ -9,20 +9,6 @@ import {
useCustomerFormContext,
} from './CustomerFormProvider';
/**
* Customer form page loading.
* @returns {JSX}
*/
function CustomerFormPageLoading({ children }) {
const { isFormLoading } = useCustomerFormContext();
return (
<DashboardInsider loading={isFormLoading}>
{children}
</DashboardInsider>
);
}
/**
* Customer form page.
* @returns {JSX}
@@ -30,6 +16,7 @@ function CustomerFormPageLoading({ children }) {
export default function CustomerFormPage() {
const history = useHistory();
const { id } = useParams();
const { isFormLoading } = useCustomerFormContext();
const customerId = parseInt(id, 10);
@@ -46,14 +33,14 @@ export default function CustomerFormPage() {
return (
<CustomerFormProvider customerId={customerId}>
<CustomerFormPageLoading>
<DashboardInsider loading={isFormLoading}>
<Box mx={'auto'} maxWidth={800}>
<CustomerFormFormik
onSubmitSuccess={handleSubmitSuccess}
onCancel={handleFormCancel}
/>
</Box>
</CustomerFormPageLoading>
</DashboardInsider>
</CustomerFormProvider>
);
}
@@ -49,6 +49,18 @@ export function VendorFormBasicSection({}) {
</ControlGroup>
</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 -----------*/}
<FFormGroup
name={'company_name'}