Commit 2fe29962 authored by Christo Gustawan Nugraha's avatar Christo Gustawan Nugraha
Browse files

fix ekatalog + arsip

unggah laporan editarsip belum fix
No related merge requests found
Showing with 75 additions and 52 deletions
+75 -52
......@@ -28,46 +28,48 @@ public function edit($id)
// Update the specified ArsipLaporan record in storage
public function update(Request $request, $id)
{
// Validate the incoming request data
$laporan_arsip = ArsipLaporan::findOrFail($id);
// Validate the incoming request
$request->validate([
'nip' => 'required',
'nama_penulis' => 'required',
'jabatan' => 'required',
'golongan' => 'required',
'unit_kerja' => 'required',
'jenis_pelatihan' => 'required',
'nama_pelatihan' => 'required',
'nip' => 'required|string|max:255',
'nama_penulis' => 'required|string|max:255',
'jabatan' => 'required|string|max:255',
'golongan' => 'required|string|max:255',
'unit_kerja' => 'required|string|max:255',
'jenis_pelatihan' => 'required|string|max:255',
'nama_pelatihan' => 'required|string|max:255',
'tahun_pelatihan' => 'required|integer',
'pelaksanaan' => 'required',
'mode_pelatihan' => 'required',
'waktu_pelaksanaan' => 'required',
'judul_laporan' => 'required',
'latar_belakang' => 'required',
'unggah_laporan' => 'file|mimes:pdf|max:2048', // Optional file validation
'pelaksanaan' => 'required|string|max:255',
'mode_pelatihan' => 'required|string|max:255',
'waktu_pelaksanaan' => 'required|string|max:255',
'judul_laporan' => 'required|string|max:255',
'latar_belakang' => 'required|string',
'unggah_laporan' => 'nullable|file|mimes:pdf,docx,jpg,jpeg,png|max:10240', // Optional file validation
]);
// Retrieve the record by ID
$laporan_arsip = ArsipLaporan::findOrFail($id);
// Update the record's attributes
// Update the record's attributes (excluding file handling here for now)
$laporan_arsip->fill($request->except('unggah_laporan'));
// Handle file upload if a new file is provided
if ($request->hasFile('unggah_laporan')) {
// Delete the old file if it exists
if ($laporan_arsip->unggah_laporan) {
Storage::delete($laporan_arsip->unggah_laporan);
}
// Store the new file
$filePath = $request->file('unggah_laporan')->store('uploads/reports');
$laporan_arsip->unggah_laporan = $filePath;
}
// Save the updated record
$laporan_arsip->save();
// Redirect back to the list or another desired page
return redirect()->route('laporan.arsip')->with('success', 'Laporan arsip updated successfully.');
// Redirect back with a success message
return redirect()->route('laporan.arsip')->with('success', 'Laporan successfully updated');
}
}
......@@ -6,19 +6,33 @@
class ArsipLaporan extends Model
{
// Tentukan nama tabel yang digunakan
// Specify the table name
protected $table = 'laporan_arsip';
// Tentukan kolom yang bisa diisi melalui mass-assignment
// Specify the columns that can be mass-assigned
protected $fillable = [
'nip',
'nama_penulis',
'judul_laporan',
'nama_pelatihan',
'jabatan',
'golongan',
'unit_kerja',
'jenis_pelatihan',
'nama_pelatihan',
'tahun_pelatihan',
'pelaksanaan',
'mode_pelatihan',
'waktu_pelaksanaan',
'judul_laporan',
'latar_belakang',
'unggah_laporan', // Add this if it's part of your fillable fields (file uploads)
'status',
'tanggal_ajuan'
];
// Kolom timestamp created_at dan updated_at diaktifkan (default dari Laravel)
}
// If you don't have 'created_at' and 'updated_at' in the table,
// you can disable timestamps by setting this property to false.
// If these timestamps are in your table, leave this as true (default).
public $timestamps = true; // Or false if you don't have these columns
// Define the relationship if needed (e.g., belongsTo, hasMany, etc.)
}
......@@ -17,8 +17,11 @@ class Diklat extends Model
'rumpun',
'kode_jabatan',
'penyelenggara',
'link_katalog',
'tanggal_pelaksanaan', // Add this field
'tempat_pelaksanaan', // Add this field
'metode_pelaksanaan', // Add this field
'jenis_biaya', // Add this field
'biaya_per_orang', // Add this field
'link_katalog', // Add this field
];
}
......@@ -20,8 +20,13 @@ public function up()
$table->string('rumpun');
$table->string('kode_jabatan');
$table->string('penyelenggara');
$table->string('link_katalog');
$table->timestamps();
$table->date('tanggal_pelaksanaan'); // Kolom tanggal_pelaksanaan
$table->string('tempat_pelaksanaan'); // Kolom tempat_pelaksanaan
$table->string('metode_pelaksanaan'); // Kolom metode_pelaksanaan
$table->string('jenis_biaya'); // Kolom jenis_biaya
$table->decimal('biaya_per_orang', 10, 2); // Kolom biaya_per_orang
$table->string('link_katalog')->nullable(); // Kolom link_katalog
$table->timestamps(); // Menambahkan kolom created_at dan updated_at
});
}
......@@ -35,3 +40,4 @@ public function down()
Schema::dropIfExists('diklats');
}
}
File added
File added
......@@ -12,84 +12,82 @@
<div class="card-body" style="background-color: #f8f5f1;">
<div class="form-container mx-auto"
style="max-width: 900px; padding: 40px; background-color: #ffffff; border-radius: 10px; border: 1px solid #ccc; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);">
<form action="{{ route('ekatalog.storediklat') }}" method="POST" enctype="multipart/form-data">
@csrf
<form>
<!-- Display Diklat data -->
<div class="mb-3">
<label for="jenis_diklat" class="form-label">Jenis Diklat</label>
<input type="text" class="form-control" id="jenis_diklat" name="jenis_diklat"
placeholder="Masukkan jenis diklat" required>
value="{{ $diklat->jenis_diklat }}" readonly>
</div>
<div class="mb-3">
<label for="nama_diklat" class="form-label">Nama Diklat</label>
<input type="text" class="form-control" id="nama_diklat" name="nama_diklat"
placeholder="Masukkan nama diklat" required>
value="{{ $diklat->nama_diklat }}" readonly>
</div>
<div class="mb-3">
<label for="rumpun" class="form-label">Rumpun</label>
<input type="text" class="form-control" id="rumpun" name="rumpun"
placeholder="Masukkan rumpun" required>
value="{{ $diklat->rumpun }}" readonly>
</div>
<div class="mb-3">
<label for="kode_jabatan" class="form-label">Kode Jabatan</label>
<input type="text" class="form-control" id="kode_jabatan" name="kode_jabatan"
placeholder="Masukkan kode jabatan" required>
value="{{ $diklat->kode_jabatan }}" readonly>
</div>
<div class="mb-3">
<label for="penyelenggara" class="form-label">Penyelenggara</label>
<input type="text" class="form-control" id="penyelenggara" name="penyelenggara"
placeholder="Masukkan penyelenggara" required>
value="{{ $diklat->penyelenggara }}" readonly>
</div>
<div class="mb-3">
<label for="tanggal_pelaksanaan" class="form-label">Tanggal Pelaksanaan</label>
<input type="date" class="form-control" id="tanggal_pelaksanaan"
name="tanggal_pelaksanaan" required>
name="tanggal_pelaksanaan" value="{{ $diklat->tanggal_pelaksanaan }}" readonly>
</div>
<div class="mb-3">
<label for="tempat_pelaksanaan" class="form-label">Tempat Pelaksanaan</label>
<input type="text" class="form-control" id="tempat_pelaksanaan"
name="tempat_pelaksanaan" placeholder="Masukkan tempat pelaksanaan" required>
name="tempat_pelaksanaan" value="{{ $diklat->tempat_pelaksanaan }}" readonly>
</div>
<div class="mb-3">
<label for="metode_pelaksanaan" class="form-label">Metode Pelaksanaan</label>
<input type="text" class="form-control" id="metode_pelaksanaan"
name="metode_pelaksanaan" placeholder="Masukkan metode pelaksanaan" required>
name="metode_pelaksanaan" value="{{ $diklat->metode_pelaksanaan }}" readonly>
</div>
<div class="mb-3">
<label for="jenis_biaya" class="form-label">Jenis Biaya</label>
<input type="text" class="form-control" id="jenis_biaya" name="jenis_biaya"
placeholder="Masukkan jenis biaya" required>
value="{{ $diklat->jenis_biaya }}" readonly>
</div>
<div class="mb-3">
<label for="biaya_per_orang" class="form-label">Biaya /Orang</label>
<input type="number" class="form-control" id="biaya_per_orang" name="biaya_per_orang"
placeholder="Masukkan biaya per orang" required>
value="{{ $diklat->biaya_per_orang }}" readonly>
</div>
<div class="mb-3">
<label for="link_katalog" class="form-label">Link Katalog</label>
<input type="url" class="form-control" id="link_katalog" name="link_katalog"
placeholder="Masukkan link katalog" required>
value="{{ $diklat->link_katalog }}" readonly>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
/* Add your CSS styles here */
</style>
@endsection
\ No newline at end of file
@endsection
......@@ -84,7 +84,7 @@
<div class="mb-3">
<label for="unggah_laporan" class="form-label">Unggah Laporan</label>
<input type="file" class="form-control" id="unggah_laporan" name="unggah_laporan" accept=".pdf">
<input type="file" class="form-control" id="unggah_laporan" name="unggah_laporan" accept=".pdf,.doc,.docx" required>
@if($laporan_arsip->unggah_laporan)
<p>File saat ini: <a href="{{ asset($laporan_arsip->unggah_laporan) }}" target="_blank">Lihat Laporan</a></p>
@else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment