changes
This commit is contained in:
parent
90bbf1942c
commit
872b76b012
|
|
@ -118,6 +118,7 @@ public function contracts(Client $client, Request $request)
|
||||||
$from = $request->input('from');
|
$from = $request->input('from');
|
||||||
$to = $request->input('to');
|
$to = $request->input('to');
|
||||||
$search = $request->input('search');
|
$search = $request->input('search');
|
||||||
|
$segmentId = $request->input('segment');
|
||||||
|
|
||||||
$contractsQuery = \App\Models\Contract::query()
|
$contractsQuery = \App\Models\Contract::query()
|
||||||
->whereHas('clientCase', function ($q) use ($client) {
|
->whereHas('clientCase', function ($q) use ($client) {
|
||||||
|
|
@ -149,8 +150,16 @@ public function contracts(Client $client, Request $request)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
->when($segmentId, function ($q) use ($segmentId) {
|
||||||
|
$q->whereHas('segments', function ($s) use ($segmentId) {
|
||||||
|
$s->where('segments.id', $segmentId)
|
||||||
|
->where('contract_segment.active', true);
|
||||||
|
});
|
||||||
|
})
|
||||||
->orderByDesc('start_date');
|
->orderByDesc('start_date');
|
||||||
|
|
||||||
|
$segments = \App\Models\Segment::orderBy('name')->get(['id', 'name']);
|
||||||
|
|
||||||
$types = [
|
$types = [
|
||||||
'address_types' => \App\Models\Person\AddressType::all(),
|
'address_types' => \App\Models\Person\AddressType::all(),
|
||||||
'phone_types' => \App\Models\Person\PhoneType::all(),
|
'phone_types' => \App\Models\Person\PhoneType::all(),
|
||||||
|
|
@ -159,7 +168,8 @@ public function contracts(Client $client, Request $request)
|
||||||
return Inertia::render('Client/Contracts', [
|
return Inertia::render('Client/Contracts', [
|
||||||
'client' => $data,
|
'client' => $data,
|
||||||
'contracts' => $contractsQuery->paginate($request->integer('perPage', 20))->withQueryString(),
|
'contracts' => $contractsQuery->paginate($request->integer('perPage', 20))->withQueryString(),
|
||||||
'filters' => $request->only(['from', 'to', 'search']),
|
'filters' => $request->only(['from', 'to', 'search', 'segment']),
|
||||||
|
'segments' => $segments,
|
||||||
'types' => $types,
|
'types' => $types,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -415,6 +415,15 @@ public function missingContracts(Import $import)
|
||||||
->where('client_cases.client_id', $import->client_id)
|
->where('client_cases.client_id', $import->client_id)
|
||||||
->where('contracts.active', 1)
|
->where('contracts.active', 1)
|
||||||
->whereNull('contracts.deleted_at')
|
->whereNull('contracts.deleted_at')
|
||||||
|
// Exclude contracts that have any ACTIVE segment marked as excluded
|
||||||
|
->whereNotExists(function ($sq) {
|
||||||
|
$sq->select(\DB::raw(1))
|
||||||
|
->from('contract_segment')
|
||||||
|
->join('segments', 'segments.id', '=', 'contract_segment.segment_id')
|
||||||
|
->whereColumn('contract_segment.contract_id', 'contracts.id')
|
||||||
|
->where('contract_segment.active', true)
|
||||||
|
->where('segments.exclude', true);
|
||||||
|
})
|
||||||
->when(count($present) > 0, function ($q) use ($present) {
|
->when(count($present) > 0, function ($q) use ($present) {
|
||||||
$q->whereNotIn('contracts.reference', $present);
|
$q->whereNotIn('contracts.reference', $present);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ public function update(UpdateSegmentRequest $request, Segment $segment)
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'description' => $data['description'] ?? null,
|
'description' => $data['description'] ?? null,
|
||||||
'active' => $data['active'] ?? $segment->active,
|
'active' => $data['active'] ?? $segment->active,
|
||||||
|
'exclude' => $data['exclude'] ?? $segment->exclude
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return to_route('settings.segments')->with('success', 'Segment updated');
|
return to_route('settings.segments')->with('success', 'Segment updated');
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public function rules(): array
|
||||||
'name' => ['required', 'string', 'max:50'],
|
'name' => ['required', 'string', 'max:50'],
|
||||||
'description' => ['nullable', 'string', 'max:255'],
|
'description' => ['nullable', 'string', 'max:255'],
|
||||||
'active' => ['boolean'],
|
'active' => ['boolean'],
|
||||||
|
'exclude' => ['boolean']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,14 @@ class Segment extends Model
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
'active',
|
'active',
|
||||||
|
'exclude'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'active' => 'boolean',
|
'active' => 'boolean',
|
||||||
|
'exclude' => 'boolean'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('segments', function (Blueprint $table) {
|
||||||
|
if (! Schema::hasColumn('segments', 'exclude')) {
|
||||||
|
$table->boolean('exclude')->default(false)->after('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('segments', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('segments', 'exclude')) {
|
||||||
|
$table->dropColumn('exclude');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,43 +1,128 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import DialogModal from '@/Components/DialogModal.vue'
|
import DialogModal from "@/Components/DialogModal.vue";
|
||||||
|
import { router } from "@inertiajs/vue3";
|
||||||
|
import { ref, computed } from "vue";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
|
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||||
|
import { faTrash, faXmark, faCheck } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
library.add(faTrash, faXmark, faCheck);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: { type: Boolean, default: false },
|
show: { type: Boolean, default: false },
|
||||||
client_case: { type: Object, required: true },
|
client_case: { type: Object, required: true },
|
||||||
contract: { type: Object, default: null },
|
contract: { type: Object, default: null },
|
||||||
})
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(["close"]);
|
||||||
const close = () => emit('close')
|
const close = () => emit("close");
|
||||||
|
|
||||||
const items = () => Array.isArray(props.contract?.objects) ? props.contract.objects : []
|
// Local optimistic filtering of removed items so the list updates immediately
|
||||||
|
const removedIds = ref([]);
|
||||||
|
const confirmingId = ref(null);
|
||||||
|
const items = computed(() => {
|
||||||
|
const arr = Array.isArray(props.contract?.objects) ? props.contract.objects : [];
|
||||||
|
if (!removedIds.value.length) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
return arr.filter((o) => !removedIds.value.includes(o.id));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete handling (no confirmation)
|
||||||
|
const deleteObject = (o) => {
|
||||||
|
if (!o?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const id = o.id;
|
||||||
|
router.delete(
|
||||||
|
route("clientCase.object.delete", {
|
||||||
|
client_case: props.client_case.uuid,
|
||||||
|
id,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
preserveScroll: true,
|
||||||
|
onSuccess: () => {
|
||||||
|
if (!removedIds.value.includes(id)) {
|
||||||
|
removedIds.value.push(id);
|
||||||
|
}
|
||||||
|
if (confirmingId.value === id) {
|
||||||
|
confirmingId.value = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal :show="show" @close="close">
|
<DialogModal :show="show" @close="close">
|
||||||
<template #title>
|
<template #title>
|
||||||
Predmeti
|
Predmeti
|
||||||
<span v-if="contract" class="ml-2 text-sm text-gray-500">(Pogodba: {{ contract.reference }})</span>
|
<span v-if="contract" class="ml-2 text-sm text-gray-500"
|
||||||
|
>(Pogodba: {{ contract.reference }})</span
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="mt-1 max-h-[60vh] overflow-y-auto">
|
<div class="mt-1 max-h-[60vh] overflow-y-auto">
|
||||||
<div v-if="items().length > 0" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
<div
|
||||||
<div v-for="o in items()" :key="o.id" class="rounded-lg border border-gray-200 bg-white shadow-sm">
|
v-if="items.length > 0"
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="o in items"
|
||||||
|
:key="o.id"
|
||||||
|
class="rounded-lg border border-gray-200 bg-white shadow-sm"
|
||||||
|
>
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<div class="flex items-start justify-between">
|
<div class="flex items-start justify-between">
|
||||||
<div>
|
<div>
|
||||||
<div class="text-xs uppercase text-gray-500">Ref.</div>
|
<div class="text-xs uppercase text-gray-500">Ref.</div>
|
||||||
<div class="font-semibold text-gray-900">{{ o.reference || '-' }}</div>
|
<div class="font-semibold text-gray-900">{{ o.reference || "-" }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="ml-3 flex items-center gap-2">
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs text-gray-700"
|
||||||
|
>{{ o.type || "—" }}</span
|
||||||
|
>
|
||||||
|
<template v-if="confirmingId === o.id">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex h-8 w-8 items-center justify-center rounded-full hover:bg-gray-100 text-gray-700"
|
||||||
|
:title="'Prekliči'"
|
||||||
|
@click.stop="confirmingId = null"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon :icon="['fas', 'xmark']" class="text-[16px]" />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex h-8 w-8 items-center justify-center rounded-full hover:bg-green-50 text-green-700"
|
||||||
|
:title="'Potrdi brisanje'"
|
||||||
|
@click.stop="deleteObject(o)"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon :icon="['fas', 'check']" class="text-[16px]" />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex h-8 w-8 items-center justify-center rounded-full hover:bg-red-50"
|
||||||
|
:title="'Izbriši'"
|
||||||
|
@click.stop="confirmingId = o.id"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon :icon="['fas', 'trash']" class="text-red-600" />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<span class="ml-3 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs text-gray-700">{{ o.type || '—' }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<div class="text-xs uppercase text-gray-500">Naziv</div>
|
<div class="text-xs uppercase text-gray-500">Naziv</div>
|
||||||
<div class="text-gray-900">{{ o.name || '-' }}</div>
|
<div class="text-gray-900">{{ o.name || "-" }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<div class="text-xs uppercase text-gray-500">Opis</div>
|
<div class="text-xs uppercase text-gray-500">Opis</div>
|
||||||
<div class="text-gray-700 whitespace-pre-wrap">{{ o.description || '' }}</div>
|
<div class="text-gray-700 whitespace-pre-wrap">
|
||||||
|
{{ o.description || "" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -45,7 +130,13 @@ const items = () => Array.isArray(props.contract?.objects) ? props.contract.obje
|
||||||
<div v-else class="text-center text-gray-500 py-3">Ni predmetov.</div>
|
<div v-else class="text-center text-gray-500 py-3">Ni predmetov.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4 flex justify-end">
|
<div class="mt-4 flex justify-end">
|
||||||
<button type="button" class="px-4 py-2 rounded-md border border-gray-300 text-gray-700 hover:bg-gray-50" @click="close">Zapri</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
class="px-4 py-2 rounded-md border border-gray-300 text-gray-700 hover:bg-gray-50"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
Zapri
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</DialogModal>
|
</DialogModal>
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@ const props = defineProps({
|
||||||
client: Object,
|
client: Object,
|
||||||
contracts: Object,
|
contracts: Object,
|
||||||
filters: Object,
|
filters: Object,
|
||||||
|
segments: Object,
|
||||||
types: Object,
|
types: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fromDate = ref(props.filters?.from || "");
|
const fromDate = ref(props.filters?.from || "");
|
||||||
const toDate = ref(props.filters?.to || "");
|
const toDate = ref(props.filters?.to || "");
|
||||||
const search = ref(props.filters?.search || "");
|
const search = ref(props.filters?.search || "");
|
||||||
|
const selectedSegment = ref(props.filters?.segment || "");
|
||||||
function applyDateFilter() {
|
function applyDateFilter() {
|
||||||
const params = Object.fromEntries(
|
const params = Object.fromEntries(
|
||||||
new URLSearchParams(window.location.search).entries()
|
new URLSearchParams(window.location.search).entries()
|
||||||
|
|
@ -35,6 +37,11 @@ function applyDateFilter() {
|
||||||
} else {
|
} else {
|
||||||
delete params.search;
|
delete params.search;
|
||||||
}
|
}
|
||||||
|
if (selectedSegment.value) {
|
||||||
|
params.segment = selectedSegment.value;
|
||||||
|
} else {
|
||||||
|
delete params.segment;
|
||||||
|
}
|
||||||
delete params.page;
|
delete params.page;
|
||||||
router.get(route("client.contracts", { uuid: props.client.uuid }), params, {
|
router.get(route("client.contracts", { uuid: props.client.uuid }), params, {
|
||||||
preserveState: true,
|
preserveState: true,
|
||||||
|
|
@ -46,6 +53,7 @@ function applyDateFilter() {
|
||||||
function clearDateFilter() {
|
function clearDateFilter() {
|
||||||
fromDate.value = "";
|
fromDate.value = "";
|
||||||
toDate.value = "";
|
toDate.value = "";
|
||||||
|
selectedSegment.value = "";
|
||||||
applyDateFilter();
|
applyDateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,7 +158,7 @@ function formatDate(value) {
|
||||||
class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between"
|
class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-3 flex-wrap">
|
<div class="flex items-center gap-3 flex-wrap">
|
||||||
<label class="font-medium mr-2">Filter po datumu:</label>
|
<label class="font-medium mr-2">Filtri:</label>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<span class="text-sm text-gray-600">Od</span>
|
<span class="text-sm text-gray-600">Od</span>
|
||||||
<input
|
<input
|
||||||
|
|
@ -169,12 +177,25 @@ function formatDate(value) {
|
||||||
class="rounded border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 px-3 py-2 text-sm"
|
class="rounded border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 px-3 py-2 text-sm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-sm text-gray-600">Segment</span>
|
||||||
|
<select
|
||||||
|
v-model="selectedSegment"
|
||||||
|
@change="applyDateFilter"
|
||||||
|
class="rounded border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 px-3 py-2 text-sm"
|
||||||
|
>
|
||||||
|
<option value="">Vsi segmenti</option>
|
||||||
|
<option v-for="segment in segments" :key="segment.id" :value="segment.id">
|
||||||
|
{{ segment.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-flex items-center px-3 py-2 text-sm font-medium rounded border border-gray-300 text-gray-700 hover:bg-gray-50 disabled:opacity-50"
|
class="inline-flex items-center px-3 py-2 text-sm font-medium rounded border border-gray-300 text-gray-700 hover:bg-gray-50 disabled:opacity-50"
|
||||||
:disabled="!fromDate && !toDate"
|
:disabled="!fromDate && !toDate && !selectedSegment"
|
||||||
@click="clearDateFilter"
|
@click="clearDateFilter"
|
||||||
title="Počisti datum"
|
title="Počisti filtre"
|
||||||
>
|
>
|
||||||
Počisti
|
Počisti
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -194,7 +215,7 @@ function formatDate(value) {
|
||||||
:meta="{ current_page: contracts.current_page, per_page: contracts.per_page, total: contracts.total, last_page: contracts.last_page }"
|
:meta="{ current_page: contracts.current_page, per_page: contracts.per_page, total: contracts.total, last_page: contracts.last_page }"
|
||||||
route-name="client.contracts"
|
route-name="client.contracts"
|
||||||
:route-params="{ uuid: client.uuid }"
|
:route-params="{ uuid: client.uuid }"
|
||||||
:query="{ from: fromDate || undefined, to: toDate || undefined }"
|
:query="{ from: fromDate || undefined, to: toDate || undefined, segment: selectedSegment || undefined }"
|
||||||
:search="search"
|
:search="search"
|
||||||
row-key="uuid"
|
row-key="uuid"
|
||||||
:only-props="['contracts']"
|
:only-props="['contracts']"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
import AppLayout from "@/Layouts/AppLayout.vue";
|
||||||
import { useForm, router } from '@inertiajs/vue3';
|
import { useForm, router } from "@inertiajs/vue3";
|
||||||
import { ref } from 'vue';
|
import { ref } from "vue";
|
||||||
import DialogModal from '@/Components/DialogModal.vue';
|
import DialogModal from "@/Components/DialogModal.vue";
|
||||||
import PrimaryButton from '@/Components/PrimaryButton.vue';
|
import PrimaryButton from "@/Components/PrimaryButton.vue";
|
||||||
import InputLabel from '@/Components/InputLabel.vue';
|
import InputLabel from "@/Components/InputLabel.vue";
|
||||||
import InputError from '@/Components/InputError.vue';
|
import InputError from "@/Components/InputError.vue";
|
||||||
import TextInput from '@/Components/TextInput.vue';
|
import TextInput from "@/Components/TextInput.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
segments: Array,
|
segments: Array,
|
||||||
|
|
@ -17,16 +17,18 @@ const showEdit = ref(false);
|
||||||
const editing = ref(null);
|
const editing = ref(null);
|
||||||
|
|
||||||
const createForm = useForm({
|
const createForm = useForm({
|
||||||
name: '',
|
name: "",
|
||||||
description: '',
|
description: "",
|
||||||
active: true,
|
active: true,
|
||||||
|
exclude: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const editForm = useForm({
|
const editForm = useForm({
|
||||||
id: null,
|
id: null,
|
||||||
name: '',
|
name: "",
|
||||||
description: '',
|
description: "",
|
||||||
active: true,
|
active: true,
|
||||||
|
exclude: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const openCreate = () => {
|
const openCreate = () => {
|
||||||
|
|
@ -41,7 +43,7 @@ const closeCreate = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const store = () => {
|
const store = () => {
|
||||||
createForm.post(route('settings.segments.store'), {
|
createForm.post(route("settings.segments.store"), {
|
||||||
preserveScroll: true,
|
preserveScroll: true,
|
||||||
onSuccess: () => closeCreate(),
|
onSuccess: () => closeCreate(),
|
||||||
});
|
});
|
||||||
|
|
@ -51,8 +53,9 @@ const openEdit = (segment) => {
|
||||||
editing.value = segment;
|
editing.value = segment;
|
||||||
editForm.id = segment.id;
|
editForm.id = segment.id;
|
||||||
editForm.name = segment.name;
|
editForm.name = segment.name;
|
||||||
editForm.description = segment.description ?? '';
|
editForm.description = segment.description ?? "";
|
||||||
editForm.active = !!segment.active;
|
editForm.active = !!segment.active;
|
||||||
|
editForm.exclude = !!segment.exclude;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -63,7 +66,7 @@ const closeEdit = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const update = () => {
|
const update = () => {
|
||||||
editForm.put(route('settings.segments.update', { segment: editForm.id }), {
|
editForm.put(route("settings.segments.update", { segment: editForm.id }), {
|
||||||
preserveScroll: true,
|
preserveScroll: true,
|
||||||
onSuccess: () => closeEdit(),
|
onSuccess: () => closeEdit(),
|
||||||
});
|
});
|
||||||
|
|
@ -87,21 +90,44 @@ const update = () => {
|
||||||
<form @submit.prevent="store" class="space-y-4">
|
<form @submit.prevent="store" class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<InputLabel for="nameCreate" value="Name" />
|
<InputLabel for="nameCreate" value="Name" />
|
||||||
<TextInput id="nameCreate" v-model="createForm.name" type="text" class="mt-1 block w-full" />
|
<TextInput
|
||||||
|
id="nameCreate"
|
||||||
|
v-model="createForm.name"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
/>
|
||||||
<InputError :message="createForm.errors.name" class="mt-1" />
|
<InputError :message="createForm.errors.name" class="mt-1" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<InputLabel for="descCreate" value="Description" />
|
<InputLabel for="descCreate" value="Description" />
|
||||||
<TextInput id="descCreate" v-model="createForm.description" type="text" class="mt-1 block w-full" />
|
<TextInput
|
||||||
|
id="descCreate"
|
||||||
|
v-model="createForm.description"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
/>
|
||||||
<InputError :message="createForm.errors.description" class="mt-1" />
|
<InputError :message="createForm.errors.description" class="mt-1" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<input id="activeCreate" type="checkbox" v-model="createForm.active" />
|
<input id="activeCreate" type="checkbox" v-model="createForm.active" />
|
||||||
<label for="activeCreate">Active</label>
|
<label for="activeCreate">Active</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
id="excludeCreate"
|
||||||
|
type="checkbox"
|
||||||
|
v-model="createForm.exclude"
|
||||||
|
/>
|
||||||
|
<label for="excludeCreate">Exclude</label>
|
||||||
|
</div>
|
||||||
<div class="flex justify-end gap-2 mt-4">
|
<div class="flex justify-end gap-2 mt-4">
|
||||||
<button type="button" @click="closeCreate" class="px-4 py-2 rounded bg-gray-200 hover:bg-gray-300">Cancel</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
@click="closeCreate"
|
||||||
|
class="px-4 py-2 rounded bg-gray-200 hover:bg-gray-300"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
<PrimaryButton :disabled="createForm.processing">Create</PrimaryButton>
|
<PrimaryButton :disabled="createForm.processing">Create</PrimaryButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -114,21 +140,41 @@ const update = () => {
|
||||||
<form @submit.prevent="update" class="space-y-4">
|
<form @submit.prevent="update" class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<InputLabel for="nameEdit" value="Name" />
|
<InputLabel for="nameEdit" value="Name" />
|
||||||
<TextInput id="nameEdit" v-model="editForm.name" type="text" class="mt-1 block w-full" />
|
<TextInput
|
||||||
|
id="nameEdit"
|
||||||
|
v-model="editForm.name"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
/>
|
||||||
<InputError :message="editForm.errors.name" class="mt-1" />
|
<InputError :message="editForm.errors.name" class="mt-1" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<InputLabel for="descEdit" value="Description" />
|
<InputLabel for="descEdit" value="Description" />
|
||||||
<TextInput id="descEdit" v-model="editForm.description" type="text" class="mt-1 block w-full" />
|
<TextInput
|
||||||
|
id="descEdit"
|
||||||
|
v-model="editForm.description"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
/>
|
||||||
<InputError :message="editForm.errors.description" class="mt-1" />
|
<InputError :message="editForm.errors.description" class="mt-1" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<input id="activeEdit" type="checkbox" v-model="editForm.active" />
|
<input id="activeEdit" type="checkbox" v-model="editForm.active" />
|
||||||
<label for="activeEdit">Active</label>
|
<label for="activeEdit">Active</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input id="excludeEdit" type="checkbox" v-model="editForm.exclude" />
|
||||||
|
<label for="excludeEdit">Exclude</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end gap-2 mt-4">
|
<div class="flex justify-end gap-2 mt-4">
|
||||||
<button type="button" @click="closeEdit" class="px-4 py-2 rounded bg-gray-200 hover:bg-gray-300">Cancel</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
@click="closeEdit"
|
||||||
|
class="px-4 py-2 rounded bg-gray-200 hover:bg-gray-300"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
<PrimaryButton :disabled="editForm.processing">Save</PrimaryButton>
|
<PrimaryButton :disabled="editForm.processing">Save</PrimaryButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -142,6 +188,7 @@ const update = () => {
|
||||||
<th class="py-2 pr-4">Name</th>
|
<th class="py-2 pr-4">Name</th>
|
||||||
<th class="py-2 pr-4">Description</th>
|
<th class="py-2 pr-4">Description</th>
|
||||||
<th class="py-2 pr-4">Active</th>
|
<th class="py-2 pr-4">Active</th>
|
||||||
|
<th class="py-2 pr-4">Exclude</th>
|
||||||
<th class="py-2 pr-4">Actions</th>
|
<th class="py-2 pr-4">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -152,12 +199,29 @@ const update = () => {
|
||||||
<td class="py-2 pr-4">{{ s.description }}</td>
|
<td class="py-2 pr-4">{{ s.description }}</td>
|
||||||
<td class="py-2 pr-4">
|
<td class="py-2 pr-4">
|
||||||
<span class="inline-flex items-center gap-1">
|
<span class="inline-flex items-center gap-1">
|
||||||
<span :class="s.active ? 'bg-green-500' : 'bg-gray-400'" class="inline-block w-2 h-2 rounded-full"></span>
|
<span
|
||||||
{{ s.active ? 'Yes' : 'No' }}
|
:class="s.active ? 'bg-green-500' : 'bg-gray-400'"
|
||||||
|
class="inline-block w-2 h-2 rounded-full"
|
||||||
|
></span>
|
||||||
|
{{ s.active ? "Yes" : "No" }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="py-2 pr-4">
|
<td class="py-2 pr-4">
|
||||||
<button class="text-indigo-600 hover:text-indigo-800" @click="openEdit(s)">Edit</button>
|
<span class="inline-flex items-center gap-1">
|
||||||
|
<span
|
||||||
|
:class="s.exclude ? 'bg-green-500' : 'bg-gray-400'"
|
||||||
|
class="inline-block w-2 h-2 rounded-full"
|
||||||
|
></span>
|
||||||
|
{{ s.exclude ? "Yes" : "No" }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="py-2 pr-4">
|
||||||
|
<button
|
||||||
|
class="text-indigo-600 hover:text-indigo-800"
|
||||||
|
@click="openEdit(s)"
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
<!-- Delete intentionally skipped as requested -->
|
<!-- Delete intentionally skipped as requested -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user