Compare commits
3 Commits
fc9557d37f
...
2724413e20
Author | SHA1 | Date |
---|---|---|
|
2724413e20 | |
|
81a14c5d8a | |
|
28ed616aa1 |
|
@ -90,3 +90,7 @@ function RemoveSpecialCharPlus($str)
|
|||
// Returning the result
|
||||
return $res;
|
||||
}
|
||||
|
||||
function toDmy($date){
|
||||
return date("d-m-Y", strtotime($date));
|
||||
}
|
|
@ -2,8 +2,16 @@
|
|||
|
||||
namespace App\Http\Controllers\Admins;
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -14,4 +22,302 @@ class DashboardController extends Controller
|
|||
{
|
||||
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();
|
||||
$pendapatanHari = $this->calculatePendapatanHari();
|
||||
$pengeluaranBulan = $this->calculatePengeluaranBulan();
|
||||
$pengeluaranHari = $this->calculatePengeluaranHari();
|
||||
|
||||
return ResponseFormatter::success(['pendapatanBulan' => $pendapatanBulan, 'pendapatanHari' => $pendapatanHari, 'pengeluaranBulan' => $pengeluaranBulan, 'pengeluaranHari' => $pengeluaranHari]);
|
||||
}
|
||||
|
||||
private function calculatePendapatanBulan()
|
||||
{
|
||||
// tanggal bulan ini
|
||||
$first_day_of_the_current_month = Carbon::today()->startOfMonth();
|
||||
$last_day_of_the_current_month = $first_day_of_the_current_month->copy()->endOfMonth();
|
||||
|
||||
// tanggal bulan lalu
|
||||
$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 = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_current_month, $last_day_of_the_current_month])->sum('grand_total');
|
||||
$penjualanBulanLalu = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_previous_month, $last_day_of_the_previous_month])->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 month and this month
|
||||
if ($penjualanBulanLalu != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanSatuBulan - $penjualanBulanLalu) / $penjualanBulanLalu * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'penjualanSatuBulan' => $penjualanSatuBulan,
|
||||
'penjualanBulanLalu' => $penjualanBulanLalu,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
}
|
||||
|
||||
private function calculatePendapatanHari()
|
||||
{
|
||||
// tanggal hari ini
|
||||
$first_day_of_the_current_day = Carbon::today()->startOfDay();
|
||||
|
||||
$last_day_of_the_current_day = $first_day_of_the_current_day->copy()->endOfDay();
|
||||
|
||||
// tanggal kemarin
|
||||
$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 = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_current_day, $last_day_of_the_current_day])->sum('grand_total');
|
||||
$penjualanKemarin = Pesanan::whereBetween('tanggal_pesanan', [$first_day_of_the_previous_day, $last_day_of_the_previous_day])->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 month and this month
|
||||
if ($penjualanKemarin != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanHariIni - $penjualanKemarin) / $penjualanKemarin * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'penjualanHariIni' => $penjualanHariIni,
|
||||
'penjualanKemarin' => $penjualanKemarin,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
}
|
||||
|
||||
private function calculatePengeluaranBulan()
|
||||
{
|
||||
// tanggal bulan ini
|
||||
$first_day_of_the_current_month = Carbon::today()->startOfMonth();
|
||||
$last_day_of_the_current_month = $first_day_of_the_current_month->copy()->endOfMonth();
|
||||
|
||||
// tanggal bulan lalu
|
||||
$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');
|
||||
|
||||
/**
|
||||
* @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 month and this month
|
||||
if ($penjualanBulanLalu != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanSatuBulan - $penjualanBulanLalu) / $penjualanBulanLalu * 100;
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'penjualanSatuBulan' => $penjualanSatuBulan,
|
||||
'penjualanBulanLalu' => $penjualanBulanLalu,
|
||||
'statusCalculation' => $statusCalculation,
|
||||
'percentageOfSalesGrowth' => $percentageOfSalesGrowth
|
||||
];
|
||||
}
|
||||
|
||||
private function calculatePengeluaranHari()
|
||||
{
|
||||
// tanggal hari ini
|
||||
$first_day_of_the_current_day = Carbon::today()->startOfDay();
|
||||
|
||||
$last_day_of_the_current_day = $first_day_of_the_current_day->copy()->endOfDay();
|
||||
|
||||
// tanggal kemarin
|
||||
$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');
|
||||
|
||||
/**
|
||||
* @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 month and this month
|
||||
if ($penjualanKemarin != 0) {
|
||||
$statusCalculation = 2;
|
||||
$percentageOfSalesGrowth = ($penjualanHariIni - $penjualanKemarin) / $penjualanKemarin * 100;
|
||||
|
||||
// minus or not
|
||||
if ($percentageOfSalesGrowth < 0) {
|
||||
$statusCalculation = 3;
|
||||
$percentageOfSalesGrowth = $percentageOfSalesGrowth * -1;
|
||||
}
|
||||
} else {
|
||||
$statusCalculation = 1;
|
||||
$percentageOfSalesGrowth = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'penjualanHariIni' => $penjualanHariIni,
|
||||
'penjualanKemarin' => $penjualanKemarin,
|
||||
'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,120 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admins\Pengeluaran;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\BukuBesar;
|
||||
use App\Models\Pengeluaran;
|
||||
use App\Models\RekeningCoa;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PengeluaranController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(){
|
||||
$coaBiaya = RekeningCoa::where('kode_coa', 5)->get();
|
||||
$rekeningCoaTf = RekeningCoa::where('kode_coa', 1)->where('sub_kode_coa', 200)->get();
|
||||
|
||||
return view('pages.admin.pengeluaran.index', compact('coaBiaya', 'rekeningCoaTf'));
|
||||
}
|
||||
|
||||
public function simpan(Request $request){
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$user = request()->user();
|
||||
|
||||
Pengeluaran::create([
|
||||
'faktur' => "PG-".date('YmdHis'),
|
||||
'tanggal' => $request->tanggal,
|
||||
'jenis_transaksi' => $request->jenis_transaksi,
|
||||
'nominal' => $request->nominal,
|
||||
'keterangan' => $request->keterangan,
|
||||
'user_id' => $user->id
|
||||
]);
|
||||
if ($request->jenis_transaksi == "1") {
|
||||
BukuBesar::create([
|
||||
'faktur' => "PG-".date('YmdHis'),
|
||||
'tanggal' => $request->tanggal,
|
||||
'rekening_coa_id' => "2",
|
||||
'kode_rekening_coa' => "1.100.01",
|
||||
'keterangan_coa' => "Kas Kasir",
|
||||
'keterangan' => $request->keterangan,
|
||||
'debet' => 0,
|
||||
'kredit' => $request->nominal
|
||||
]);
|
||||
BukuBesar::create([
|
||||
'faktur' => "PG-".date('YmdHis'),
|
||||
'tanggal' => $request->tanggal,
|
||||
'rekening_coa_id' => $request->id_rekening_coa,
|
||||
'kode_rekening_coa' => $request->kode_coa,
|
||||
'keterangan_coa' => $request->keterangan_coa,
|
||||
'keterangan' => $request->keterangan,
|
||||
'debet' => $request->nominal,
|
||||
'kredit' => 0,
|
||||
]);
|
||||
}else{
|
||||
BukuBesar::create([
|
||||
'faktur' => "PG-".date('YmdHis'),
|
||||
'tanggal' => $request->tanggal,
|
||||
'rekening_coa_id' => $request->id_rekening_coa_transfer,
|
||||
'kode_rekening_coa' => $request->kode_coa_transfer,
|
||||
'keterangan_coa' => $request->keterangan_coa_transfer,
|
||||
'keterangan' => $request->keterangan,
|
||||
'debet' => 0,
|
||||
'kredit' => $request->nominal
|
||||
]);
|
||||
BukuBesar::create([
|
||||
'faktur' => "PG-".date('YmdHis'),
|
||||
'tanggal' => $request->tanggal,
|
||||
'rekening_coa_id' => $request->id_rekening_coa,
|
||||
'kode_rekening_coa' => $request->kode_coa,
|
||||
'keterangan_coa' => $request->keterangan_coa,
|
||||
'keterangan' => $request->keterangan,
|
||||
'debet' => $request->nominal,
|
||||
'kredit' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Data berhasil tersimpan']);
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
|
||||
dd($th->getMessage());
|
||||
return response()->json(['status' => false, 'message' => 'Kesalahan menyimpan data']);
|
||||
}
|
||||
}
|
||||
|
||||
public function laporan(Request $request){
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4',
|
||||
'orientation' => 'portrait',
|
||||
'margin_left' => 15,
|
||||
'margin_right' => 15,
|
||||
'margin_top' => 10,
|
||||
'margin_bottom' => 10,
|
||||
'default_font_size' => 9,
|
||||
'default_font' => 'arial',
|
||||
]);
|
||||
$mpdf->AddPage();
|
||||
$mpdf->setFooter('{PAGENO}');
|
||||
|
||||
$data = Pengeluaran::with('user')->whereDate('tanggal', '>=', $request->filter_tanggal_1)
|
||||
->whereDate('tanggal', '<=', $request->filter_tanggal_2)
|
||||
->get();
|
||||
$html = view('pages.admin.pengeluaran.laporan', [
|
||||
'data' => $data,
|
||||
'filter_tanggal_1' => $request->filter_tanggal_1,
|
||||
'filter_tanggal_2' => $request->filter_tanggal_2,
|
||||
]);
|
||||
$mpdf->writeHTML($html);
|
||||
$mpdf->Output('Laporan_Pengeluaran.pdf', 'I');
|
||||
return response()->header('Content-Type', 'application/pdf');
|
||||
}
|
||||
}
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
namespace App\Http\Controllers\Admins\Users;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
@ -19,21 +22,36 @@ class UserController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
// call table user with pagination
|
||||
$users = User::latest()->paginate(10);
|
||||
|
||||
return view('pages.admin.users.index', compact('users'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
// fetch data role
|
||||
$roles = Role::latest()->get();
|
||||
|
||||
// call view users.create
|
||||
return view('pages.admin.users.create', compact('roles'));
|
||||
return view('pages.admin.users.index', compact('roles'));
|
||||
}
|
||||
|
||||
public function getDataUser()
|
||||
{
|
||||
$users = User::with('role')->latest()->get();
|
||||
|
||||
return datatables()->of($users)
|
||||
->addColumn('rolenya', function ($users) {
|
||||
$roles = '';
|
||||
foreach ($users->role as $role) {
|
||||
$roles .= '<span class="badge badge-primary">' . $role->name . '</span> ';
|
||||
}
|
||||
return $roles;
|
||||
})
|
||||
->addColumn('action', function ($users) {
|
||||
return '
|
||||
<button class="btn btn-sm btn-warning btn-edit-user" data-id=' . $users->id . '><i class="fas fa-edit"></i></button>
|
||||
<button class="btn btn-sm btn-danger btn-hapus-user" data-id=' . $users->id . '><i class="fas fa-trash"></i></button>
|
||||
';
|
||||
})
|
||||
->addColumn('updated_atnya', function ($users) {
|
||||
return tanggal_indonesia($users->updated_at) . ' ' . $users->updated_at->format('H:i:s');
|
||||
})
|
||||
->rawColumns(['action' => 'action', 'rolenya' => 'rolenya', 'updated_atnya' => 'updated_atnya'])
|
||||
->addIndexColumn()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,19 +60,30 @@ class UserController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
// validation
|
||||
$rules = array(
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|min:8'
|
||||
);
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required|min:8|confirmed',
|
||||
'role_id' => 'required'
|
||||
], [
|
||||
'name.required' => 'Nama tidak boleh kosong!',
|
||||
'email.required' => 'Email tidak boleh kosong!',
|
||||
'email.email' => 'Email tidak valid!',
|
||||
'email.unique' => 'Email sudah terdaftar!',
|
||||
'password.required' => 'Password tidak boleh kosong!',
|
||||
'password.min' => 'Password minimal 8 karakter!',
|
||||
'password.confirmed' => 'Password tidak sama!',
|
||||
'role_id.required' => 'Role tidak boleh kosong!',
|
||||
]);
|
||||
|
||||
// check validation
|
||||
if ($validator->fails()) {
|
||||
return Redirect::to('admin/users/create')
|
||||
->withErrors($validator)
|
||||
->withInput($request->except('password'));
|
||||
} else {
|
||||
return ResponseFormatter::error($validator->errors()->first());
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
// create new account
|
||||
$user = User::create([
|
||||
'name' => $request->name,
|
||||
|
@ -63,16 +92,15 @@ class UserController extends Controller
|
|||
]);
|
||||
|
||||
// Create role for user
|
||||
$role = Role::findOrFail($request->role); // Pengunjung
|
||||
foreach ($request->role_id as $key => $value) {
|
||||
$role = Role::findOrFail($value); // Pengunjung
|
||||
$user->assignRole($role);
|
||||
|
||||
// Create Session message
|
||||
Session::flash('users-message', [
|
||||
'type' => 'success',
|
||||
'msg' => 'Anda berhasil menambahkan data!'
|
||||
]);
|
||||
|
||||
return Redirect::to('admin/users');
|
||||
}
|
||||
DB::commit();
|
||||
return ResponseFormatter::success($user, "User berhasil ditambahkan");
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
return ResponseFormatter::error($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,11 +118,10 @@ class UserController extends Controller
|
|||
public function edit(string $id)
|
||||
{
|
||||
// get data from user
|
||||
$user = User::findOrFail($id);
|
||||
$roles = Role::latest()->get();
|
||||
|
||||
// call view pages
|
||||
return view('pages.admin.users.edit', compact('user', 'roles'));
|
||||
$user = User::with('role')->findOrFail($id);
|
||||
return ResponseFormatter::success([
|
||||
'user' => $user
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,6 +102,9 @@ class AuthController extends Controller
|
|||
|
||||
try {
|
||||
if (Auth::attempt($validator->validated(), $request->has('remember_me') ? true : false)) {
|
||||
$user = auth()->user();
|
||||
session()->put('id', $user->id);
|
||||
session()->put('name', $user->name);
|
||||
Session::flash('login-message', [
|
||||
'type' => 'success',
|
||||
'msg' => 'Anda berhasil melakukan Login!'
|
||||
|
|
|
@ -22,15 +22,15 @@ class History extends Controller
|
|||
$filter_tanggal_2 = $request->filter_tanggal_2;
|
||||
$data = Pesanan::with(['detailPesanan', 'user'])
|
||||
->when($filter_tanggal_1, function ($query) use ($filter_tanggal_1) {
|
||||
return $query->whereDate('created_at', '>=', $filter_tanggal_1);
|
||||
return $query->whereDate('tanggal_pesanan', '>=', $filter_tanggal_1);
|
||||
})
|
||||
->when($filter_tanggal_2, function ($query) use ($filter_tanggal_2) {
|
||||
return $query->whereDate('created_at', '<=', $filter_tanggal_2);
|
||||
return $query->whereDate('tanggal_pesanan', '<=', $filter_tanggal_2);
|
||||
})
|
||||
->when(!$filter_tanggal_1 && !$filter_tanggal_2, function ($query) {
|
||||
return $query->whereDate('created_at', Carbon::today());
|
||||
return $query->whereDate('tanggal_pesanan', Carbon::today());
|
||||
})
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('tanggal_pesanan', 'desc')
|
||||
->get();
|
||||
|
||||
return datatables()
|
||||
|
@ -70,7 +70,8 @@ class History extends Controller
|
|||
return view('pages.Kasir.print_dapur', compact('pesanan'));
|
||||
}
|
||||
|
||||
public function getDataDetailHistory(Request $request){
|
||||
public function getDataDetailHistory(Request $request)
|
||||
{
|
||||
$data = DetailPesanan::with('pesanan')->where('pesanan_id', $request->id_pesanan)->get();
|
||||
|
||||
return response()->json(['status' => true, 'data' => $data]);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LaporanController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('pages.admin.laporan.index');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MenuTerlarisView extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'menu_terlaris_view';
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pengeluaran extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'pengeluaran';
|
||||
protected $guarded = [];
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Helpers\ResponseFormatter;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
trait FailedValidation
|
||||
{
|
||||
/**
|
||||
* Useful for auto create id with uuid when first call create function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
throw new HttpResponseException(ResponseFormatter::error($validator->errors()->first(), 400));
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@
|
|||
"laravel/framework": "^10.10",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/tinker": "^2.8",
|
||||
"mpdf/mpdf": "^8.2",
|
||||
"realrashid/sweet-alert": "^6.0",
|
||||
"spatie/laravel-permission": "^6.3",
|
||||
"yajra/laravel-datatables": "^10.1"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "c2a087156cf7cdb5fbd03918562d593c",
|
||||
"content-hash": "622a1b44adad65bf17c6308f5e4f8fe0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
@ -2387,6 +2387,238 @@
|
|||
],
|
||||
"time": "2023-10-27T15:32:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v8.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "596a87b876d7793be7be060a8ac13424de120dd5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/596a87b876d7793be7be060a8ac13424de120dd5",
|
||||
"reference": "596a87b876d7793be7be060a8ac13424de120dd5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"mpdf/psr-http-message-shim": "^1.0 || ^2.0",
|
||||
"mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
|
||||
"myclabs/deep-copy": "^1.7",
|
||||
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
|
||||
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
|
||||
"psr/http-message": "^1.0 || ^2.0",
|
||||
"psr/log": "^1.0 || ^2.0 || ^3.0",
|
||||
"setasign/fpdi": "^2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.0",
|
||||
"mpdf/qrcode": "^1.1.0",
|
||||
"squizlabs/php_codesniffer": "^3.5.0",
|
||||
"tracy/tracy": "~2.5",
|
||||
"yoast/phpunit-polyfills": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "Needed for generation of some types of barcodes",
|
||||
"ext-xml": "Needed mainly for SVG manipulation",
|
||||
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Mpdf\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Matěj Humpál",
|
||||
"role": "Developer, maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Ian Back",
|
||||
"role": "Developer (retired)"
|
||||
}
|
||||
],
|
||||
"description": "PHP library generating PDF files from UTF-8 encoded HTML",
|
||||
"homepage": "https://mpdf.github.io",
|
||||
"keywords": [
|
||||
"pdf",
|
||||
"php",
|
||||
"utf-8"
|
||||
],
|
||||
"support": {
|
||||
"docs": "http://mpdf.github.io",
|
||||
"issues": "https://github.com/mpdf/mpdf/issues",
|
||||
"source": "https://github.com/mpdf/mpdf"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.paypal.me/mpdf",
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-07T13:52:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/psr-http-message-shim",
|
||||
"version": "v2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/psr-http-message-shim.git",
|
||||
"reference": "f25a0153d645e234f9db42e5433b16d9b113920f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/psr-http-message-shim/zipball/f25a0153d645e234f9db42e5433b16d9b113920f",
|
||||
"reference": "f25a0153d645e234f9db42e5433b16d9b113920f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"psr/http-message": "^2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mpdf\\PsrHttpMessageShim\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mark Dorison",
|
||||
"email": "mark@chromatichq.com"
|
||||
},
|
||||
{
|
||||
"name": "Kristofer Widholm",
|
||||
"email": "kristofer@chromatichq.com"
|
||||
},
|
||||
{
|
||||
"name": "Nigel Cunningham",
|
||||
"email": "nigel.cunningham@technocrat.com.au"
|
||||
}
|
||||
],
|
||||
"description": "Shim to allow support of different psr/message versions.",
|
||||
"support": {
|
||||
"issues": "https://github.com/mpdf/psr-http-message-shim/issues",
|
||||
"source": "https://github.com/mpdf/psr-http-message-shim/tree/v2.0.1"
|
||||
},
|
||||
"time": "2023-10-02T14:34:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/psr-log-aware-trait",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/psr-log-aware-trait.git",
|
||||
"reference": "a633da6065e946cc491e1c962850344bb0bf3e78"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/psr-log-aware-trait/zipball/a633da6065e946cc491e1c962850344bb0bf3e78",
|
||||
"reference": "a633da6065e946cc491e1c962850344bb0bf3e78",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"psr/log": "^3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mpdf\\PsrLogAwareTrait\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mark Dorison",
|
||||
"email": "mark@chromatichq.com"
|
||||
},
|
||||
{
|
||||
"name": "Kristofer Widholm",
|
||||
"email": "kristofer@chromatichq.com"
|
||||
}
|
||||
],
|
||||
"description": "Trait to allow support of different psr/log versions.",
|
||||
"support": {
|
||||
"issues": "https://github.com/mpdf/psr-log-aware-trait/issues",
|
||||
"source": "https://github.com/mpdf/psr-log-aware-trait/tree/v3.0.0"
|
||||
},
|
||||
"time": "2023-05-03T06:19:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.11.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-08T13:26:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "2.72.1",
|
||||
|
@ -2879,6 +3111,56 @@
|
|||
],
|
||||
"time": "2024-01-09T09:30:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.100",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
|
||||
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">= 7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"support": {
|
||||
"email": "info@paragonie.com",
|
||||
"issues": "https://github.com/paragonie/random_compat/issues",
|
||||
"source": "https://github.com/paragonie/random_compat"
|
||||
},
|
||||
"time": "2020-10-15T08:29:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpspreadsheet",
|
||||
"version": "1.29.0",
|
||||
|
@ -3865,6 +4147,78 @@
|
|||
],
|
||||
"time": "2023-02-15T07:13:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
"version": "v2.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Setasign/FPDI.git",
|
||||
"reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6db878129ec6c7e141316ee71872923e7f1b7ad",
|
||||
"reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-zlib": "*",
|
||||
"php": "^5.6 || ^7.0 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"setasign/tfpdf": "<1.31"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~5.7",
|
||||
"setasign/fpdf": "~1.8.6",
|
||||
"setasign/tfpdf": "~1.33",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"tecnickcom/tcpdf": "~6.2"
|
||||
},
|
||||
"suggest": {
|
||||
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"setasign\\Fpdi\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Slabon",
|
||||
"email": "jan.slabon@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
},
|
||||
{
|
||||
"name": "Maximilian Kresse",
|
||||
"email": "maximilian.kresse@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
}
|
||||
],
|
||||
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||
"homepage": "https://www.setasign.com/fpdi",
|
||||
"keywords": [
|
||||
"fpdf",
|
||||
"fpdi",
|
||||
"pdf"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Setasign/FPDI/issues",
|
||||
"source": "https://github.com/Setasign/FPDI/tree/v2.6.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-11T16:03:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "6.3.0",
|
||||
|
@ -7388,65 +7742,6 @@
|
|||
},
|
||||
"time": "2023-12-10T02:24:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.11.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-08T13:26:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nunomaduro/collision",
|
||||
"version": "v7.10.0",
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('pengeluaran', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('faktur')->nullable();
|
||||
$table->date('tanggal')->nullable();
|
||||
$table->integer('jenis_transaksi')->nullable()->comment('1 = Tunai, 2 = Transfer');
|
||||
$table->integer('nominal')->nullable();
|
||||
$table->string('keterangan')->nullable();
|
||||
$table->foreignId('user_id')->nullable()->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pengeluaran');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('CREATE OR REPLACE VIEW menu_terlaris_view AS
|
||||
SELECT
|
||||
detail_pesanans.produk_id,
|
||||
produks.*,
|
||||
COUNT(detail_pesanans.produk_id) AS jumlah_produk_terjual
|
||||
FROM
|
||||
detail_pesanans
|
||||
JOIN produks ON produks.id = detail_pesanans.produk_id
|
||||
GROUP BY
|
||||
detail_pesanans.produk_id,
|
||||
produks.nama_produk
|
||||
ORDER BY
|
||||
jumlah_produk_terjual DESC
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('DROP VIEW IF EXISTS menu_terlaris_view');
|
||||
}
|
||||
};
|
|
@ -15,13 +15,13 @@
|
|||
</li>
|
||||
@endcan
|
||||
<li class="nav-item dropdown">
|
||||
<a id="dropdownSubMenu1" href="#" data-toggle="dropdown" aria-haspopup="true"
|
||||
<a id="dropdownSubMenu1" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="false" class="nav-link dropdown-toggle">Transaksi</a>
|
||||
<ul aria-labelledby="dropdownSubMenu1" class="dropdown-menu border-0 shadow">
|
||||
<li><a href="#" class="dropdown-item">Order </a></li>
|
||||
<li><a href="#" class="dropdown-item">Pengeluaran</a></li>
|
||||
<li><a href="{{ route('pengeluaran.index') }}" class="dropdown-item">Pengeluaran</a></li>
|
||||
<li class="dropdown-divider"></li>
|
||||
<li><a href="#" class="dropdown-item">Laporan</a></li>
|
||||
<li><a href="{{ route('laporan.index') }}" class="dropdown-item">Laporan</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@canany(['users.index', 'menu.index'], auth()->user())
|
||||
|
|
|
@ -93,10 +93,7 @@
|
|||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// GrandTotal over all pages
|
||||
diskonTotal = api
|
||||
.column(7)
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
|
||||
// Total over this page
|
||||
pageTotal = api
|
||||
|
@ -116,7 +113,6 @@
|
|||
api.column(5).footer().innerHTML = totalPesanan + ' Item';
|
||||
api.column(6).footer().innerHTML =
|
||||
'Rp. ' + pageTotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
api.column(7).footer().innerHTML = diskonTotal + ' %';
|
||||
api.column(8).footer().innerHTML =
|
||||
'Rp. ' + totalAll.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
}
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('content-header')
|
||||
<div class="col-12">
|
||||
<div class="col-12">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0"> Kasir <small>kasir 3.0</small></h1>
|
||||
<h3 class="m-0"> Master Data</h3>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="#">Kasir</a></li>
|
||||
<li class="breadcrumb-item active">History</li>
|
||||
<li class="breadcrumb-item"><a href="#">Admin</a></li>
|
||||
<li class="breadcrumb-item active">Menus</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-12 mt-2">
|
||||
<div class="col-12 mt-2">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-header mt-0 pt-0">
|
||||
<div class="d-flex">
|
||||
<h3>Daftar Menu</h3>
|
||||
<h4>Daftar Menu</h4>
|
||||
<!-- Button trigger modal -->
|
||||
<div class="ml-auto">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-default">
|
||||
|
@ -54,10 +54,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Tambah Menu -->
|
||||
<div class="modal fade" id="modal-default">
|
||||
<!-- Modal Tambah Menu -->
|
||||
<div class="modal fade" id="modal-default">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
@ -84,12 +84,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<!-- Toastr -->
|
||||
<style>
|
||||
<!-- Toastr -->
|
||||
<style>
|
||||
@media only screen and (max-width : 991px) {
|
||||
/* Styles */
|
||||
}
|
||||
|
@ -101,14 +101,14 @@
|
|||
@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')}}">
|
||||
</style>
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/toastr/toastr.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<script>
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#tabelku').DataTable({
|
||||
processing: true,
|
||||
|
@ -144,5 +144,5 @@
|
|||
]
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
@endpush
|
|
@ -18,14 +18,348 @@
|
|||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-12 mt-2">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-body">
|
||||
<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,33 @@
|
|||
@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"> Laporan</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="#">Admin</a></li>
|
||||
<li class="breadcrumb-item active">Laporan</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-12 mt-2">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
|
@ -0,0 +1,126 @@
|
|||
@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"> Pengeluaran</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item">Home</li>
|
||||
<li class="breadcrumb-item">Transaksi</li>
|
||||
<li class="breadcrumb-item active">Pengeluaran</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="content__boxed">
|
||||
<div class="content__wrap">
|
||||
<div class="row">
|
||||
<div class="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">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h5>Form Input Data</h5>
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Tanggal</label>
|
||||
<input type="date" class="form-control" id="tanggal" value="{{ date('Y-m-d') }}">
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Jenis Transaksi</label>
|
||||
<select class="form-control" id="jenis_transaksi">
|
||||
<option value="" selected>--Pilih Jenis Transkasi--</option>
|
||||
<option value="1">Tunai</option>
|
||||
<option value="2">Transfer</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Rekening Coa Kebutuhan</label>
|
||||
<select class="form-control" id="rekening_coa_kebutuhan">
|
||||
<option value="" selected>--Pilih Rekening Coa--</option>
|
||||
@foreach ($coaBiaya as $biaya)
|
||||
@if ($biaya->status == 0)
|
||||
<optgroup label="{{ $biaya->coa }} | {{ $biaya->keterangan_coa }}">
|
||||
@else
|
||||
<option
|
||||
value="{{ $biaya->id }}|{{ $biaya->coa }}|{{ $biaya->keterangan_coa }}">
|
||||
{{ $biaya->coa }} | {{ $biaya->keterangan_coa }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Nominal</label>
|
||||
<input type="number" min="0" class="form-control" id="nominal" placeholder="Nominal Pengeluaran">
|
||||
</div>
|
||||
<div class="col-md-6 mt-3">
|
||||
<label>Keterangan</label>
|
||||
<textarea class="form-control" id="keterangan" placeholder="Keterangan"></textarea>
|
||||
</div>
|
||||
<div hidden class="transfer col-6 mt-3">
|
||||
<label class="form-label">Rekening Coa Jenis Transaksi</label>
|
||||
<select class="form-control" id="rekening_coa_transfer">
|
||||
<option selected disabled>--Pilih Rekening Coa--</option>
|
||||
@foreach ($rekeningCoaTf as $coaTf)
|
||||
@if ($coaTf->status == 0)
|
||||
<optgroup label="{{ $coaTf->coa }} | {{ $coaTf->keterangan_coa }}">
|
||||
@else
|
||||
<option value="{{ $biaya->id }}|{{ $coaTf->coa }}|{{ $coaTf->keterangan_coa }}">
|
||||
{{ $coaTf->coa }} | {{ $coaTf->keterangan_coa }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<a href="javascript:void(0)" class="btn btn-warning" id="simpan_pengeluaran">Simpan Data</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="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 action="{{ route('pengeluaran.laporan') }}" method="POST">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h5>Form Laporan</h5>
|
||||
</div>
|
||||
<div class="col-md-4 mt-3">
|
||||
<label>Dari Tanggal</label>
|
||||
<input type="date" class="form-control" name="filter_tanggal_1" value="{{ date('Y-m-d') }}">
|
||||
</div>
|
||||
<div class="col-md-4 mt-3">
|
||||
<label>Sampai Tanggal</label>
|
||||
<input type="date" class="form-control" name="filter_tanggal_2" value="{{ date('Y-m-d') }}">
|
||||
</div>
|
||||
<div class="col-md-4 mt-5">
|
||||
<button type="submit" class="btn btn-warning" id="filter_laporan">Preview</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@include('pages.admin.pengeluaran.js')
|
|
@ -0,0 +1,92 @@
|
|||
@push('scripts')
|
||||
<script src="{{ asset('assets/plugins/toastr/toastr.min.js') }}"></script>
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
$('#jenis_transaksi').on('change', function(){
|
||||
if ($("#jenis_transaksi").val() == "1") {
|
||||
$(".transfer").prop('hidden', true)
|
||||
}else if($("#jenis_transaksi").val() == "2"){
|
||||
$(".transfer").prop('hidden', false)
|
||||
}else{
|
||||
$(".transfer").prop('hidden', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#simpan_pengeluaran').on('click', function() {
|
||||
// Jika jenis transaksi tunai
|
||||
if($("#jenis_transaksi").val() == "1"){
|
||||
let rekening_coa_kebutuhan = $("#rekening_coa_kebutuhan").val()
|
||||
let split_rekening_coa_kebutuhan = rekening_coa_kebutuhan.split("|")
|
||||
let id_rekening_coa = split_rekening_coa_kebutuhan[0]
|
||||
let kode_coa = split_rekening_coa_kebutuhan[1]
|
||||
let keterangan_coa = split_rekening_coa_kebutuhan[2]
|
||||
let dataTunai = {
|
||||
tanggal : $("#tanggal").val(),
|
||||
jenis_transaksi : $("#jenis_transaksi").val(),
|
||||
nominal : $("#nominal").val(),
|
||||
keterangan : $("#keterangan").val(),
|
||||
id_rekening_coa : id_rekening_coa,
|
||||
kode_coa : kode_coa,
|
||||
keterangan_coa : keterangan_coa,
|
||||
}
|
||||
// return console.log(dataTunai);
|
||||
$.ajax({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
type: "POST",
|
||||
url: "{{ route('pengeluaran.simpan') }}",
|
||||
data: dataTunai,
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
alert(result.message)
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
let rekening_coa_kebutuhan = $("#rekening_coa_kebutuhan").val()
|
||||
let split_rekening_coa_kebutuhan = rekening_coa_kebutuhan.split("|")
|
||||
let id_rekening_coa = split_rekening_coa_kebutuhan[0]
|
||||
let kode_coa = split_rekening_coa_kebutuhan[1]
|
||||
let keterangan_coa = split_rekening_coa_kebutuhan[2]
|
||||
let rekening_coa_transfer = $("#rekening_coa_transfer").val()
|
||||
let split_rekening_coa_transfer = rekening_coa_transfer.split("|")
|
||||
let id_rekening_coa_transfer = split_rekening_coa_transfer[0]
|
||||
let kode_coa_transfer = split_rekening_coa_transfer[1]
|
||||
let keterangan_coa_transfer = split_rekening_coa_transfer[2]
|
||||
let dataTranfer = {
|
||||
tanggal : $("#tanggal").val(),
|
||||
jenis_transaksi : $("#jenis_transaksi").val(),
|
||||
nominal : $("#nominal").val(),
|
||||
keterangan : $("#keterangan").val(),
|
||||
id_rekening_coa : id_rekening_coa,
|
||||
kode_coa : kode_coa,
|
||||
keterangan_coa : keterangan_coa,
|
||||
id_rekening_coa_transfer : id_rekening_coa_transfer,
|
||||
kode_coa_transfer : kode_coa_transfer,
|
||||
keterangan_coa_transfer : keterangan_coa_transfer,
|
||||
}
|
||||
// return console.log(dataTranfer);
|
||||
$.ajax({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
type: "POST",
|
||||
url: "{{ route('pengeluaran.simpan') }}",
|
||||
data: dataTranfer,
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
alert(result.message)
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Laporan Pengeluaran</title>
|
||||
</head>
|
||||
<body>
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td>Tanggal Unduh: {{ date('d-m-Y H:i:s') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dicetak Oleh: {{ Session::get('name') }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td style="text-align: center; font-size: 20px; font-weight: bold;">Laporan Pengeluaran</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: center;">Pencarian: {{ 'Antara Tanggal '.toDmy($filter_tanggal_1).' s/d Tanggal '.toDmy($filter_tanggal_2).'' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width: 100%; border-collapse:collapse; border:1px solid black;">
|
||||
<thead style="border-collapse:collapse; border:1px solid black;">
|
||||
<tr style="border-collapse:collapse; border:1px solid black;">
|
||||
<th style="border-collapse:collapse; border:1px solid black;">No</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">Faktur</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">Tanggal</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">Jenis Transaksi</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">Nominal</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">Keterangan</th>
|
||||
<th style="border-collapse:collapse; border:1px solid black;">User</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="border-collapse:collapse; border:1px solid black;">
|
||||
@foreach ($data as $key => $val)
|
||||
<tr>
|
||||
<td style="text-align: center; border-collapse:collapse; border:1px solid black;">{{ $key+1 }}</td>
|
||||
<td style="border-collapse:collapse; border:1px solid black;">{{ $val->faktur }}</td>
|
||||
<td style="text-align:center; border-collapse:collapse; border:1px solid black;">{{ toDmy($val->tanggal) }}</td>
|
||||
<td style="text-align:center; border-collapse:collapse; border:1px solid black;">{{ $val->jenis_transaksi == "1" ? "Tunai" : "Transfer" }}</td>
|
||||
<td style="text-align: left; border-collapse:collapse; border:1px solid black;">Rp {{ format_uang($val->nominal) }}</td>
|
||||
<td style="border-collapse:collapse; border:1px solid black;">{{ $val->keterangan }}</td>
|
||||
<td style="text-align:center; border-collapse:collapse; border:1px solid black;">{{ $val->user->name }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -5,13 +5,13 @@
|
|||
<div class="container" style="display: contents">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0"> Kasir <small>kasir 3.0</small></h1>
|
||||
<h3 class="m-0"> Master Data</h3>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="#">Kasir</a></li>
|
||||
<li class="breadcrumb-item active">History</li>
|
||||
<li class="breadcrumb-item"><a href="#">Admin</a></li>
|
||||
<li class="breadcrumb-item active">Users</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,86 +20,404 @@
|
|||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12 d-flex align-items-stretch">
|
||||
<div class="card w-100">
|
||||
<div class="card-body p-4">
|
||||
<div class="d-flex align-items-stretch">
|
||||
<h5 class="card-title fw-semibold mb-4">Data Pengguna</h5>
|
||||
<div class="d-inline ms-auto">
|
||||
<a href="{{ route('users.create') }}" class="btn btn-sm btn-success">
|
||||
<i class="ti ti-user-plus"></i> Tambah
|
||||
</a>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 mt-2">
|
||||
<div class="container" style="display: contents">
|
||||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-header mt-0 pt-0">
|
||||
<div class="d-flex">
|
||||
<h4>Daftar User</h4>
|
||||
<!-- Button trigger modal -->
|
||||
<div class="ml-auto">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal"
|
||||
data-target="#modal-default-add">
|
||||
Tambah User
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered text-nowrap mb-0 align-middle">
|
||||
<thead class="text-dark fs-4">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{-- <h5 class="card-title">Form List Data</h5> --}}
|
||||
<div class="table-responsive mt-3">
|
||||
<table id="tabelku" class="table table-hover display" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border-bottom-0" width="70px">
|
||||
<h6 class="fw-semibold mb-0 text-center">No.</h6>
|
||||
</th>
|
||||
<th class="border-bottom-0">
|
||||
<h6 class="fw-semibold mb-0">Name</h6>
|
||||
</th>
|
||||
<th class="border-bottom-0">
|
||||
<h6 class="fw-semibold mb-0">Terakhir Diupdate</h6>
|
||||
</th>
|
||||
<th class="border-bottom-0" width="100px">
|
||||
<h6 class="fw-semibold mb-0 text-center">Action</h6>
|
||||
</th>
|
||||
<th class="text-center">No</th>
|
||||
<th>Nama User</th>
|
||||
<th>Email User</th>
|
||||
<th>Role</th>
|
||||
<th>Terakhir Diupdate</th>
|
||||
<th class="text-center"><i class="fas fa-cog"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($users as $user)
|
||||
<tr>
|
||||
<td class="border-bottom-0">
|
||||
<h6 class="fw-normal mb-0 text-center">
|
||||
{{ ($users->currentPage() - 1) * $users->perPage() + $loop->index + 1 }}.
|
||||
</h6>
|
||||
</td>
|
||||
<td class="border-bottom-0">
|
||||
<h6 class="fw-semibold mb-1">{{ $user->name }}</h6>
|
||||
<span class="fw-normal">{{ $user->email }}</span>
|
||||
</td>
|
||||
<td class="border-bottom-0">
|
||||
<h6 class="fw-normal mb-0 fs-4">{{ $user->updated_at }}</h6>
|
||||
</td>
|
||||
<td class="border-bottom-0">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<a href="{{ route('users.edit', $user->id) }}"
|
||||
class="btn btn-sm btn-primary"><i class="ti ti-edit"></i> Ubah</a>
|
||||
<!-- <form onsubmit="return confirm('Apakah Anda Yakin ?');" action="{{ route('users.update', $user->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-danger">Hapus</button>
|
||||
</form> -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<div class="alert alert-danger">
|
||||
Data Pengguna belum Tersedia.
|
||||
</div>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Tambah Menu -->
|
||||
<div class="modal fade" id="modal-default-add">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Tambah User</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="form-tambah-user" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label for="user-name" class="col-form-label">Nama User:</label>
|
||||
<input type="text" class="form-control" id="user-name" name="name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="user-email" class="col-form-label">Email User:</label>
|
||||
<input type="text" class="form-control" id="user-email" name="email" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password-input" class="col-form-label">Password User:</label>
|
||||
<input type="text" class="form-control" id="password-input" name="password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="konfirmasi-password-input" class="col-form-label">Konfirmasi Password User:</label>
|
||||
<input type="text" class="form-control" id="konfirmasi-password-input"
|
||||
name="password_confirmation" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="role-text" class="col-form-label">Role:</label>
|
||||
<div class="form-group select2-primary">
|
||||
<select class="select2" multiple="multiple" data-placeholder="Pilih role user" required
|
||||
name="role_id[]" style="width: 100%;">
|
||||
@foreach ($roles as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="simpan-form-tambah">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal-default-edit">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit User</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="form-edit-user" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label for="user-name-edit" class="col-form-label">Nama User:</label>
|
||||
<input type="text" class="form-control" id="user-name_edit" name="name_edit" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="user-email_edit" class="col-form-label">Email User:</label>
|
||||
<input type="text" class="form-control" id="user-email_edit" name="email_edit" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password-input_edit" class="col-form-label">Password User:</label>
|
||||
<input type="text" class="form-control" id="password-input_edit" name="password_edit"
|
||||
placeholder="Kosongkan jika tidak ingin mengubah password" required>
|
||||
</div>
|
||||
<div class="form-group" id="password_confirm_edit" style="display: none">
|
||||
<label for="konfirmasi-password-input_edit" class="col-form-label">Konfirmasi Password
|
||||
User:</label>
|
||||
<input type="text" class="form-control" id="konfirmasi-password-input_edit"
|
||||
placeholder="Kosongkan jika tidak ingin mengubah password"
|
||||
name="password_confirmation_edit" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="role-text" class="col-form-label">Role:</label>
|
||||
<div class="form-group select2-primary">
|
||||
<select class="edit_select2" multiple="multiple" data-placeholder="Pilih role user"
|
||||
required name="role_id_edit[]" style="width: 100%;">
|
||||
@foreach ($roles as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="simpan-form-tambah">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal-default-hapus">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Hapus User</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{-- <form id="form-tambah-user" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label for="user-name" class="col-form-label">Nama User:</label>
|
||||
<input type="text" class="form-control" id="user-name" name="name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email-name" class="col-form-label">Email User:</label>
|
||||
<input type="text" class="form-control" id="email-name" name="email" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password-input" class="col-form-label">Password User:</label>
|
||||
<input type="text" class="form-control" id="password-input" name="password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="konfirmasi-password-input" class="col-form-label">Konfirmasi Password
|
||||
User:</label>
|
||||
<input type="text" class="form-control" id="konfirmasi-password-input"
|
||||
name="password_confirmation" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="role-text" class="col-form-label">Role:</label>
|
||||
<div class="form-group select2-primary">
|
||||
<select class="select2" multiple="multiple" data-placeholder="Pilih role user" required
|
||||
name="role_id[]" style="width: 100%;">
|
||||
@foreach ($roles as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="simpan-form-tambah">Simpan</button>
|
||||
</div>
|
||||
</form> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
@if (Session::has('users-message'))
|
||||
<script>
|
||||
Swal.fire({
|
||||
text: "{{ Session::get('users-message')['msg'] }}",
|
||||
icon: "{{ Session::get('users-message')['type'] }}",
|
||||
timer: 2500
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
@push('styles')
|
||||
<!-- Toastr -->
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/toastr/toastr.min.css') }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ asset('assets/datatables/datatables.min.css') }}">
|
||||
|
||||
<!-- Select2 -->
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/select2/css/select2.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<!-- Toastr -->
|
||||
<script src="{{ asset('assets/plugins/toastr/toastr.min.js') }}"></script>
|
||||
<!-- Select2 -->
|
||||
<script src="{{ asset('assets/plugins/select2/js/select2.full.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('assets/datatables/datatables.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
// check password dan konfirmasi password
|
||||
$('#konfirmasi-password-input').on('keyup', function() {
|
||||
if ($('#password-input').val() == $('#konfirmasi-password-input').val()) {
|
||||
$('#konfirmasi-password-input').removeClass('is-invalid')
|
||||
$('#konfirmasi-password-input').addClass('is-valid')
|
||||
} else {
|
||||
$('#konfirmasi-password-input').removeClass('is-valid')
|
||||
$('#konfirmasi-password-input').addClass('is-invalid')
|
||||
}
|
||||
})
|
||||
|
||||
//Initialize Select2 Elements
|
||||
$('.select2').select2({
|
||||
dropdownParent: $("#modal-default-add")
|
||||
})
|
||||
$('.edit_select2').select2({
|
||||
dropdownParent: $("#modal-default-edit")
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#tabelku').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ route('users.getDataUser') }}",
|
||||
columns: [{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'name',
|
||||
name: 'name'
|
||||
},
|
||||
{
|
||||
data: 'email',
|
||||
name: 'email'
|
||||
},
|
||||
{
|
||||
data: 'rolenya',
|
||||
name: 'rolenya'
|
||||
},
|
||||
{
|
||||
data: 'updated_atnya',
|
||||
name: 'updated_atnya',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
className: 'text-center'
|
||||
},
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
// handle password edit user keyup
|
||||
$('#password-input_edit').on('keyup', function() {
|
||||
if ($('#password-input_edit').val() != '') {
|
||||
$('#password_confirm_edit').show()
|
||||
if ($('#password-input_edit').val() == $('#konfirmasi-password-input_edit').val()) {
|
||||
$('#konfirmasi-password-input_edit').removeClass('is-invalid')
|
||||
$('#konfirmasi-password-input_edit').addClass('is-valid')
|
||||
} else {
|
||||
$('#konfirmasi-password-input_edit').removeClass('is-valid')
|
||||
$('#konfirmasi-password-input_edit').addClass('is-invalid')
|
||||
}
|
||||
} else {
|
||||
$('#password_confirm_edit').hide()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// ajax tambah user
|
||||
$('#form-tambah-user').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: "{{ route('users.store') }}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
toastr.success(response.meta.message)
|
||||
$('#modal-default-add').modal('hide')
|
||||
$('#form-tambah-user')[0].reset()
|
||||
$('.select2').val(null).trigger('change')
|
||||
$('#konfirmasi-password-input').removeClass('is-valid')
|
||||
$('#tabelku').DataTable().ajax.reload()
|
||||
},
|
||||
error: function(response) {
|
||||
toastr.error(response.responseJSON.meta.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// ajax edit user
|
||||
$(document).on('click', '.btn-edit-user', function() {
|
||||
var id = $(this).attr('data-id')
|
||||
$.ajax({
|
||||
url: "{{ url('users') }}" + '/' + id + '/edit',
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var user = response.data.user;
|
||||
$('#modal-default-edit').modal('show')
|
||||
$('#user-name_edit').val(user.name)
|
||||
$('#user-email_edit').val(user.email)
|
||||
|
||||
// set value select2
|
||||
var roles = user.role;
|
||||
var role_id = [];
|
||||
$.each(roles, function(key, value) {
|
||||
role_id.push(value.id)
|
||||
})
|
||||
$('.edit_select2').val(role_id).trigger('change')
|
||||
|
||||
$('#form-edit-user').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: "{{ url('users') }}" + '/' + id,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(response) {
|
||||
toastr.success(response.meta.message)
|
||||
$('#modal-default-edit').modal('hide')
|
||||
$('#form-edit-user')[0].reset()
|
||||
$('.edit_select2').val(null).trigger(
|
||||
'change')
|
||||
$('#konfirmasi-password-input_edit')
|
||||
.removeClass('is-valid')
|
||||
$('#tabelku').DataTable().ajax.reload()
|
||||
},
|
||||
error: function(response) {
|
||||
toastr.error(response.responseJSON.meta
|
||||
.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
error: function(response) {
|
||||
toastr.error(response.responseJSON.meta.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// ajax hapus user
|
||||
$(document).on('click', '.btn-hapus-user', function() {
|
||||
var id = $(this).attr('data-id')
|
||||
Swal.fire({
|
||||
title: 'Apakah anda yakin?',
|
||||
text: "Data user akan dihapus secara permanen!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#007bff',
|
||||
cancelButtonColor: '#dc3545',
|
||||
confirmButtonText: 'Ya, hapus!',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: "{{ url('admin/users') }}" + '/' + id,
|
||||
type: "POST",
|
||||
data: {
|
||||
'_method': 'DELETE'
|
||||
},
|
||||
success: function(response) {
|
||||
toastr.success(response.meta.message)
|
||||
$('#tabelku').DataTable().ajax.reload()
|
||||
},
|
||||
error: function(response) {
|
||||
toastr.error(response.responseJSON.meta.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Admins\DashboardController;
|
||||
use App\Http\Controllers\Admins\Pengeluaran\PengeluaranController;
|
||||
use App\Http\Controllers\Admins\Users\RoleController;
|
||||
use App\Http\Controllers\Admins\Users\UserController;
|
||||
use App\Http\Controllers\Auths\AuthController;
|
||||
use App\Http\Controllers\Kasir\History;
|
||||
use App\Http\Controllers\Kasir\Menu;
|
||||
use App\Http\Controllers\Kasir\Transaksi;
|
||||
use App\Http\Controllers\LaporanController;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
@ -59,19 +61,28 @@ Route::group(['middleware' => ['auth', 'permission']], function () {
|
|||
});
|
||||
|
||||
// Dashboard
|
||||
Route::get('dashboard', [DashboardController::class, 'index'])->name('dashboard.index')->comment('Halaman Dashboard');
|
||||
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");
|
||||
});
|
||||
|
||||
|
||||
// Profile
|
||||
// Route::get('profile', [ProfileController::class, 'index'])->name('profile.index')->comment('Halaman Profile');
|
||||
// Route::post('profile', [ProfileController::class, 'update'])->name('profile.update')->comment('Update Profile');
|
||||
|
||||
// Users
|
||||
Route::get('users', [UserController::class, 'index'])->name('users.index')->comment('Halaman User');
|
||||
Route::get('users/create', [UserController::class, 'create'])->name('users.create')->comment('Halaman Tambah User');
|
||||
Route::post('users', [UserController::class, 'store'])->name('users.store')->comment('Tambah User');
|
||||
Route::get('users/edit/{id}', [UserController::class, 'edit'])->name('users.edit')->comment('Halaman Edit User');
|
||||
Route::put('users/update/{id}', [UserController::class, 'update'])->name('users.update')->comment('Perbarui User');
|
||||
Route::delete('users/delete/{id}', [UserController::class, 'destroy'])->name('users.delete')->comment('Menghapus User');
|
||||
Route::group(['prefix' => 'users'], function () {
|
||||
Route::get('/', [UserController::class, 'index'])->name('users.index')->comment('Halaman User');
|
||||
Route::get('/getDataUser', [UserController::class, 'getDataUser'])->name('users.getDataUser')->comment('Ambil data User');
|
||||
Route::get('/create', [UserController::class, 'create'])->name('users.create')->comment('Halaman Tambah User');
|
||||
Route::post('/', [UserController::class, 'store'])->name('users.store')->comment('Tambah User');
|
||||
Route::get('/{id}/edit', [UserController::class, 'edit'])->name('users.edit')->comment('Halaman Edit User');
|
||||
Route::put('/update/{id}', [UserController::class, 'update'])->name('users.update')->comment('Perbarui User');
|
||||
Route::delete('/delete/{id}', [UserController::class, 'destroy'])->name('users.delete')->comment('Menghapus User');
|
||||
});
|
||||
|
||||
// Roles
|
||||
Route::group(['prefix' => 'roles'], function () {
|
||||
|
@ -83,4 +94,22 @@ Route::group(['middleware' => ['auth', 'permission']], function () {
|
|||
Route::delete('/delete/{id}', [RoleController::class, 'destroy'])->name('roles.delete')->comment('Menghapus Roles');
|
||||
Route::get('/refresh-routes', [RoleController::class, 'refreshRoutes'])->name('roles.refresh-routes')->comment('Refresh Permission Routes');
|
||||
});
|
||||
|
||||
// Roles
|
||||
Route::group(['prefix' => 'laporan'], function () {
|
||||
Route::get('/', [LaporanController::class, 'index'])->name('laporan.index')->comment('Halaman Laporan');
|
||||
Route::get('/create', [LaporanController::class, 'create'])->name('laporan.create')->comment('Halaman Tambah Laporan');
|
||||
Route::post('/', [LaporanController::class, 'store'])->name('laporan.store')->comment('Tambah Laporan');
|
||||
Route::get('/edit/{id}', [LaporanController::class, 'edit'])->name('laporan.edit')->comment('Halaman Edit Laporan');
|
||||
Route::put('/update/{id}', [LaporanController::class, 'update'])->name('laporan.update')->comment('Perbarui Laporan');
|
||||
Route::delete('/delete/{id}', [LaporanController::class, 'destroy'])->name('laporan.delete')->comment('Menghapus Laporan');
|
||||
Route::get('/refresh-routes', [LaporanController::class, 'refreshRoutes'])->name('laporan.refresh-routes')->comment('Refresh Permission Routes');
|
||||
});
|
||||
|
||||
// Pengeluaran
|
||||
Route::group(['prefix' => 'pengeluaran'], function () {
|
||||
Route::get('/', [PengeluaranController::class, 'index'])->name('pengeluaran.index')->comment('Halaman Pengeluaran');
|
||||
Route::post('/simpan', [PengeluaranController::class, 'simpan'])->name('pengeluaran.simpan')->comment('Halaman Simpan Pengeluaran');
|
||||
Route::post('/laporan', [PengeluaranController::class, 'laporan'])->name('pengeluaran.laporan')->comment('Halaman Laporan');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue