parent
a2b0de44b9
commit
7121e57cbb
|
@ -177,7 +177,7 @@ class Member extends Model implements Geolocatable
|
||||||
|
|
||||||
public function isLeader(): bool
|
public function isLeader(): bool
|
||||||
{
|
{
|
||||||
return $this->memberships()->isLeader()->exists();
|
return $this->leaderMemberships->count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAge(): ?int
|
public function getAge(): ?int
|
||||||
|
@ -274,7 +274,7 @@ class Member extends Model implements Geolocatable
|
||||||
*/
|
*/
|
||||||
public function leaderMemberships(): HasMany
|
public function leaderMemberships(): HasMany
|
||||||
{
|
{
|
||||||
return $this->ageGroupMemberships()->isLeader();
|
return $this->ageGroupMemberships()->isLeader()->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MemberController extends Controller
|
||||||
'data' => MemberResource::collection(Member::search($filter->search)->query(
|
'data' => MemberResource::collection(Member::search($filter->search)->query(
|
||||||
fn ($q) => $q->select('*')
|
fn ($q) => $q->select('*')
|
||||||
->withFilter($filter)
|
->withFilter($filter)
|
||||||
->with(['subscription', 'leaderMemberships', 'ageGroupMemberships'])
|
->with(['gender', 'subscription', 'leaderMemberships', 'ageGroupMemberships.subactivity'])
|
||||||
->withPendingPayment()
|
->withPendingPayment()
|
||||||
->ordered()
|
->ordered()
|
||||||
)->paginate(15)),
|
)->paginate(15)),
|
||||||
|
|
|
@ -119,6 +119,10 @@ class MemberResource extends JsonResource
|
||||||
*/
|
*/
|
||||||
public static function meta(): array
|
public static function meta(): array
|
||||||
{
|
{
|
||||||
|
if (request()->header('X-Inertia-Partial-Data', '') !== '' && !str_contains(request()->header('X-Inertia-Partial-Data', ''), 'meta')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
$activities = Activity::with('subactivities')->get();
|
$activities = Activity::with('subactivities')->get();
|
||||||
$createActivities = Activity::remote()->with(['subactivities' => fn ($q) => $q->remote()])->get();
|
$createActivities = Activity::remote()->with(['subactivities' => fn ($q) => $q->remote()])->get();
|
||||||
|
|
||||||
|
@ -127,11 +131,11 @@ class MemberResource extends JsonResource
|
||||||
'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'),
|
'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'),
|
||||||
'formActivities' => $activities->pluck('name', 'id'),
|
'formActivities' => $activities->pluck('name', 'id'),
|
||||||
'formSubactivities' => $activities->map(function (Activity $activity) {
|
'formSubactivities' => $activities->map(function (Activity $activity) {
|
||||||
return ['subactivities' => $activity->subactivities()->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'formCreateActivities' => $createActivities->pluck('name', 'id'),
|
'formCreateActivities' => $createActivities->pluck('name', 'id'),
|
||||||
'formCreateSubactivities' => $createActivities->map(function (Activity $activity) {
|
'formCreateSubactivities' => $createActivities->map(function (Activity $activity) {
|
||||||
return ['subactivities' => $activity->subactivities()->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'groups' => NestedGroup::cacheForSelect(),
|
'groups' => NestedGroup::cacheForSelect(),
|
||||||
'filter' => FilterScope::fromRequest(request()->input('filter', '')),
|
'filter' => FilterScope::fromRequest(request()->input('filter', '')),
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
|
"barryvdh/laravel-debugbar": "^3.9",
|
||||||
"beyondcode/laravel-dump-server": "^1.8",
|
"beyondcode/laravel-dump-server": "^1.8",
|
||||||
"cviebrock/eloquent-sluggable": "^9.0",
|
"cviebrock/eloquent-sluggable": "^9.0",
|
||||||
"doctrine/dbal": "^3.1",
|
"doctrine/dbal": "^3.1",
|
||||||
|
|
|
@ -4,8 +4,92 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "9b301aa44118f3ff66ba16b8688726a3",
|
"content-hash": "32582424fa61be5b9404c6d0ebf48a92",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-debugbar",
|
||||||
|
"version": "v3.9.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||||
|
"reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/bfd0131c146973cab164e50f5cdd8a67cc60cab1",
|
||||||
|
"reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/routing": "^9|^10",
|
||||||
|
"illuminate/session": "^9|^10",
|
||||||
|
"illuminate/support": "^9|^10",
|
||||||
|
"maximebf/debugbar": "^1.18.2",
|
||||||
|
"php": "^8.0",
|
||||||
|
"symfony/finder": "^6"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.3.3",
|
||||||
|
"orchestra/testbench-dusk": "^5|^6|^7|^8",
|
||||||
|
"phpunit/phpunit": "^8.5.30|^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.8-dev"
|
||||||
|
},
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Barryvdh\\Debugbar\\ServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\Debugbar\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Debugbar integration for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar",
|
||||||
|
"laravel",
|
||||||
|
"profiler",
|
||||||
|
"webprofiler"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
|
||||||
|
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.9.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://fruitcake.nl",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/barryvdh",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2023-08-25T18:43:57+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "beyondcode/laravel-dump-server",
|
"name": "beyondcode/laravel-dump-server",
|
||||||
"version": "1.9.0",
|
"version": "1.9.0",
|
||||||
|
@ -3995,6 +4079,72 @@
|
||||||
],
|
],
|
||||||
"time": "2023-06-21T14:59:35+00:00"
|
"time": "2023-06-21T14:59:35+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "maximebf/debugbar",
|
||||||
|
"version": "v1.19.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||||
|
"reference": "03dd40a1826f4d585ef93ef83afa2a9874a00523"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/03dd40a1826f4d585ef93ef83afa2a9874a00523",
|
||||||
|
"reference": "03dd40a1826f4d585ef93ef83afa2a9874a00523",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1|^8",
|
||||||
|
"psr/log": "^1|^2|^3",
|
||||||
|
"symfony/var-dumper": "^4|^5|^6"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": ">=7.5.20 <10.0",
|
||||||
|
"twig/twig": "^1.38|^2.7|^3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"kriswallsmith/assetic": "The best way to manage assets",
|
||||||
|
"monolog/monolog": "Log using Monolog",
|
||||||
|
"predis/predis": "Redis storage"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.18-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DebugBar\\": "src/DebugBar/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maxime Bouroumeau-Fuseau",
|
||||||
|
"email": "maxime.bouroumeau@gmail.com",
|
||||||
|
"homepage": "http://maximebf.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Debug bar in the browser for php application",
|
||||||
|
"homepage": "https://github.com/maximebf/php-debugbar",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maximebf/php-debugbar/issues",
|
||||||
|
"source": "https://github.com/maximebf/php-debugbar/tree/v1.19.1"
|
||||||
|
},
|
||||||
|
"time": "2023-10-12T08:10:52+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "monicahq/laravel-sabre",
|
"name": "monicahq/laravel-sabre",
|
||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
|
@ -13723,14 +13873,7 @@
|
||||||
"time": "2023-05-30T22:51:52+00:00"
|
"time": "2023-05-30T22:51:52+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [
|
"aliases": [],
|
||||||
{
|
|
||||||
"package": "zoomyboy/tex",
|
|
||||||
"version": "dev-main",
|
|
||||||
"alias": "1.0",
|
|
||||||
"alias_normalized": "1.0.0.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"zoomyboy/laravel-nami": 20,
|
"zoomyboy/laravel-nami": 20,
|
||||||
|
|
|
@ -16,26 +16,33 @@ export function useIndex(props, siteName) {
|
||||||
|
|
||||||
const filterString = computed(() => toFilterString(inner.meta.value.filter));
|
const filterString = computed(() => toFilterString(inner.meta.value.filter));
|
||||||
|
|
||||||
function reload(resetPage = true, withMeta = true) {
|
function reload(resetPage = true, withMeta = true, data) {
|
||||||
var data = {
|
var data = {
|
||||||
filter: filterString.value,
|
filter: filterString.value,
|
||||||
page: 1,
|
page: resetPage ? 1 : inner.meta.value.current_page,
|
||||||
|
...data,
|
||||||
};
|
};
|
||||||
|
|
||||||
data['page'] = resetPage ? 1 : inner.meta.value.current_page;
|
|
||||||
|
|
||||||
router.visit(window.location.pathname, {
|
router.visit(window.location.pathname, {
|
||||||
data,
|
data,
|
||||||
preserveState: true,
|
preserveState: true,
|
||||||
|
only: ['data'],
|
||||||
onSuccess: (page) => {
|
onSuccess: (page) => {
|
||||||
inner.data.value = page.props.data.data;
|
inner.data.value = page.props.data.data;
|
||||||
if (withMeta) {
|
if (withMeta) {
|
||||||
inner.meta.value = page.props.data.meta;
|
inner.meta.value = {
|
||||||
|
...inner.meta.value,
|
||||||
|
...page.props.data.meta,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadPage(page) {
|
||||||
|
reload(false, true, {page: page});
|
||||||
|
}
|
||||||
|
|
||||||
function can(permission) {
|
function can(permission) {
|
||||||
return inner.meta.value.can[permission];
|
return inner.meta.value.can[permission];
|
||||||
}
|
}
|
||||||
|
@ -46,7 +53,7 @@ export function useIndex(props, siteName) {
|
||||||
|
|
||||||
function setFilter(key, value) {
|
function setFilter(key, value) {
|
||||||
inner.meta.value.filter[key] = value;
|
inner.meta.value.filter[key] = value;
|
||||||
reload(true, false);
|
reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestCallback(successMessage, failureMessage) {
|
function requestCallback(successMessage, failureMessage) {
|
||||||
|
@ -77,6 +84,7 @@ export function useIndex(props, siteName) {
|
||||||
filterString,
|
filterString,
|
||||||
router,
|
router,
|
||||||
toFilterString,
|
toFilterString,
|
||||||
|
reloadPage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-6">
|
<div class="px-6">
|
||||||
<ui-pagination class="mt-4" :value="meta" :only="['data']"></ui-pagination>
|
<ui-pagination class="mt-4" :value="meta" @reload="reloadPage"></ui-pagination>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ui-sidebar v-if="single !== null" @close="closeSidebar">
|
<ui-sidebar v-if="single !== null" @close="closeSidebar">
|
||||||
|
@ -130,7 +130,7 @@ const single = ref(null);
|
||||||
const deleting = ref(null);
|
const deleting = ref(null);
|
||||||
|
|
||||||
const props = defineProps(indexProps);
|
const props = defineProps(indexProps);
|
||||||
var { router, data, meta, getFilter, setFilter, filterString } = useIndex(props.data, 'member');
|
var { router, data, meta, getFilter, setFilter, filterString, reloadPage } = useIndex(props.data, 'member');
|
||||||
|
|
||||||
function exportMembers() {
|
function exportMembers() {
|
||||||
window.open(`/member-export?filter=${filterString.value}`);
|
window.open(`/member-export?filter=${filterString.value}`);
|
||||||
|
|
Loading…
Reference in New Issue