Skip to content

Commit ed45de9

Browse files
committed
add: case studies
1 parent 0cd202f commit ed45de9

File tree

8 files changed

+125
-6
lines changed

8 files changed

+125
-6
lines changed

app/Http/Controllers/Backend/DashboardController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected function getStatReports(): array
291291

292292
public function getChartData()
293293
{
294-
$fiscalYears = FiscalYear::orderBy('year', 'desc')->latest()->take(5)->latest()->get();
294+
$fiscalYears = FiscalYear::orderBy('year', 'desc')->latest()->latest()->take(3)->get();
295295

296296
$mappedItems = $fiscalYears->map(function ($fy) {
297297
$data = collect([

app/Http/Controllers/Frontend/Page/PageController.php

+8
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ public function myCourses()
137137
$courses = $user->purchased('course');
138138
return view('frontend.pages.myCourses', compact('courses'));
139139
}
140+
//show all my case studies in frontend
141+
public function myCaseStudies()
142+
{
143+
$user = User::where('id', auth()->id())->first();
144+
$packages = $user->purchased('caseStudyPackage');
145+
$studies = $user->purchased('caseStudy');
146+
return view('frontend.pages.myCaseStudies', compact('packages', 'studies'));
147+
}
140148
//show all my payments/payment history in frontend
141149
public function myPayments()
142150
{

app/Providers/AppServiceProvider.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Laravel\Telescope\TelescopeServiceProvider;
2020
use Illuminate\Contracts\Foundation\Application;
2121
use App\Interfaces\Services\BaseServiceInterface;
22+
use App\Models\FiscalYear;
2223
use App\Services\CustomService\CustomServiceService;
2324
use Illuminate\Database\Eloquent\Relations\Relation;
2425

@@ -55,5 +56,7 @@ public function boot(): void
5556
CustomService::class => CustomService::class
5657
]);
5758
Paginator::useBootstrapFive();
59+
60+
FiscalYear::updateOrCreate(['year'=> currentFiscalYear()],['year'=> currentFiscalYear()]);
5861
}
5962
}

resources/views/backend/dashboard/dashboard.blade.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
.stat-report td {
2828
padding: 4px;
2929
}
30-
.stat-report td > h3 {
30+
31+
.stat-report td>h3 {
3132
padding: 0;
3233
}
3334
@@ -249,6 +250,7 @@ class="text-light font-18 fw-bold">{{ $progress }}%</span></div>
249250
</div> <!-- tab-content -->
250251
</div>
251252
{{-- Project Progress Ends --}}
253+
252254
@php
253255
$number = new \NumberFormatter('en_IN', \NumberFormatter::DEFAULT_STYLE);
254256
$arearClients = $fiscalYear
@@ -416,8 +418,8 @@ class="text-light font-18 fw-bold">{{ $progress }}%</span></div>
416418
</div>
417419
</div>
418420
<div class="col-12">
419-
<div class="float-end fw-bold fs-5">Total: <span class="mdi-currency-bdt"></span> <span
420-
data-plugin="counterup">{{ $expenses->total }}</span>
421+
<div class="float-end fw-bold fs-5">Total: <span class="mdi-currency-bdt"></span>
422+
<span data-plugin="counterup">{{ $expenses->total }}</span>
421423
</div>
422424
</div>
423425
</div> <!-- end row-->

resources/views/frontend/layouts/app.blade.php

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ class="auth-sidebar-toggle menu-close-btn waves-effect waves-light p-2 me-2 bord
153153
<li class="sidebar-item">
154154
<a class="" href="{{ route('page.my.courses') }}">My Courses</a>
155155
</li>
156+
<li class="sidebar-item">
157+
<a class="" href="{{ route('page.my.case.studies') }}">My Case Studies</a>
158+
</li>
156159
<li class="sidebar-item">
157160
<a class="" href="{{ route('referral.index') }}">Referrals</a>
158161
</li>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
@extends('frontend.layouts.app')
2+
@section('main')
3+
<div class="container my-5">
4+
<h3 class="text-center text-muted">Packages:</h3>
5+
<div class="row">
6+
@if (count($packages) > 0)
7+
<table class="table table-responsive table-striped">
8+
<thead class="bg-light">
9+
<tr>
10+
<th class="">No</th>
11+
<th class="">Name</th>
12+
<th class="" style="width: 80px;">Action</th>
13+
</tr>
14+
</thead>
15+
<tbody>
16+
@foreach ($packages as $key => $package)
17+
<tr>
18+
<td>{{ ++$key }}</td>
19+
<td>
20+
21+
<a href="#" class="d-flex align-items-start gap-2 text-reset">
22+
<div>
23+
<span data-feather="folder" class="icon-dual"></span>
24+
</div>
25+
<div>
26+
<div class="fw-medium">{{ $package->name }}</div>
27+
<div class="d-flex mt-2 gap-2 align-items-center">
28+
<span data-feather="package" class="icon-dual w-4 h-4"></span>
29+
{{ $package->caseStudies?->count() }} Packages
30+
</div>
31+
</div>
32+
</a>
33+
</td>
34+
<td>
35+
<x-backend.ui.button type="custom" class="btn-sm text-capitalize btn-dark"
36+
href="{{ route('course.caseStudy.index', ['package_id' => $package->id]) }}">
37+
CaseStudies
38+
</x-backend.ui.button>
39+
40+
</td>
41+
</tr>
42+
@endforeach
43+
</tbody>
44+
</table>
45+
@else
46+
<section class="bg-light d-flex align-items-center justify-content-center rounded" style="height: 400px;">
47+
<div class="">
48+
<p>You havn't purchased any caseStudies yet!</p>
49+
<a href="{{ route('course.caseStudy.page') }}"
50+
class="btn btn-primary rounded-3 w-100 mx-auto">Explore
51+
CaseStudies</a>
52+
</div>
53+
</section>
54+
@endif
55+
</div>
56+
</div>
57+
@if (count($studies) > 0)
58+
<div class="container my-5">
59+
<h3 class="text-center text-muted">Case Studies:</h3>
60+
<div class="row">
61+
<table class="table table-responsive table-striped">
62+
<thead class="bg-light">
63+
<tr>
64+
<th class="">No</th>
65+
<th class="">Name</th>
66+
<th class="" style="width: 80px;">Action</th>
67+
</tr>
68+
</thead>
69+
<tbody>
70+
@foreach ($studies as $key => $study)
71+
<tr>
72+
<td>{{ ++$key }}</td>
73+
<td>
74+
75+
<a href="#" class="d-flex align-items-start gap-2 text-reset">
76+
<div>
77+
<span data-feather="folder" class="icon-dual"></span>
78+
</div>
79+
<div>
80+
<div class="fw-medium">{{ $study->name }}</div>
81+
</div>
82+
</a>
83+
</td>
84+
<td>
85+
<x-backend.ui.button type="custom" class="btn-sm text-capitalize btn-dark"
86+
href="{{ route('course.caseStudy.show', ['caseStudy' => $study]) }}">
87+
View
88+
</x-backend.ui.button>
89+
90+
</td>
91+
</tr>
92+
@endforeach
93+
</tbody>
94+
</table>
95+
96+
</div>
97+
</div>
98+
@endif
99+
@endsection

resources/views/frontend/pages/myCourses.blade.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
<td>{{ ++$key }}</td>
1919
<td>
2020

21-
<a href="{{ route('video.byCourse', $course->id) }}"
21+
<a href="#"
2222
class="d-flex align-items-start gap-2 text-reset">
2323
<div>
2424
<span data-feather="folder" class="icon-dual"></span>
2525
</div>
2626
<div>
2727
<div class="fw-medium">{{ $course->name }}</div>
28-
{{-- <div>{{ $course->videos()->count() }} Videos</div> --}}
28+
<div class="d-flex mt-2 gap-2 align-items-center">
29+
<span data-feather="tv" class="icon-dual w-4 h-4"></span>
30+
{{ $course->videos?->count() }} Case Studies
31+
</div>
2932
</div>
3033
</a>
3134
</td>

routes/frontend.php

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
Route::get('/training', [PageController::class, 'trainingPage'])->name('page.training');
9999
Route::get('/promo-codes', [PageController::class, 'PromoCodePage'])->name('page.promo.code');
100100
Route::get('/my-courses', [PageController::class, 'myCourses'])->name('page.my.courses');
101+
Route::get('/my-case-studies', [PageController::class, 'myCaseStudies'])->name('page.my.case.studies');
101102
Route::get('/my-payments', [PageController::class, 'myPayments'])->name('page.my.payments');
102103
Route::get('/my-payments/show/{id}', [PageController::class, 'myPaymentShow'])->name('page.my.payment.show');
103104
// user generated refer link

0 commit comments

Comments
 (0)