Gunawan19621
1 year ago
17 changed files with 841 additions and 82 deletions
@ -0,0 +1,92 @@
|
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use App\Models\BarangKeluar; |
||||
use App\Models\m_asset; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class BarangKeluarController extends Controller |
||||
{ |
||||
/** |
||||
* Display a listing of the resource. |
||||
*/ |
||||
public function index() |
||||
{ |
||||
$Bkeluar = BarangKeluar::all(); |
||||
$asset = m_asset::all(); |
||||
return view('dashboard.transaksi.barang_keluar', compact('Bkeluar', 'asset')); |
||||
} |
||||
|
||||
/** |
||||
* Show the form for creating a new resource. |
||||
*/ |
||||
public function create() |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Store a newly created resource in storage. |
||||
*/ |
||||
public function store(Request $request) |
||||
{ |
||||
// dd('masuk'); |
||||
$request->validate([ |
||||
'asset_id' => 'required', |
||||
'jumlah' => 'required', |
||||
'tanggal_keluar' => 'required', |
||||
'penerima_barang' => 'required', |
||||
'exit_warehouse' => 'required', |
||||
'keterangan' => 'required', |
||||
]); |
||||
// dd($request); |
||||
try { |
||||
$validatedData = $request->except('_token'); |
||||
// dd($validatedData); |
||||
BarangKeluar::create($validatedData); |
||||
return redirect()->back()->with('success', 'Data barang keluar berhasil ditambah.'); |
||||
} catch (\Throwable $th) { |
||||
return redirect()->back()->with('error', 'Data barang keluar gagal ditambah.'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Display the specified resource. |
||||
*/ |
||||
public function show($barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Show the form for editing the specified resource. |
||||
*/ |
||||
public function edit($barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Update the specified resource in storage. |
||||
*/ |
||||
public function update(Request $request, $barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Remove the specified resource from storage. |
||||
*/ |
||||
public function destroy($id) |
||||
{ |
||||
// dd("oke"); |
||||
try { |
||||
$asset = BarangKeluar::findOrFail($id); |
||||
$asset->delete(); |
||||
return redirect()->back()->with('success', 'Data Barang Keluar berhasil dihapus'); |
||||
} catch (\Throwable $th) { |
||||
return redirect()->back()->with('error', 'Data Barang Keluar gagal dihapus'); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use App\Models\BarangMasuk; |
||||
use App\Http\Requests\UpdateBarang_masukRequest; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class BarangMasukController extends Controller |
||||
{ |
||||
/** |
||||
* Display a listing of the resource. |
||||
*/ |
||||
public function index() |
||||
{ |
||||
return view('dashboard.transaksi.barang_masuk'); |
||||
} |
||||
|
||||
/** |
||||
* Show the form for creating a new resource. |
||||
*/ |
||||
public function create() |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Store a newly created resource in storage. |
||||
*/ |
||||
public function store(Request $request) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Display the specified resource. |
||||
*/ |
||||
public function show(BarangMasuk $barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Show the form for editing the specified resource. |
||||
*/ |
||||
public function edit(BarangMasuk $barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Update the specified resource in storage. |
||||
*/ |
||||
public function update(Request $request, BarangMasuk $barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Remove the specified resource from storage. |
||||
*/ |
||||
public function destroy(BarangMasuk $barang_masuk) |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class BarangKeluar extends Model |
||||
{ |
||||
use HasFactory; |
||||
protected $table = 'barang_keluars', $guarded = ['id']; |
||||
|
||||
public function asset() |
||||
{ |
||||
return $this->belongsTo(m_asset::class, 'asset_id'); |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class BarangMasuk extends Model |
||||
{ |
||||
use HasFactory; |
||||
} |
@ -0,0 +1,36 @@
|
||||
<?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('barang_masuks', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->bigInteger('asset_id')->unsigned(); |
||||
$table->foreign('asset_id')->references('id')->on('m_assets'); |
||||
$table->integer('jumlah'); // Kolom untuk jumlah barang masuk |
||||
$table->date('tanggal_masuk'); // Kolom untuk tanggal barang masuk |
||||
$table->string('asal_barang', 200); // Kolom untuk PIC barang masuk |
||||
$table->string('pengirim_barang', 200); // Kolom untuk PIC barang masuk |
||||
$table->string('penerima_barang', 200); // Kolom untuk PIC barang masuk |
||||
$table->string('enter_warehouse', 200)->nullable(); |
||||
$table->string('keterangan')->nullable(); // Kolom untuk keterangan (opsional) |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('barang_masuks'); |
||||
} |
||||
}; |
@ -0,0 +1,34 @@
|
||||
<?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('barang_keluars', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->bigInteger('asset_id')->unsigned(); |
||||
$table->foreign('asset_id')->references('id')->on('m_assets'); |
||||
$table->integer('jumlah'); // Kolom untuk jumlah barang masuk |
||||
$table->date('tanggal_keluar'); // Kolom untuk tanggal barang masuk |
||||
$table->string('penerima_barang', 200); // Kolom untuk PIC barang masuk |
||||
$table->string('exit_warehouse', 200)->nullable(); |
||||
$table->string('keterangan')->nullable(); // Kolom untuk keterangan (opsional) |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('barang_keluars'); |
||||
} |
||||
}; |
After Width: | Height: | Size: 393 KiB |
@ -0,0 +1,248 @@
|
||||
@extends('layouts.main') |
||||
@section('title', 'Barang Keluar') |
||||
@section('content') |
||||
<div class="container-fluid"> |
||||
<h1 class="h3 mb-2 text-gray-800">Tabel Barang Keluar</h1> |
||||
<div class="mb-4"> |
||||
<p>Our Outgoing Item Tables are enhanced with the help of the DataTables plugin. This is a powerful tool that |
||||
allows you to explore outgoing data in a more interactive and efficient way.</p> |
||||
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal"> |
||||
<span class="text">+ Tambah data</span> |
||||
</a> |
||||
</div> |
||||
<div class="card shadow mb-4"> |
||||
<div class="card-header py-3"> |
||||
<div class="row"> |
||||
<div class="col-6"> |
||||
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Barang Keluar</h5> |
||||
</div> |
||||
{{-- <div class="col-6 text-right"> |
||||
<a href="{{ route('assetcetakpdf.cetakpdf') }}" class="btn btn-success btn-icon-split ml-auto" |
||||
target="_blank"> |
||||
<span class="text">Cetak PDF</span> |
||||
</a> |
||||
<a href="{{ route('assetexport.export') }}" class="btn btn-info btn-icon-split ml-auto" |
||||
target="_blank"> |
||||
<span class="text">Cetak Exel</span> |
||||
</a> |
||||
</div> --}} |
||||
</div> |
||||
</div> |
||||
<div class="card-body"> |
||||
<div class="table-responsive"> |
||||
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0"> |
||||
<thead> |
||||
<tr> |
||||
<th>Nama Barang</th> |
||||
<th>Jumlah</th> |
||||
<th>Tgl Keluar</th> |
||||
<th>Penerima</th> |
||||
<th>Asal Gudang</th> |
||||
<th>Keterangan</th> |
||||
<th class="text-center">Action</th> |
||||
</tr> |
||||
</thead> |
||||
<tfoot> |
||||
<tr> |
||||
<th>Nama Barang</th> |
||||
<th>Jumlah</th> |
||||
<th>Tgl Keluar</th> |
||||
<th>Penerima</th> |
||||
<th>Asal Gudang</th> |
||||
<th>Keterangan</th> |
||||
<th class="text-center">Action</th> |
||||
</tr> |
||||
</tfoot> |
||||
<tbody> |
||||
@foreach ($Bkeluar as $data) |
||||
<tr> |
||||
<td>{{ $data->asset->name }}</td> |
||||
<td>{{ $data->jumlah }}</td> |
||||
<td>{{ \Carbon\Carbon::parse($data->tanggal_keluar)->format('d-m-Y') }}</td> |
||||
<td>{{ $data->penerima_barang }}</td> |
||||
<td>{{ $data->exit_warehouse }}</td> |
||||
<td>{{ $data->keterangan }}</td> |
||||
<td class="text-center"> |
||||
<a href="#" data-toggle="modal" |
||||
data-target="#editDataModal{{ $data['id'] }}"> |
||||
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> |
||||
</a> |
||||
<a href="{{ route('hapusBarangK.destroy', $data->id) }}" |
||||
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')"> |
||||
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
@endforeach |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- Modal Tambah Asset--> |
||||
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" |
||||
aria-hidden="true"> |
||||
<div class="modal-dialog" role="document"> |
||||
<div class="modal-content"> |
||||
<div class="modal-header"> |
||||
<h5 class="modal-title" id="exampleModalLabel">Tambah Data</h5> |
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
||||
<span aria-hidden="true">×</span> |
||||
</button> |
||||
</div> |
||||
<div class="modal-body"> |
||||
{{-- <form action="{{ route('asset.store') }}" method="POST" enctype="multipart/form-data"> --}} |
||||
<form action="{{ route('barangKeluar.store') }}" method="POST" enctype="multipart/form-data"> |
||||
@csrf |
||||
<div class="form-group"> |
||||
<label for="asset_id" class="col-form-label">Nama Barang:</label> |
||||
<select class="form-control" name="asset_id" type="text" id="asset_id"> |
||||
<option disabled selected>Pilih Nama Barang</option> |
||||
@foreach ($asset as $data) |
||||
<option value="{{ $data->id }}">{{ $data->name }}</option> |
||||
@endforeach |
||||
</select> |
||||
|
||||
<label for="jumlah" class="col-form-label">Jumlah Barang:</label> |
||||
<input class="form-control" name="jumlah" type="number" id="jumlah" |
||||
value="{{ old('jumlah') }}" placeholder="Masukkan Jumlah Barang" required> |
||||
|
||||
<label for="tanggal_keluar" class="col-form-label">Tgl Keluar:</label> |
||||
<input class="form-control" name="tanggal_keluar" type="date" id="tanggal_keluar" |
||||
value="{{ old('tanggal_keluar') }}" placeholder="Masukkan Tgl Keluar Barang" required> |
||||
|
||||
<label for="penerima_barang" class="col-form-label">Pererima:</label> |
||||
<input class="form-control" name="penerima_barang" type="text" id="penerima_barang" |
||||
value="{{ old('penerima_barang') }}" placeholder="Masukkan Penerima Barang" required> |
||||
|
||||
<label for="exit_warehouse" class="col-form-label">Asal Gudang:</label> |
||||
<input class="form-control" name="exit_warehouse" type="text" id="exit_warehouse" |
||||
value="{{ old('exit_warehouse') }}" placeholder="Masukan Asal Gudang Barang" required> |
||||
|
||||
<label for="keterangan" class="col-form-label">Keterangan:</label> |
||||
<textarea class="form-control" name="keterangan" id="keterangan" placeholder="Masukkan Keterangan Barang" required>{{ old('keterangan') }}</textarea> |
||||
</div> |
||||
<div class="modal-footer"> |
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button> |
||||
<button type="submit" class="btn btn-primary">Simpan</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- Modal Edit Asset--> |
||||
@foreach ($Bkeluar as $data) |
||||
<div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog" |
||||
aria-labelledby="exampleModalLabel" aria-hidden="true"> |
||||
<div class="modal-dialog" role="document"> |
||||
<div class="modal-content"> |
||||
<div class="modal-header"> |
||||
<h5 class="modal-title" id="exampleModalLabel">Edit Data</h5> |
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
||||
<span aria-hidden="true">×</span> |
||||
</button> |
||||
</div> |
||||
<div class="modal-body"> |
||||
<form action="#" method="POST" enctype="multipart/form-data"> |
||||
@csrf |
||||
@method('PUT') |
||||
<div class="form-group"> |
||||
<label for="asset_id" class="col-form-label">Nama Barang:</label> |
||||
<select class="form-control" name="asset_id" type="text" id="asset_id"> |
||||
<option disabled selected>Pilih Nama Barang</option> |
||||
@foreach ($asset as $data_asset) |
||||
<option value="{{ $data->id }}" |
||||
@if ($data_asset->id == $data->asset_id) selected |
||||
@else @endif> |
||||
{{ $data_asset->name }}</option> |
||||
@endforeach |
||||
</select> |
||||
|
||||
<label for="jumlah" class="col-form-label">Jumlah Barang:</label> |
||||
<input class="form-control" name="jumlah" type="number" id="jumlah" |
||||
value="{{ $data->jumlah }}" placeholder="Masukkan Jumlah Barang" required> |
||||
|
||||
<label for="tanggal_keluar" class="col-form-label">Tgl Keluar:</label> |
||||
<input class="form-control" name="tanggal_keluar" type="date" id="tanggal_keluar" |
||||
value="{{ \Carbon\Carbon::parse($data->tanggal_keluar)->format('Y-m-d') }}" |
||||
placeholder="Masukkan Tgl Keluar Barang" required> |
||||
|
||||
<label for="penerima_barang" class="col-form-label">Pererima:</label> |
||||
<input class="form-control" name="penerima_barang" type="text" id="penerima_barang" |
||||
value="{{ $data->penerima_barang }}" placeholder="Masukkan Penerima Barang" required> |
||||
|
||||
<label for="exit_warehouse" class="col-form-label">Asal Gudang:</label> |
||||
<input class="form-control" name="exit_warehouse" type="text" id="exit_warehouse" |
||||
value="{{ $data->exit_warehouse }}" placeholder="Masukan Asal Gudang Barang" |
||||
required> |
||||
|
||||
<label for="keterangan" class="col-form-label">Keterangan:</label> |
||||
<textarea class="form-control" name="keterangan" id="keterangan" placeholder="Masukkan Keterangan Barang" required>{{ $data->keterangan }}</textarea> |
||||
</div> |
||||
<div class="modal-footer"> |
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button> |
||||
<button type="submit" class="btn btn-primary">Simpan</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{{-- <div class="modal-dialog" role="document"> |
||||
<div class="modal-content"> |
||||
<div class="modal-header"> |
||||
<h5 class="modal-title" id="exampleModalLabel">Edit Data Asset</h5> |
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
||||
<span aria-hidden="true">×</span> |
||||
</button> |
||||
</div> |
||||
<div class="modal-body"> |
||||
<form action="{{ route('asset.update', $data->id) }}" method="POST" |
||||
enctype="multipart/form-data"> |
||||
@csrf |
||||
@method('PUT') |
||||
<div class="form-group"> |
||||
<label for="name" class="col-form-label">Nama Asset:</label> |
||||
<input class="form-control" name="name" type="text" id="name" |
||||
value="{{ $data->name }}" placeholder="Masukan Nama Asset" required> |
||||
|
||||
<label for="description" class="col-form-label">Deskripsi Asset:</label> |
||||
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Asset" required>{{ $data->description }}</textarea> |
||||
|
||||
<label for="qr_count" class="col-form-label">QR_Count:</label> |
||||
<input class="form-control" name="qr_count" type="text" id="qr_count" |
||||
value="{{ $data->qr_count }}" placeholder="Masukan Kode QR" |
||||
onkeypress="return event.charCode >= 48 && event.charCode <= 57" required> |
||||
|
||||
<label for="date" class="col-form-label">Tanggal:</label> |
||||
<input class="form-control" name="date" type="date" id="date" |
||||
value="{{ \Carbon\Carbon::parse($data->date)->format('Y-m-d') }}" |
||||
placeholder="Masukan Tanggal Asset" required> |
||||
|
||||
<label for="warehouse_id" class="col-form-label">Gudang:</label> |
||||
<select class="form-control" name="warehouse_id" id="warehouse_id"> |
||||
<option disabled selected>Pilih Asal Gudang</option> |
||||
@foreach ($warehouse as $data_warehouse) |
||||
<option value="{{ $data_warehouse->id }}" |
||||
@if ($data_warehouse->id == $data->warehouse_id) selected |
||||
@else @endif> |
||||
{{ $data_warehouse->name }}</option> |
||||
@endforeach |
||||
</select> |
||||
|
||||
</div> |
||||
<div class="modal-footer"> |
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button> |
||||
<button type="submit" class="btn btn-primary">Simpan</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> --}} |
||||
</div> |
||||
@endforeach |
||||
@endsection |
@ -0,0 +1,5 @@
|
||||
@extends('layouts.main') |
||||
@section('title', 'Barang Masuk') |
||||
@section('content') |
||||
<p>Halaman Barang Masuk</p> |
||||
@endsection |
Loading…
Reference in new issue