Skip to content

Commit

Permalink
fix: hide/show organization/contact switch if section exists
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Jan 1, 2025
1 parent 9113378 commit cc0f440
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions frontend/src/components/Modals/DealModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,29 @@
</div>
</div>
<div>
<div class="mb-4 grid grid-cols-1 gap-4 sm:grid-cols-3">
<div class="flex items-center gap-3 text-sm text-ink-gray-5">
<div
v-if="hasOrganizationSections || hasContactSections"
class="mb-4 grid grid-cols-1 gap-4 sm:grid-cols-3"
>
<div
v-if="hasOrganizationSections"
class="flex items-center gap-3 text-sm text-ink-gray-5"
>
<div>{{ __('Choose Existing Organization') }}</div>
<Switch v-model="chooseExistingOrganization" />
</div>
<div class="flex items-center gap-3 text-sm text-ink-gray-5">
<div
v-if="hasContactSections"
class="flex items-center gap-3 text-sm text-ink-gray-5"
>
<div>{{ __('Choose Existing Contact') }}</div>
<Switch v-model="chooseExistingContact" />
</div>
</div>
<div class="h-px w-full border-t my-5" />
<div
v-if="hasOrganizationSections || hasContactSections"
class="h-px w-full border-t my-5"
/>
<FieldLayout
ref="fieldLayoutRef"
v-if="tabs.data?.length"
Expand Down Expand Up @@ -98,6 +110,9 @@ const deal = reactive({
deal_owner: '',
})
const hasOrganizationSections = ref(false)
const hasContactSections = ref(false)
const isDealCreating = ref(false)
const chooseExistingContact = ref(false)
const chooseExistingOrganization = ref(false)
Expand Down Expand Up @@ -131,6 +146,19 @@ const tabs = createResource({
return _tabs.forEach((tab) => {
tab.sections.forEach((section) => {
section.columns.forEach((column) => {
if (
['organization_section', 'organization_details_section'].includes(
section.name,
)
) {
hasOrganizationSections.value = true
} else if (
['contact_section', 'contact_details_section'].includes(
section.name,
)
) {
hasContactSections.value = true
}
column.fields.forEach((field) => {
if (field.name == 'status') {
field.type = 'Select'
Expand Down

0 comments on commit cc0f440

Please sign in to comment.