add budgets

This commit is contained in:
Jagad R R
2025-01-07 17:23:42 +07:00
parent 8c62fb6a19
commit 1027b0dfb4
24 changed files with 868 additions and 36 deletions
@@ -0,0 +1,107 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Transfer Budgets</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('budget_control.store') }}" enctype="multipart/form-data">
@csrf
@include('backend.layouts.partials.messages')
<div class="row">
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Periode Bulan <span class="font-italic font-weight-normal">(required)</span></label>
<select class="form-control form-control-md" name="periode_month" required>
<option value="">Pilih Bulan</option>
<option value="january" {{ old('periode_month') == 1 ? 'selected' : '' }}>Januari</option>
<option value="february" {{ old('periode_month') == 2 ? 'selected' : '' }}>Februari</option>
<option value="march" {{ old('periode_month') == 3 ? 'selected' : '' }}>Maret</option>
<option value="april" {{ old('periode_month') == 4 ? 'selected' : '' }}>April</option>
<option value="may" {{ old('periode_month') == 5 ? 'selected' : '' }}>Mei</option>
<option value="june" {{ old('periode_month') == 6 ? 'selected' : '' }}>Juni</option>
<option value="july" {{ old('periode_month') == 7 ? 'selected' : '' }}>Juli</option>
<option value="august" {{ old('periode_month') == 8 ? 'selected' : '' }}>Agustus</option>
<option value="september" {{ old('periode_month') == 9 ? 'selected' : '' }}>September</option>
<option value="october" {{ old('periode_month') == 10 ? 'selected' : '' }}>Oktober</option>
<option value="november" {{ old('periode_month') == 11 ? 'selected' : '' }}>November</option>
<option value="december" {{ old('periode_month') == 12 ? 'selected' : '' }}>Desember</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Periode Tahun <span class="font-italic font-weight-normal">(required)</span></label>
<select class="form-control form-control-md" name="periode_year" required>
<option value="">Pilih Tahun</option>
{{-- get current year and one year after --}}
@for ($i = date('Y'); $i <= date('Y') + 1; $i++)
<option value="{{ $i }}" {{ old('periode_year') == $i ? 'selected' : '' }}>{{ $i }}</option>
@endfor
</select>
</div>
<div class="mb-3">
<label class="form-label">Penerima <span class="font-italic font-weight-normal">(required)</span></label>
<select class="form-control form-control-md" name="receiver_id" required>
<option value="">Pilih Receiver</option>
@foreach ($users as $receiver)
<option value="{{ $receiver->id }}" {{ old('receiver_id') == $receiver->id ? 'selected' : '' }}>
{{ $receiver->name }} ({{ $receiver->cabang->cabang->name }})
</option>
@endforeach
</select>
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Amount <span class="font-italic font-weight-normal">(required)</span></label>
<input type="text" class="form-control" name="amount" id="amount" required value="{{ old('amount') }}">
</div>
<div class="mb-3">
<label class="form-label">Remarks <span class="font-italic font-weight-normal">(optional)</span></label>
<textarea class="form-control" name="remarks">{{ old('remarks') }}</textarea>
</div>
<div class="mb-3">
<label class="form-label">Tanggal Closing <span class="font-italic font-weight-normal">(required)</span></label>
<input type="datetime-local" class="form-control" name="closing_at" id="closing_at" required value="{{ old('closing_at') }}">
</div>
</div>
<button type="submit" class="btn btn-primary ml-2">Submit</button>
</div>
</form>
</div>
</div>
</div>
</section>
<script>
new AutoNumeric('#amount', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
</script>
@endsection
@@ -0,0 +1,150 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Active Budgets</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 col-6">
<div class="small-box bg-info">
<div class="inner">
<h3>Rp {{ number_format($data->whereIn('status', 'Assigned')->sum('amount'), 0, ',', '.') }}</h3>
<p>Total Budget Bulan Ini</p>
</div>
<div class="icon">
<i class="fas fa-wallet"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-6">
<div class="small-box bg-success">
<div class="inner">
<h3>Rp {{ number_format($availableBudget, 0, ',', '.') }}</h3>
<p>Total Budget Tersedia</p>
</div>
<div class="icon">
<i class="fas fa-check-circle"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-6">
<div class="small-box bg-danger">
<div class="inner">
<h3 class="text-white">Rp {{ number_format($usedBudget, 0, ',', '.') }}</h3>
<p class="text-white">Total Budget Terpakai</p>
</div>
<div class="icon">
<i class="fas fa-times"></i>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">Current Active Budget</h4>
<p class="float-right mb-2">
@if (auth()->user()->can('budget_control.create'))
<a class="btn btn-primary text-white" href="{{ route('budget_control.create') }}">
Add New Budget
</a>
@endif
</p>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Penerima</th>
<th>Cabang</th>
<th>Pengirim</th>
<th>Total</th>
<th>Keterangan</th>
<th>Periode</th>
<th>Tanggal Closing</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($data as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->receiver->name }}</td>
<td>{{ $item->cabang->name }}</td>
<td>{{ $item->sender->name }}</td>
<td>{{ number_format($item->amount, 0, ',', '.') }}</td>
<td>{{ $item->remarks }}</td>
<td>{{ strtoupper($item->periode_month) }} {{ $item->periode_year }}</td>
<td>{{ \Carbon\Carbon::parse($item->closing_at)->locale('id')->isoFormat('D MMMM Y H:mm') }}</td>
<td>
@if ($item->status == 'Unassigned')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Assigned')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
<td>
@if (auth()->user()->can('budget_control.delete'))
<form action="{{ route('budget_control.destroy', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this item?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print']
});
}
});
</script>
@endsection
@@ -0,0 +1,92 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Log Transfer Budgets</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">Log Transfer Budgets</h4>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Penerima</th>
<th>Cabang</th>
<th>Pengirim</th>
<th>Total</th>
<th>Keterangan</th>
<th>Periode</th>
<th>Tanggal Closing</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($data as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->receiver->name }}</td>
<td>{{ $item->cabang->name }}</td>
<td>{{ $item->sender->name }}</td>
<td>{{ number_format($item->amount, 0, ',', '.') }}</td>
<td>{{ $item->remarks }}</td>
<td>{{ strtoupper($item->periode_month) }} {{ $item->periode_year }}</td>
<td>{{ \Carbon\Carbon::parse($item->closing_at)->locale('id')->isoFormat('D MMMM Y H:mm') }}</td>
<td>
@if ($item->status == 'Unassigned')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Assigned')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print']
});
}
});
</script>
@endsection