Skip to content

Commit fb29239

Browse files
committed
feat(contract): add contract download functionality to CompanyBillingInfo and update CompanyView
1 parent e6c91d1 commit fb29239

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

frontend/src/components/companies/CompanyBillingInfo.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
<p class="text-sm">{{ company?.billingInfo?.tin }}</p>
6262
</div>
6363
</div>
64+
65+
<ContractDownload
66+
v-if="canSeeContract"
67+
:company-id="company?.id as string"
68+
/>
6469
</div>
6570

6671
<!-- No Billing Info State -->
@@ -75,6 +80,7 @@
7580

7681
<script setup lang="ts">
7782
import { ref, computed } from "vue";
83+
import { useAuthStore } from "@/stores/auth";
7884
import { useCompanyBillingMutation } from "@/mutations/companies";
7985
import type { Company, CompanyBillingInfo } from "@/dto/companies";
8086
import Card from "../ui/card/Card.vue";
@@ -85,6 +91,7 @@ import CardTitle from "../ui/card/CardTitle.vue";
8591
import Button from "../ui/button/Button.vue";
8692
import BillingForm from "./BillingForm.vue";
8793
import EmptyStateCard from "../ui/EmptyStateCard.vue";
94+
import ContractDownload from "./ContractDownload.vue";
8895
8996
interface Props {
9097
company?: Company;
@@ -115,6 +122,14 @@ const hasBillingInfo = computed(() => {
115122
const billingMutation = useCompanyBillingMutation();
116123
const { mutate: updateBilling, isLoading: isUpdating } = billingMutation;
117124
125+
const authStore = useAuthStore();
126+
const canSeeContract = computed(
127+
() =>
128+
authStore.isAuthenticated &&
129+
authStore.decoded &&
130+
(authStore.decoded as { role?: string }).role === "COORDINATOR",
131+
);
132+
118133
const startEditing = () => {
119134
isEditing.value = true;
120135
};

frontend/src/components/companies/ContractDownload.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<template>
2-
<div class="flex gap-2">
3-
<Button :disabled="isLoading" @click="download('pt')"
4-
>Generate Contract (PT)</Button
2+
<div class="flex flex-col gap-2">
3+
<Button
4+
size="sm"
5+
class="w-full"
6+
:disabled="isLoading"
7+
@click="download('pt')"
58
>
6-
<Button :disabled="isLoading" @click="download('en')"
7-
>Generate Contract (EN)</Button
9+
Generate Contract (PT)
10+
</Button>
11+
<Button
12+
size="sm"
13+
class="w-full"
14+
:disabled="isLoading"
15+
@click="download('en')"
816
>
17+
Generate Contract (EN)
18+
</Button>
919
</div>
1020
</template>
1121

frontend/src/views/Dashboard/Companies/CompanyView.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
@updated="handleCompanyUpdated"
2222
/>
2323

24-
<div class="mt-4">
25-
<ContractDownload :company-id="companyId as string" />
26-
</div>
27-
2824
<!-- Company Contacts -->
2925
<!-- prettier-ignore -->
3026
<CompanyContacts
@@ -64,7 +60,6 @@ import CompanyContacts from "@/components/companies/CompanyContacts.vue";
6460
import CompanyCommunications from "@/components/companies/CompanyCommunications.vue";
6561
import ParticipationsCard from "@/components/ParticipationsCard.vue";
6662
import DirectEmailDialogTrigger from "@/components/DirectEmailDialogTrigger.vue";
67-
import ContractDownload from "@/components/companies/ContractDownload.vue";
6863
import type { CompanyWithParticipation } from "@/dto/companies";
6964
import { withCurrentParticipation } from "@/lib/utils";
7065
import { useEventStore } from "@/stores/event";

0 commit comments

Comments
 (0)