feat: update various controllers to return back instead of redirecting to index routes; add payroll adjustment and payroll controllers
This commit is contained in:
parent
6627422655
commit
48c031a86f
@ -36,7 +36,7 @@ public function updateSystem(UpdateSystemRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Pengaturan sistem berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.settings.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function updateHomepage(UpdateHomepageRequest $request): RedirectResponse
|
||||
@ -45,7 +45,7 @@ public function updateHomepage(UpdateHomepageRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Pengaturan homepage berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.settings.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function updateSocialMedia(UpdateSocialMediaRequest $request): RedirectResponse
|
||||
@ -54,7 +54,7 @@ public function updateSocialMedia(UpdateSocialMediaRequest $request): RedirectRe
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Pengaturan media sosial berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.settings.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function updateMarketplace(UpdateMarketplaceRequest $request): RedirectResponse
|
||||
@ -63,7 +63,7 @@ public function updateMarketplace(UpdateMarketplaceRequest $request): RedirectRe
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Pengaturan marketplace berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.settings.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function updateHR(UpdateHRRequest $request): RedirectResponse
|
||||
@ -72,6 +72,6 @@ public function updateHR(UpdateHRRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Pengaturan HR berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.settings.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,10 +20,8 @@ public function __construct(
|
||||
|
||||
public function index(PaginatedRequest $request): Response
|
||||
{
|
||||
$cashAccount = $this->service->get();
|
||||
|
||||
return Inertia::render('admin/finance/cash-account/index', [
|
||||
'cashAccount' => $cashAccount,
|
||||
'cashAccount' => $this->service->get(),
|
||||
'transactions' => $this->service->paginatedTransactions(
|
||||
...$request->validatedWithDefaults(),
|
||||
filters: $request->only(['type']),
|
||||
@ -38,7 +36,7 @@ public function index(PaginatedRequest $request): Response
|
||||
public function deposit(CashTransactionRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->deposit($request->validated()),
|
||||
fn() => $this->service->deposit($request->validated()),
|
||||
'Deposit berhasil ditambahkan.',
|
||||
'admin.finance.cash-accounts.index'
|
||||
);
|
||||
@ -47,7 +45,7 @@ public function deposit(CashTransactionRequest $request): RedirectResponse
|
||||
public function withdrawal(CashTransactionRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->withdrawal($request->validated()),
|
||||
fn() => $this->service->withdrawal($request->validated()),
|
||||
'Withdrawal berhasil ditambahkan.',
|
||||
'admin.finance.cash-accounts.index'
|
||||
);
|
||||
@ -56,7 +54,7 @@ public function withdrawal(CashTransactionRequest $request): RedirectResponse
|
||||
public function update(CashTransactionRequest $request, CashTransaction $transaction): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->updateTransaction($transaction, $request->validated()),
|
||||
fn() => $this->service->updateTransaction($transaction, $request->validated()),
|
||||
'Transaksi berhasil diperbarui.',
|
||||
'admin.finance.cash-accounts.index'
|
||||
);
|
||||
@ -65,7 +63,7 @@ public function update(CashTransactionRequest $request, CashTransaction $transac
|
||||
public function destroy(CashTransaction $transaction): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->deleteTransaction($transaction),
|
||||
fn() => $this->service->deleteTransaction($transaction),
|
||||
'Transaksi berhasil dihapus.',
|
||||
'admin.finance.cash-accounts.index'
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Finance;
|
||||
namespace App\Http\Controllers\Admin\Finance\Payroll;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\Finance\PayrollAdjustmentRequest;
|
||||
@ -18,7 +18,7 @@ public function __construct(
|
||||
public function store(PayrollAdjustmentRequest $request, Payroll $payroll): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($payroll, $request->validated()),
|
||||
fn() => $this->service->create($payroll, $request->validated()),
|
||||
'Adjustment gaji berhasil ditambahkan.',
|
||||
'admin.finance.payroll-periods.show',
|
||||
parameters: ['payroll_period' => $payroll->payroll_period_id]
|
||||
@ -28,7 +28,7 @@ public function store(PayrollAdjustmentRequest $request, Payroll $payroll): Redi
|
||||
public function destroy(PayrollAdjustment $payrollAdjustment): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->delete($payrollAdjustment),
|
||||
fn() => $this->service->delete($payrollAdjustment),
|
||||
'Adjustment gaji berhasil dihapus.',
|
||||
'admin.finance.payroll-periods.show',
|
||||
parameters: ['payroll_period' => $payrollAdjustment->payroll->payroll_period_id]
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Finance;
|
||||
namespace App\Http\Controllers\Admin\Finance\Payroll;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Payroll;
|
||||
@ -16,7 +16,7 @@ public function __construct(
|
||||
public function pay(Payroll $payroll): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->pay($payroll),
|
||||
fn() => $this->service->pay($payroll),
|
||||
'Gaji berhasil dibayar.',
|
||||
'admin.finance.payroll-periods.show',
|
||||
parameters: ['payroll_period' => $payroll->payroll_period_id]
|
||||
@ -26,7 +26,7 @@ public function pay(Payroll $payroll): RedirectResponse
|
||||
public function cancel(Payroll $payroll): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->cancel($payroll),
|
||||
fn() => $this->service->cancel($payroll),
|
||||
'Gaji berhasil dibatalkan.',
|
||||
'admin.finance.payroll-periods.show',
|
||||
parameters: ['payroll_period' => $payroll->payroll_period_id]
|
||||
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Finance;
|
||||
namespace App\Http\Controllers\Admin\Finance\Payroll;
|
||||
|
||||
use App\Enums\PayrollPeriodStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\PaginatedRequest;
|
||||
use App\Models\PayrollPeriod;
|
||||
@ -26,29 +25,22 @@ public function index(PaginatedRequest $request): Response
|
||||
|
||||
public function current(): RedirectResponse
|
||||
{
|
||||
$now = now();
|
||||
|
||||
$period = PayrollPeriod::firstOrCreate(
|
||||
['year' => $now->year, 'month' => $now->month],
|
||||
['status' => PayrollPeriodStatus::OPEN]
|
||||
);
|
||||
$period = $this->service->getCurrentOrCreate();
|
||||
|
||||
return to_route('admin.finance.payroll-periods.show', ['payroll_period' => $period->id]);
|
||||
}
|
||||
|
||||
public function show(PayrollPeriod $payrollPeriod): Response
|
||||
{
|
||||
$period = $this->service->getDetail($payrollPeriod);
|
||||
|
||||
return Inertia::render('admin/finance/payroll-period/show', [
|
||||
'payrollPeriod' => $period,
|
||||
'payrollPeriod' => $this->service->getDetail($payrollPeriod),
|
||||
]);
|
||||
}
|
||||
|
||||
public function close(PayrollPeriod $payrollPeriod): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->close($payrollPeriod),
|
||||
fn() => $this->service->close($payrollPeriod),
|
||||
'Periode gaji berhasil ditutup.',
|
||||
'admin.finance.payroll-periods.index'
|
||||
);
|
||||
@ -57,7 +49,7 @@ public function close(PayrollPeriod $payrollPeriod): RedirectResponse
|
||||
public function reopen(PayrollPeriod $payrollPeriod): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->reopen($payrollPeriod),
|
||||
fn() => $this->service->reopen($payrollPeriod),
|
||||
'Periode gaji berhasil dibuka kembali.',
|
||||
'admin.finance.payroll-periods.index'
|
||||
);
|
||||
@ -6,7 +6,6 @@
|
||||
use App\Http\Requests\Admin\HR\AttendanceRequest;
|
||||
use App\Models\Attendance;
|
||||
use App\Services\Admin\HR\AttendanceService;
|
||||
use App\Settings\HRSettings;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
@ -22,44 +21,9 @@ public function index(Request $request): Response
|
||||
{
|
||||
$year = $request->integer('year', now()->year);
|
||||
$month = $request->integer('month', now()->month);
|
||||
$hrSettings = app(HRSettings::class);
|
||||
$user = auth()->user();
|
||||
$isAdmin = $user->hasAnyRole(['developer', 'owner']);
|
||||
|
||||
if ($isAdmin) {
|
||||
return Inertia::render('admin/hr/attendance/index', [
|
||||
'attendances' => $this->service->getByMonth($year, $month),
|
||||
'leaves' => $this->service->getLeavesByMonth($year, $month),
|
||||
'employees' => $this->service->getAllEmployees(),
|
||||
'todayAttendance' => null,
|
||||
'currentYear' => $year,
|
||||
'currentMonth' => $month,
|
||||
'monthStats' => $this->service->getMonthStats($year, $month),
|
||||
'hrSettings' => [
|
||||
'scheduled_check_in_time' => $hrSettings->scheduled_check_in_time,
|
||||
'scheduled_check_out_time' => $hrSettings->scheduled_check_out_time,
|
||||
],
|
||||
'isAdmin' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
$employeeId = $user->employee?->id;
|
||||
$isOnLeave = $this->service->isOnLeave($user);
|
||||
|
||||
return Inertia::render('admin/hr/attendance/index', [
|
||||
'attendances' => $this->service->getByMonth($year, $month, $employeeId),
|
||||
'leaves' => $this->service->getLeavesByMonth($year, $month, $employeeId),
|
||||
'todayAttendance' => $this->service->getToday(),
|
||||
'currentYear' => $year,
|
||||
'currentMonth' => $month,
|
||||
'monthStats' => $this->service->getMonthStats($year, $month, $employeeId),
|
||||
'hrSettings' => [
|
||||
'scheduled_check_in_time' => $hrSettings->scheduled_check_in_time,
|
||||
'scheduled_check_out_time' => $hrSettings->scheduled_check_out_time,
|
||||
],
|
||||
'isOnLeave' => $isOnLeave,
|
||||
'canCheckIn' => $user->employee !== null,
|
||||
'isAdmin' => false,
|
||||
...$this->service->getIndexData($year, $month),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -7,15 +7,16 @@
|
||||
use App\Http\Requests\PaginatedRequest;
|
||||
use App\Models\User;
|
||||
use App\Services\Admin\HR\EmployeeService;
|
||||
use App\Services\Admin\Settings\RoleService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private EmployeeService $service
|
||||
private EmployeeService $service,
|
||||
private RoleService $roleService,
|
||||
) {}
|
||||
|
||||
public function index(PaginatedRequest $request): Response
|
||||
@ -32,14 +33,8 @@ public function index(PaginatedRequest $request): Response
|
||||
|
||||
public function create(): Response
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return Inertia::render('admin/hr/employee/create', [
|
||||
'roles' => $this->service->canViewAll()
|
||||
? Role::where('name', '!=', 'Developer')
|
||||
->when($this->service->shouldHideAdminBahanBaku(), fn ($q) => $q->where('name', '!=', 'admin-bahan-baku'))
|
||||
->get(['id', 'name'])
|
||||
: Role::where('name', '=', $user->roles->first()?->name)->get(['id', 'name']),
|
||||
'roles' => $this->roleService->getForEmployee(),
|
||||
'canViewAll' => $this->service->canViewAll(),
|
||||
]);
|
||||
}
|
||||
@ -47,7 +42,7 @@ public function create(): Response
|
||||
public function store(EmployeeRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($request->validated()),
|
||||
fn() => $this->service->create($request->validated()),
|
||||
'Pegawai berhasil ditambahkan.',
|
||||
'admin.hr.employees.index'
|
||||
);
|
||||
@ -59,9 +54,7 @@ public function edit(User $user): Response
|
||||
|
||||
return Inertia::render('admin/hr/employee/edit', [
|
||||
'employee' => $user,
|
||||
'roles' => Role::where('name', '!=', 'Developer')
|
||||
->when($this->service->shouldHideAdminBahanBaku(), fn ($q) => $q->where('name', '!=', 'admin-bahan-baku'))
|
||||
->get(['id', 'name']),
|
||||
'roles' => $this->roleService->getForEmployee(),
|
||||
'canViewAll' => $this->service->canViewAll(),
|
||||
]);
|
||||
}
|
||||
@ -69,7 +62,7 @@ public function edit(User $user): Response
|
||||
public function update(EmployeeRequest $request, User $user): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->update($user, $request->validated()),
|
||||
fn() => $this->service->update($user, $request->validated()),
|
||||
'Pegawai berhasil diperbarui.',
|
||||
'admin.hr.employees.index'
|
||||
);
|
||||
@ -78,7 +71,7 @@ public function update(EmployeeRequest $request, User $user): RedirectResponse
|
||||
public function destroy(User $user): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->delete($user),
|
||||
fn() => $this->service->delete($user),
|
||||
'Pegawai berhasil dihapus.',
|
||||
'admin.hr.employees.index'
|
||||
);
|
||||
@ -91,13 +84,13 @@ public function toggleActive(User $user): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => "Pegawai berhasil {$status}."]);
|
||||
|
||||
return to_route('admin.hr.employees.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function resetPassword(User $user): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->resetPassword($user),
|
||||
fn() => $this->service->resetPassword($user),
|
||||
'Kata sandi pegawai berhasil direset ke kata sandi default.',
|
||||
'admin.hr.employees.index'
|
||||
);
|
||||
|
||||
@ -42,7 +42,7 @@ public function create(): Response
|
||||
public function store(TransactionRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($request->validated()),
|
||||
fn() => $this->service->create($request->validated()),
|
||||
'Transaksi berhasil ditambahkan.',
|
||||
'admin.manage.transactions.index',
|
||||
'admin.manage.transactions.create'
|
||||
@ -60,7 +60,7 @@ public function edit(Order $transaction): Response
|
||||
public function update(TransactionRequest $request, Order $transaction): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->update($transaction, $request->validated()),
|
||||
fn() => $this->service->update($transaction, $request->validated()),
|
||||
'Transaksi berhasil diperbarui.',
|
||||
'admin.manage.transactions.index',
|
||||
'admin.manage.transactions.edit',
|
||||
@ -71,7 +71,7 @@ public function update(TransactionRequest $request, Order $transaction): Redirec
|
||||
public function destroy(Order $transaction): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->delete($transaction),
|
||||
fn() => $this->service->delete($transaction),
|
||||
'Transaksi berhasil dihapus.',
|
||||
'admin.manage.transactions.index'
|
||||
);
|
||||
@ -80,7 +80,7 @@ public function destroy(Order $transaction): RedirectResponse
|
||||
public function updateStatus(Order $transaction): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->updateStatus($transaction, request('status')),
|
||||
fn() => $this->service->updateStatus($transaction, request('status')),
|
||||
'Status transaksi berhasil diperbarui.',
|
||||
'admin.manage.transactions.index'
|
||||
);
|
||||
|
||||
@ -30,7 +30,7 @@ public function store(CategoryRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kategori berhasil ditambahkan.']);
|
||||
|
||||
return to_route('admin.master.categories.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function update(CategoryRequest $request, Category $category): RedirectResponse
|
||||
@ -39,7 +39,7 @@ public function update(CategoryRequest $request, Category $category): RedirectRe
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kategori berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.master.categories.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function destroy(Category $category): RedirectResponse
|
||||
@ -48,6 +48,6 @@ public function destroy(Category $category): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kategori berhasil dihapus.']);
|
||||
|
||||
return to_route('admin.master.categories.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public function store(CustomerRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Customer berhasil ditambahkan.']);
|
||||
|
||||
return to_route('admin.master.customers.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function update(CustomerRequest $request, Customer $customer): RedirectResponse
|
||||
@ -39,7 +39,7 @@ public function update(CustomerRequest $request, Customer $customer): RedirectRe
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Customer berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.master.customers.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function destroy(Customer $customer): RedirectResponse
|
||||
@ -48,6 +48,6 @@ public function destroy(Customer $customer): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Customer berhasil dihapus.']);
|
||||
|
||||
return to_route('admin.master.customers.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public function create(): Response
|
||||
public function store(ProductRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($request->validated()),
|
||||
fn() => $this->service->create($request->validated()),
|
||||
'Produk berhasil ditambahkan.',
|
||||
'admin.master.products.index',
|
||||
'admin.master.products.create'
|
||||
@ -60,7 +60,7 @@ public function edit(Product $product): Response
|
||||
public function update(ProductRequest $request, Product $product): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->update($product, $request->validated()),
|
||||
fn() => $this->service->update($product, $request->validated()),
|
||||
'Produk berhasil diperbarui.',
|
||||
'admin.master.products.index',
|
||||
'admin.master.products.edit',
|
||||
@ -71,7 +71,7 @@ public function update(ProductRequest $request, Product $product): RedirectRespo
|
||||
public function destroy(Product $product): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->delete($product),
|
||||
fn() => $this->service->delete($product),
|
||||
'Produk berhasil dihapus.',
|
||||
'admin.master.products.index'
|
||||
);
|
||||
@ -84,7 +84,7 @@ public function toggleStatus(Product $product): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => "Status produk berhasil diubah menjadi {$status->label()}."]);
|
||||
|
||||
return to_route('admin.master.products.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function approve(Product $product): RedirectResponse
|
||||
@ -93,7 +93,7 @@ public function approve(Product $product): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Produk berhasil disetujui.']);
|
||||
|
||||
return to_route('admin.master.products.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function reject(Product $product): RedirectResponse
|
||||
@ -103,7 +103,7 @@ public function reject(Product $product): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Produk berhasil ditolak.']);
|
||||
|
||||
return to_route('admin.master.products.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function resubmit(Product $product): RedirectResponse
|
||||
@ -112,6 +112,6 @@ public function resubmit(Product $product): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Produk berhasil diajukan ulang.']);
|
||||
|
||||
return to_route('admin.master.products.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,8 +18,6 @@ public function __construct(
|
||||
|
||||
public function index(StockMutationRequest $request, Product $product, ProductVariant $variant): Response
|
||||
{
|
||||
$perPage = $request->validatedWithDefaults()['perPage'];
|
||||
|
||||
return Inertia::render('admin/master/product/variant/stock-mutations', [
|
||||
'product' => [
|
||||
'id' => $product->id,
|
||||
@ -29,7 +27,7 @@ public function index(StockMutationRequest $request, Product $product, ProductVa
|
||||
'id' => $variant->id,
|
||||
'name' => $variant->name,
|
||||
],
|
||||
'mutations' => $this->service->paginated($variant, $perPage),
|
||||
'mutations' => $this->service->paginated($variant, ...$request->validatedWithDefaults()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public function create(): Response
|
||||
public function store(RawMaterialRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($request->validated()),
|
||||
fn() => $this->service->create($request->validated()),
|
||||
'Bahan baku berhasil ditambahkan.',
|
||||
'admin.master.raw-materials.index',
|
||||
'admin.master.raw-materials.create'
|
||||
@ -53,7 +53,7 @@ public function edit(RawMaterial $rawMaterial): Response
|
||||
public function update(RawMaterialRequest $request, RawMaterial $rawMaterial): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->update($rawMaterial, $request->validated()),
|
||||
fn() => $this->service->update($rawMaterial, $request->validated()),
|
||||
'Bahan baku berhasil diperbarui.',
|
||||
'admin.master.raw-materials.index',
|
||||
'admin.master.raw-materials.edit',
|
||||
@ -64,7 +64,7 @@ public function update(RawMaterialRequest $request, RawMaterial $rawMaterial): R
|
||||
public function destroy(RawMaterial $rawMaterial): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->delete($rawMaterial),
|
||||
fn() => $this->service->delete($rawMaterial),
|
||||
'Bahan baku berhasil dihapus.',
|
||||
'admin.master.raw-materials.index'
|
||||
);
|
||||
@ -77,6 +77,6 @@ public function toggleStatus(RawMaterial $rawMaterial): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => "Status bahan baku berhasil diubah menjadi {$status}."]);
|
||||
|
||||
return to_route('admin.master.raw-materials.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public function store(SupplierRequest $request): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Supplier berhasil ditambahkan.']);
|
||||
|
||||
return to_route('admin.master.suppliers.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function update(SupplierRequest $request, Supplier $supplier): RedirectResponse
|
||||
@ -39,7 +39,7 @@ public function update(SupplierRequest $request, Supplier $supplier): RedirectRe
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Supplier berhasil diperbarui.']);
|
||||
|
||||
return to_route('admin.master.suppliers.index');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function destroy(Supplier $supplier): RedirectResponse
|
||||
@ -48,6 +48,6 @@ public function destroy(Supplier $supplier): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Supplier berhasil dihapus.']);
|
||||
|
||||
return to_route('admin.master.suppliers.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public function create(): Response
|
||||
public function store(RoleRequest $request): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->create($request->validated()),
|
||||
fn() => $this->service->create($request->validated()),
|
||||
'Role berhasil ditambahkan.',
|
||||
'admin.settings.roles.index'
|
||||
);
|
||||
@ -43,7 +43,7 @@ public function store(RoleRequest $request): RedirectResponse
|
||||
public function edit(Role $role): Response
|
||||
{
|
||||
return Inertia::render('admin/roles/edit', [
|
||||
'role' => $this->service->getById($role->id),
|
||||
'role' => $role->load('permissions'),
|
||||
'permissions' => $this->service->getPermissionsByModule(),
|
||||
]);
|
||||
}
|
||||
@ -51,7 +51,7 @@ public function edit(Role $role): Response
|
||||
public function update(RoleRequest $request, Role $role): RedirectResponse
|
||||
{
|
||||
return $this->handleAction(
|
||||
fn () => $this->service->update($role, $request->validated()),
|
||||
fn() => $this->service->update($role, $request->validated()),
|
||||
'Role berhasil diperbarui.',
|
||||
'admin.settings.roles.index'
|
||||
);
|
||||
@ -63,6 +63,6 @@ public function destroy(Role $role): RedirectResponse
|
||||
|
||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Role berhasil dihapus.']);
|
||||
|
||||
return to_route('admin.settings.roles.index');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
use App\Http\Controllers\Admin\Finance\CashAccountController;
|
||||
use App\Http\Controllers\Admin\Finance\EmployeeAdvanceController;
|
||||
use App\Http\Controllers\Admin\Finance\ExpenseController;
|
||||
use App\Http\Controllers\Admin\Finance\PayrollAdjustmentController;
|
||||
use App\Http\Controllers\Admin\Finance\PayrollController;
|
||||
use App\Http\Controllers\Admin\Finance\PayrollPeriodController;
|
||||
use App\Http\Controllers\Admin\Finance\Payroll\PayrollAdjustmentController;
|
||||
use App\Http\Controllers\Admin\Finance\Payroll\PayrollController;
|
||||
use App\Http\Controllers\Admin\Finance\Payroll\PayrollPeriodController;
|
||||
use App\Http\Controllers\Admin\HR\AttendanceController;
|
||||
use App\Http\Controllers\Admin\HR\EmployeeController;
|
||||
use App\Http\Controllers\Admin\HR\LeaveRequestController;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user