Browse Source

update validasi warehouse

master
Gunawan19621 1 year ago
parent
commit
e729e9b92e
  1. 25
      app/Http/Controllers/Auth/AuthenticatedSessionController.php
  2. 24
      app/Http/Controllers/Auth/RedirectAuthController.php
  3. 26
      app/Http/Controllers/CustomerController.php
  4. 12
      app/Http/Controllers/M_userController.php
  5. 19
      app/Http/Controllers/WarehouseController.php
  6. 53
      app/Http/Requests/ValidasiCreateCustomer.php
  7. 78
      app/Http/Requests/ValidasiCreateUser.php
  8. 45
      app/Http/Requests/ValidasiCreateWarehouse.php
  9. 45
      app/Http/Requests/ValidasiUpdateWarehouse.php
  10. 6
      app/Models/Customer.php
  11. 2
      database/migrations/2023_10_23_073314_create_m_warehouses_table.php
  12. 22
      database/migrations/2023_10_23_075245_create_users_table.php
  13. 14
      database/migrations/2023_10_28_080457_create_customers_table.php
  14. 28
      database/seeders/Customer.php
  15. 6
      database/seeders/RoleSeeder.php
  16. 26
      database/seeders/UserSeeder.php
  17. 12
      resources/views/auth/login.blade.php
  18. 34
      resources/views/dashboard/Master_Data/Customer/create.blade.php
  19. 35
      resources/views/dashboard/Master_Data/Customer/edit.blade.php
  20. 7
      resources/views/dashboard/Master_Data/Customer/index.blade.php
  21. 29
      resources/views/dashboard/Master_Data/Customer/show.blade.php
  22. 5
      resources/views/dashboard/Master_Data/User/create.blade.php
  23. 1
      resources/views/dashboard/Master_Data/User/index.blade.php
  24. 11
      resources/views/dashboard/Master_Data/Warehouse/index.blade.php
  25. 26
      resources/views/layouts/components/alert-prompt.blade.php
  26. 4
      resources/views/layouts/main.blade.php

25
app/Http/Controllers/Auth/AuthenticatedSessionController.php

