feat(hak akses): memperbaiki kueri agar sesuai dengan hak akses yang diberikan,data berdasarkan barbershop_id,menambahkan scope di model dan menghapus with di model

This commit is contained in:
Yoga Pangestu 2024-11-28 21:59:42 +07:00
parent ecf4e23e73
commit 59ac4bbd4c
29 changed files with 608 additions and 425 deletions

View File

@ -20,7 +20,13 @@ public function index(): View
{
return view('pages.admin.finance.cashes', [
'pageTitle' => 'Kas',
'cashes' => Cash::latest()->get(),
'cashes' => Cash::with(['user', 'user.biography'])
->barbershop()
->when(auth()->user()->role_id === 4, function ($query) {
return $query->where('user_id', auth()->id());
})
->latest()
->get(),
]);
}

View File

@ -20,7 +20,13 @@ public function index(): View
{
return view('pages.admin.finance.expenses', [
'pageTitle' => 'Pengeluaran',
'expenses' => Expense::with(['user', 'user.biography'])->barbershop()->latest()->get(),
'expenses' => Expense::with(['user', 'user.biography'])
->barbershop()
->when(auth()->user()->role_id === 4, function ($query) {
return $query->where('user_id', auth()->id());
})
->latest()
->get(),
]);
}

View File

@ -18,7 +18,14 @@ public function index(): View
{
return view('pages.admin.finance.payroll.index', [
'pageTitle' => 'Gaji',
'payrolls' => Payroll::latest()->get(),
'payrolls' => Payroll::with(['employee', 'employee.biography'])
->barbershop()
->when(in_array(auth()->user()->role_id, [4, 5]), function ($query) {
return $query->where('user_id', auth()->id())
->orWhere('employee_id', auth()->id());
})
->latest()
->get(),
]);
}

View File

