Changes to field job view and controller
This commit is contained in:
@@ -32,7 +32,9 @@ const filteredTemplates = computed(() => {
|
||||
if (!form.client_uuid) {
|
||||
return props.templates.filter((t) => !t.client_id);
|
||||
}
|
||||
return props.templates.filter((t) => t.client_uuid === form.client_uuid || !t.client_id);
|
||||
return props.templates.filter(
|
||||
(t) => t.client_uuid === form.client_uuid || !t.client_id
|
||||
);
|
||||
});
|
||||
|
||||
const uploading = ref(false);
|
||||
@@ -67,7 +69,7 @@ async function startImport() {
|
||||
uploadError.value = "Najprej izberite datoteko.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uploading.value = true;
|
||||
try {
|
||||
const fd = new FormData();
|
||||
@@ -79,12 +81,12 @@ async function startImport() {
|
||||
fd.append("client_uuid", form.client_uuid);
|
||||
}
|
||||
fd.append("has_header", form.has_header ? "1" : "0");
|
||||
|
||||
|
||||
const { data } = await axios.post(route("imports.store"), fd, {
|
||||
headers: { Accept: "application/json" },
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
|
||||
if (data?.uuid) {
|
||||
router.visit(route("imports.continue", { import: data.uuid }));
|
||||
} else if (data?.id) {
|
||||
@@ -153,7 +155,30 @@ async function startImport() {
|
||||
<Label>Predloga</Label>
|
||||
<Select v-model="form.import_template_id">
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Izberite predlogo..." />
|
||||
<SelectValue placeholder="Izberite predlogo...">
|
||||
<template v-if="form.import_template_id">
|
||||
<div class="flex w-full items-center justify-between">
|
||||
<span class="truncate">
|
||||
{{
|
||||
filteredTemplates.find(
|
||||
(t) => t.id === form.import_template_id
|
||||
)?.name
|
||||
}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-2 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-600 dark:bg-gray-700 dark:text-gray-300"
|
||||
>
|
||||
{{
|
||||
filteredTemplates.find(
|
||||
(t) => t.id === form.import_template_id
|
||||
)?.client_id
|
||||
? "Client"
|
||||
: "Global"
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
@@ -209,7 +234,9 @@ async function startImport() {
|
||||
<span class="text-xs text-gray-500">
|
||||
{{ (form.file.size / 1024).toFixed(1) }} kB
|
||||
</span>
|
||||
<span class="inline-block rounded bg-gray-100 px-1.5 py-0.5 text-[10px]">
|
||||
<span
|
||||
class="inline-block rounded bg-gray-100 px-1.5 py-0.5 text-[10px]"
|
||||
>
|
||||
Zamenjaj
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user