reform the blade files

This commit is contained in:
2025-02-05 14:08:23 +03:30
parent 943b2dbb93
commit ed832dab70
6 changed files with 51 additions and 33 deletions

View File

@@ -37,38 +37,36 @@
</tr>
<tr>
@foreach($details as $detail)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $detail->sub_item_str }}</th>
@foreach($subItems as $subItem)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $subItem->sub_item_str }}</th>
@endforeach
</tr>
<tr>
@foreach($details as $detail)
@foreach($subItems as $subItem)
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $detail->sub_item_unit }})</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $subItem->sub_item_unit }})</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($activities as $activity)
@foreach ($provinces as $province)
<tr>
<td style="border: 1px solid black;text-align: center;">{{ $activity->province_fa }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $province['name_fa'] }}</td>
@foreach ($details as $index => $detail)
@foreach ($subItems as $subItem)
<td style="border: 1px solid black;text-align: center;">
{{ $activity->{'Count_' . ($index)} ?? '-' }}
{{ $province->{'Count_' . ($index)} ?? '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($activity->{'Sum_' . ($index)}) ? round($activity->{'Sum_' . ($index)}, 1) : '-' }}
{{ isset($province->{'Sum_' . ($index)}) ? round($province->{'Sum_' . ($index)}, 1) : '-' }}
</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -72,12 +72,12 @@
@foreach($edarateShahri as $edareShahri)
@php
// محاسبه مجموع مقدار s برای این استان
$totalForProvince = collect($data)->where('p', $edareShahri['id'])->sum('s');
$totalForProvince = collect($data)->where('c', $edareShahri['id'])->sum('s');
// محاسبه مجموع مقدار s برای هر آیتم در این استان
$itemTotalsForProvince = [];
foreach ($items as $item) {
$itemTotalsForProvince[$item['item']] = collect($data)->where('p', $edareShahri['id'])->where('i', $item['item'])->sum('s');
$itemTotalsForProvince[$item['item']] = collect($data)->where('c', $edareShahri['id'])->where('i', $item['item'])->sum('s');
}
@endphp
<tr>

View File

@@ -37,31 +37,31 @@
</tr>
<tr>
@foreach($details as $detail)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $detail->sub_item_str }}</th>
@foreach($subItems as $subItem)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $subItem->sub_item_str }}</th>
@endforeach
</tr>
<tr>
@foreach($details as $detail)
@foreach($subItems as $subItem)
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $detail->sub_item_unit }})</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $subItem->sub_item_unit }})</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($activities as $activity)
@foreach ($edarateShahri as $edareShahri)
<tr>
<td style="border: 1px solid black;text-align: center;">{{ $activity->city_fa }}</td>
@foreach ($details as $index => $detail)
@foreach ($subItems as $subItem)
<td style="border: 1px solid black;text-align: center;">
{{ $activity->{'Count_' . ($index)} ?? '-' }}
{{ $edareShahri->{'Count_' . ($subItem)} ?? '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($activity->{'Sum_' . ($index)}) ? round($activity->{'Sum_' . ($index)}, 1) : '-' }}
{{ isset($edareShahri->{'Sum_' . ($subItem)}) ? round($edareShahri->{'Sum_' . ($subItem)}, 1) : '-' }}
</td>
@endforeach
</tr>