fix the blade
This commit is contained in:
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace App\Exports\V3\RoadItemsProjects;
|
||||
|
||||
use App\Models\Province;
|
||||
use App\Models\RoadItemsProject;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
@@ -18,17 +13,17 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class CountryActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private Collection $activities){}
|
||||
public function __construct(private array $activities){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
|
||||
return view('v3.Reports.RoadItems.CountryActivityPerSubItem', [
|
||||
'activities' => $activities->data,
|
||||
'fromDate' => $activities->fromDate,
|
||||
'toDate' => $activities->toDate,
|
||||
'details' => $activities->details
|
||||
'activities' => $activities["data"],
|
||||
'fromDate' => $activities["fromDate"],
|
||||
'toDate' => $activities["toDate"],
|
||||
'details' => $activities["details"]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
namespace App\Services\Reports;
|
||||
|
||||
use App\Models\InfoItem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoadItemReportService
|
||||
{
|
||||
public function countryActivityPerSubItem(int $item, string $fromDate, string $toDate): Collection
|
||||
public function countryActivityPerSubItem(int $item, string $fromDate, string $toDate): array
|
||||
{
|
||||
$subItems = InfoItem::query()->where('item', $item)->get(['sub_item', 'sub_item_str', 'sub_item_unit']);
|
||||
|
||||
@@ -36,18 +35,18 @@ class RoadItemReportService
|
||||
];
|
||||
|
||||
foreach ($subItems as $subItem) {
|
||||
$totalItemCount = [
|
||||
$totalItemCount[] = [
|
||||
"total_count_{$subItem->sub_item}" => $activities->sum("Count_{$subItem->sub_item}"),
|
||||
"total_sum_{$subItem->sub_item}" => $activities->sum("Sum_{$subItem->sub_item}"),
|
||||
];
|
||||
}
|
||||
|
||||
return collect([
|
||||
return [
|
||||
'data' => $activities->push($totalItemCount),
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
'details' => $subItems,
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
||||
public function provinceActivityPerSubItem(int $item, string $fromDate, string $toDate, int $provinceId): Collection
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<span>{{ $detail->sub_item_str }}</span>
|
||||
<div style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">
|
||||
<span>تعداد</span>
|
||||
<span>{{ $detail->unit }}مجموع</span>
|
||||
<span>{{ $detail["sub_item_unit"] }}مجموع</span>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
@@ -52,11 +52,11 @@
|
||||
<tbody>
|
||||
@foreach ($activities as $activity)
|
||||
<tr>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $activity->province_fa }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $activity["province_fa"] }}</td>
|
||||
|
||||
@if($activity->sub_item == $detail->sub_item)
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $activity->Count_ }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ round($activity->Sum_, 1) }}</td>
|
||||
@if($activity["sub_item"] == $detail["sub_item"])
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $activity["Count_{$activity["sub_item"]}"] }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ round($activity["Sum_{$activity["sub_item"]}"], 1) }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user