-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
224b6c3
commit cfa5987
Showing
33 changed files
with
818 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,6 @@ onBeforeMount(() => { | |
updateFieldValues(invoice.value); | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
apps/dashboard/src/modules/financial/components/invoice/create/InvoiceCreate.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<template> | ||
<CardComponent header="Create Invoice"> | ||
<ActionButton | ||
type="submit" | ||
:disabled="disabled" | ||
:label="t('common.create')" | ||
:submitting="form.context.isSubmitting.value" | ||
:result="form.success?.value != null" | ||
@click="form.submit" | ||
/> | ||
</CardComponent> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CardComponent from "@/components/CardComponent.vue"; | ||
import { computed, type PropType } from "vue"; | ||
import { type Form, getProperty, setSubmit, setSuccess } from "@/utils/formUtils"; | ||
import * as yup from "yup"; | ||
import { createInvoiceObject } from "@/utils/validation-schema"; | ||
import ActionButton from "@/components/ActionButton.vue"; | ||
import { useI18n } from "vue-i18n"; | ||
import type { CreateInvoiceRequest } from "@sudosos/sudosos-client"; | ||
import { useAuthStore } from "@sudosos/sudosos-frontend-common"; | ||
import apiService from "@/services/ApiService"; | ||
import { useToast } from "primevue/usetoast"; | ||
import { handleError } from "@/utils/errorUtils"; | ||
const { t } = useI18n(); | ||
const toast = useToast(); | ||
const authStore = useAuthStore(); | ||
const props = defineProps({ | ||
form: { | ||
type: Object as PropType<Form<yup.InferType<typeof createInvoiceObject>>>, | ||
required: true, | ||
}, | ||
}); | ||
const disabled = computed(() => { | ||
return !props.form?.context.meta.value.valid || getProperty(props.form, "forId") === undefined; | ||
}); | ||
setSubmit(props.form, props.form.context.handleSubmit(async (values) => { | ||
const byId = authStore.user?.id; | ||
if (byId === undefined) { | ||
setSuccess(props.form, false); | ||
return; | ||
} | ||
const request: CreateInvoiceRequest = { | ||
forId: values.forId, | ||
byId, | ||
addressee: values.addressee, | ||
description: values.description, | ||
reference: values.reference, | ||
transactionIDs: values.transactionIDs, | ||
street: values.street, | ||
postalCode: values.postalCode, | ||
city: values.city, | ||
country: values.country, | ||
date: values.date, | ||
attention: values.attention, | ||
amount: values.transactionTotal, | ||
}; | ||
await apiService.invoices.createInvoice(request).then(() => { | ||
toast.add({ | ||
severity: 'success', | ||
summary: t('common.toast.success.success'), | ||
detail: t('common.toast.success.invoiceCreated'), | ||
life: 3000, | ||
}); | ||
setSuccess(props.form, true); | ||
props.form.context.resetForm(); | ||
}).catch((error) => { | ||
setSuccess(props.form, false); | ||
handleError(error, toast); | ||
}); | ||
})); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
35 changes: 35 additions & 0 deletions
35
...dashboard/src/modules/financial/components/invoice/create/InvoiceCreateAddressingCard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<FormCard :header="t('modules.financial.forms.invoice.addressing')" :enable-edit="false"> | ||
<div class="flex flex-column justify-content-between gap-2"> | ||
<InvoiceBaseAddressingForm :form="form" :edit="edit"/> | ||
</div> | ||
</FormCard> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import FormCard from "@/components/FormCard.vue"; | ||
import { computed, type PropType } from "vue"; | ||
import { createInvoiceObject } from "@/utils/validation-schema"; | ||
import { type Form, getProperty } from "@/utils/formUtils"; | ||
import { useI18n } from "vue-i18n"; | ||
import * as yup from "yup"; | ||
import InvoiceBaseAddressingForm from "@/modules/financial/components/invoice/forms/InvoiceBaseAddressingForm.vue"; | ||
const { t } = useI18n(); | ||
const props = defineProps({ | ||
form: { | ||
type: Object as PropType<Form<yup.InferType<typeof createInvoiceObject>>>, | ||
required: true, | ||
}, | ||
}); | ||
const edit = computed(() => { | ||
const forId = getProperty(props.form, "forId"); | ||
return forId !== undefined; | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
35 changes: 35 additions & 0 deletions
35
apps/dashboard/src/modules/financial/components/invoice/create/InvoiceCreateSettingsCard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<FormCard :header="t('modules.financial.forms.invoice.settings')" :enable-edit="false"> | ||
<div class="flex flex-column justify-content-between gap-2"> | ||
<InvoiceBaseSettingsForm :form="form" :edit="edit"/> | ||
</div> | ||
</FormCard> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import FormCard from "@/components/FormCard.vue"; | ||
import { computed, type PropType } from "vue"; | ||
import { createInvoiceObject } from "@/utils/validation-schema"; | ||
import { type Form, getProperty } from "@/utils/formUtils"; | ||
import { useI18n } from "vue-i18n"; | ||
import * as yup from "yup"; | ||
import InvoiceBaseSettingsForm from "@/modules/financial/components/invoice/forms/InvoiceBaseSettingsForm.vue"; | ||
const { t } = useI18n(); | ||
const props = defineProps({ | ||
form: { | ||
type: Object as PropType<Form<yup.InferType<typeof createInvoiceObject>>>, | ||
required: true, | ||
}, | ||
}); | ||
const edit = computed(() => { | ||
const forId = getProperty(props.form, "forId"); | ||
return forId !== undefined; | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
Oops, something went wrong.