feat: pindah barbershop
This commit is contained in:
parent
59ac4bbd4c
commit
9e720ea57d
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Barbershop;
|
||||
|
||||
if (! function_exists('barbershop')) {
|
||||
function barbershop()
|
||||
{
|
||||
return Barbershop::all();
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,8 @@
|
||||
use App\Models\Barbershop;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@ -62,4 +64,14 @@ public function index()
|
||||
'topCustomersByTotal' => $topCustomersByTotal,
|
||||
]);
|
||||
}
|
||||
|
||||
public function changeBarbershop(Barbershop $barbershop): RedirectResponse
|
||||
{
|
||||
$user = User::findOrFail(Auth::id());
|
||||
$user->barbershop_id = $barbershop->id;
|
||||
$user->save();
|
||||
notify()->success('Barbershop berhasil diubah', 'Berhasil');
|
||||
|
||||
return redirect()->route('dashboard.overview');
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="card o-hidden">
|
||||
<div class="card-body balance-widget">
|
||||
<span class="f-w-500 f-light">Kas</span>
|
||||
<span class="f-w-500 f-light">{{ auth()->user()->barbershop->name }}</span>
|
||||
<h4 class="mb-3 mt-1 f-w-500 mb-0 f-22">
|
||||
<span class="counter">{{ formatToRupiah($cash) }}</span>
|
||||
</h4>
|
||||
|
||||
@ -13,6 +13,50 @@
|
||||
</div>
|
||||
<div class="nav-right col-xxl-7 col-xl-6 col-md-7 col-8 pull-right right-header p-0 ms-auto">
|
||||
<ul class="nav-menus">
|
||||
<li class="onhover-dropdown">
|
||||
<div class="mode">
|
||||
<i data-feather="home"></i>
|
||||
</div>
|
||||
<div class="onhover-show-div bookmark-flip">
|
||||
<div class="flip-card">
|
||||
<div class="flip-card-inner">
|
||||
<div class="front">
|
||||
<h6 class="f-18 mb-0 dropdown-title">Barbershop</h6>
|
||||
<ul class="bookmark-dropdown">
|
||||
<li>
|
||||
<div class="row">
|
||||
@foreach (barbershop() as $barbershop)
|
||||
<div class="col-6 text-center">
|
||||
<a
|
||||
href="{{ route('dashboard.changeBarbershop', encryptId($barbershop->id)) }}">
|
||||
<div class="bookmark-content">
|
||||
<div class="bookmark-icon">
|
||||
<i data-feather="home"></i>
|
||||
</div>
|
||||
<span>{{ $barbershop->name }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="back">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="bookmark-dropdown flip-back-content">
|
||||
<input type="text" placeholder="Search...">
|
||||
</div>
|
||||
</li>
|
||||
<li><a class="f-w-700 d-block flip-back btn btn-primary w-100" id="flip-back"
|
||||
href="#!">Back</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="mode">
|
||||
<i data-feather="moon"></i>
|
||||
@ -29,7 +73,8 @@
|
||||
alt="image">
|
||||
<div class="media-body">
|
||||
<span>{{ Auth::user()->biography->full_name }}</span>
|
||||
<p class="mb-0">{{ Auth::user()->role->name }} <i class="middle fa fa-angle-down"></i></p>
|
||||
<p class="mb-0">{{ Auth::user()->role->name }} <i class="middle fa fa-angle-down"></i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="profile-dropdown onhover-show-div">
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
Route::get('analytic', [AnalyticController::class, 'index'])->name('dashboard.analytic')->middleware('check_role:1,2,3');
|
||||
Route::get('analytic/filter', [AnalyticController::class, 'filter'])->name('dashboard.analytic.filter')->middleware('check_role:1,2,3');
|
||||
|
||||
Route::get('change-barbershop/{barbershop}', [OverviewController::class, 'changeBarbershop'])->name('dashboard.changeBarbershop');
|
||||
|
||||
Route::middleware(['check_role:1,2,3'])->group(function () {
|
||||
Route::prefix('master')->group(function () {
|
||||
Route::prefix('barbershop')->group(function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user