Pagination
This commit is contained in:
@@ -75,13 +75,14 @@ class PersonController extends Controller
|
||||
|
||||
$qr = $this->process_rule(null,$currentQuery["rules"],$condition);
|
||||
|
||||
if ($qr) $result = $qr->first();
|
||||
if ($qr) $result = $qr->take(5)->paginate(2);
|
||||
else $result = [];
|
||||
|
||||
return Inertia::render(
|
||||
'Rpo/Results',
|
||||
[
|
||||
'result' => $result
|
||||
'result' => $result,
|
||||
'query' => $query,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
28
resources/js/Components/Pagination.vue
Normal file
28
resources/js/Components/Pagination.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<script setup>
|
||||
import { Link } from '@inertiajs/inertia-vue3';
|
||||
|
||||
defineProps({
|
||||
links: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="links.length > 3">
|
||||
<div class="flex flex-wrap -mb-1">
|
||||
<template v-for="(link, p) in links" :key="p">
|
||||
<div v-if="link.url === null" class="mr-1 mb-1 px-4 py-3 text-sm leading-4 text-gray-400 border rounded"
|
||||
v-html="link.label" />
|
||||
<Link v-else
|
||||
class="mr-1 mb-1 px-4 py-3 text-sm leading-4 border rounded hover:bg-white focus:border-indigo-500 focus:text-indigo-500"
|
||||
:class="{ 'bg-blue-700 text-white': link.active }" method="post" :data="data" :href="link.url" v-html="link.label" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
console.log('JSON=',this.rpo);
|
||||
|
||||
}
|
||||
|
||||
122
resources/js/Components/RpoRecord2.vue
Normal file
122
resources/js/Components/RpoRecord2.vue
Normal file
@@ -0,0 +1,122 @@
|
||||
<script setup>
|
||||
import rpoJsonData from '../Data/RpoTree.json';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
rpo: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: rpoJsonData
|
||||
}
|
||||
});
|
||||
|
||||
const arrData = computed(() => Object.keys(props.data));
|
||||
|
||||
function keyTitle(key) {
|
||||
return key.split("_").join(" ");
|
||||
}
|
||||
|
||||
function checkValueType(val) {
|
||||
if (typeof val !== "object") {
|
||||
return typeof val;
|
||||
}
|
||||
return Array.isArray(val) ? "array" : "object";
|
||||
}
|
||||
|
||||
function printRpoName(rpoKey) {
|
||||
|
||||
console.log('data',typeof props.rpo[rpoKey]);
|
||||
console.log('rpoKey',rpoKey);
|
||||
if (typeof props.rpo[rpoKey] !== 'undefined'){
|
||||
if (typeof props.rpo[rpoKey]["desc"] !== 'undefined') {
|
||||
console.log(props.rpo[rpoKey]);
|
||||
return props.rpo[rpoKey].desc;
|
||||
}
|
||||
if (typeof props.rpo[rpoKey]["value"] !== 'undefined') {
|
||||
console.log(props.rpo[rpoKey]);
|
||||
return props.rpo[rpoKey].value.desc;
|
||||
}
|
||||
|
||||
console.log(props.rpo[rpoKey]);
|
||||
return props.rpo[rpoKey]["desc"];
|
||||
}
|
||||
|
||||
return rpoKey;
|
||||
}
|
||||
|
||||
function subRpo(val,kz,i) {
|
||||
console.log('val=',val,'k=',kz,'i=',i);
|
||||
console.log(props.rpo);
|
||||
return props.rpo[kz];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="table-main">
|
||||
<div
|
||||
v-for="(row, index) in arrData"
|
||||
:key="index"
|
||||
class="row-data m-2 d-flex"
|
||||
>
|
||||
<div class="key p-2 d-inline-block">
|
||||
<div class="text-capitalize ">
|
||||
{{ printRpoName(row) }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="['string', 'number'].includes(checkValueType(data[row]))">
|
||||
<div class="value p-2 d-inline-block">{{ data[row] }}</div>
|
||||
</div>
|
||||
<div v-else-if="checkValueType(data[row]) === 'array'">
|
||||
<div v-for="(arrRow, index2) in data[row]" :key="index2" class="d-flex">
|
||||
<div v-if="['string', 'number'].includes(checkValueType(arrRow))">
|
||||
{{ arrRow }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<RpoRecord2 :data="arrRow" :rpo="subRpo(arrRow, row,index2)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<RpoRecord2 :data="data[row]" :rpo="subRpo(data[row],row,index)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.table-main {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
.m-2 {
|
||||
margin: .5rem!important;
|
||||
}
|
||||
.mx-2 {
|
||||
margin-right: .5rem!important;
|
||||
}
|
||||
.p-2 {
|
||||
padding: .5rem!important;
|
||||
}
|
||||
.d-flex {
|
||||
display: flex!important;
|
||||
}
|
||||
.d-inline-block {
|
||||
display: inline-block!important;
|
||||
}
|
||||
.text-capitalize {
|
||||
text-transform: capitalize!important;
|
||||
}
|
||||
.key {
|
||||
background: lightgray;
|
||||
}
|
||||
.table-main .row-data {
|
||||
border: 2px solid grey;
|
||||
border-radius: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
{
|
||||
"identifiers": {
|
||||
"name": "identifiers",
|
||||
"desc": "Identifikátor",
|
||||
"type": "Object",
|
||||
|
||||
"value": {
|
||||
"name": "identifiers.value",
|
||||
"desc": "Identifikátor",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -12,18 +16,31 @@
|
||||
}
|
||||
},
|
||||
"fullNames": {
|
||||
"name": "fullNames.value",
|
||||
"desc": "Plné meno",
|
||||
"type": "Object",
|
||||
|
||||
"value": {
|
||||
"name": "fullNames.value",
|
||||
"desc": "Plné meno",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
"name": "fullNames.validFrom",
|
||||
"desc": "platnosť od",
|
||||
"type": "Date"
|
||||
},
|
||||
"validTo": {
|
||||
"name": "fullNames.validTo",
|
||||
"desc": "platnosť do",
|
||||
"type": "Date"
|
||||
}
|
||||
},
|
||||
"addresses": {
|
||||
"name": "address.value",
|
||||
"desc": "Adresa",
|
||||
"type": "Object",
|
||||
|
||||
"validFrom": {
|
||||
"name": "addresses.validFrom",
|
||||
"desc": "platnosť od",
|
||||
@@ -74,6 +91,10 @@
|
||||
}
|
||||
},
|
||||
"legalForms": {
|
||||
"name": "legalForms.value",
|
||||
"desc": "Právna forma",
|
||||
"type": "Object",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "legalForms.codelistCode",
|
||||
"desc": "kód zoznamu"
|
||||
@@ -85,7 +106,7 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "legalForms.value",
|
||||
"desc": "Právna forma",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -100,6 +121,10 @@
|
||||
"type": "Date"
|
||||
},
|
||||
"activities": {
|
||||
"name": "activities",
|
||||
"desc": "Aktivity",
|
||||
"type": "Object",
|
||||
|
||||
"economicActivityDescription": {
|
||||
"name": "activities.economicActivityDescription",
|
||||
"desc": "Typ ekonomickej aktivity",
|
||||
@@ -162,6 +187,10 @@
|
||||
}
|
||||
},
|
||||
"country": {
|
||||
"name": "statutoryBodies.address.country.value",
|
||||
"desc": "Krajina",
|
||||
"type": "Object",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "statutoryBodies.address.country.codelistCode",
|
||||
"desc": "krajina CL"
|
||||
@@ -173,12 +202,16 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "statutoryBodies.address.country.value",
|
||||
"desc": "krajina",
|
||||
"desc": "hodnota",
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"personName": {
|
||||
"name": "statutoryBodies.personName",
|
||||
"desc": "Meno",
|
||||
"type": "Object",
|
||||
|
||||
"formatedName": {
|
||||
"name": "statutoryBodies.personName.formatedName",
|
||||
"desc": "celé meno",
|
||||
@@ -197,7 +230,15 @@
|
||||
}
|
||||
},
|
||||
"stakeholders": {
|
||||
"name": "stakeholders",
|
||||
"desc": "Zainteresovana osoba",
|
||||
"type": "Number",
|
||||
|
||||
"stakeholderType": {
|
||||
"name": "stakeholders",
|
||||
"desc": "Typ zainteresovanej osoby",
|
||||
"type": "Number",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "stakeholders.stakeholderType.codelistCode",
|
||||
"desc": "CL"
|
||||
@@ -209,7 +250,7 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "stakeholders.stakeholderType.value",
|
||||
"desc": "Prartneri v podnikaní",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
@@ -219,6 +260,10 @@
|
||||
"type": "Date"
|
||||
},
|
||||
"address": {
|
||||
"name": "stakeholders.address",
|
||||
"desc": "Adresa",
|
||||
"type": "Object",
|
||||
|
||||
"street": {
|
||||
"name": "stakeholders.address.street",
|
||||
"desc": "Ulica",
|
||||
@@ -247,6 +292,10 @@
|
||||
}
|
||||
},
|
||||
"country": {
|
||||
"name": "stakeholders.address.country",
|
||||
"desc": "Krajina",
|
||||
"type": "Object",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "stakeholders.address.country.codelistCode",
|
||||
"desc": "CL"
|
||||
@@ -258,7 +307,7 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "stakeholders.address.country.value",
|
||||
"desc": "Krajina",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
@@ -277,9 +326,13 @@
|
||||
}
|
||||
},
|
||||
"otherLegalFacts": {
|
||||
"name": "otherLegalFacts.value",
|
||||
"desc": "Iné právne skutočnosti",
|
||||
"type": "Array",
|
||||
|
||||
"value": {
|
||||
"name": "otherLegalFacts.value",
|
||||
"desc": "Poznámky k právnym informáciam",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -289,9 +342,13 @@
|
||||
}
|
||||
},
|
||||
"authorizations": {
|
||||
"name": "authorizations.value",
|
||||
"desc": "Oprávnenie konať v mene PO",
|
||||
"type": "Object",
|
||||
|
||||
"value": {
|
||||
"name": "authorizations.value",
|
||||
"desc": "Autorizácia",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -301,6 +358,10 @@
|
||||
}
|
||||
},
|
||||
"equities": {
|
||||
"name": "equities.value",
|
||||
"desc": "Základé imanie",
|
||||
"type": "Array",
|
||||
|
||||
"validFrom": {
|
||||
"name": "equities.validFrom",
|
||||
"desc": "platné od",
|
||||
@@ -308,10 +369,14 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "equities.value",
|
||||
"desc": "Cenné papiere",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"currency": {
|
||||
"name": "equities.currency.value",
|
||||
"desc": "Mena",
|
||||
"type": "Array",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "equities.currency.codelistCode",
|
||||
"desc": "CL"
|
||||
@@ -323,7 +388,7 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "equities.currency.value",
|
||||
"desc": "Cenné papiere, mena",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
@@ -334,6 +399,10 @@
|
||||
}
|
||||
},
|
||||
"deposits": {
|
||||
"name": "deposits",
|
||||
"desc": "Vklady",
|
||||
"type": "Array",
|
||||
|
||||
"validTo": {
|
||||
"name": "deposits.validTo",
|
||||
"desc": "Platný do",
|
||||
@@ -358,10 +427,15 @@
|
||||
},
|
||||
"amount": {
|
||||
"name": "deposits.amount",
|
||||
"desc": "Depozit, čiastka",
|
||||
"desc": "Čiastka",
|
||||
"type": "Number"
|
||||
},
|
||||
|
||||
"currency": {
|
||||
"name": "deposits.currency",
|
||||
"desc": "Mena",
|
||||
"type": "Array",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "deposits.currency.codelistCode",
|
||||
"desc": "CL"
|
||||
@@ -385,6 +459,10 @@
|
||||
},
|
||||
"sourceRegister": {
|
||||
"value": {
|
||||
"name": "sourceRegister.value",
|
||||
"desc": "Registračný úrad",
|
||||
"type": "Array",
|
||||
|
||||
"codelistCode": {
|
||||
"name": "sourceRegister.value.codelistCode",
|
||||
"desc": "CL"
|
||||
@@ -396,14 +474,14 @@
|
||||
},
|
||||
"value": {
|
||||
"name": "sourceRegister.value.value",
|
||||
"desc": "Registračný úrad",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"registrationOffices": {
|
||||
"value": {
|
||||
"name": "sourceRegister.registrationOffices.value",
|
||||
"desc": "Registračný úrad, kancelária",
|
||||
"desc": "Kancelária",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -413,9 +491,13 @@
|
||||
}
|
||||
},
|
||||
"registrationNumbers": {
|
||||
"name": "sourceRegister.registrationNumbers.value",
|
||||
"desc": "Číslo",
|
||||
"type": "Array",
|
||||
|
||||
"value": {
|
||||
"name": "sourceRegister.registrationNumbers.value",
|
||||
"desc": "Registračné číslo",
|
||||
"desc": "Hodnota",
|
||||
"type": "String"
|
||||
},
|
||||
"validFrom": {
|
||||
@@ -426,6 +508,10 @@
|
||||
}
|
||||
},
|
||||
"statisticalCodes": {
|
||||
"name": "statisticalCodes",
|
||||
"desc": "Štatistické kódy",
|
||||
"type": "Object",
|
||||
|
||||
"statCodesActualization": {
|
||||
"name": "statisticalCodes.statCodesActualization",
|
||||
"desc": "Aktualizácia",
|
||||
|
||||
@@ -5,19 +5,24 @@ import rpoFields from '../../Data/MultiSelectOptionsRPO';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { defineEmits } from 'vue'
|
||||
import { Inertia } from '@inertiajs/inertia';
|
||||
import RpoRecord from '@/Components/RpoRecord.vue';
|
||||
import RpoRecord2 from '@/Components/RpoRecord2.vue';
|
||||
import Pagination from '@/Components/Pagination.vue';
|
||||
|
||||
defineProps({
|
||||
result: Object,
|
||||
query: Object,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<GuestLayout>
|
||||
|
||||
<Head title="Register výsledky" />
|
||||
<RpoRecord :data="result"/>
|
||||
<Pagination :links="result.links" :data="query"/>
|
||||
<div v-for="r in result.data" :key="r.id">
|
||||
<RpoRecord2 :data="r"/>
|
||||
</div>
|
||||
<Pagination :links="result.links" :data="query"/>
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
||||
@@ -46,7 +46,7 @@ Route::middleware('auth')->group(function () {
|
||||
|
||||
|
||||
Route::get('/all', [PersonController::class, 'index']);
|
||||
Route::post('/search', [PersonController::class, 'search'])
|
||||
Route::any('/search', [PersonController::class, 'search'])
|
||||
->name('search');
|
||||
|
||||
require __DIR__.'/auth.php';
|
||||
|
||||
Reference in New Issue
Block a user