Browse Source

update master kondisi peti

master
Gunawan19621 1 year ago
parent
commit
fbd61aef05
  1. 15
      app/Http/Controllers/CustomerController.php
  2. 51
      app/Http/Controllers/KondisiPetiController.php
  3. 5
      app/Http/Controllers/PetiController.php
  4. 39
      app/Http/Requests/ValidasiCreateKondisiPeti.php
  5. 39
      app/Http/Requests/ValidasiUpdateKondisiPeti.php
  6. 28
      app/Imports/CustomerImport.php
  7. 13
      app/Models/Kondisi_Peti.php
  8. 9
      app/Models/Peti.php
  9. 9
      database/migrations/2023_11_06_022213_create_kondisi_petis_table.php
  10. 4
      database/migrations/2023_11_06_085238_create_petis_table.php
  11. 0
      database/migrations/2023_11_06_122033_create_asset_statuses_table.php
  12. 1
      database/seeders/DatabaseSeeder.php
  13. 32
      database/seeders/Kondisi_PetiSeeder.php
  14. 1
      public/assets/file/Format Import Customer.csv
  15. 42
      resources/views/dashboard/Master_Data/Customer/index.blade.php
  16. 59
      resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php
  17. 11
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php
  18. 14
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/edit.blade.php
  19. 4
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php
  20. 4
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/show.blade.php
  21. 2
      routes/web.php

15
app/Http/Controllers/CustomerController.php

@ -2,11 +2,13 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\ValidasiCreateCustomer;
use App\Http\Requests\ValidasiUpdateCustomer;
use App\Models\Customer; use App\Models\Customer;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Imports\CustomerImport;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Requests\ValidasiCreateCustomer;
use App\Http\Requests\ValidasiUpdateCustomer;
class CustomerController extends Controller class CustomerController extends Controller
{ {
@ -108,4 +110,13 @@ class CustomerController extends Controller
return redirect()->back()->with('error', 'Data customer gagal dihapus'); return redirect()->back()->with('error', 'Data customer gagal dihapus');
} }
} }
public function importCustomer(Request $request)
{
// dd('oke');
//melakukan import file
Excel::import(new CustomerImport, request()->file('file'));
return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil Di Import');
}
} }

51
app/Http/Controllers/KondisiPetiController.php

@ -3,14 +3,65 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Requests\ValidasiCreateKondisiPeti;
use App\Http\Requests\ValidasiUpdateKondisiPeti;
use App\Models\Kondisi_Peti;
class KondisiPetiController extends Controller class KondisiPetiController extends Controller
{ {
public function index() public function index()
{ {
$data = [ $data = [
'kondisiPeti' => Kondisi_Peti::all(),
'active' => 'menu-kondisipeti' 'active' => 'menu-kondisipeti'
]; ];
return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data); return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data);
} }
public function store(ValidasiCreateKondisiPeti $request)
{
// dd('oke');
// dd($request);
try {
$currentUser = Auth::user();
$validatedData = $request->except('_token');
$validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by
$validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by
// dd($validatedData);
Kondisi_Peti::create($validatedData);
return redirect()->back()->with('success', 'Data Kondisi Peti Berhasil Ditambah.');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data Kondisi Peti Gagal Ditambah.');
}
}
public function update(ValidasiUpdateKondisiPeti $request, $id)
{
try {
$currentUser = Auth::user();
$kondisiPeti = Kondisi_Peti::findOrFail($id);
$validatedData = $request->except('_token');
$validatedData['updated_by'] = $currentUser->fullname;
$kondisiPeti->update($validatedData);
return redirect()->back()->with('success', 'Data Kondisi Peti Berhasil Diperbarui.');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data Kondisi Peti Gagal Diperbarui.');
}
}
public function destroy($id)
{
// dd("oke");
try {
$kondisiPeti = Kondisi_Peti::findOrFail($id);
$kondisiPeti->delete();
return redirect()->back()->with('success', 'Data kondisi peti berhasil dihapus');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data kondisi peti gagal dihapus');
}
}
} }

