Browse Source

update id tambahan untuk transfer dan disposal

master
Gunawan19621 1 year ago
parent
commit
253997dfa4
  1. 10
      app/Http/Controllers/TransferController.php
  2. 24
      app/Http/Requests/Transfer/ValidasiCreateTransfer.php
  3. 24
      app/Http/Requests/Transfer/ValidasiUpdateTransfer.php
  4. 2
      app/Models/Transfer.php
  5. 2
      resources/views/dashboard/History/Pengembalian/index.blade.php

10
app/Http/Controllers/TransferController.php

@ -30,15 +30,6 @@ class TransferController extends Controller
return view('dashboard.Transfer.index', $data); return view('dashboard.Transfer.index', $data);
} }
// public function index()
// {
// $data = [
// 'transfer' => Transfer::orderBy('created_at', 'desc')->get(),
// 'active' => 'menu-transfer',
// ];
// return view('dashboard.Transfer.index', $data);
// }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*/ */
@ -59,6 +50,7 @@ class TransferController extends Controller
*/ */
public function store(ValidasiCreateTransfer $request) public function store(ValidasiCreateTransfer $request)
{ {
// dd($request);
try { try {
// Mendapatkan informasi pengguna yang sedang login // Mendapatkan informasi pengguna yang sedang login
$currentUser = Auth::user(); $currentUser = Auth::user();

24
app/Http/Requests/Transfer/ValidasiCreateTransfer.php

@ -22,11 +22,25 @@ class ValidasiCreateTransfer extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ return [
'peti_id' => 'nullable', // Optional, peti_id harus ada di tabel petis 'peti_id' => 'required', // Required, peti_id harus ada di tabel petis
'source_warehouse' => 'nullable', // Optional, source_warehouse harus ada di tabel m_warehouses 'source_warehouse' => 'required', // Optional, source_warehouse harus ada di tabel m_warehouses
'destination_warehouse' => 'nullable', // Optional, destination_warehouse harus ada di tabel m_warehouses 'destination_warehouse' => 'required', // Optional, destination_warehouse harus ada di tabel m_warehouses
'name_customer' => 'nullable', // Optional, name_customer harus ada di tabel customers 'name_customer' => 'required', // Optional, name_customer harus ada di tabel customers
'date' => 'nullable', // Optional, harus berupa tanggal 'date' => 'required', // Optional, harus berupa tanggal
];
}
/**
* Get the error messages for the defined validation rules.
*/
public function messages(): array
{
return [
'peti_id.required' => 'Peti harus diisi',
'source_warehouse.required' => 'Source Warehouse harus diisi',
'destination_warehouse.required' => 'Destination Warehouse harus diisi',
'name_customer.required' => 'Nama Customer harus diisi',
'date.required' => 'Tanggal harus diisi',
]; ];
} }
} }

24
app/Http/Requests/Transfer/ValidasiUpdateTransfer.php

@ -22,11 +22,25 @@ class ValidasiUpdateTransfer extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ return [
'peti_id' => 'nullable', // Optional, peti_id harus ada di tabel petis 'peti_id' => 'required', // Required, peti_id harus ada di tabel petis
'source_warehouse' => 'nullable', // Optional, source_warehouse harus ada di tabel m_warehouses 'source_warehouse' => 'required', // Optional, source_warehouse harus ada di tabel m_warehouses
'destination_warehouse' => 'nullable', // Optional, destination_warehouse harus ada di tabel m_warehouses 'destination_warehouse' => 'required', // Optional, destination_warehouse harus ada di tabel m_warehouses
'name_customer' => 'nullable', // Optional, name_customer harus ada di tabel customers 'name_customer' => 'required', // Optional, name_customer harus ada di tabel customers
'date' => 'nullable', // Optional, harus berupa tanggal 'date' => 'required', // Optional, harus berupa tanggal
];
}
/**
* Get the error messages for the defined validation rules.
*/
public function messages(): array
{
return [
'peti_id.required' => 'Peti harus diisi',
'source_warehouse.required' => 'Source Warehouse harus diisi',
'destination_warehouse.required' => 'Destination Warehouse harus diisi',
'name_customer.required' => 'Nama Customer harus diisi',
'date.required' => 'Tanggal harus diisi',
]; ];
} }
} }

2
app/Models/Transfer.php

@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Transfer extends Model class Transfer extends Model
{ {
use HasFactory, SoftDeletes, UUID; use HasFactory, SoftDeletes;
protected $table = 'transfers'; protected $table = 'transfers';
protected $fillable = [ protected $fillable = [

2
resources/views/dashboard/History/Pengembalian/index.blade.php

@ -74,7 +74,7 @@
</td> </td>
<td> <td>
@if ($data->kondisi_peti) @if ($data->kondisi_peti)
{{ $data->kondisi_peti }} {{ $data->kondisi_peti->nama_kondisi }}
@else @else
<p class="text-center font-weight-bold">-</p> <p class="text-center font-weight-bold">-</p>
@endif @endif

Loading…
Cancel
Save