Projects/3BIT/winter-semester/IIS/xnecasr00/resources/views/winemaker/dashboard/completed-activities.blade.php
2026-04-14 19:28:46 +02:00

587 lines
19 KiB
PHP

@extends('layouts.winemaker')
@section('content')
<style>
.section {
background: white;
border-radius: 12px;
padding: 2rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
margin-bottom: 2rem;
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 2px solid #e2e8f0;
}
.section-title {
font-size: 1.5rem;
font-weight: 700;
color: #2d3748;
display: flex;
align-items: center;
gap: 0.75rem;
}
.section-icon {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
background: linear-gradient(135deg, #89b4d9 0%, #a8cce5 100%);
}
.section-icon svg {
width: 18px;
height: 18px;
fill: white;
}
/* Planned Actions Timeline */
.planned-timeline {
position: relative;
}
.planned-item {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
position: relative;
}
.planned-item:last-child {
margin-bottom: 0;
}
.planned-item:not(:last-child)::before {
content: '';
position: absolute;
left: 20px;
top: 45px;
bottom: -10px;
width: 2px;
background: #e2e8f0;
}
.planned-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
border: 3px solid #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
z-index: 1;
background: white;
}
.planned-icon svg {
width: 20px;
height: 20px;
}
.planned-icon.spraying {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.planned-icon.spraying svg {
fill: white;
}
.planned-icon.fertilization {
background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
}
.planned-icon.fertilization svg {
fill: white;
}
.planned-icon.watering {
background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}
.planned-icon.watering svg {
fill: white;
}
.planned-icon.pruning {
background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}
.planned-icon.pruning svg {
fill: white;
}
.planned-icon.harvest {
background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}
.planned-icon.harvest svg {
fill: white;
}
.planned-content {
flex: 1;
background: #f7fafc;
border-radius: 8px;
padding: 1rem;
border: 1px solid #e2e8f0;
}
.planned-content.today {
background: linear-gradient(135deg, #fff5ec 0%, #f7fafc 100%);
border-color: #ed8936;
}
.planned-content.overdue {
background: linear-gradient(135deg, #fff5f5 0%, #f7fafc 100%);
border-color: #f56565;
}
.planned-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 0.5rem;
}
.planned-title {
font-size: 1rem;
font-weight: 600;
color: #2d3748;
}
.planned-date {
font-size: 0.875rem;
color: #4a5568;
white-space: nowrap;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
}
.date-badge {
display: inline-block;
padding: 0.125rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
}
.date-badge.today {
background: #fed7aa;
color: #7c2d12;
}
.date-badge.overdue {
background: #fecaca;
color: #7f1d1d;
}
.planned-description {
font-size: 0.95rem;
color: #4a5568;
line-height: 1.5;
}
.planned-meta {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 0.75rem;
font-size: 0.875rem;
}
.row-badge {
background: white;
color: #4a5568;
padding: 0.25rem 0.625rem;
border-radius: 4px;
font-weight: 500;
border: 1px solid #e2e8f0;
}
/* Activity Timeline */
.activity-timeline {
position: relative;
}
.activity-item {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
position: relative;
}
.activity-item:last-child {
margin-bottom: 0;
}
.activity-item:not(:last-child)::before {
content: '';
position: absolute;
left: 20px;
top: 45px;
bottom: -10px;
width: 2px;
background: #e2e8f0;
}
.activity-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
border: 3px solid #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
z-index: 1;
background: white;
}
.activity-icon svg {
width: 20px;
height: 20px;
}
.activity-icon.spraying {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.activity-icon.spraying svg {
fill: white;
}
.activity-icon.fertilization {
background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
}
.activity-icon.fertilization svg {
fill: white;
}
.activity-icon.watering {
background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}
.activity-icon.watering svg {
fill: white;
}
.activity-icon.pruning {
background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}
.activity-icon.pruning svg {
fill: white;
}
.activity-icon.harvest {
background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}
.activity-icon.harvest svg {
fill: white;
}
.activity-icon.production {
background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
}
.activity-icon.production svg {
fill: white;
}
.activity-icon.sales {
background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}
.activity-icon.sales svg {
fill: white;
}
.activity-content {
flex: 1;
background: #f7fafc;
border-radius: 8px;
padding: 1rem;
border: 1px solid #e2e8f0;
}
.activity-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 0.5rem;
}
.activity-title {
font-size: 1rem;
font-weight: 600;
color: #2d3748;
}
.activity-time {
font-size: 0.875rem;
color: #4a5568;
white-space: nowrap;
font-weight: 600;
}
.activity-description {
font-size: 0.95rem;
color: #4a5568;
line-height: 1.5;
}
.activity-meta {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 0.75rem;
font-size: 0.875rem;
}
.meta-badge {
background: white;
color: #4a5568;
padding: 0.25rem 0.625rem;
border-radius: 4px;
font-weight: 500;
border: 1px solid #e2e8f0;
}
.empty-state {
text-align: center;
padding: 3rem 2rem;
color: #718096;
}
.empty-state svg {
width: 80px;
height: 80px;
margin: 0 auto 1rem;
opacity: 0.3;
fill: #cbd5e0;
}
.empty-state-title {
font-size: 1.25rem;
font-weight: 600;
color: #4a5568;
margin-bottom: 0.5rem;
}
/* Stats cards */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stat-card {
background: white;
border-radius: 12px;
padding: 1.5rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
border-top: 4px solid #89b4d9;
}
.stat-label {
font-size: 0.875rem;
color: #718096;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.5rem;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
color: #2d3748;
}
.stat-description {
font-size: 0.875rem;
color: #a0aec0;
margin-top: 0.25rem;
}
.grid-2 {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
}
.dashboard-container {
max-width: 900px;
margin: 0 auto;
}
</style>
<div class="page-header" style="text-align: center; margin-bottom: 3rem;">
<h1 class="page-title" style="font-size: 2rem; font-weight: 700; color: #2d3748; margin-bottom: 0.5rem;">
All Completed Activities
</h1>
<p class="page-subtitle" style="color: #718096; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; text-align: left;">
<a href="{{ route('winemaker.dashboard') }}" style="color: #89b4d9; text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width: 24px; height: 24px; fill: currentColor;">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
</svg>
<span style="color: #718096; font-weight: 600;">Back to Dashboard</span>
</a>
</p>
</div>
<div class="dashboard-container">
<!-- Recent Activity Timeline -->
<div class="section">
<div class="section-header">
<h2 class="section-title">
<div class="section-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
</svg>
</div>
All Completed Activities
</h2>
</div>
@if($completedActivities->isEmpty())
<div class="empty-state">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
</svg>
<div class="empty-state-title">No Completed Activities</div>
<p>No completed actions recorded.</p>
</div>
@else
<div class="activity-timeline">
@foreach($completedActivities as $activity)
@if($activity->activity_type === 'task')
<!-- Completed Task (Treatment/Harvest from PlannedTask) -->
@php
$taskType = strtolower($activity->type);
@endphp
<div class="activity-item">
<div class="activity-icon {{ $taskType }}">
@if($taskType === 'spraying')
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M3,3V5A2,2 0 0,0 5,7H6V20A1,1 0 0,0 7,21H9A1,1 0 0,0 10,20V7H14V9H12V11H14V13H12V15H14V20A1,1 0 0,0 15,21H17A1,1 0 0,0 18,20V9H19A2,2 0 0,0 21,7V5H3M7,5H9V7H7V5M11,5H13V7H11V5M15,5H17V7H15V5Z"/>
</svg>
@elseif($taskType === 'fertilization')
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M21,16V4H3V16H21M12,6A2,2 0 0,1 14,8A2,2 0 0,1 12,10A2,2 0 0,1 10,8A2,2 0 0,1 12,6M6,9H7.5L7,13H8L8.5,9H10L9.5,13H10.5L11,9H12.5L11.5,13H15.5L15,9H16.5L16,13H17L17.5,9H19L18.5,13C18.5,13 18.5,13.5 18,14H6C5.5,13.5 5.5,13 5.5,13L6,9M3,18V20H21V18H3Z"/>
</svg>
@elseif($taskType === 'watering')
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8z"/>
</svg>
@elseif($taskType === 'pruning')
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3z"/>
</svg>
@elseif($taskType === 'harvest')
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M17.21 9l-4.38-6.56c-.19-.28-.51-.42-.83-.42-.32 0-.64.14-.83.43L6.79 9H2c-.55 0-1 .45-1 1 0 .09.01.18.04.27l2.54 9.27c.23.84 1 1.46 1.92 1.46h13c.92 0 1.69-.62 1.93-1.46l2.54-9.27L23 10c0-.55-.45-1-1-1h-4.79zM9 9l3-4.4L15 9H9zm3 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/>
</svg>
@endif
</div>
<div class="activity-content">
<div class="activity-header">
<div class="activity-title">{{ $activity->type }} Completed</div>
<div class="activity-time">{{ $activity->activity_date->format('M j, Y') }}</div>
</div>
@if($activity->note)
<div class="activity-description">{{ $activity->note }}</div>
@endif
@if($activity->vineyard_rows->isNotEmpty())
<div class="activity-meta">
@foreach($activity->vineyard_rows->sortBy('id') as $row)
<span class="meta-badge">
Row {{ $row->id }}
</span>
@endforeach
</div>
@endif
</div>
</div>
@elseif($activity->activity_type === 'production')
<!-- Wine Production (Bottling/Blending) -->
<div class="activity-item">
<div class="activity-icon production">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M6 3v6c0 2.97 2.16 5.43 5 5.91V19H8v2h8v-2h-3v-4.09c2.84-.48 5-2.94 5-5.91V3H6zm10 6c0 2.21-1.79 4-4 4s-4-1.79-4-4V5h8v4z"/>
</svg>
</div>
<div class="activity-content">
<div class="activity-header">
<div class="activity-title">
@if($activity->is_blend)
Created Blend: {{ $activity->wine->wine_name }}
@else
Bottled Wine: {{ $activity->wine->wine_name }}
@endif
</div>
<div class="activity-time">{{ $activity->activity_date->format('M j, Y') }}</div>
</div>
<div class="activity-description">
Produced {{ number_format($activity->wine->bottles_produced) }} bottles
@if($activity->is_blend)
from {{ $activity->productions->count() }} harvests
@endif
({{ number_format($activity->total_weight, 1) }} kg of grapes)
</div>
<div class="activity-meta">
<span class="meta-badge">{{ $activity->wine->grapeVariety->variety_name }}</span>
<span class="meta-badge">{{ ucfirst($activity->wine->wine_type) }} Wine</span>
<span class="meta-badge">{{ $activity->wine->alcohol_percentage }}% ABV</span>
</div>
</div>
</div>
@elseif($activity->activity_type === 'harvest')
<!-- Harvest Recorded -->
<div class="activity-item">
<div class="activity-icon harvest">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M17.21 9l-4.38-6.56c-.19-.28-.51-.42-.83-.42-.32 0-.64.14-.83.43L6.79 9H2c-.55 0-1 .45-1 1 0 .09.01.18.04.27l2.54 9.27c.23.84 1 1.46 1.92 1.46h13c.92 0 1.69-.62 1.93-1.46l2.54-9.27L23 10c0-.55-.45-1-1-1h-4.79zM9 9l3-4.4L15 9H9zm3 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/>
</svg>
</div>
<div class="activity-content">
<div class="activity-header">
<div class="activity-title">Harvest Recorded</div>
<div class="activity-time">{{ $activity->activity_date->format('M j, Y') }}</div>
</div>
<div class="activity-description">
Harvested {{ number_format($activity->harvest->weight, 1) }} kg from Row {{ $activity->harvest->vineyard_row_id }}
</div>
<div class="activity-meta">
<span class="meta-badge">{{ number_format($activity->harvest->sugar_content, 1) }} sugar content</span>
<span class="meta-badge">{{ ucfirst($activity->harvest->quality) }} quality</span>
</div>
</div>
</div>
@endif
@endforeach
</div>
@endif
</div>
</div>
@endsection