feat: menambahkan card baru di ikhtisar untuk setor uang
This commit is contained in:
parent
47277d18e5
commit
04676604c6
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Barbershop;
|
||||
use App\Models\DepositMoney;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Payroll;
|
||||
use App\Models\Transaction;
|
||||
@ -48,6 +49,10 @@ public function index()
|
||||
|
||||
$todayExpense = Expense::query()->barbershop()->today()->sum('amount');
|
||||
$yesterdayExpense = Expense::query()->barbershop()->yesterday()->sum('amount');
|
||||
|
||||
$todayDepositMoney = DepositMoney::query()->barbershop()->today()->sum('amount');
|
||||
$yesterdayDepositMoney = DepositMoney::query()->barbershop()->yesterday()->sum('amount');
|
||||
|
||||
$todayPayroll = Payroll::query()->barbershop()->today()->sum('total');
|
||||
$yesterdayPayroll = Payroll::query()->barbershop()->yesterday()->sum('amount');
|
||||
|
||||
@ -104,6 +109,8 @@ public function index()
|
||||
'todayShaving' => $todayShaving,
|
||||
'yesterdayShaving' => $yesterdayShaving,
|
||||
'todayExpense' => $todayExpense + $todayPayroll,
|
||||
'todayDepositMoney' => $todayDepositMoney,
|
||||
'yesterdayDepositMoney' => $yesterdayDepositMoney,
|
||||
'yesterdayExpense' => $yesterdayExpense + $yesterdayPayroll,
|
||||
'todayNewCustomer' => $todayNewCustomer,
|
||||
'yesterdayNewCustomer' => $yesterdayNewCustomer,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@ -21,6 +22,16 @@ public function scopeBarbershop(Builder $query): Builder
|
||||
return $query->where('barbershop_id', Auth::user()->barbershop_id);
|
||||
}
|
||||
|
||||
public function scopeToday(Builder $query): Builder
|
||||
{
|
||||
return $query->whereDate('created_at', Carbon::today());
|
||||
}
|
||||
|
||||
public function scopeYesterday(Builder $query): Builder
|
||||
{
|
||||
return $query->whereDate('created_at', Carbon::yesterday());
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
||||
@ -82,6 +82,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="card small-widget">
|
||||
<div class="card-body primary">
|
||||
<span class="f-light">Setor Uang</span>
|
||||
<div class="d-flex align-items-end gap-1">
|
||||
<h4>{{ formatToRupiah($todayDepositMoney) }}</h4>
|
||||
<span class="font-primary f-12 f-w-500">
|
||||
<span>
|
||||
{{ formatToRupiah($yesterdayDepositMoney) }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="bg-gradient">
|
||||
<svg class="stroke-icon svg-fill">
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="col-6">
|
||||
<div class="card small-widget">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user