5
app/Http/Controllers/PetiController.php

@ -9,6 +9,7 @@ use Dompdf\Options;
use App\Models\Peti; use App\Models\Peti;
use App\Models\Customer; use App\Models\Customer;
use App\Models\Type_peti; use App\Models\Type_peti;
use App\Models\Kondisi_Peti;
use Mockery\Matcher\Type; use Mockery\Matcher\Type;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -23,6 +24,7 @@ class PetiController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'kondisiPeti' => Kondisi_Peti::all(),
'peti' => Peti::all(), 'peti' => Peti::all(),
'active' => 'menu-peti', 'active' => 'menu-peti',
]; ];
@ -35,6 +37,7 @@ class PetiController extends Controller
public function create() public function create()
{ {
$data = [ $data = [
'kondisiPeti' => Kondisi_Peti::get(),
'typepeti' => Type_peti::all(), 'typepeti' => Type_peti::all(),
'customer' => Customer::all(), 'customer' => Customer::all(),
'warehouse' => m_warehouse::all(), 'warehouse' => m_warehouse::all(),
@ -48,6 +51,7 @@ class PetiController extends Controller
*/ */
public function store(ValidasiCreatePeti $request) public function store(ValidasiCreatePeti $request)
{ {
// dd($request->all());
try { try {
$currenttype = Auth::user(); $currenttype = Auth::user();
@ -109,6 +113,7 @@ class PetiController extends Controller
public function edit($id) public function edit($id)
{ {
$data = [ $data = [
'kondisiPeti' => Kondisi_Peti::get(),
'peti' => Peti::findOrFail($id), 'peti' => Peti::findOrFail($id),
'typepeti' => Type_peti::all(), 'typepeti' => Type_peti::all(),
'customer' => Customer::all(), 'customer' => Customer::all(),

39
app/Http/Requests/ValidasiCreateKondisiPeti.php

@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiCreateKondisiPeti 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 [
'nama_kondisi' => 'required|string',
'deskripsi_kondisi' => 'required|string',
];
}
public function messages()
{
return [
'name.required' => 'Nama Kondisi harus diisi',
'name.string' => 'Nama Kondisi harus berupa string',
'description.required' => 'Deskripsi Kondisi harus diisi',
'description.string' => 'Deskripsi Kondisi harus berupa string',
];
}
}

39
app/Http/Requests/ValidasiUpdateKondisiPeti.php

@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ValidasiUpdateKondisiPeti 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 [
'nama_kondisi' => 'required|string',
'deskripsi_kondisi' => 'required|string',
];
}
public function messages()
{
return [
'name.required' => 'Nama Kondisi harus diisi',
'name.string' => 'Nama Kondisi harus berupa string',
'description.required' => 'Deskripsi Kondisi harus diisi',
'description.string' => 'Deskripsi Kondisi harus berupa string',
];
}
}

28
app/Imports/CustomerImport.php

@ -0,0 +1,28 @@
<?php
namespace App\Imports;
use App\Models\Customer;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class CustomerImport implements ToModel, WithHeadingRow
{
/**
* @param array $row
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function model(array $row)
{
return new Customer([
'name' => $row['name'],
'code_customer' => $row['code_customer'],
'lot_no' => $row['lot_no'],
'no_tlp' => $row['no_tlp'],
'email' => $row['email'],
'address' => $row['address'],
]);
}
}

13
app/Models/Kondisi_Peti.php

@ -2,10 +2,19 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Kondisi_Peti extends Model class Kondisi_Peti extends Model
{ {
use HasFactory; use HasFactory, SoftDeletes;
protected $table = 'kondisi_petis';
protected $fillable = [
'nama_kondisi',
'deskripsi_kondisi',
'created_by',
'updated_by',
];
} }

9
app/Models/Peti.php

@ -2,6 +2,9 @@
namespace App\Models; namespace App\Models;
use App\Models\Customer;
use App\Models\Type_peti;
use App\Models\Kondisi_Peti;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -18,7 +21,7 @@ class Peti extends Model
'warehouse_id', 'warehouse_id',
'jumlah', 'jumlah',
'date_pembuatan', 'date_pembuatan',
'status_disposal', 'kondisipeti_id',
'packing_no', 'packing_no',
'fix_lot', 'fix_lot',
'created_by', 'created_by',
@ -37,4 +40,8 @@ class Peti extends Model
{ {
return $this->belongsTo(Type_peti::class, 'tipe_peti_id')->select('id', 'type', 'size_peti', 'description'); return $this->belongsTo(Type_peti::class, 'tipe_peti_id')->select('id', 'type', 'size_peti', 'description');
} }
public function kondisipeti()
{
return $this->belongsTo(Kondisi_Peti::class, 'kondisipeti_id')->select('id', 'nama_kondisi', 'deskripsi_kondisi');
}
} }

9
database/migrations/2023_11_06_022213_create_kondisi__petis_table.php → database/migrations/2023_11_06_022213_create_kondisi_petis_table.php

@ -11,9 +11,14 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('kondisi__petis', function (Blueprint $table) { Schema::create('kondisi_petis', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('nama_kondisi', 50);
$table->text('deskripsi_kondisi');
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
}); });
} }
@ -22,6 +27,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('kondisi__petis'); Schema::dropIfExists('kondisi_petis');
} }
}; };

4
database/migrations/2023_10_28_085238_create_petis_table.php → database/migrations/2023_11_06_085238_create_petis_table.php

@ -24,7 +24,9 @@ return new class extends Migration
$table->date('date_pembuatan', 100)->nullable(); $table->date('date_pembuatan', 100)->nullable();
$table->unsignedBigInteger('warehouse_id')->nullable(); $table->unsignedBigInteger('warehouse_id')->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->string('status_disposal')->nullable(); $table->unsignedBigInteger('kondisipeti_id')->nullable();
$table->foreign('kondisipeti_id')->references('id')->on('kondisi_petis')->onDelete('set null');
// $table->string('status_disposal')->nullable();
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

0
database/migrations/2023_10_29_122033_create_asset_statuses_table.php → database/migrations/2023_11_06_122033_create_asset_statuses_table.php

1
database/seeders/DatabaseSeeder.php

@ -26,6 +26,7 @@ class DatabaseSeeder extends Seeder
UserSeeder::class, UserSeeder::class,
Type_Peti::class, Type_Peti::class,
Customer::class, Customer::class,
Kondisi_PetiSeeder::class,
]); ]);
} }
} }

32
database/seeders/Kondisi_PetiSeeder.php

@ -0,0 +1,32 @@
<?php
namespace Database\Seeders;
use App\Models\Kondisi_Peti;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class Kondisi_PetiSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Kondisi peti Rusak
Kondisi_Peti::create([
'nama_kondisi' => 'Rusak',
'deskripsi_kondisi' => 'Barang Rusak',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Kondisi peti Baik
Kondisi_Peti::create([
'nama_kondisi' => 'Ready',
'deskripsi_kondisi' => 'Barang Siap Bawa',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
}
}

1
public/assets/file/Format Import Customer.csv

@ -0,0 +1 @@
name,code_customer,lot_no,no_tlp,email,address
1 name code_customer lot_no no_tlp email address

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

@ -12,6 +12,10 @@
<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">
<span class="text">+ Tambah data</span> <span class="text">+ Tambah data</span>
</a> </a>
<a href="#" class="btn btn-info btn-icon-split" data-toggle="modal"
data-target="#importDataModal">
<span class="text">Import Customer</span>
</a>
</div> </div>
</div> </div>
</div> </div>
@ -69,4 +73,42 @@
@else @else
@include('pages.user.Master_Data.Customer.index') @include('pages.user.Master_Data.Customer.index')
@endif @endif
<!-- Tambah Data Modal-->
<div class="modal fade" id="importDataModal" 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">Import Data Customer</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('dashboard.customer.import') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
<div class="form-group">
<label for="name" class="col-form-label">File Import Customer:</label>
<input type="file" name="file" class="form-control" accept=".xlsx, .xls, .csv"
required>
<small class="text-muted">Pilih file Excel (.xlsx, .xls) atau CSV (.csv) untuk
diimpor.</small>
</div>
<!-- Tombol untuk mengunduh file -->
<div class="form-group">
<a href="{{ asset('assets/file/Format Import Customer.csv') }}" class="btn btn-primary"
download>Unduh Format Customer</a>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection @endsection

59
resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php

@ -26,23 +26,20 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{-- @php @php
$notype = 1; $nokondisi = 1;
@endphp @endphp
@forelse ($typepeti as $data_typepeti) @forelse ($kondisiPeti as $data_kondisiPeti)
<tr> <tr>
<td class="text-center">{{ $notype++ }}</td> <td class="text-center">{{ $nokondisi++ }}</td>
<td>{{ $data_typepeti->type }}</td> <td>{{ $data_kondisiPeti->nama_kondisi }}</td>
<td>{{ $data_typepeti->size_peti }}</td> <td>{{ $data_kondisiPeti->deskripsi_kondisi }}</td>
<td>{{ $data_typepeti->description }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.typepeti.show', [$data_typepeti->id]) }}"> <a href="#" data-toggle="modal"
<i class="fa fa-eye mr-2" style="font-size: 20px"></i> data-target="#editDataModal{{ $data_kondisiPeti->id }}">
</a>
<a href="{{ route('dashboard.typepeti.edit', [$data_typepeti->id]) }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> <i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a> </a>
<form action="{{ route('dashboard.typepeti.destroy', $data_typepeti->id) }}" <form action="{{ route('dashboard.kondisipeti.destroy', $data_kondisiPeti->id) }}"
method="POST" style="display: inline;"> method="POST" style="display: inline;">
@csrf @csrf
@method('DELETE') @method('DELETE')
@ -56,7 +53,7 @@
</tr> </tr>
@empty @empty
<p>Data Kosong</p> <p>Data Kosong</p>
@endforelse --}} @endforelse
</tbody> </tbody>
</table> </table>
</div> </div>
@ -80,17 +77,17 @@
@csrf @csrf
<div class="form-group"> <div class="form-group">
<div class="form-group"> <div class="form-group">
<label for="name" class="col-form-label">Kondisi Peti : <span <label for="nama_kondisi" class="col-form-label">Kondisi Peti : <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" name="name" type="text" id="name" <input class="form-control" name="nama_kondisi" type="text" id="nama_kondisi"
value="{{ old('name') }}" placeholder="Masukan Kondisi Peti" pattern="[^0-9]+" value="{{ old('nama_kondisi') }}" placeholder="Masukan Kondisi Peti" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');" oninput="this.value=this.value.replace(/[0-9]/g,'');"
title="Hanya karakter selain huruf yang diperbolehkan" required> title="Hanya karakter selain huruf yang diperbolehkan" required>
<label for="description" class="col-form-label">Deskripsi: <span <label for="deskripsi_kondisi" class="col-form-label">Deskripsi: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Kondisi Peti" <textarea class="form-control" name="deskripsi_kondisi" id="deskripsi_kondisi"
required>{{ old('description') }}</textarea> placeholder="Masukkan Deskripsi Kondisi Peti" required>{{ old('deskripsi_kondisi') }}</textarea>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -104,34 +101,36 @@
</div> </div>
<!-- Edit data Modal --> <!-- Edit data Modal -->
{{-- @foreach ($role as $data) @foreach ($kondisiPeti as $data)
<div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog" <div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true"> aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Role</h5> <h5 class="modal-title" id="exampleModalLabel">Edit Kondisi Peti</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form action="{{ route('dashboard.role.update', $data->id) }}" method="POST" <form action="{{ route('dashboard.kondisipeti.update', $data->id) }}" method="POST"
enctype="multipart/form-data" id="inputanForm"> enctype="multipart/form-data" id="inputanForm">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="form-group"> <div class="form-group">
<label for="name" class="col-form-label">Nama Hak Akses: <span <div class="form-group">
<label for="nama_kondisi" class="col-form-label">Kondisi Peti : <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" name="name" type="text" id="name" <input class="form-control" name="nama_kondisi" type="text" id="nama_kondisi"
value="{{ $data->name }}" placeholder="Masukan Nama Hak Akses" pattern="[^0-9]+" value="{{ $data->nama_kondisi }}" placeholder="Masukan Kondisi Peti"
oninput="this.value=this.value.replace(/[0-9]/g,'');" pattern="[^0-9]+" oninput="this.value=this.value.replace(/[0-9]/g,'');"
title="Hanya karakter selain huruf yang diperbolehkan" required> title="Hanya karakter selain huruf yang diperbolehkan" required>
<label for="description" class="col-form-label">Deskripsi Hak Akses: <span <label for="deskripsi_kondisi" class="col-form-label">Deskripsi: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Hak Akses" <textarea class="form-control" name="deskripsi_kondisi" id="deskripsi_kondisi"
required>{{ $data->description }}</textarea> placeholder="Masukkan Deskripsi Kondisi Peti" required>{{ $data->deskripsi_kondisi }}</textarea>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
@ -142,7 +141,7 @@
</div> </div>
</div> </div>
</div> </div>
@endforeach --}} @endforeach
<script> <script>
document.getElementById('inputanForm').addEventListener('submit', function() { document.getElementById('inputanForm').addEventListener('submit', function() {

11
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php

@ -43,13 +43,12 @@
@endforeach @endforeach
</select> </select>
<label for="status_disposal" class="col-form-label">Kondisi Peti:</label> <label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label>
<select class="form-control" name="status_disposal" id="status_disposal"> <select class="form-control" name="kondisipeti_id" id="kondisipeti_id">
<option disabled selected>Pilih Kondisi Peti</option> <option disabled selected>Pilih Kondisi Peti</option>
<option value="Baru">Baru</option> @foreach ($kondisiPeti as $data_kondisiPeti)
<option value="Bekas">Bekas</option> <option value="{{ $data_kondisiPeti->id }}">{{ $data_kondisiPeti->nama_kondisi }}</option>
<option value="Recycle">Recycle</option> @endforeach
<option value="Lainnya">Lainnya</option>
</select> </select>
<label for="jumlah" class="col-form-label">Jumlah Peti: <span class="text-danger">*</span></label> <label for="jumlah" class="col-form-label">Jumlah Peti: <span class="text-danger">*</span></label>

14
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/edit.blade.php

@ -55,15 +55,21 @@
@endforeach @endforeach
</select> </select>
<label for="status_disposal" class="col-form-label">Kondisi Peti:</label> <label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label>
<select class="form-control" name="status_disposal" id="status_disposal"> <select class="form-control" name="kondisipeti_id" id="kondisipeti_id">
<option disabled>Pilih Kondisi Peti</option> <option disabled>Pilih Kondisi Peti</option>
<option value="Baru" {{ old('status_disposal') == 'Baru' ? 'selected' : '' }}>Baru</option> @foreach ($kondisiPeti as $data_kondisiPeti)
<option value="{{ $data_kondisiPeti->id }}"
@if ($data_kondisiPeti->id == $peti->kondisipeti_id) selected
@else @endif>
{{ $data_kondisiPeti->nama_kondisi }}</option>
@endforeach
{{-- <option value="Baru" {{ old('status_disposal') == 'Baru' ? 'selected' : '' }}>Baru</option>
<option value="Bekas" {{ old('status_disposal') == 'Bekas' ? 'selected' : '' }}>Bekas</option> <option value="Bekas" {{ old('status_disposal') == 'Bekas' ? 'selected' : '' }}>Bekas</option>
<option value="Recycle" {{ old('status_disposal') == 'Recycle' ? 'selected' : '' }}>Recycle <option value="Recycle" {{ old('status_disposal') == 'Recycle' ? 'selected' : '' }}>Recycle
</option> </option>
<option value="Lainnya" {{ old('status_disposal') == 'Lainnya' ? 'selected' : '' }}>Lainnya <option value="Lainnya" {{ old('status_disposal') == 'Lainnya' ? 'selected' : '' }}>Lainnya
</option> </option> --}}
</select> </select>
<label for="date_pembuatan" class="col-form-label">Tanggal Pembuatan Peti: <span <label for="date_pembuatan" class="col-form-label">Tanggal Pembuatan Peti: <span

4
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -46,7 +46,7 @@
<th>Tipe Peti</th> <th>Tipe Peti</th>
<th>Ukuran Peti</th> <th>Ukuran Peti</th>
<th>Lot No</th> <th>Lot No</th>
<th>Status Peti</th> <th>Kondisi Peti</th>
<th>Packing No</th> <th>Packing No</th>
<th>Fix Lot</th> <th>Fix Lot</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
@ -67,7 +67,7 @@
<td>{{ $data_peti->tipe_peti->type }}</td> <td>{{ $data_peti->tipe_peti->type }}</td>
<td>{{ $data_peti->tipe_peti->size_peti }}</td> <td>{{ $data_peti->tipe_peti->size_peti }}</td>
<td>{{ $data_peti->customer->lot_no }}</td> <td>{{ $data_peti->customer->lot_no }}</td>
<td>{{ $data_peti->status_disposal }}</td> <td>{{ $data_peti->kondisipeti->nama_kondisi }}</td>
<td class="text-right">{{ $data_peti->packing_no }}</td> <td class="text-right">{{ $data_peti->packing_no }}</td>
<td>{{ $data_peti->fix_lot }}</td> <td>{{ $data_peti->fix_lot }}</td>
<td class="text-center"> <td class="text-center">

4
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/show.blade.php

@ -22,8 +22,8 @@
<label for="warehouse_id" class="col-form-label">Warehouse:</label> <label for="warehouse_id" class="col-form-label">Warehouse:</label>
<input class="form-control" value="{{ $peti->warehouse->name }}" readonly> <input class="form-control" value="{{ $peti->warehouse->name }}" readonly>
<label for="status_disposal" class="col-form-label">Status Peti:</label> <label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label>
<input class="form-control" value="{{ $peti->status_disposal }}" readonly> <input class="form-control" value="{{ $peti->kondisipeti->nama_kondisi }}" readonly>
<label for="jumlah" class="col-form-label">Jumlah Peti:</label> <label for="jumlah" class="col-form-label">Jumlah Peti:</label>
<input class="form-control" value="{{ $peti->jumlah }}" readonly> <input class="form-control" value="{{ $peti->jumlah }}" readonly>

2
routes/web.php

@ -95,6 +95,8 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::get('customer/{id}/edit', 'edit')->name('customer.edit'); Route::get('customer/{id}/edit', 'edit')->name('customer.edit');
Route::put('customer/{id}', 'update')->name('customer.update'); Route::put('customer/{id}', 'update')->name('customer.update');
Route::delete('customer/delete/{id}', 'destroy')->name('customer.destroy'); Route::delete('customer/delete/{id}', 'destroy')->name('customer.destroy');
// Route::post('customer/import', 'importCustomer')->name('customer.importCustomer');
Route::post('customers/import', 'importCustomer')->name('customer.import');
}); });
Route::controller(KondisiPetiController::class)->group(function () { Route::controller(KondisiPetiController::class)->group(function () {

Loading…
Cancel
Save