@ -23,14 +23,29 @@ class AuthenticatedSessionController extends Controller
/** /**
* Handle an incoming authentication request. * Handle an incoming authentication request.
*/ */
public function store(LoginRequest $request): RedirectResponse public function store(Request $request)
{ {
$request->authenticate(); $request->validate([
'email' => 'required|email',
$request->session()->regenerate(); 'password' => 'required',
]);
if (!Auth::attempt($request->only('email', 'password'), $request->input('remember'))) {
return back()
->withInput($request->only('email'))
->withErrors(['email' => 'Kombinasi email dan password tidak valid.']);
}
return redirect()->intended(RouteServiceProvider::HOME); return redirect(RouteServiceProvider::HOME);
} }
// public function store(LoginRequest $request): RedirectResponse
// {
// $request->authenticate();
// $request->session()->regenerate();
// return redirect()->intended(RouteServiceProvider::HOME);
// }
/** /**
* Destroy an authenticated session. * Destroy an authenticated session.

24
app/Http/Controllers/Auth/RedirectAuthController.php

@ -10,13 +10,29 @@ class RedirectAuthController extends Controller
{ {
public function redirectAuth() public function redirectAuth()
{ {
if (Auth::check() && Auth::user()->role_id == '1') { if (Auth::check()) {
if (Auth::user()->role_id == '1') {
// Admin // Admin
return redirect()->route('dashboard.home.admin'); return redirect()->route('dashboard.home.admin');
} elseif (Auth::check() && Auth::user()->role_id == 'user') {
return redirect()->route('dashboard.home.user');
} else { } else {
return redirect()->route('login'); return redirect()->route('dashboard.home.admin');
// User (role_id selain 1)
// return redirect()->route('dashboard.home.user');
}
} else {
// Tidak ada akun atau kesalahan login
// return redirect()->route('login')->with('error', 'Kesalahan email atau password.');
return redirect()->route('login')->with('error', 'Kesalahan email atau password.');
} }
// if (Auth::check() && Auth::user()->role_id == '1') {
// // Admin
// return redirect()->route('dashboard.home.admin');
// } elseif (Auth::check() && Auth::user()->role_id == '2') {
// return redirect()->route('dashboard.home.admin');
// // return redirect()->route('dashboard.home.user');
// } else {
// return redirect()->route('login');
// }
} }
} }

26
app/Http/Controllers/CustomerController.php

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\ValidasiCreateCustomer;
use App\Models\Customer; use App\Models\Customer;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -34,26 +35,13 @@ class CustomerController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(Request $request) public function store(ValidasiCreateCustomer $request)
{ {
// dd('oke');
$request->validate([
'name' => 'required',
'code_customer' => 'required',
'lot_no' => 'required',
'nip' => '',
'no_hp' => 'required',
'tgl_lahir' => '',
'jenis_kelamin' => '',
'agama' => '',
'address' => 'required',
]);
try { try {
$currentUser = Auth::user(); $currentUser = Auth::user();
$validatedData = $request->except('_token'); $validatedData = $request->except('_token');
$validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by $validatedData['created_by'] = $currentUser->id; // Menggunakan nama pengguna sebagai created_by
$validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by $validatedData['updated_by'] = $currentUser->id; // Menggunakan nama pengguna sebagai updated_by
Customer::create($validatedData); Customer::create($validatedData);
return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil ditambahkan'); return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil ditambahkan');
} catch (\Throwable $th) { } catch (\Throwable $th) {
@ -95,11 +83,7 @@ class CustomerController extends Controller
'name' => 'required', 'name' => 'required',
'code_customer' => 'required', 'code_customer' => 'required',
'lot_no' => 'required', 'lot_no' => 'required',
'nip' => 'required', 'no_tlp' => 'required',
'no_hp' => 'required',
'tgl_lahir' => 'required',
'jenis_kelamin' => 'required',
'agama' => 'required',
'address' => 'required', 'address' => 'required',
]); ]);
// dd($request); // dd($request);

12
app/Http/Controllers/M_userController.php

@ -7,6 +7,7 @@ use App\Models\m_role;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Http\Requests\ValidasiCreateUser;
class M_userController extends Controller class M_userController extends Controller
{ {
@ -40,17 +41,8 @@ class M_userController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(Request $request) public function store(ValidasiCreateUser $request)
{ {
$request->validate([
'username' => 'required',
'fullname' => 'required',
'email' => 'required|email',
'divisi' => 'required',
'role_id' => 'required',
'warehouse_id' => 'required',
'password' => 'required',
]);
try { try {
$currentUser = Auth::user(); $currentUser = Auth::user();

19
app/Http/Controllers/WarehouseController.php

@ -2,6 +2,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\ValidasiCreateWarehouse;
use App\Http\Requests\ValidasiUpdateWarehouse;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -30,13 +32,9 @@ class WarehouseController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(Request $request) public function store(ValidasiCreateWarehouse $request)
{ {
$request->validate([
'name' => 'required',
'description' => 'required',
'address' => 'required',
]);
try { try {
$currentUser = Auth::user(); $currentUser = Auth::user();
$validatedData = $request->except('_token'); $validatedData = $request->except('_token');
@ -71,15 +69,8 @@ class WarehouseController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function update(Request $request, $id) public function update(ValidasiUpdateWarehouse $request, $id)
{ {
// dd('oke');
$request->validate([
'name' => 'required',
'description' => 'required',
'address' => 'required',
]);
// dd($request);
try { try {
$warehouse = m_warehouse::findOrFail($id); $warehouse = m_warehouse::findOrFail($id);
$warehouse->update($request->all()); $warehouse->update($request->all());

53
app/Http/Requests/ValidasiCreateCustomer.php

@ -0,0 +1,53 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiCreateCustomer extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:50',
'code_customer' => 'required|string|max:15|unique:customers,code_customer',
'lot_no' => 'required|string|max:50',
'no_tlp' => 'required|numeric|max:20',
'address' => 'required|string',
];
}
public function messages()
{
return [
'name.required' => 'Kolom name wajib diisi.',
'name.string' => 'Kolom name harus berupa teks.',
'name.max' => 'Kolom name tidak boleh lebih dari :max karakter.',
'code_customer.required' => 'Kolom code_customer wajib diisi.',
'code_customer.string' => 'Kolom code_customer harus berupa teks.',
'code_customer.max' => 'Kolom code_customer tidak boleh lebih dari :max karakter.',
'code_customer.unique' => 'Kolom code_customer sudah ada.',
'lot_no.required' => 'Kolom lot_no wajib diisi.',
'lot_no.string' => 'Kolom lot_no harus berupa teks.',
'lot_no.max' => 'Kolom lot_no tidak boleh lebih dari :max karakter.',
'no_tlp.required' => 'Kolom no_tlp wajib diisi.',
'no_tlp.numeric' => 'Kolom no_tlp harus berisi angka.',
'no_tlp.max' => 'Kolom no_tlp tidak boleh lebih dari :max karakter.',
'address.required' => 'Kolom address wajib diisi.',
'address.string' => 'Kolom address harus berupa teks.',
];
}
}

78
app/Http/Requests/ValidasiCreateUser.php

@ -0,0 +1,78 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiCreateUser extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'username' => 'required|string|max:32',
'fullname' => 'required|string|max:32',
'nip' => 'nullable|numeric|max:20',
'email' => 'required|email|string|max:45',
'no_hp' => 'nullable|numeric|max:15',
'divisi' => 'nullable|string|max:50',
'foto' => 'nullable|string|max:255',
'role_id' => 'required|exists:m_roles,id',
'warehouse_id' => 'nullable|exists:m_warehouses,id',
'address' => 'nullable|string',
'email_verified_at' => 'nullable|date',
'password' => 'required|string|min:6|max:16',
'created_by' => 'nullable|string|max:32',
'updated_by' => 'nullable|string|max:32',
];
}
public function messages()
{
return [
'username.required' => 'Kolom username wajib diisi.',
'username.string' => 'Kolom username harus berupa teks.',
'username.max' => 'Kolom username tidak boleh lebih dari :max karakter.',
'fullname.required' => 'Kolom fullname wajib diisi.',
'fullname.string' => 'Kolom fullname harus berupa teks.',
'fullname.max' => 'Kolom fullname tidak boleh lebih dari :max karakter.',
'nip.numeric' => 'Kolom NIP harus berisi angka.',
'nip.max' => 'Kolom NIP tidak boleh lebih dari :max karakter.',
'email.required' => 'Kolom email wajib diisi.',
'email.email' => 'Format email tidak valid.',
'email.string' => 'Kolom email harus berupa teks.',
'email.max' => 'Kolom email tidak boleh lebih dari :max karakter.',
'no_hp.numeric' => 'Kolom no_hp harus berisi angka.',
'no_hp.max' => 'Kolom no_hp tidak boleh lebih dari :max karakter.',
'divisi.string' => 'Kolom divisi harus berupa teks.',
'divisi.max' => 'Kolom divisi tidak boleh lebih dari :max karakter.',
'foto.string' => 'Kolom foto harus berupa teks.',
'foto.max' => 'Kolom foto tidak boleh lebih dari :max karakter.',
'role_id.required' => 'Kolom role_id wajib diisi.',
'role_id.exists' => 'Role yang dipilih tidak valid.',
'warehouse_id.exists' => 'Warehouse yang dipilih tidak valid.',
'address.string' => 'Kolom address harus berupa teks.',
'email_verified_at.date' => 'Format tanggal email_verified_at tidak valid.',
'password.required' => 'Kolom password wajib diisi.',
'password.string' => 'Kolom password harus berupa teks.',
'password.min' => 'Kolom password minimal harus :min karakter.',
'password.max' => 'Kolom password tidak boleh lebih dari :max karakter.',
'created_by.string' => 'Kolom created_by harus berupa teks.',
'created_by.max' => 'Kolom created_by tidak boleh lebih dari :max karakter.',
'updated_by.string' => 'Kolom updated_by harus berupa teks.',
'updated_by.max' => 'Kolom updated_by tidak boleh lebih dari :max karakter.',
];
}
}

45
app/Http/Requests/ValidasiCreateWarehouse.php

@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiCreateWarehouse extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:32',
'description' => 'required|string|max:255',
'address' => 'required|string|max:255',
];
}
public function messages()
{
return [
'name.required' => 'Kolom nama wajib diisi.',
'name.string' => 'Kolom nama harus berupa teks.',
'name.max' => 'Kolom nama tidak boleh lebih dari :max karakter.',
'description.required' => 'Kolom deskripsi wajib diisi.',
'description.string' => 'Kolom deskripsi harus berupa teks.',
'description.max' => 'Kolom deskripsi tidak boleh lebih dari :max karakter.',
'address.required' => 'Kolom alamat wajib diisi.',
'address.string' => 'Kolom alamat harus berupa teks.',
'address.max' => 'Kolom alamat tidak boleh lebih dari :max karakter.',
];
}
}

45
app/Http/Requests/ValidasiUpdateWarehouse.php

@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiUpdateWarehouse extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:32',
'description' => 'required|string|max:255',
'address' => 'required|string|max:255',
];
}
public function messages()
{
return [
'name.required' => 'Kolom nama wajib diisi.',
'name.string' => 'Kolom nama harus berupa teks.',
'name.max' => 'Kolom nama tidak boleh lebih dari :max karakter.',
'description.required' => 'Kolom deskripsi wajib diisi.',
'description.string' => 'Kolom deskripsi harus berupa teks.',
'description.max' => 'Kolom deskripsi tidak boleh lebih dari :max karakter.',
'address.required' => 'Kolom alamat wajib diisi.',
'address.string' => 'Kolom alamat harus berupa teks.',
'address.max' => 'Kolom alamat tidak boleh lebih dari :max karakter.',
];
}
}

6
app/Models/Customer.php

@ -15,11 +15,7 @@ class Customer extends Model
'name', 'name',
'code_customer', 'code_customer',
'lot_no', 'lot_no',
'nip', 'no_tlp',
'no_hp',
'tgl_lahir',
'jenis_kelamin',
'agama',
'address', 'address',
'created_by', 'created_by',
'updated_by', 'updated_by',

2
database/migrations/2023_10_23_073314_create_m_warehouses_table.php

@ -13,7 +13,7 @@ return new class extends Migration
{ {
Schema::create('m_warehouses', function (Blueprint $table) { Schema::create('m_warehouses', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name', 200)->nullable(); $table->string('name', 32)->nullable();
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->text('address')->nullable(); $table->text('address')->nullable();
$table->timestamps(); $table->timestamps();

22
database/migrations/2023_10_23_075245_create_users_table.php

@ -14,28 +14,28 @@ return new class extends Migration
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('username', 50)->nullable();
$table->string('fullname', 255)->nullable(); $table->string('username', 32)->nullable();
$table->string('fullname', 50)->nullable();
$table->string('nip', 20)->nullable(); $table->string('nip', 20)->nullable();
$table->string('email', 255)->nullable(); $table->string('email', 45)->nullable();
$table->string('no_hp', 20)->nullable(); $table->string('no_hp', 15)->nullable();
$table->string('divisi', 255)->nullable(); $table->string('divisi', 100)->nullable();
$table->date('tgl_lahir')->nullable(); $table->date('tgl_lahir')->nullable();
$table->string('jenis_kelamin', 30)->nullable();
$table->string('agama', 30)->nullable();
$table->string('foto', 255)->nullable(); $table->string('foto', 255)->nullable();
// $table->bigInteger('role_id')->unsigned()->nullable(); $table->string('jenis_kelamin', 20)->nullable();
// $table->foreign('role_id')->references('id')->on('m_roles')->onDelete('set null'); $table->string('agama', 15)->nullable();
$table->foreignId('role_id')->constrained('m_roles')->onDelete('cascade'); $table->foreignId('role_id')->constrained('m_roles')->onDelete('cascade');
$table->bigInteger('warehouse_id')->unsigned()->nullable(); $table->bigInteger('warehouse_id')->unsigned()->nullable();
$table->foreign('warehouse_id')->references('id')->on('m_warehouses')->onDelete('set null'); $table->foreign('warehouse_id')->references('id')->on('m_warehouses')->onDelete('set null');
$table->text('address')->nullable(); $table->text('address')->nullable();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password', 255)->nullable(); $table->string('password', 255)->nullable();
$table->string('created_by', 50)->nullable();
$table->string('updated_by', 50)->nullable();
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
$table->softDeletes(); $table->softDeletes();
}); });
} }

14
database/migrations/2023_10_28_080457_create_customers_table.php

@ -13,19 +13,15 @@ return new class extends Migration
{ {
Schema::create('customers', function (Blueprint $table) { Schema::create('customers', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name', 200); $table->string('name', 50);
$table->string('code_customer', 50); $table->string('code_customer', 15);
$table->string('lot_no', 50); $table->string('lot_no', 50);
$table->string('nip', 20)->nullable(); $table->string('no_tlp', 20)->nullable();
$table->string('no_hp', 20)->nullable();
$table->date('tgl_lahir')->nullable();
$table->string('jenis_kelamin', 30)->nullable();
$table->string('agama', 30)->nullable();
$table->text('address')->nullable(); $table->text('address')->nullable();
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 50)->nullable();
$table->string('updated_by', 200)->nullable(); $table->string('updated_by', 50)->nullable();
}); });
} }

28
database/seeders/Customer.php

@ -14,28 +14,20 @@ class Customer extends Seeder
public function run(): void public function run(): void
{ {
DB::table('customers')->insert([ DB::table('customers')->insert([
'name' => 'Gunawan', 'name' => 'DHARMA',
'code_customer' => 'G', 'code_customer' => 'DPM',
'lot_no' => 'CWT', 'lot_no' => 'JKT23',
'nip' => '1234567890987654', 'no_tlp' => '02122344',
'no_hp' => '085159079010', 'address' => 'Jalan Raya Ciwatu',
// 'tgl_lahir' => '19-06-2001',
'jenis_kelamin' => 'Laki-Laki',
'agama' => 'Islam',
'address' => 'CIwatu',
'created_by' => 'Seeder', 'created_by' => 'Seeder',
'updated_by' => 'Seeder', 'updated_by' => 'Seeder',
]); ]);
DB::table('customers')->insert([ DB::table('customers')->insert([
'name' => 'Andra Ryandra', 'name' => 'ADHI CHANDRA',
'code_customer' => 'AR', 'code_customer' => 'ACJ',
'lot_no' => 'KA', 'lot_no' => 'JKT23',
'nip' => '1234567890987', 'no_tlp' => '02198765',
'no_hp' => '085159079011', 'address' => 'Jalan Raya Gelarmendala',
// 'tgl_lahir' => '19-06-2001',
'jenis_kelamin' => 'Laki-Laki',
'agama' => 'Islam',
'address' => 'CIwatu',
'created_by' => 'Seeder', 'created_by' => 'Seeder',
'updated_by' => 'Seeder', 'updated_by' => 'Seeder',
]); ]);

6
database/seeders/RoleSeeder.php

@ -16,15 +16,15 @@ class RoleSeeder extends Seeder
// Role Admin // Role Admin
m_role::create([ m_role::create([
'name' => 'Admin', 'name' => 'Admin',
'description' => 'Peran admin sistem', 'description' => 'admin sistem',
'created_by' => 'Seeder', 'created_by' => 'Seeder',
'updated_by' => 'Seeder', 'updated_by' => 'Seeder',
]); ]);
// Role User // Role User
m_role::create([ m_role::create([
'name' => 'User', 'name' => 'Operator',
'description' => 'Peran pengguna biasa', 'description' => 'Operator sistem',
'created_by' => 'Seeder', 'created_by' => 'Seeder',
'updated_by' => 'Seeder', 'updated_by' => 'Seeder',
]); ]);

26
database/seeders/UserSeeder.php

@ -15,10 +15,10 @@ class UserSeeder extends Seeder
{ {
User::create([ User::create([
'username' => 'admin', 'username' => 'admin',
'fullname' => 'Admin User', 'fullname' => 'Admin System',
'nip' => '12345', 'nip' => '1234567890123456',
'email' => 'admin@gmail.com', 'email' => 'admin@gmail.com',
'no_hp' => '1234567890', 'no_hp' => '085159079010',
'divisi' => 'Admin Division', 'divisi' => 'Admin Division',
'tgl_lahir' => '1990-01-01', 'tgl_lahir' => '1990-01-01',
'jenis_kelamin' => 'Laki-laki', 'jenis_kelamin' => 'Laki-laki',
@ -26,7 +26,7 @@ class UserSeeder extends Seeder
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan 'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 1, // Ganti dengan ID peran yang sesuai 'role_id' => 1, // Ganti dengan ID peran yang sesuai
'warehouse_id' => 1, // Ganti dengan ID gudang yang sesuai 'warehouse_id' => 1, // Ganti dengan ID gudang yang sesuai
'address' => 'Alamat Admin', 'address' => 'Jalan Ciwatu',
'email_verified_at' => now(), 'email_verified_at' => now(),
'password' => bcrypt('admin'), 'password' => bcrypt('admin'),
'created_by' => 'Seeder', 'created_by' => 'Seeder',
@ -35,21 +35,21 @@ class UserSeeder extends Seeder
// User lainnya // User lainnya
User::create([ User::create([
'username' => 'user1', 'username' => 'Operator',
'fullname' => 'User Satu', 'fullname' => 'Operator System',
'nip' => '54321', 'nip' => '6543210987654321',
'email' => 'user1@gmail.com', 'email' => 'operator@gmail.com',
'no_hp' => '9876543210', 'no_hp' => '087779767603',
'divisi' => 'Divisi Satu', 'divisi' => 'Operator Gudang',
'tgl_lahir' => '1985-05-15', 'tgl_lahir' => '1985-05-15',
'jenis_kelamin' => 'Perempuan', 'jenis_kelamin' => 'Perempuan',
'agama' => 'Kristen', 'agama' => 'Islam',
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan 'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 2, // Ganti dengan ID peran yang sesuai 'role_id' => 2, // Ganti dengan ID peran yang sesuai
'warehouse_id' => 2, // Ganti dengan ID gudang yang sesuai 'warehouse_id' => 2, // Ganti dengan ID gudang yang sesuai
'address' => 'Alamat User Satu', 'address' => 'Jalan Gelarmendala',
'email_verified_at' => now(), 'email_verified_at' => now(),
'password' => bcrypt('user1'), 'password' => bcrypt('operator'),
'created_by' => 'Seeder', 'created_by' => 'Seeder',
'updated_by' => 'Seeder', 'updated_by' => 'Seeder',
]); ]);

12
resources/views/auth/login.blade.php

@ -40,7 +40,7 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="p-5"> <div class="p-5">
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Welcome Back!</h1> <h1 class="h4 text-gray-900 mb-4">Selamat Datang!</h1>
</div> </div>
<form class="user" method="POST" action="{{ route('login') }}"> <form class="user" method="POST" action="{{ route('login') }}">
@csrf @csrf
@ -49,11 +49,21 @@
aria-describedby="emailHelp" name="email" value="{{ old('email') }}" aria-describedby="emailHelp" name="email" value="{{ old('email') }}"
required autofocus autocomplete="username" required autofocus autocomplete="username"
placeholder="Masukan Email anda"> placeholder="Masukan Email anda">
@if ($errors->has('email'))
<div class="alert alert-danger">
{{ $errors->first('email') }}
</div>
@endif
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="password" class="form-control form-control-user" id="password" <input type="password" class="form-control form-control-user" id="password"
name="password" required autocomplete="current-password" name="password" required autocomplete="current-password"
placeholder="Masukan password anda"> placeholder="Masukan password anda">
@if ($errors->has('password'))
<div class="alert alert-danger">
{{ $errors->first('password') }}
</div>
@endif
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-checkbox small"> <div class="custom-control custom-checkbox small">

34
resources/views/dashboard/Master_Data/Customer/create.blade.php

@ -1,5 +1,6 @@
@extends('layouts.main') @extends('layouts.main')
@section('content') @section('content')
@include('layouts.components.alert-prompt')
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<div class="row"> <div class="row">
@ -24,36 +25,9 @@
<input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ old('lot_no') }}" <input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ old('lot_no') }}"
placeholder="Masukan lot number" required> placeholder="Masukan lot number" required>
<label for="nip" class="col-form-label">NIP Customer:</label> <label for="no_tlp" class="col-form-label">Nomor Telepon Customer:</label>
<input class="form-control" name="nip" type="text" id="nip" value="{{ old('nip') }}" <input class="form-control" name="no_tlp" type="text" id="no_tlp" value="{{ old('no_tlp') }}"
placeholder="Masukan NIP customer" required> placeholder="Masukan Nomor Telepon customer" required>
<label for="no_hp" class="col-form-label">No. HP Customer:</label>
<input class="form-control" name="no_hp" type="text" id="no_hp" value="{{ old('no_hp') }}"
placeholder="Masukan Nomor Handphone customer" required>
<label for="tgl_lahir" class="col-form-label">Tanggal Lahir Customer:</label>
<input class="form-control" name="tgl_lahir" type="date" id="tgl_lahir"
value="{{ old('tgl_lahir') }}" required>
<label for="jenis_kelamin" class="col-form-label">Jenis Kelamin Customer:</label>
<select class="form-control" name="jenis_kelamin" id="jenis_kelamin" required>
<option disabled selected>Pilih Jenis Kelamin Customer</option>
<option value="Laki-Laki">Laki-Laki</option>
<option value="Perempuan">Perempuan</option>
</select>
<label for="agama" class="col-form-label">Agama Customer:</label>
<select class="form-control" name="agama" id="agama" required>
<option disabled selected>Pilih Agama Customer</option>
<option value="Islam">Islam</option>
<option value="Kristen">Kristen</option>
<option value="Katolik">Katolik</option>
<option value="Hindu">Hindu</option>
<option value="Buddha">Buddha</option>
<option value="Konghucu">Konghucu</option>
<option value="Lainnya">Lainnya</option>
</select>
<label for="address" class="col-form-label">Alamat Customer:</label> <label for="address" class="col-form-label">Alamat Customer:</label>
<textarea class="form-control" name="address" id="address" placeholder="Masukkan alamat customer" required></textarea> <textarea class="form-control" name="address" id="address" placeholder="Masukkan alamat customer" required></textarea>

35
resources/views/dashboard/Master_Data/Customer/edit.blade.php

@ -26,38 +26,9 @@
<input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ $customer->lot_no }}" <input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ $customer->lot_no }}"
placeholder="Masukan lot number" required> placeholder="Masukan lot number" required>
<label for="nip" class="col-form-label">NIP Customer:</label> <label for="no_tlp" class="col-form-label">No. Telepon Customer:</label>
<input class="form-control" name="nip" type="text" id="nip" value="{{ $customer->nip }}" <input class="form-control" name="no_tlp" type="text" id="no_tlp" value="{{ $customer->no_tlp }}"
placeholder="Masukan NIP customer" required> placeholder="Masukan nomor telepon customer" required>
<label for="no_hp" class="col-form-label">No. HP Customer:</label>
<input class="form-control" name="no_hp" type="text" id="no_hp" value="{{ $customer->no_hp }}"
placeholder="Masukan Nomor Handphone customer" required>
<label for="tgl_lahir" class="col-form-label">Tanggal Lahir Customer:</label>
<input class="form-control" name="tgl_lahir" type="date" id="tgl_lahir"
value="{{ $customer->tgl_lahir }}" required>
<label for="jenis_kelamin" class="col-form-label">Jenis Kelamin Customer:</label>
<select class="form-control" name="jenis_kelamin" id="jenis_kelamin" required>
<option disabled>Pilih Jenis Kelamin Customer</option>
<option value="Laki-Laki" {{ $customer->jenis_kelamin === 'Laki-Laki' ? 'selected' : '' }}>Laki-Laki
</option>
<option value="Perempuan" {{ $customer->jenis_kelamin === 'Perempuan' ? 'selected' : '' }}>Perempuan
</option>
</select>
<label for="agama" class="col-form-label">Agama Customer:</label>
<select class="form-control" name="agama" id="agama" required>
<option disabled selected>Pilih Agama Customer</option>
<option value="Islam" {{ $customer->agama === 'Islam' ? 'selected' : '' }}>Islam</option>
<option value="Kristen" {{ $customer->agama === 'Kristen' ? 'selected' : '' }}>Kristen</option>
<option value="Katolik" {{ $customer->agama === 'Katolik' ? 'selected' : '' }}>Katolik</option>
<option value="Hindu" {{ $customer->agama === 'Hindu' ? 'selected' : '' }}>Hindu</option>
<option value="Buddha" {{ $customer->agama === 'Buddha' ? 'selected' : '' }}>Buddha</option>
<option value="Konghucu" {{ $customer->agama === 'Konghucu' ? 'selected' : '' }}>Konghucu</option>
<option value="Lainnya" {{ $customer->agama === 'Lainnya' ? 'selected' : '' }}>Lainnya</option>
</select>
<label for="address" class="col-form-label">Alamat Customer:</label> <label for="address" class="col-form-label">Alamat Customer:</label>
<textarea class="form-control" name="address" id="address" placeholder="Masukkan alamat customer" required>{{ $customer->address }}</textarea> <textarea class="form-control" name="address" id="address" placeholder="Masukkan alamat customer" required>{{ $customer->address }}</textarea>

7
resources/views/dashboard/Master_Data/Customer/index.blade.php

@ -1,10 +1,11 @@
@extends('layouts.main') @extends('layouts.main')
@section('content') @section('content')
@include('layouts.components.alert-prompt')
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data User</h5> <h5 class="m-0 font-weight-bold text-primary mt-2">Data Customer</h5>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<a href="{{ route('dashboard.customer.create') }}" class="btn btn-success btn-icon-split"> <a href="{{ route('dashboard.customer.create') }}" class="btn btn-success btn-icon-split">
@ -21,7 +22,7 @@
<th class="text-center">No</th> <th class="text-center">No</th>
<th>Nama</th> <th>Nama</th>
<th>Kode Customer</th> <th>Kode Customer</th>
<th>No. HP</th> <th>No. Telepon</th>
<th>Alamat</th> <th>Alamat</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
@ -35,7 +36,7 @@
<td class="text-center">{{ $nocustomer++ }}</td> <td class="text-center">{{ $nocustomer++ }}</td>
<td>{{ $data_customer->name }}</td> <td>{{ $data_customer->name }}</td>
<td>{{ $data_customer->code_customer }}</td> <td>{{ $data_customer->code_customer }}</td>
<td>{{ $data_customer->no_hp }}</td> <td>{{ $data_customer->no_tlp }}</td>
<td>{{ $data_customer->address }}</td> <td>{{ $data_customer->address }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.customer.show', [$data_customer->id]) }}"> <a href="{{ route('dashboard.customer.show', [$data_customer->id]) }}">

29
resources/views/dashboard/Master_Data/Customer/show.blade.php

@ -11,39 +11,20 @@
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label for="name" class="col-form-label">Nama Customer:</label> <label for="name" class="col-form-label">Nama Customer:</label>
<input class="form-control" name="name" type="text" id="name" value="{{ $customer->name }}" <input class="form-control" value="{{ $customer->name }}" readonly>
readonly>
<label for="code_customer" class="col-form-label">Kode Customer:</label> <label for="code_customer" class="col-form-label">Kode Customer:</label>
<input class="form-control" name="code_customer" type="text" id="code_customer" <input class="form-control" value="{{ $customer->code_customer }}" readonly>
value="{{ $customer->code_customer }}" readonly>
<label for="lot_no" class="col-form-label">Lot Number:</label> <label for="lot_no" class="col-form-label">Lot Number:</label>
<input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ $customer->lot_no }}" <input class="form-control" name="lot_no" type="text" id="lot_no" value="{{ $customer->lot_no }}"
readonly> readonly>
<label for="nip" class="col-form-label">NIP Customer:</label> <label for="no_tlp" class="col-form-label">No. Telepon Customer:</label>
<input class="form-control" name="nip" type="text" id="nip" value="{{ $customer->nip }}" <input class="form-control" value="{{ $customer->no_tlp }}" readonly>
readonly>
<label for="no_hp" class="col-form-label">No. HP Customer:</label>
<input class="form-control" name="no_hp" type="text" id="no_hp" value="{{ $customer->no_hp }}"
readonly>
<label for="tgl_lahir" class="col-form-label">Tanggal Lahir Customer:</label>
<input class="form-control" name="tgl_lahir" type="date" id="tgl_lahir"
value="{{ $customer->tgl_lahir }}" readonly>
<label for="jenis_kelamin" class="col-form-label">Jenis Kelamin Customer:</label>
<input class="form-control" name="jenis_kelamin" type="text" id="jenis_kelamin"
value="{{ $customer->jenis_kelamin }}" readonly>
<label for="agama" class="col-form-label">Agama Customer:</label>
<input class="form-control" name="agama" type="text" id="agama" value="{{ $customer->agama }}"
readonly>
<label for="address" class="col-form-label">Alamat Customer:</label> <label for="address" class="col-form-label">Alamat Customer:</label>
<textarea class="form-control" name="address" id="address" readonly>{{ $customer->address }}</textarea> <textarea class="form-control" readonly>{{ $customer->address }}</textarea>
</div> </div>
<div class="modal-footer d-flex justify-content-center"> <div class="modal-footer d-flex justify-content-center">
<a href="{{ route('dashboard.customer.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.customer.index') }}" class="btn btn-secondary">Kembali</a>

5
resources/views/dashboard/Master_Data/User/create.blade.php

@ -9,6 +9,11 @@
</div> </div>
</div> </div>
</div> </div>
@include('layouts.components.alert-prompt')
<div class="card-body"> <div class="card-body">
<form action="{{ route('dashboard.user.store') }}" method="POST" enctype="multipart/form-data"> <form action="{{ route('dashboard.user.store') }}" method="POST" enctype="multipart/form-data">
@csrf @csrf

1
resources/views/dashboard/Master_Data/User/index.blade.php

@ -1,5 +1,6 @@
@extends('layouts.main') @extends('layouts.main')
@section('content') @section('content')
@include('layouts.components.alert-prompt')
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<div class="row"> <div class="row">

11
resources/views/dashboard/Master_Data/Warehouse/index.blade.php

@ -1,7 +1,9 @@
@extends('layouts.main') @extends('layouts.main')
@section('title', 'Warehouse') @section('title', 'Warehouse')
@section('content') @section('content')
<div class="container-fluid">
@include('layouts.components.alert-prompt')
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<div class="row"> <div class="row">
@ -9,8 +11,7 @@
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Warehouse</h5> <h5 class="m-0 font-weight-bold text-primary mt-2">Data Warehouse</h5>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" <a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
data-target="#tambahDataModal">
<span class="text">Tambah Data Warehouse</span> <span class="text">Tambah Data Warehouse</span>
</a> </a>
</a> </a>
@ -40,8 +41,7 @@
<td>{{ $data->description }}</td> <td>{{ $data->description }}</td>
<td>{{ $data->address }}</td> <td>{{ $data->address }}</td>
<td class="text-center"> <td class="text-center">
<a href="#" data-toggle="modal" <a href="#" data-toggle="modal" data-target="#editDataModal{{ $data['id'] }}">
data-target="#editDataModal{{ $data['id'] }}">
<i class="fa fa-edit" style="font-size: 20px"></i> <i class="fa fa-edit" style="font-size: 20px"></i>
</a> </a>
<form action="{{ route('dashboard.warehouse.destroy', $data->id) }}" method="POST" <form action="{{ route('dashboard.warehouse.destroy', $data->id) }}" method="POST"
@ -63,7 +63,6 @@
</div> </div>
</div> </div>
</div>
<!-- Modal Tambah--> <!-- Modal Tambah-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" <div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"

26
resources/views/layouts/components/alert-prompt.blade.php

@ -0,0 +1,26 @@
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if (Session::has('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>{{ Session::get('success') }}</strong>
</div>
@endif
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
setTimeout(function() {
$(".alert.alert-danger, .alert.alert-success").fadeOut(500, function() {
$(this).remove();
});
}, 5000); // 5 detik
});
</script>

4
resources/views/layouts/main.blade.php

@ -28,7 +28,7 @@
<div class="container-fluid"> <div class="container-fluid">
<!-- allert update data foto --> <!-- allert update data foto -->
@if (session()->has('success')) {{-- @if (session()->has('success'))
<div id="success-alert" class="alert alert-success floating-alert"> <div id="success-alert" class="alert alert-success floating-alert">
{{ session()->get('success') }} {{ session()->get('success') }}
</div> </div>
@ -36,7 +36,7 @@
<div id="error-alert" class="alert alert-danger floating-alert"> <div id="error-alert" class="alert alert-danger floating-alert">
X {{ session()->get('error') }} X {{ session()->get('error') }}
</div> </div>
@endif @endif --}}
<!-- Main Bar --> <!-- Main Bar -->
@yield('content') @yield('content')

Loading…
Cancel
Save