Mount send modals on index views and dashboard, pass missing props

SendInvoiceModal and SendEstimateModal were only mounted on detail
views. Resend from table dropdowns did nothing because the modal
component was not in the DOM. Added to index views and dashboard.

Pass canCreatePayment and canCreateEstimate props to InvoiceDropdown
from detail view and dashboard.
This commit is contained in:
Darko Gjorgjijoski
2026-04-06 22:56:57 +02:00
parent 5c0e761dfa
commit c328d1cd10
5 changed files with 23 additions and 0 deletions

View File

@@ -168,6 +168,7 @@ const canCreateInvoiceFromEstimate = computed(() => userStore.hasAbilities(ABILI
:can-delete="canDeleteInvoice"
:can-send="canSendInvoice"
:can-create-payment="canCreatePayment"
:can-create-estimate="canCreateEstimate"
/>
</template>
</BaseTable>

View File

@@ -5,6 +5,8 @@ import { useUserStore } from '../../../../stores/user.store'
import DashboardStats from '../components/DashboardStats.vue'
import DashboardChart from '../components/DashboardChart.vue'
import DashboardTable from '../components/DashboardTable.vue'
import SendInvoiceModal from '@v2/features/company/invoices/components/SendInvoiceModal.vue'
import SendEstimateModal from '@v2/features/company/estimates/components/SendEstimateModal.vue'
const route = useRoute()
const router = useRouter()
@@ -27,4 +29,7 @@ onMounted(() => {
<DashboardChart />
<DashboardTable />
</BasePage>
<SendInvoiceModal />
<SendEstimateModal />
</template>

View File

@@ -220,6 +220,8 @@
</BaseTable>
</div>
</BasePage>
<SendEstimateModal />
</template>
<script setup lang="ts">
@@ -228,6 +230,7 @@ import { useI18n } from 'vue-i18n'
import { debouncedWatch } from '@vueuse/core'
import { useEstimateStore } from '../store'
import EstimateDropdown from '../components/EstimateDropdown.vue'
import SendEstimateModal from '../components/SendEstimateModal.vue'
import { useUserStore } from '../../../../stores/user.store'
import { useDialogStore } from '../../../../stores/dialog.store'
import type { Estimate } from '../../../../types/domain/estimate'

View File

@@ -45,6 +45,8 @@
:can-create="canCreate"
:can-delete="canDelete"
:can-send="canSend"
:can-create-payment="canCreatePayment"
:can-create-estimate="canCreateEstimate"
/>
</template>
</BasePageHeader>
@@ -276,6 +278,10 @@ const canCreatePayment = computed<boolean>(() => {
)
})
const canCreateEstimate = computed<boolean>(() => {
return userStore.hasAbilities('create-estimate')
})
const invoiceData = ref<Invoice | null>(null)
const isMarkAsSent = ref<boolean>(false)
const isLoading = ref<boolean>(false)

View File

@@ -329,6 +329,7 @@
:can-delete="canDelete"
:can-send="canSend"
:can-create-payment="canCreatePayment"
:can-create-estimate="canCreateEstimate"
/>
</template>
</BaseTable>
@@ -469,6 +470,8 @@
</div>
</template>
</BasePage>
<SendInvoiceModal />
</template>
<script setup lang="ts">
@@ -479,6 +482,7 @@ import { debouncedWatch } from '@vueuse/core'
import { useInvoiceStore } from '../store'
import { useRecurringInvoiceStore } from '../../recurring-invoices/store'
import InvoiceDropdown from '../components/InvoiceDropdown.vue'
import SendInvoiceModal from '../components/SendInvoiceModal.vue'
import RecurringInvoiceDropdown from '../../recurring-invoices/components/RecurringInvoiceDropdown.vue'
import { useUserStore } from '../../../../stores/user.store'
import { useDialogStore } from '../../../../stores/dialog.store'
@@ -649,6 +653,10 @@ const canCreatePayment = computed<boolean>(() => {
return userStore.hasAbilities('create-payment')
})
const canCreateEstimate = computed<boolean>(() => {
return userStore.hasAbilities('create-estimate')
})
const hasAtLeastOneAbility = computed<boolean>(() => {
return canDelete.value || canEdit.value || canView.value || canSend.value
})