This commit is contained in:
256
resources/views/livewire/party/show.blade.php
Normal file
256
resources/views/livewire/party/show.blade.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<div class="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
|
||||
<div class="container mx-auto py-12 px-4">
|
||||
<!-- Breadcrumb Navigation -->
|
||||
<nav class="mb-8" aria-label="Breadcrumb">
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 px-4 py-3">
|
||||
<ol class="flex items-center space-x-2 text-sm text-gray-600">
|
||||
<li>
|
||||
<a wire:navigate href="{{ route('home') }}" class="text-blue-600 hover:text-blue-700 flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6">
|
||||
</path>
|
||||
</svg>
|
||||
Hem
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<svg class="w-4 h-4 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd"
|
||||
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</li>
|
||||
<li>
|
||||
<a wire:navigate href="{{ route('party.index') }}" class="text-blue-600 hover:text-blue-700">
|
||||
Partier
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<svg class="w-4 h-4 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd"
|
||||
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</li>
|
||||
<li class="font-medium text-gray-900">
|
||||
{{ $party->label() }}
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Party Header -->
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-8 mb-8">
|
||||
<div class="flex flex-col md:flex-row items-center gap-6">
|
||||
<div class="w-24 h-24 bg-gray-100 rounded-full flex items-center justify-center">
|
||||
@if ($party->logo())
|
||||
<img src="{{ $party->logo() }}" alt="{{ $party->label() }}" class="w-20 h-20 object-contain">
|
||||
@else
|
||||
<span class="text-3xl font-bold text-gray-600">{{ $party->value }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="text-center md:text-left">
|
||||
<h1 class="text-4xl font-bold text-gray-900 mb-2">{{ $party->label() }}</h1>
|
||||
<p class="text-xl text-gray-600 mb-4">{{ $party->value }}</p>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="bg-blue-50 rounded-lg p-3">
|
||||
<div class="text-sm font-medium text-blue-600">Totalt motioner</div>
|
||||
<div class="text-2xl font-bold text-blue-900">{{ $this->motionStatistics['total'] }}</div>
|
||||
</div>
|
||||
<div class="bg-green-50 rounded-lg p-3">
|
||||
<div class="text-sm font-medium text-green-600">Ledamöter</div>
|
||||
<div class="text-2xl font-bold text-green-900">{{ count($members) }}</div>
|
||||
</div>
|
||||
<div class="bg-purple-50 rounded-lg p-3">
|
||||
<div class="text-sm font-medium text-purple-600">Röster (urval)</div>
|
||||
<div class="text-2xl font-bold text-purple-900">{{ count($votes) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Statistics Section -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8">
|
||||
<!-- Motion Statistics -->
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-6">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center mr-3">
|
||||
<svg class="w-5 h-5 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-900">Motioner per år</h2>
|
||||
</div>
|
||||
@if (!empty($this->motionStatistics['by_year']))
|
||||
<div style="height: 20rem;">
|
||||
<livewire:livewire-column-chart :column-chart-model="$this->motionsColumnChart" />
|
||||
</div>
|
||||
@else
|
||||
<p class="text-gray-500 text-center py-8">Ingen motionsstatistik tillgänglig</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Motion Types -->
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-6">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center mr-3">
|
||||
<svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-900">Motionstyper</h2>
|
||||
</div>
|
||||
@if (!empty($this->motionStatistics['by_type']))
|
||||
<div style="height: 20rem;">
|
||||
<livewire:livewire-pie-chart :pie-chart-model="$this->motionTypePieChart" />
|
||||
</div>
|
||||
@else
|
||||
<p class="text-gray-500 text-center py-8">Ingen motionsstatistik tillgänglig</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Voting Statistics -->
|
||||
@if (!empty($this->votingStatistics))
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-6 mb-8">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center mr-3">
|
||||
<svg class="w-5 h-5 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-900">Röststatistik (urval av ledamöter)</h2>
|
||||
</div>
|
||||
<div class="flex flex-col lg:flex-row gap-6">
|
||||
<div style="height: 20rem;" class="lg:w-1/2">
|
||||
<livewire:livewire-pie-chart :pie-chart-model="$this->votingPieChart" />
|
||||
</div>
|
||||
<div class="lg:w-1/2 my-auto">
|
||||
<div class="space-y-2">
|
||||
@php($totalVotes = array_sum($this->votingStatistics))
|
||||
@foreach ($this->votingStatistics as $voteType => $count)
|
||||
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
|
||||
<span class="text-black font-medium">{{ $voteType }}</span>
|
||||
<span class="text-black text-lg font-bold">
|
||||
{{ $totalVotes > 0 ? round(($count / $totalVotes) * 100, 2) : 0 }}%
|
||||
</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Motions Section -->
|
||||
@if (!empty($this->motionsByYear))
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-6 mb-8">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center mr-3">
|
||||
<svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-900">Partiets motioner</h2>
|
||||
</div>
|
||||
|
||||
<!-- Year tabs -->
|
||||
<div class="border-b border-gray-200 mb-4">
|
||||
<nav class="-mb-px flex space-x-8">
|
||||
@foreach (array_keys($this->motionsByYear) as $year)
|
||||
<button wire:click="selectYear('{{ $year }}')"
|
||||
class="cursor-pointer py-2 px-1 border-b-2 font-medium text-sm {{ $selectedYear == $year ? 'border-green-500 text-green-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' }}">
|
||||
{{ $year }} ({{ count($this->motionsByYear[$year]) }})
|
||||
</button>
|
||||
@endforeach
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@if ($selectedYear && isset($this->motionsByYear[$selectedYear]))
|
||||
<div class="space-y-4">
|
||||
@foreach (collect($this->motionsByYear[$selectedYear])->take(10) as $motion)
|
||||
<div class="bg-gray-50 rounded-lg p-4 hover:bg-gray-100 transition-colors">
|
||||
<div class="flex flex-col lg:flex-row lg:items-start gap-4">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-2">
|
||||
<a wire:navigate href="{{ route('motion.show', $motion->dok_id) }}"
|
||||
class="hover:text-blue-600 transition-colors">
|
||||
{{ $motion->titel }}
|
||||
</a>
|
||||
</h3>
|
||||
@if (!empty($motion->undertitel))
|
||||
<p class="text-sm text-gray-600 mb-2">{{ $motion->undertitel }}</p>
|
||||
@endif
|
||||
<div class="flex flex-wrap gap-4 text-sm text-gray-500">
|
||||
<span>{{ $motion->rm }}:{{ $motion->beteckning }}</span>
|
||||
<span>{{ \Carbon\Carbon::parse($motion->datum)->format('Y-m-d') }}</span>
|
||||
<span class="px-2 py-1 bg-gray-200 rounded">{{ $motion->subtyp }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<a wire:navigate href="{{ route('motion.show', $motion->dok_id) }}"
|
||||
class="px-3 py-1 text-sm font-medium text-green-600 bg-green-100 rounded-md hover:bg-green-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500">
|
||||
Visa motion
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@if (count($this->motionsByYear[$selectedYear]) > 10)
|
||||
<div class="text-center pt-4">
|
||||
<a wire:navigate href="{{ route('motion.search', ['party' => $party->value, 'dateInterval' => $selectedYear]) }}"
|
||||
class="px-4 py-2 text-sm font-medium text-blue-600 bg-blue-100 rounded-md hover:bg-blue-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
Visa alla {{ count($this->motionsByYear[$selectedYear]) }} motioner för {{ $selectedYear }}
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Members Section -->
|
||||
@if (!empty($members))
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-6">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center mr-3">
|
||||
<svg class="w-5 h-5 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-900">Partiets ledamöter ({{ count($members) }})</h2>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@foreach ($members as $member)
|
||||
<a wire:navigate href="{{ route('person.show', $member->intressent_id) }}">
|
||||
<div class="bg-gray-50 rounded-lg p-4 hover:bg-gray-100 transition-colors border border-gray-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<div class="font-semibold text-gray-900">{{ $member->tilltalsnamn }} {{ $member->efternamn }}</div>
|
||||
<div class="text-sm text-gray-600">{{ $member->valkrets }}</div>
|
||||
@if (!empty($member->status))
|
||||
<div class="text-xs text-gray-500">{{ $member->status }}</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user