feat(expense): crud,roite model binding, custom js untuk modal, membuat observer untuk penghapusan gambar menambahkan kolom use_cash dan menyesuaikan css nya untuk input radio
This commit is contained in:
parent
dcad080e97
commit
1cfed062dd
102
app/Http/Controllers/Admin/Finance/ExpenseController.php
Normal file
102
app/Http/Controllers/Admin/Finance/ExpenseController.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin\Finance;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Admin\Finance\ExpenseRequest;
|
||||||
|
use App\Models\Barbershop;
|
||||||
|
use App\Models\Expense;
|
||||||
|
use App\Traits\UploadAttachment;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class ExpenseController extends Controller
|
||||||
|
{
|
||||||
|
use UploadAttachment;
|
||||||
|
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
return view('pages.admin.finance.expenses', [
|
||||||
|
'pageTitle' => 'Pengeluaran',
|
||||||
|
'expenses' => Expense::latest()->get(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(ExpenseRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validatedData = $request->validated();
|
||||||
|
$barbershopId = Auth::user()->barbershop_id;
|
||||||
|
$barbershop = Barbershop::findOrFail($barbershopId);
|
||||||
|
|
||||||
|
if ($validatedData['use_cash'] === '1' && $barbershop->cash < $validatedData['amount']) {
|
||||||
|
notify()->error('Saldo kas tidak mencukupi', 'Gagal');
|
||||||
|
|
||||||
|
return back()->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($validatedData, $barbershop, $barbershopId) {
|
||||||
|
$newExpense = Expense::create(array_merge($validatedData, [
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'barbershop_id' => $barbershopId,
|
||||||
|
]));
|
||||||
|
|
||||||
|
if ($validatedData['use_cash'] === '1') {
|
||||||
|
$barbershop->decrement('cash', $validatedData['amount']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->uploadAttachment($validatedData['proof'], 'expenses', Expense::class, $newExpense->id);
|
||||||
|
});
|
||||||
|
|
||||||
|
notify()->success('Data berhasil ditambahkan', 'Berhasil');
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(ExpenseRequest $request, Expense $expense): RedirectResponse
|
||||||
|
{
|
||||||
|
$validatedData = $request->validated();
|
||||||
|
$barbershop = Barbershop::findOrFail($expense->barbershop_id);
|
||||||
|
|
||||||
|
$amountDifference = $validatedData['amount'] - $expense->amount;
|
||||||
|
|
||||||
|
if ($validatedData['use_cash'] === '1') {
|
||||||
|
$requiredCash = $barbershop->cash - ($amountDifference < 0 ? 0 : $amountDifference);
|
||||||
|
if ($requiredCash < 0) {
|
||||||
|
notify()->error('Saldo kas tidak mencukupi', 'Gagal');
|
||||||
|
|
||||||
|
return back()->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($validatedData, $expense, $barbershop) {
|
||||||
|
if ($expense->use_cash === '1') {
|
||||||
|
$barbershop->increment('cash', $expense->amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
$expense->update($validatedData);
|
||||||
|
|
||||||
|
if ($validatedData['use_cash'] === '1') {
|
||||||
|
$barbershop->decrement('cash', $validatedData['amount']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($validatedData['proof'])) {
|
||||||
|
$this->uploadAttachment($validatedData['proof'], 'expenses', Expense::class, $expense->id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
notify()->success('Data berhasil diperbarui', 'Berhasil');
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(Expense $expense): RedirectResponse
|
||||||
|
{
|
||||||
|
$expense->delete();
|
||||||
|
|
||||||
|
notify()->success('Data berhasil dihapus', 'Berhasil');
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,7 +33,7 @@ public function store(CustomerRequest $request): RedirectResponse
|
|||||||
|
|
||||||
notify()->success('Data berhasil ditambahkan', 'Berhasil');
|
notify()->success('Data berhasil ditambahkan', 'Berhasil');
|
||||||
|
|
||||||
return redirect('dashboard/master/customers');
|
return back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Customer $customer, CustomerRequest $request): RedirectResponse
|
public function update(Customer $customer, CustomerRequest $request): RedirectResponse
|
||||||
@ -44,7 +44,7 @@ public function update(Customer $customer, CustomerRequest $request): RedirectRe
|
|||||||
|
|
||||||
notify()->success('Data berhasil diubah', 'Berhasil');
|
notify()->success('Data berhasil diubah', 'Berhasil');
|
||||||
|
|
||||||
return redirect('dashboard/master/customers');
|
return back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(Customer $customer): RedirectResponse
|
public function delete(Customer $customer): RedirectResponse
|
||||||
|
|||||||
45
app/Http/Requests/Admin/Finance/ExpenseRequest.php
Normal file
45
app/Http/Requests/Admin/Finance/ExpenseRequest.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin\Finance;
|
||||||
|
|
||||||
|
use App\Traits\NotificationTrait;
|
||||||
|
use Illuminate\Contracts\Validation\Validator;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class ExpenseRequest extends FormRequest
|
||||||
|
{
|
||||||
|
use NotificationTrait;
|
||||||
|
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return Auth::check();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function prepareForValidation(): void
|
||||||
|
{
|
||||||
|
$this->merge([
|
||||||
|
'amount' => removeRupiahFormatting($this->amount),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
$isEdit = $this->isMethod('put');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => ['required', 'string', 'max:100'],
|
||||||
|
'amount' => ['required', 'numeric', 'min:0', 'max:99999999.99'],
|
||||||
|
'proof' => $isEdit
|
||||||
|
? ['nullable', 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048']
|
||||||
|
: ['required', 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048'],
|
||||||
|
'use_cash' => ['required', Rule::in(['1', '2'])],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function failedValidation(Validator $validator): void
|
||||||
|
{
|
||||||
|
$this->handleValidationFailure($validator);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Observers\ExpenseObserver;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
#[ObservedBy([ExpenseObserver::class])]
|
||||||
class Expense extends Model
|
class Expense extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes;
|
use HasFactory, SoftDeletes;
|
||||||
@ -17,6 +20,7 @@ class Expense extends Model
|
|||||||
'barbershop_id',
|
'barbershop_id',
|
||||||
'name',
|
'name',
|
||||||
'amount',
|
'amount',
|
||||||
|
'use_cash',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
|
|||||||
51
app/Observers/ExpenseObserver.php
Normal file
51
app/Observers/ExpenseObserver.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Models\Expense;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class ExpenseObserver
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the Expense "created" event.
|
||||||
|
*/
|
||||||
|
public function created(Expense $expense): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Expense "updated" event.
|
||||||
|
*/
|
||||||
|
public function updated(Expense $expense): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Expense "deleting" event.
|
||||||
|
*/
|
||||||
|
public function deleting(Expense $expense): void
|
||||||
|
{
|
||||||
|
if ($expense->attachment && $expense->attachment->formatted_attachment) {
|
||||||
|
Storage::delete("expenses/{$expense->attachment->formatted_attachment}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Expense "restored" event.
|
||||||
|
*/
|
||||||
|
public function restored(Expense $expense): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Expense "force deleted" event.
|
||||||
|
*/
|
||||||
|
public function forceDeleted(Expense $expense): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Barbershop;
|
use App\Models\Barbershop;
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
|
use App\Models\Expense;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
@ -28,5 +29,6 @@ public function boot(): void
|
|||||||
Route::bind('user', fn (string $user) => User::findOrFail(decryptId($user)));
|
Route::bind('user', fn (string $user) => User::findOrFail(decryptId($user)));
|
||||||
Route::bind('customer', fn (string $customer) => Customer::findOrFail(decryptId($customer)));
|
Route::bind('customer', fn (string $customer) => Customer::findOrFail(decryptId($customer)));
|
||||||
Route::bind('service', fn (string $service) => Service::findOrFail(decryptId($service)));
|
Route::bind('service', fn (string $service) => Service::findOrFail(decryptId($service)));
|
||||||
|
Route::bind('expense', fn (string $expense) => Expense::findOrFail(decryptId($expense)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public function up(): void
|
|||||||
$table->foreignId('barbershop_id')->constrained('barbershop')->cascadeOnDelete();
|
$table->foreignId('barbershop_id')->constrained('barbershop')->cascadeOnDelete();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->decimal('amount', 10, 2);
|
$table->decimal('amount', 10, 2);
|
||||||
|
$table->enum('use_cash', ['1', '2'])->default('2')->comment('1:Yes 2:No');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9895,7 +9895,7 @@ .custom-input .invalid-feedback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.custom-input .form-check .form-check-input:valid {
|
.custom-input .form-check .form-check-input:valid {
|
||||||
border-color: #54BA4A;
|
/* border-color: #54BA4A; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-input .form-check .form-check-input:invalid {
|
.custom-input .form-check .form-check-input:invalid {
|
||||||
@ -9911,7 +9911,7 @@ .custom-input .form-check .form-check-input:valid~.form-check-label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.custom-input .form-check .form-check-input:checked {
|
.custom-input .form-check .form-check-input:checked {
|
||||||
background-color: #54BA4A;
|
/* background-color: #54BA4A; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-input .form-check .invalid-feedback {
|
.custom-input .form-check .invalid-feedback {
|
||||||
@ -10097,7 +10097,7 @@ .checkbox-wrapper {
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: calc(8px + 8 * (100vw - 320px) / 1600);
|
gap: calc(8px + 8 * (100vw - 320px) / 1600);
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
/* justify-content: center; */
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
|
|||||||
33
public/assets/admin/js/custom/expense.js
Normal file
33
public/assets/admin/js/custom/expense.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
$(document).ready(function () {
|
||||||
|
$("#createModal").on("show.bs.modal", function (event) {
|
||||||
|
const button = $(event.relatedTarget);
|
||||||
|
const data = {
|
||||||
|
modalTitle: button.data("modal-title"),
|
||||||
|
url: button.data("url"),
|
||||||
|
method: button.data("method"),
|
||||||
|
|
||||||
|
name: button.data("name"),
|
||||||
|
amount: button.data("amount"),
|
||||||
|
useCash: button.data("use-cash"),
|
||||||
|
};
|
||||||
|
|
||||||
|
$(".modal-title").text(data.modalTitle);
|
||||||
|
$("#form").attr('action', data.url);
|
||||||
|
$("#form-method").val(data.method);
|
||||||
|
|
||||||
|
if (data.method === 'put') {
|
||||||
|
$("#name").val(data.name);
|
||||||
|
$("#amount").val(data.amount);
|
||||||
|
$(`input[name="use_cash"][value="${data.useCash}"]`).prop("checked", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#createModal').on('hidden.bs.modal', function () {
|
||||||
|
const method = $("#form-method").val();
|
||||||
|
if (method === 'put') {
|
||||||
|
$("#name").val('');
|
||||||
|
$("#amount").val('');
|
||||||
|
$('input[name="use_cash"]').prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
181
resources/views/pages/admin/finance/expenses.blade.php
Normal file
181
resources/views/pages/admin/finance/expenses.blade.php
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
@extends('layouts.admin')
|
||||||
|
@section('styles')
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ asset('assets/admin/css/vendors/datatables.css') }}">
|
||||||
|
@endsection
|
||||||
|
@section('app')
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="display" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Nama</th>
|
||||||
|
<th>Jumlah</th>
|
||||||
|
<th>Bukti</th>
|
||||||
|
<th>Tanggal</th>
|
||||||
|
<th>Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($expenses as $expense)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $expense->name }}</td>
|
||||||
|
<td>{{ formatToRupiah($expense->amount) ?? '-' }}</td>
|
||||||
|
<td>
|
||||||
|
@if ($expense->attachment && $expense->attachment->formatted_attachment)
|
||||||
|
<a
|
||||||
|
href="{{ Storage::url("expenses/{$expense->attachment->formatted_attachment}") }}">
|
||||||
|
<img src="{{ Storage::url("expenses/{$expense->attachment->formatted_attachment}") }}"
|
||||||
|
alt="{{ $expense->name }}" width="77" height="77">
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="{{ asset('assets/images/no-imge.png') }}">
|
||||||
|
<img src="{{ asset('assets/images/no-imge.png') }}"
|
||||||
|
alt="Default Image" style="width: 77px; height: 77px">
|
||||||
|
</a>
|
||||||
|
@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>
|
||||||
|
</a>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-labelledby="createModal"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"></h5>
|
||||||
|
<button class="btn-close py-0" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form class="row g-3 custom-input" method="post" id="form" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="_method" id="form-method">
|
||||||
|
@csrf
|
||||||
|
<div class="col-lg-12 position-relative">
|
||||||
|
<label class="form-label" for="name">Nama</label>
|
||||||
|
<input name="name" class="form-control @error('name') is-invalid @enderror"
|
||||||
|
id="name" type="text" placeholder="Masukan Nama" value="{{ old('name') }}">
|
||||||
|
@error('name')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 position-relative">
|
||||||
|
<label class="form-label" for="amount">Jumlah</label>
|
||||||
|
<input name="amount"
|
||||||
|
class="form-control rupiah-format @error('amount') is-invalid @enderror" id="amount"
|
||||||
|
type="text" placeholder="Masukan Jumlah" value="{{ old('amount') }}"
|
||||||
|
inputmode="numeric">
|
||||||
|
@error('amount')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 position-relative">
|
||||||
|
<label class="form-label" for="use_cash">Gunakan Kas</label>
|
||||||
|
<div class="form-check radio ps-0">
|
||||||
|
<ul class="radio-wrapper">
|
||||||
|
<li>
|
||||||
|
<input class="form-check-input" id="radio-yes" type="radio" name="use_cash"
|
||||||
|
value="1" @checked(old('use_cash') == '1')>
|
||||||
|
<label class="form-check-label" for="radio-yes">
|
||||||
|
<i data-feather="check"></i>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input class="form-check-input" id="radio-no" type="radio"
|
||||||
|
name="use_cash" value="2" @checked(old('use_cash') == '2')>
|
||||||
|
<label class="form-check-label" for="radio-no">
|
||||||
|
<i data-feather="x"></i>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@error('use_cash')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 position-relative">
|
||||||
|
<label class="form-label" for="proof">Bukti
|
||||||
|
<span class="form-span"><i>(.jpeg,.png,.jpg,.gif,.svg)</i></span>
|
||||||
|
</label>
|
||||||
|
<input name="proof" class="form-control @error('proof') is-invalid @enderror"
|
||||||
|
id="proof" type="file" value="{{ old('proof') }}"
|
||||||
|
accept="image/jpeg,image/png,image/jpg,image/gif,image/svg">
|
||||||
|
@error('proof')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 position-relative">
|
||||||
|
<button class="btn btn-secondary" type="button" data-bs-dismiss="modal">Tutup</button>
|
||||||
|
<button class="btn btn-primary">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
@section('afterScripts')
|
||||||
|
<script src="{{ asset('assets/admin/js/datatable/jquery.dataTables.min.js?ver=1.0.0') }}"></script>
|
||||||
|
<script src="{{ asset('assets/admin/js/datatable/client-side.js?ver=1.0.0') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/interactions/confirmation.js?ver=1.0.0') }}"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<script src="{{ asset('assets/admin/js/custom/expense.js?ver=1.0.0') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/forms/rupiah-format.js?ver=1.0.0') }}"></script>
|
||||||
|
@endsection
|
||||||
@ -82,6 +82,18 @@
|
|||||||
<span>Layanan</span>
|
<span>Layanan</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<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>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-arrow" id="right-arrow"><i data-feather="arrow-right"></i></div>
|
<div class="right-arrow" id="right-arrow"><i data-feather="arrow-right"></i></div>
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use App\Http\Controllers\Admin\Auth\LoginController;
|
use App\Http\Controllers\Admin\Auth\LoginController;
|
||||||
use App\Http\Controllers\Admin\Dashboard\OverviewController;
|
use App\Http\Controllers\Admin\Dashboard\OverviewController;
|
||||||
|
use App\Http\Controllers\Admin\Finance\ExpenseController;
|
||||||
use App\Http\Controllers\Admin\Master\BarbershopController;
|
use App\Http\Controllers\Admin\Master\BarbershopController;
|
||||||
use App\Http\Controllers\Admin\Master\CustomerController;
|
use App\Http\Controllers\Admin\Master\CustomerController;
|
||||||
use App\Http\Controllers\Admin\Master\ServiceController;
|
use App\Http\Controllers\Admin\Master\ServiceController;
|
||||||
@ -59,4 +60,13 @@
|
|||||||
Route::delete('delete/{service}', [ServiceController::class, 'delete'])->name('master.service.delete');
|
Route::delete('delete/{service}', [ServiceController::class, 'delete'])->name('master.service.delete');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('finance')->group(function () {
|
||||||
|
Route::get('/expenses', [ExpenseController::class, 'index'])->name('finance.expenses');
|
||||||
|
Route::prefix('expense')->group(function () {
|
||||||
|
Route::post('store', [ExpenseController::class, 'store'])->name('finance.expense.store');
|
||||||
|
Route::put('update/{expense}', [ExpenseController::class, 'update'])->name('finance.expense.update');
|
||||||
|
Route::delete('delete/{expense}', [ExpenseController::class, 'delete'])->name('finance.expense.delete');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user