Commit 1e425193 by Alfiro Pratama

Monev & Bukti Anggaran

parent d658cb05
......@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
use App\Models\Proposal;
use App\Models\Kelompok;
......@@ -14,6 +15,7 @@ use App\Models\Periode;
use App\Models\MonevInternal;
use App\Models\JadwalKegiatan;
use App\Models\BuktiAnggaran;
use App\Models\JenisSatuanBarang;
use Session;
use Alert;
......@@ -178,28 +180,73 @@ class MonevController extends Controller
$title = 'Bukti Penggunaan Anggaran';
$anggaran = BuktiAnggaran::with(['rProposal', 'rMonev'])
->where('monev_id', $monev)
// ->paginate(10);
->get();
->where('monev_id', $monev)
->get();
$monev = MonevInternal::with(['rProposal', 'rBuktiAnggaran' => function($query) {
$query->orderByRaw('CASE WHEN tgl_pembelian IS NULL THEN 0 ELSE 1 END ASC, tgl_pembelian ASC');
}])
->where('id', $monev)
->first();
$jenis_satuan = JenisSatuanBarang::select('jenis_satuan')
->get();
// dd($monev->rBuktiAnggaran);
$data = [
'title' => $title,
'anggaran' => $anggaran
'title' => $title,
'anggaran' => $anggaran,
'monev' => $monev,
'jenis_satuan' => $jenis_satuan
];
return view('backend.mahasiswa.monev.anggaran.index', $data);
}
public function storeAnggaran()
public function storeAnggaran(Request $request)
{
$title = 'Bukti Penggunaan Anggaran';
// $proposal = Proposal::with(['rluaran', 'rPeriode'])->find(decrypt($id));
$data = [
// 'proposal' => $proposal,
'title' => $title
];
return view('backend.mahasiswa.monev.anggaran.index', $data);
DB::beginTransaction();
try {
$key = $request->except('_token');
$userid = Auth::user()->id;
$this->validate($request,
[
'nota_file' => 'required|mimes:pdf|max:5000'
], [
'nota_file.required' => 'Tidak ada file yang di upload',
'nota_file.mimes' => 'File harus pdf',
'nota_file.max' => 'File tidak boleh lebih dari 5 mb',
]);
$anggaran = MonevInternal::with(['rProposal', 'rBuktiAnggaran'])->find($key['monev_id']);
$original_file = $key['nota_file']->getClientOriginalName();
$file_nama = $anggaran->rProposal->rPeriode->nama . '_Bukti-Anggaran_' . $anggaran->rProposal->proposal_id . '_' . pathinfo($original_file, PATHINFO_FILENAME) . '.' . $key['nota_file']->getClientOriginalExtension();
// dd($key);
Storage::disk('static')->put('simpmw/monev/II/bukti-anggaran/' . $file_nama, file_get_contents($key['nota_file']->getRealPath()));
BuktiAnggaran::create([
'proposal_id' => $key['proposal_id'],
'monev_id' => $key['monev_id'],
'nama_kegiatan' => $key['nama_kegiatan'],
'nama_barang' => $key['nama_barang'],
'tgl_pembelian' => $key['tgl_pembelian'],
'kuantitas' => $key['kuantitas'],
'jenis_satuan' => $key['jenis_satuan'],
'harga_satuan' => $key['harga_satuan'],
'total_harga_per' => $key['kuantitas']*$key['harga_satuan'],
'total_harga_seluruh' => null,
'nota_file' => $file_nama,
'created_by' => $userid,
'updated_by' => $userid,
]);
DB::commit();
return redirect()->back()->with('success', 'Data berhasil disimpan');
} catch (\Exception $e) {
DB::rollback();
return redirect()->back()->with('error', 'Gagal menyimpan data: ' . $e->getMessage());
}
}
}
......@@ -22,15 +22,19 @@ class BuktiAnggaran extends Model
'monev_id',
'nama_kegiatan',
'nama_barang',
'tgl_pembelian',
'kuantitas',
'jenis_satuan',
'harga_satuan',
'total_harga_per',
'total_harga_seluruh',
'nota_file',
'created_user',
'updated_user',
'deleted_user',
'created_at',
'created_by',
'updated_at',
'updated_by',
'deleted_at',
'deleted_by',
];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
......
<?php
namespace App\Models;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class JenisSatuanBarang extends Model
{
use HasFactory, UuidTrait;
protected $table = 'jenis_satuan_barang';
protected $primaryKey = 'id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = ['nama'];
}
......@@ -66,7 +66,7 @@ class MonevInternal extends Model
public function rBuktiAnggaran()
{
return $this->hasMany(BuktiAnggaran::class, 'id', 'monev_id');
return $this->hasMany(BuktiAnggaran::class, 'monev_id');
}
}
......@@ -52,7 +52,7 @@
</div>
</form>
<br>
@if(($jadwal->tanggal_mulai <= Carbon\Carbon::now()) && ($jadwal->tanggal_selesai >= Carbon\Carbon::now()))
{{-- @if(($jadwal->tanggal_mulai <= Carbon\Carbon::now()) && ($jadwal->tanggal_selesai >= Carbon\Carbon::now())) --}}
<div class="table-responsive">
<table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead style="vertical-align: middle; text-align: center;">
......@@ -83,21 +83,21 @@
<td align="center">{{ $item->rProposal->judul }}</td>
<td align="center">
@if(is_null($item->logbook_file))
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->proposal_id.'__logbook__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->id.'__logbook__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
@else
<a href="https://statik.unesa.ac.id/simpmw/monev/II/logbook/{{ $item->logbook_file }}" target="_blank" title="Logbook" class="btn btn-info btn-sm waves-effect waves-light"> <i class="fas fa-search"></i> Lihat</a>
@endif
</td>
<td align="center">
@if(is_null($item->laporan_akhir_file))
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->proposal_id.'__akhir__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->id.'__akhir__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
@else
<a href="https://statik.unesa.ac.id/simpmw/monev/II/akhir/{{ $item->akhir_file }}" target="_blank" title="Laporan Akhir" class="btn btn-info btn-sm waves-effect waves-light"> <i class="fas fa-search"></i> Lihat</a>
@endif
</td>
<td align="center">
@if(is_null($item->produk_url))
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->proposal_id.'__produk__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->id.'__produk__II')) }}" type="button" class="btn btn-warning btn-sm waves-effect waves-light"> <i class="fas fa-file-upload"></i> Upload</a>
@else
<a href="{{ $item->produk_url }}" target="_blank" title="Video Produk Akhir" class="btn btn-info btn-sm waves-effect waves-light"> <i class="fas fa-search"></i> Lihat</a>
@endif
......@@ -110,7 +110,7 @@
</td> --}}
<td align="center">
<button data-bs-toggle="modal" data-bs-target="{{ '#lihat'.$item->id }}" class="btn btn-success btn-sm form-control mb-2"><i class="fas fa-search"></i> Hasil Penilaian</button>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->proposal_id.'__proposal__II')) }}" type="button" class="btn btn-danger btn-sm waves-effect waves-light form-control" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Revisi Proposal"><i class="fas fa-file-upload"></i> Revisi</a>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->id.'__proposal__II')) }}" type="button" class="btn btn-danger btn-sm waves-effect waves-light form-control" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Revisi Proposal"><i class="fas fa-file-upload"></i> Revisi</a>
<div id="{{ 'lihat'.$item->id }}" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="lihatLabel" aria-hidden="true">
......@@ -185,11 +185,11 @@
</tbody>
</table>
</div>
@else
{{-- @else
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>Informasi!</strong> Monev Internal II dilaksanakan pada : <strong>Tanggal {{ Carbon\Carbon::parse($jadwal->tanggal_mulai)->isoFormat('D MMMM Y'); }}</strong> sampai dengan <strong>Tanggal {{ Carbon\Carbon::parse($jadwal->tanggal_selesai)->isoFormat('D MMMM Y'); }}.</strong>
</div>
@endif
@endif --}}
</div>
</div>
</div> <!-- end col -->
......
......@@ -46,7 +46,7 @@
<th>Judul Proposal</th>
<th>Catatan Harian<br>(Logbook)</th>
<th>Laporan Kemajuan</th>
<th>Laporan Luaran</th>
<th>Laporan Magang / Lainnya</th>
<th>Nilai</th>
</tr>
</thead>
......
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