|
|
@@ -65,7 +65,41 @@ Page 'Mon abonnement'
|
|
|
</UiExpansionPanel>
|
|
|
|
|
|
<UiExpansionPanel
|
|
|
- v-if="showDolibarrPanel"
|
|
|
+ v-if="dolibarrAccount !== null && dolibarrAccount.order"
|
|
|
+ title="purchase_order"
|
|
|
+ icon="fas fa-file"
|
|
|
+ >
|
|
|
+ <v-container :fluid="true" class="container">
|
|
|
+ <v-row>
|
|
|
+ <v-table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>{{ $t('reference') }}</th>
|
|
|
+ <th>{{ $t('date') }}</th>
|
|
|
+ <th></th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>{{ dolibarrAccount.order.ref }}</td>
|
|
|
+ <td>{{ $d(dolibarrAccount.order.date) }}</td>
|
|
|
+ <td>
|
|
|
+ <a
|
|
|
+ @click="downloadDolibarrBillingDoc(DOLIBARR_BILLING_DOC_TYPE.ORDER, dolibarrAccount.order.ref)"
|
|
|
+ class="clickable"
|
|
|
+ >
|
|
|
+ {{ $t('download') }}
|
|
|
+ </a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </v-table>
|
|
|
+ </v-row>
|
|
|
+ </v-container>
|
|
|
+ </UiExpansionPanel>
|
|
|
+
|
|
|
+ <UiExpansionPanel
|
|
|
+ v-if="showDolibarrBillsPanel"
|
|
|
title="bills"
|
|
|
icon="fas fa-file"
|
|
|
>
|
|
|
@@ -98,7 +132,7 @@ Page 'Mon abonnement'
|
|
|
</td>
|
|
|
<td>
|
|
|
<a
|
|
|
- @click="downloadDolibarrBill(bill.ref)"
|
|
|
+ @click="downloadDolibarrBillingDoc(DOLIBARR_BILLING_DOC_TYPE.INVOICE, bill.ref)"
|
|
|
class="clickable"
|
|
|
>
|
|
|
{{ $t('download') }}
|
|
|
@@ -440,6 +474,7 @@ import UrlUtils from '~/services/utils/urlUtils'
|
|
|
import { useDownloadFromRoute } from '~/composables/utils/useDownloadFromRoute'
|
|
|
import { useApiLegacyRequestService } from '~/composables/data/useApiLegacyRequestService'
|
|
|
import { usePageStore } from '~/stores/page'
|
|
|
+import {DOLIBARR_BILLING_DOC_TYPE} from '~/types/enum/enums';
|
|
|
|
|
|
//meta
|
|
|
definePageMeta({
|
|
|
@@ -467,12 +502,13 @@ const { data: dolibarrAccount, pending: dolibarrPending } = fetch(
|
|
|
organizationProfile.id,
|
|
|
)
|
|
|
|
|
|
-const showDolibarrPanel = computed(
|
|
|
+const showDolibarrBillsPanel = computed(
|
|
|
() =>
|
|
|
!dolibarrPending.value &&
|
|
|
dolibarrAccount.value &&
|
|
|
dolibarrAccount.value.bills.length > 0,
|
|
|
)
|
|
|
+
|
|
|
const formatCurrency = (value: number, currency: string): string => {
|
|
|
return value.toLocaleString(i18n.locale.value, {
|
|
|
style: 'currency',
|
|
|
@@ -526,6 +562,7 @@ function initPanel(): Ref<Array<string>> {
|
|
|
openedPanels.value = [
|
|
|
'subscription_page',
|
|
|
'service_detail',
|
|
|
+ 'purchase_order',
|
|
|
'bills',
|
|
|
'opentalent_offers',
|
|
|
'opentalent_options',
|
|
|
@@ -615,8 +652,8 @@ async function stopTrial() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const downloadDolibarrBill = (ref: string): void => {
|
|
|
- const route = UrlUtils.join('api/dolibarr/download/invoice', ref)
|
|
|
+const downloadDolibarrBillingDoc = (type: DOLIBARR_BILLING_DOC_TYPE, ref: string): void => {
|
|
|
+ const route = UrlUtils.join('api/dolibarr/download', type, encodeURIComponent(ref))
|
|
|
|
|
|
useDownloadFromRoute(route, `${ref}.pdf`)
|
|
|
}
|