/
home
/
sjslayjy
/
public_html
/
ccbfsoution
/
resources
/
views
/
silagemaking
/
Upload File
HOME
@extends('layouts.app') @section('content') <style> .container-block { background: white; padding: 20px; border-radius: 16px; box-shadow: 0 0 10px rgba(0,0,0,0.05); } .filter-group { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; margin-bottom: 20px; } .filter-group label { font-weight: 600; margin-bottom: 4px; font-size: 14px; color: #333; } .filter-group .form-select, .filter-group .form-control { height: 36px; padding: 4px 12px; border-radius: 999px; font-size: 14px; min-width: 150px; } .search-container { position: relative; } .search-container input { padding-right: 32px; } .search-container .fa-search { position: absolute; right: 10px; top: 9px; color: #888; } .table-responsive-wrapper { overflow-x: auto; margin-top: 20px; } .table thead { background-color: #4c6e16; color: white; font-weight: bold; text-align: center; white-space: nowrap; } .table tbody tr:nth-child(even) { background-color: #f0f7e0; } .table th, .table td { vertical-align: middle; text-align: center; padding: 10px; white-space: nowrap; } .pagination { justify-content: center; margin-top: 20px; } .bg-kharif { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; } .bg-rabi { background: linear-gradient(135deg, #f39c12, #e67e22); color: white; } .bg-zaid { background: linear-gradient(135deg, #8e44ad, #9b59b6); color: white; } </style> <div class="container-block my-3"> <form method="GET" class="filter-group"> {{-- Site Dropdown --}} <div> <label>Location:</label> @if ($role == 1) <select name="site_id" class="form-select" onchange="this.form.submit()"> <option value="">All Sites</option> @foreach ($sites as $id => $name) <option value="{{ $id }}" {{ $selectedSiteId == $id ? 'selected' : '' }}> {{ $name }} </option> @endforeach </select> @else <input type="text" class="form-control" value="{{ $sites[$selectedSiteId] ?? 'N/A' }}" readonly> @endif </div> {{-- Block Dropdown --}} <div> <label>Block</label> <select name="block_name" class="form-select" onchange="this.form.submit()"> <option value="">All Blocks</option> @foreach ($blocks as $blk) <option value="{{ $blk }}" {{ request('block_name') == $blk ? 'selected' : '' }}> Block {{ $blk }} </option> @endforeach </select> </div> <div class="form-group-compact"> <label for="sessionSelect" class="form-label"> <i class="fas fa-calendar-alt"></i> Season </label> <select id="sessionSelect" name="session" class="form-select custom-select-enhanced" onchange="this.form.submit()"> <option value="">All Seasons</option> <option value="kharif" {{ request('session') == 'kharif' ? 'selected' : '' }}>🌾 Kharif </option> <option value="rabi" {{ request('session') == 'rabi' ? 'selected' : '' }}>🌾 Rabi</option> <option value="zaid" {{ request('session') == 'zaid' ? 'selected' : '' }}>🌾 Zaid</option> </select> </div> </form> {{-- Data Table --}} <div class="table-responsive-wrapper"> <table class="table table-bordered mb-0"> <thead> <tr> <th>Sr. No.</th> <th>Block Name</th> <th>Plot No.</th> <th>Area (Acre)</th> <th>Area Covered (Acre)</th> <th>Date</th> <th>Seed Name</th> <th>Total Green Fodder Yield (MT)</th> <th>Fodder Used for Silage Making (MT)</th> <th>Processed Output Yield (MT)(20%)</th> <th>Unprocessed Fodder Remaining (MT)</th> <th>Method of Harvest</th> <th>Machine Used</th> <th>Tractor Used</th> <th>HSD Consumption (Ltr)</th> <th>Time (Hrs)</th> <th>Manpower Type</th> <th>Unskilled</th> <th>Semi-Skilled 1</th> <th>Semi-Skilled 2</th> <th>Major Maintenance (Rs)</th> <th>Total Cost (Rs)</th> </tr> </thead> <tbody> @forelse($silagemakings as $i => $row) @php // Season detection logic $dateField = $row->date ?? $row->created_at ?? now(); $date = \Carbon\Carbon::parse($dateField); $month = $date->month; if ($month >= 6 && $month <= 10) { $season = 'kharif'; $seasonLabel = 'Kharif'; $seasonClass = 'bg-kharif'; } elseif ($month >= 11 || $month <= 3) { $season = 'rabi'; $seasonLabel = 'Rabi'; $seasonClass = 'bg-rabi'; } else { $season = 'zaid'; $seasonLabel = 'Zaid'; $seasonClass = 'bg-zaid'; } // Frontend filter $sessionFilter = request('session'); if ($sessionFilter && $sessionFilter !== $season) { continue; } @endphp <tr> <td>{{ $silagemakings->firstItem() + $i }}</td> <td>{{ $row->block_name ?? 'N/A' }}</td> <td>{{ $row->plot_name ?? '-' }}</td> <td>{{ $row->area ?? '-' }}</td> <td>{{ $row->area_covered ?? '-' }}</td> <td>{{ \Carbon\Carbon::parse($row->harvest_date)->format('d-m-Y') }}</td> <td>{{ $row->seed_name ?? '-' }}</td> <td>{{ $row->total_available_yield ?? 0 }}</td> <td>{{ $row->required_yield_mt ?? 0 }}</td> <td>{{ $row->adjusted_yield_mt ?? 0 }}</td> <td>{{ number_format(($row->total_available_yield ?? 0) - ($row->required_yield_mt ?? 0), 2) }}</td> <td>{{ $row->silage_making_method ?? '-' }}</td> <td>{{ $row->machine_names_display ?? '-' }}</td> <td>{{ $row->tractor_names_display ?? '-' }}</td> <td>{{ $row->hsd_consumption ?? '-' }}</td> <td>{{ $row->hours_used ?? '-' }}</td> <td>{{ $row->manpower_type ?? '-' }}</td> <td>{{ $row->unskilled ?? 0 }}</td> <td>{{ $row->semi_skilled_1 ?? 0 }}</td> <td>{{ $row->semi_skilled_2 ?? 0 }}</td> <td> @if (!empty($row->parsed_major_maintenance)) @foreach ($row->parsed_major_maintenance as $item) {{ $item['spare_part'] ?? '-' }}: ₹{{ $item['value'] ?? '0' }}<br> @endforeach @else - @endif </td> <td>{{ $row->total_cost ?? 'N/A' }}</td> </tr> @empty <tr> <td colspan="22" class="text-center text-muted py-4">No records found.</td> </tr> @endforelse </tbody> </table> </div> {{-- Pagination --}} <div class="d-flex pagination"> {{ $silagemakings->links('pagination::bootstrap-5') }} </div> </div> @endsection