|
@@ -61,11 +61,26 @@
|
|
|
dense
|
|
dense
|
|
|
no-caps
|
|
no-caps
|
|
|
unelevated
|
|
unelevated
|
|
|
- :disable="!canEdit"
|
|
|
|
|
- :loading="reopeningId === row.id"
|
|
|
|
|
|
|
+ :disable="!canEdit || row.status === 'paid'"
|
|
|
@click.stop="changeStatus(row)"
|
|
@click.stop="changeStatus(row)"
|
|
|
>
|
|
>
|
|
|
- <q-tooltip v-if="canEdit">Clique para alterar o status</q-tooltip>
|
|
|
|
|
|
|
+ <q-tooltip v-if="canEdit && row.status !== 'paid'">Dar baixa</q-tooltip>
|
|
|
|
|
+ </q-btn>
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #body-cell-actions="{ row }">
|
|
|
|
|
+ <q-td auto-width>
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ v-if="row.invoice_url"
|
|
|
|
|
+ round
|
|
|
|
|
+ dense
|
|
|
|
|
+ flat
|
|
|
|
|
+ color="teal-7"
|
|
|
|
|
+ icon="mdi-open-in-new"
|
|
|
|
|
+ aria-label="Abrir cobrança"
|
|
|
|
|
+ @click="openInvoice(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-tooltip>Abrir cobrança no Asaas</q-tooltip>
|
|
|
</q-btn>
|
|
</q-btn>
|
|
|
</q-td>
|
|
</q-td>
|
|
|
</template>
|
|
</template>
|
|
@@ -178,7 +193,6 @@ import {
|
|
|
getPayablesMe,
|
|
getPayablesMe,
|
|
|
createPayableMe,
|
|
createPayableMe,
|
|
|
settlePayableMe,
|
|
settlePayableMe,
|
|
|
- reopenPayableMe,
|
|
|
|
|
} from "src/api/unit_payable";
|
|
} from "src/api/unit_payable";
|
|
|
|
|
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
@@ -203,7 +217,6 @@ const rows = ref([]);
|
|
|
const settleDialog = ref(false);
|
|
const settleDialog = ref(false);
|
|
|
const selected = ref(null);
|
|
const selected = ref(null);
|
|
|
const settling = ref(false);
|
|
const settling = ref(false);
|
|
|
-const reopeningId = ref(null);
|
|
|
|
|
const settleForm = ref({ payment_date: null, payment_date_iso: null, discount: 0, fine: 0 });
|
|
const settleForm = ref({ payment_date: null, payment_date_iso: null, discount: 0, fine: 0 });
|
|
|
|
|
|
|
|
const createDialog = ref(false);
|
|
const createDialog = ref(false);
|
|
@@ -217,6 +230,7 @@ const columns = [
|
|
|
{ name: "value", label: "Valor", field: "value", align: "left" },
|
|
{ name: "value", label: "Valor", field: "value", align: "left" },
|
|
|
{ name: "due_date", label: "Vencimento", field: "due_date", align: "left" },
|
|
{ name: "due_date", label: "Vencimento", field: "due_date", align: "left" },
|
|
|
{ name: "status", label: "Status", field: "status", align: "left" },
|
|
{ name: "status", label: "Status", field: "status", align: "left" },
|
|
|
|
|
+ { name: "actions", label: "Ações", field: "actions", align: "right" },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
function formatCurrency(value) {
|
|
function formatCurrency(value) {
|
|
@@ -276,8 +290,11 @@ function openSettle(row) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function changeStatus(row) {
|
|
function changeStatus(row) {
|
|
|
- if (row.status === "paid") onReopen(row);
|
|
|
|
|
- else openSettle(row);
|
|
|
|
|
|
|
+ if (row.status !== "paid") openSettle(row);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function openInvoice(row) {
|
|
|
|
|
+ window.open(row.invoice_url, "_blank");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function onSettle() {
|
|
async function onSettle() {
|
|
@@ -298,18 +315,6 @@ async function onSettle() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-async function onReopen(row) {
|
|
|
|
|
- reopeningId.value = row.id;
|
|
|
|
|
- try {
|
|
|
|
|
- await reopenPayableMe(row.id);
|
|
|
|
|
- await loadData();
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error(e);
|
|
|
|
|
- } finally {
|
|
|
|
|
- reopeningId.value = null;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function openCreate() {
|
|
function openCreate() {
|
|
|
const today = new Date();
|
|
const today = new Date();
|
|
|
createForm.value = {
|
|
createForm.value = {
|