Option to add installment to contract/account to increace balance amount same as payment and can be deleted which will reduce balance amount by new amount of the installment deleted, call later added badge to show active call laters
This commit is contained in:
@@ -15,6 +15,8 @@ import CaseObjectCreateDialog from "./CaseObjectCreateDialog.vue";
|
||||
import CaseObjectsDialog from "./CaseObjectsDialog.vue";
|
||||
import PaymentDialog from "./PaymentDialog.vue";
|
||||
import ViewPaymentsDialog from "./ViewPaymentsDialog.vue";
|
||||
import InstallmentDialog from "./InstallmentDialog.vue";
|
||||
import ViewInstallmentsDialog from "./ViewInstallmentsDialog.vue";
|
||||
import ContractMetaEditDialog from "./ContractMetaEditDialog.vue";
|
||||
import CreateDialog from "@/Components/Dialogs/CreateDialog.vue";
|
||||
import ConfirmationDialog from "@/Components/Dialogs/ConfirmationDialog.vue";
|
||||
@@ -31,6 +33,7 @@ import {
|
||||
faSpinner,
|
||||
faTags,
|
||||
faFolderOpen,
|
||||
faArrowUp,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import EmptyState from "@/Components/EmptyState.vue";
|
||||
import { Button } from "@/Components/ui/button";
|
||||
@@ -444,6 +447,52 @@ const closePaymentsDialog = () => {
|
||||
selectedContract.value = null;
|
||||
};
|
||||
|
||||
// Installments
|
||||
const showInstallmentDialog = ref(false);
|
||||
const installmentContract = ref(null);
|
||||
const installmentForm = useForm({
|
||||
amount: null,
|
||||
currency: "EUR",
|
||||
installment_at: null,
|
||||
reference: "",
|
||||
});
|
||||
|
||||
const openInstallmentDialog = (c) => {
|
||||
installmentContract.value = c;
|
||||
installmentForm.reset();
|
||||
installmentForm.installment_at = todayStr.value;
|
||||
showInstallmentDialog.value = true;
|
||||
};
|
||||
|
||||
const closeInstallmentDialog = () => {
|
||||
showInstallmentDialog.value = false;
|
||||
installmentContract.value = null;
|
||||
};
|
||||
|
||||
const submitInstallment = () => {
|
||||
if (!installmentContract.value?.account?.id) return;
|
||||
const accountId = installmentContract.value.account.id;
|
||||
installmentForm.post(route("accounts.installments.store", { account: accountId }), {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
closeInstallmentDialog();
|
||||
router.reload({ only: ["contracts", "activities"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const showInstallmentsDialog = ref(false);
|
||||
|
||||
const openInstallmentsDialog = (c) => {
|
||||
selectedContract.value = c;
|
||||
showInstallmentsDialog.value = true;
|
||||
};
|
||||
|
||||
const closeInstallmentsDialog = () => {
|
||||
showInstallmentsDialog.value = false;
|
||||
selectedContract.value = null;
|
||||
};
|
||||
|
||||
// Meta edit dialog
|
||||
const showMetaEditDialog = ref(false);
|
||||
|
||||
@@ -832,6 +881,26 @@ const availableSegmentsCount = computed(() => {
|
||||
@click="openPaymentDialog(row)"
|
||||
/>
|
||||
|
||||
<div class="my-1 border-t border-gray-100" />
|
||||
|
||||
<!-- Installments -->
|
||||
<div
|
||||
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
|
||||
>
|
||||
Obroki
|
||||
</div>
|
||||
<ActionMenuItem
|
||||
:icon="faCircleInfo"
|
||||
label="Pokaži obroke"
|
||||
@click="openInstallmentsDialog(row)"
|
||||
/>
|
||||
<ActionMenuItem
|
||||
v-if="row.active && row?.account"
|
||||
:icon="faArrowUp"
|
||||
label="Dodaj obrok"
|
||||
@click="openInstallmentDialog(row)"
|
||||
/>
|
||||
|
||||
<!-- Archive -->
|
||||
<template v-if="edit">
|
||||
<div class="my-1 border-t border-gray-100" />
|
||||
@@ -937,6 +1006,20 @@ const availableSegmentsCount = computed(() => {
|
||||
:edit="edit"
|
||||
/>
|
||||
|
||||
<InstallmentDialog
|
||||
:show="showInstallmentDialog"
|
||||
:form="installmentForm"
|
||||
@close="closeInstallmentDialog"
|
||||
@submit="submitInstallment"
|
||||
/>
|
||||
|
||||
<ViewInstallmentsDialog
|
||||
:show="showInstallmentsDialog"
|
||||
:contract="selectedContract"
|
||||
@close="closeInstallmentsDialog"
|
||||
:edit="edit"
|
||||
/>
|
||||
|
||||
<ContractMetaEditDialog
|
||||
:show="showMetaEditDialog"
|
||||
:client_case="client_case"
|
||||
|
||||
Reference in New Issue
Block a user