lama
This commit is contained in:
parent
433782119f
commit
6703fcf78d
|
@ -2,12 +2,15 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\GajiModel; // Import model
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class GajiController extends Controller
|
class GajiController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('Gaji');
|
// Ambil semua data gaji dari database
|
||||||
|
$gajiKaryawan = GajiModel::all(); // Anda bisa menambahkan filter atau pagination jika diperlukan
|
||||||
|
return view('Gaji', compact('gajiKaryawan')); // Kirim data ke view
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\InputGajiModel; // Import model
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class InputGajiController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('InputGaji');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Validasi input
|
||||||
|
$validated = $request->validate([
|
||||||
|
'Tanggal' => 'required|date',
|
||||||
|
'kategori' => 'required|string',
|
||||||
|
'nama_karyawan' => 'required|string',
|
||||||
|
'gaji' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Bersihkan format angka dari input gaji
|
||||||
|
$gaji = str_replace(['.', ','], '', $request->gaji);
|
||||||
|
|
||||||
|
// Tentukan kode berdasarkan kategori
|
||||||
|
$kode = $this->generateKode($validated['kategori']);
|
||||||
|
|
||||||
|
// Simpan data
|
||||||
|
InputGajiModel::create([
|
||||||
|
'Tanggal' => $validated['Tanggal'],
|
||||||
|
'kode' => $kode,
|
||||||
|
'kategori' => $validated['kategori'],
|
||||||
|
'nama_karyawan' => $validated['nama_karyawan'],
|
||||||
|
'keterangan' => null,
|
||||||
|
'uang_masuk' => 0,
|
||||||
|
'uang_keluar' => 0,
|
||||||
|
'gaji' => $gaji,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->back()->with('error', 'Gagal menyimpan data: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateKode($kategori)
|
||||||
|
{
|
||||||
|
// Tentukan kode dasar berdasarkan kategori
|
||||||
|
$kodeDasar = 0;
|
||||||
|
switch ($kategori) {
|
||||||
|
case 'utang_gaji':
|
||||||
|
$kodeDasar = 2;
|
||||||
|
break;
|
||||||
|
case 'beban_gaji':
|
||||||
|
$kodeDasar = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$kodeDasar = 0; // Kode default jika kategori tidak dikenali
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil jumlah transaksi dengan kode dasar yang sama
|
||||||
|
$lastTransaction = InputGajiModel::where('kode', 'like', $kodeDasar . '%')->orderBy('id', 'desc')->first();
|
||||||
|
$nextNumber = $lastTransaction ? intval(substr($lastTransaction->kode, 1)) + 1 : 1;
|
||||||
|
|
||||||
|
// Gabungkan kode dasar dengan nomor urut
|
||||||
|
return $kodeDasar . str_pad($nextNumber, 2, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,23 +14,67 @@ public function index()
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
// Validasi data
|
try {
|
||||||
$request->validate([
|
// Validasi input
|
||||||
'tanggal' => 'required|date',
|
$validated = $request->validate([
|
||||||
'kategori' => 'required|string|max:255',
|
'Tanggal' => 'required|date',
|
||||||
'keterangan' => 'required|string',
|
'kategori' => 'required|string',
|
||||||
'total_uang' => 'required|numeric',
|
'keterangan' => 'required|string',
|
||||||
]);
|
'uang_keluar' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
// Simpan data ke database
|
// Bersihkan format angka dari input uang_keluar
|
||||||
UangKeluarModel::create([
|
$uang_keluar = str_replace(['.', ','], '', $request->uang_keluar);
|
||||||
'tanggal' => $request->tanggal,
|
|
||||||
'kategori' => $request->kategori,
|
|
||||||
'keterangan' => $request->keterangan,
|
|
||||||
'total_uang' => $request->total_uang,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Redirect atau kembali ke halaman dengan pesan sukses
|
// Tentukan kode berdasarkan kategori
|
||||||
return redirect()->back()->with('success', 'Data Uang Keluar berhasil disimpan!');
|
$kode = $this->generateKode($validated['kategori']);
|
||||||
|
|
||||||
|
// Simpan data
|
||||||
|
UangKeluarModel::create([
|
||||||
|
'Tanggal' => $validated['Tanggal'],
|
||||||
|
'kode' => $kode,
|
||||||
|
'kategori' => $validated['kategori'],
|
||||||
|
'keterangan' => $validated['keterangan'],
|
||||||
|
'uang_masuk' => 0,
|
||||||
|
'uang_keluar' => $uang_keluar,
|
||||||
|
'gaji' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->back()->with('error', 'Gagal menyimpan data: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateKode($kategori)
|
||||||
|
{
|
||||||
|
// Tentukan kode dasar berdasarkan kategori
|
||||||
|
$kodeDasar = 0;
|
||||||
|
switch ($kategori) {
|
||||||
|
case 'kas':
|
||||||
|
$kodeDasar = 1;
|
||||||
|
break;
|
||||||
|
case 'utang_usaha':
|
||||||
|
$kodeDasar = 2;
|
||||||
|
break;
|
||||||
|
case 'utang_bank':
|
||||||
|
$kodeDasar = 2;
|
||||||
|
break;
|
||||||
|
case 'beban_listrik':
|
||||||
|
$kodeDasar = 5;
|
||||||
|
break;
|
||||||
|
case 'beban_sewa':
|
||||||
|
$kodeDasar = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$kodeDasar = 0; // Kode default jika kategori tidak dikenali
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil jumlah transaksi dengan kode dasar yang sama
|
||||||
|
$lastTransaction = UangKeluarModel::where('kode', 'like', $kodeDasar . '%')->orderBy('id', 'desc')->first();
|
||||||
|
$nextNumber = $lastTransaction ? intval(substr($lastTransaction->kode, 1)) + 1 : 1;
|
||||||
|
|
||||||
|
// Gabungkan kode dasar dengan nomor urut
|
||||||
|
return $kodeDasar . str_pad($nextNumber, 2, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,23 +14,64 @@ public function index()
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
// Validasi data
|
try {
|
||||||
$request->validate([
|
// Validasi input
|
||||||
'tanggal' => 'required|date',
|
$validated = $request->validate([
|
||||||
'kategori' => 'required|string|max:255',
|
'Tanggal' => 'required|date',
|
||||||
'keterangan' => 'required|string',
|
'kategori' => 'required|string',
|
||||||
'total_uang' => 'required|numeric',
|
'keterangan' => 'required|string',
|
||||||
]);
|
'uang_masuk' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
// Simpan data ke database
|
// Bersihkan format angka dari input uang_masuk
|
||||||
UangMasukModel::create([
|
$uang_masuk = str_replace(['.', ','], '', $request->uang_masuk);
|
||||||
'tanggal' => $request->tanggal,
|
|
||||||
'kategori' => $request->kategori,
|
|
||||||
'keterangan' => $request->keterangan,
|
|
||||||
'total_uang' => $request->total_uang,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Redirect atau kembali ke halaman dengan pesan sukses
|
// Tentukan kode berdasarkan kategori
|
||||||
return redirect()->back()->with('success', 'Data Uang Masuk berhasil disimpan!');
|
$kode = $this->generateKode($validated['kategori']);
|
||||||
|
|
||||||
|
// Simpan data
|
||||||
|
UangMasukModel::create([
|
||||||
|
'Tanggal' => $validated['Tanggal'],
|
||||||
|
'kode' => $kode,
|
||||||
|
'kategori' => $validated['kategori'],
|
||||||
|
'keterangan' => $validated['keterangan'],
|
||||||
|
'uang_masuk' => $uang_masuk,
|
||||||
|
'uang_keluar' => 0,
|
||||||
|
'gaji' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->back()->with('error', 'Gagal menyimpan data: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateKode($kategori)
|
||||||
|
{
|
||||||
|
// Tentukan kode dasar berdasarkan kategori
|
||||||
|
$kodeDasar = 0;
|
||||||
|
switch ($kategori) {
|
||||||
|
case 'kas':
|
||||||
|
$kodeDasar = 1;
|
||||||
|
break;
|
||||||
|
case 'modal_pemilik':
|
||||||
|
$kodeDasar = 3;
|
||||||
|
break;
|
||||||
|
case 'pendapatan_penjualan':
|
||||||
|
$kodeDasar = 4;
|
||||||
|
break;
|
||||||
|
case 'pendapatan_jasa':
|
||||||
|
$kodeDasar = 4; // Jika ada kode yang sama, bisa disesuaikan
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$kodeDasar = 0; // Kode default jika kategori tidak dikenali
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil jumlah transaksi dengan kode dasar yang sama
|
||||||
|
$lastTransaction = UangMasukModel::where('kode', 'like', $kodeDasar . '%')->orderBy('id', 'desc')->first();
|
||||||
|
$nextNumber = $lastTransaction ? intval(substr($lastTransaction->kode, 1)) + 1 : 1;
|
||||||
|
|
||||||
|
// Gabungkan kode dasar dengan nomor urut
|
||||||
|
return $kodeDasar . str_pad($nextNumber, 2, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GajiModel extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
// Nama tabel yang digunakan
|
||||||
|
protected $table = 'laporan_transaksis'; // Ganti dengan nama tabel yang sesuai
|
||||||
|
|
||||||
|
// Primary key
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
// Menentukan apakah primary key adalah auto-increment
|
||||||
|
public $incrementing = true;
|
||||||
|
|
||||||
|
// Tipe data primary key
|
||||||
|
protected $keyType = 'int';
|
||||||
|
|
||||||
|
// Kolom yang dapat diisi
|
||||||
|
protected $fillable = [
|
||||||
|
'Tanggal',
|
||||||
|
'kode',
|
||||||
|
'kategori',
|
||||||
|
'keterangan',
|
||||||
|
'uang_masuk',
|
||||||
|
'uang_keluar',
|
||||||
|
'gaji'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Timestamps
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
// Jika Anda ingin mengubah nama kolom timestamps
|
||||||
|
const CREATED_AT = 'created_at';
|
||||||
|
const UPDATED_AT = 'updated_at';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'Tanggal' => 'date',
|
||||||
|
'uang_masuk' => 'decimal:2',
|
||||||
|
'uang_keluar' => 'decimal:2',
|
||||||
|
'gaji' => 'decimal:2',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class InputGajiModel extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
// Nama tabel yang digunakan
|
||||||
|
protected $table = 'laporan_transaksis';
|
||||||
|
|
||||||
|
// Primary key
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
// Menentukan apakah primary key adalah auto-increment
|
||||||
|
public $incrementing = true;
|
||||||
|
|
||||||
|
// Tipe data primary key
|
||||||
|
protected $keyType = 'int';
|
||||||
|
|
||||||
|
// Kolom yang dapat diisi
|
||||||
|
protected $fillable = [
|
||||||
|
'Tanggal',
|
||||||
|
'kode',
|
||||||
|
'kategori',
|
||||||
|
'nama_karyawan',
|
||||||
|
'uang_masuk',
|
||||||
|
'uang_keluar',
|
||||||
|
'gaji'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Timestamps
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
// Jika Anda ingin mengubah nama kolom timestamps
|
||||||
|
const CREATED_AT = 'created_at';
|
||||||
|
const UPDATED_AT = 'updated_at';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'Tanggal' => 'date',
|
||||||
|
'uang_masuk' => 'decimal:2',
|
||||||
|
'uang_keluar' => 'decimal:2',
|
||||||
|
'gaji' => 'decimal:2',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Login extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ class UangKeluarModel extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
// Nama tabel yang digunakan
|
// Nama tabel yang digunakan
|
||||||
protected $table = 'uang_keluar';
|
protected $table = 'laporan_transaksis';
|
||||||
|
|
||||||
// Primary key
|
// Primary key
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
@ -23,10 +23,13 @@ class UangKeluarModel extends Model
|
||||||
|
|
||||||
// Kolom yang dapat diisi
|
// Kolom yang dapat diisi
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tanggal',
|
'Tanggal',
|
||||||
|
'kode',
|
||||||
'kategori',
|
'kategori',
|
||||||
'keterangan',
|
'keterangan',
|
||||||
'total_uang',
|
'uang_masuk',
|
||||||
|
'uang_keluar',
|
||||||
|
'gaji'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Timestamps
|
// Timestamps
|
||||||
|
@ -35,4 +38,11 @@ class UangKeluarModel extends Model
|
||||||
// Jika Anda ingin mengubah nama kolom timestamps
|
// Jika Anda ingin mengubah nama kolom timestamps
|
||||||
const CREATED_AT = 'created_at';
|
const CREATED_AT = 'created_at';
|
||||||
const UPDATED_AT = 'updated_at';
|
const UPDATED_AT = 'updated_at';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'Tanggal' => 'date',
|
||||||
|
'uang_masuk' => 'decimal:2',
|
||||||
|
'uang_keluar' => 'decimal:2',
|
||||||
|
'gaji' => 'decimal:2',
|
||||||
|
];
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ class UangMasukModel extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
// Nama tabel yang digunakan
|
// Nama tabel yang digunakan
|
||||||
protected $table = 'uang_masuk';
|
protected $table = 'laporan_transaksis';
|
||||||
|
|
||||||
// Primary key
|
// Primary key
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
@ -23,10 +23,13 @@ class UangMasukModel extends Model
|
||||||
|
|
||||||
// Kolom yang dapat diisi
|
// Kolom yang dapat diisi
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tanggal',
|
'Tanggal',
|
||||||
|
'kode',
|
||||||
'kategori',
|
'kategori',
|
||||||
'keterangan',
|
'keterangan',
|
||||||
'total_uang',
|
'uang_masuk',
|
||||||
|
'uang_keluar',
|
||||||
|
'gaji'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Timestamps
|
// Timestamps
|
||||||
|
@ -35,4 +38,11 @@ class UangMasukModel extends Model
|
||||||
// Jika Anda ingin mengubah nama kolom timestamps
|
// Jika Anda ingin mengubah nama kolom timestamps
|
||||||
const CREATED_AT = 'created_at';
|
const CREATED_AT = 'created_at';
|
||||||
const UPDATED_AT = 'updated_at';
|
const UPDATED_AT = 'updated_at';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'Tanggal' => 'date',
|
||||||
|
'uang_masuk' => 'decimal:2',
|
||||||
|
'uang_keluar' => 'decimal:2',
|
||||||
|
'gaji' => 'decimal:2',
|
||||||
|
];
|
||||||
}
|
}
|
|
@ -1,28 +0,0 @@
|
||||||
<?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('password_reset_tokens', function (Blueprint $table) {
|
|
||||||
$table->string('email')->primary();
|
|
||||||
$table->string('token');
|
|
||||||
$table->timestamp('created_at')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('password_reset_tokens');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?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('failed_jobs', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->string('uuid')->unique();
|
|
||||||
$table->text('connection');
|
|
||||||
$table->text('queue');
|
|
||||||
$table->longText('payload');
|
|
||||||
$table->longText('exception');
|
|
||||||
$table->timestamp('failed_at')->useCurrent();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('failed_jobs');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,33 +0,0 @@
|
||||||
<?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('personal_access_tokens', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->morphs('tokenable');
|
|
||||||
$table->string('name');
|
|
||||||
$table->string('token', 64)->unique();
|
|
||||||
$table->text('abilities')->nullable();
|
|
||||||
$table->timestamp('last_used_at')->nullable();
|
|
||||||
$table->timestamp('expires_at')->nullable();
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('personal_access_tokens');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -13,9 +13,16 @@ public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('laporan_transaksis', function (Blueprint $table) {
|
Schema::create('laporan_transaksis', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->Date('Tanggal');
|
||||||
|
$table->string('kode');
|
||||||
|
$table->string('kategori');
|
||||||
|
$table->text('keterangan');
|
||||||
|
$table->text('nama_karyawan');
|
||||||
|
$table->decimal('uang_masuk', 15, 2);
|
||||||
|
$table->decimal('uang_keluar', 15, 2);
|
||||||
|
$table->decimal('gaji', 15, 2);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
laporan_transaksi
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,13 +11,12 @@
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('logins', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('nama');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
$table->rememberToken();
|
$table->string('role');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -27,6 +26,6 @@ public function up(): void
|
||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('users');
|
Schema::dropIfExists('logins');
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -126,6 +126,12 @@
|
||||||
<span>Uang Keluar</span>
|
<span>Uang Keluar</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="mb-4">
|
||||||
|
<a href="{{ route('input-gaji.index') }}" class="nav-link flex items-center p-2 rounded-lg hover:bg-blue-700 transition-colors">
|
||||||
|
<i class="fas fa-money-bill-wave-alt mr-3"></i>
|
||||||
|
<span>Input Gaji</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="mb-4">
|
<li class="mb-4">
|
||||||
<a href="{{ route('gaji.index') }}" class="nav-link flex items-center p-2 rounded-lg hover:bg-blue-700 transition-colors">
|
<a href="{{ route('gaji.index') }}" class="nav-link flex items-center p-2 rounded-lg hover:bg-blue-700 transition-colors">
|
||||||
<i class="fas fa-user mr-3"></i>
|
<i class="fas fa-user mr-3"></i>
|
||||||
|
|
|
@ -13,44 +13,45 @@
|
||||||
<div class="flex flex-wrap gap-4 px-6 py-4 border-b border-gray-200">
|
<div class="flex flex-wrap gap-4 px-6 py-4 border-b border-gray-200">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<label class="mr-2 text-sm font-medium text-gray-600">Keterangan:</label>
|
<label class="mr-2 text-sm font-medium text-gray-600">Keterangan:</label>
|
||||||
<input type="text" id="filterKeterangan" placeholder="Masukkan keterangan" class="border rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
<input type="text" id="filterKeterangan" placeholder="Masukkan keterangan" class="border rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" onkeyup="filterTable()">
|
||||||
<button class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">
|
<button class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">
|
||||||
<i class="fas fa-search mr-2"></i>Filter
|
<i class="fas fa-search mr-2"></i>Filter
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-white rounded-lg shadow-lg p-6">
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||||
<!-- Tabel Keterangan Gaji Karyawan -->
|
<!-- Tabel Keterangan Gaji Karyawan -->
|
||||||
<table class="min-w-full bg-white border border-gray-300">
|
<table id="gajiTable" class="min-w-full bg-white border border-gray-300">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="py-2 px-4 border-b text-left">No</th>
|
<th class="py-2 px-4 border-b text-left">No</th>
|
||||||
<th class="py-2 px-4 border-b text-left">Keterangan</th>
|
<th class="py-2 px-4 border-b text-left">Keterangan</th>
|
||||||
<th class="py-2 px-4 border-b text-left">Nominal</th>
|
<th class="py-2 px-4 border-b text-left">Nominal</th>
|
||||||
<th class="py-2 px-4 border-b text-left">Aksi</th>
|
<th class="py-2 px-4 border-b text-left">Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- Contoh data, ganti dengan data dinamis dari database -->
|
@foreach($gajiKaryawan as $index => $gaji)
|
||||||
<tr>
|
<tr>
|
||||||
<td class="py-2 px-4 border-b">1</td>
|
<td class="py-2 px-4 border-b">{{ $index + 1 }}</td>
|
||||||
<td class="py-2 px-4 border-b">Gaji Jack</td>
|
<td class="py-2 px-4 border-b">{{ $gaji->keterangan }}</td>
|
||||||
<td class="py-2 px-4 border-b">Rp 5.000.000</td>
|
<td class="py-2 px-4 border-b">Rp {{ number_format($gaji->gaji, 0, ',', '.') }}</td>
|
||||||
<td class="py-3 px-4 text-center">
|
<td class="py-3 px-4 text-center">
|
||||||
<div class="flex justify-center space-x-2">
|
<div class="flex justify-center space-x-2">
|
||||||
<button class="text-blue-600 hover:text-blue-800" title="Edit">
|
<button class="text-blue-600 hover:text-blue-800" title="Edit">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="text-red-600 hover:text-red-800" title="Hapus">
|
<button class="text-red-600 hover:text-red-800" title="Hapus">
|
||||||
<i class="fas fa-trash"></i>
|
<i class="fas fa-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- Tambahkan lebih banyak baris sesuai kebutuhan -->
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
@extends('Core.Sidebar')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="p-6 animate-fade-in">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="mb-4 bg-blue-600 text-white p-4 rounded-lg shadow-md">
|
||||||
|
<h1 class="text-2xl font-bold">Input Gaji Karyawan</h1>
|
||||||
|
<p class="text-sm mt-1">Formulir untuk menambahkan data Gaji Karyawan</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||||
|
<form id="GajiForm" action="{{ route('input-gaji.store') }}" method="POST" class="space-y-4">
|
||||||
|
@csrf <!-- Token CSRF untuk keamanan -->
|
||||||
|
<!-- Tanggal -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||||
|
Tanggal <span class="text-red-600">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="date"
|
||||||
|
name="Tanggal"
|
||||||
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Kategori -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||||
|
Kategori <span class="text-red-600">*</span>
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
name="kategori"
|
||||||
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="" disabled selected>Pilih Kategori Akun</option>
|
||||||
|
<optgroup label="Akun Kewajiban → Kategori untuk utang atau kewajiban perusahaan">
|
||||||
|
<option value="utang_gaji">Utang gaji</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Akun Beban → Kategori untuk biaya operasional">
|
||||||
|
<option value="beban_gaji">Beban gaji</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Nama Karyawan -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||||
|
Nama Karyawan <span class="text-red-600">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="nama_karyawan"
|
||||||
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
placeholder="Masukkan nama karyawan"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Total Gaji -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||||
|
Total Gaji <span class="text-red-600">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<span class="absolute left-3 top-2 text-gray-600">Rp</span>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="gaji"
|
||||||
|
class="w-full border rounded-lg pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
placeholder="0"
|
||||||
|
required
|
||||||
|
oninput="formatNumber(this)"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-500 mt-1">Masukkan angka tanpa tanda titik atau koma</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tombol Submit -->
|
||||||
|
<div class="flex justify-end space-x-3 pt-4">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="px-4 py-2 border rounded-lg hover:bg-gray-100 transition-colors"
|
||||||
|
onclick="window.history.back()"
|
||||||
|
>
|
||||||
|
Kembali
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SweetAlert2 -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function formatNumber(input) {
|
||||||
|
// Hapus semua karakter non-digit
|
||||||
|
let value = input.value.replace(/\D/g, '');
|
||||||
|
|
||||||
|
// Format angka dengan pemisah ribuan
|
||||||
|
if (value !== '') {
|
||||||
|
value = new Intl.NumberFormat('id-ID').format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default date to today
|
||||||
|
document.querySelector('input[type="date"]').valueAsDate = new Date();
|
||||||
|
|
||||||
|
// Menampilkan notifikasi jika ada pesan sukses atau error
|
||||||
|
@if(session('success'))
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: '{{ session('success') }}',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(session('error'))
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'error',
|
||||||
|
title: 'Gagal!',
|
||||||
|
text: '{{ session('error') }}',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Animasi fade-in saat halaman dimuat */
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-fade-in {
|
||||||
|
animation: fadeIn 0.5s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom styling untuk input date */
|
||||||
|
input[type="date"] {
|
||||||
|
appearance: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
padding-right: 2rem;
|
||||||
|
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat right 0.75rem center/1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover effects */
|
||||||
|
.form-group input:hover,
|
||||||
|
.form-group textarea:hover {
|
||||||
|
border-color: #93C5FD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Button animations */
|
||||||
|
button {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
button:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endsection
|
|
@ -18,7 +18,7 @@
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
name="tanggal"
|
name="Tanggal"
|
||||||
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
|
@ -39,27 +39,14 @@ class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:
|
||||||
<optgroup label="Akun Aset → Kategori yang mencatat kepemilikan perusahaan">
|
<optgroup label="Akun Aset → Kategori yang mencatat kepemilikan perusahaan">
|
||||||
<option value="kas">Kas</option>
|
<option value="kas">Kas</option>
|
||||||
<option value="piutang">Piutang usaha</option>
|
<option value="piutang">Piutang usaha</option>
|
||||||
<option value="persediaan">Persediaan</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
||||||
<optgroup label="Akun Kewajiban → Kategori untuk utang atau kewajiban perusahaan">
|
<optgroup label="Akun Kewajiban → Kategori untuk utang atau kewajiban perusahaan">
|
||||||
<option value="utang_usaha">Utang usaha</option>
|
<option value="utang_usaha">Utang usaha</option>
|
||||||
<option value="utang_bank">Utang bank</option>
|
<option value="utang_bank">Utang bank</option>
|
||||||
<option value="utang_gaji">Utang gaji</option>
|
|
||||||
</optgroup>
|
|
||||||
|
|
||||||
<optgroup label="Akun Ekuitas → Kategori untuk modal pemilik">
|
|
||||||
<option value="modal_pemilik">Modal pemilik</option>
|
|
||||||
<option value="laba_ditahan">Laba ditahan</option>
|
|
||||||
</optgroup>
|
|
||||||
|
|
||||||
<optgroup label="Akun Pendapatan → Kategori untuk pemasukan perusahaan">
|
|
||||||
<option value="pendapatan_penjualan">Pendapatan penjualan</option>
|
|
||||||
<option value="pendapatan_jasa">Pendapatan jasa</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
||||||
<optgroup label="Akun Beban → Kategori untuk biaya operasional">
|
<optgroup label="Akun Beban → Kategori untuk biaya operasional">
|
||||||
<option value="beban_gaji">Beban gaji</option>
|
|
||||||
<option value="beban_listrik">Beban listrik</option>
|
<option value="beban_listrik">Beban listrik</option>
|
||||||
<option value="beban_sewa">Beban sewa</option>
|
<option value="beban_sewa">Beban sewa</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
@ -88,12 +75,12 @@ class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<span class="absolute left-3 top-2 text-gray-600">Rp</span>
|
<span class="absolute left-3 top-2 text-gray-600">Rp</span>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="text"
|
||||||
name="total_uang"
|
name="uang_keluar"
|
||||||
class="w-full border rounded-lg pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full border rounded-lg pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
min="0"
|
|
||||||
required
|
required
|
||||||
|
oninput="formatNumber(this)"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs text-gray-500 mt-1">Masukkan angka tanpa tanda titik atau koma</p>
|
<p class="text-xs text-gray-500 mt-1">Masukkan angka tanpa tanda titik atau koma</p>
|
||||||
|
@ -119,26 +106,44 @@ class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- SweetAlert2 -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('uangKeluarForm').addEventListener('submit', function(e) {
|
function formatNumber(input) {
|
||||||
e.preventDefault();
|
// Hapus semua karakter non-digit
|
||||||
// Logika untuk handle submit form bisa ditambahkan di sini
|
let value = input.value.replace(/\D/g, '');
|
||||||
alert('Form submitted!');
|
|
||||||
});
|
// Format angka dengan pemisah ribuan
|
||||||
|
if (value !== '') {
|
||||||
|
value = new Intl.NumberFormat('id-ID').format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
// Set default date to today
|
// Set default date to today
|
||||||
document.querySelector('input[type="date"]').valueAsDate = new Date();
|
document.querySelector('input[type="date"]').valueAsDate = new Date();
|
||||||
|
|
||||||
// Format number input dengan pemisah ribuan
|
// Menampilkan notifikasi jika ada pesan sukses atau error
|
||||||
const uangInput = document.querySelector('input[type="number"]');
|
@if(session('success'))
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: '{{ session('success') }}',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
uangInput.addEventListener('input', function(e) {
|
@if(session('error'))
|
||||||
let value = this.value.replace(/\D/g, '');
|
Swal.fire({
|
||||||
if (value !== '') {
|
icon: 'error',
|
||||||
value = parseInt(value).toLocaleString('id-ID');
|
title: 'Gagal!',
|
||||||
}
|
text: '{{ session('error') }}',
|
||||||
this.value = value;
|
confirmButtonText: 'OK'
|
||||||
});
|
});
|
||||||
|
@endif
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
name="tanggal"
|
name="Tanggal"
|
||||||
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
|
@ -33,35 +33,21 @@ class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:
|
||||||
name="kategori"
|
name="kategori"
|
||||||
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
required
|
required
|
||||||
|
onchange="updateTotalUang(this.value)"
|
||||||
>
|
>
|
||||||
<option value="" disabled selected>Pilih Kategori Akun</option>
|
<option value="" disabled selected>Pilih Kategori Akun</option>
|
||||||
|
|
||||||
<optgroup label="Akun Aset → Kategori yang mencatat kepemilikan perusahaan">
|
<optgroup label="Akun Aset → Kategori yang mencatat kepemilikan perusahaan">
|
||||||
<option value="kas">Kas</option>
|
<option value="kas" data-kode="KAS">Kas</option>
|
||||||
<option value="piutang">Piutang usaha</option>
|
|
||||||
<option value="persediaan">Persediaan</option>
|
|
||||||
</optgroup>
|
|
||||||
|
|
||||||
<optgroup label="Akun Kewajiban → Kategori untuk utang atau kewajiban perusahaan">
|
|
||||||
<option value="utang_usaha">Utang usaha</option>
|
|
||||||
<option value="utang_bank">Utang bank</option>
|
|
||||||
<option value="utang_gaji">Utang gaji</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
||||||
<optgroup label="Akun Ekuitas → Kategori untuk modal pemilik">
|
<optgroup label="Akun Ekuitas → Kategori untuk modal pemilik">
|
||||||
<option value="modal_pemilik">Modal pemilik</option>
|
<option value="modal_pemilik" data-kode="MP">Modal pemilik</option>
|
||||||
<option value="laba_ditahan">Laba ditahan</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
||||||
<optgroup label="Akun Pendapatan → Kategori untuk pemasukan perusahaan">
|
<optgroup label="Akun Pendapatan → Kategori untuk pemasukan perusahaan">
|
||||||
<option value="pendapatan_penjualan">Pendapatan penjualan</option>
|
<option value="pendapatan_penjualan" data-kode="PP">Pendapatan penjualan</option>
|
||||||
<option value="pendapatan_jasa">Pendapatan jasa</option>
|
<option value="pendapatan_jasa" data-kode="PJ">Pendapatan jasa</option>
|
||||||
</optgroup>
|
|
||||||
|
|
||||||
<optgroup label="Akun Beban → Kategori untuk biaya operasional">
|
|
||||||
<option value="beban_gaji">Beban gaji</option>
|
|
||||||
<option value="beban_listrik">Beban listrik</option>
|
|
||||||
<option value="beban_sewa">Beban sewa</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -88,17 +74,20 @@ class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<span class="absolute left-3 top-2 text-gray-600">Rp</span>
|
<span class="absolute left-3 top-2 text-gray-600">Rp</span>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="text"
|
||||||
name="total_uang"
|
name="uang_masuk"
|
||||||
class="w-full border rounded-lg pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full border rounded-lg pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
min="0"
|
|
||||||
required
|
required
|
||||||
|
oninput="formatNumber(this)"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs text-gray-500 mt-1">Masukkan angka tanpa tanda titik atau koma</p>
|
<p class="text-xs text-gray-500 mt-1">Masukkan angka tanpa tanda titik atau koma</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Input Tersembunyi untuk Kode -->
|
||||||
|
<input type="hidden" name="kode" id="kodeInput" value="">
|
||||||
|
|
||||||
<!-- Tombol Submit -->
|
<!-- Tombol Submit -->
|
||||||
<div class="flex justify-end space-x-3 pt-4">
|
<div class="flex justify-end space-x-3 pt-4">
|
||||||
<button
|
<button
|
||||||
|
@ -119,26 +108,60 @@ class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- SweetAlert2 -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function formatNumber(input) {
|
||||||
|
// Hapus semua karakter non-digit
|
||||||
|
let value = input.value.replace(/\D/g, '');
|
||||||
|
|
||||||
|
// Format angka dengan pemisah ribuan
|
||||||
|
if (value !== '') {
|
||||||
|
value = new Intl.NumberFormat('id-ID').format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
document.getElementById('uangMasukForm').addEventListener('submit', function(e) {
|
document.getElementById('uangMasukForm').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
// Jangan prevent default agar form bisa disubmit
|
||||||
// Logika untuk handle submit form bisa ditambahkan di sini
|
const uangMasukInput = document.querySelector('input[name="uang_masuk"]');
|
||||||
alert('Form submitted!');
|
// Biarkan nilai dengan format untuk diproses di controller
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set default date to today
|
// Set default date to today
|
||||||
document.querySelector('input[type="date"]').valueAsDate = new Date();
|
document.querySelector('input[type="date"]').valueAsDate = new Date();
|
||||||
|
|
||||||
// Format number input dengan pemisah ribuan
|
// Menampilkan notifikasi jika ada pesan sukses atau error
|
||||||
const uangInput = document.querySelector('input[type="number"]');
|
@if(session('success'))
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: '{{ session('success') }}',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
uangInput.addEventListener('input', function(e) {
|
@if(session('error'))
|
||||||
let value = this.value.replace(/\D/g, '');
|
Swal.fire({
|
||||||
if (value !== '') {
|
icon: 'error',
|
||||||
value = parseInt(value).toLocaleString('id-ID');
|
title: 'Gagal!',
|
||||||
|
text: '{{ session('error') }}',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
|
function updateTotalUang(kategori) {
|
||||||
|
const kodeInput = document.getElementById('kodeInput');
|
||||||
|
const selectedOption = document.querySelector(`select[name="kategori"] option:checked`);
|
||||||
|
|
||||||
|
if (selectedOption) {
|
||||||
|
kodeInput.value = selectedOption.getAttribute('data-kode'); // Ini tidak lagi digunakan, karena kode dihasilkan di server
|
||||||
}
|
}
|
||||||
this.value = value;
|
}
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
use App\Http\Controllers\SidebarController;
|
use App\Http\Controllers\SidebarController;
|
||||||
use App\Http\Controllers\UangMasukController;
|
use App\Http\Controllers\UangMasukController;
|
||||||
use App\Http\Controllers\UangKeluarController;
|
use App\Http\Controllers\UangKeluarController;
|
||||||
|
use App\Http\Controllers\InputGajiController;
|
||||||
use App\Http\Controllers\GajiController;
|
use App\Http\Controllers\GajiController;
|
||||||
use App\Http\Controllers\HomeController;
|
use App\Http\Controllers\HomeController;
|
||||||
use App\Http\Controllers\LaporanController;
|
use App\Http\Controllers\LaporanController;
|
||||||
|
@ -29,7 +30,9 @@
|
||||||
Route::get('/uang-masuk', [UangMasukController::class, 'index'])->name('uang-masuk.index');
|
Route::get('/uang-masuk', [UangMasukController::class, 'index'])->name('uang-masuk.index');
|
||||||
Route::post('/uang-masuk', [UangMasukController::class, 'store'])->name('uangmasuk.store');
|
Route::post('/uang-masuk', [UangMasukController::class, 'store'])->name('uangmasuk.store');
|
||||||
Route::get('/uang-keluar', [UangKeluarController::class, 'index'])->name('uang-keluar.index');
|
Route::get('/uang-keluar', [UangKeluarController::class, 'index'])->name('uang-keluar.index');
|
||||||
Route::post('/uang-keluar', [UangMasukController::class, 'store'])->name('uangkeluar.store');
|
Route::post('/uang-keluar', [UangKeluarController::class, 'store'])->name('uangkeluar.store');
|
||||||
|
Route::get('/input-gaji', [InputGajiController::class, 'index'])->name('input-gaji.index');
|
||||||
|
Route::post('/input-gaji', [InputGajiController::class, 'store'])->name('input-gaji.store');
|
||||||
|
|
||||||
//untuk Uang Gaji
|
//untuk Uang Gaji
|
||||||
Route::get('/gaji', [GajiController::class, 'index'])->name('gaji.index');
|
Route::get('/gaji', [GajiController::class, 'index'])->name('gaji.index');
|
||||||
|
|
Loading…
Reference in New Issue