task-d5.5.1
This commit is contained in:
@@ -325,8 +325,8 @@ export const crmContactShares = pgTable(
|
||||
})
|
||||
);
|
||||
|
||||
export const crmEnquiries = pgTable(
|
||||
'crm_enquiries',
|
||||
export const crmOpportunities = pgTable(
|
||||
'crm_opportunities',
|
||||
{
|
||||
id: text('id').primaryKey(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
@@ -374,17 +374,17 @@ export const crmEnquiries = pgTable(
|
||||
updatedBy: text('updated_by').notNull()
|
||||
},
|
||||
(table) => ({
|
||||
organizationCodeIdx: uniqueIndex('crm_enquiries_org_code_idx').on(
|
||||
organizationCodeIdx: uniqueIndex('crm_opportunities_org_code_idx').on(
|
||||
table.organizationId,
|
||||
table.code
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
export const crmEnquiryFollowups = pgTable('crm_enquiry_followups', {
|
||||
export const crmOpportunityFollowups = pgTable('crm_opportunity_followups', {
|
||||
id: text('id').primaryKey(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
enquiryId: text('enquiry_id').notNull(),
|
||||
opportunityId: text('opportunity_id').notNull(),
|
||||
followupDate: timestamp('followup_date', { withTimezone: true }).notNull(),
|
||||
followupType: text('followup_type').notNull(),
|
||||
contactId: text('contact_id'),
|
||||
@@ -399,10 +399,10 @@ export const crmEnquiryFollowups = pgTable('crm_enquiry_followups', {
|
||||
updatedBy: text('updated_by').notNull()
|
||||
});
|
||||
|
||||
export const crmEnquiryCustomers = pgTable('crm_enquiry_customers', {
|
||||
export const crmOpportunityCustomers = pgTable('crm_opportunity_customers', {
|
||||
id: text('id').primaryKey(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
enquiryId: text('enquiry_id').notNull(),
|
||||
opportunityId: text('opportunity_id').notNull(),
|
||||
customerId: text('customer_id').notNull(),
|
||||
role: text('role').notNull(),
|
||||
remark: text('remark'),
|
||||
@@ -411,10 +411,10 @@ export const crmEnquiryCustomers = pgTable('crm_enquiry_customers', {
|
||||
deletedAt: timestamp('deleted_at', { withTimezone: true })
|
||||
});
|
||||
|
||||
export const crmEnquiryAttachments = pgTable('crm_enquiry_attachments', {
|
||||
export const crmOpportunityAttachments = pgTable('crm_opportunity_attachments', {
|
||||
id: text('id').primaryKey(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
enquiryId: text('enquiry_id').notNull(),
|
||||
opportunityId: text('opportunity_id').notNull(),
|
||||
category: text('category').notNull(),
|
||||
fileName: text('file_name').notNull(),
|
||||
originalFileName: text('original_file_name').notNull(),
|
||||
@@ -459,7 +459,7 @@ export const crmQuotations = pgTable(
|
||||
organizationId: text('organization_id').notNull(),
|
||||
branchId: text('branch_id'),
|
||||
code: text('code').notNull(),
|
||||
enquiryId: text('enquiry_id'),
|
||||
opportunityId: text('opportunity_id'),
|
||||
customerId: text('customer_id').notNull(),
|
||||
contactId: text('contact_id'),
|
||||
quotationDate: timestamp('quotation_date', { withTimezone: true }).notNull(),
|
||||
@@ -804,3 +804,4 @@ export const crmDocumentTemplateTableColumns = pgTable(
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ const FOUNDATION_OPTIONS = {
|
||||
parentCategory: 'crm_customer_group'
|
||||
}
|
||||
],
|
||||
crm_enquiry_status: [
|
||||
crm_opportunity_status: [
|
||||
{ code: 'new', label: 'New', value: 'new', sortOrder: 1 },
|
||||
{ code: 'qualifying', label: 'Qualifying', value: 'qualifying', sortOrder: 2 },
|
||||
{ code: 'requirement', label: 'Requirement', value: 'requirement', sortOrder: 3 },
|
||||
@@ -468,15 +468,15 @@ const REPORT_DEFINITIONS: ReportDefinitionSeed[] = [
|
||||
category: 'pipeline'
|
||||
},
|
||||
{
|
||||
code: 'enquiry_pipeline',
|
||||
name: 'Enquiry Pipeline',
|
||||
description: 'Operational report for open enquiries, quotation progress, and sales pipeline health.',
|
||||
code: 'opportunity_pipeline',
|
||||
name: 'Opportunity Pipeline',
|
||||
description: 'Operational report for open opportunities, quotation progress, and sales pipeline health.',
|
||||
category: 'pipeline'
|
||||
},
|
||||
{
|
||||
code: 'enquiry_aging',
|
||||
name: 'Enquiry Aging',
|
||||
description: 'Operational report for stalled enquiries and aging opportunity follow-ups.',
|
||||
code: 'opportunity_aging',
|
||||
name: 'Opportunity Aging',
|
||||
description: 'Operational report for stalled opportunities and aging opportunity follow-ups.',
|
||||
category: 'pipeline'
|
||||
},
|
||||
{
|
||||
@@ -488,13 +488,13 @@ const REPORT_DEFINITIONS: ReportDefinitionSeed[] = [
|
||||
{
|
||||
code: 'lead_conversion',
|
||||
name: 'Lead Conversion',
|
||||
description: 'Marketing conversion report from lead creation into active enquiries.',
|
||||
description: 'Marketing conversion report from lead creation into active opportunities.',
|
||||
category: 'pipeline'
|
||||
},
|
||||
{
|
||||
code: 'enquiry_conversion',
|
||||
name: 'Enquiry Conversion',
|
||||
description: 'Sales conversion report from enquiry creation into quotation generation.',
|
||||
code: 'opportunity_conversion',
|
||||
name: 'Opportunity Conversion',
|
||||
description: 'Sales conversion report from opportunity creation into quotation generation.',
|
||||
category: 'pipeline'
|
||||
},
|
||||
{
|
||||
@@ -520,9 +520,9 @@ const REPORT_DEFINITIONS: ReportDefinitionSeed[] = [
|
||||
const DOCUMENT_SEQUENCES = [
|
||||
{ documentType: 'customer', prefix: 'CUS' },
|
||||
{ documentType: 'contact', prefix: 'CON' },
|
||||
{ documentType: 'enquiry', prefix: 'ENQ' },
|
||||
{ documentType: 'opportunity', prefix: 'ENQ' },
|
||||
{ documentType: 'crm_lead', prefix: 'LD' },
|
||||
{ documentType: 'crm_enquiry', prefix: 'EN' },
|
||||
{ documentType: 'crm_opportunity', prefix: 'EN' },
|
||||
{ documentType: 'quotation', prefix: 'QT' },
|
||||
{ documentType: 'approval', prefix: 'APV' }
|
||||
];
|
||||
@@ -1229,3 +1229,4 @@ if (require.main === module) {
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user