Merge branch 'main-gitea-akuncoa' of https://git.indoserv.net/wewmantap/resto-dhepot into mico
commit
5a4762c5e0
|
@ -1,52 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins;
|
||||
namespace App\Http\Controllers\Admins\Dashboard;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Kasir\Menu;
|
||||
use App\Models\MenuTerlarisView;
|
||||
use App\Models\Pengeluaran;
|
||||
use App\Models\Pesanan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class DashboardController extends Controller
|
||||
class CalculationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('pages.admin.dashboard');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-26 18:59:12
|
||||
* @Desc: Display Menu Terlaris
|
||||
*/
|
||||
|
||||
public function menuTerlaris()
|
||||
{
|
||||
|
||||
$data = MenuTerlarisView::where([['kategori_produk_id', '=', 2], ['tgl_start_promo', '=', null]])->get();
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function getCalculationPendapatan()
|
||||
{
|
||||
$pendapatanBulan = $this->calculatePendapatanBulan();
|
||||
$pendapatanMinggu = $this->calculatePendapatanMinggu();
|
||||
$pendapatanHari = $this->calculatePendapatanHari();
|
||||
$pengeluaranBulan = $this->calculatePengeluaranBulan();
|
||||
$pengeluaranHari = $this->calculatePengeluaranHari();
|
||||
|
||||
return ResponseFormatter::success(['pendapatanBulan' => $pendapatanBulan, 'pendapatanHari' => $pendapatanHari, 'pengeluaranBulan' => $pengeluaranBulan, 'pengeluaranHari' => $pengeluaranHari]);
|
||||
// dd($pendapatanMinggu);
|
||||
return ResponseFormatter::success(['pendapatanBulan' => $pendapatanBulan, 'pendapatanMinggu' => $pendapatanMinggu, 'pendapatanHari' => $pendapatanHari]);
|
||||
}
|
||||
|
||||
private function calculatePendapatanBulan()
|
||||
|
@ -95,6 +67,52 @@ class DashboardController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
private function calculatePendapatanMinggu()
|
||||
{
|
||||
// tanggal minggu ini
|
||||
$first_day_of_the_current_week = Carbon::today()->startOfWeek();
|
||||
$last_day_of_the_current_week = $first_day_of_the_current_week->copy()->endOfWeek();
|
||||
// dd($last_day_of_the_current_week);
|
||||
// tanggal minggu lalu
|
||||
$first_day_of_the_previous_week = $first_day_of_the_current_week->copy()->subWeek()->startOfWeek();
|
||||
$last_day_of_the_previous_week = $first_day_of_the_current_week->copy()->subWeek()->endOfWeek();
|
||||
|
||||
// get data jumlah penjualan keseluruhan dalam satu minggu
|
||||
$penjualanSatuMinggu = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_current_week, $last_day_of_the_current_week])->sum('grand_total');
|
||||
$penjualanMingguLalu = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_previous_week, $last_day_of_the_previous_week])->sum('grand_total');
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-30 15:52:41
|
||||
* @Desc: constant status
|
||||
* 1 netral
|
||||
* 2 plus
|
||||
* 3 minus
|
||||
*/
|
||||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last week and this week
|
||||
if ($penjualanMingguLalu != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanSatuMinggu - $penjualanMingguLalu) / $penjualanMingguLalu * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'penjualanSatuMinggu' => $penjualanSatuMinggu,
|
||||
'penjualanMingguLalu' => $penjualanMingguLalu,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
}
|
||||
|
||||
private function calculatePendapatanHari()
|
||||
{
|
||||
// tanggal hari ini
|
||||
|
@ -152,9 +170,9 @@ class DashboardController extends Controller
|
|||
$first_day_of_the_previous_month = $first_day_of_the_current_month->copy()->subMonth()->startOfMonth();
|
||||
$last_day_of_the_previous_month = $first_day_of_the_current_month->copy()->subMonth()->endOfMonth();
|
||||
|
||||
// get data jumlah penjualan keseluruhan dalam satu bulan
|
||||
$penjualanSatuBulan = pengeluaran::whereBetween('tanggal', [$first_day_of_the_current_month, $last_day_of_the_current_month])->sum('nominal');
|
||||
$penjualanBulanLalu = pengeluaran::whereBetween('tanggal', [$first_day_of_the_previous_month, $last_day_of_the_previous_month])->sum('nominal');
|
||||
// get data jumlah pengeluaran keseluruhan dalam satu bulan
|
||||
$pengeluaranSatuBulan = pengeluaran::whereBetween('tanggal', [$first_day_of_the_current_month, $last_day_of_the_current_month])->sum('nominal');
|
||||
$pengeluaranBulanLalu = pengeluaran::whereBetween('tanggal', [$first_day_of_the_previous_month, $last_day_of_the_previous_month])->sum('nominal');
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
|
@ -167,9 +185,9 @@ class DashboardController extends Controller
|
|||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last month and this month
|
||||
if ($penjualanBulanLalu != 0) {
|
||||
if ($pengeluaranBulanLalu != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanSatuBulan - $penjualanBulanLalu) / $penjualanBulanLalu * 100;
|
||||
$percentageOfSalesGrowth = ($pengeluaranSatuBulan - $pengeluaranBulanLalu) / $pengeluaranBulanLalu * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
|
@ -181,8 +199,8 @@ class DashboardController extends Controller
|
|||
}
|
||||
|
||||
return [
|
||||
'penjualanSatuBulan' => $penjualanSatuBulan,
|
||||
'penjualanBulanLalu' => $penjualanBulanLalu,
|
||||
'pengeluaranSatuBulan' => $pengeluaranSatuBulan,
|
||||
'pengeluaranBulanLalu' => $pengeluaranBulanLalu,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
|
@ -199,9 +217,9 @@ class DashboardController extends Controller
|
|||
$first_day_of_the_previous_day = $first_day_of_the_current_day->copy()->subDay()->startOfDay();
|
||||
$last_day_of_the_previous_day = $first_day_of_the_current_day->copy()->subDay()->endOfDay();
|
||||
|
||||
// get data jumlah penjualan keseluruhan dalam satu bulan
|
||||
$penjualanHariIni = Pengeluaran::whereBetween('tanggal', [$first_day_of_the_current_day, $last_day_of_the_current_day])->sum('nominal');
|
||||
$penjualanKemarin = pengeluaran::whereBetween('tanggal', [$first_day_of_the_previous_day, $last_day_of_the_previous_day])->sum('nominal');
|
||||
// get data jumlah pengeluaran keseluruhan dalam satu bulan
|
||||
$pengeluaranHariIni = Pengeluaran::whereBetween('tanggal', [$first_day_of_the_current_day, $last_day_of_the_current_day])->sum('nominal');
|
||||
$pengeluaranKemarin = pengeluaran::whereBetween('tanggal', [$first_day_of_the_previous_day, $last_day_of_the_previous_day])->sum('nominal');
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
|
@ -214,9 +232,9 @@ class DashboardController extends Controller
|
|||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last month and this month
|
||||
if ($penjualanKemarin != 0) {
|
||||
if ($pengeluaranKemarin != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanHariIni - $penjualanKemarin) / $penjualanKemarin * 100;
|
||||
$percentageOfSalesGrowth = ($pengeluaranHariIni - $pengeluaranKemarin) / $pengeluaranKemarin * 100;
|
||||
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
|
@ -229,95 +247,10 @@ class DashboardController extends Controller
|
|||
}
|
||||
|
||||
return [
|
||||
'penjualanHariIni' => $penjualanHariIni,
|
||||
'penjualanKemarin' => $penjualanKemarin,
|
||||
'pengeluaranHariIni' => $pengeluaranHariIni,
|
||||
'pengeluaranKemarin' => $pengeluaranKemarin,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
}
|
||||
|
||||
public function getChart()
|
||||
{
|
||||
$allPenjualan = Pesanan::sum('grand_total');
|
||||
|
||||
$weekThisMonth = $this->getDataEachWeekThisMonth();
|
||||
$weekLastMonth = $this->getDataEachWeekLastMonth();
|
||||
|
||||
return ResponseFormatter::success(['allPenjualan' => $allPenjualan, 'weekThisMonth' => $weekThisMonth, 'weekLastMonth' => $weekLastMonth]);
|
||||
}
|
||||
|
||||
private function getDataEachWeekThisMonth()
|
||||
{
|
||||
//format string
|
||||
$f = 'Y-m-d';
|
||||
|
||||
//if you want to record time as well, then replace today() with now()
|
||||
//and remove startOfDay()
|
||||
$today = Carbon::today();
|
||||
$date = $today->copy()->firstOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
$dates = [];
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dates['Minggu ke ' . $i] = $startDate->format($f) . ' 00:00:00 |' . $date->format($f) . ' 23:59:59';
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$datapenjualan = [];
|
||||
|
||||
foreach ($dates as $key => $value) {
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', explode('|', $value))->sum('grand_total');
|
||||
|
||||
|
||||
$datapenjualan[$key] = $dataPenjualan;
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
private function getDataEachWeekLastMonth()
|
||||
{
|
||||
//format string
|
||||
$f = 'Y-m-d';
|
||||
|
||||
//if you want to record time as well, then replace today() with now()
|
||||
//and remove startOfDay()
|
||||
$today = Carbon::today()->subMonth();
|
||||
$date = $today->copy()->firstOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
$dates = [];
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dates['Minggu ke ' . $i] = $startDate->format($f) . ' 00:00:00 |' . $date->format($f) . ' 23:59:59';
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$datapenjualan = [];
|
||||
foreach ($dates as $key => $value) {
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', explode('|', $value))->sum('grand_total');
|
||||
$datapenjualan[$key] = $dataPenjualan;
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins\Dashboard;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Pengeluaran;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ChartPengeluaranController extends Controller
|
||||
{
|
||||
|
||||
public function getChartPengeluaran()
|
||||
{
|
||||
$allPengeluaran = Pengeluaran::sum('nominal');
|
||||
|
||||
$weekThisMonth = $this->getDataEachWeekThisMonthPengeluaran();
|
||||
$weekLastMonth = $this->getDataEachWeekLastMonthPengeluaran();
|
||||
|
||||
return ResponseFormatter::success(['allPengeluaran' => $allPengeluaran, 'weekThisMonth' => $weekThisMonth, 'weekLastMonth' => $weekLastMonth]);
|
||||
}
|
||||
|
||||
private function getDataEachWeekThisMonthPengeluaran()
|
||||
{
|
||||
//format string
|
||||
$f = 'Y-m-d';
|
||||
|
||||
//if you want to record time as well, then replace today() with now()
|
||||
//and remove startOfDay()
|
||||
$today = Carbon::today();
|
||||
$date = $today->copy()->firstOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
$dates = [];
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dates['Minggu ke ' . $i] = $startDate->format($f) . ' 00:00:00 |' . $date->format($f) . ' 23:59:59';
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$datapengeluaran = [];
|
||||
|
||||
foreach ($dates as $key => $value) {
|
||||
$dataPengeluaran = Pengeluaran::whereBetween('tanggal', explode('|', $value))->sum('nominal');
|
||||
$datapengeluaran[$key] = $dataPengeluaran;
|
||||
}
|
||||
|
||||
return $datapengeluaran;
|
||||
}
|
||||
|
||||
private function getDataEachWeekLastMonthPengeluaran()
|
||||
{
|
||||
//format string
|
||||
$f = 'Y-m-d';
|
||||
|
||||
//if you want to record time as well, then replace today() with now()
|
||||
//and remove startOfDay()
|
||||
$today = Carbon::today()->subMonth();
|
||||
$date = $today->copy()->firstOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
$dates = [];
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dates['Minggu ke ' . $i] = $startDate->format($f) . ' 00:00:00 |' . $date->format($f) . ' 23:59:59';
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$datapengeluaran = [];
|
||||
foreach ($dates as $key => $value) {
|
||||
$dataPengeluaran = Pengeluaran::whereBetween('tanggal', explode('|', $value))->sum('nominal');
|
||||
$datapengeluaran[$key] = $dataPengeluaran;
|
||||
}
|
||||
|
||||
return $datapengeluaran;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins\Dashboard;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Pesanan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ChartPenjualanController extends Controller
|
||||
{
|
||||
|
||||
public function getChartWeek()
|
||||
{
|
||||
// get data grand_total this week from first day until last day of week from 00:00:00 until 23:59:59
|
||||
$grandTotalThisWeek = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->startOfWeek()->format('Y-m-d') . ' 00:00:00', Carbon::today()->endOfWeek()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
// get data grand_total last week from first day until last day of week from 00:00:00 until 23:59:59
|
||||
$grandTotalLastWeek = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->subWeek()->startOfWeek()->format('Y-m-d') . ' 00:00:00', Carbon::today()->subWeek()->endOfWeek()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-30 15:52:41
|
||||
* @Desc: constant status
|
||||
* 1 netral
|
||||
* 2 plus
|
||||
* 3 minus
|
||||
*/
|
||||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last week and this week
|
||||
if ($grandTotalLastWeek != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($grandTotalThisWeek - $grandTotalLastWeek) / $grandTotalLastWeek * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
$thisWeek = $this->getDataEachDayThisWeek();
|
||||
// $lastWeek = $this->getDataEachDayLastWeek();
|
||||
|
||||
return ResponseFormatter::success(['thisWeek' => $thisWeek, 'grandTotalThisWeek' => $grandTotalThisWeek, 'grandTotalLastWeek' => $grandTotalLastWeek, 'percentageOfSalesGrowth' => $percentageOfSalesGrowth, 'statusCalculation' => $statusCalculation]);
|
||||
}
|
||||
|
||||
private function getDataEachDayThisWeek()
|
||||
{
|
||||
// get data grand_total per day this week from 00:00:00 until 23:59:59
|
||||
$datapenjualan = [];
|
||||
|
||||
$today = Carbon::today();
|
||||
$date = $today->copy()->startOfWeek()->startOfDay();
|
||||
$eow = $today->copy()->endOfWeek()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eow); $i++) {
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$date->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan[tanggal_indonesia($date->format('Y-m-d'))] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
private function getDataEachDayLastWeek()
|
||||
{
|
||||
// get data grand_total per day last week from 00:00:00 until 23:59:59
|
||||
$datapenjualan = [];
|
||||
|
||||
$today = Carbon::today()->subWeek();
|
||||
$date = $today->copy()->startOfWeek()->startOfDay();
|
||||
$eow = $today->copy()->endOfWeek()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eow); $i++) {
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$date->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan[tanggal_indonesia($date->format('Y-m-d'))] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
public function getChartMonth()
|
||||
{
|
||||
// get data grand_total this month from first day until last day of month from 00:00:00 until 23:59:59
|
||||
$grandTotalThisMonth = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->startOfMonth()->format('Y-m-d') . ' 00:00:00', Carbon::today()->endOfMonth()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
// get data grand_total last month from first day until last day of month from 00:00:00 until 23:59:59
|
||||
$grandTotalLastMonth = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->subMonth()->startOfMonth()->format('Y-m-d') . ' 00:00:00', Carbon::today()->subMonth()->endOfMonth()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-30 15:52:41
|
||||
* @Desc: constant status
|
||||
* 1 netral
|
||||
* 2 plus
|
||||
* 3 minus
|
||||
*/
|
||||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last week and this week
|
||||
if ($grandTotalLastMonth != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($grandTotalThisMonth - $grandTotalLastMonth) / $grandTotalLastMonth * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
$weekThisMonth = $this->getDataEachWeekThisMonth();
|
||||
// $weekLastMonth = $this->getDataEachWeekLastMonth();
|
||||
|
||||
return ResponseFormatter::success(['weekThisMonth' => $weekThisMonth, 'grandTotalThisMonth' => $grandTotalThisMonth, 'grandTotalLastMonth' => $grandTotalLastMonth, 'percentageOfSalesGrowth' => $percentageOfSalesGrowth, 'statusCalculation' => $statusCalculation]);
|
||||
}
|
||||
|
||||
private function getDataEachWeekThisMonth()
|
||||
{
|
||||
// get data grand_total per week this month from 00:00:00 until 23:59:59 each day of week (Sunday)
|
||||
$datapenjualan = [];
|
||||
$today = Carbon::today();
|
||||
$date = $today->copy()->startOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$startDate->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan['Minggu ke ' . $i] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
private function getDataEachWeekLastMonth()
|
||||
{
|
||||
// get data grand_total per week this month from 00:00:00 until 23:59:59 each day of week (Sunday) last month
|
||||
$datapenjualan = [];
|
||||
$today = Carbon::today()->subMonth();
|
||||
$date = $today->copy()->startOfMonth()->startOfDay();
|
||||
$eom = $today->copy()->endOfMonth()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eom); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->dayOfWeek != Carbon::SUNDAY && $date->lte($eom)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$startDate->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan['Minggu ke ' . $i] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
public function getChartYear()
|
||||
{
|
||||
// get data grand_total this year from first day until last day of year from 00:00:00 until 23:59:59
|
||||
$grandTotalThisYear = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->startOfYear()->format('Y-m-d') . ' 00:00:00', Carbon::today()->endOfYear()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
// get data grand_total last year from first day until last day of year from 00:00:00 until 23:59:59
|
||||
$grandTotalLastYear = Pesanan::whereBetween('tanggal_pesanan', [Carbon::today()->subYear()->startOfYear()->format('Y-m-d') . ' 00:00:00', Carbon::today()->subYear()->endOfYear()->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-30 15:52:41
|
||||
* @Desc: constant status
|
||||
* 1 netral
|
||||
* 2 plus
|
||||
* 3 minus
|
||||
*/
|
||||
$statusCalculation = 1;
|
||||
|
||||
// calculate percentage of sales growth in the last week and this week
|
||||
if ($grandTotalLastYear != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($grandTotalThisYear - $grandTotalLastYear) / $grandTotalLastYear * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
$monthThisYear = $this->getDataEachMonthThisYear();
|
||||
// $monthLastYear = $this->getDataEachMonthLastYear();
|
||||
|
||||
return ResponseFormatter::success(['monthThisYear' => $monthThisYear, 'grandTotalThisYear' => $grandTotalThisYear, 'grandTotalLastYear' => $grandTotalLastYear, 'percentageOfSalesGrowth' => $percentageOfSalesGrowth, 'statusCalculation' => $statusCalculation]);
|
||||
}
|
||||
|
||||
private function getDataEachMonthThisYear()
|
||||
{
|
||||
// get data grand_total per month this year from 00:00:00 until 23:59:59 each day of month (last day of month)
|
||||
$datapenjualan = [];
|
||||
$today = Carbon::today();
|
||||
$date = $today->copy()->startOfYear()->startOfDay();
|
||||
$eoy = $today->copy()->endOfYear()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eoy); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->day != $date->daysInMonth && $date->lte($eoy)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$startDate->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan[$date->format('F')] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
|
||||
private function getDataEachMonthLastYear()
|
||||
{
|
||||
// get data grand_total per month this year from 00:00:00 until 23:59:59 each day of month (last day of month) last year
|
||||
$datapenjualan = [];
|
||||
$today = Carbon::today()->subYear();
|
||||
$date = $today->copy()->startOfYear()->startOfDay();
|
||||
$eoy = $today->copy()->endOfYear()->startOfDay();
|
||||
|
||||
for ($i = 1; $date->lte($eoy); $i++) {
|
||||
|
||||
//record start date
|
||||
$startDate = $date->copy();
|
||||
|
||||
//loop to end of the week while not crossing the last date of month
|
||||
while ($date->day != $date->daysInMonth && $date->lte($eoy)) {
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
$dataPenjualan = Pesanan::whereBetween('tanggal_pesanan', [$startDate->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->sum('grand_total');
|
||||
$datapenjualan['Bulan ke ' . $i] = $dataPenjualan;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return $datapenjualan;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins\Dashboard;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Kasir\Menu;
|
||||
use App\Models\KelompokKategori;
|
||||
use App\Models\MenuTerlarisView;
|
||||
use App\Models\Pengeluaran;
|
||||
use App\Models\Pesanan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('pages.admin.dashboard.dashboard');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: xelz
|
||||
* @Date: 2024-01-26 18:59:12
|
||||
* @Desc: Display Menu Terlaris
|
||||
*/
|
||||
|
||||
public function menuTerlaris()
|
||||
{
|
||||
|
||||
$data = MenuTerlarisView::where([['kategori_produk_id', '=', 2], ['tgl_start_promo', '=', null]])->get();
|
||||
|
||||
// $KelompokKategori = KelompokKategori::with('kelompokKategoriPivot.produkTerlaris')->get();
|
||||
// dd($KelompokKategori->kelompokKategoriPivot->first()->produkTerlaris);
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function minumanTerlaris()
|
||||
{
|
||||
$data = MenuTerlarisView::where([['kategori_produk_id', '=', 1], ['tgl_start_promo', '=', null]])->get();
|
||||
|
||||
// $KelompokKategori = KelompokKategori::with('kelompokKategoriPivot.produkTerlaris')->get();
|
||||
// dd($KelompokKategori->kelompokKategoriPivot->first()->produkTerlaris);
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->make(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins\RekeningCoa;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\RekeningCoa;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RekeningCoaController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('pages.admin.rekening_coa.index');
|
||||
}
|
||||
|
||||
public function getData(){
|
||||
$rekeningCoa = RekeningCoa::orderBy('coa', 'asc')->get();
|
||||
$nomor = 1;
|
||||
|
||||
return datatables()
|
||||
->of($rekeningCoa)
|
||||
->addColumn('nomor', function($rekeningCoa) use (&$nomor){
|
||||
return $nomor++;
|
||||
})
|
||||
->rawColumns(['nomor'])
|
||||
->addColumn('ubah', function($rekeningCoa) {
|
||||
if($rekeningCoa->status <> 0){
|
||||
return '<a class="me-1" href="javascript:void(0)" onclick="ubah(\''.$rekeningCoa->id.'\', \''.$rekeningCoa->kode_coa.'\',
|
||||
\''.$rekeningCoa->sub_kode_coa.'\', \''.$rekeningCoa->detail_coa.'\', \''.$rekeningCoa->keterangan_coa.'\')">
|
||||
<span class="btn btn-xs btn-warning"><i class="fas fa-edit"></i></span>
|
||||
</a>';
|
||||
}
|
||||
})
|
||||
->rawColumns(['ubah'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function simpan(Request $request){
|
||||
try {
|
||||
if($request->detail_coa <> null){
|
||||
$status = 1;
|
||||
$coa = $request->kode_coa.".".$request->sub_kode_coa.".".$request->detail_coa;
|
||||
}else{
|
||||
$status = 0;
|
||||
$coa = $request->kode_coa.".".$request->sub_kode_coa;
|
||||
}
|
||||
RekeningCoa::create([
|
||||
'kode_coa' => $request->kode_coa,
|
||||
'sub_kode_coa' => $request->sub_kode_coa,
|
||||
'detail_coa' => $request->detail_coa,
|
||||
'coa' => $coa,
|
||||
'keterangan_coa' => $request->keterangan_coa,
|
||||
'status' => $status
|
||||
]);
|
||||
|
||||
return redirect()->route('coa.index')->with(['success' => 'Data berhasil ditambahkan']);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return back()->withError($th->getMessage())->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function ubah(Request $request){
|
||||
try {
|
||||
$rekeningCoa = RekeningCoa::where('id', $request->id_rekening_coa);
|
||||
$rekeningCoa->update([
|
||||
'detail_coa' => $request->detail_coa,
|
||||
'keterangan_coa' => $request->keterangan_coa,
|
||||
]);
|
||||
|
||||
return redirect()->route('coa.index')->with(['success' => 'Data berhasil diubah']);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return back()->withError($th->getMessage())->withInput();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,12 @@ class KategoriProduk extends Model
|
|||
return $this->hasMany(Produk::class, 'kategori_produk_id');
|
||||
}
|
||||
|
||||
|
||||
public function produkTerlaris()
|
||||
{
|
||||
return $this->belongsTo(MenuTerlarisView::class, 'produk_id');
|
||||
}
|
||||
|
||||
// kelompok kategori
|
||||
public function kelompokKategori()
|
||||
{
|
||||
|
|
|
@ -27,4 +27,9 @@ class KelompokKategoriPivot extends Model
|
|||
{
|
||||
return $this->belongsTo(Produk::class, 'produk_id');
|
||||
}
|
||||
|
||||
public function produkTerlaris()
|
||||
{
|
||||
return $this->belongsTo(MenuTerlarisView::class, 'produk_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,25 @@ class MenuTerlarisView extends Model
|
|||
use HasFactory;
|
||||
|
||||
protected $table = 'menu_terlaris_view';
|
||||
|
||||
// full path to reach image from storage folder and check if image exists or not
|
||||
public function getGambarProdukAttribute($value)
|
||||
{
|
||||
$storage = storage_path('app/public/produk/' . $this->kategori_produk_id . '/' . $value);
|
||||
if (file_exists($storage)) {
|
||||
return asset('storage/produk/' . $this->kategori_produk_id . '/' . $value);
|
||||
} else {
|
||||
return asset('assets/images/menu_image.jpeg');
|
||||
}
|
||||
}
|
||||
|
||||
public function kategori_produk()
|
||||
{
|
||||
return $this->belongsTo(KategoriProduk::class, 'kategori_produk_id');
|
||||
}
|
||||
|
||||
public function kelompokKategori()
|
||||
{
|
||||
return $this->belongsToMany(KelompokKategori::class, KelompokKategoriPivot::class, 'produk_id', 'kelompok_kategori_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,8 @@ class Pengeluaran extends Model
|
|||
public function user(){
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function jenis_kelamin(){
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Database\Seeders;
|
|||
use App\Models\RekeningCoa;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RekeningCoaSeeder extends Seeder
|
||||
{
|
||||
|
@ -13,7 +14,13 @@ class RekeningCoaSeeder extends Seeder
|
|||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// RekeningCoa::truncate();
|
||||
// Disable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
||||
|
||||
RekeningCoa::truncate();
|
||||
|
||||
// Enable foreign key checks
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
|
||||
$csvFile = fopen(base_path("database/seeders/data_csv/rekening_coa.csv"), "r");
|
||||
$firstline = true;
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
kode_coa,sub_kode_coa,detail_coa,coa,keterangan_coa,status
|
||||
1,100,,1.100,Kas,0
|
||||
1,100,1,1.100.01,Kas Kasir,1
|
||||
1,100,1,1.100.02,Kas BCA1,1
|
||||
1,100,1,1.100.03,Kas BCA2,1
|
||||
1,100,1,1.100.04,Kas Mandiri1,1
|
||||
1,100,1,1.100.05,Kas Mandiri2,1
|
||||
1,100,1,1.100.06,Kas BRI1,1
|
||||
1,100,1,1.100.07,Kas BRI2,1
|
||||
1,100,1,1.100.08,Kas BNI1,1
|
||||
1,100,1,1.100.09,Kas BNI2,1
|
||||
1,100,1,1.100.10,Kas BSI1,1
|
||||
1,100,1,1.100.11,Kas BSI2,1
|
||||
1,100,01,1.100.01,Kas Kasir,1
|
||||
1,100,02,1.100.02,Kas BCA1,1
|
||||
1,100,03,1.100.03,Kas BCA2,1
|
||||
1,100,04,1.100.04,Kas Mandiri1,1
|
||||
1,100,05,1.100.05,Kas Mandiri2,1
|
||||
1,100,06,1.100.06,Kas BRI1,1
|
||||
1,100,07,1.100.07,Kas BRI2,1
|
||||
1,100,08,1.100.08,Kas BNI1,1
|
||||
1,100,09,1.100.09,Kas BNI2,1
|
||||
1,100,10,1.100.10,Kas BSI1,1
|
||||
1,100,11,1.100.11,Kas BSI2,1
|
||||
1,200,,1.200,Antar Bank Aktiva,0
|
||||
1,200,1,1.200.01,Tab ABA Bank Mandiri1,1
|
||||
1,200,2,1.200.02,Tab ABA Bank Mandiri2,1
|
||||
1,200,3,1.200.03,Tab ABA Bank BNI1,1
|
||||
1,200,4,1.200.04,Tab ABA Bank BNI2,1
|
||||
1,200,5,1.200.05,Tab ABA Bank BCA1,1
|
||||
1,200,5,1.200.06,Tab ABA Bank BCA2,1
|
||||
1,200,5,1.200.07,Tab ABA Bank BRI1,1
|
||||
1,200,5,1.200.08,Tab ABA Bank BRI2,1
|
||||
1,200,5,1.200.09,Tab ABA Bank BSI1,1
|
||||
1,200,5,1.200.10,Tab ABA Bank BSI2,1
|
||||
1,200,01,1.200.01,Tab ABA Bank Mandiri1,1
|
||||
1,200,02,1.200.02,Tab ABA Bank Mandiri2,1
|
||||
1,200,03,1.200.03,Tab ABA Bank BNI1,1
|
||||
1,200,04,1.200.04,Tab ABA Bank BNI2,1
|
||||
1,200,05,1.200.05,Tab ABA Bank BCA1,1
|
||||
1,200,06,1.200.06,Tab ABA Bank BCA2,1
|
||||
1,200,07,1.200.07,Tab ABA Bank BRI1,1
|
||||
1,200,08,1.200.08,Tab ABA Bank BRI2,1
|
||||
1,200,09,1.200.09,Tab ABA Bank BSI1,1
|
||||
1,200,10,1.200.10,Tab ABA Bank BSI2,1
|
||||
1,300,,1.300,Piutang,0
|
||||
1,300,1,1.300.01,Piutang Konsumen,1
|
||||
1,300,01,1.300.01,Piutang Konsumen,1
|
||||
2,100,,2.100,Hutang,0
|
||||
2,100,1,2.100.01,Hutang Usaha,1
|
||||
2,100,2,2.100.02,Hutang Bank,1
|
||||
2,100,01,2.100.01,Hutang Usaha,1
|
||||
2,100,02,2.100.02,Hutang Bank,1
|
||||
2,200,,2.200,Pajak,0
|
||||
2,200,1,2.200.01,Pajak PPh21,1
|
||||
2,200,2,2.200.02,Pajak PPh22,1
|
||||
2,200,01,2.200.01,Pajak PPh21,1
|
||||
2,200,02,2.200.02,Pajak PPh22,1
|
||||
3,100,,3.100,Modal,0
|
||||
3,100,1,3.100.01,Modal Awal,1
|
||||
3,100,01,3.100.01,Modal Awal,1
|
||||
4,100,,4.100,Pendapatan,0
|
||||
4,100,1,4.100.01,Pendapatan Penjualan,1
|
||||
4,100,01,4.100.01,Pendapatan Penjualan,1
|
||||
5,100,,5.100,Beban Umum & Administrasi,0
|
||||
5,100,1,5.100.01,Gaji & Upah,1
|
||||
5,100,2,5.100.02,Lembur,1
|
||||
5,100,3,5.100.03,Alat Tulis & Kantor,1
|
||||
5,100,4,5.100.04,Perjalanan Dinas / Transport,1
|
||||
5,100,5,5.100.05,Perawatan Kendaraan,1
|
||||
5,100,01,5.100.01,Gaji & Upah,1
|
||||
5,100,02,5.100.02,Lembur,1
|
||||
5,100,03,5.100.03,Alat Tulis & Kantor,1
|
||||
5,100,04,5.100.04,Perjalanan Dinas / Transport,1
|
||||
5,100,05,5.100.05,Perawatan Kendaraan,1
|
||||
5,200,,5.200,Beban Organisasi,0
|
||||
5,200,1,5.200.01,Biaya Rapat,1
|
||||
5,200,2,5.200.02,Biaya Lainnya,1
|
||||
5,200,01,5.200.01,Biaya Rapat,1
|
||||
5,200,02,5.200.02,Biaya Lainnya,1
|
||||
5,300,,5.300,Beban Operasional Lainnya,0
|
||||
5,300,1,5.300.01,Sewa Kantor,1
|
||||
5,300,2,5.300.02,Biaya Telepon / Pulsa,1
|
||||
5,300,3,5.300.03,Biaya Listrik,1
|
||||
5,300,4,5.300.04,Biaya Air,1
|
||||
5,300,5,5.300.05,Biaya Wifi,1
|
||||
5,300,6,5.300.06,Biaya BBM,1
|
||||
5,300,7,5.300.07,Biaya Penyisihan THR,1
|
||||
5,300,01,5.300.01,Sewa Kantor,1
|
||||
5,300,02,5.300.02,Biaya Telepon / Pulsa,1
|
||||
5,300,03,5.300.03,Biaya Listrik,1
|
||||
5,300,04,5.300.04,Biaya Air,1
|
||||
5,300,05,5.300.05,Biaya Wifi,1
|
||||
5,300,06,5.300.06,Biaya BBM,1
|
||||
5,300,07,5.300.07,Biaya Penyisihan THR,1
|
||||
5,400,,5.400,Pembelian,0
|
||||
5,400,1,5.400.01,Pembelian Barang,1
|
||||
5,400,2,5.400.02,Pembelian Sarpras,1
|
||||
5,400,01,5.400.01,Pembelian Barang,1
|
||||
5,400,02,5.400.02,Pembelian Sarpras,1
|
||||
|
|
|
|
@ -6,6 +6,11 @@
|
|||
Keriting</span>
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler order-1" type="button" data-toggle="collapse" data-target="#navbarCollapse"
|
||||
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse order-3" id="navbarCollapse">
|
||||
<!-- Left navbar links -->
|
||||
<ul class="navbar-nav">
|
||||
|
@ -31,6 +36,9 @@
|
|||
@can('menu.index', auth()->user())
|
||||
<li><a href="{{ route('menu.index') }}" class="dropdown-item">Data Menu</a></li>
|
||||
@endcan
|
||||
@can('coa.index', auth()->user())
|
||||
<li><a href="{{ route('coa.index') }}" class="dropdown-item">Data Rekening Coa</a></li>
|
||||
@endcan
|
||||
@can('users.index', auth()->user())
|
||||
<li class="dropdown-divider"></li>
|
||||
<li><a href="{{ route('users.index') }}" class="dropdown-item">Setting User</a></li>
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
$('#modal-default').modal('hide');
|
||||
} else {
|
||||
globalId++;
|
||||
console.log(globalId);
|
||||
// console.log(globalId);
|
||||
if (paketFreenya.length != 0) {
|
||||
if (paketFreenya.length == 3) {
|
||||
paketFreenyaini = 'FREEALL';
|
||||
|
@ -321,7 +321,7 @@
|
|||
|
||||
// delete menu from table and calculate qty and total price menu ordered
|
||||
function deleteMenu(params) {
|
||||
console.log(params);
|
||||
// console.log(params);
|
||||
var table = document.getElementById("order-menus");
|
||||
var index = 0;
|
||||
|
||||
|
@ -366,7 +366,7 @@
|
|||
|
||||
// increment qty menu ordered
|
||||
function incrementMenu(params, nama_produk) {
|
||||
console.log(params);
|
||||
// console.log(params);
|
||||
var table = document.getElementById("order-menus");
|
||||
var index = 0;
|
||||
|
||||
|
@ -1042,7 +1042,7 @@
|
|||
|
||||
// clear selected menus
|
||||
function clearSelected() {
|
||||
console.log('batal');
|
||||
// console.log('batal');
|
||||
for (var i = 0; i < selectedMenus.length; i++) {
|
||||
changeOrderedMenus(selectedMenus[i].id, 'batal');
|
||||
menu_terpilih.innerHTML = ` `;
|
||||
|
|
|
@ -255,11 +255,12 @@
|
|||
@else
|
||||
@foreach ($item->kelompokKategoriPivot as $key2 => $kelompokKategoriPivot)
|
||||
{{-- Jika paket irit --}}
|
||||
@if ($kelompokKategoriPivot->kelompok_kategori_id == 9)
|
||||
@if ($kelompokKategoriPivot->kelompok_kategori_id === 9)
|
||||
@if (
|
||||
$kelompokKategoriPivot->produk->tgl_start_promo <= \Carbon\Carbon::now() &&
|
||||
$kelompokKategoriPivot->produk->tgl_end_promo >= \Carbon\Carbon::now())
|
||||
@if ($kelompokKategoriPivot->produk->stok_promo === 0)
|
||||
{{-- untuk promo aktif dan stok tersedia --}}
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn disabled">
|
||||
<div class="card-header">
|
||||
|
@ -297,6 +298,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@else
|
||||
{{-- untuk promo dengan stok kosong --}}
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn"
|
||||
onclick="aadMenu( {{ $kelompokKategoriPivot->produk }} )">
|
||||
|
@ -335,58 +337,68 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
{{-- untuk promo tidak aktif --}}
|
||||
@if ($loop->last)
|
||||
Tidak ada promo
|
||||
@endif
|
||||
@endif
|
||||
@else
|
||||
@if ($kelompokKategoriPivot->kelompok_kategori_id == 2)
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn"
|
||||
onclick="aadMenu( {{ $kelompokKategoriPivot->produk }} )">
|
||||
<div class="card-header px-0">
|
||||
<h6 class="m-0 text-sm text-bold">
|
||||
{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body px-0">
|
||||
<div class="col-md-12 px-0">
|
||||
<div class="col-md-12 text-sm d-flex py-2 rounded bg-secondary" style="background-color: rgb(230, 230, 230)">
|
||||
<h5 class="my-auto text-bold" style="align-items: center;">
|
||||
{{ convert_to_rupiah($kelompokKategoriPivot->produk->harga_produk) }}
|
||||
</h5>
|
||||
<a class="btn btn-warning ml-auto" id="ordered-menus"><i class="fa fa-shopping-cart"></i></a>
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn"
|
||||
onclick="aadMenu( {{ $kelompokKategoriPivot->produk }} )">
|
||||
<div class="card-header px-0">
|
||||
<h6 class="m-0 text-sm text-bold">
|
||||
{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body px-0">
|
||||
<div class="col-md-12 px-0">
|
||||
<div class="col-md-12 text-sm d-flex py-2 rounded bg-secondary"
|
||||
style="background-color: rgb(230, 230, 230)">
|
||||
<h5 class="my-auto text-bold"
|
||||
style="align-items: center;">
|
||||
{{ convert_to_rupiah($kelompokKategoriPivot->produk->harga_produk) }}
|
||||
</h5>
|
||||
<a class="btn btn-warning ml-auto"
|
||||
id="ordered-menus"><i
|
||||
class="fa fa-shopping-cart"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn"
|
||||
onclick="aadMenu( {{ $kelompokKategoriPivot->produk }} )">
|
||||
<div class="card-header">
|
||||
<h6 class="m-0 text-xs">
|
||||
{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-md-12">
|
||||
<img style="width: 100%;height: 100%;object-fit: cover;"
|
||||
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
|
||||
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
|
||||
<div class="col-md-12 mt-1"
|
||||
style="align-items: center;align-content: center;">
|
||||
<h5>
|
||||
{{ convert_to_rupiah($kelompokKategoriPivot->produk->harga_produk) }}
|
||||
</h5>
|
||||
</div>
|
||||
{{-- untuk semua menu selain paket --}}
|
||||
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="card card-warning card-outline btn"
|
||||
onclick="aadMenu( {{ $kelompokKategoriPivot->produk }} )">
|
||||
<div class="card-header">
|
||||
<h6 class="m-0 text-xs">
|
||||
{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-md-12">
|
||||
<a class="col-sm-6 col-md-8 col-lg-12 btn btn-warning"
|
||||
id="ordered-menus">Pesan</a>
|
||||
<img style="width: 100%;height: 100%;object-fit: cover;"
|
||||
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
|
||||
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
|
||||
<div class="col-md-12 mt-1"
|
||||
style="align-items: center;align-content: center;">
|
||||
<h5>
|
||||
{{ convert_to_rupiah($kelompokKategoriPivot->produk->harga_produk) }}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<a class="col-sm-6 col-md-8 col-lg-12 btn btn-warning"
|
||||
id="ordered-menus">Pesan</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
@ -410,7 +422,8 @@
|
|||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered table-striped" id="order-menus" style="border-collapse: collapse; width: 100%; max-width: 600px; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
|
||||
<table class="table table-bordered table-striped" id="order-menus"
|
||||
style="border-collapse: collapse; width: 100%; max-width: 600px; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
|
||||
<thead style="background-color: rgb(230, 230, 230)">
|
||||
<tr>
|
||||
<th class="text-center">Menu</th>
|
||||
|
@ -473,7 +486,8 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th colspan="4" class="text-center">
|
||||
<button class="btn btn-outline-primary col-sm-12 col-md-12 col-lg-12" id="bayar_uang_pas">Uang Pas</button>
|
||||
<button class="btn btn-outline-primary col-sm-12 col-md-12 col-lg-12"
|
||||
id="bayar_uang_pas">Uang Pas</button>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -486,8 +500,8 @@
|
|||
class="form-control rounded-3 col-lg-6" placeholder="Nomor Pemesan"
|
||||
id="nomor-pemesan" oninput="inputNum(this)" required>
|
||||
<input type="number" min="1" name="nomor-meja"
|
||||
class="form-control rounded-3 mt-1" placeholder="Nomor Meja" id="nomor-meja"
|
||||
required>
|
||||
class="form-control rounded-3 mt-1" placeholder="Nomor Meja"
|
||||
id="nomor-meja" required>
|
||||
<input type="text" name="keterangan-pesanan"
|
||||
placeholder="Keterangan Pesanan" class="form-control rounded-3 mt-1"
|
||||
id="keterangan-pesanan">
|
||||
|
|
|
@ -1,365 +0,0 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('content-header')
|
||||
<div class="col-12">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0"> Dashboard</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item active">Dashboard</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card" id="calculationPendapatan">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Laporan Pendapatan dan Pengeluaran</h5>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
|
||||
<!-- ./card-body -->
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-6">
|
||||
<div class="description-block border-right">
|
||||
<span class="description-percentage" id="penjualanHaripercentageOfSalesGrowth">
|
||||
</span>
|
||||
<h5 class="description-header" id="penjualanHari"></h5>
|
||||
<span class="description-text">Pendapatan Hari ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-3 col-6">
|
||||
<div class="description-block border-right">
|
||||
<span class="description-percentage" id="pengeluaranHaripercentageOfSalesGrowth">
|
||||
</span>
|
||||
<h5 class="description-header" id="pengeluaranHari"></h5>
|
||||
<span class="description-text">Pengeluaran Hari ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-3 col-6">
|
||||
<div class="description-block border-right">
|
||||
<span class="description-percentage" id="penjualanBulanpercentageOfSalesGrowth">
|
||||
</span>
|
||||
<h5 class="description-header" id="penjualanBulan"></h5>
|
||||
<span class="description-text">Pendapatan Bulan ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-3 col-6">
|
||||
<div class="description-block">
|
||||
<span class="description-percentage" id="pengeluaranBulanpercentageOfSalesGrowth">
|
||||
</span>
|
||||
<h5 class="description-header" id="pengeluaranBulan"></h5>
|
||||
<span class="description-text">Pengeluaran Bulan ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.card-footer -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<h3 class="card-title">Menu Terlaris</h3>
|
||||
<div class="card-tools">
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-bars"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body table-responsive p-0">
|
||||
<table class="table table-striped table-valign-middle" id="table-terlaris">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Menu</th>
|
||||
<th>Harga</th>
|
||||
<th>Terjual</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
<div class="col-lg-6">
|
||||
<!-- /.card -->
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="card-title">Penjualan</h3>
|
||||
<a href="javascript:void(0);">View Report</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<p class="d-flex flex-column">
|
||||
<span class="text-bold text-lg" id="penjualanSepanjangWaktu"></span>
|
||||
<span>Penjualan Keseluruhan</span>
|
||||
</p>
|
||||
<p class="ml-auto d-flex flex-column text-right">
|
||||
<span class="text-success" id="persentaseSepanjangWaktu">
|
||||
<i class="fas fa-arrow-up"></i> 33.1%
|
||||
</span>
|
||||
<span class="text-muted">dari bulan lalu</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.d-flex -->
|
||||
|
||||
<div class="position-relative mb-4">
|
||||
<canvas id="sales-chart" height="200"></canvas>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row justify-content-end">
|
||||
<span class="mr-2">
|
||||
<i class="fas fa-square text-primary"></i> Bulan ini
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<i class="fas fa-square text-gray"></i> Bulan Kemarin
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }} ">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<!-- ChartJS -->
|
||||
<script src="{{ asset('assets/plugins/chart.js/Chart.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
'use strict'
|
||||
|
||||
var ticksStyle = {
|
||||
fontColor: '#495057',
|
||||
fontStyle: 'bold'
|
||||
}
|
||||
|
||||
var mode = 'index'
|
||||
var intersect = true
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getChart') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
console.log(data);
|
||||
$('#penjualanSepanjangWaktu').append(converRp(data.allPenjualan));
|
||||
var $salesChart = $('#sales-chart')
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: Object.keys(data.weekThisMonth),
|
||||
datasets: [{
|
||||
backgroundColor: '#007bff',
|
||||
borderColor: '#007bff',
|
||||
data: Object.values(data.weekThisMonth)
|
||||
},
|
||||
{
|
||||
backgroundColor: '#ced4da',
|
||||
borderColor: '#ced4da',
|
||||
data: Object.values(data.weekLastMonth)
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
// Include a dollar sign in the ticks
|
||||
callback: function(value, index,
|
||||
values) {
|
||||
return converRp(value)
|
||||
}
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table-terlaris').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
searching: false,
|
||||
"bLengthChange": false,
|
||||
"bFilter": true,
|
||||
"bInfo": false,
|
||||
ajax: "{{ route('dashboard.menuTerlaris') }}",
|
||||
columns: [{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'nama_produk',
|
||||
name: 'nama_produk'
|
||||
},
|
||||
{
|
||||
data: 'harga_produk',
|
||||
name: 'harga_produk',
|
||||
'render': function(data, type, full, meta) {
|
||||
// change to IDR
|
||||
return 'Rp. ' + data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
},
|
||||
className: 'text-right'
|
||||
},
|
||||
{
|
||||
data: 'jumlah_produk_terjual',
|
||||
name: 'jumlah_produk_terjual'
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
getCalculationPendapatan();
|
||||
})
|
||||
|
||||
function getCalculationPendapatan() {
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getCalculationPendapatan') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
changeDataFromCalculate('penjualanBulan', data.pendapatanBulan
|
||||
.penjualanSatuBulan, data.pendapatanBulan.percentageOfSalesGrowth,
|
||||
data.pendapatanBulan.statusCalculation)
|
||||
changeDataFromCalculate('penjualanHari', data.pendapatanHari
|
||||
.penjualanHariIni, data.pendapatanHari.percentageOfSalesGrowth,
|
||||
data.pendapatanHari.statusCalculation)
|
||||
changeDataFromCalculate('pengeluaranBulan', data.pengeluaranBulan
|
||||
.pengeluaranSatuBulan, data.pengeluaranBulan.percentageOfSalesGrowth,
|
||||
data.pengeluaranBulan.statusCalculation)
|
||||
changeDataFromCalculate('pengeluaranHari', data.pengeluaranHari
|
||||
.pengeluaranHariIni, data.pengeluaranHari.percentageOfSalesGrowth,
|
||||
data.pengeluaranHari.statusCalculation)
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changeDataFromCalculate(id, penjualanSatuBulan, percentageOfSalesGrowth, statusCalculation) {
|
||||
// change to IDR
|
||||
if (penjualanSatuBulan == null) {
|
||||
penjualanSatuBulan = 0;
|
||||
} else {
|
||||
penjualanSatuBulan;
|
||||
}
|
||||
|
||||
$('#' + id).append(converRp(penjualanSatuBulan));
|
||||
|
||||
// pembulatan 2 angka di belakang koma
|
||||
percentageOfSalesGrowth = percentageOfSalesGrowth.toFixed(2);
|
||||
switch (statusCalculation) {
|
||||
case 1:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-warning')
|
||||
break;
|
||||
case 2:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-up"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-success')
|
||||
break;
|
||||
case 3:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-down"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-danger')
|
||||
break;
|
||||
default:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-warning')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function converRp(params) {
|
||||
return ('Rp. ' + params.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.') ?? 0);
|
||||
}
|
||||
</script>
|
||||
@endpush
|
|
@ -0,0 +1,284 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('content-header')
|
||||
<div class="col-12">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0"> Dashboard</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item active">Dashboard</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-info card-outline" id="calculationPendapatan">
|
||||
{{-- <div class="card-header">
|
||||
<h5 class="card-title">Laporan Pendapatan dan Pengeluaran</h5>
|
||||
</div> --}}
|
||||
<!-- /.card-header -->
|
||||
|
||||
<!-- ./card-body -->
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="description-block border-left border-right">
|
||||
<span>
|
||||
<span class="description-percentage" id="penjualanHaripercentageOfSalesGrowth">
|
||||
</span>
|
||||
<small>Dari hari kemarin</small>
|
||||
</span>
|
||||
<h5 class="description-header" id="penjualanHari"></h5>
|
||||
<span class="description-text">Penjualan Hari ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="description-block border-right">
|
||||
<span>
|
||||
<span class="description-percentage" id="penjualanMinggupercentageOfSalesGrowth">
|
||||
</span>
|
||||
<small>Dari minggu kemarin</small>
|
||||
</span>
|
||||
<h5 class="description-header" id="penjualanMinggu"></h5>
|
||||
<span class="description-text">Penjualan Minggu ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="description-block border-right">
|
||||
<span>
|
||||
<span class="description-percentage" id="penjualanBulanpercentageOfSalesGrowth">
|
||||
</span>
|
||||
<small>Dari bulan kemarin</small>
|
||||
</span>
|
||||
<h5 class="description-header" id="penjualanBulan"></h5>
|
||||
<span class="description-text">Penjualan Bulan ini</span>
|
||||
</div>
|
||||
<!-- /.description-block -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.card-footer -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<!-- /.card -->
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="card-title">Penjualan per Minggu</h3>
|
||||
{{-- <a href="javascript:void(0);">View Report</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<p class="d-flex flex-column">
|
||||
<span class="text-bold text-lg" id="penjualanWeek"></span>
|
||||
<span>Penjualan Keseluruhan Minggu ini</span>
|
||||
</p>
|
||||
<p class="ml-auto d-flex flex-column text-right">
|
||||
<span id="persentaseWeek">
|
||||
</span>
|
||||
<span class="text-muted">dari minggu lalu</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.d-flex -->
|
||||
|
||||
<div class="position-relative mb-4">
|
||||
<canvas id="sales-chart-week" height="200"></canvas>
|
||||
</div>
|
||||
|
||||
{{-- <div class="d-flex flex-row justify-content-end">
|
||||
<span class="mr-2">
|
||||
<i class="fas fa-square text-primary"></i> minggu ini
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<i class="fas fa-square text-gray"></i> minggu Kemarin
|
||||
</span>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
<div class="col-lg-6">
|
||||
<!-- /.card -->
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="card-title">Penjualan per Bulan</h3>
|
||||
{{-- <a href="javascript:void(0);">View Report</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<p class="d-flex flex-column">
|
||||
<span class="text-bold text-lg" id="penjualanMonth"></span>
|
||||
<span>Penjualan Keseluruhan Bulan ini</span>
|
||||
</p>
|
||||
<p class="ml-auto d-flex flex-column text-right">
|
||||
<span id="persentaseMonth">
|
||||
</span>
|
||||
<span class="text-muted">dari bulan lalu</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.d-flex -->
|
||||
|
||||
<div class="position-relative mb-4">
|
||||
<canvas id="sales-chart-month" height="200"></canvas>
|
||||
</div>
|
||||
|
||||
{{-- <div class="d-flex flex-row justify-content-end">
|
||||
<span class="mr-2">
|
||||
<i class="fas fa-square text-primary"></i> Bulan ini
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<i class="fas fa-square text-gray"></i> Bulan Kemarin
|
||||
</span>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
<div class="col-lg-12">
|
||||
<!-- /.card -->
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="card-title">Penjualan per Tahun</h3>
|
||||
{{-- <a href="javascript:void(0);">View Report</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<p class="d-flex flex-column">
|
||||
<span class="text-bold text-lg" id="penjualanYear"></span>
|
||||
<span>Penjualan Keseluruhan Tahun ini</span>
|
||||
</p>
|
||||
<p class="ml-auto d-flex flex-column text-right">
|
||||
<span id="persentaseYear">
|
||||
</span>
|
||||
<span class="text-muted">dari tahun lalu</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.d-flex -->
|
||||
|
||||
<div class="position-relative mb-4">
|
||||
<canvas id="sales-chart-year" height="200"></canvas>
|
||||
</div>
|
||||
|
||||
{{-- <div class="d-flex flex-row justify-content-end">
|
||||
<span class="mr-2">
|
||||
<i class="fas fa-square text-primary"></i> Tahun ini
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<i class="fas fa-square text-gray"></i> Tahun Kemarin
|
||||
</span>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<h3 class="card-title">Makanan Terlaris</h3>
|
||||
<div class="card-tools">
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-bars"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body table-responsive p-0">
|
||||
<table class="table table-striped table-valign-middle" id="table-terlaris">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Menu</th>
|
||||
<th>Harga</th>
|
||||
<th>Terjual</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header border-0">
|
||||
<h3 class="card-title">Minuman Terlaris</h3>
|
||||
<div class="card-tools">
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
<a href="#" class="btn btn-tool btn-sm">
|
||||
<i class="fas fa-bars"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body table-responsive p-0">
|
||||
<table class="table table-striped table-valign-middle" id="table-minuman-terlaris">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Menu</th>
|
||||
<th>Harga</th>
|
||||
<th>Terjual</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col-md-6 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }} ">
|
||||
@endpush
|
||||
|
||||
@include('pages.admin.dashboard.js')
|
|
@ -0,0 +1,418 @@
|
|||
@push('scripts')
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<!-- ChartJS -->
|
||||
<script src="{{ asset('assets/plugins/chart.js/Chart.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
'use strict'
|
||||
|
||||
var ticksStyle = {
|
||||
fontColor: '#495057',
|
||||
fontStyle: 'bold'
|
||||
}
|
||||
|
||||
var mode = 'index'
|
||||
var intersect = true
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getChartWeek') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
$('#penjualanWeek').append(converRp(data.grandTotalThisWeek));
|
||||
changeDataFromCalculateChart('persentaseWeek', data
|
||||
.percentageOfSalesGrowth,
|
||||
data.statusCalculation)
|
||||
var $salesChart = $('#sales-chart-week')
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: Object.keys(data.thisWeek),
|
||||
datasets: [{
|
||||
backgroundColor: '#007bff',
|
||||
borderColor: '#007bff',
|
||||
data: Object.values(data.thisWeek)
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
// Include a dollar sign in the ticks
|
||||
callback: function(value, index,
|
||||
values) {
|
||||
return converRp(value)
|
||||
}
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(function() {
|
||||
'use strict'
|
||||
|
||||
var ticksStyle = {
|
||||
fontColor: '#495057',
|
||||
fontStyle: 'bold'
|
||||
}
|
||||
|
||||
var mode = 'index'
|
||||
var intersect = true
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getChartMonth') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
$('#penjualanMonth').append(converRp(data.grandTotalThisMonth));
|
||||
changeDataFromCalculateChart('persentaseMonth', data
|
||||
.percentageOfSalesGrowth,
|
||||
data.statusCalculation)
|
||||
var $salesChart = $('#sales-chart-month')
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: Object.keys(data.weekThisMonth),
|
||||
datasets: [{
|
||||
backgroundColor: '#007bff',
|
||||
borderColor: '#007bff',
|
||||
data: Object.values(data.weekThisMonth)
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
// Include a dollar sign in the ticks
|
||||
callback: function(value, index,
|
||||
values) {
|
||||
return converRp(value)
|
||||
}
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(function() {
|
||||
'use strict'
|
||||
|
||||
var ticksStyle = {
|
||||
fontColor: '#495057',
|
||||
fontStyle: 'bold'
|
||||
}
|
||||
|
||||
var mode = 'index'
|
||||
var intersect = true
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getChartYear') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
// console.log(data);
|
||||
$('#penjualanYear').append(converRp(data.grandTotalThisYear));
|
||||
changeDataFromCalculateChart('persentaseYear', data
|
||||
.percentageOfSalesGrowth,
|
||||
data.statusCalculation)
|
||||
var $salesChart = $('#sales-chart-year')
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: Object.keys(data.monthThisYear),
|
||||
datasets: [{
|
||||
backgroundColor: '#007bff',
|
||||
borderColor: '#007bff',
|
||||
data: Object.values(data.monthThisYear)
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
// Include a dollar sign in the ticks
|
||||
callback: function(value, index,
|
||||
values) {
|
||||
return converRp(value)
|
||||
}
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table-terlaris').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
searching: false,
|
||||
"bLengthChange": false,
|
||||
"bFilter": true,
|
||||
"bInfo": false,
|
||||
ajax: "{{ route('dashboard.menuTerlaris') }}",
|
||||
columns: [{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'nama_produk',
|
||||
name: 'nama_produk'
|
||||
},
|
||||
{
|
||||
data: 'harga_produk',
|
||||
name: 'harga_produk',
|
||||
'render': function(data, type, full, meta) {
|
||||
// change to IDR
|
||||
return 'Rp. ' + data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
},
|
||||
className: 'text-right'
|
||||
},
|
||||
{
|
||||
data: 'jumlah_produk_terjual',
|
||||
name: 'jumlah_produk_terjual'
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#table-minuman-terlaris').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
searching: false,
|
||||
"bLengthChange": false,
|
||||
"bFilter": true,
|
||||
"bInfo": false,
|
||||
ajax: "{{ route('dashboard.minumanTerlaris') }}",
|
||||
columns: [{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'nama_produk',
|
||||
name: 'nama_produk'
|
||||
},
|
||||
{
|
||||
data: 'harga_produk',
|
||||
name: 'harga_produk',
|
||||
'render': function(data, type, full, meta) {
|
||||
// change to IDR
|
||||
return 'Rp. ' + data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
},
|
||||
className: 'text-right'
|
||||
},
|
||||
{
|
||||
data: 'jumlah_produk_terjual',
|
||||
name: 'jumlah_produk_terjual'
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
getCalculationPendapatan();
|
||||
})
|
||||
|
||||
function getCalculationPendapatan() {
|
||||
$.ajax({
|
||||
url: "{{ route('dashboard.getCalculationPendapatan') }}",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
var data = response.data;
|
||||
console.log(data);
|
||||
changeDataFromCalculate('penjualanBulan', data.pendapatanBulan
|
||||
.penjualanSatuBulan, data.pendapatanBulan.percentageOfSalesGrowth,
|
||||
data.pendapatanBulan.statusCalculation)
|
||||
changeDataFromCalculate('penjualanMinggu', data.pendapatanMinggu
|
||||
.penjualanSatuMinggu, data.pendapatanMinggu.percentageOfSalesGrowth,
|
||||
data.pendapatanMinggu.statusCalculation)
|
||||
changeDataFromCalculate('penjualanHari', data.pendapatanHari
|
||||
.penjualanHariIni, data.pendapatanHari.percentageOfSalesGrowth,
|
||||
data.pendapatanHari.statusCalculation)
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changeDataFromCalculate(id, penjualanSatuBulan, percentageOfSalesGrowth, statusCalculation) {
|
||||
// change to IDR
|
||||
if (penjualanSatuBulan == null) {
|
||||
penjualanSatuBulan = 0;
|
||||
} else {
|
||||
penjualanSatuBulan;
|
||||
}
|
||||
|
||||
$('#' + id).append(converRp(penjualanSatuBulan));
|
||||
|
||||
// pembulatan 2 angka di belakang koma
|
||||
percentageOfSalesGrowth = percentageOfSalesGrowth.toFixed(2);
|
||||
switch (statusCalculation) {
|
||||
case 1:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-warning')
|
||||
break;
|
||||
case 2:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-up"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-success')
|
||||
break;
|
||||
case 3:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-down"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-danger')
|
||||
break;
|
||||
default:
|
||||
$('#' + id + 'percentageOfSalesGrowth').append('<i class="fas fa-caret-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id + 'percentageOfSalesGrowth').addClass('text-warning')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function changeDataFromCalculateChart(id, percentageOfSalesGrowth, statusCalculation) {
|
||||
// pembulatan 2 angka di belakang koma
|
||||
percentageOfSalesGrowth = percentageOfSalesGrowth.toFixed(2);
|
||||
switch (statusCalculation) {
|
||||
case 1:
|
||||
$('#' + id).append('<i class="fas fa-arrow-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id).addClass('text-warning')
|
||||
break;
|
||||
case 2:
|
||||
$('#' + id).append('<i class="fas fa-arrow-up"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id).addClass('text-success')
|
||||
break;
|
||||
case 3:
|
||||
$('#' + id).append('<i class="fas fa-arrow-down"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id).addClass('text-danger')
|
||||
break;
|
||||
default:
|
||||
$('#' + id).append('<i class="fas fa-arrow-left"></i> ' +
|
||||
percentageOfSalesGrowth + '%')
|
||||
$('#' + id).addClass('text-warning')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function converRp(params) {
|
||||
return ('Rp. ' + params.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.') ?? 0);
|
||||
}
|
||||
</script>
|
||||
@endpush
|
|
@ -135,7 +135,6 @@
|
|||
<th>Faktur</th>
|
||||
<th>Kebutuhan</th>
|
||||
<th>Jenis Transaksi</th>
|
||||
<th>Jenis Transaksi</th>
|
||||
<th>Tanggal Transaksi</th>
|
||||
<th>User</th>
|
||||
<th>Nominal</th>
|
||||
|
@ -159,7 +158,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@include('pages.admin.pengeluaran.js')
|
||||
@include('pages.admin.pengeluaran.style')
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
],
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
|
||||
ajax: {
|
||||
url: '{{ route('pengeluaran.getDataPengeluaran') }}',
|
||||
data: function(d) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
@push('styles')
|
||||
<!-- Toastr -->
|
||||
<style>
|
||||
@media only screen and (max-width : 991px) {
|
||||
/* Styles */
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 768px) {
|
||||
/* Styles */
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 414px) {
|
||||
/* Styles */
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/toastr/toastr.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }}">
|
||||
@endpush
|
|
@ -0,0 +1,104 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('content-header')
|
||||
<div class="col-12">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0"> Rekening Coa</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item">Home</li>
|
||||
<li class="breadcrumb-item">Master Data</li>
|
||||
<li class="breadcrumb-item active">Rekening Coa</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="content__boxed">
|
||||
<div class="content__wrap">
|
||||
<div class="row">
|
||||
<div class="col-md-5 col-sm-12 mt-2">
|
||||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-body">
|
||||
<div class="col-md-12">
|
||||
<form id="form_member" action="{{ route('coa.simpan') }}" method="POST">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h5>Form Input Data</h5>
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Kode COA <span style="color: red;">*</span></label>
|
||||
<select class="form-control form-control-sm" name="kode_coa" required>
|
||||
<option selected disabled>--Pilih Kode COA--</option>
|
||||
<option value="1">1. Aktifa</option>
|
||||
<option value="2">2. Pasiva</option>
|
||||
<option value="3">3. Modal</option>
|
||||
<option value="4">4. Pendapatan</option>
|
||||
<option value="5">5. Biaya</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Sub Kode COA <span style="color: red;">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm" name="sub_kode_coa" onkeypress="return number(event)" maxlength="3" required placeholder="Sub Kode COA">
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<input type="checkbox" id="ceklist" onchange="centang()">
|
||||
<label for="ceklist">Aktifkan Detail Coa</label>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<label>Detail COA</label>
|
||||
<input type="text" class="form-control form-control-sm" id="detail_coa" name="detail_coa" id="detail_coa" onkeypress="return number(event)" maxlength="3" disabled placeholder="Detail COA">
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<label>Keterangan COA <span style="color: red;">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm" name="keterangan_coa" required placeholder="Keterangan COA" required>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="btn-group">
|
||||
<button type="reset" class="btn btn-sm btn-warning mr-1">Bersihkan</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7 col-sm-12 mt-2">
|
||||
<div class="card">
|
||||
<div class="card bg-orange" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="tabelku" class="table table-striped display">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">No</th>
|
||||
<th>Kode COA</th>
|
||||
<th>Sub Kode COA</th>
|
||||
<th>Detail COA</th>
|
||||
<th>COA</th>
|
||||
<th>Keterangan COA</th>
|
||||
<th class="text-center"><i class="fas fa-cog"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('pages.admin.rekening_coa.modal')
|
||||
@endsection
|
||||
|
||||
@include('pages.admin.rekening_coa.style')
|
||||
@include('pages.admin.rekening_coa.js')
|
|
@ -0,0 +1,51 @@
|
|||
@push('scripts')
|
||||
<script src="{{ asset('assets/plugins/toastr/toastr.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<script>
|
||||
function centang(){
|
||||
var ceklist = document.getElementById("ceklist")
|
||||
var detailCoa = $('#detail_coa')
|
||||
|
||||
if(ceklist.checked === true){
|
||||
detailCoa.prop('disabled', false)
|
||||
}else{
|
||||
detailCoa.prop('disabled', true)
|
||||
}
|
||||
}
|
||||
function ubah(id_rekening_coa, kode_coa, sub_kode_coa, detail_coa_edit, keterangan_coa){
|
||||
$('#id_rekening_coa').val(id_rekening_coa)
|
||||
$('#kode_coa').val(kode_coa)
|
||||
$('#sub_kode_coa').val(sub_kode_coa)
|
||||
$('#detail_coa_edit').val(detail_coa_edit)
|
||||
$('#keterangan_coa').val(keterangan_coa)
|
||||
$('#formedit').attr('action','{{ route('coa.ubah','') }}/'+id_rekening_coa)
|
||||
$('#modal_edit').modal('show')
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
$('#tabelku').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
scrollY: false,
|
||||
ajax: '{{ route('coa.getData') }}',
|
||||
columns: [
|
||||
{data: 'nomor', name: 'nomor', orderable: false, className: 'text-center'},
|
||||
{data: 'kode_coa', name: 'kode_coa', className: 'text-center'},
|
||||
{data: 'sub_kode_coa', name: 'sub_kode_coa', className: 'text-center'},
|
||||
{data: 'detail_coa', name: 'detail_coa', className: 'text-center'},
|
||||
{data: 'coa', name: 'coa', className: 'text-center'},
|
||||
{data: 'keterangan_coa', name: 'keterangan_coa', className: 'text-center'},
|
||||
{data: 'ubah', name: 'ubah', className: 'text-center'},
|
||||
]
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
@if(session()->has('success'))
|
||||
toastr.success('{{ session('success') }}', 'BERHASIL');
|
||||
@elseif(session()->has('error'))
|
||||
toastr.error('{{ session('error') }}', 'GAGAL');
|
||||
@endif
|
||||
</script>
|
||||
@endpush
|
|
@ -0,0 +1,39 @@
|
|||
<div class="modal fade" id="modal_edit" aria-labelledby="exampleModalLabel" >
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Edit Data</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="formedit" action="" enctype="multipart/form-data" method="POST">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label class="form-label mt-3">Kode COA</label>
|
||||
<input type="hidden" class="form-control" name="id_rekening_coa" id="id_rekening_coa" required placeholder="Sub Kode COA">
|
||||
<input type="text" class="form-control" name="kode_coa" id="kode_coa" readonly placeholder="Sub Kode COA">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label mt-3">Sub Kode COA</label>
|
||||
<input type="text" class="form-control" name="sub_kode_coa" id="sub_kode_coa" readonly placeholder="Sub Kode COA">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label mt-3">Detail COA <span style="color: red;">*</span></label>
|
||||
<input type="text" class="form-control" name="detail_coa" id="detail_coa_edit" onkeypress="return number(event)" maxlength="3" placeholder="Detail COA" required>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label mt-3">Keterangan COA <span style="color: red;">*</span></label>
|
||||
<input type="text" class="form-control" name="keterangan_coa" id="keterangan_coa" placeholder="Keterangan COA" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,18 @@
|
|||
@push('styles')
|
||||
<!-- Toastr -->
|
||||
<style>
|
||||
@media only screen and (max-width : 991px) {
|
||||
/* Styles */
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 768px) {
|
||||
/* Styles */
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 414px) {
|
||||
/* Styles */
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/toastr/toastr.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }}">
|
||||
@endpush
|
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Admins\DashboardController;
|
||||
use App\Http\Controllers\Admins\Dashboard\CalculationController;
|
||||
use App\Http\Controllers\Admins\Dashboard\ChartPengeluaranController;
|
||||
use App\Http\Controllers\Admins\Dashboard\ChartPenjualanController;
|
||||
use App\Http\Controllers\Admins\Dashboard\DashboardController;
|
||||
use App\Http\Controllers\Admins\Pengeluaran\PengeluaranController;
|
||||
use App\Http\Controllers\Admins\RekeningCoa\RekeningCoaController;
|
||||
use App\Http\Controllers\Admins\Users\RoleController;
|
||||
use App\Http\Controllers\Admins\Users\UserController;
|
||||
use App\Http\Controllers\Auths\AuthController;
|
||||
|
@ -66,8 +70,12 @@ Route::group(['middleware' => ['auth', 'permission']], function () {
|
|||
Route::group(['prefix' => 'dashboard'], function () {
|
||||
Route::get('/', [DashboardController::class, 'index'])->name('dashboard.index')->comment('Halaman Dashboard');
|
||||
Route::get('/menuTerlaris', [DashboardController::class, 'menuTerlaris'])->name('dashboard.menuTerlaris')->comment("Ambil data Menu Terlaris");
|
||||
Route::get('/getCalculationPendapatan', [DashboardController::class, 'getCalculationPendapatan'])->name('dashboard.getCalculationPendapatan')->comment("Ambil data Total Penjualan");
|
||||
Route::get('/getChart', [DashboardController::class, 'getChart'])->name('dashboard.getChart')->comment("Ambil data Total Penjualan");
|
||||
Route::get('/minumanTerlaris', [DashboardController::class, 'minumanTerlaris'])->name('dashboard.minumanTerlaris')->comment("Ambil data Minuman Terlaris");
|
||||
Route::get('/getCalculationPendapatan', [CalculationController::class, 'getCalculationPendapatan'])->name('dashboard.getCalculationPendapatan')->comment("Ambil data Total Penjualan");
|
||||
Route::get('/getChartWeek', [ChartPenjualanController::class, 'getChartWeek'])->name('dashboard.getChartWeek')->comment("Ambil data Total Penjualan per Minggu");
|
||||
Route::get('/getChartMonth', [ChartPenjualanController::class, 'getChartMonth'])->name('dashboard.getChartMonth')->comment("Ambil data Total Penjualan per Bulan");
|
||||
Route::get('/getChartYear', [ChartPenjualanController::class, 'getChartYear'])->name('dashboard.getChartYear')->comment("Ambil data Total Penjualan per Tahun");
|
||||
Route::get('/getChartPengeluaran', [ChartPengeluaranController::class, 'getChartPengeluaran'])->name('dashboard.getChartPengeluaran')->comment("Ambil data Total Pengeluaran");
|
||||
});
|
||||
|
||||
|
||||
|
@ -104,4 +112,12 @@ Route::group(['middleware' => ['auth', 'permission']], function () {
|
|||
Route::post('/laporan', [PengeluaranController::class, 'laporan'])->name('pengeluaran.laporan')->comment('Halaman Laporan');
|
||||
Route::get('/getDatapengeluaran', [PengeluaranController::class, 'getDatapengeluaran'])->name('pengeluaran.getDataPengeluaran')->comment("Ambil data Riwayat Transaksi");
|
||||
});
|
||||
|
||||
// Rekening Coa
|
||||
Route::group(['prefix' => 'coa'], function () {
|
||||
Route::get('/', [RekeningCoaController::class, 'index'])->name('coa.index')->comment('Halaman Rekening Coa');
|
||||
Route::get('/getData', [RekeningCoaController::class, 'getData'])->name('coa.getData')->comment('Halaman Get Data Coa');
|
||||
Route::post('/simpan', [RekeningCoaController::class, 'simpan'])->name('coa.simpan')->comment('Halaman Simpan Rekening Coa');
|
||||
Route::post('/ubah/{id}', [RekeningCoaController::class, 'ubah'])->name('coa.ubah')->comment('Halaman Ubah Rekening Coa');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue