paketno sms filter zadnja obljuba
This commit is contained in:
parent
46feba2df7
commit
8125b4d321
|
|
@ -294,7 +294,7 @@ public function cancel(Package $package): RedirectResponse
|
||||||
public function contracts(Request $request, PhoneSelector $selector): \Illuminate\Http\JsonResponse
|
public function contracts(Request $request, PhoneSelector $selector): \Illuminate\Http\JsonResponse
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'segment_id' => ['required', 'integer', 'exists:segments,id'],
|
'segment_id' => ['nullable', 'integer', 'exists:segments,id'],
|
||||||
'q' => ['nullable', 'string'],
|
'q' => ['nullable', 'string'],
|
||||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||||
'client_id' => ['nullable', 'integer', 'exists:clients,id'],
|
'client_id' => ['nullable', 'integer', 'exists:clients,id'],
|
||||||
|
|
@ -302,24 +302,31 @@ public function contracts(Request $request, PhoneSelector $selector): \Illuminat
|
||||||
'only_validated' => ['nullable', 'boolean'],
|
'only_validated' => ['nullable', 'boolean'],
|
||||||
'start_date_from' => ['nullable', 'date'],
|
'start_date_from' => ['nullable', 'date'],
|
||||||
'start_date_to' => ['nullable', 'date'],
|
'start_date_to' => ['nullable', 'date'],
|
||||||
|
'promise_date_from' => ['nullable', 'date'],
|
||||||
|
'promise_date_to' => ['nullable', 'date'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$segmentId = (int) $request->input('segment_id');
|
$segmentId = $request->input('segment_id') ? (int) $request->input('segment_id') : null;
|
||||||
$perPage = (int) ($request->input('per_page') ?? 25);
|
$perPage = (int) ($request->input('per_page') ?? 25);
|
||||||
|
|
||||||
$query = Contract::query()
|
$query = Contract::query()
|
||||||
->join('contract_segment', function ($j) use ($segmentId) {
|
|
||||||
$j->on('contract_segment.contract_id', '=', 'contracts.id')
|
|
||||||
->where('contract_segment.segment_id', '=', $segmentId)
|
|
||||||
->where('contract_segment.active', true);
|
|
||||||
})
|
|
||||||
->with([
|
->with([
|
||||||
'clientCase.person.phones',
|
'clientCase.person.phones',
|
||||||
'clientCase.client.person',
|
'clientCase.client.person',
|
||||||
|
'account',
|
||||||
])
|
])
|
||||||
->select('contracts.*')
|
->select('contracts.*')
|
||||||
->latest('contracts.id');
|
->latest('contracts.id');
|
||||||
|
|
||||||
|
// Optional segment filter
|
||||||
|
if ($segmentId) {
|
||||||
|
$query->join('contract_segment', function ($j) use ($segmentId) {
|
||||||
|
$j->on('contract_segment.contract_id', '=', 'contracts.id')
|
||||||
|
->where('contract_segment.segment_id', '=', $segmentId)
|
||||||
|
->where('contract_segment.active', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ($q = trim((string) $request->input('q'))) {
|
if ($q = trim((string) $request->input('q'))) {
|
||||||
$query->where(function ($w) use ($q) {
|
$query->where(function ($w) use ($q) {
|
||||||
$w->where('contracts.reference', 'ILIKE', "%{$q}%");
|
$w->where('contracts.reference', 'ILIKE', "%{$q}%");
|
||||||
|
|
@ -340,6 +347,21 @@ public function contracts(Request $request, PhoneSelector $selector): \Illuminat
|
||||||
$query->where('contracts.start_date', '<=', $startDateTo);
|
$query->where('contracts.start_date', '<=', $startDateTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Date range filters for account.promise_date
|
||||||
|
$promiseDateFrom = $request->input('promise_date_from');
|
||||||
|
$promiseDateTo = $request->input('promise_date_to');
|
||||||
|
|
||||||
|
if ($promiseDateFrom || $promiseDateTo) {
|
||||||
|
$query->whereHas('account', function ($q) use ($promiseDateFrom, $promiseDateTo) {
|
||||||
|
if ($promiseDateFrom) {
|
||||||
|
$q->where('promise_date', '>=', $promiseDateFrom);
|
||||||
|
}
|
||||||
|
if ($promiseDateTo) {
|
||||||
|
$q->where('promise_date', '<=', $promiseDateTo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Optional phone filters
|
// Optional phone filters
|
||||||
if ($request->boolean('only_mobile') || $request->boolean('only_validated')) {
|
if ($request->boolean('only_mobile') || $request->boolean('only_validated')) {
|
||||||
$query->whereHas('clientCase.person.phones', function ($q) use ($request) {
|
$query->whereHas('clientCase.person.phones', function ($q) use ($request) {
|
||||||
|
|
@ -365,6 +387,7 @@ public function contracts(Request $request, PhoneSelector $selector): \Illuminat
|
||||||
'uuid' => $contract->uuid,
|
'uuid' => $contract->uuid,
|
||||||
'reference' => $contract->reference,
|
'reference' => $contract->reference,
|
||||||
'start_date' => $contract->start_date,
|
'start_date' => $contract->start_date,
|
||||||
|
'promise_date' => $contract->account?->promise_date,
|
||||||
'case' => [
|
'case' => [
|
||||||
'id' => $contract->clientCase?->id,
|
'id' => $contract->clientCase?->id,
|
||||||
'uuid' => $contract->clientCase?->uuid,
|
'uuid' => $contract->clientCase?->uuid,
|
||||||
|
|
|
||||||
|
|
@ -89,19 +89,30 @@ const search = ref('')
|
||||||
const clientId = ref(null)
|
const clientId = ref(null)
|
||||||
const startDateFrom = ref('')
|
const startDateFrom = ref('')
|
||||||
const startDateTo = ref('')
|
const startDateTo = ref('')
|
||||||
|
const promiseDateFrom = ref('')
|
||||||
|
const promiseDateTo = ref('')
|
||||||
const onlyMobile = ref(false)
|
const onlyMobile = ref(false)
|
||||||
const onlyValidated = ref(false)
|
const onlyValidated = ref(false)
|
||||||
const loadingContracts = ref(false)
|
const loadingContracts = ref(false)
|
||||||
const selectedContractIds = ref(new Set())
|
const selectedContractIds = ref(new Set())
|
||||||
|
const perPage = ref(25)
|
||||||
|
|
||||||
async function loadContracts(url = null) {
|
async function loadContracts(url = null) {
|
||||||
if (!segmentId.value) {
|
|
||||||
contracts.value = { data: [], meta: { current_page: 1, last_page: 1, per_page: 25, total: 0 } }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loadingContracts.value = true
|
loadingContracts.value = true
|
||||||
try {
|
try {
|
||||||
const target = url || `${route('admin.packages.contracts')}?segment_id=${encodeURIComponent(segmentId.value)}${search.value ? `&q=${encodeURIComponent(search.value)}` : ''}${clientId.value ? `&client_id=${encodeURIComponent(clientId.value)}` : ''}${startDateFrom.value ? `&start_date_from=${encodeURIComponent(startDateFrom.value)}` : ''}${startDateTo.value ? `&start_date_to=${encodeURIComponent(startDateTo.value)}` : ''}${onlyMobile.value ? `&only_mobile=1` : ''}${onlyValidated.value ? `&only_validated=1` : ''}`
|
const params = new URLSearchParams()
|
||||||
|
if (segmentId.value) params.append('segment_id', segmentId.value)
|
||||||
|
if (search.value) params.append('q', search.value)
|
||||||
|
if (clientId.value) params.append('client_id', clientId.value)
|
||||||
|
if (startDateFrom.value) params.append('start_date_from', startDateFrom.value)
|
||||||
|
if (startDateTo.value) params.append('start_date_to', startDateTo.value)
|
||||||
|
if (promiseDateFrom.value) params.append('promise_date_from', promiseDateFrom.value)
|
||||||
|
if (promiseDateTo.value) params.append('promise_date_to', promiseDateTo.value)
|
||||||
|
if (onlyMobile.value) params.append('only_mobile', '1')
|
||||||
|
if (onlyValidated.value) params.append('only_validated', '1')
|
||||||
|
params.append('per_page', perPage.value)
|
||||||
|
|
||||||
|
const target = url || `${route('admin.packages.contracts')}?${params.toString()}`
|
||||||
const res = await fetch(target, { headers: { 'X-Requested-With': 'XMLHttpRequest' } })
|
const res = await fetch(target, { headers: { 'X-Requested-With': 'XMLHttpRequest' } })
|
||||||
const json = await res.json()
|
const json = await res.json()
|
||||||
contracts.value = { data: json.data || [], meta: json.meta || { current_page: 1, last_page: 1, per_page: 25, total: 0 } }
|
contracts.value = { data: json.data || [], meta: json.meta || { current_page: 1, last_page: 1, per_page: 25, total: 0 } }
|
||||||
|
|
@ -151,7 +162,21 @@ function goContractsPage(delta) {
|
||||||
const { current_page } = contracts.value.meta
|
const { current_page } = contracts.value.meta
|
||||||
const nextPage = current_page + delta
|
const nextPage = current_page + delta
|
||||||
if (nextPage < 1 || nextPage > contracts.value.meta.last_page) return
|
if (nextPage < 1 || nextPage > contracts.value.meta.last_page) return
|
||||||
const base = `${route('admin.packages.contracts')}?segment_id=${encodeURIComponent(segmentId.value)}${search.value ? `&q=${encodeURIComponent(search.value)}` : ''}${clientId.value ? `&client_id=${encodeURIComponent(clientId.value)}` : ''}${startDateFrom.value ? `&start_date_from=${encodeURIComponent(startDateFrom.value)}` : ''}${startDateTo.value ? `&start_date_to=${encodeURIComponent(startDateTo.value)}` : ''}${onlyMobile.value ? `&only_mobile=1` : ''}${onlyValidated.value ? `&only_validated=1` : ''}&page=${nextPage}`
|
|
||||||
|
const params = new URLSearchParams()
|
||||||
|
if (segmentId.value) params.append('segment_id', segmentId.value)
|
||||||
|
if (search.value) params.append('q', search.value)
|
||||||
|
if (clientId.value) params.append('client_id', clientId.value)
|
||||||
|
if (startDateFrom.value) params.append('start_date_from', startDateFrom.value)
|
||||||
|
if (startDateTo.value) params.append('start_date_to', startDateTo.value)
|
||||||
|
if (promiseDateFrom.value) params.append('promise_date_from', promiseDateFrom.value)
|
||||||
|
if (promiseDateTo.value) params.append('promise_date_to', promiseDateTo.value)
|
||||||
|
if (onlyMobile.value) params.append('only_mobile', '1')
|
||||||
|
if (onlyValidated.value) params.append('only_validated', '1')
|
||||||
|
params.append('per_page', perPage.value)
|
||||||
|
params.append('page', nextPage)
|
||||||
|
|
||||||
|
const base = `${route('admin.packages.contracts')}?${params.toString()}`
|
||||||
loadContracts(base)
|
loadContracts(base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,43 +268,92 @@ function submitCreateFromContracts() {
|
||||||
|
|
||||||
<!-- Contracts mode -->
|
<!-- Contracts mode -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
<div class="sm:col-span-3 space-y-4">
|
||||||
|
<!-- Basic filters -->
|
||||||
|
<div class="grid sm:grid-cols-3 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs text-gray-500 mb-1">Segment</label>
|
<label class="block text-xs font-medium text-gray-700 mb-1">Segment</label>
|
||||||
<select v-model.number="segmentId" @change="loadContracts()" class="w-full rounded border-gray-300 text-sm">
|
<select v-model.number="segmentId" @change="loadContracts()" class="w-full rounded border-gray-300 text-sm">
|
||||||
<option :value="null">—</option>
|
<option :value="null">Vsi segmenti</option>
|
||||||
<option v-for="s in segments" :key="s.id" :value="s.id">{{ s.name }}</option>
|
<option v-for="s in segments" :key="s.id" :value="s.id">{{ s.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs text-gray-500 mb-1">Stranka</label>
|
<label class="block text-xs font-medium text-gray-700 mb-1">Stranka</label>
|
||||||
<select v-model.number="clientId" @change="loadContracts()" class="w-full rounded border-gray-300 text-sm">
|
<select v-model.number="clientId" @change="loadContracts()" class="w-full rounded border-gray-300 text-sm">
|
||||||
<option :value="null">—</option>
|
<option :value="null">Vse stranke</option>
|
||||||
<option v-for="c in clients" :key="c.id" :value="c.id">{{ c.name }}</option>
|
<option v-for="c in clients" :key="c.id" :value="c.id">{{ c.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs text-gray-500 mb-1">Iskanje</label>
|
<label class="block text-xs font-medium text-gray-700 mb-1">Iskanje po referenci</label>
|
||||||
<input v-model="search" @keyup.enter="loadContracts()" type="text" class="w-full rounded border-gray-300 text-sm" placeholder="referenca...">
|
<input v-model="search" @keyup.enter="loadContracts()" type="text" class="w-full rounded border-gray-300 text-sm" placeholder="Vnesi referenco...">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Date range filters -->
|
||||||
|
<div class="border-t pt-4">
|
||||||
|
<h4 class="text-xs font-semibold text-gray-700 mb-3">Datumski filtri</h4>
|
||||||
|
<div class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs text-gray-500 mb-1">Datum začetka od</label>
|
<div class="text-xs font-medium text-gray-600 mb-2">Datum začetka pogodbe</div>
|
||||||
|
<div class="grid grid-cols-2 gap-2">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs text-gray-500 mb-1">Od</label>
|
||||||
<input v-model="startDateFrom" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
<input v-model="startDateFrom" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs text-gray-500 mb-1">Datum začetka do</label>
|
<label class="block text-xs text-gray-500 mb-1">Do</label>
|
||||||
<input v-model="startDateTo" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
<input v-model="startDateTo" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-end">
|
|
||||||
<button @click="loadContracts()" class="px-3 py-1.5 rounded border text-sm h-fit">Išči</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:col-span-3 flex items-center gap-6 text-sm text-gray-700">
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-xs font-medium text-gray-600 mb-2">Datum obljube plačila</div>
|
||||||
|
<div class="grid grid-cols-2 gap-2">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs text-gray-500 mb-1">Od</label>
|
||||||
|
<input v-model="promiseDateFrom" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs text-gray-500 mb-1">Do</label>
|
||||||
|
<input v-model="promiseDateTo" @change="loadContracts()" type="date" class="w-full rounded border-gray-300 text-sm">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Phone filters -->
|
||||||
|
<div class="border-t pt-4">
|
||||||
|
<h4 class="text-xs font-semibold text-gray-700 mb-3">Telefonski filtri</h4>
|
||||||
|
<div class="flex items-center gap-6 text-sm text-gray-700">
|
||||||
<label class="inline-flex items-center gap-2">
|
<label class="inline-flex items-center gap-2">
|
||||||
<input type="checkbox" v-model="onlyMobile" @change="loadContracts()"> Samo s mobilno številko
|
<input type="checkbox" v-model="onlyMobile" @change="loadContracts()" class="rounded border-gray-300">
|
||||||
|
Samo mobilne številke
|
||||||
</label>
|
</label>
|
||||||
<label class="inline-flex items-center gap-2">
|
<label class="inline-flex items-center gap-2">
|
||||||
<input type="checkbox" v-model="onlyValidated" @change="loadContracts()"> Telefonska številka mora biti potrjena
|
<input type="checkbox" v-model="onlyValidated" @change="loadContracts()" class="rounded border-gray-300">
|
||||||
|
Samo potrjene številke
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action buttons -->
|
||||||
|
<div class="flex items-center gap-2 pt-2">
|
||||||
|
<button @click="loadContracts()" class="px-4 py-2 rounded bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700">
|
||||||
|
Išči pogodbe
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="segmentId = null; clientId = null; search = ''; startDateFrom = ''; startDateTo = ''; promiseDateFrom = ''; promiseDateTo = ''; onlyMobile = false; onlyValidated = false; contracts.value = { data: [], meta: { current_page: 1, last_page: 1, per_page: 25, total: 0 } }"
|
||||||
|
class="px-4 py-2 rounded border border-gray-300 text-gray-700 text-sm font-medium hover:bg-gray-50"
|
||||||
|
>
|
||||||
|
Počisti filtre
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Results table -->
|
||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<div class="overflow-hidden rounded border bg-white">
|
<div class="overflow-hidden rounded border bg-white">
|
||||||
<table class="min-w-full divide-y divide-gray-200">
|
<table class="min-w-full divide-y divide-gray-200">
|
||||||
|
|
@ -300,18 +374,28 @@ function submitCreateFromContracts() {
|
||||||
<th class="px-3 py-2 text-left">Primer</th>
|
<th class="px-3 py-2 text-left">Primer</th>
|
||||||
<th class="px-3 py-2 text-left">Stranka</th>
|
<th class="px-3 py-2 text-left">Stranka</th>
|
||||||
<th class="px-3 py-2 text-left">Datum začetka</th>
|
<th class="px-3 py-2 text-left">Datum začetka</th>
|
||||||
|
<th class="px-3 py-2 text-left">Zadnja obljuba</th>
|
||||||
<th class="px-3 py-2 text-left">Izbrana številka</th>
|
<th class="px-3 py-2 text-left">Izbrana številka</th>
|
||||||
<th class="px-3 py-2 text-left">Opomba</th>
|
<th class="px-3 py-2 text-left">Opomba</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="divide-y divide-gray-200" v-if="!loadingContracts">
|
<tbody class="divide-y divide-gray-200" v-if="!loadingContracts">
|
||||||
<tr v-for="c in contracts.data" :key="c.id" class="text-sm">
|
<tr v-for="c in contracts.data" :key="c.id" class="text-sm hover:bg-gray-50">
|
||||||
<td class="px-3 py-2">
|
<td class="px-3 py-2">
|
||||||
<input type="checkbox" :checked="selectedContractIds.has(c.id)" @change="toggleSelectContract(c.id)">
|
<input type="checkbox" :checked="selectedContractIds.has(c.id)" @change="toggleSelectContract(c.id)" class="rounded">
|
||||||
</td>
|
</td>
|
||||||
<td class="px-3 py-2">
|
<td class="px-3 py-2">
|
||||||
<div class="font-mono text-xs text-gray-600">{{ c.uuid }}</div>
|
<div class="font-mono text-xs text-gray-600">{{ c.uuid }}</div>
|
||||||
<div class="text-xs text-gray-800">{{ c.reference }}</div>
|
<a
|
||||||
|
v-if="c.case?.uuid"
|
||||||
|
:href="route('clientCase.show', c.case.uuid)"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="text-xs font-medium text-indigo-600 hover:text-indigo-800 hover:underline"
|
||||||
|
>
|
||||||
|
{{ c.reference }}
|
||||||
|
</a>
|
||||||
|
<div v-else class="text-xs font-medium text-gray-800">{{ c.reference }}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-3 py-2">
|
<td class="px-3 py-2">
|
||||||
<div class="text-xs text-gray-800">{{ c.person?.full_name || '—' }}</div>
|
<div class="text-xs text-gray-800">{{ c.person?.full_name || '—' }}</div>
|
||||||
|
|
@ -322,6 +406,9 @@ function submitCreateFromContracts() {
|
||||||
<td class="px-3 py-2">
|
<td class="px-3 py-2">
|
||||||
<div class="text-xs text-gray-700">{{ c.start_date ? new Date(c.start_date).toLocaleDateString('sl-SI') : '—' }}</div>
|
<div class="text-xs text-gray-700">{{ c.start_date ? new Date(c.start_date).toLocaleDateString('sl-SI') : '—' }}</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-3 py-2">
|
||||||
|
<div class="text-xs text-gray-700">{{ c.promise_date ? new Date(c.promise_date).toLocaleDateString('sl-SI') : '—' }}</div>
|
||||||
|
</td>
|
||||||
<td class="px-3 py-2">
|
<td class="px-3 py-2">
|
||||||
<div v-if="c.selected_phone" class="text-xs">
|
<div v-if="c.selected_phone" class="text-xs">
|
||||||
{{ c.selected_phone.number }}
|
{{ c.selected_phone.number }}
|
||||||
|
|
@ -332,27 +419,44 @@ function submitCreateFromContracts() {
|
||||||
<td class="px-3 py-2 text-xs text-gray-500">{{ c.no_phone_reason || '—' }}</td>
|
<td class="px-3 py-2 text-xs text-gray-500">{{ c.no_phone_reason || '—' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="!contracts.data?.length">
|
<tr v-if="!contracts.data?.length">
|
||||||
<td colspan="7" class="px-3 py-8 text-center text-sm text-gray-500">Ni rezultatov.</td>
|
<td colspan="8" class="px-3 py-8 text-center text-sm text-gray-500">
|
||||||
|
Ni rezultatov. Poskusite z drugimi filtri.
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody v-else>
|
<tbody v-else>
|
||||||
<tr><td colspan="7" class="px-3 py-6 text-center text-sm text-gray-500">Nalaganje...</td></tr>
|
<tr><td colspan="8" class="px-3 py-6 text-center text-sm text-gray-500">Nalaganje...</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 flex items-center justify-between text-sm">
|
<div class="mt-3 flex items-center justify-between text-sm">
|
||||||
<div class="text-gray-600">
|
<div class="text-gray-600 flex items-center gap-4">
|
||||||
|
<span v-if="contracts.data.length">
|
||||||
Prikazano stran {{ contracts.meta.current_page }} od {{ contracts.meta.last_page }} (skupaj {{ contracts.meta.total }})
|
Prikazano stran {{ contracts.meta.current_page }} od {{ contracts.meta.last_page }} (skupaj {{ contracts.meta.total }})
|
||||||
|
</span>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<label class="text-xs text-gray-500">Na stran:</label>
|
||||||
|
<select v-model.number="perPage" @change="loadContracts()" class="rounded border-gray-300 text-xs py-1">
|
||||||
|
<option :value="10">10</option>
|
||||||
|
<option :value="25">25</option>
|
||||||
|
<option :value="50">50</option>
|
||||||
|
<option :value="100">100</option>
|
||||||
|
<option :value="200">200</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-x-2">
|
<div class="space-x-2">
|
||||||
<button @click="goContractsPage(-1)" :disabled="contracts.meta.current_page <= 1" class="px-3 py-1.5 rounded border text-sm disabled:opacity-50">Nazaj</button>
|
<button @click="goContractsPage(-1)" :disabled="contracts.meta.current_page <= 1" class="px-3 py-1.5 rounded border text-sm disabled:opacity-50 disabled:cursor-not-allowed">Nazaj</button>
|
||||||
<button @click="goContractsPage(1)" :disabled="contracts.meta.current_page >= contracts.meta.last_page" class="px-3 py-1.5 rounded border text-sm disabled:opacity-50">Naprej</button>
|
<button @click="goContractsPage(1)" :disabled="contracts.meta.current_page >= contracts.meta.last_page" class="px-3 py-1.5 rounded border text-sm disabled:opacity-50 disabled:cursor-not-allowed">Naprej</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:col-span-3 flex items-center justify-end gap-2">
|
<div class="sm:col-span-3 flex items-center justify-between gap-2 pt-4 border-t">
|
||||||
<div class="text-sm text-gray-600 mr-auto">Izbrano: {{ selectedContractIds.size }}</div>
|
<div class="text-sm text-gray-600">
|
||||||
<button @click="submitCreateFromContracts" :disabled="selectedContractIds.size === 0" class="px-3 py-1.5 rounded bg-emerald-600 text-white text-sm disabled:opacity-50">Ustvari paket</button>
|
<span class="font-medium">Izbrano: {{ selectedContractIds.size }}</span>
|
||||||
|
<span v-if="selectedContractIds.size > 0" class="ml-2 text-gray-500">({{ selectedContractIds.size === 1 ? '1 pogodba' : `${selectedContractIds.size} pogodb` }})</span>
|
||||||
|
</div>
|
||||||
|
<button @click="submitCreateFromContracts" :disabled="selectedContractIds.size === 0" class="px-4 py-2 rounded bg-emerald-600 text-white text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed hover:bg-emerald-700">Ustvari paket</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user