From efc89cf6af5658f2b09ec070a2b5b44e48db6073 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Tue, 1 Oct 2024 21:54:54 +0200 Subject: [PATCH] add employees_can_see_billable_rates setting to organization settings --- .../Partials/OrganizationBillableRate.vue | 33 ++++++++++++++++++- .../packages/api/src/openapi.json.client.ts | 2 ++ .../js/packages/ui/src/Input/Checkbox.vue | 5 +++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/resources/js/Pages/Teams/Partials/OrganizationBillableRate.vue b/resources/js/Pages/Teams/Partials/OrganizationBillableRate.vue index d80ec2e4..03f42cc7 100644 --- a/resources/js/Pages/Teams/Partials/OrganizationBillableRate.vue +++ b/resources/js/Pages/Teams/Partials/OrganizationBillableRate.vue @@ -9,6 +9,7 @@ import { useOrganizationStore } from '@/utils/useOrganization'; import { storeToRefs } from 'pinia'; import OrganizationBillableRateModal from '@/Components/Common/Organization/OrganizationBillableRateModal.vue'; import { getOrganizationCurrencyString } from '@/utils/money'; +import { Checkbox } from '@/packages/ui/src'; const store = useOrganizationStore(); const { fetchOrganization, updateOrganization } = store; @@ -17,6 +18,7 @@ const saving = ref(false); const organizationBody = ref({ name: '', billable_rate: null as number | null, + employees_can_see_billable_rates: false, }); onMounted(async () => { @@ -24,6 +26,8 @@ onMounted(async () => { organizationBody.value = { name: organization.value?.name ?? '', billable_rate: organization.value?.billable_rate, + employees_can_see_billable_rates: + organization.value?.employees_can_see_billable_rates ?? false, }; }); const showConfirmationModal = ref(false); @@ -34,6 +38,17 @@ async function submit() { saving.value = false; showConfirmationModal.value = false; } + +function checkForConfirmationModal() { + if ( + organizationBody.value.billable_rate === + organization.value?.billable_rate + ) { + submit(); + } else { + showConfirmationModal.value = true; + } +} diff --git a/resources/js/packages/api/src/openapi.json.client.ts b/resources/js/packages/api/src/openapi.json.client.ts index ea962f36..084ad8c4 100644 --- a/resources/js/packages/api/src/openapi.json.client.ts +++ b/resources/js/packages/api/src/openapi.json.client.ts @@ -51,12 +51,14 @@ const OrganizationResource = z name: z.string(), is_personal: z.boolean(), billable_rate: z.union([z.number(), z.null()]), + employees_can_see_billable_rates: z.boolean(), }) .passthrough(); const OrganizationUpdateRequest = z .object({ name: z.string().max(255), billable_rate: z.union([z.number(), z.null()]).optional(), + employees_can_see_billable_rates: z.boolean().optional(), }) .passthrough(); const ProjectResource = z diff --git a/resources/js/packages/ui/src/Input/Checkbox.vue b/resources/js/packages/ui/src/Input/Checkbox.vue index e2d0bda0..295b88e4 100644 --- a/resources/js/packages/ui/src/Input/Checkbox.vue +++ b/resources/js/packages/ui/src/Input/Checkbox.vue @@ -12,6 +12,10 @@ const props = defineProps({ type: String, default: null, }, + id: { + type: String, + default: null, + }, }); const proxyChecked = computed({ @@ -29,6 +33,7 @@ const proxyChecked = computed({