@ -22,7 +22,11 @@ class AttendanceController extends Controller
public function index(Request $request): View|JsonResponse
{
if ($request->ajax()) {
$attendances = Attendance::query();
$attendances = Attendance::with('attachments')
->barbershop()
->when(in_array(auth()->user()->role_id, [4, 5]), function ($query) {
return $query->where('user_id', auth()->id());
});
return DataTables::eloquent($attendances)
->addIndexColumn()
@ -79,8 +83,8 @@ public function index(Request $request): View|JsonResponse
return view('pages.admin.manage.attendances', [
'pageTitle' => 'Kehadiran',
'checkInAttendance' => Attendance::where('user_id', Auth::id())->whereDate('created_at', today())->first(),
'checkOutAttendance' => Attendance::where('user_id', Auth::id())->whereDate('created_at', today())->whereNotNull('check_out')->first(),
'checkInAttendance' => Attendance::with('attachments')->where('user_id', Auth::id())->whereDate('created_at', today())->first(),
'checkOutAttendance' => Attendance::with('attachments')->where('user_id', Auth::id())->whereDate('created_at', today())->whereNotNull('check_out')->first(),
]);
}

View File

@ -20,7 +20,10 @@ public function index(): View
{
return view('pages.admin.manage.inventory', [
'pageTitle' => 'Barang',
'inventory' => Inventory::with(['user', 'user.biography'])->barbershop()->latest()->get(),
'inventory' => Inventory::with(['user', 'user.biography', 'attachment'])
->barbershop()
->latest()
->get(),
]);
}

View File

@ -7,6 +7,7 @@
use App\Models\Customer;
use App\Models\Service;
use App\Models\Transaction;
use App\Models\User;
use App\Traits\DeleteAttachment;
use App\Traits\UploadAttachment;
use Illuminate\Contracts\View\View;
@ -23,7 +24,13 @@ public function index(): View
{
return view('pages.admin.manage.transaction.index', [
'pageTitle' => 'Transaksi',
'transactions' => Transaction::with(['user', 'user.biography'])->barbershop()->latest()->get(),
'transactions' => Transaction::with(['user', 'user.biography'])
->barbershop()
->when(auth()->user()->role_id === 5, function ($query) {
return $query->where('user_id', auth()->id());
})
->latest()
->get(),
]);
}
@ -31,8 +38,9 @@ public function create(): View
{
return view('pages.admin.manage.transaction.create', [
'pageTitle' => 'Tambah Transaksi',
'services' => Service::latest()->get(),
'customers' => Customer::latest()->get(),
'services' => Service::query()->barbershop()->latest()->get(),
'customers' => Customer::query()->barbershop()->latest()->get(),
'barber' => User::with('biography')->barbershop()->barber()->latest()->get(),
]);
}
@ -52,7 +60,7 @@ public function store(TransactionRequest $request): RedirectResponse
]);
}
$newTransaction = Transaction::create(array_merge($validatedData, [
'user_id' => $userId,
'user_id' => $validatedData['barber'],
'barbershop_id' => $barbershopId,
'service_id' => $validatedData['service'],
'customer_id' => $customer ? $customer->id : $validatedData['customer'],
@ -69,8 +77,9 @@ public function edit(Transaction $transaction): View
{
return view('pages.admin.manage.transaction.edit', [
'pageTitle' => 'Edit Transaksi',
'services' => Service::latest()->get(),
'customers' => Customer::latest()->get(),
'services' => Service::query()->barbershop()->latest()->get(),
'customers' => Customer::query()->barbershop()->latest()->get(),
'barber' => User::with('biography')->barbershop()->barber()->latest()->get(),
'transaction' => $transaction,
]);
}
@ -81,6 +90,7 @@ public function update(Transaction $transaction, TransactionRequest $request): R
DB::transaction(function () use ($validatedData, $transaction) {
$transaction->update(array_merge($validatedData, [
'user_id' => $validatedData['barber'],
'service_id' => $validatedData['service'],
'customer_id' => $validatedData['customer'],
]));

View File

@ -18,7 +18,10 @@ public function index(): View
{
return view('pages.admin.master.customers', [
'pageTitle' => 'Pelanggan',
'customers' => Customer::with(['user', 'user.biography'])->barbershop()->latest()->get(),
'customers' => Customer::with(['user', 'user.biography'])
->barbershop()
->latest()
->get(),
]);
}

View File

@ -15,7 +15,10 @@ public function index(): View
{
return view('pages.admin.master.service.index', [
'pageTitle' => 'Layanan',
'services' => Service::latest()->get(),
'services' => Service::with(['user', 'biography'])
->barbershop()
->latest()
->get(),
]);
}

View File

@ -23,7 +23,10 @@ public function index(): View
{
return view('pages.admin.master.user.index', [
'pageTitle' => 'Pengguna',
'users' => User::latest()->get(),
'users' => User::with(['biography', 'attachment'])
->barbershop()
->latest()
->get(),
]);
}

View File

@ -31,6 +31,7 @@ public function rules(): array
$isEdit = $this->isMethod('put');
return [
'barber' => ['required', Rule::exists('users', 'id')],
'service' => ['required', Rule::exists('services', 'id')],
'customer' => ['required'],
'price' => ['required', 'numeric', 'min:0', 'max:999999.99'],

View File

@ -2,11 +2,13 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
class Attendance extends Model
{
@ -19,9 +21,10 @@ class Attendance extends Model
'check_out',
];
protected $with = [
'attachments',
];
public function scopeBarbershop(Builder $query): Builder
{
return $query->where('barbershop_id', Auth::user()->barbershop_id);
}
public function user(): BelongsTo
{

View File

@ -28,10 +28,6 @@ class Barbershop extends Model
'cash',
];
protected $with = [
'attachment',
];
protected $cascadeDeletes = [
'users',
'customers',

View File

@ -2,11 +2,13 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
class Cash extends Model
{
@ -21,6 +23,11 @@ class Cash extends Model
'amount',
];
public function scopeBarbershop(Builder $query): Builder
{
return $query->where('barbershop_id', Auth::user()->barbershop_id);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);

View File

@ -2,11 +2,13 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
class Payroll extends Model
{
@ -25,6 +27,11 @@ class Payroll extends Model
'description',
];
public function scopeBarbershop(Builder $query): Builder
{
return $query->where('barbershop_id', Auth::user()->barbershop_id);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);

View File

@ -15,8 +15,12 @@
<h4 class="mb-3 mt-1 f-w-500 mb-0 f-22">
<span class="counter">{{ formatToRupiah($cash) }}</span>
</h4>
<a class="purchase-btn btn btn-primary btn-hover-effect f-w-500"
href="{{ route('finance.cashes') }}">Tambah Kas</a>
@if (auth()->user()->role_id !== 5 && auth()->user()->role_id !== 2)
<a class="purchase-btn btn btn-primary btn-hover-effect f-w-500"
href="{{ route('finance.cashes') }}">Tambah Kas</a>
@else
<span class=" f-w-500"></span>
@endif
<div class="mobile-right-img">
<img class="mobile-img" src="{{ asset('assets/admin/images/mobile.png') }}"
alt="mobile with coin">

View File

@ -6,15 +6,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Kas" data-url="{{ route('finance.cash.store') }}" data-metho="post"
class="btn btn-primary">
Tambah
</a>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Kas" data-url="{{ route('finance.cash.store') }}" data-metho="post"
class="btn btn-primary">
Tambah
</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -26,7 +28,9 @@ class="btn btn-primary">
<th>Nama</th>
<th>Jumlah</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -37,32 +41,36 @@ class="btn btn-primary">
<td>{{ $cash->name }}</td>
<td>{{ formatToRupiah($cash->amount) ?? '-' }}</td>
<td>{{ formatDateIndo($cash->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Kas"
data-url="{{ route('finance.cash.update', encryptId($cash->id)) }}"
data-method="put" data-name="{{ $cash->name }}"
data-amount="{{ formatToRupiah($cash->amount) }}">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('finance.cash.delete', encryptId($cash->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Kas"
data-url="{{ route('finance.cash.update', encryptId($cash->id)) }}"
data-method="put" data-name="{{ $cash->name }}"
data-amount="{{ formatToRupiah($cash->amount) }}">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('finance.cash.delete', encryptId($cash->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,15 +6,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Pelanggan" data-url="{{ route('finance.expense.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Pengeluaran" data-url="{{ route('finance.expense.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -27,7 +29,9 @@
<th>Jumlah</th>
<th>Bukti</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -52,33 +56,38 @@
@endif
</td>
<td>{{ formatDateIndo($expense->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Pelanggan"
data-url="{{ route('finance.expense.update', encryptId($expense->id)) }}"
data-method="put" data-name="{{ $expense->name }}"
data-amount="{{ formatToRupiah($expense->amount) }}"
data-use-cash="{{ $expense->use_cash }}">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('finance.expense.delete', encryptId($expense->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal"
data-modal-title="Edit Pengeluaran"
data-url="{{ route('finance.expense.update', encryptId($expense->id)) }}"
data-method="put" data-name="{{ $expense->name }}"
data-amount="{{ formatToRupiah($expense->amount) }}"
data-use-cash="{{ $expense->use_cash }}">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('finance.expense.delete', encryptId($expense->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,11 +6,13 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('finance.payroll.create') }}">Tambah</a>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('finance.payroll.create') }}">Tambah</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -27,7 +29,9 @@
<th>Total</th>
<th>Keterangan</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -43,30 +47,34 @@
<td>{{ formatToRupiah($payroll->total) }}</td>
<td>{{ $payroll->description }}</td>
<td>{{ formatDateIndo($payroll->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('finance.payroll.edit', encryptId($payroll->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('finance.payroll.delete', encryptId($payroll->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('finance.payroll.edit', encryptId($payroll->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('finance.payroll.delete', encryptId($payroll->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,15 +6,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Barang" data-url="{{ route('manage.inventory.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Barang" data-url="{{ route('manage.inventory.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -30,7 +32,9 @@
<th>Gambar</th>
<th>Deskripsi</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -58,34 +62,38 @@
</td>
<td>{{ $item->description }}</td>
<td>{{ formatDateIndo($item->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Barang"
data-url="{{ route('manage.inventory.update', encryptId($item->id)) }}"
data-method="put" data-name="{{ $item->name }}"
data-quantity="{{ $item->quantity }}"
data-price="{{ formatToRupiah($item->price) }}"
data-description="{{ $item->description }}">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('manage.inventory.delete', encryptId($item->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
@if (in_array(auth()->user()->role_id, [1, 3]))
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Barang"
data-url="{{ route('manage.inventory.update', encryptId($item->id)) }}"
data-method="put" data-name="{{ $item->name }}"
data-quantity="{{ $item->quantity }}"
data-price="{{ formatToRupiah($item->price) }}"
data-description="{{ $item->description }}">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('manage.inventory.delete', encryptId($item->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -14,7 +14,25 @@
<form class="row g-3 custom-input" action="{{ route('manage.transaction.store') }}" method="post"
enctype="multipart/form-data">
@csrf
<div class="col-lg-6 position-relative">
<div class="col-lg-4 position-relative">
<label class="form-label" for="barber">Barber
</label>
<select name="barber" class="form-control @error('barber') is-invalid @enderror select2"
id="barber">
<option value=""></option>
@foreach ($barber as $item)
<option value="{{ $item->id }}" @selected(old('barber') == $item->id)>
{{ $item->biography->full_name }}
</option>
@endforeach
</select>
@error('barber')
<div class="invalid-feedback">
{{ $message }}
</div>
@enderror
</div>
<div class="col-lg-4 position-relative">
<label class="form-label" for="customer">Pelanggan
</label>
<select name="customer" class="form-control @error('customer') is-invalid @enderror select2"
@ -32,7 +50,7 @@
</div>
@enderror
</div>
<div class="col-lg-6 position-relative">
<div class="col-lg-4 position-relative">
<label class="form-label" for="service">Layanan
</label>
<select name="service" class="form-control @error('service') is-invalid @enderror select2"
@ -115,8 +133,8 @@
</label>
</li>
<li>
<input class="form-check-input" id="radio-other" type="radio" name="payment_method"
value="3" @checked(old('payment_method') == '3')>
<input class="form-check-input" id="radio-other" type="radio"
name="payment_method" value="3" @checked(old('payment_method') == '3')>
<label class="form-check-label" for="radio-other">
Lainnya
</label>

View File

@ -16,7 +16,25 @@
enctype="multipart/form-data">
@csrf
@method('put')
<div class="col-lg-6 position-relative">
<div class="col-lg-4 position-relative">
<label class="form-label" for="barber">Barber
</label>
<select name="barber" class="form-control @error('barber') is-invalid @enderror select2"
id="barber">
<option value=""></option>
@foreach ($barber as $item)
<option value="{{ $item->id }}" @selected($transaction->user_id == $item->id)>
{{ $item->biography->full_name }}
</option>
@endforeach
</select>
@error('barber')
<div class="invalid-feedback">
{{ $message }}
</div>
@enderror
</div>
<div class="col-lg-4 position-relative">
<label class="form-label" for="customer">Pelanggan
</label>
<select name="customer" class="form-control @error('customer') is-invalid @enderror select2"
@ -34,7 +52,7 @@
</div>
@enderror
</div>
<div class="col-lg-6 position-relative">
<div class="col-lg-4 position-relative">
<label class="form-label" for="service">Layanan
</label>
<select name="service" class="form-control @error('service') is-invalid @enderror select2"
@ -117,8 +135,8 @@
</label>
</li>
<li>
<input class="form-check-input" id="radio-other" type="radio" name="payment_method"
value="3" @checked($transaction->payment_method == '3')>
<input class="form-check-input" id="radio-other" type="radio"
name="payment_method" value="3" @checked($transaction->payment_method == '3')>
<label class="form-check-label" for="radio-other">
Lainnya
</label>

View File

@ -6,11 +6,13 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('manage.transaction.create') }}">Tambah</a>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('manage.transaction.create') }}">Tambah</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -18,7 +20,7 @@
<thead>
<tr>
<th>No</th>
<th>Penginput</th>
<th>Barber</th>
<th>Pelanggan</th>
<th>Layanan</th>
<th>Harga</th>
@ -27,7 +29,9 @@
<th>Metode Pembayaran</th>
<th>Gambar</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -66,30 +70,34 @@
@endif
</td>
<td>{{ formatDateIndo($transaction->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('manage.transaction.edit', encryptId($transaction->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('manage.transaction.delete', encryptId($transaction->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
@if (in_array(auth()->user()->role_id, [1, 3, 4]))
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('manage.transaction.edit', encryptId($transaction->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('manage.transaction.delete', encryptId($transaction->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,11 +6,13 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.barbershop.create') }}">Tambah</a>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.barbershop.create') }}">Tambah</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -27,7 +29,9 @@
<th>Kas</th>
<th>Gambar</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -57,30 +61,34 @@
@endif
</td>
<td>{{ formatDateIndo($item->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('master.barbershop.edit', encryptId($item->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('master.barbershop.delete', encryptId($item->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
@if (in_array(auth()->user()->role_id, [1, 3]))
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('master.barbershop.edit', encryptId($item->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('master.barbershop.delete', encryptId($item->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,15 +6,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Pelanggan" data-url="{{ route('master.customer.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="list-product-header">
<div>
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#createModal"
data-modal-title="Tambah Pelanggan" data-url="{{ route('master.customer.store') }}"
data-metho="post" class="btn btn-primary">
Tambah
</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -26,7 +28,9 @@
<th>Nama</th>
<th>Kontak</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -37,32 +41,37 @@
<td>{{ $customer->name }}</td>
<td>{{ $customer->contact_number ?? '-' }}</td>
<td>{{ formatDateIndo($customer->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal" data-modal-title="Edit Pelanggan"
data-url="{{ route('master.customer.update', encryptId($customer->id)) }}"
data-method="put" data-name="{{ $customer->name }}"
data-contact-number="{{ $customer->contact_number }}">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('master.customer.delete', encryptId($customer->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
@if (in_array(auth()->user()->role_id, [1, 3]))
<td>
<ul class="action">
<li class="edit">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#createModal"
data-modal-title="Edit Pelanggan"
data-url="{{ route('master.customer.update', encryptId($customer->id)) }}"
data-method="put" data-name="{{ $customer->name }}"
data-contact-number="{{ $customer->contact_number }}">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('master.customer.delete', encryptId($customer->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,11 +6,13 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.service.create') }}">Tambah</a>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.service.create') }}">Tambah</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -23,7 +25,9 @@
<th>Harga</th>
<th>Deskripsi</th>
<th>Tanggal</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -35,30 +39,34 @@
<td>{{ formatToRupiah($service->price) }}</td>
<td>{{ $service->description }}</td>
<td>{{ formatDateIndo($service->created_at) }}</td>
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('master.service.edit', encryptId($service->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('master.service.delete', encryptId($service->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
@if (in_array(auth()->user()->role_id, [1, 3]))
<td>
<ul class="action">
<li class="edit">
<a href="{{ route('master.service.edit', encryptId($service->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('master.service.delete', encryptId($service->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -6,11 +6,13 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.user.create') }}">Tambah</a>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="list-product-header">
<div>
<a class="btn btn-primary" href="{{ route('master.user.create') }}">Tambah</a>
</div>
</div>
</div>
@endif
<div class="card">
<div class="card-body">
<div class="table-responsive">
@ -27,7 +29,9 @@
<th>Gaji Pokok</th>
<th>Status</th>
<th>Tanggal Bekerja</th>
<th>Aksi</th>
@if (in_array(auth()->user()->role_id, [1, 3]))
<th>Aksi</th>
@endif
</tr>
</thead>
<tbody>
@ -47,72 +51,77 @@
: '<span class="badge bg-danger">Tidak Aktif</span>' !!}
</td>
<td>{{ formatDateIndo($user->entry_date) }}</td>
<td>
<ul class="action">
<li class="{{ $user->is_active ? 'nonactivate' : '7366ff' }}">
<a href="javascript:void(0)"
onclick="event.preventDefault(); document.getElementById('activation-form-{{ $user->id }}').submit();"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="{{ $user->is_active ? 'Nonaktifkan' : 'Aktifkan' }}">
<i data-feather="{{ $user->is_active ? 'x' : 'check' }}"></i>
</a>
<form
action="{{ route('master.user.activation', encryptId($user->id)) }}"
method="post" id="activation-form-{{ $user->id }}"
style="display: none;">
@csrf
@method('put')
</form>
</li>
<li class="reset-password">
<form
action="{{ route('master.user.resetPassword', encryptId($user->id)) }}"
method="post">
@csrf
@method('put')
<a href="javascript:void(0)" class="reset-password"
@if (in_array(auth()->user()->role_id, [1, 3]))
<td>
<ul class="action">
<li class="{{ $user->is_active ? 'nonactivate' : '7366ff' }}">
<a href="javascript:void(0)"
onclick="event.preventDefault(); document.getElementById('activation-form-{{ $user->id }}').submit();"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Reset Kata Sandi">
<i data-feather="unlock"></i>
data-bs-title="{{ $user->is_active ? 'Nonaktifkan' : 'Aktifkan' }}">
<i
data-feather="{{ $user->is_active ? 'x' : 'check' }}"></i>
</a>
</form>
</li>
<li class="show">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#showModal" id="tooltipTrigger"
data-full-name="{{ $user->biography->full_name ?? '-' }}"
data-barbershop="{{ $user->barbershop->name ?? '-' }}"
data-pob="{{ $user->biography->pob ?? '-' }}"
data-dob="{{ formatDateIndo($user->biography->dob) ?? '-' }}"
data-address="{{ $user->biography->address ?? '-' }}"
data-gender="{{ $user->biography->gender ?? '-' }}"
data-sop="{{ $user->sop ?? '-' }}"
data-avatar="{{ Storage::url("users/{$user->attachment->formatted_attachment}") }}">
<i data-feather="eye"></i>
</a>
</li>
<li class="edit">
<a href="{{ route('master.user.edit', encryptId($user->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</li>
<li class="delete">
<form
action="{{ route('master.user.delete', encryptId($user->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
<form
action="{{ route('master.user.activation', encryptId($user->id)) }}"
method="post" id="activation-form-{{ $user->id }}"
style="display: none;">
@csrf
@method('put')
</form>
</li>
<li class="reset-password">
<form
action="{{ route('master.user.resetPassword', encryptId($user->id)) }}"
method="post">
@csrf
@method('put')
<a href="javascript:void(0)" class="reset-password"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Reset Kata Sandi">
<i data-feather="unlock"></i>
</a>
</form>
</li>
<li class="show">
<a href="javascript:void(0)" data-bs-toggle="modal"
data-bs-target="#showModal" id="tooltipTrigger"
data-full-name="{{ $user->biography->full_name ?? '-' }}"
data-barbershop="{{ $user->barbershop->name ?? '-' }}"
data-pob="{{ $user->biography->pob ?? '-' }}"
data-dob="{{ formatDateIndo($user->biography->dob) ?? '-' }}"
data-address="{{ $user->biography->address ?? '-' }}"
data-gender="{{ $user->biography->gender ?? '-' }}"
data-sop="{{ $user->sop ?? '-' }}"
data-avatar="{{ Storage::url("users/{$user->attachment->formatted_attachment}") }}">
<i data-feather="eye"></i>
</a>
</li>
<li class="edit">
<a href="{{ route('master.user.edit', encryptId($user->id)) }}"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
data-bs-title="Edit">
<i data-feather="edit"></i>
</a>
</form>
</li>
</ul>
</td>
</li>
@if (auth()->user()->role_id === 1)
<li class="delete">
<form
action="{{ route('master.user.delete', encryptId($user->id)) }}"
method="post">
@csrf
@method('delete')
<a href="javascript:void(0)" class="delete-data"
data-bs-toggle="tooltip" data-bs-placement="left"
data-bs-title="Hapus">
<i data-feather="trash-2"></i>
</a>
</form>
</li>
@endif
</ul>
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -53,9 +53,11 @@
</div>
@enderror
</div>
<div class="col-12">
<button class="btn btn-primary button-disable" type="submit">Simpan</button>
</div>
@if (in_array(auth()->user()->role_id, [1, 3]))
<div class="col-12">
<button class="btn btn-primary button-disable" type="submit">Simpan</button>
</div>
@endif
</form>
</div>
</div>

View File

@ -45,7 +45,6 @@
{{ $message }}
</div>
@enderror
<a class="link" href="{{ route('auth.forgot-password') }}">Lupa kata sandi?</a>
</div>
<div
class="col-12 d-flex justify-content-center @error('g-recaptcha-response') is-invalid

View File

@ -49,58 +49,62 @@
<span>Ringkasan</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('dashboard.analytic') }}">
<i data-feather="bar-chart-2"></i>
<span>Analitik</span>
</a>
</li>
<li class="sidebar-main-title">
<div>
<h6>Master</h6>
</div>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.barbershop') }}">
<i data-feather="home"></i>
<span>Barbershop</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.users') }}">
<i data-feather="users"></i>
<span>Pengguna</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.customers') }}">
<i data-feather="user-plus"></i>
<span>Pelanggan</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.services') }}">
<i data-feather="sliders"></i>
<span>Layanan</span>
</a>
</li>
@if (in_array(auth()->user()->role_id, [1, 2, 3]))
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('dashboard.analytic') }}">
<i data-feather="bar-chart-2"></i>
<span>Analitik</span>
</a>
</li>
<li class="sidebar-main-title">
<div>
<h6>Master</h6>
</div>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.barbershop') }}">
<i data-feather="home"></i>
<span>Barbershop</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.users') }}">
<i data-feather="users"></i>
<span>Pengguna</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.customers') }}">
<i data-feather="user-plus"></i>
<span>Pelanggan</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('master.services') }}">
<i data-feather="sliders"></i>
<span>Layanan</span>
</a>
</li>
@endif
<li class="sidebar-main-title">
<div>
<h6>Keuangan</h6>
</div>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('finance.expenses') }}">
<i data-feather="log-out"></i>
<span>Pengeluaran</span>
</a>
</li>
@if (auth()->user()->role_id !== 5)
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('finance.expenses') }}">
<i data-feather="log-out"></i>
<span>Pengeluaran</span>
</a>
</li>
@endif
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('finance.payrolls') }}">
@ -108,13 +112,15 @@
<span>Gaji</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('finance.cashes') }}">
<i data-feather="upload"></i>
<span>Kas</span>
</a>
</li>
@if (auth()->user()->role_id !== 5)
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('finance.cashes') }}">
<i data-feather="upload"></i>
<span>Kas</span>
</a>
</li>
@endif
<li class="sidebar-main-title">
<div>
<h6>Kelola</h6>
@ -134,25 +140,27 @@
<span>Transaksi</span>
</a>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('manage.inventory') }}">
<i data-feather="archive"></i>
<span>Barang</span>
</a>
</li>
<li class="sidebar-main-title">
<div>
<h6>Pengaturan</h6>
</div>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('setting.application') }}">
<i data-feather="settings"></i>
<span>Aplikasi</span>
</a>
</li>
@if (in_array(auth()->user()->role_id, [1, 2, 3]))
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('manage.inventory') }}">
<i data-feather="archive"></i>
<span>Barang</span>
</a>
</li>
<li class="sidebar-main-title">
<div>
<h6>Pengaturan</h6>
</div>
</li>
<li class="sidebar-list">
<i class="fa fa-thumb-tack"></i>
<a class="sidebar-link sidebar-title link-nav" href="{{ route('setting.application') }}">
<i data-feather="settings"></i>
<span>Aplikasi</span>
</a>
</li>
@endif
</ul>
</div>
<div class="right-arrow" id="right-arrow"><i data-feather="arrow-right"></i></div>