created master data: rayon, cost centre, kategori

This commit is contained in:
Jagad R R
2024-12-12 18:18:26 +07:00
parent 8cf94b5a5e
commit 095c2169c5
38 changed files with 1249 additions and 17 deletions
@@ -56,6 +56,7 @@ class AdminsController extends Controller
$admin->password = Hash::make($request->password); $admin->password = Hash::make($request->password);
$admin->username = $request->username; $admin->username = $request->username;
$admin->email = $request->email; $admin->email = $request->email;
$admin->phone = $request->phone;
$admin->save(); $admin->save();
if ($request->roles) { if ($request->roles) {
@@ -93,6 +94,7 @@ class AdminsController extends Controller
$admin->name = $request->name; $admin->name = $request->name;
$admin->email = $request->email; $admin->email = $request->email;
$admin->username = $request->username; $admin->username = $request->username;
$admin->phone = $request->phone;
if ($request->password) { if ($request->password) {
$admin->password = Hash::make($request->password); $admin->password = Hash::make($request->password);
@@ -104,7 +106,7 @@ class AdminsController extends Controller
} }
session()->flash('success', 'Admin has been updated.'); session()->flash('success', 'Admin has been updated.');
return back(); return redirect()->route('admin.admins.index');
} }
public function destroy(int $id): RedirectResponse public function destroy(int $id): RedirectResponse
@@ -114,6 +116,6 @@ class AdminsController extends Controller
$admin = Admin::findOrFail($id); $admin = Admin::findOrFail($id);
$admin->delete(); $admin->delete();
session()->flash('success', 'Admin has been deleted.'); session()->flash('success', 'Admin has been deleted.');
return back(); return redirect()->route('admin.admins.index');
} }
} }
@@ -104,7 +104,7 @@ class RolesController extends Controller
} }
session()->flash('success', 'Role has been updated.'); session()->flash('success', 'Role has been updated.');
return back(); return redirect()->route('admin.roles.index');
} }
public function destroy(int $id): RedirectResponse public function destroy(int $id): RedirectResponse
@@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers\Forms;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\FormUpCountry;
use App\Models\Rayon;
class FormUpCountryController extends Controller
{
public function index()
{
return view('backend.pages.forms.upcountry.index');
}
public function create()
{
return view('backend.pages.forms.upcountry.create', [
'rayons' => Rayon::all()
]);
}
public function store()
{
}
public function edit()
{
return view('backend.pages.forms.upcountry.edit', [
'rayons' => Rayon::all()
]);
}
public function update()
{
}
public function destroy()
{
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\Master;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Kategori;
class CategoryController extends Controller
{
public function index()
{
return view('backend.pages.master.category.index', [
'categories' => Kategori::all()
]);
}
public function create()
{
return view('backend.pages.master.category.create');
}
public function store(Request $request)
{
$request->validate([
'name' => 'required|unique:kategori,name',
'account_number' => 'required|unique:kategori,account_number'
]);
Kategori::create([
'name' => $request->name,
'account_number' => $request->account_number
]);
session()->flash('success', 'Category has been created.');
return redirect()->route('admin.category.index');
}
public function edit($id)
{
return view('backend.pages.master.category.edit', [
'category' => Kategori::findOrfail($id)
]);
}
public function update(Request $request, $id)
{
$request->validate([
'name' => 'required|unique:kategori,name,' . $id . ',id',
'account_number' => 'required|unique:kategori,account_number,' . $id . ',id'
]);
Kategori::findOrfail($id)->update([
'name' => $request->name,
'account_number' => $request->account_number
]);
session()->flash('success', 'Category has been updated.');
return redirect()->route('admin.category.index');
}
public function destroy($id)
{
Kategori::findOrfail($id)->delete();
session()->flash('success', 'Category has been deleted.');
return redirect()->route('admin.category.index');
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\Master;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\CostCentre;
class CostCentreController extends Controller
{
public function index()
{
return view('backend.pages.master.cost.index', [
'costs' => CostCentre::all()
]);
}
public function create()
{
return view('backend.pages.master.cost.create');
}
public function store(Request $request)
{
$request->validate([
'code' => 'required|unique:cost_centre,code',
'name' => 'required|unique:cost_centre,name'
]);
CostCentre::create([
'code' => $request->code,
'name' => $request->name
]);
session()->flash('success', 'Cost Centre has been created.');
return redirect()->route('admin.cost.index');
}
public function edit($id)
{
return view('backend.pages.master.cost.edit', [
'cost' => CostCentre::findOrfail($id)
]);
}
public function update(Request $request, $id)
{
$request->validate([
'code' => 'required|unique:cost_centre,code,' . $id . ',id',
'name' => 'required|unique:cost_centre,name,' . $id . ',id'
]);
CostCentre::findOrfail($id)->update([
'code' => $request->code,
'name' => $request->name
]);
session()->flash('success', 'Cost has been updated.');
return redirect()->route('admin.cost.index');
}
public function destroy($id)
{
CostCentre::findOrfail($id)->delete();
session()->flash('success', 'Cost has been deleted.');
return redirect()->route('admin.cost.index');
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\Master;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Rayon;
class RayonController extends Controller
{
public function index()
{
return view('backend.pages.master.rayon.index', [
'rayons' => Rayon::all()
]);
}
public function create()
{
return view('backend.pages.master.rayon.create');
}
public function store(Request $request)
{
$request->validate([
'code' => 'required|unique:rayon,code',
'name' => 'required|unique:rayon,name'
]);
Rayon::create([
'code' => $request->code,
'name' => $request->name
]);
session()->flash('success', 'Rayon has been created.');
return redirect()->route('admin.rayon.index');
}
public function edit($id)
{
return view('backend.pages.master.rayon.edit', [
'rayon' => Rayon::findOrfail($id)
]);
}
public function update(Request $request, $id)
{
$request->validate([
'code' => 'required|unique:rayon,code,' . $id . ',id',
'name' => 'required|unique:rayon,name,' . $id . ',id'
]);
Rayon::findOrfail($id)->update([
'code' => $request->code,
'name' => $request->name
]);
session()->flash('success', 'Rayon has been updated.');
return redirect()->route('admin.rayon.index');
}
public function destroy($id)
{
Rayon::findOrfail($id)->delete();
session()->flash('success', 'Rayon has been deleted.');
return redirect()->route('admin.rayon.index');
}
}
+1 -4
View File
@@ -7,7 +7,6 @@ use Spatie\Menu\Laravel\Facades\Menu;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
class MenuMiddleware class MenuMiddleware
{ {
@@ -43,8 +42,6 @@ class MenuMiddleware
ORDER BY m.id ORDER BY m.id
"); ");
foreach ($menus as $item) { foreach ($menus as $item) {
// Ambil submenu jika ada // Ambil submenu jika ada
$children = DB::select(" $children = DB::select("
@@ -77,7 +74,7 @@ class MenuMiddleware
'<li class="nav-item">' . '<li class="nav-item">' .
'<a href="#" class="nav-link">' . '<a href="#" class="nav-link">' .
'<i class="nav-icon ' . $item->icon . '"></i>' . '<i class="nav-icon ' . $item->icon . '"></i>' .
'<p>' . $item->title . '<i class="fas fa-angle-left right"></i></p>' . '<p>' . $item->title . '<i class="fas fa-angle-left right mt-1"></i></p>' .
'</a>' . '</a>' .
$submenu->render() . $submenu->render() .
'</li>' '</li>'
+1
View File
@@ -30,6 +30,7 @@ class AdminRequest extends FormRequest
'email' => 'required|max:100|email|unique:admins,email,' . $adminId, 'email' => 'required|max:100|email|unique:admins,email,' . $adminId,
'username' => 'required|max:100|unique:admins,username,' . $adminId, 'username' => 'required|max:100|unique:admins,username,' . $adminId,
'password' => $adminId ? 'nullable|confirmed' : 'confirmed', 'password' => $adminId ? 'nullable|confirmed' : 'confirmed',
'phone' => 'required|max:15|unique:admins,phone,' . $adminId,
]; ];
} }
} }
+2
View File
@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@@ -11,6 +12,7 @@ use Spatie\Permission\Traits\HasRoles;
class Admin extends Authenticatable class Admin extends Authenticatable
{ {
use Notifiable, HasRoles; use Notifiable, HasRoles;
use SoftDeletes;
/** /**
* Set the default guard for this model. * Set the default guard for this model.
+1 -1
View File
@@ -10,5 +10,5 @@ class Rayon extends Model
use SoftDeletes; use SoftDeletes;
protected $table = 'rayon'; protected $table = 'rayon';
protected $fillable = ['name']; protected $fillable = ['code', 'name'];
} }
@@ -0,0 +1,28 @@
<?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::table('rayon', function (Blueprint $table) {
$table->string('code')->after('id')->nullable()->unique();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('rayon', function (Blueprint $table) {
$table->dropColumn('code');
});
}
};
+2
View File
@@ -1,5 +1,7 @@
<?php <?php
namespace Database\Seeds;
use App\Models\Admin; use App\Models\Admin;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
+6
View File
@@ -1,6 +1,11 @@
<?php <?php
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Database\Seeds\UserSeeder;
use Database\Seeds\AdminSeeder;
use Database\Seeds\RolePermissionSeeder;
use Database\Seeds\MenuSeeder;
use Database\Seeds\RayonSeeder;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder
{ {
@@ -15,5 +20,6 @@ class DatabaseSeeder extends Seeder
$this->call(AdminSeeder::class); $this->call(AdminSeeder::class);
$this->call(RolePermissionSeeder::class); $this->call(RolePermissionSeeder::class);
$this->call(MenuSeeder::class); $this->call(MenuSeeder::class);
$this->call(RayonSeeder::class);
} }
} }
+24
View File
@@ -1,5 +1,7 @@
<?php <?php
namespace Database\Seeds;
use App\Models\Admin; use App\Models\Admin;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
@@ -47,5 +49,27 @@ class MenuSeeder extends Seeder
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
] ]
]); ]);
DB::table('role_menu')->insert([
[
'role_id' => 1,
'menu_id' => 61,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'role_id' => 1,
'menu_id' => 62,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'role_id' => 1,
'menu_id' => 63,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]
]);
} }
} }
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Database\Seeds;
use Illuminate\Database\Seeder;
use App\Models\Rayon;
class RayonSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Rayon::create([
'code' => 'R1',
'name' => 'Rayon 1',
]);
Rayon::create([
'code' => 'R2',
'name' => 'Rayon 2',
]);
Rayon::create([
'code' => 'R3',
'name' => 'Rayon 3',
]);
}
}
+2
View File
@@ -1,5 +1,7 @@
<?php <?php
namespace Database\Seeds;
use App\Models\Admin; use App\Models\Admin;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
+2
View File
@@ -1,5 +1,7 @@
<?php <?php
namespace Database\Seeds;
use App\User; use App\User;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
@@ -11,6 +11,8 @@
</div> </div>
@endif @endif
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@if (Session::has('success')) @if (Session::has('success'))
<script> <script>
Swal.fire({ Swal.fire({
@@ -37,7 +37,7 @@
<div class="col-12 mt-5"> <div class="col-12 mt-5">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="header-title">{{ $pageInfo['title'] }}</h4> <h4 class="header-title mb-4">{{ $pageInfo['title'] }}</h4>
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<form action="{{ route('admin.admins.store') }}" method="POST"> <form action="{{ route('admin.admins.store') }}" method="POST">
@@ -84,7 +84,11 @@
placeholder="Enter Username" required value="{{ old('username') }}"> placeholder="Enter Username" required value="{{ old('username') }}">
</div> </div>
<div class="form-group col-md-6 col-sm-6">
<label for="phone">Phone</label>
<input type="text" class="form-control" id="phone" name="phone"
placeholder="Enter phone number" required value="{{ old('phone') }}">
</div>
</div> </div>
@@ -87,6 +87,12 @@
placeholder="Enter Username" required value="{{ $admin->username }}"> placeholder="Enter Username" required value="{{ $admin->username }}">
</div> </div>
<div class="form-group col-md-6 col-sm-6">
<label for="phone">Phone</label>
<input type="text" class="form-control" id="phone" name="phone"
placeholder="Enter phone number" required value="{{ $admin->phone }}">
</div>
</div> </div>
@@ -4,7 +4,6 @@
Dashboard Dashboard
@endsection @endsection
@section('admin-content') @section('admin-content')
<section class="content-header"> <section class="content-header">
<div class="container-fluid"> <div class="container-fluid">
@@ -0,0 +1,95 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Tambahkan Expense Up Country Baru</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form>
<div class="row">
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Pilih Rayon</label>
<select class="form-control form-control-md">
<option value="">Pilih Rayon</option>
@foreach ($rayons as $rayon)
<option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label class="form-label">Tanggal</label>
<input type="date" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Tujuan</label>
<input type="text" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Allowance</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Transport Dalam Kota</label>
<input type="number" class="form-control">
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Transport Antar Kota</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Hotel</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 1</label>
<input type="file" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 2</label>
<input type="file" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 3</label>
<input type="file" class="form-control">
</div>
</div>
<button type="submit" class="btn btn-primary ml-2">Submit</button>
</div>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,95 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Edit Expense Up Country</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form>
<div class="row">
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Pilih Rayon</label>
<select class="form-control form-control-md">
<option value="">Pilih Rayon</option>
@foreach ($rayons as $rayon)
<option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label class="form-label">Tanggal</label>
<input type="date" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Tujuan</label>
<input type="text" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Allowance</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Transport Dalam Kota</label>
<input type="number" class="form-control">
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Transport Antar Kota</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Hotel</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="number" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 1</label>
<input type="file" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 2</label>
<input type="file" class="form-control">
</div>
<div class="mb-3">
<label class="form-label">Bukti 3</label>
<input type="file" class="form-control">
</div>
</div>
<button type="submit" class="btn btn-primary ml-2">Submit</button>
</div>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,90 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Forms Up Country</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">List Data Forms Up Country Anda</h4>
<p class="float-right mb-2">
<a class="btn btn-primary text-white" href="">
Add New Expense Up Country
</a>
</p>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Rayon</th>
<th>Tanggal</th>
<th>Tujuan</th>
<th>Jarak</th>
<th>Allowance</th>
<th>Transport Dalkot</th>
<th>Transport Ankot</th>
<th>Hotel</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Doe</td>
<td>Rayon 1</td>
<td>2021-09-01</td>
<td>Surabaya</td>
<td>100</td>
<td>100000</td>
<td>10000</td>
<td>5000</td>
<td>50000</td>
<td>file1.jpg</td>
<td>file2.jpg</td>
<td>file3.jpg</td>
<td>1234567890</td>
<td>
<a href="" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
<a href="" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,45 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Tambahkan Category Baru</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.category.store') }}">
@csrf
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="text" class="form-control" name="name">
</div>
<div class="mb-3">
<label class="form-label">Account Number</label>
<input type="text" class="form-control" name="account_number">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,46 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Edit Category</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.category.update', $category->id) }}">
@csrf
@method('PUT')
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="text" class="form-control" name="name" value="{{ $category->name }}">
</div>
<div class="mb-3">
<label class="form-label">Account Number</label>
<input type="text" class="form-control" name="account_number" value="{{ $category->account_number }}">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,90 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Data Master Category</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">List Data Category</h4>
<p class="float-right mb-2">
<a class="btn btn-primary text-white" href="{{ route('admin.category.create') }}">
Add New Category
</a>
</p>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Account Number</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($categories as $category)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $category->name }}</td>
<td>{{ $category->account_number }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.category.edit', $category->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $category->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $category->id }}"
action="{{ route('admin.category.destroy', $category->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false
});
}
</script>
@endsection
@@ -0,0 +1,45 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Tambahkan Cost Centre Baru</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.cost.store') }}">
@csrf
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Code Cost Centre</label>
<input type="text" class="form-control" name="code">
</div>
<div class="mb-3">
<label class="form-label">Nama Cost Centre</label>
<input type="text" class="form-control" name="name">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,46 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Edit Cost Centre</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.cost.update', $cost->id) }}">
@csrf
@method('PUT')
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Code Cost Centre</label>
<input type="text" class="form-control" name="code" value="{{ $cost->code }}">
</div>
<div class="mb-3">
<label class="form-label">Nama Cost Centre</label>
<input type="text" class="form-control" name="name" value="{{ $cost->name }}">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,90 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Data Master Cost Centre</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">List Data Cost Centre</h4>
<p class="float-right mb-2">
<a class="btn btn-primary text-white" href="{{ route('admin.cost.create') }}">
Add New Cost Centre
</a>
</p>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($costs as $cost)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $cost->code }}</td>
<td>{{ $cost->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.cost.edit', $cost->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $cost->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $cost->id }}"
action="{{ route('admin.cost.destroy', $cost->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false
});
}
</script>
@endsection
@@ -0,0 +1,44 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Tambahkan Rayon Baru</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.rayon.store') }}">
@csrf
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Code Rayon</label>
<input type="text" class="form-control" name="code">
</div>
<div class="mb-3">
<label class="form-label">Nama Rayon</label>
<input type="text" class="form-control" name="name">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,45 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Edit Rayon</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<form method="POST" action="{{ route('admin.rayon.update', $rayon->id) }}">
@csrf
@method('PUT')
@include('backend.layouts.partials.messages')
<div class="mb-3">
<label class="form-label">Code Rayon</label>
<input type="text" class="form-control" name="code" value="{{ $rayon->code }}">
</div>
<div class="mb-3">
<label class="form-label">Nama Rayon</label>
<input type="text" class="form-control" name="name" value="{{ $rayon->name }}">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</section>
@endsection
@@ -0,0 +1,90 @@
@extends('layouts.app')
@section('title')
Dashboard
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Data Master Rayon</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">List Data Rayon</h4>
<p class="float-right mb-2">
<a class="btn btn-primary text-white" href="{{ route('admin.rayon.create') }}">
Add New Rayon
</a>
</p>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($rayons as $rayon)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $rayon->code }}</td>
<td>{{ $rayon->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.rayon.edit', $rayon->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $rayon->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $rayon->id }}"
action="{{ route('admin.rayon.destroy', $rayon->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false
});
}
</script>
@endsection
@@ -4,7 +4,6 @@
{{ $pageInfo['title'] }} {{ $pageInfo['title'] }}
@endsection @endsection
@section('admin-content') @section('admin-content')
<section class="content-header"> <section class="content-header">
<div class="container-fluid"> <div class="container-fluid">
@@ -63,10 +62,23 @@
@endforeach @endforeach
</td> </td>
<td> <td>
@if (auth::user()->can('admin.edit')) @if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" <a class="btn btn-success btn-sm text-white"
href="{{ route('admin.roles.edit', $role->id) }}">Edit</a> href="{{ route('admin.roles.edit', $role->id) }}">Edit</a>
@endif @endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $role->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $role->id }}"
action="{{ route('admin.roles.destroy', $role->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
<a class="btn btn-primary btn-sm text-white" <a class="btn btn-primary btn-sm text-white"
href="{{ route('auth.menurole.index', $role->id) }}">Assign href="{{ route('auth.menurole.index', $role->id) }}">Assign
Menus</a> Menus</a>
@@ -29,5 +29,4 @@
}) })
</script> </script>
<script src="{{ asset('js/global.function.js') }}"></script> <script src="{{ asset('js/global.function.js') }}"></script>
@@ -1,8 +1,8 @@
<!-- sidebar menu area start --> <!-- sidebar menu area start -->
@php @php
$usr = Auth::guard('admin')->user(); $usr = Auth::guard('admin')->user();
@endphp @endphp
<nav class="mt-2"> <nav class="mt-2">
{!! $menu !!} {!! $menu !!}
</nav> </nav>
+41
View File
@@ -8,6 +8,10 @@ use App\Http\Controllers\GenerateDataMasterController;
use App\Http\Controllers\Backend\DashboardController; use App\Http\Controllers\Backend\DashboardController;
use App\Http\Controllers\Backend\RolesController; use App\Http\Controllers\Backend\RolesController;
use App\Http\Controllers\Backend\MenuRoleController; use App\Http\Controllers\Backend\MenuRoleController;
use App\Http\Controllers\Forms\FormUpCountryController;
use App\Http\Controllers\Master\RayonController;
use App\Http\Controllers\Master\CostCentreController;
use App\Http\Controllers\Master\CategoryController;
Auth::routes(); Auth::routes();
@@ -27,10 +31,47 @@ Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['auth:admi
Route::resource('admins', AdminsController::class); Route::resource('admins', AdminsController::class);
Route::resource('roles', RolesController::class); Route::resource('roles', RolesController::class);
Route::get('/admin', [DashboardController::class, 'index'])->name('dashboard'); Route::get('/admin', [DashboardController::class, 'index'])->name('dashboard');
// Rayon
Route::get('/rayon', [RayonController::class, 'index'])->name('rayon.index');
Route::get('/rayon/create', [RayonController::class, 'create'])->name('rayon.create');
Route::post('/rayon/store', [RayonController::class, 'store'])->name('rayon.store');
Route::get('/rayon/edit/{id}', [RayonController::class, 'edit'])->name('rayon.edit');
Route::put('/rayon/update/{id}', [RayonController::class, 'update'])->name('rayon.update');
Route::delete('/rayon/destroy/{id}', [RayonController::class, 'destroy'])->name('rayon.destroy');
// Cost Centre
Route::get('/cost', [CostCentreController::class, 'index'])->name('cost.index');
Route::get('/cost/create', [CostCentreController::class, 'create'])->name('cost.create');
Route::post('/cost/store', [CostCentreController::class, 'store'])->name('cost.store');
Route::get('/cost/edit/{id}', [CostCentreController::class, 'edit'])->name('cost.edit');
Route::put('/cost/update/{id}', [CostCentreController::class, 'update'])->name('cost.update');
Route::delete('/cost/destroy/{id}', [CostCentreController::class, 'destroy'])->name('cost.destroy');
// Category
Route::get('/category', [CategoryController::class, 'index'])->name('category.index');
Route::get('/category/create', [CategoryController::class, 'create'])->name('category.create');
Route::post('/category/store', [CategoryController::class, 'store'])->name('category.store');
Route::get('/category/edit/{id}', [CategoryController::class, 'edit'])->name('category.edit');
Route::put('/category/update/{id}', [CategoryController::class, 'update'])->name('category.update');
Route::delete('/category/destroy/{id}', [CategoryController::class, 'destroy'])->name('category.destroy');
})->middleware(['auth:admin']); })->middleware(['auth:admin']);
Route::middleware(['auth:admin', 'menu'])->group(function () { Route::middleware(['auth:admin', 'menu'])->group(function () {
Route::get('/', [DashboardController::class, 'index'])->name('dashboard.index'); Route::get('/', [DashboardController::class, 'index'])->name('dashboard.index');
// Forms
Route::prefix('forms')->group(function () {
// Up Country
Route::get('/up-country', [FormUpCountryController::class, 'index'])->name('forms.up-country');
Route::get('/up-country/create', [FormUpCountryController::class, 'create'])->name('forms.up-country.create');
Route::post('/up-country/store', [FormUpCountryController::class, 'store'])->name('forms.up-country.store');
Route::get('/up-country/edit/{id}', [FormUpCountryController::class, 'edit'])->name('forms.up-country.edit');
Route::put('/up-country/update/{id}', [FormUpCountryController::class, 'update'])->name('forms.up-country.update');
Route::delete('/up-country/destroy/{id}', [FormUpCountryController::class, 'destroy'])->name('forms.up-country.destroy');
});
//Menu Role //Menu Role
Route::get('/auth/menu-tree/{id}', [MenuRoleController::class, 'index'])->name('auth.menurole.index'); Route::get('/auth/menu-tree/{id}', [MenuRoleController::class, 'index'])->name('auth.menurole.index');
Route::post('/auth/menu-tree/submit', [MenuRoleController::class, 'saveMenu'])->name('auth.menurole.submit'); Route::post('/auth/menu-tree/submit', [MenuRoleController::class, 'saveMenu'])->name('auth.menurole.submit');