diff --git a/packages/drafts-realm/OpportunityForm/37f6334a-02be-48db-a675-20409f8d5507.json b/packages/drafts-realm/OpportunityForm/37f6334a-02be-48db-a675-20409f8d5507.json index c8d7e1f929..a630c7f8ec 100644 --- a/packages/drafts-realm/OpportunityForm/37f6334a-02be-48db-a675-20409f8d5507.json +++ b/packages/drafts-realm/OpportunityForm/37f6334a-02be-48db-a675-20409f8d5507.json @@ -3,6 +3,7 @@ "type": "card", "attributes": { "opportunityName": "Opportunity Name", + "companyName": "", "closeDate": "2024-06-13", "amount": { "currency": "RM", diff --git a/packages/drafts-realm/SaleHub/bcbf2e7d-16ad-41e0-95a4-03dc988809e5.json b/packages/drafts-realm/SaleHub/bcbf2e7d-16ad-41e0-95a4-03dc988809e5.json index 6dacede677..124107945a 100644 --- a/packages/drafts-realm/SaleHub/bcbf2e7d-16ad-41e0-95a4-03dc988809e5.json +++ b/packages/drafts-realm/SaleHub/bcbf2e7d-16ad-41e0-95a4-03dc988809e5.json @@ -93,6 +93,7 @@ }, "opportunityForm": { "opportunityName": null, + "companyName": "Law lawbombom", "closeDate": null, "amount": { "currency": null, diff --git a/packages/drafts-realm/opportunity-form.gts b/packages/drafts-realm/opportunity-form.gts index 971266bb18..a4abc9addb 100644 --- a/packages/drafts-realm/opportunity-form.gts +++ b/packages/drafts-realm/opportunity-form.gts @@ -119,6 +119,11 @@ class AmountField extends FieldDef { /* Opportunity Form */ class IsolatedSecForOpportunityForm extends Component { + get getCompanyName() { + if (!this.args.model.companyName) return '-'; + return this.args.model.companyName; + } + get getFormattedAmount() { const amount = this.args.model.amount; const hasAmount = amount && amount.totalAmount; @@ -176,6 +181,11 @@ class IsolatedSecForOpportunityForm extends Component {
+
+ + + {{this.getCompanyName}} +
<@fields.closeDate /> @@ -338,6 +348,10 @@ class EditSecForOpportunityForm extends Component { <@fields.accountName /> + + <@fields.companyName /> + + <@fields.closeDate /> @@ -432,6 +446,9 @@ export class OpportunityFormField extends FieldDef { @field accountName = linksTo(CrmAccount, { description: `Account Name`, }); + @field companyName = contains(StringField, { + description: `Company Name`, + }); @field closeDate = contains(DateCard, { description: `Close Date`, }); @@ -465,6 +482,9 @@ export class OpportunityForm extends CardDef { @field accountName = linksTo(CrmAccount, { description: `Account Name`, }); + @field companyName = contains(StringField, { + description: `Company Name`, + }); @field closeDate = contains(DateCard, { description: `Close Date`, }); diff --git a/packages/drafts-realm/sale-hub.gts b/packages/drafts-realm/sale-hub.gts index c0e1fd2460..5316a7925d 100644 --- a/packages/drafts-realm/sale-hub.gts +++ b/packages/drafts-realm/sale-hub.gts @@ -788,6 +788,9 @@ class IsolatedSecForSaleHub extends Component { @action handleConvert() { this.openModal(); + this.updateAccountFormAccountName(); + this.updateContactFormName(); + this.updateOpportunityAccountName(); } //task-form modal @@ -796,10 +799,6 @@ class IsolatedSecForSaleHub extends Component { @action openTaskFormModal() { this.isTaskFormModalVisible = true; - - this.updateAccountFormAccountName(); - this.updateContactFormName(); - this.updateOpportunityAccountName(); } @action @@ -848,43 +847,34 @@ class IsolatedSecForSaleHub extends Component { const firstName = this.args.model.leadForm.name.firstName; const company = this.args.model.leadForm.company; - this.args.model.opportunityForm.opportunityName = `${firstName} ${company}`; + this.args.model.opportunityForm.companyName = `${firstName} ${company}`; } } get accountFormAccountName() { const { leadForm } = this.args.model; - if (!leadForm || !leadForm.name) return ''; - const { salutation, firstName, lastName } = leadForm.name; if (!salutation || !firstName || !lastName) return ''; - return `${salutation} ${firstName} ${lastName}`; } get contactFormAccountName() { const { leadForm } = this.args.model; - if (!leadForm || !leadForm.name) return ''; - const { salutation, firstName, lastName } = leadForm.name; if (!salutation || !firstName || !lastName) return ''; - return `${salutation} ${firstName} ${lastName}`; } get opportunityFormName() { const { leadForm } = this.args.model; - - if (!leadForm || !leadForm.name || !leadForm.company) return ''; - + if (!leadForm || !leadForm.company) return ''; const { firstName } = leadForm.name; if (!firstName) return ''; - return `${firstName} ${leadForm.company}`; }