Big changes added events for decisions
This commit is contained in:
@@ -8,6 +8,7 @@ import SavedMappingsTable from "./Partials/SavedMappingsTable.vue";
|
||||
import LogsTable from "./Partials/LogsTable.vue";
|
||||
import ProcessResult from "./Partials/ProcessResult.vue";
|
||||
import { ref, computed, onMounted, watch } from "vue";
|
||||
import { router } from "@inertiajs/vue3";
|
||||
import Multiselect from "vue-multiselect";
|
||||
import axios from "axios";
|
||||
import Modal from "@/Components/Modal.vue"; // still potentially used elsewhere
|
||||
@@ -150,6 +151,40 @@ async function openMissingContracts() {
|
||||
}
|
||||
}
|
||||
|
||||
// Unresolved keyref rows (contracts not found) UI state
|
||||
const showUnresolved = ref(false);
|
||||
const unresolvedLoading = ref(false);
|
||||
const unresolvedColumns = ref([]);
|
||||
const unresolvedRows = ref([]); // [{id,row_number,values:[]}]
|
||||
async function openUnresolved() {
|
||||
if (!importId.value || !contractRefIsKeyref.value) return;
|
||||
showUnresolved.value = true;
|
||||
unresolvedLoading.value = true;
|
||||
try {
|
||||
const { data } = await axios.get(
|
||||
route("imports.missing-keyref-rows", { import: importId.value }),
|
||||
{ headers: { Accept: "application/json" }, withCredentials: true }
|
||||
);
|
||||
unresolvedColumns.value = Array.isArray(data?.columns) ? data.columns : [];
|
||||
unresolvedRows.value = Array.isArray(data?.rows) ? data.rows : [];
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"Unresolved keyref rows fetch failed",
|
||||
e.response?.status || "",
|
||||
e.response?.data || e
|
||||
);
|
||||
unresolvedColumns.value = [];
|
||||
unresolvedRows.value = [];
|
||||
} finally {
|
||||
unresolvedLoading.value = false;
|
||||
}
|
||||
}
|
||||
function downloadUnresolvedCsv() {
|
||||
if (!importId.value) return;
|
||||
// Direct download
|
||||
window.location.href = route("imports.missing-keyref-csv", { import: importId.value });
|
||||
}
|
||||
|
||||
// Determine if all detected columns are mapped with entity+field
|
||||
function evaluateMappingSaved() {
|
||||
console.log("here the evaluation happen of mapping save!");
|
||||
@@ -881,6 +916,9 @@ async function processImport() {
|
||||
}
|
||||
);
|
||||
processResult.value = data;
|
||||
// Immediately refresh the page props to reflect the completed state
|
||||
// Reload only the 'import' prop to minimize payload; don't preserve state so UI reflects new status
|
||||
router.reload({ only: ["import"], preserveScroll: true, preserveState: false });
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"Process import error",
|
||||
@@ -1153,6 +1191,14 @@ async function fetchSimulation() {
|
||||
>
|
||||
Ogled manjkajoče
|
||||
</button>
|
||||
<button
|
||||
v-if="isCompleted && contractRefIsKeyref"
|
||||
class="px-3 py-1.5 bg-amber-600 text-white text-xs rounded"
|
||||
@click.prevent="openUnresolved"
|
||||
title="Prikaži vrstice, kjer pogodba (keyref) ni bila najdena"
|
||||
>
|
||||
Neobstoječi
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
@@ -1331,6 +1377,67 @@ async function fetchSimulation() {
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<!-- Unresolved keyref rows modal -->
|
||||
<Modal :show="showUnresolved" max-width="5xl" @close="showUnresolved = false">
|
||||
<div class="p-4 max-h-[75vh] overflow-auto">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="font-semibold text-lg">
|
||||
Vrstice z neobstoječim contract.reference (KEYREF)
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
class="px-3 py-1.5 bg-green-600 text-white text-xs rounded"
|
||||
@click.prevent="downloadUnresolvedCsv"
|
||||
>
|
||||
Prenesi CSV
|
||||
</button>
|
||||
<button
|
||||
class="text-gray-500 hover:text-gray-700"
|
||||
@click.prevent="showUnresolved = false"
|
||||
>
|
||||
Zapri
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="unresolvedLoading" class="py-8 text-center text-sm text-gray-500">
|
||||
Nalagam …
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="!unresolvedRows.length" class="py-6 text-sm text-gray-600">
|
||||
Ni zadetkov.
|
||||
</div>
|
||||
<div v-else class="overflow-auto border border-gray-200 rounded">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-gray-50 text-gray-700">
|
||||
<tr>
|
||||
<th class="px-3 py-2 text-left w-24"># vrstica</th>
|
||||
<th
|
||||
v-for="(c, i) in unresolvedColumns"
|
||||
:key="i"
|
||||
class="px-3 py-2 text-left"
|
||||
>
|
||||
{{ c }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="r in unresolvedRows" :key="r.id" class="border-t">
|
||||
<td class="px-3 py-2 text-gray-500">{{ r.row_number }}</td>
|
||||
<td
|
||||
v-for="(c, i) in unresolvedColumns"
|
||||
:key="i"
|
||||
class="px-3 py-2 whitespace-pre-wrap break-words"
|
||||
>
|
||||
{{ r.values?.[i] ?? "" }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
<SimulationModal
|
||||
:show="showPaymentSim"
|
||||
:rows="paymentSimRows"
|
||||
|
||||
Reference in New Issue
Block a user