add is_billable support for create / update project and in timetracker, fixes ST-217

This commit is contained in:
Gregor Vostrak
2024-06-06 16:04:37 +02:00
committed by Constantin Graf
parent d9244d1ab4
commit 7fb58ea341
22 changed files with 343 additions and 32 deletions

View File

@@ -0,0 +1,59 @@
<script setup lang="ts">
import FormSection from '@/Components/FormSection.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import { onMounted, ref } from 'vue';
import InputLabel from '@/Components/InputLabel.vue';
import type { UpdateOrganizationBody } from '@/utils/api';
import BillableRateInput from '@/Components/Common/BillableRateInput.vue';
import { useOrganizationStore } from '@/utils/useOrganization';
import { storeToRefs } from 'pinia';
const store = useOrganizationStore();
const { fetchOrganization, updateOrganization } = store;
const { organization } = storeToRefs(store);
const organizationBody = ref<UpdateOrganizationBody>({
name: '',
billable_rate: null,
});
onMounted(async () => {
await fetchOrganization();
organizationBody.value = {
name: organization.value?.name ?? '',
billable_rate: organization.value?.billable_rate,
};
});
function submit() {
updateOrganization(organizationBody.value);
}
</script>
<template>
<FormSection>
<template #title> Billable Rate</template>
<template #description>
Configure the default billable rate for the organization.
</template>
<template #form>
<!-- Organization Owner Information -->
<div class="col-span-6">
<div class="col-span-6 sm:col-span-4">
<InputLabel
for="organizationBillableRate"
value="Organization Billable Rate" />
<BillableRateInput
v-if="organization"
v-model="organizationBody.billable_rate"
name="organizationBillableRate"></BillableRateInput>
</div>
</div>
</template>
<template #actions>
<PrimaryButton @click="submit">Save</PrimaryButton>
</template>
</FormSection>
</template>

View File

@@ -8,6 +8,7 @@ import type { Organization } from '@/types/models';
import type { Permissions, Role } from '@/types/jetstream';
import ImportData from '@/Pages/Teams/Partials/ImportData.vue';
import { canUpdateOrganization } from '@/utils/permissions';
import OrganizationBillableRate from '@/Pages/Teams/Partials/OrganizationBillableRate.vue';
defineProps<{
team: Organization;
@@ -28,6 +29,11 @@ defineProps<{
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
<UpdateTeamNameForm :team="team" :permissions="permissions" />
<SectionBorder />
<OrganizationBillableRate
v-if="canUpdateOrganization()"
:team="team" />
<TeamMemberManager
class="mt-10 sm:mt-0"
:team="team"