initial commit
parent
3c71e9289c
commit
1378aa2338
|
@ -1,66 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Http\Requests\HistoryKegiatanRequest;
|
|
||||||
use App\Models\HistoryKegiatan;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Inertia\Inertia;
|
|
||||||
|
|
||||||
class HistoryKegiatanController extends Controller
|
|
||||||
{
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$historykegiatan = HistoryKegiatan::latest()->get();
|
|
||||||
return Inertia::render('admin/kegiatan/index_history_kegiatan', ['historykegiatan' => $historykegiatan]);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('Error fetching History Kegiatan: ' . $e->getMessage());
|
|
||||||
return back()->with('error', 'Something went wrong.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store(HistoryKegiatanRequest $request)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$historykegiatan = HistoryKegiatan::withTrashed()
|
|
||||||
->where('NamaHistoryKegiatan', $request->NamaHistoryKegiatan)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($historykegiatan) {
|
|
||||||
$historykegiatan->restore();
|
|
||||||
return redirect()->route('admin.historykegiatan.index')->with('success', 'History Kegiatan berhasil dikembalikan.');
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryKegiatan::create($request->validated());
|
|
||||||
|
|
||||||
return redirect()->route('admin.historykegiatan.index')->with('success', 'History Kegiatan berhasil dibuat.');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('Error creating History Kegiatan: ' . $e->getMessage());
|
|
||||||
return back()->with('error', 'Something went wrong.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update(HistoryKegiatanRequest $request, HistoryKegiatan $historykegiatan)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$historykegiatan->update($request->validated());
|
|
||||||
return redirect()->route('admin.history$historykegiatan.index')->with('success', 'History Kegiatan berhasil diperbarui.');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('Error updating History Kegiatan: ' . $e->getMessage());
|
|
||||||
return back()->with('error', 'Something went wrong.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy(HistoryKegiatan $historykegiatan)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$historykegiatan->delete();
|
|
||||||
return redirect()->route('admin.histo$historykegiatan.index')->with('success', 'History Kegiatan berhasil dihapus.');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('Error deleting History Kegiatan: ' . $e->getMessage());
|
|
||||||
return back()->with('error', 'Something went wrong.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,12 +3,12 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Requests\HistoryPerusahaanRequest;
|
use App\Http\Requests\HistoryPerusahaanRequest;
|
||||||
use App\Models\HistoryKegiatan;
|
|
||||||
use App\Models\HistoryPerusahaan;
|
use App\Models\HistoryPerusahaan;
|
||||||
use App\Models\Kabupaten;
|
use App\Models\Kabupaten;
|
||||||
use App\Models\Kecamatan;
|
use App\Models\Kecamatan;
|
||||||
use App\Models\Kelurahan;
|
use App\Models\Kelurahan;
|
||||||
use App\Models\Perusahaan;
|
use App\Models\Perusahaan;
|
||||||
|
use App\Models\RefHistoryKegiatan;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
@ -19,7 +19,7 @@ class HistoryPerusahaanController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
$historyPerusahaan = HistoryPerusahaan::with(['perusahaan', 'historyKegiatan', 'kelurahan.kecamatan.kabupaten'])->orderBy('created_at', 'desc')->get();
|
$historyPerusahaan = HistoryPerusahaan::with(['perusahaan', 'refhistoryKegiatan', 'kelurahan.kecamatan.kabupaten'])->orderBy('created_at', 'desc')->get();
|
||||||
|
|
||||||
// Eager load companies with their relationships
|
// Eager load companies with their relationships
|
||||||
$perusahaan = Perusahaan::with('kelurahan.kecamatan.kabupaten')->get()
|
$perusahaan = Perusahaan::with('kelurahan.kecamatan.kabupaten')->get()
|
||||||
|
@ -32,7 +32,7 @@ class HistoryPerusahaanController extends Controller
|
||||||
return Inertia::render('admin/history_perusahaan/index_history_perusahaan', [
|
return Inertia::render('admin/history_perusahaan/index_history_perusahaan', [
|
||||||
'historyPerusahaan' => $historyPerusahaan,
|
'historyPerusahaan' => $historyPerusahaan,
|
||||||
'perusahaan' => $perusahaan,
|
'perusahaan' => $perusahaan,
|
||||||
'historyKegiatan' => HistoryKegiatan::all(),
|
'refhistoryKegiatan' => RefHistoryKegiatan::all(),
|
||||||
'kabupaten' => Kabupaten::all(),
|
'kabupaten' => Kabupaten::all(),
|
||||||
'kecamatan' => Kecamatan::all(),
|
'kecamatan' => Kecamatan::all(),
|
||||||
'kelurahan' => Kelurahan::all(),
|
'kelurahan' => Kelurahan::all(),
|
||||||
|
@ -77,13 +77,13 @@ class HistoryPerusahaanController extends Controller
|
||||||
{
|
{
|
||||||
$perusahaan = Perusahaan::with('historyPerusahaan')->findOrFail($perusahaanId);
|
$perusahaan = Perusahaan::with('historyPerusahaan')->findOrFail($perusahaanId);
|
||||||
|
|
||||||
$historyKegiatan = HistoryKegiatan::all();
|
$refhistoryKegiatan = RefHistoryKegiatan::all();
|
||||||
|
|
||||||
$historyPerusahaan = HistoryPerusahaan::with('historyKegiatan')->where('PerusahaanId', $perusahaanId)->get();
|
$historyPerusahaan = HistoryPerusahaan::with('refhistoryKegiatan')->where('PerusahaanId', $perusahaanId)->get();
|
||||||
|
|
||||||
return Inertia::render('admin/history_perusahaan/detail_history_perusahaan', [
|
return Inertia::render('admin/history_perusahaan/detail_history_perusahaan', [
|
||||||
'perusahaan' => $perusahaan,
|
'perusahaan' => $perusahaan,
|
||||||
'historyKegiatan' => $historyKegiatan,
|
'refhistoryKegiatan' => $refhistoryKegiatan,
|
||||||
'historyPerusahaan' => $historyPerusahaan,
|
'historyPerusahaan' => $historyPerusahaan,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public function update(Request $request, $historyPerusahaanId)
|
||||||
'PerusahaanId' => 'required|integer',
|
'PerusahaanId' => 'required|integer',
|
||||||
'NomorHistory' => 'required|string',
|
'NomorHistory' => 'required|string',
|
||||||
'TanggalHistory' => 'required|date',
|
'TanggalHistory' => 'required|date',
|
||||||
'HistoryKegiatanId' => 'required|integer',
|
'RefHistoryKegiatanId' => 'required|integer',
|
||||||
'KeteranganHistory' => 'nullable|string',
|
'KeteranganHistory' => 'nullable|string',
|
||||||
'DokumenHistory' => 'nullable|file|mimes:pdf',
|
'DokumenHistory' => 'nullable|file|mimes:pdf',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -0,0 +1,524 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Pelaporan\AL;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Komponen;
|
||||||
|
use App\Models\Spl_AL;
|
||||||
|
use App\Models\Ipal;
|
||||||
|
use App\Models\IpalParameter;
|
||||||
|
use App\Models\HasilUjiAL;
|
||||||
|
use App\Models\LampiranAL;
|
||||||
|
use App\Models\NilaiKomponen;
|
||||||
|
use App\Models\PelaporanDate;
|
||||||
|
use App\Models\Catatan;
|
||||||
|
use App\Models\Pelaporan\Lampiran;
|
||||||
|
use App\Models\Pelaporan\Pelaporan;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller untuk Laporan Pengelolaan Air Limbah
|
||||||
|
*
|
||||||
|
* @author Muammar <official.muammar@gmail.com>
|
||||||
|
*/
|
||||||
|
class ALController extends Controller
|
||||||
|
{
|
||||||
|
const ID_REFPELAPORAN = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menampilkan halaman laporan
|
||||||
|
*/
|
||||||
|
public function laporan($idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load models
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idPelaporan);
|
||||||
|
|
||||||
|
// Set breadcrumb data
|
||||||
|
$breadcrumb = $this->_generateBreadcrumb('Pelaporan');
|
||||||
|
|
||||||
|
// Get editable status
|
||||||
|
$editable = $this->_isEditable($idPelaporan, 'AL') && Gate::allows('pelaporan.edit');
|
||||||
|
|
||||||
|
// Check IPAL Komunal status
|
||||||
|
$ipalKomunal = $this->_getIpalKomunalStatus($idPelaporan);
|
||||||
|
$lampiranSk = 0;
|
||||||
|
$verifikasiSk = '';
|
||||||
|
$ketSk = '';
|
||||||
|
|
||||||
|
if ($ipalKomunal) {
|
||||||
|
if ($ipalKomunal->tersambung == 'Iya') {
|
||||||
|
$sk = Lampiran::getKomponenByKode('SK');
|
||||||
|
if ($sk) {
|
||||||
|
$lampiranSk = $this->_cekLampiranSk($idPelaporan, $sk->id) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifikasi surat kerjasama
|
||||||
|
$idKomponenSk = Lampiran::getKomponenByKode('SK')->id;
|
||||||
|
$komponenSk = Ipal::getNilaiKomponen([
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idrefkomponen' => $idKomponenSk
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$editable && $komponenSk) {
|
||||||
|
if ($komponenSk->verifikasi !== null) {
|
||||||
|
$verifikasiSk = $komponenSk->verifikasi == '1' ? 'Approved' : 'Not Approved';
|
||||||
|
}
|
||||||
|
$ketSk = $komponenSk->keterangan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare data for view
|
||||||
|
$data = [
|
||||||
|
'breadcrumb' => $breadcrumb,
|
||||||
|
'NamaPerusahaan' => $pelaporan->perusahaan,
|
||||||
|
'Tahun' => $pelaporan->tahun,
|
||||||
|
'periode' => $pelaporan->periode,
|
||||||
|
'editable' => $editable,
|
||||||
|
'lampiran_sk' => $lampiranSk,
|
||||||
|
'verifikasi_sk' => $verifikasiSk,
|
||||||
|
'ipal_komunal' => $ipalKomunal ? $ipalKomunal->tersambung : '',
|
||||||
|
'ket_sk' => $ketSk,
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'catatan' => Komponen::getCatatan($idPelaporan, self::ID_REFPELAPORAN)
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('pelaporan.al', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to load al table
|
||||||
|
*/
|
||||||
|
public function table($idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load pelaporan data
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idPelaporan);
|
||||||
|
|
||||||
|
// Get reference data
|
||||||
|
$getData = Komponen::getDataRef(self::ID_REFPELAPORAN);
|
||||||
|
$dataTable = $getData['data'];
|
||||||
|
$rowspan1 = $getData['total_rows'] + 1;
|
||||||
|
|
||||||
|
// Get nilai komponen
|
||||||
|
$nilaiKomponen = Komponen::getNilaiKomponen($idPelaporan, self::ID_REFPELAPORAN);
|
||||||
|
|
||||||
|
// Get nilai komponen A6 and A7
|
||||||
|
$komponenCodes = ['A6', 'A7'];
|
||||||
|
$nilaiData = [];
|
||||||
|
|
||||||
|
foreach ($komponenCodes as $code) {
|
||||||
|
$nilaiData['nilai_' . $code] = '';
|
||||||
|
$idRefKomponen = Ipal::getIdRefKomponen($code);
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen
|
||||||
|
];
|
||||||
|
|
||||||
|
$nilaiKomponenValue = Ipal::getNilaiKomponen($filter);
|
||||||
|
if ($nilaiKomponenValue) {
|
||||||
|
$nilaiData['nilai_' . $code] = $nilaiKomponenValue->nilai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get nilai syarat teknis
|
||||||
|
$kodeSyaratTeknis = ['A1', 'A2', 'A3', 'A4', 'A5'];
|
||||||
|
$nilaiSyaratTeknis = [];
|
||||||
|
|
||||||
|
foreach ($kodeSyaratTeknis as $kode) {
|
||||||
|
$idKomponen = Ipal::getIdRefKomponen($kode);
|
||||||
|
$komponenSyaratTeknis = Ipal::getNilaiKomponen([
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idmcipal' => null,
|
||||||
|
'idrefkomponen' => $idKomponen
|
||||||
|
]);
|
||||||
|
|
||||||
|
$nilaiSyaratTeknis[$kode] = $komponenSyaratTeknis ? $komponenSyaratTeknis->nilai : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update nilai SPL
|
||||||
|
$this->_updateNilaiSpl($idPelaporan);
|
||||||
|
$spl = number_format($pelaporan->spl_al, 2, '.', ' ');
|
||||||
|
|
||||||
|
$splAl = Ipal::getNilaiSpl($idPelaporan);
|
||||||
|
$spl2 = $splAl ? number_format($splAl->nilaispl, 2, '.', ' ') : 0;
|
||||||
|
|
||||||
|
// Prepare data for view
|
||||||
|
$data = array_merge($nilaiData, [
|
||||||
|
'data_table' => $dataTable,
|
||||||
|
'rowspan_1' => $rowspan1,
|
||||||
|
'nilai_komponen' => $nilaiKomponen,
|
||||||
|
'nilai_syarat_teknis' => $nilaiSyaratTeknis,
|
||||||
|
'spl' => $spl,
|
||||||
|
'spl_2' => $spl2,
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idrefpelaporan' => self::ID_REFPELAPORAN
|
||||||
|
]);
|
||||||
|
|
||||||
|
return view('pelaporan.al_table', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display SPL data
|
||||||
|
*/
|
||||||
|
public function spl($idPelaporan)
|
||||||
|
{
|
||||||
|
// Load pelaporan data
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idPelaporan);
|
||||||
|
$spl = Ipal::getNilaiSpl($idPelaporan);
|
||||||
|
|
||||||
|
// Prepare data for view
|
||||||
|
$data = [
|
||||||
|
'NamaPerusahaan' => $pelaporan->perusahaan,
|
||||||
|
'Tahun' => $pelaporan->tahun,
|
||||||
|
'periode' => $pelaporan->periode,
|
||||||
|
'spl' => $spl
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('pelaporan.spl_al', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there are attachments
|
||||||
|
*/
|
||||||
|
public function cekAdaLampiran($idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = Lampiran::cekAdaLampiran($idPelaporan, self::ID_REFPELAPORAN);
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for surat kerjasama
|
||||||
|
*/
|
||||||
|
public function cekSuratKerjasama($idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sk = Lampiran::getKomponenByKode('SK');
|
||||||
|
if ($sk) {
|
||||||
|
$lampiranSk = $this->_cekLampiranSk($idPelaporan, $sk->id);
|
||||||
|
$response = ['lampiran' => $lampiranSk ? true : false];
|
||||||
|
} else {
|
||||||
|
$response = ['lampiran' => false];
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save AL data
|
||||||
|
*/
|
||||||
|
public function simpan(Request $request, $idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view') || !Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dataCatatan = $request->input('catatan');
|
||||||
|
$dataHasil = [];
|
||||||
|
|
||||||
|
if ($request->has('hasil')) {
|
||||||
|
foreach ($request->input('hasil') as $row => $value) {
|
||||||
|
$dataHasil[$row] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dataHasil)) {
|
||||||
|
Komponen::updateHasil($idPelaporan, self::ID_REFPELAPORAN, $dataHasil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update SKL nilai if provided
|
||||||
|
if ($request->has('skl-nilai')) {
|
||||||
|
$nilaiSkl = $request->input('skl-nilai');
|
||||||
|
Pelaporan::updateNilaiSkl($idPelaporan, self::ID_REFPELAPORAN, $nilaiSkl);
|
||||||
|
Pelaporan::updateAvgSkl($idPelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update status IPAL Komunal
|
||||||
|
$statusIpalKomunal = $request->input('ipal_komunal', 'Tidak');
|
||||||
|
$this->_updateStatusIpalKomunal($idPelaporan, $statusIpalKomunal);
|
||||||
|
|
||||||
|
// Save catatan
|
||||||
|
Komponen::simpanCatatan($idPelaporan, self::ID_REFPELAPORAN, $dataCatatan);
|
||||||
|
|
||||||
|
// Update mcpelaporan_date
|
||||||
|
Pelaporan::updateTanggalPelaporan([
|
||||||
|
'id_mcpelaporan' => $idPelaporan,
|
||||||
|
'id_refpelaporan' => self::ID_REFPELAPORAN
|
||||||
|
], now()->toDateString());
|
||||||
|
|
||||||
|
// Update table mcverifikasi
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idrefpelaporan' => self::ID_REFPELAPORAN
|
||||||
|
];
|
||||||
|
|
||||||
|
$dataUpdate = [
|
||||||
|
'verifikasi' => 1,
|
||||||
|
'tanggal' => now()->format('Y-m-d H:i:s'),
|
||||||
|
'oleh' => Auth::id()
|
||||||
|
];
|
||||||
|
|
||||||
|
Pelaporan::updateStatusVerifikasi($filter, $dataUpdate);
|
||||||
|
|
||||||
|
// Log activity
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idPelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
$aktivitas = 'Pelaporan AL - ' . $perusahaan->nama . ' - Tahun ' . $pelaporan->tahun .
|
||||||
|
' - Periode ' . $pelaporan->periode;
|
||||||
|
|
||||||
|
Log::info('LOG_EDIT', ['message' => $aktivitas, 'module' => 'pelaporan']);
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'message' => 'Data Pengelolaan Air Limbah berhasil disimpan',
|
||||||
|
'status' => 'success'
|
||||||
|
];
|
||||||
|
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export data to PDF
|
||||||
|
*/
|
||||||
|
public function exportPdf($idPelaporan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.export')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load pelaporan data
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idPelaporan);
|
||||||
|
|
||||||
|
// Prepare data for PDF
|
||||||
|
$getData = Komponen::getDataRef(self::ID_REFPELAPORAN);
|
||||||
|
$dataTable = $getData['data'];
|
||||||
|
$rowspan1 = $getData['total_rows'] + 1;
|
||||||
|
$nilaiKomponen = Komponen::getNilaiKomponen($idPelaporan, self::ID_REFPELAPORAN);
|
||||||
|
$catatan = Komponen::getCatatan($idPelaporan, self::ID_REFPELAPORAN);
|
||||||
|
|
||||||
|
// Get IPAL Komunal status
|
||||||
|
$ipalKomunal = $this->_getIpalKomunalStatus($idPelaporan);
|
||||||
|
$lampiranSk = 0;
|
||||||
|
$komponenSk = null;
|
||||||
|
|
||||||
|
if ($ipalKomunal) {
|
||||||
|
$statusIpalKomunal = $ipalKomunal->tersambung;
|
||||||
|
// Check lampiran surat kerjasama
|
||||||
|
$sk = Lampiran::getKomponenByKode('SK');
|
||||||
|
if ($sk) {
|
||||||
|
$lampiranSk = $this->_cekLampiranSk($idPelaporan, $sk->id);
|
||||||
|
if ($lampiranSk) {
|
||||||
|
$komponenSk = Ipal::getNilaiKomponen([
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idrefkomponen' => $sk->id
|
||||||
|
]);
|
||||||
|
$lampiranSk = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$statusIpalKomunal = 'Tidak';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get syarat teknis values
|
||||||
|
$syaratTeknis = ['A1', 'A2', 'A3', 'A4', 'A5'];
|
||||||
|
$nilaiSyaratTeknis = [];
|
||||||
|
|
||||||
|
foreach ($syaratTeknis as $kode) {
|
||||||
|
$idKomponen = Ipal::getIdRefKomponen($kode);
|
||||||
|
$komponenSyaratTeknis = Ipal::getNilaiKomponen([
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'idmcipal' => null,
|
||||||
|
'idrefkomponen' => $idKomponen
|
||||||
|
]);
|
||||||
|
|
||||||
|
$nilaiSyaratTeknis[$kode] = $komponenSyaratTeknis ? $komponenSyaratTeknis->nilai : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get SKL and SPL values
|
||||||
|
$skl = Pelaporan::getNilaiSkl($idPelaporan, self::ID_REFPELAPORAN);
|
||||||
|
$spl = $ipalKomunal && $ipalKomunal->tersambung == 'Iya' ? 100 : number_format($pelaporan->spl_al, 2, '.', ' ');
|
||||||
|
|
||||||
|
// Generate PDF
|
||||||
|
$pdf = PDF::loadView('pelaporan.al_pdf', [
|
||||||
|
'NamaPerusahaan' => $pelaporan->perusahaan,
|
||||||
|
'Tahun' => $pelaporan->tahun,
|
||||||
|
'periode' => $pelaporan->periode,
|
||||||
|
'data_table' => $dataTable,
|
||||||
|
'rowspan_1' => $rowspan1,
|
||||||
|
'nilai_komponen' => $nilaiKomponen,
|
||||||
|
'catatan' => $catatan,
|
||||||
|
'ipal_komunal' => $statusIpalKomunal,
|
||||||
|
'lampiran_sk' => $lampiranSk,
|
||||||
|
'komponen_sk' => $komponenSk,
|
||||||
|
'skl' => $skl,
|
||||||
|
'spl' => $spl,
|
||||||
|
'nilai_syarat_teknis' => $nilaiSyaratTeknis
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $pdf->download('Laporan_al_' . $pelaporan->perusahaan . '_' . $pelaporan->tahun . '_' . $pelaporan->periode . '.pdf');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai SPL
|
||||||
|
*/
|
||||||
|
private function _updateNilaiSpl($idPelaporan)
|
||||||
|
{
|
||||||
|
$allIpal = Ipal::getData($idPelaporan);
|
||||||
|
$jmlParam = 0;
|
||||||
|
$memenuhiBakuMutu = 0;
|
||||||
|
$memenuhiBatasEmisi = 0;
|
||||||
|
|
||||||
|
foreach ($allIpal as $ipal) {
|
||||||
|
$params = IpalParameter::getData($ipal->id);
|
||||||
|
$jmlParam += count($params);
|
||||||
|
|
||||||
|
$allHasilUji = Ipal::getAllHasilUjiBy([
|
||||||
|
'idmcipal' => $ipal->id,
|
||||||
|
'nilai !=' => null
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Check each hasil uji against bakumutu
|
||||||
|
foreach ($allHasilUji as $hasilUji) {
|
||||||
|
$param = IpalParameter::getOneBy(['id' => $hasilUji->idmcipal_parameter]);
|
||||||
|
|
||||||
|
if ($hasilUji->nilai == '*') {
|
||||||
|
$memenuhiBakuMutu++;
|
||||||
|
} elseif ($hasilUji->debit != null && $param->bakumutu_jenis != 'Positif/Negatif' && $param->batasemisi) {
|
||||||
|
if ($hasilUji->bebanemisi <= $param->batasemisi) {
|
||||||
|
$memenuhiBatasEmisi++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($param->bakumutu_jenis == 'Angka Tunggal') {
|
||||||
|
if ($hasilUji->nilai <= $param->bakumutu_nilai1) {
|
||||||
|
$memenuhiBakuMutu++;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Rentang Angka') {
|
||||||
|
if ($hasilUji->nilai >= $param->bakumutu_nilai1 && $hasilUji->nilai <= $param->bakumutu_nilai2) {
|
||||||
|
$memenuhiBakuMutu++;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Positif/Negatif') {
|
||||||
|
if (strtolower($hasilUji->nilai) == strtolower($param->bakumutu_nilai1)) {
|
||||||
|
$memenuhiBakuMutu++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalParam = $jmlParam * 3;
|
||||||
|
$melebihiBakuMutuEmisi = $totalParam - $memenuhiBakuMutu - $memenuhiBatasEmisi;
|
||||||
|
$nilaiSpl = $totalParam ? 100 - (($melebihiBakuMutuEmisi / $totalParam) * 100) : 0;
|
||||||
|
|
||||||
|
// Save or update nilai SPL
|
||||||
|
$splAl = Ipal::getNilaiSpl($idPelaporan);
|
||||||
|
|
||||||
|
if ($splAl) {
|
||||||
|
$data = [
|
||||||
|
'diuji' => $totalParam,
|
||||||
|
'melebihi' => $melebihiBakuMutuEmisi,
|
||||||
|
'nilaispl' => $nilaiSpl
|
||||||
|
];
|
||||||
|
Ipal::updateNilaiSpl($idPelaporan, $data);
|
||||||
|
} else {
|
||||||
|
$data = [
|
||||||
|
'idmcpelaporan' => $idPelaporan,
|
||||||
|
'diuji' => $totalParam,
|
||||||
|
'melebihi' => $melebihiBakuMutuEmisi,
|
||||||
|
'nilaispl' => $nilaiSpl
|
||||||
|
];
|
||||||
|
Ipal::insertNilaiSpl($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate breadcrumb
|
||||||
|
*/
|
||||||
|
private function _generateBreadcrumb($module)
|
||||||
|
{
|
||||||
|
// Implementation of breadcrumb generation
|
||||||
|
return ['Home' => route('home'), 'Pelaporan' => route('pelaporan.index')];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if report is editable
|
||||||
|
*/
|
||||||
|
private function _isEditable($idPelaporan, $module)
|
||||||
|
{
|
||||||
|
// Implementation to check if report is editable
|
||||||
|
return Pelaporan::checkEditable($idPelaporan, $module);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Ipal Komunal status
|
||||||
|
*/
|
||||||
|
private function _getIpalKomunalStatus($idPelaporan)
|
||||||
|
{
|
||||||
|
return Spl_AL::getStatusMcKomunal($idPelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Lampiran SK
|
||||||
|
*/
|
||||||
|
private function _cekLampiranSk($idPelaporan, $skId)
|
||||||
|
{
|
||||||
|
return LampiranAL::cekLampiranSk($idPelaporan, $skId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update status IPAL Komunal
|
||||||
|
*/
|
||||||
|
private function _updateStatusIpalKomunal($idPelaporan, $status)
|
||||||
|
{
|
||||||
|
// Update IPAL komunal status
|
||||||
|
Spl_AL::updateStatusMcKomunal($idPelaporan, $status);
|
||||||
|
|
||||||
|
// If connected to IPAL komunal and has SK
|
||||||
|
if ($status == 'Iya') {
|
||||||
|
$sk = Lampiran::getKomponenByKode('SK');
|
||||||
|
if ($sk) {
|
||||||
|
$lampiranSk = $this->_cekLampiranSk($idPelaporan, $sk->id);
|
||||||
|
if ($lampiranSk) {
|
||||||
|
Pelaporan::updateNilaiSkl($idPelaporan, 2, 100);
|
||||||
|
Pelaporan::updateAvgSkl($idPelaporan);
|
||||||
|
Pelaporan::updateNilaiSpl($idPelaporan, 2, 100);
|
||||||
|
Pelaporan::updateAvgSpl($idPelaporan);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, calculate regular SPL value
|
||||||
|
$spl = Ipal::getNilaiSpl($idPelaporan);
|
||||||
|
|
||||||
|
if ($spl) {
|
||||||
|
Pelaporan::updateNilaiSpl($idPelaporan, 2, $spl->nilaispl);
|
||||||
|
} else {
|
||||||
|
Pelaporan::updateNilaiSpl($idPelaporan, 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pelaporan::updateAvgSpl($idPelaporan);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,746 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Pelaporan\AL;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Pelaporan;
|
||||||
|
use App\Models\Ipal;
|
||||||
|
use App\Models\IpalParameter;
|
||||||
|
use App\Models\Spl_AL;
|
||||||
|
use App\Models\NilaiKomponen;
|
||||||
|
use App\Models\Pelaporan\Lampiran;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller untuk Parameter Laporan Pengelolaan Air Limbah
|
||||||
|
*
|
||||||
|
* @author Muammar <official.muammar@gmail.com>
|
||||||
|
*/
|
||||||
|
class IpalParameterController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display parameter table
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function table($idMcIpal)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get IPAL data
|
||||||
|
$ipal = Ipal::getOneBy(['IpalId' => $idMcIpal]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'IpalId' => $idMcIpal,
|
||||||
|
'NamaIpal' => $ipal->nama
|
||||||
|
];
|
||||||
|
|
||||||
|
// If mcipal_parameter is empty, fill it based on refipal_parameter
|
||||||
|
$parameter = IpalParameter::getOneBy(['IpalId' => $idMcIpal]);
|
||||||
|
|
||||||
|
if (!$parameter) {
|
||||||
|
$refIpalParam = IpalParameter::getRefIpalParam($ipal->idrefipal);
|
||||||
|
|
||||||
|
if ($refIpalParam) {
|
||||||
|
foreach ($refIpalParam as $row) {
|
||||||
|
$dataMcIpalParam = [
|
||||||
|
'IpalId' => $idMcIpal,
|
||||||
|
'RefIpalParameterId' => $row->id,
|
||||||
|
'Nama' => $row->nama,
|
||||||
|
'Satuan' => $row->satuan,
|
||||||
|
'BakuMutuJenis' => $row->bakumutu_jenis,
|
||||||
|
'BakuMutuNilai1' => $row->bakumutu_nilai1,
|
||||||
|
'BakuMutuNilai2' => $row->bakumutu_nilai2,
|
||||||
|
'BatasEmisi' => $row->batasemisi
|
||||||
|
];
|
||||||
|
|
||||||
|
$idMcIpalParam = IpalParameter::insertMcIpalParam($dataMcIpalParam);
|
||||||
|
|
||||||
|
// Insert data to mchasiluji_al
|
||||||
|
$this->_insertHasilUji($idMcIpal, $idMcIpalParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_updateNilaiA6($ipal->idmcpelaporan);
|
||||||
|
$this->_updateNilaiA7($ipal->idmcpelaporan);
|
||||||
|
$this->_updateNilaiSpl($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
if (!$this->_cekIpalKomunal($ipal->idmcpelaporan)) {
|
||||||
|
$this->_updateNilaiSkl($ipal->idmcpelaporan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('pelaporan.ipal.parameter.index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get data for datatable
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function getData($idMcIpal)
|
||||||
|
{
|
||||||
|
$dataParameter = IpalParameter::getData($idMcIpal);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$no = 1;
|
||||||
|
|
||||||
|
foreach ($dataParameter as $row) {
|
||||||
|
if ($row->bakumutu_nilai2) {
|
||||||
|
$bakumutu = $row->bakumutu_nilai1 . ' - ' . $row->bakumutu_nilai2;
|
||||||
|
} else {
|
||||||
|
$bakumutu = $row->bakumutu_nilai1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[] = [
|
||||||
|
$no,
|
||||||
|
$row->nama,
|
||||||
|
$row->satuan,
|
||||||
|
$bakumutu,
|
||||||
|
($row->batasemisi != NULL ? floatval($row->batasemisi) : ''),
|
||||||
|
$row->id
|
||||||
|
];
|
||||||
|
|
||||||
|
$no++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'data' => $data,
|
||||||
|
'recordsTotal' => count($data)
|
||||||
|
];
|
||||||
|
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to add new parameter
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function add(Request $request, $idMcIpal)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('action')) {
|
||||||
|
$response = $this->_insertUpdate($idMcIpal, 'insert', $request);
|
||||||
|
|
||||||
|
$ipal = Ipal::getOneBy(['IpalId' => $idMcIpal]);
|
||||||
|
|
||||||
|
$this->_updateNilaiA6($ipal->idmcpelaporan);
|
||||||
|
$this->_updateNilaiA7($ipal->idmcpelaporan);
|
||||||
|
$this->_updateNilaiSpl($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
if (!$this->_cekIpalKomunal($ipal->idmcpelaporan)) {
|
||||||
|
$this->_updateNilaiSkl($ipal->idmcpelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['IpalId'] = $idMcIpal;
|
||||||
|
return view('pelaporan.ipal.parameter.add', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to edit parameter
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $idMcIpalParam
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function edit(Request $request, $idMcIpalParam)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('action')) {
|
||||||
|
$response = $this->_insertUpdate($idMcIpalParam, 'update', $request);
|
||||||
|
return response()->json($response);
|
||||||
|
} else {
|
||||||
|
$data['param'] = IpalParameter::getOneBy(['id' => $idMcIpalParam]);
|
||||||
|
return view('pelaporan.ipal.parameter.edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to delete parameter
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $idMcIpalParam
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function delete(Request $request, $idMcIpalParam)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('action')) {
|
||||||
|
$idRefIpalParam = IpalParameter::getOneBy(['id' => $idMcIpalParam])->idrefipal_parameter;
|
||||||
|
|
||||||
|
// Data for logging
|
||||||
|
$ipalParameter = IpalParameter::getOneBy(['id' => $idMcIpalParam]);
|
||||||
|
$idMcIpal = $ipalParameter->idmcipal;
|
||||||
|
$idMcPelaporan = Ipal::getOneBy(['id' => $idMcIpal])->idmcpelaporan;
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
$namaIpal = Ipal::getOneBy(['id' => $idMcIpal])->nama;
|
||||||
|
$namaIpalParameter = $ipalParameter->nama;
|
||||||
|
|
||||||
|
// Delete ipal parameter and hasiluji from database
|
||||||
|
IpalParameter::deleteMcIpalParam(['id' => $idMcIpalParam]);
|
||||||
|
Ipal::deleteHasilUji(['idmcipal_parameter' => $idMcIpalParam]);
|
||||||
|
|
||||||
|
if ($request->input('ref_delete')) {
|
||||||
|
IpalParameter::disableRefIpalParam($idRefIpalParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_updateNilaiA6($idMcPelaporan);
|
||||||
|
$this->_updateNilaiA7($idMcPelaporan);
|
||||||
|
$this->_updateNilaiSpl($idMcPelaporan);
|
||||||
|
|
||||||
|
if (!$this->_cekIpalKomunal($idMcPelaporan)) {
|
||||||
|
$this->_updateNilaiSkl($idMcPelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log activity
|
||||||
|
$aktivitas = 'Pelaporan AL - ' . $perusahaan->nama . ' - Tahun ' . $pelaporan->tahun . ' - Periode ' .
|
||||||
|
$pelaporan->periode . ' - Nama IPAL ' . $namaIpal . ' - Parameter Uji Lab ' .
|
||||||
|
$namaIpalParameter;
|
||||||
|
Log::info('LOG_DELETE', ['message' => $aktivitas, 'module' => 'pelaporan']);
|
||||||
|
|
||||||
|
$response = ['message' => 'Parameter Berhasil Dihapus', 'status' => 'success'];
|
||||||
|
return response()->json($response);
|
||||||
|
} else {
|
||||||
|
$param = IpalParameter::getOneBy(['id' => $idMcIpalParam]);
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $param->idmcipal]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'idmcipal_param' => $idMcIpalParam,
|
||||||
|
'nomor_ipal' => $ipal->nomor,
|
||||||
|
'nama_ipal' => $ipal->nama,
|
||||||
|
'nama_param' => $param->nama
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('pelaporan.ipal.parameter.delete', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to insert into or update table mcipal_parameter and refipal_parameter
|
||||||
|
*
|
||||||
|
* @param int $id if insert then $id = $idmcipal if update then $id = $idmcipal_parameter
|
||||||
|
* @param string $action insert or update
|
||||||
|
* @param Request $request
|
||||||
|
* @return array $response
|
||||||
|
*/
|
||||||
|
private function _insertUpdate($id, $action, Request $request)
|
||||||
|
{
|
||||||
|
$post = $request->all();
|
||||||
|
|
||||||
|
if ($post['nama'] !== "" && $post['satuan'] !== "") {
|
||||||
|
if ($post['bakumutu'] == 1) {
|
||||||
|
$bakumutuJenis = 'Angka Tunggal';
|
||||||
|
$bakumutuNilai1 = $post['angka_tunggal'];
|
||||||
|
$bakumutuNilai2 = '';
|
||||||
|
|
||||||
|
if (!is_numeric($bakumutuNilai1)) {
|
||||||
|
$response = ['message' => 'Data belum lengkap', 'status' => 'error'];
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(isset($post['batasemisi']) && $post['batasemisi'])) {
|
||||||
|
$response = ['message' => 'Beban pencemaran maksimum wajib diisi', 'status' => 'error'];
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
} else if ($post['bakumutu'] == 2) {
|
||||||
|
$bakumutuJenis = 'Rentang Angka';
|
||||||
|
$bakumutuNilai1 = $post['nilai1'];
|
||||||
|
$bakumutuNilai2 = $post['nilai2'];
|
||||||
|
|
||||||
|
if (!(is_numeric($bakumutuNilai1) && is_numeric($bakumutuNilai2))) {
|
||||||
|
$response = ['message' => 'Data belum lengkap', 'status' => 'error'];
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(isset($post['batasemisi']) && $post['batasemisi'])) {
|
||||||
|
$response = ['message' => 'Beban pencemaran maksimum wajib diisi', 'status' => 'error'];
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
} else if ($post['bakumutu'] == 3) {
|
||||||
|
$bakumutuJenis = 'Positif/Negatif';
|
||||||
|
$bakumutuNilai1 = $post['bakumutu_3'];
|
||||||
|
$bakumutuNilai2 = '';
|
||||||
|
|
||||||
|
if (!$bakumutuNilai1) {
|
||||||
|
$response = ['message' => 'Data belum lengkap', 'status' => 'error'];
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
} else if ($post['bakumutu'] == 4) {
|
||||||
|
$bakumutuJenis = 'Tanpa Baku Mutu';
|
||||||
|
$bakumutuNilai1 = '-';
|
||||||
|
$bakumutuNilai2 = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dataRefIpalParam = [
|
||||||
|
'nama' => $post['nama'],
|
||||||
|
'satuan' => $post['satuan'],
|
||||||
|
'bakumutu_jenis' => $bakumutuJenis,
|
||||||
|
'bakumutu_nilai1' => $bakumutuNilai1,
|
||||||
|
'bakumutu_nilai2' => $bakumutuNilai2,
|
||||||
|
'batasemisi' => (($post['bakumutu'] == 3 || $post['batasemisi'] === '') ? NULL : $post['batasemisi'])
|
||||||
|
];
|
||||||
|
|
||||||
|
$dataMcIpalParam = $dataRefIpalParam;
|
||||||
|
|
||||||
|
if ($action == 'insert') {
|
||||||
|
$idRefIpal = Ipal::getOneBy(['id' => $id])->idrefipal;
|
||||||
|
$dataRefIpalParam['idrefipal'] = $idRefIpal;
|
||||||
|
$dataRefIpalParam['del'] = 'n';
|
||||||
|
|
||||||
|
$idRefIpalParam = IpalParameter::insertRefIpalParam($dataRefIpalParam);
|
||||||
|
|
||||||
|
$dataMcIpalParam['idmcipal'] = $id;
|
||||||
|
$dataMcIpalParam['idrefipal_parameter'] = $idRefIpalParam;
|
||||||
|
|
||||||
|
$idMcIpalParam = IpalParameter::insertMcIpalParam($dataMcIpalParam);
|
||||||
|
|
||||||
|
// Insert data to mchasiluji_al
|
||||||
|
$this->_insertHasilUji($id, $idMcIpalParam);
|
||||||
|
|
||||||
|
// Log activity
|
||||||
|
$idMcPelaporan = Ipal::getOneBy(['id' => $id])->idmcpelaporan;
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
$namaIpal = Ipal::getOneBy(['id' => $id])->nama;
|
||||||
|
$namaIpalParameter = $dataMcIpalParam['nama'];
|
||||||
|
|
||||||
|
$aktivitas = 'Pelaporan AL - ' . $perusahaan->nama . ' - Tahun ' . $pelaporan->tahun . ' - Periode ' .
|
||||||
|
$pelaporan->periode . ' - Nama IPAL ' . $namaIpal . ' - Parameter Uji Lab ' .
|
||||||
|
$namaIpalParameter;
|
||||||
|
Log::info('LOG_CREATE', ['message' => $aktivitas, 'module' => 'pelaporan']);
|
||||||
|
} elseif ($action == 'update') {
|
||||||
|
IpalParameter::updateMcIpalParam($id, $dataMcIpalParam);
|
||||||
|
|
||||||
|
if (isset($post['ref_save'])) {
|
||||||
|
$idRefIpalParam = IpalParameter::getOneBy(['id' => $id])->idrefipal_parameter;
|
||||||
|
IpalParameter::updateRefIpalParam($idRefIpalParam, $dataRefIpalParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log activity
|
||||||
|
$ipalParameter = IpalParameter::getOneBy(['id' => $id]);
|
||||||
|
$idMcIpal = $ipalParameter->idmcipal;
|
||||||
|
$idMcPelaporan = Ipal::getOneBy(['id' => $idMcIpal])->idmcpelaporan;
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
$namaIpal = Ipal::getOneBy(['id' => $idMcIpal])->nama;
|
||||||
|
$namaIpalParameter = $ipalParameter->nama;
|
||||||
|
|
||||||
|
$aktivitas = 'Pelaporan AL - ' . $perusahaan->nama . ' - Tahun ' . $pelaporan->tahun . ' - Periode ' .
|
||||||
|
$pelaporan->periode . ' - Nama IPAL ' . $namaIpal . ' - Parameter Uji Lab ' .
|
||||||
|
$namaIpalParameter;
|
||||||
|
Log::info('LOG_EDIT', ['message' => $aktivitas, 'module' => 'pelaporan']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = ['message' => 'Parameter Berhasil Disimpan', 'status' => 'success'];
|
||||||
|
} else {
|
||||||
|
$response = ['message' => 'Data belum lengkap', 'status' => 'error'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert hasil uji for new parameter
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param int $idMcIpalParam
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _insertHasilUji($idMcIpal, $idMcIpalParam)
|
||||||
|
{
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
$dataHasilUji = [];
|
||||||
|
$bulan = 0;
|
||||||
|
|
||||||
|
if ($pelaporan->idrefperiodepelaporan == 1) {
|
||||||
|
$bulan = 1;
|
||||||
|
} elseif ($pelaporan->idrefperiodepelaporan == 2) {
|
||||||
|
$bulan = 4;
|
||||||
|
} elseif ($pelaporan->idrefperiodepelaporan == 3) {
|
||||||
|
$bulan = 7;
|
||||||
|
} elseif ($pelaporan->idrefperiodepelaporan == 4) {
|
||||||
|
$bulan = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
$dataHasilUji[] = [
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'tahun' => $pelaporan->tahun,
|
||||||
|
'idrefperusahaan' => $pelaporan->idrefperusahaan,
|
||||||
|
'idmcipal_parameter' => $idMcIpalParam,
|
||||||
|
'bulan' => $this->_mcMonth($bulan)
|
||||||
|
];
|
||||||
|
$bulan++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ipal::insertHasilUji($dataHasilUji);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai A6
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _updateNilaiA6($idMcPelaporan)
|
||||||
|
{
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$allIpal = Ipal::getData($idMcPelaporan);
|
||||||
|
|
||||||
|
$periode = $pelaporan->idrefperiodepelaporan;
|
||||||
|
$bulanAwal = (($periode - 1) * 3) + 1;
|
||||||
|
$jmlNilaiIpal = 0;
|
||||||
|
|
||||||
|
foreach ($allIpal as $row) {
|
||||||
|
$jmlNilaiParam = 0;
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
$filter = [
|
||||||
|
'idmcipal' => $row->id,
|
||||||
|
'bulan' => $this->_mcMonth($bulanAwal + $i),
|
||||||
|
'nilai !=' => 'NULL'
|
||||||
|
];
|
||||||
|
$hasilUji = Ipal::getHasilUjiBy($filter);
|
||||||
|
|
||||||
|
if ($hasilUji) {
|
||||||
|
$jmlNilaiParam += 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$nilaiIpal = $jmlNilaiParam / 3;
|
||||||
|
$jmlNilaiIpal += $nilaiIpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($allIpal)) {
|
||||||
|
$nilaiA6 = $jmlNilaiIpal / count($allIpal);
|
||||||
|
} else {
|
||||||
|
$nilaiA6 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$idRefKomponen = Ipal::getIdRefKomponen('A6');
|
||||||
|
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen
|
||||||
|
];
|
||||||
|
|
||||||
|
if (Ipal::getNilaiKomponen($filter)) {
|
||||||
|
$data = ['nilai' => $nilaiA6];
|
||||||
|
Ipal::updateNilaiKomponen($filter, $data);
|
||||||
|
} else {
|
||||||
|
$data = [
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen,
|
||||||
|
'idrefhasil' => 0,
|
||||||
|
'nilai' => $nilaiA6
|
||||||
|
];
|
||||||
|
Ipal::insertNilaiKomponen($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai A7
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _updateNilaiA7($idMcPelaporan)
|
||||||
|
{
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$allIpal = Ipal::getData($idMcPelaporan);
|
||||||
|
|
||||||
|
$periode = $pelaporan->idrefperiodepelaporan;
|
||||||
|
$bulanAwal = (($periode - 1) * 3) + 1;
|
||||||
|
$jmlNilaiIpal = 0;
|
||||||
|
|
||||||
|
foreach ($allIpal as $row) {
|
||||||
|
$jmlNilaiParam = 0;
|
||||||
|
$params = IpalParameter::getData($row->id);
|
||||||
|
$tambahNilai = false;
|
||||||
|
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
foreach ($params as $param) {
|
||||||
|
$filter = [
|
||||||
|
'idmcipal_parameter' => $param->id,
|
||||||
|
'bulan' => $this->_mcMonth($bulanAwal + $i)
|
||||||
|
];
|
||||||
|
$hasilUji = Ipal::getHasilUjiBy($filter);
|
||||||
|
$tambahNilai = false;
|
||||||
|
|
||||||
|
if ($hasilUji->nilai) {
|
||||||
|
if ($hasilUji->nilai == '*') {
|
||||||
|
$tambahNilai = true;
|
||||||
|
} elseif ($hasilUji->debit != NULL && $param->bakumutu_jenis != 'Positif/Negatif') {
|
||||||
|
if ($hasilUji->bebanemisi > $param->batasemisi) {
|
||||||
|
$tambahNilai = false;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$tambahNilai = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($param->bakumutu_jenis == 'Angka Tunggal') {
|
||||||
|
if ($hasilUji->nilai > $param->bakumutu_nilai1) {
|
||||||
|
$tambahNilai = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Rentang Angka') {
|
||||||
|
if ($hasilUji->nilai < $param->bakumutu_nilai1 || $hasilUji->nilai > $param->bakumutu_nilai2) {
|
||||||
|
$tambahNilai = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Positif/Negatif') {
|
||||||
|
if (strtolower($hasilUji->nilai) != strtolower($param->bakumutu_nilai1)) {
|
||||||
|
$tambahNilai = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tambahNilai = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$tambahNilai = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tambahNilai) {
|
||||||
|
$jmlNilaiParam += 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$nilaiIpal = $jmlNilaiParam / 3;
|
||||||
|
$jmlNilaiIpal += $nilaiIpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($allIpal)) {
|
||||||
|
$nilaiA7 = $jmlNilaiIpal / count($allIpal);
|
||||||
|
} else {
|
||||||
|
$nilaiA7 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$idRefKomponen = Ipal::getIdRefKomponen('A7');
|
||||||
|
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if (Ipal::getNilaiKomponen($filter)) {
|
||||||
|
$data = ['nilai' => $nilaiA7];
|
||||||
|
Ipal::updateNilaiKomponen($filter, $data);
|
||||||
|
} else {
|
||||||
|
$data = [
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen,
|
||||||
|
'idrefhasil' => 0,
|
||||||
|
'nilai' => $nilaiA7
|
||||||
|
];
|
||||||
|
|
||||||
|
Ipal::insertNilaiKomponen($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai SPL
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _updateNilaiSpl($idMcPelaporan)
|
||||||
|
{
|
||||||
|
$allIpal = Ipal::getData($idMcPelaporan);
|
||||||
|
$jmlParam = 0;
|
||||||
|
$memenuhiBakumutu = 0;
|
||||||
|
$memenuhiBatasEmisi = 0;
|
||||||
|
|
||||||
|
foreach ($allIpal as $ipal) {
|
||||||
|
$params = IpalParameter::getData($ipal->id);
|
||||||
|
$jmlParam += count($params);
|
||||||
|
|
||||||
|
$allHasilUji = Ipal::getAllHasilUjiBy([
|
||||||
|
'idmcipal' => $ipal->id,
|
||||||
|
'nilai !=' => NULL
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Check all hasil uji against bakumutu
|
||||||
|
foreach ($allHasilUji as $hasilUji) {
|
||||||
|
$param = IpalParameter::getOneBy(['id' => $hasilUji->idmcipal_parameter]);
|
||||||
|
|
||||||
|
if ($hasilUji->nilai == '*') {
|
||||||
|
$memenuhiBakumutu++;
|
||||||
|
} elseif ($hasilUji->debit != NULL && $param->bakumutu_jenis != 'Positif/Negatif') {
|
||||||
|
if ($hasilUji->bebanemisi <= $param->batasemisi) {
|
||||||
|
$memenuhiBatasEmisi++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($param->bakumutu_jenis == 'Angka Tunggal') {
|
||||||
|
if ($hasilUji->nilai <= $param->bakumutu_nilai1) {
|
||||||
|
$memenuhiBakumutu++;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Rentang Angka') {
|
||||||
|
if ($hasilUji->nilai >= $param->bakumutu_nilai1 && $hasilUji->nilai <= $param->bakumutu_nilai2) {
|
||||||
|
$memenuhiBakumutu++;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Positif/Negatif') {
|
||||||
|
if (strtolower($hasilUji->nilai) == strtolower($param->bakumutu_nilai1)) {
|
||||||
|
$memenuhiBakumutu++;
|
||||||
|
}
|
||||||
|
} elseif ($param->bakumutu_jenis == 'Tanpa Baku Mutu') {
|
||||||
|
$memenuhiBakumutu++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalParam = $jmlParam * 3;
|
||||||
|
$melebihiBakumutuEmisi = $totalParam - $memenuhiBakumutu - $memenuhiBatasEmisi;
|
||||||
|
|
||||||
|
if ($totalParam) {
|
||||||
|
$nilaiSpl = 100 - (($melebihiBakumutuEmisi / $totalParam) * 100);
|
||||||
|
} else {
|
||||||
|
$nilaiSpl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ipal::getNilaiSpl($idMcPelaporan)) {
|
||||||
|
$data = [
|
||||||
|
'diuji' => $totalParam,
|
||||||
|
'melebihi' => $melebihiBakumutuEmisi,
|
||||||
|
'nilaispl' => $nilaiSpl
|
||||||
|
];
|
||||||
|
Ipal::updateNilaiSpl($idMcPelaporan, $data);
|
||||||
|
} else {
|
||||||
|
$data = [
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'diuji' => $totalParam,
|
||||||
|
'melebihi' => $melebihiBakumutuEmisi,
|
||||||
|
'nilaispl' => $nilaiSpl
|
||||||
|
];
|
||||||
|
Ipal::insertNilaiSpl($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pelaporan::updateNilaiSpl($idMcPelaporan, 2, $nilaiSpl);
|
||||||
|
Pelaporan::getAvgSpl($idMcPelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if IPAL is komunal
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function _cekIpalKomunal($idMcPelaporan)
|
||||||
|
{
|
||||||
|
$ipalKomunal = Spl_AL::getStatusMcKomunal($idMcPelaporan);
|
||||||
|
|
||||||
|
if ($ipalKomunal) {
|
||||||
|
if ($ipalKomunal->tersambung == 'Iya') {
|
||||||
|
$sk = Lampiran::getKomponenByKode('SK');
|
||||||
|
if ($sk) {
|
||||||
|
$lampiranSk = Spl_AL::cekLampiranSk($idMcPelaporan, $sk->id);
|
||||||
|
if ($lampiranSk) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai SKL
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _updateNilaiSkl($idMcPelaporan)
|
||||||
|
{
|
||||||
|
$totalNilai1 = 0;
|
||||||
|
$totalNilai2 = 0;
|
||||||
|
$totalNilai3 = 0;
|
||||||
|
$kelompok1 = ['A1', 'A2', 'A3', 'A4'];
|
||||||
|
$kelompok2 = ['A5'];
|
||||||
|
$kelompok3 = ['A6', 'A7', 'A8', 'A9', 'A10'];
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
$komponen = 'A' . $i;
|
||||||
|
$idRefKomponen = Ipal::getIdRefKomponen($komponen);
|
||||||
|
|
||||||
|
$nilaiKomponen = Ipal::getNilaiKomponen([
|
||||||
|
'idmcpelaporan' => $idMcPelaporan,
|
||||||
|
'idrefkomponen' => $idRefKomponen,
|
||||||
|
'idmcipal' => NULL
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($nilaiKomponen) {
|
||||||
|
if (in_array($komponen, $kelompok1)) {
|
||||||
|
$totalNilai1 += $nilaiKomponen->nilai;
|
||||||
|
} elseif (in_array($komponen, $kelompok2)) {
|
||||||
|
$totalNilai2 += $nilaiKomponen->nilai;
|
||||||
|
} else {
|
||||||
|
$totalNilai3 += $nilaiKomponen->nilai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$skl = (15 * ($totalNilai1 / count($kelompok1)) / 100) +
|
||||||
|
(15 * ($totalNilai2 / count($kelompok2)) / 100) +
|
||||||
|
(70 * ($totalNilai3 / count($kelompok3)) / 100);
|
||||||
|
|
||||||
|
Pelaporan::updateNilaiSkl($idMcPelaporan, 2, $skl);
|
||||||
|
Pelaporan::updateAvgSkl($idMcPelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert month number to name
|
||||||
|
*
|
||||||
|
* @param int $monthNum
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function _mcMonth($monthNum)
|
||||||
|
{
|
||||||
|
$months = [
|
||||||
|
1 => 'January',
|
||||||
|
2 => 'February',
|
||||||
|
3 => 'March',
|
||||||
|
4 => 'April',
|
||||||
|
5 => 'May',
|
||||||
|
6 => 'June',
|
||||||
|
7 => 'July',
|
||||||
|
8 => 'August',
|
||||||
|
9 => 'September',
|
||||||
|
10 => 'October',
|
||||||
|
11 => 'November',
|
||||||
|
12 => 'December'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $months[$monthNum] ?? '';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,265 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Pelaporan\AL;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Pelaporan;
|
||||||
|
use App\Models\Ipal;
|
||||||
|
use App\Models\IpalParameter;
|
||||||
|
use App\Models\HasilUjiAL;
|
||||||
|
use App\Models\LampiranAL;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller untuk Lampiran Hasil Uji
|
||||||
|
*
|
||||||
|
* @author Beti Tuntari <beti.tuntari@gmail.com>
|
||||||
|
*/
|
||||||
|
class LampiranHasilUjiController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display and edit attachment form
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $bulan
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($idMcIpal, $bulan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get IPAL and pelaporan data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
// Determine if upload is allowed in current period
|
||||||
|
$blnAwal = (($pelaporan->idrefperiodepelaporan - 1) * 3) + 1;
|
||||||
|
$blnAkhir = $blnAwal + 3;
|
||||||
|
$editable = Pelaporan::checkEditable($ipal->idmcpelaporan, 'al') && Gate::allows('pelaporan.edit');
|
||||||
|
|
||||||
|
if (($bulan >= $blnAwal && $bulan <= $blnAkhir) && $editable) {
|
||||||
|
$enableUpload = 1;
|
||||||
|
} else {
|
||||||
|
$enableUpload = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'tahun' => $pelaporan->tahun,
|
||||||
|
'periode' => $pelaporan->periode,
|
||||||
|
'nama_ipal' => $ipal->nama,
|
||||||
|
'bulan' => $this->_mcMonth($bulan),
|
||||||
|
'enableUpload' => $enableUpload
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('pelaporan.ipal.lampiran', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload files via dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $bulan
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function uploadFile(Request $request, $idMcIpal, $bulan)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get IPAL and pelaporan data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
// Get upload directory
|
||||||
|
$dirUpload = $this->_getDirectory($pelaporan->id, $idMcIpal, 'al', 'A6', $bulan);
|
||||||
|
|
||||||
|
// Create directory if it doesn't exist
|
||||||
|
if (!Storage::disk('public')->exists($dirUpload)) {
|
||||||
|
Storage::disk('public')->makeDirectory($dirUpload, 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle file uploads
|
||||||
|
if ($request->hasFile('file')) {
|
||||||
|
$files = $request->file('file');
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$name = $file->getClientOriginalName();
|
||||||
|
$ext = $file->getClientOriginalExtension();
|
||||||
|
$baseName = pathinfo($name, PATHINFO_FILENAME);
|
||||||
|
$newName = $baseName . '_' . date('Ymd_His') . '.' . $ext;
|
||||||
|
|
||||||
|
$filePath = $file->storeAs($dirUpload, $newName, 'public');
|
||||||
|
$fullPath = storage_path('app/public/' . $filePath);
|
||||||
|
|
||||||
|
// Set file permissions
|
||||||
|
chmod($fullPath, 0777);
|
||||||
|
|
||||||
|
// Save file data to database
|
||||||
|
$data = [
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'tahun' => $pelaporan->tahun,
|
||||||
|
'idrefperusahaan' => $pelaporan->idrefperusahaan,
|
||||||
|
'bulan' => $bulan,
|
||||||
|
'dokumen' => $fullPath,
|
||||||
|
'tanggalunggah' => Carbon::now()->format('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
|
||||||
|
Ipal::saveLampiranHasilUji($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all uploaded files for dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function listFiles(Request $request)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!(Gate::allows('pelaporan.view') || Gate::allows('verifikasi.view'))) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get parameters from request
|
||||||
|
$idMcIpal = $request->input('idmcipal');
|
||||||
|
$bulan = $request->input('bulan');
|
||||||
|
|
||||||
|
// Get IPAL and pelaporan data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
// Get all attachments
|
||||||
|
$allLampiran = Ipal::getLampiranHasilUji([
|
||||||
|
'b.idrefipal' => $ipal->idrefipal,
|
||||||
|
'a.idrefperusahaan' => $pelaporan->idrefperusahaan,
|
||||||
|
'a.bulan' => $bulan,
|
||||||
|
'a.tahun' => $pelaporan->tahun
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($allLampiran as $lampiran) {
|
||||||
|
if (File::exists($lampiran->dokumen)) {
|
||||||
|
$pathExplode = explode('/', $lampiran->dokumen);
|
||||||
|
$obj = [
|
||||||
|
'name' => end($pathExplode),
|
||||||
|
'size' => File::size($lampiran->dokumen),
|
||||||
|
'path' => $lampiran->dokumen
|
||||||
|
];
|
||||||
|
$result[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete files from dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteFile(Request $request)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get parameters from request
|
||||||
|
$idMcIpal = $request->input('idmcipal');
|
||||||
|
$bulan = $request->input('bulan');
|
||||||
|
$fileName = $request->input('fileName');
|
||||||
|
|
||||||
|
// Get IPAL data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
|
||||||
|
// Get upload directory
|
||||||
|
$dirUpload = storage_path('app/public/') . $this->_getDirectory($ipal->idmcpelaporan, $idMcIpal, 'al', 'A6', $bulan);
|
||||||
|
|
||||||
|
// Delete file
|
||||||
|
$fullPath = $dirUpload . basename($fileName);
|
||||||
|
if (File::exists($fullPath)) {
|
||||||
|
File::delete($fullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete from database
|
||||||
|
$filter = [
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'bulan' => $bulan,
|
||||||
|
'dokumen' => $dirUpload . basename($fileName)
|
||||||
|
];
|
||||||
|
|
||||||
|
Ipal::deleteLampiranHasilUji($filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get directory for file storage
|
||||||
|
*
|
||||||
|
* @param int $idMcPelaporan
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $kodeRefPelaporan
|
||||||
|
* @param string $kodeKomponen
|
||||||
|
* @param string $bulan
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function _getDirectory($idMcPelaporan, $idMcIpal, $kodeRefPelaporan, $kodeKomponen, $bulan)
|
||||||
|
{
|
||||||
|
$pelaporan = Pelaporan::findOrFail($idMcPelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
|
||||||
|
$notAllowedChar = [' ', '.', '/', '-', ',', ':'];
|
||||||
|
|
||||||
|
$noInduk = $perusahaan->nomorinduk;
|
||||||
|
$noIpal = $ipal->nomor;
|
||||||
|
$tahun = $pelaporan->tahun;
|
||||||
|
$periode = strtolower(str_replace($notAllowedChar, '_', $pelaporan->periode));
|
||||||
|
|
||||||
|
$dirUpload = 'data_perusahaan/' . $noInduk . '/lampiran' . '/' . $kodeRefPelaporan . '/' .
|
||||||
|
$kodeKomponen . '/' . $tahun . '_' . $periode . '/lampiran_hasiluji' . '/' .
|
||||||
|
$bulan . '/' . $noIpal . '/';
|
||||||
|
|
||||||
|
return $dirUpload;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert month number to name
|
||||||
|
*
|
||||||
|
* @param int $monthNum
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function _mcMonth($monthNum)
|
||||||
|
{
|
||||||
|
$months = [
|
||||||
|
1 => 'January',
|
||||||
|
2 => 'February',
|
||||||
|
3 => 'March',
|
||||||
|
4 => 'April',
|
||||||
|
5 => 'May',
|
||||||
|
6 => 'June',
|
||||||
|
7 => 'July',
|
||||||
|
8 => 'August',
|
||||||
|
9 => 'September',
|
||||||
|
10 => 'October',
|
||||||
|
11 => 'November',
|
||||||
|
12 => 'December'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $months[$monthNum] ?? '';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,319 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Pelaporan\AL;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Pelaporan;
|
||||||
|
use App\Models\Ipal;
|
||||||
|
use App\Models\IpalParameter;
|
||||||
|
use App\Models\Pelaporan\Lampiran;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller untuk Lampiran Komponen di Persyaratan Teknis
|
||||||
|
*
|
||||||
|
* @author Beti Tuntari <beti.tuntari@gmail.com>
|
||||||
|
*/
|
||||||
|
class LampiranSyaratTeknisController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display and edit technical requirements attachment form
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $kodeKomponen
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($idMcIpal, $kodeKomponen)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get models data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'nama_ipal' => $ipal->nama,
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'editable' => Pelaporan::checkEditable($ipal->idmcpelaporan, 'al') && Gate::allows('pelaporan.edit'),
|
||||||
|
'kode_komponen' => $kodeKomponen,
|
||||||
|
'nama_komponen' => Lampiran::getKomponenByKode($kodeKomponen)->nama
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('pelaporan.ipal.lampiran_syarat_teknis', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload files via dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $kodeKomponen
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function uploadFile(Request $request, $idMcIpal, $kodeKomponen)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get IPAL data
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
|
||||||
|
// Get upload directory
|
||||||
|
$dirUpload = $this->_getDirectory($idMcIpal, $kodeKomponen);
|
||||||
|
|
||||||
|
// Create directory if it doesn't exist
|
||||||
|
if (!Storage::disk('public')->exists($dirUpload)) {
|
||||||
|
Storage::disk('public')->makeDirectory($dirUpload, 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle file uploads
|
||||||
|
if ($request->hasFile('file')) {
|
||||||
|
$files = $request->file('file');
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$name = $file->getClientOriginalName();
|
||||||
|
$ext = $file->getClientOriginalExtension();
|
||||||
|
$baseName = pathinfo($name, PATHINFO_FILENAME);
|
||||||
|
$newName = $baseName . '_' . date('Ymd_His') . '.' . $ext;
|
||||||
|
|
||||||
|
$filePath = $file->storeAs($dirUpload, $newName, 'public');
|
||||||
|
$fullPath = storage_path('app/public/' . $filePath);
|
||||||
|
|
||||||
|
// Set file permissions
|
||||||
|
chmod($fullPath, 0777);
|
||||||
|
|
||||||
|
// Save file data to database
|
||||||
|
if ($kodeKomponen != 'A5') {
|
||||||
|
$idRefKomponen = Lampiran::getKomponenByKode($kodeKomponen)->id;
|
||||||
|
$insert = [
|
||||||
|
'PelapranId' => $ipal->idmcpelaporan,
|
||||||
|
'IpalId' => $idMcIpal,
|
||||||
|
'KomponenId' => $idRefKomponen,
|
||||||
|
'Dokumen' => $fullPath,
|
||||||
|
'TanggalUnggah' => Carbon::now()->format('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
|
||||||
|
Lampiran::saveFile($insert);
|
||||||
|
} else {
|
||||||
|
// For A5, update IPAL's lampiran field
|
||||||
|
if ($ipal->lampiran && File::exists($ipal->lampiran)) {
|
||||||
|
File::delete($ipal->lampiran);
|
||||||
|
}
|
||||||
|
Ipal::editMcIpal($idMcIpal, ['Lamapiran' => $fullPath]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all uploaded files for dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function listFiles(Request $request)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get parameters from request
|
||||||
|
$idMcIpal = $request->input('idmcipal');
|
||||||
|
$kodeKomponen = $request->input('kode_komponen');
|
||||||
|
$idRefKomponen = Lampiran::getKomponenByKode($kodeKomponen)->id;
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
// Get all attachments
|
||||||
|
if ($kodeKomponen != 'A5') {
|
||||||
|
$allLampiran = Lampiran::getLampiran([
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'idrefkomponen' => $idRefKomponen
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($allLampiran as $lampiran) {
|
||||||
|
if (File::exists($lampiran->dokumen)) {
|
||||||
|
$pathExplode = explode('/', $lampiran->dokumen);
|
||||||
|
$obj = [
|
||||||
|
'name' => end($pathExplode),
|
||||||
|
'size' => File::size($lampiran->dokumen),
|
||||||
|
'path' => $lampiran->dokumen
|
||||||
|
];
|
||||||
|
$result[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// For A5, get from IPAL's lampiran field
|
||||||
|
$lampiran = $ipal->lampiran;
|
||||||
|
if ($lampiran && File::exists($lampiran)) {
|
||||||
|
$pathExplode = explode('/', $lampiran);
|
||||||
|
$obj = [
|
||||||
|
'name' => end($pathExplode),
|
||||||
|
'size' => File::size($lampiran),
|
||||||
|
'path' => $lampiran
|
||||||
|
];
|
||||||
|
$result[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete files from dropzone
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteFile(Request $request)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.edit')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get parameters from request
|
||||||
|
$filePath = $request->input('filePath');
|
||||||
|
$idMcIpal = $request->input('idmcipal');
|
||||||
|
$kodeKomponen = $request->input('kode_komponen');
|
||||||
|
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$idRefKomponen = Lampiran::getKomponenByKode($kodeKomponen)->id;
|
||||||
|
|
||||||
|
if ($kodeKomponen != 'A5') {
|
||||||
|
// Delete file physically
|
||||||
|
if (File::exists($filePath)) {
|
||||||
|
File::delete($filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete from database
|
||||||
|
$filter = [
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'idrefkomponen' => $idRefKomponen,
|
||||||
|
'dokumen' => $filePath
|
||||||
|
];
|
||||||
|
|
||||||
|
Lampiran::deleteFile($filter);
|
||||||
|
} else {
|
||||||
|
// For A5, clear IPAL's lampiran field
|
||||||
|
if ($ipal->lampiran && File::exists($ipal->lampiran)) {
|
||||||
|
File::delete($ipal->lampiran);
|
||||||
|
}
|
||||||
|
Ipal::editMcIpal($idMcIpal, ['lampiran' => '']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if attachments exist
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $kodeKomponen
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function cekAdaLampiran($idMcIpal, $kodeKomponen)
|
||||||
|
{
|
||||||
|
// Check authorization
|
||||||
|
if (!Gate::allows('pelaporan.view')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
|
||||||
|
if ($kodeKomponen == 'all') {
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $ipal->idmcpelaporan,
|
||||||
|
'idmcipal' => $idMcIpal
|
||||||
|
];
|
||||||
|
|
||||||
|
$allLampiran = Lampiran::getLampiran($filter);
|
||||||
|
$idA5 = Lampiran::getKomponenByKode('A5')->id;
|
||||||
|
|
||||||
|
$lampiranExists = [];
|
||||||
|
|
||||||
|
foreach ($allLampiran as $lampiran) {
|
||||||
|
if ($lampiran->idrefkomponen != $idA5) {
|
||||||
|
if (File::exists($lampiran->dokumen)) {
|
||||||
|
if (!in_array($lampiran->idrefkomponen, $lampiranExists)) {
|
||||||
|
array_push($lampiranExists, $lampiran->idrefkomponen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ipal->lampiran && File::exists($ipal->lampiran)) {
|
||||||
|
array_push($lampiranExists, $idA5);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $lampiranExists;
|
||||||
|
} else {
|
||||||
|
$idRefKomponen = Lampiran::getKomponenByKode($kodeKomponen)->id;
|
||||||
|
|
||||||
|
$response = ['lampiran' => false, 'refkomponen' => $idRefKomponen];
|
||||||
|
|
||||||
|
if ($kodeKomponen != 'A5') {
|
||||||
|
$filter = [
|
||||||
|
'idmcpelaporan' => $ipal->idmcpelaporan,
|
||||||
|
'idmcipal' => $idMcIpal,
|
||||||
|
'idrefkomponen' => $idRefKomponen
|
||||||
|
];
|
||||||
|
$allLampiran = Lampiran::getLampiran($filter);
|
||||||
|
|
||||||
|
if ($allLampiran) {
|
||||||
|
foreach ($allLampiran as $lampiran) {
|
||||||
|
if (File::exists($lampiran->dokumen)) {
|
||||||
|
$response['lampiran'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($ipal->lampiran && File::exists($ipal->lampiran)) {
|
||||||
|
$response['lampiran'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get directory for file storage
|
||||||
|
*
|
||||||
|
* @param int $idMcIpal
|
||||||
|
* @param string $kodeKomponen
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function _getDirectory($idMcIpal, $kodeKomponen)
|
||||||
|
{
|
||||||
|
$ipal = Ipal::getOneBy(['id' => $idMcIpal]);
|
||||||
|
$pelaporan = Pelaporan::findOrFail($ipal->idmcpelaporan);
|
||||||
|
$perusahaan = Pelaporan::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
|
||||||
|
$notAllowedChar = [' ', '.', '/', '-', ',', ':'];
|
||||||
|
|
||||||
|
$noInduk = $perusahaan->nomorinduk;
|
||||||
|
$tahun = $pelaporan->tahun;
|
||||||
|
$periode = strtolower(str_replace($notAllowedChar, '_', $pelaporan->periode));
|
||||||
|
$kodeRefPelaporan = 'al';
|
||||||
|
$ipalName = str_replace($notAllowedChar, '_', $ipal->nama);
|
||||||
|
|
||||||
|
$dirUpload = 'data_perusahaan/' . $noInduk . '/lampiran' . '/' . $kodeRefPelaporan . '/' .
|
||||||
|
$tahun . '_' . $periode . '/' . $ipalName . '/' . $kodeKomponen . '/';
|
||||||
|
|
||||||
|
return $dirUpload;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,19 +2,141 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Pelaporan;
|
||||||
|
use App\Models\PeriodePelaporan;
|
||||||
|
use App\Models\Perusahaan;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
|
|
||||||
class PelaporanALController extends Controller
|
class PelaporanALController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
|
||||||
|
public function index(){
|
||||||
|
try {
|
||||||
|
// Mendapatkan data perusahaan dan periode pelaporan
|
||||||
|
$companies = Perusahaan::all();
|
||||||
|
$periodes = PeriodePelaporan::all();
|
||||||
|
|
||||||
|
// Mendapatkan pelaporan dengan relasi perusahaan dan periode
|
||||||
|
$pelaporan = Pelaporan::with(['Perusahaan', 'PeriodePelaporan'])->get();
|
||||||
|
|
||||||
|
return Inertia::render('admin/pelaporan/AL/index_AL', [
|
||||||
|
'companies' => $companies,
|
||||||
|
'periodes' => $periodes,
|
||||||
|
'pelaporan' => $pelaporan,
|
||||||
|
]);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error('Error fetching data for PelaporanALController index: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat mengambil data laporan.');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Unexpected error in PelaporanALController index: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan tak terduga.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function indexIpal()
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
// return Inertia::render('admin/pelaporan/AL/index_AL_IPAL');
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// Log::error('Error rendering view: ' . $e->getMessage());
|
||||||
|
// return back()->with('error', 'Something went wrong.');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function indexIpal(){
|
||||||
|
try {
|
||||||
|
// Data IPAL
|
||||||
|
$ipals = Pelaporan::all();
|
||||||
|
|
||||||
|
return Inertia::render('admin/pelaporan/AL/index_AL_IPAL', [
|
||||||
|
'ipals' => $ipals,
|
||||||
|
]);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error('Error fetching data for IPAL in PelaporanALController indexIpal: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat mengambil data IPAL.');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Unexpected error in PelaporanALController indexIpal: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan tak terduga.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return Inertia::render('admin/pelaporan/AL/index_AL');
|
// Validasi input
|
||||||
} catch (\Exception $e) {
|
$request->validate([
|
||||||
Log::error('Error rendering view: ' . $e->getMessage());
|
'company_id' => 'required|exists:perusahaan,id',
|
||||||
return back()->with('error', 'Something went wrong.');
|
'period_id' => 'required|exists:periode_pelaporan,id',
|
||||||
|
'tahun' => 'required|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Membuat pelaporan baru
|
||||||
|
Pelaporan::create([
|
||||||
|
'PerusahaanId' => $request->company_id,
|
||||||
|
'PeriodePelaporanId' => $request->period_id,
|
||||||
|
'Tahun' => $request->tahun,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('pelaporan.index')->with('success', 'Pelaporan berhasil ditambahkan.');
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error('Error while storing Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat menambahkan pelaporan.');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Unexpected error while storing Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan tak terduga.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Validasi input
|
||||||
|
$request->validate([
|
||||||
|
'company_id' => 'required|exists:perusahaan,id',
|
||||||
|
'period_id' => 'required|exists:periode_pelaporan,id',
|
||||||
|
'tahun' => 'required|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Menemukan pelaporan berdasarkan ID
|
||||||
|
$pelaporan = Pelaporan::findOrFail($id);
|
||||||
|
|
||||||
|
// Mengupdate data pelaporan
|
||||||
|
$pelaporan->update([
|
||||||
|
'PerusahaanId' => $request->company_id,
|
||||||
|
'PeriodePelaporanId' => $request->period_id,
|
||||||
|
'Tahun' => $request->tahun,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('pelaporan.index')->with('success', 'Pelaporan berhasil diperbarui.');
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error('Error while updating Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat memperbarui pelaporan.');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Unexpected error while updating Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan tak terduga.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Menemukan pelaporan berdasarkan ID
|
||||||
|
$pelaporan = Pelaporan::findOrFail($id);
|
||||||
|
|
||||||
|
// Menghapus pelaporan
|
||||||
|
$pelaporan->delete();
|
||||||
|
|
||||||
|
return redirect()->route('pelaporan.index')->with('success', 'Pelaporan berhasil dihapus.');
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error('Error while deleting Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat menghapus pelaporan.');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Unexpected error while deleting Pelaporan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Terjadi kesalahan tak terduga.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,43 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Pelaporan;
|
||||||
|
use App\Models\PeriodePelaporan;
|
||||||
|
use App\Models\Perusahaan;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
|
|
||||||
class PelaporanController extends Controller
|
class PelaporanController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
// public function index()
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
// return Inertia::render('admin/pelaporan/index_pelaporan');
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// Log::error('Error rendering view: ' . $e->getMessage());
|
||||||
|
// return back()->with('error', 'Something went wrong.');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
// Ambil data perusahaan
|
||||||
return Inertia::render('admin/pelaporan/index_pelaporan');
|
$companies = Perusahaan::select('PerusahaanId', 'NamaPerusahaan')->get();
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error('Error rendering view: ' . $e->getMessage());
|
// Ambil data periode (misalnya Triwulan)
|
||||||
return back()->with('error', 'Something went wrong.');
|
// Pastikan model PeriodePelaporan memiliki field 'NamaPeriode' atau 'Triwulan'
|
||||||
}
|
$periodes = PeriodePelaporan::select('PeriodePelaporanId', 'Nama')->get();
|
||||||
|
|
||||||
|
// Ambil data pelaporan lengkap dengan relasi perusahaan dan periode pelaporan
|
||||||
|
// (Sesuaikan nama relasinya dengan yang ada di model Pelaporan)
|
||||||
|
$pelaporan = Pelaporan::with(['perusahaan', 'periodePelaporan'])->get();
|
||||||
|
|
||||||
|
// Kirim data ke Inertia
|
||||||
|
return Inertia::render('admin/pelaporan/index_pelaporan', [
|
||||||
|
'companies' => $companies,
|
||||||
|
'periodes' => $periodes,
|
||||||
|
'pelaporan' => $pelaporan,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,15 @@ class PostController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$posts = Post::with(['kategori', 'subkategori'])->latest()->get();
|
$posts = Post::with(['kategori', 'subkategori'])->latest()->get();
|
||||||
|
|
||||||
|
// Transform posts to include proper image URLs
|
||||||
|
$posts = $posts->map(function ($post) {
|
||||||
|
if ($post->ImagePost) {
|
||||||
|
$post->ImagePost = Storage::url($post->ImagePost);
|
||||||
|
}
|
||||||
|
return $post;
|
||||||
|
});
|
||||||
|
|
||||||
$kategori = Kategori::all();
|
$kategori = Kategori::all();
|
||||||
$subkategori = SubKategori::all();
|
$subkategori = SubKategori::all();
|
||||||
|
|
||||||
|
@ -56,7 +65,18 @@ class PostController extends Controller
|
||||||
throw new \Exception('Invalid image file');
|
throw new \Exception('Invalid image file');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['ImagePost'] = $file->store('images/posts', 'public');
|
Log::info('Uploading file to Minio', [
|
||||||
|
'filename' => $file->getClientOriginalName(),
|
||||||
|
'mimetype' => $file->getMimeType(),
|
||||||
|
'size' => $file->getSize()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data['ImagePost'] = $file->store('images/posts', 's3');
|
||||||
|
|
||||||
|
Log::info('File uploaded to Minio', [
|
||||||
|
'path' => $data['ImagePost'],
|
||||||
|
'url' => Storage::url($data['ImagePost'])
|
||||||
|
]);
|
||||||
|
|
||||||
if ($data['ImagePost'] === false) {
|
if ($data['ImagePost'] === false) {
|
||||||
throw new \Exception('Failed to store image');
|
throw new \Exception('Failed to store image');
|
||||||
|
@ -73,8 +93,8 @@ class PostController extends Controller
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
if (isset($data['ImagePost']) && Storage::disk('public')->exists($data['ImagePost'])) {
|
if (isset($data['ImagePost']) && Storage::disk('s3')->exists($data['ImagePost'])) {
|
||||||
Storage::disk('public')->delete($data['ImagePost']);
|
Storage::disk('s3')->delete($data['ImagePost']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::error('Error creating post: ' . $e->getMessage());
|
Log::error('Error creating post: ' . $e->getMessage());
|
||||||
|
@ -101,7 +121,7 @@ class PostController extends Controller
|
||||||
return Inertia::render('admin/post/edit_post', [
|
return Inertia::render('admin/post/edit_post', [
|
||||||
'posting' => [
|
'posting' => [
|
||||||
...$post->toArray(),
|
...$post->toArray(),
|
||||||
'ImagePost' => $post->ImagePost ? '/storage/' . $post->ImagePost : null,
|
'ImagePost' => $post->ImagePost ? Storage::url($post->ImagePost) : null,
|
||||||
],
|
],
|
||||||
'kategori' => Kategori::all(),
|
'kategori' => Kategori::all(),
|
||||||
'subkategori' => SubKategori::all(),
|
'subkategori' => SubKategori::all(),
|
||||||
|
@ -112,47 +132,61 @@ class PostController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(PostRequest $request, Post $post)
|
public function update(PostRequest $request, Post $post)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$data = $request->validated();
|
$data = $request->validated();
|
||||||
|
|
||||||
// Update gambar hanya jika ada file baru yang diupload
|
// Update gambar hanya jika ada file baru yang diupload
|
||||||
if ($request->hasFile('ImagePost')) {
|
if ($request->hasFile('ImagePost')) {
|
||||||
// Hapus gambar lama jika ada
|
// Hapus gambar lama jika ada
|
||||||
if ($post->ImagePost && Storage::disk('public')->exists($post->ImagePost)) {
|
if ($post->ImagePost && Storage::disk('s3')->exists($post->ImagePost)) {
|
||||||
Storage::disk('public')->delete($post->ImagePost);
|
Log::info('Deleting old image from Minio', ['path' => $post->ImagePost]);
|
||||||
|
Storage::disk('s3')->delete($post->ImagePost);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file('ImagePost');
|
||||||
|
Log::info('Uploading new image to Minio', [
|
||||||
|
'filename' => $file->getClientOriginalName(),
|
||||||
|
'mimetype' => $file->getMimeType(),
|
||||||
|
'size' => $file->getSize()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data['ImagePost'] = $file->store('images/posts', 's3');
|
||||||
|
|
||||||
|
Log::info('New image uploaded to Minio', [
|
||||||
|
'path' => $data['ImagePost'],
|
||||||
|
'url' => Storage::url($data['ImagePost'])
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// Jika tidak ada file baru, jangan update field ImagePost
|
||||||
|
unset($data['ImagePost']);
|
||||||
}
|
}
|
||||||
$data['ImagePost'] = $request->file('ImagePost')->store('images/posts', 'public');
|
|
||||||
} else {
|
// Pastikan nilai is_publish dikonversi ke boolean
|
||||||
// Jika tidak ada file baru, jangan update field ImagePost
|
$data['IsPublish'] = filter_var($request->input('IsPublish'), FILTER_VALIDATE_BOOLEAN);
|
||||||
unset($data['ImagePost']);
|
|
||||||
|
$post->update($data);
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return redirect()->route('admin.post.index')->with('success', 'Post berhasil diperbarui.');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::error('Error updating Post: ' . $e->getMessage());
|
||||||
|
Log::info('Form data received:', [
|
||||||
|
'IsPublish' => $request->input('IsPublish'),
|
||||||
|
'IsPublishType' => gettype($request->input('IsPublish')),
|
||||||
|
'hasFile' => $request->hasFile('ImagePost')
|
||||||
|
]);
|
||||||
|
return back()->with('error', 'Terjadi kesalahan saat memperbarui post.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pastikan nilai is_publish dikonversi ke boolean
|
|
||||||
$data['IsPublish'] = filter_var($request->input('IsPublish'), FILTER_VALIDATE_BOOLEAN);
|
|
||||||
|
|
||||||
$post->update($data);
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return redirect()->route('admin.post.index')->with('success', 'Post berhasil diperbarui.');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
Log::error('Error updating Post: ' . $e->getMessage());
|
|
||||||
Log::info('Form data received:', [
|
|
||||||
'IsPublish' => $request->input('IsPublish'),
|
|
||||||
'IsPublishType' => gettype($request->input('IsPublish')),
|
|
||||||
'hasFile' => $request->hasFile('ImagePost')
|
|
||||||
]);
|
|
||||||
return back()->with('error', 'Terjadi kesalahan saat memperbarui post.');
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function destroy(Post $post)
|
public function destroy(Post $post)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Storage::disk('public')->delete($post->ImagePost);
|
Storage::disk('s3')->delete($post->ImagePost);
|
||||||
$post->delete();
|
$post->delete();
|
||||||
|
|
||||||
return redirect()->route('admin.post.index')->with('success', 'Post berhasil dihapus.');
|
return redirect()->route('admin.post.index')->with('success', 'Post berhasil dihapus.');
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Requests\HistoryKegiatanRequest;
|
||||||
|
use App\Http\Requests\RefHistoryKegiatanRequest;
|
||||||
|
use App\Models\RefHistoryKegiatan;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
class RefHistoryKegiatanController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$refhistorykegiatan = RefHistoryKegiatan::latest()->get();
|
||||||
|
return Inertia::render('admin/kegiatan/index_refhistory_kegiatan', ['refhistorykegiatan' => $refhistorykegiatan]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error fetching Ref History Kegiatan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Something went wrong.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(RefHistoryKegiatanRequest $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$refhistorykegiatan = RefHistoryKegiatan::withTrashed()
|
||||||
|
->where('NamaHistoryKegiatan', $request->NamaHistoryKegiatan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($refhistorykegiatan) {
|
||||||
|
$refhistorykegiatan->restore();
|
||||||
|
return redirect()->route('admin.refhistorykegiatan.index')->with('success', 'Ref History Kegiatan berhasil dikembalikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
RefHistoryKegiatan::create($request->validated());
|
||||||
|
|
||||||
|
return redirect()->route('admin.refhistorykegiatan.index')->with('success', 'Ref History Kegiatan berhasil dibuat.');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error creating Ref History Kegiatan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Something went wrong.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(RefHistoryKegiatanRequest $request, RefHistoryKegiatan $refhistorykegiatan)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$refhistorykegiatan->update($request->validated());
|
||||||
|
return redirect()->route('admin.refhistorykegiatan.index')->with('success', 'Ref History Kegiatan berhasil diperbarui.');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error updating Ref History Kegiatan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Something went wrong.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(RefHistoryKegiatan $refhistorykegiatan)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$refhistorykegiatan->delete();
|
||||||
|
return redirect()->route('admin.refhistorykegiatan.index')->with('success', 'Ref History Kegiatan berhasil dihapus.');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error deleting Ref History Kegiatan: ' . $e->getMessage());
|
||||||
|
return back()->with('error', 'Something went wrong.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ class HistoryPerusahaanRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'PerusahaanId' => 'required|integer',
|
'PerusahaanId' => 'required|integer',
|
||||||
'HistoryKegiatanId' => 'required|integer',
|
'RefHistoryKegiatanId' => 'required|integer',
|
||||||
'TanggalHistory' => 'required|date',
|
'TanggalHistory' => 'required|date',
|
||||||
'NomorHistory' => 'nullable|string|max:100',
|
'NomorHistory' => 'nullable|string|max:100',
|
||||||
'KeteranganHistory' => 'nullable|string',
|
'KeteranganHistory' => 'nullable|string',
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace App\Http\Requests;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class HistoryKegiatanRequest extends FormRequest
|
class RefHistoryKegiatanRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
|
@ -27,7 +27,7 @@ class HistoryKegiatanRequest extends FormRequest
|
||||||
'required',
|
'required',
|
||||||
'string',
|
'string',
|
||||||
'max:255',
|
'max:255',
|
||||||
Rule::unique('HistoryKegiatan', 'NamaHistoryKegiatan')->whereNull('deleted_at') // Abaikan data yang dihapus (soft delete)
|
Rule::unique('RefHistoryKegiatan', 'NamaHistoryKegiatan')->whereNull('deleted_at') // Abaikan data yang dihapus (soft delete)
|
||||||
],
|
],
|
||||||
'IsPublish' => 'boolean',
|
'IsPublish' => 'boolean',
|
||||||
];
|
];
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Catatan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Catatan';
|
||||||
|
|
||||||
|
protected $primaryKey = 'CatatanId';
|
||||||
|
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefPelaporanId',
|
||||||
|
'IsiCatatan',
|
||||||
|
'Evaluasi',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefPelaporan.
|
||||||
|
*/
|
||||||
|
public function refPelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefPelaporan::class, 'RefPelaporanId', 'RefPelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Cerobong extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Cerobong';
|
||||||
|
|
||||||
|
protected $primaryKey = 'CerobongId';
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefCerobongId',
|
||||||
|
'Kode',
|
||||||
|
'Nama',
|
||||||
|
'SumberEmisi',
|
||||||
|
'JenisBahanBakar',
|
||||||
|
'Konsumsi',
|
||||||
|
'Bentuk',
|
||||||
|
'Tinggi',
|
||||||
|
'Diameter',
|
||||||
|
'Posisi',
|
||||||
|
'JenisPengendali',
|
||||||
|
'JamOperasional',
|
||||||
|
'Kapasitas',
|
||||||
|
'SatuanKapasitas',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefCerobong.
|
||||||
|
*/
|
||||||
|
public function refCerobong()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefCerobong::class, 'RefCerobongId', 'RefCerobongId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CerobongParameter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'CerobongParameter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'CerobongParameterId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'CerobongId',
|
||||||
|
'RefCerobongParameterId',
|
||||||
|
'Nama',
|
||||||
|
'Satuan',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'Del',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Cerobong.
|
||||||
|
*/
|
||||||
|
public function cerobong()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Cerobong::class, 'CerobongId', 'CerobongId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefCerobongParameter.
|
||||||
|
*/
|
||||||
|
public function refCerobongParameter()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefCerobongParameter::class, 'RefCerobongParameterId', 'RefCerobongParameterId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ChoicesLP extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Evaluasi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Evaluasi';
|
||||||
|
|
||||||
|
protected $primaryKey = 'EvaluasiId';
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'DokumenEval',
|
||||||
|
'TipeDokumen',
|
||||||
|
'Email',
|
||||||
|
'TanggalKirim',
|
||||||
|
'Oleh',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GroupHasil extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'GroupHasil';
|
||||||
|
|
||||||
|
protected $primaryKey = 'GroupHasilId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'HasilId',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function hasil()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Hasil::class, 'HasilId', 'HasilId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GroupPerusahaan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'GroupPerusahaan';
|
||||||
|
|
||||||
|
protected $primaryKey = 'GroupPerusahaanId';
|
||||||
|
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'UserId',
|
||||||
|
'PermissionId',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model User.
|
||||||
|
*/
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'UserId', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Hasil extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Hasil';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaHasil',
|
||||||
|
'NilaiHasil',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiAL extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiAL';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiALId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'IpalId',
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'IpalParameterId',
|
||||||
|
'Bulan',
|
||||||
|
'Nilai',
|
||||||
|
'Debit',
|
||||||
|
'BebanEmisi',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Ipal.
|
||||||
|
*/
|
||||||
|
public function ipal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Ipal::class, 'IpalId', 'IpalId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model IpalParameter.
|
||||||
|
*/
|
||||||
|
public function ipalParameter()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(IpalParameter::class, 'IpalParameterId', 'IpalParameterId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiBS extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiBS';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiBSId';
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefLokasiId',
|
||||||
|
'Nama',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'HasilUji',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Lokasi.
|
||||||
|
*/
|
||||||
|
public function lokasi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Lokasi::class, 'LokasiId', 'LokasiId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiKDM extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'HasilUjiKDM';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiKDMId';
|
||||||
|
protected $fillable = [
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'IndikatorKdmId',
|
||||||
|
'Bulan',
|
||||||
|
'Nilai',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model IndikatorKdm.
|
||||||
|
*/
|
||||||
|
public function indikatorKdm()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(IndikatorKdm::class, 'IndikatorKdmId', 'IndikatorKdmId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiLP extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiLP';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiLPId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'Sampah',
|
||||||
|
'Jenis',
|
||||||
|
'Bulan',
|
||||||
|
'Nilai',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiSTB extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiSTB';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiSTBId';
|
||||||
|
protected $fillable = [
|
||||||
|
'CerobongId',
|
||||||
|
'CerobongParameterId',
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'Semester1',
|
||||||
|
'Semester2',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Cerobong.
|
||||||
|
*/
|
||||||
|
public function cerobong()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Cerobong::class, 'CerobongId', 'CerobongId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model CerobongParameter.
|
||||||
|
*/
|
||||||
|
public function cerobongParameter()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(CerobongParameter::class, 'CerobongParameterId', 'CerobongParameterId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiUA extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiUA';
|
||||||
|
|
||||||
|
// Primary key tabel
|
||||||
|
protected $primaryKey = 'HasilUjiUAId';
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'LokasiId',
|
||||||
|
'Nama',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Lokasi.
|
||||||
|
*/
|
||||||
|
public function lokasi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Lokasi::class, 'LokasiId', 'LokasiId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilUjiUAParamter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'HasilUjiUAParameter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'HasilUjiUAParameterId';
|
||||||
|
protected $fillable = [
|
||||||
|
'HasilUjiUAId',
|
||||||
|
'UdaraAmbienBakuMutuId',
|
||||||
|
'Pengujian',
|
||||||
|
'Nilai',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model HasilUjiUA.
|
||||||
|
*/
|
||||||
|
public function hasilUjiUA()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(HasilUjiUA::class, 'HasilUjiUAId', 'HasilUjiUAId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model UdaraAmbienBakuMutu.
|
||||||
|
*/
|
||||||
|
public function udaraAmbienBakuMutu()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(UdaraAmbienBakuMutu::class, 'UdaraAmbienBakuMutuId', 'UdaraAmbienBakuMutuId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,21 +4,37 @@ namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class HistoryKegiatan extends Model
|
class HistoryKegiatan extends Model
|
||||||
{
|
{
|
||||||
use HasFactory; use SoftDeletes;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'HistoryKegiatan';
|
protected $table = 'HistoryKegiatan';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
|
||||||
|
|
||||||
protected $primaryKey = 'HistoryKegiatanId';
|
protected $primaryKey = 'HistoryKegiatanId';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'HistoryKegiatanId',
|
'PerusahaanId',
|
||||||
'NamaHistoryKegiatan',
|
'RefHistoryKegiatanId',
|
||||||
'IsPublish',
|
'Tanggal',
|
||||||
|
'Nomor',
|
||||||
|
'Keterangan',
|
||||||
|
'Dokumen',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefHistoryKegiatan.
|
||||||
|
*/
|
||||||
|
public function refHistoryKegiatan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefHistoryKegiatan::class, 'RefHistoryKegiatanId', 'RefHistoryKegiatanId');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class HistoryPerusahaan extends Model
|
||||||
protected $primaryKey = 'HistoryPerusahaanId';
|
protected $primaryKey = 'HistoryPerusahaanId';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'PerusahaanId',
|
'PerusahaanId',
|
||||||
'HistoryKegiatanId',
|
'RefHistoryKegiatanId',
|
||||||
'TanggalHistory',
|
'TanggalHistory',
|
||||||
'NomorHistory',
|
'NomorHistory',
|
||||||
'KeteranganHistory',
|
'KeteranganHistory',
|
||||||
|
@ -22,9 +22,9 @@ class HistoryPerusahaan extends Model
|
||||||
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function historyKegiatan()
|
public function refhistoryKegiatan()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(HistoryKegiatan::class, 'HistoryKegiatanId', 'HistoryKegiatanId');
|
return $this->belongsTo(RefHistoryKegiatan::class, 'RefHistoryKegiatanId', 'RefHistoryKegiatanId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function kelurahan()
|
public function kelurahan()
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IndikatorKdm extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'IndikatorKdm';
|
||||||
|
|
||||||
|
protected $primaryKey = 'IndikatorKdmId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaIndikator',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function hasilUjiKdm()
|
||||||
|
{
|
||||||
|
return $this->hasMany(HasilUjiKDM::class, 'IndikatorKdmId', 'IndikatorKdmId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Ipal extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Ipal';
|
||||||
|
|
||||||
|
protected $primaryKey = 'IpalId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefIpalId',
|
||||||
|
'Nomor',
|
||||||
|
'Nama',
|
||||||
|
'Lampiran',
|
||||||
|
'IzinTerbit',
|
||||||
|
'IzinHabis',
|
||||||
|
'Sumber',
|
||||||
|
'Kapasitas',
|
||||||
|
'Teknologi',
|
||||||
|
'BadanAir',
|
||||||
|
'DebitMaksimum',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefIpal.
|
||||||
|
*/
|
||||||
|
public function refIpal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefIpal::class, 'RefIpalId', 'RefIpalId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model IpalParameter.
|
||||||
|
*/
|
||||||
|
public function ipalParameters()
|
||||||
|
{
|
||||||
|
return $this->hasMany(IpalParameter::class, 'IpalId', 'IpalId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IpalParameter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'IpalParameter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'IpalParameterId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'IpalId',
|
||||||
|
'RefIpalParameterId',
|
||||||
|
'Nama',
|
||||||
|
'Satuan',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'BatasEmisi',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Ipal.
|
||||||
|
*/
|
||||||
|
public function ipal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Ipal::class, 'IpalId', 'IpalId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefIpalParameter.
|
||||||
|
*/
|
||||||
|
public function refIpalParameter()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefIpalParameter::class, 'RefIpalParameterId', 'RefIpalParameterId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IzinPihakKetiga extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'IzinPihakKetiga';
|
||||||
|
|
||||||
|
protected $primaryKey = 'IzinPihakKetigaId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaIzin',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class JenisKomponen extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'JenisKomponen';
|
||||||
|
protected $primaryKey = 'JenisKomponen';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaKomponen',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Komponen extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Komponen';
|
||||||
|
|
||||||
|
protected $primaryKey = 'KomponenId';
|
||||||
|
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'RefPelaporanId',
|
||||||
|
'JenisKomponenId',
|
||||||
|
'GroupHasilId',
|
||||||
|
'Kode',
|
||||||
|
'Nama',
|
||||||
|
'Lampiran',
|
||||||
|
'Info',
|
||||||
|
'Bobot',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefPelaporan.
|
||||||
|
*/
|
||||||
|
public function refPelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefPelaporan::class, 'RefPelaporanId', 'RefPelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model JenisKomponen.
|
||||||
|
*/
|
||||||
|
public function jenisKomponen()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(JenisKomponen::class, 'JenisKomponenId', 'JenisKomponenId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model GroupHasil.
|
||||||
|
*/
|
||||||
|
public function groupHasil()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(GroupHasil::class, 'GroupHasilId', 'GroupHasilId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Komunal extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Komunal';
|
||||||
|
|
||||||
|
protected $primaryKey = 'KomunalId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Tersambung',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class LampiranAL extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'LampiranAL';
|
||||||
|
|
||||||
|
// Primary key tabel
|
||||||
|
protected $primaryKey = 'LampiranALId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'IpalId',
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'Bulan',
|
||||||
|
'Dokumen',
|
||||||
|
'TanggalUnggah',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Ipal.
|
||||||
|
*/
|
||||||
|
public function ipal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Ipal::class, 'IpalId', 'IpalId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Lokasi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Lokasi';
|
||||||
|
|
||||||
|
protected $primaryKey = 'LokasiId';
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'PerusahaanId',
|
||||||
|
'Nama',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
'Tipe',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'Del',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class NilaiKomponen extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
// Nama tabel yang digunakan
|
||||||
|
protected $table = 'NilaiKomponen';
|
||||||
|
|
||||||
|
protected $primaryKey = 'NilaiKomponenId';
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'KomponenId',
|
||||||
|
'HasilId',
|
||||||
|
'Nilai',
|
||||||
|
'Verifikasi',
|
||||||
|
'TanggalVerifikasi',
|
||||||
|
'Catatan',
|
||||||
|
'Keterangan',
|
||||||
|
'Verifikator',
|
||||||
|
'IpalId',
|
||||||
|
'CerobongId',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Komponen.
|
||||||
|
*/
|
||||||
|
public function komponen()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Komponen::class, 'KomponenId', 'KomponenId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Hasil.
|
||||||
|
*/
|
||||||
|
public function hasil()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Hasil::class, 'HasilId', 'HasilId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Ipal.
|
||||||
|
*/
|
||||||
|
public function ipal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Ipal::class, 'IpalId', 'IpalId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Cerobong.
|
||||||
|
*/
|
||||||
|
public function cerobong()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Cerobong::class, 'CerobongId', 'CerobongId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class NilaiKomponenPihakKetiga extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'NilaiKomponenPihakKetiga';
|
||||||
|
|
||||||
|
protected $primaryKey = 'NilaiKomponenPihakKetigaId';
|
||||||
|
protected $fillable = [
|
||||||
|
'NilaiKomponenId',
|
||||||
|
'Nama',
|
||||||
|
'IzinPihakKetigaId',
|
||||||
|
'Jumlah',
|
||||||
|
'Satuan',
|
||||||
|
'IsDeleted',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model NilaiKomponen.
|
||||||
|
*/
|
||||||
|
public function nilaiKomponen()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(NilaiKomponen::class, 'NilaiKomponenId', 'NilaiKomponenId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model IzinPihakKetiga.
|
||||||
|
*/
|
||||||
|
public function izinPihakKetiga()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(IzinPihakKetiga::class, 'IzinPihakKetigaId', 'IzinPihakKetigaId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Pelaporan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Pelaporan';
|
||||||
|
|
||||||
|
protected $primaryKey = 'PelaporanId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PeriodePelaporanId',
|
||||||
|
'Tahun',
|
||||||
|
'PerusahaanId',
|
||||||
|
'SKL',
|
||||||
|
'SPL',
|
||||||
|
'SKL_IL',
|
||||||
|
'SKL_AL',
|
||||||
|
'SKL_LB3',
|
||||||
|
'SKL_SB',
|
||||||
|
'SKL_BS',
|
||||||
|
'SKL_STB',
|
||||||
|
'SKL_LP',
|
||||||
|
'SKL_KDM',
|
||||||
|
'SPL_AL',
|
||||||
|
'SPL_LB3',
|
||||||
|
'SPL_SB',
|
||||||
|
'SPL_BS',
|
||||||
|
'SPL_STB',
|
||||||
|
'SPL_LP',
|
||||||
|
'SPL_KDM',
|
||||||
|
'IsChecked',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke PeriodePelaporan.
|
||||||
|
*/
|
||||||
|
public function periodePelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PeriodePelaporan::class, 'PeriodePelaporanId', 'PeriodePelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Pelaporan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class ALModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'Pelaporan.SKL_AL';
|
||||||
|
protected $primaryKey = 'PelaporanId';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sesuaikan SKL pelaporan.
|
||||||
|
*
|
||||||
|
* 1. Pelaporan.SKL_AL, dari hitung-hitungan per komponen.
|
||||||
|
* 2. Pelaporan.SKL, dari rata-rata skl-nya.
|
||||||
|
*/
|
||||||
|
public static function sesuaikanSklPelaporan($idmcpelaporan)
|
||||||
|
{
|
||||||
|
// Hitung nilai skl sesuai query asli
|
||||||
|
$nilai_skl = DB::table('Komponen')
|
||||||
|
->leftJoin('NilaiKomponen', 'NilaiKomponen.KomponenId', '=', 'Komponen.KomponenId')
|
||||||
|
->where('Komponen.PelaporanId', 2)
|
||||||
|
->where('Komponen.Kode', '!=', 'SK')
|
||||||
|
->selectRaw('SUM(NilaiKomponen.Nilai) / COUNT(Komponen.KomponenId) AS skl')
|
||||||
|
->value('skl');
|
||||||
|
|
||||||
|
if (isset($nilai_skl)) {
|
||||||
|
// Panggil metode update_nilai_skl dan update_avg_skl dari PelaporanModel (asumsi sudah dibuat)
|
||||||
|
Pelaporan::updateNilaiSkl($idmcpelaporan, 2, $nilai_skl);
|
||||||
|
Pelaporan::updateAvgSkl($idmcpelaporan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sesuaikan SPL pelaporan.
|
||||||
|
*
|
||||||
|
* 1. Pelaporan.SPL_AL, disamakan dengan mcspl_al.nilaispl.
|
||||||
|
* 2. Pelaporan.SPL, dari rata-rata spl-nya.
|
||||||
|
*/
|
||||||
|
public static function sesuaikanSplPelaporan($idmcpelaporan)
|
||||||
|
{
|
||||||
|
$spl = DB::table('Spl_AL')
|
||||||
|
->where('PelaporanId', $idmcpelaporan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($spl && $spl->nilaispl) {
|
||||||
|
Pelaporan::updateNilaiSpl($idmcpelaporan, 2, $spl->nilaispl);
|
||||||
|
Pelaporan::updateAvgSpl($idmcpelaporan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil status Komunal berdasarkan idmcpelaporan.
|
||||||
|
*/
|
||||||
|
public static function getStatusMckomunal($idmcpelaporan)
|
||||||
|
{
|
||||||
|
return DB::table('Komunal')
|
||||||
|
->where('PelaporanId', $idmcpelaporan)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update atau insert status mckomunal.
|
||||||
|
*/
|
||||||
|
public static function updateStatusMckomunal($idmcpelaporan, $status)
|
||||||
|
{
|
||||||
|
$existing = self::getStatusMckomunal($idmcpelaporan);
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
DB::table('Komunal')
|
||||||
|
->where('PelaporanId', $idmcpelaporan)
|
||||||
|
->update(['Tersambung' => $status]);
|
||||||
|
} else {
|
||||||
|
DB::table('Komunal')
|
||||||
|
->insert([
|
||||||
|
'PelaporanId' => $idmcpelaporan,
|
||||||
|
'Tersambung' => $status,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cek lampiran surat kerjasama berdasarkan PelaporanId dan KomponenId.
|
||||||
|
*/
|
||||||
|
public static function cekLampiranSk($idmcpelaporan, $idrefkomponen)
|
||||||
|
{
|
||||||
|
return DB::table('Lampiran')
|
||||||
|
->where([
|
||||||
|
'PelaporanId' => $idmcpelaporan,
|
||||||
|
'KomponenId' => $idrefkomponen,
|
||||||
|
])->first();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Pelaporan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IPALmodel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'Ipal';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['PelaporanId'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data dari Ipal
|
||||||
|
*/
|
||||||
|
public static function getData($idmcpelaporan)
|
||||||
|
{
|
||||||
|
return self::where('PelaporanId', $idmcpelaporan)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get satu record berdasarkan filter
|
||||||
|
*/
|
||||||
|
public static function getOneBy(array $filter)
|
||||||
|
{
|
||||||
|
return self::where($filter)->first();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Pelaporan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IPALparameter extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'IpalParameter';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['IpalId'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data dari IpalParameter
|
||||||
|
*/
|
||||||
|
public static function getData($idmcipal)
|
||||||
|
{
|
||||||
|
return self::where('IpalId', $idmcipal)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get satu record berdasarkan filter
|
||||||
|
*/
|
||||||
|
public static function getOneBy(array $filter)
|
||||||
|
{
|
||||||
|
return self::where($filter)->first();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Pelaporan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class Lampiran extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'Lampiran';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['idmcpelaporan', 'idrefpelaporan'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cek no lampiran sertifikat
|
||||||
|
*/
|
||||||
|
public function cekNoLampiranSertifikat(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('mclampiran_sertifikat')
|
||||||
|
->join('mcpelaporan', 'mcpelaporan.id', '=', 'mclampiran_sertifikat.idmcpelaporan')
|
||||||
|
->where($filter)
|
||||||
|
->where('mclampiran_sertifikat.is_deleted', 0)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,666 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Pelaporan;
|
||||||
|
|
||||||
|
use App\Models\Verifikasi;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class Pelaporan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'Pelaporan';
|
||||||
|
protected $primaryKey = 'PelaporanId';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
// Constan nama tabel referensi
|
||||||
|
const PERIODE = 'PeriodePelaporan';
|
||||||
|
const PERUSAHAAN = 'Perusahaan';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil semua data pelaporan.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getData()
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan as a')
|
||||||
|
->select('a.*', 'b.*', 'b.Nama as Periode')
|
||||||
|
->join(self::PERIODE . ' as b', 'b.id', '=', 'a.PeriodePelaporanId')
|
||||||
|
->orderByDesc('a.Tahun')
|
||||||
|
->orderBy('a.PeriodePelaporanId')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil nilai SKL berdasarkan id pelaporan dan id ref pelaporan.
|
||||||
|
*/
|
||||||
|
public static function getNilaiSkl($idmcpelaporan, $idrefpelaporan)
|
||||||
|
{
|
||||||
|
$kode = self::getPelaporanCode($idrefpelaporan);
|
||||||
|
$column = 'skl_' . $kode;
|
||||||
|
|
||||||
|
$row = DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idmcpelaporan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return $row ? ($row->$column ?? null) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil nilai SPL berdasarkan id pelaporan dan id ref pelaporan.
|
||||||
|
*/
|
||||||
|
public static function getNilaiSpl($idmcpelaporan, $idrefpelaporan)
|
||||||
|
{
|
||||||
|
$kode = self::getPelaporanCode($idrefpelaporan);
|
||||||
|
if ($kode != 'il') {
|
||||||
|
$column = 'spl_' . $kode;
|
||||||
|
$row = DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idmcpelaporan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return $row ? ($row->$column ?? null) : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data pelaporan dengan filter.
|
||||||
|
*
|
||||||
|
* @param array $filter
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getDataBy(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan as a')
|
||||||
|
->select('a.*', 'a.id as PelaporanId', 'b.*', 'b.nama as Periode')
|
||||||
|
->where($filter)
|
||||||
|
->join(self::PERIODE . ' as b', 'b.PelaporanId', '=', 'a.PeriodePelaporanId')
|
||||||
|
->orderByDesc('a.Tahun')
|
||||||
|
->orderBy('a.PeriodePelaporanId')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data untuk admin dengan filter, gabungan perusahaan.
|
||||||
|
*
|
||||||
|
* @param array $filter
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function adminGetDataBy(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan as a')
|
||||||
|
->select('a.*', 'a.PelaporanId as PelaporanId', 'b.*', 'b.Nama as Periode', 'c.Nama as NamaPerusahaan')
|
||||||
|
->where($filter)
|
||||||
|
->join(self::PERIODE . ' as b', 'b.id', '=', 'a.PeriodePelaporanId')
|
||||||
|
->join(self::PERUSAHAAN . ' as c', 'c.id', '=', 'a.PerusahaanId')
|
||||||
|
->orderByDesc('a.Tahun')
|
||||||
|
->orderBy('a.PeriodePelaporanId')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil id perusahaan berdasarkan idmcusers.
|
||||||
|
*/
|
||||||
|
public static function getIdPerusahaan($idmcusers)
|
||||||
|
{
|
||||||
|
$row = DB::table('GroupPerusahaan')
|
||||||
|
->where('users', $idmcusers)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return $row ? $row->idrefperusahaan : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data perusahaan berdasarkan idrefperusahaan.
|
||||||
|
*/
|
||||||
|
public static function getPerusahaan($idrefperusahaan)
|
||||||
|
{
|
||||||
|
return DB::table('Perusahaan')
|
||||||
|
->where('PerusahaanId', $idrefperusahaan)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil semua perusahaan, dengan opsional filter idrefverifikator dan status aktif.
|
||||||
|
*/
|
||||||
|
public static function getAllPerusahaan($idrefverifikator = null, $is_active = null)
|
||||||
|
{
|
||||||
|
$query = DB::table('Perusahaan');
|
||||||
|
|
||||||
|
if ($idrefverifikator && $idrefverifikator !== "1") {
|
||||||
|
$query->where('VerifikatorId', $idrefverifikator);
|
||||||
|
}
|
||||||
|
if ($is_active !== null && $is_active !== '') {
|
||||||
|
$query->where('IsPublish', $is_active);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->get()->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data user perusahaan berdasarkan idrefverifikator.
|
||||||
|
*/
|
||||||
|
public static function getDataUserPerusahaan($idrefverifikator)
|
||||||
|
{
|
||||||
|
$idrefusergroups_perusahaan = 4;
|
||||||
|
|
||||||
|
return DB::table('users')
|
||||||
|
->select('users.*')
|
||||||
|
->join('GroupPerusahaan', 'GroupPerusahaan.UserId', '=', 'users.id')
|
||||||
|
->join('Perusahaan', 'GroupPerusahaan.PerusahaanId', '=', 'Perusahaan.PerusahaanId')
|
||||||
|
->where('users.UserGroupId', $idrefusergroups_perusahaan)
|
||||||
|
->where('Perusahaan.VerifikatorId', $idrefverifikator)
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data pelaporan berdasarkan ID.
|
||||||
|
*/
|
||||||
|
public static function getById($idpelaporan)
|
||||||
|
{
|
||||||
|
return self::_getQuery()
|
||||||
|
->where('a.id', $idpelaporan)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mendapatkan kode pelaporan berdasarkan idrefpelaporan.
|
||||||
|
*/
|
||||||
|
public static function getPelaporanCode($idrefpelaporan)
|
||||||
|
{
|
||||||
|
$row = DB::table('Pelaporan')
|
||||||
|
->select('Kode')
|
||||||
|
->where('PelaporanId', $idrefpelaporan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return $row ? $row->kode : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mendapatkan semua kode pelaporan.
|
||||||
|
*/
|
||||||
|
public static function getAllPelaporanCode()
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->select('Kode')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mendapatkan data referensi pelaporan berdasarkan kode.
|
||||||
|
*/
|
||||||
|
public static function getRefPelaporanByCode($code = '')
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('Kode', $code)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mendapatkan data pelaporan dari mcpelaporan by id.
|
||||||
|
*/
|
||||||
|
public static function getMclaporan($idpelaporan)
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idpelaporan)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update atau insert tanggal pelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateTanggalPelaporan(array $data, $date)
|
||||||
|
{
|
||||||
|
$exists = DB::table('PelaporanDate')
|
||||||
|
->where($data)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
return DB::table('PelaporanDate')
|
||||||
|
->where($data)
|
||||||
|
->update(['ReportDate' => $date]);
|
||||||
|
} else {
|
||||||
|
$data['ReportDate'] = $date;
|
||||||
|
return DB::table('PelaporanDate')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil pelaporan by range tanggal dan opsional refpelaporan.
|
||||||
|
*/
|
||||||
|
public static function getPelaporanByDate($start_date, $end_date, $refpelaporan = '')
|
||||||
|
{
|
||||||
|
$query = DB::table('PelaporanDate')
|
||||||
|
->whereBetween('ReportDate', [$start_date, $end_date]);
|
||||||
|
|
||||||
|
if ($refpelaporan) {
|
||||||
|
$query->where('RefPelaporanId', $refpelaporan);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->get()->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil semua perusahaan yang ada (del = 'n').
|
||||||
|
*/
|
||||||
|
public static function getAllPerusahaanExist()
|
||||||
|
{
|
||||||
|
return DB::table('Perusahaan')
|
||||||
|
->where('IsPublish', '0')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai SKL di tabel mcpelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateNilaiSkl($idpelaporan, $idrefpelaporan, $skl)
|
||||||
|
{
|
||||||
|
$kode = self::getPelaporanCode($idrefpelaporan);
|
||||||
|
$skl = $skl === null ? 0 : $skl;
|
||||||
|
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idpelaporan)
|
||||||
|
->update(["skl_$kode" => $skl]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update nilai SPL di tabel mcpelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateNilaiSpl($idpelaporan, $idrefpelaporan, $spl)
|
||||||
|
{
|
||||||
|
$kode = self::getPelaporanCode($idrefpelaporan);
|
||||||
|
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idpelaporan)
|
||||||
|
->update(["spl_$kode" => $spl]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hitung rata-rata SKL untuk pelaporan tertentu.
|
||||||
|
*/
|
||||||
|
public static function getAvgSkl($idpelaporan)
|
||||||
|
{
|
||||||
|
$query = self::getMclaporan($idpelaporan);
|
||||||
|
if (!$query) return null;
|
||||||
|
|
||||||
|
$periode = $query->idrefperiodepelaporan;
|
||||||
|
|
||||||
|
if ($periode == 2 || $periode == 4) {
|
||||||
|
$codes = self::getAllPelaporanCode();
|
||||||
|
$sum = 0;
|
||||||
|
$n = DB::table('Pelaporan')->count();
|
||||||
|
|
||||||
|
foreach ($codes as $code) {
|
||||||
|
$col = 'skl_' . $code->kode;
|
||||||
|
$sum += $query->$col ?? 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sum = ($query->skl_al ?? 0) + ($query->skl_lb3 ?? 0) + ($query->skl_lp ?? 0);
|
||||||
|
$n = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $n > 0 ? $sum / $n : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hitung rata-rata SPL untuk pelaporan tertentu.
|
||||||
|
*/
|
||||||
|
public static function getAvgSpl($idpelaporan)
|
||||||
|
{
|
||||||
|
$query = self::getMclaporan($idpelaporan);
|
||||||
|
if (!$query) return null;
|
||||||
|
|
||||||
|
$periode = $query->idrefperiodepelaporan;
|
||||||
|
|
||||||
|
if ($periode == 2 || $periode == 4) {
|
||||||
|
$codes = self::getAllPelaporanCode();
|
||||||
|
$sum = 0;
|
||||||
|
$n = DB::table('Pelaporan')->count() - 2;
|
||||||
|
|
||||||
|
foreach ($codes as $code) {
|
||||||
|
if ($code->kode != 'il' && $code->kode != 'kdm') {
|
||||||
|
$col = 'spl_' . $code->kode;
|
||||||
|
$sum += $query->$col ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sum = ($query->spl_al ?? 0) + ($query->spl_lb3 ?? 0) + ($query->spl_lp ?? 0);
|
||||||
|
$n = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $n > 0 ? $sum / $n : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update rata-rata SKL pada pelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateAvgSkl($idpelaporan)
|
||||||
|
{
|
||||||
|
$avg_skl = self::getAvgSkl($idpelaporan);
|
||||||
|
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idpelaporan)
|
||||||
|
->update(['skl' => $avg_skl]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update rata-rata SPL pada pelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateAvgSpl($idpelaporan)
|
||||||
|
{
|
||||||
|
$avg_spl = self::getAvgSpl($idpelaporan);
|
||||||
|
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where('PelaporanId', $idpelaporan)
|
||||||
|
->update(['spl' => $avg_spl]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil satu data verifikasi berdasarkan filter.
|
||||||
|
*/
|
||||||
|
public static function getOneVerifikasi(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('Verifikasi')
|
||||||
|
->where($filter)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil banyak data verifikasi berdasarkan filter.
|
||||||
|
*/
|
||||||
|
public static function getVerifikasi(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('Verifikasi')
|
||||||
|
->where($filter)
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data evaluasi berdasarkan filter.
|
||||||
|
*/
|
||||||
|
public static function getEvaluasi(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('Evaluasi')
|
||||||
|
->where($filter)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil data tanda terima berdasarkan filter.
|
||||||
|
*/
|
||||||
|
public static function getTandaterima(array $filter)
|
||||||
|
{
|
||||||
|
return DB::table('TandaTerima')
|
||||||
|
->where($filter)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perbaiki status verifikasi.
|
||||||
|
*
|
||||||
|
* @param array $filter
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
public static function fixStatusVerifikasi(array $filter, array $data)
|
||||||
|
{
|
||||||
|
$result = DB::table('Verifikasi')
|
||||||
|
->join('Pelaporan', 'Verifikasi.PelaporanId', '=', 'Pelaporan.PelaporanId')
|
||||||
|
->where('Verifikasi.Verif', 0)
|
||||||
|
->where('Pelaporan.SKL', '>', 0)
|
||||||
|
->select('Verifikasi.VerifikasiId')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($result->isNotEmpty()) {
|
||||||
|
$data_id = [];
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$array_data = $data;
|
||||||
|
$array_data['VerifikasiId'] = $row->id;
|
||||||
|
$array_data['Verifikasi'] = 1;
|
||||||
|
$data_id[] = $array_data;
|
||||||
|
}
|
||||||
|
// Laravel batch update requires package or raw query, simplified as loop update:
|
||||||
|
foreach ($data_id as $item) {
|
||||||
|
DB::table('Verifikasi')
|
||||||
|
->where('VerifikasiId', $item['VerifikasiId'])
|
||||||
|
->update(['Verif' => $item['Verif']] + $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update status verifikasi.
|
||||||
|
*/
|
||||||
|
public static function updateStatusVerifikasi(array $filter, array $data)
|
||||||
|
{
|
||||||
|
$verifikasi = self::getOneVerifikasi($filter);
|
||||||
|
|
||||||
|
if ($verifikasi) {
|
||||||
|
if ($verifikasi->verifikasi < ($data['Verif'] ?? 0)) {
|
||||||
|
DB::table('Verifikasi')
|
||||||
|
->where($filter)
|
||||||
|
->update($data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DB::table('Verifikasi')->insert(array_merge($filter, $data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert pelaporan dan dapatkan ID baru.
|
||||||
|
*/
|
||||||
|
public static function insertPelaporan(array $data)
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan')->insertGetId($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert data verifikasi.
|
||||||
|
*/
|
||||||
|
public static function insertVerifikasi(array $data)
|
||||||
|
{
|
||||||
|
return DB::table('Verifikasi')->insert($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ambil nilai konfigurasi batas penguncian pelaporan dari mcsystem.
|
||||||
|
*
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public static function checkReportLockedAfter()
|
||||||
|
{
|
||||||
|
$row = DB::table('System')
|
||||||
|
->where('Name', 'ReportLockedAfter')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return $row ? (int)$row->val : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update kolom is_checked pada pelaporan.
|
||||||
|
*/
|
||||||
|
public static function updateIsChecked(array $filter, $is_checked)
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan')
|
||||||
|
->where($filter)
|
||||||
|
->update(['IsChecked' => $is_checked]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cek apakah pelaporan editable.
|
||||||
|
*
|
||||||
|
* @param int $idmcpelaporan
|
||||||
|
* @param string|null $parameter
|
||||||
|
* @param object|null $currentUser // objek user untuk cek hak admin/granted, harus diberikan saat pemanggilan
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function checkEditable($idmcpelaporan, $parameter = null, $currentUser = null)
|
||||||
|
{
|
||||||
|
// Jika user admin, bisa edit
|
||||||
|
if ($currentUser && method_exists($currentUser, 'isAdmin') && $currentUser->isAdmin()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pelaporan = self::getById($idmcpelaporan);
|
||||||
|
if (empty($pelaporan)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$refperusahaan = self::getPerusahaan($pelaporan->idrefperusahaan);
|
||||||
|
if ($refperusahaan && $refperusahaan->is_report_locked) {
|
||||||
|
$tahun = $pelaporan->tahun;
|
||||||
|
$periode = $pelaporan->idrefperiodepelaporan;
|
||||||
|
$periode_tenggang = self::checkReportLockedAfter();
|
||||||
|
|
||||||
|
$periode_akhir_bulan = ($periode * 3) + $periode_tenggang;
|
||||||
|
$periode_akhir_tahun = $tahun;
|
||||||
|
|
||||||
|
if ($periode_akhir_bulan > 12) {
|
||||||
|
$periode_akhir_bulan -= 12;
|
||||||
|
$periode_akhir_tahun++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$waktu_periode_akhir = $periode_akhir_tahun . ($periode_akhir_bulan <= 9 ? '0' . $periode_akhir_bulan : $periode_akhir_bulan);
|
||||||
|
$waktu_sekarang = date('Ym');
|
||||||
|
|
||||||
|
if ($waktu_sekarang > $waktu_periode_akhir) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($pelaporan->is_checked)) {
|
||||||
|
$is_checked = json_decode($pelaporan->is_checked, true);
|
||||||
|
if ($parameter && isset($is_checked[$parameter]) && $is_checked[$parameter] == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cek editable khusus verifikasi.
|
||||||
|
*
|
||||||
|
* @param int $idmcpelaporan
|
||||||
|
* @param string $idrefpelaporan
|
||||||
|
* @param object|null $currentUser
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function checkEditableVerifikasi($idmcpelaporan, $idrefpelaporan = '', $currentUser = null)
|
||||||
|
{
|
||||||
|
if (!$currentUser || !method_exists($currentUser, 'isGranted') || !method_exists($currentUser, 'isAdmin')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
$pelaporan = self::getById($idmcpelaporan);
|
||||||
|
if (!$pelaporan) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tahun = $pelaporan->tahun;
|
||||||
|
$periode = $pelaporan->idrefperiodepelaporan;
|
||||||
|
|
||||||
|
if ($periode != 4) {
|
||||||
|
$bulan_akhir = $periode * 3;
|
||||||
|
$awal_tenggang = '01-' . ($bulan_akhir + 1) . '-' . $tahun;
|
||||||
|
} else {
|
||||||
|
$awal_tenggang = '01-01-' . ($tahun + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$get_report_locked = self::checkReportLockedAfter();
|
||||||
|
|
||||||
|
$akhir_tenggang = strtotime($awal_tenggang . ' + ' . (30 * $get_report_locked) . ' days');
|
||||||
|
$current_date = strtotime(date('Y-m-d'));
|
||||||
|
|
||||||
|
if ($current_date <= $akhir_tenggang
|
||||||
|
&& $currentUser->isGranted('Verifikasi.edit')
|
||||||
|
&& !$currentUser->isAdmin()) {
|
||||||
|
// Cek id verifikator
|
||||||
|
// Di sini harus implementasi pemanggilan model VerifikasiModel sesuai kebutuhan anda
|
||||||
|
// Untuk contoh saya asumsikan ada method statis getIdVerifikator
|
||||||
|
$idmcusers = $currentUser->id ?? null;
|
||||||
|
if (!$idmcusers) return false;
|
||||||
|
|
||||||
|
// Contoh pemanggilan VerifikasiModel (harus dibuat)
|
||||||
|
$idrefverifikator = Verifikasi::getIdVerifikator($idmcusers);
|
||||||
|
|
||||||
|
if ($idrefverifikator !== null && $idrefverifikator !== "0") {
|
||||||
|
$query = DB::table('Pelaporan as a')
|
||||||
|
->join('Perusahaan as b', 'a.PerusahaanId', '=', 'b.id')
|
||||||
|
->where('a.PelaporanId', $idmcpelaporan)
|
||||||
|
->select('b.VerifikatorId')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($query && $query->idrefverifikator == $idrefverifikator) {
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$result = false;
|
||||||
|
$get_verifikasi = self::getVerifikasi(['PelaporanId' => $idmcpelaporan]);
|
||||||
|
if (!empty($get_verifikasi)) {
|
||||||
|
$last_verifikasi = end($get_verifikasi);
|
||||||
|
if ($last_verifikasi['verif'] == 2) {
|
||||||
|
$result = true;
|
||||||
|
} else {
|
||||||
|
// Dinonaktifkan berdasarkan task T7579
|
||||||
|
// logic lama bisa diaktifkan kembali bila diperlukan
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert atau update kolom is_checked jika belum ada.
|
||||||
|
*/
|
||||||
|
public static function insertUpdateIsChecked($idmcpelaporan)
|
||||||
|
{
|
||||||
|
$pelaporan = self::getById($idmcpelaporan);
|
||||||
|
if (empty($pelaporan->is_checked)) {
|
||||||
|
$all_refpelaporan = self::getAllPelaporanCode();
|
||||||
|
$is_checked = [];
|
||||||
|
foreach ($all_refpelaporan as $c) {
|
||||||
|
$is_checked[$c->kode] = 1;
|
||||||
|
}
|
||||||
|
self::updateIsChecked(['PelaporanId' => $idmcpelaporan], json_encode($is_checked));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query dasar untuk pengambilan data pelaporan dengan join periode dan perusahaan.
|
||||||
|
*/
|
||||||
|
private static function _getQuery()
|
||||||
|
{
|
||||||
|
return DB::table('Pelaporan as a')
|
||||||
|
->select(
|
||||||
|
'a.*',
|
||||||
|
'b.Nama as Periode',
|
||||||
|
'b.BulanAwal',
|
||||||
|
'b.BulanAkhir',
|
||||||
|
'c.Nama as Perusahaan',
|
||||||
|
'c.Alamat',
|
||||||
|
'c.NomorInduk',
|
||||||
|
'c.PelaporanId as PerusahaanId',
|
||||||
|
'c.doc_pdl_orig',
|
||||||
|
'c.doc_pdl_path'
|
||||||
|
)
|
||||||
|
->join(self::PERIODE . ' as b', 'b.id', '=', 'a.PeriodedPelaporanId')
|
||||||
|
->join(self::PERUSAHAAN . ' as c', 'c.id', '=', 'a.PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PelaporanDate extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'PelaporanDate';
|
||||||
|
|
||||||
|
protected $primaryKey = 'PelaporanDateId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefPelaporanId',
|
||||||
|
'ReportDate',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefPelaporan.
|
||||||
|
*/
|
||||||
|
public function refPelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefPelaporan::class, 'RefPelaporanId', 'RefPelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ class PeriodePelaporan extends Model
|
||||||
protected $table = 'PeriodePelaporan';
|
protected $table = 'PeriodePelaporan';
|
||||||
protected $primaryKey = 'PeriodePelaporanId';
|
protected $primaryKey = 'PeriodePelaporanId';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'NamaPeriodePelaporan',
|
'Nama',
|
||||||
'BulanAwal',
|
'BulanAwal',
|
||||||
'BulanSelesai',
|
'BulanSelesai',
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Http\Controllers\PelaporanController;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
@ -93,9 +94,9 @@ class Perusahaan extends Model
|
||||||
return $this->belongsTo(JenisDokIL::class, 'JenisDokILId', 'JenisDokILId');
|
return $this->belongsTo(JenisDokIL::class, 'JenisDokILId', 'JenisDokILId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function historyKegiatan()
|
public function refhistoryKegiatan()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(HistoryKegiatan::class, 'HistoryKegiatanId', 'HistoryKegiatanId');
|
return $this->belongsTo(RefHistoryKegiatan::class, 'RefHistoryKegiatanId', 'RefHistoryKegiatanId');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,4 +105,8 @@ class Perusahaan extends Model
|
||||||
return $this->hasMany(HistoryPerusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
return $this->hasMany(HistoryPerusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PelaporanController::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PetugasTps extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'PetugasTps';
|
||||||
|
|
||||||
|
protected $primaryKey = 'PetugasTpsId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PerusahaanId',
|
||||||
|
'NamaPetugas',
|
||||||
|
'IsDeleted',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefCerobong extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'RefCerobong';
|
||||||
|
protected $primaryKey = 'RefCerobongId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PerusahaanId',
|
||||||
|
'Kode',
|
||||||
|
'Nama',
|
||||||
|
'SumberEmisi',
|
||||||
|
'JenisBahanBakar',
|
||||||
|
'Konsumsi',
|
||||||
|
'Bentuk',
|
||||||
|
'Tinggi',
|
||||||
|
'Diameter',
|
||||||
|
'Posisi',
|
||||||
|
'JenisPengendali',
|
||||||
|
'JamOperasional',
|
||||||
|
'Del',
|
||||||
|
'Kapasitas',
|
||||||
|
'SatuanKapasitas',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Perusahaan.
|
||||||
|
*/
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefCerobongParameter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'CerobongParameter';
|
||||||
|
protected $primaryKey = 'CerobongParameterId';
|
||||||
|
protected $fillable = [
|
||||||
|
'CerobongId',
|
||||||
|
'Nama',
|
||||||
|
'Satuan',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'Del',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Cerobong.
|
||||||
|
*/
|
||||||
|
public function cerobong()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefCerobong::class, 'RefCerobongId', 'RefCerobongId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class RefHistoryKegiatan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory; use SoftDeletes;
|
||||||
|
|
||||||
|
protected $table = 'RefHistoryKegiatan';
|
||||||
|
|
||||||
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
|
protected $primaryKey = 'RefHistoryKegiatanId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaHistoryKegiatan',
|
||||||
|
'IsPublish',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefIpal extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'RefIpal';
|
||||||
|
|
||||||
|
protected $primaryKey = 'RefIpalId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PerusahaanId',
|
||||||
|
'NomorIpal',
|
||||||
|
'NamaIpal',
|
||||||
|
'DokumenIpal',
|
||||||
|
'IzinTerbit',
|
||||||
|
'IzinHabis',
|
||||||
|
'SumberLimbah',
|
||||||
|
'KapasitasIpal',
|
||||||
|
'Teknologi',
|
||||||
|
'BadanAir',
|
||||||
|
'DebitMaksimum',
|
||||||
|
'Lintang',
|
||||||
|
'Bujur',
|
||||||
|
'Del',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model IpalParameter.
|
||||||
|
*/
|
||||||
|
public function refipalParameters()
|
||||||
|
{
|
||||||
|
return $this->hasMany(RefIpalParameter::class, 'RefIpalId', 'RefIpalId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefIpalParameter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'RefIpalParameter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'RefIpalParameterId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'RefIpalId',
|
||||||
|
'NamaParameter',
|
||||||
|
'Satuan',
|
||||||
|
'BakuMutuJenis',
|
||||||
|
'BakuMutuNilai1',
|
||||||
|
'BakuMutuNilai2',
|
||||||
|
'BatasEmisi',
|
||||||
|
'Del',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Ipal.
|
||||||
|
*/
|
||||||
|
public function refipal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefIpal::class, 'RefIpalId', 'RefIpalId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'RefLog';
|
||||||
|
|
||||||
|
protected $primaryKey = 'RefLogId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'Nama',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RefPelaporan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'RefPelaporan';
|
||||||
|
|
||||||
|
protected $primaryKey = 'RefPelaporanId';
|
||||||
|
|
||||||
|
// Atribut yang dapat diisi secara massal
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaPelaporan',
|
||||||
|
'KodePelaporan',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Verifikasi.
|
||||||
|
*/
|
||||||
|
public function verifikasi()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Verifikasi::class, 'RefPelaporanId', 'RefPelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_AL extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_AL';
|
||||||
|
|
||||||
|
protected $primaryKey = 'Spl_AL_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Diuji',
|
||||||
|
'Melebihi',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_BS extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_BS';
|
||||||
|
protected $primaryKey = 'Spl_BS_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Tipe',
|
||||||
|
'Lokasi',
|
||||||
|
'Melebihi',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_KDM extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_KDM';
|
||||||
|
protected $primaryKey = 'Spl_KDM_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Iya',
|
||||||
|
'Jumlah',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_LB3 extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_LB3';
|
||||||
|
protected $primaryKey = 'Spl_LB3_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Timbulan',
|
||||||
|
'Perlakukan',
|
||||||
|
'Residu',
|
||||||
|
'BelumTerkelola',
|
||||||
|
'Sisa',
|
||||||
|
'Kinerja',
|
||||||
|
'NilaiSpl',
|
||||||
|
'Status',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_LP extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_LP';
|
||||||
|
protected $primaryKey = 'Spl_LP_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Timbulan',
|
||||||
|
'Diangkut',
|
||||||
|
'Pengolahan',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_SB extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_SB';
|
||||||
|
protected $primaryKey = 'Spl_SB_Id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'BensinJumlah',
|
||||||
|
'BensinUji',
|
||||||
|
'BensinLulus',
|
||||||
|
'DieselJumlah',
|
||||||
|
'DieselUji',
|
||||||
|
'DieselLulus',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Spl_STB extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Spl_STB';
|
||||||
|
protected $primaryKey = 'Spl_STB_Id';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Diuji',
|
||||||
|
'Melebihi',
|
||||||
|
'NilaiSpl',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Stb extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Stb';
|
||||||
|
protected $primaryKey = 'Stb_Id';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'EmisiStb',
|
||||||
|
'Cerobong',
|
||||||
|
'SuratPernyataan',
|
||||||
|
'TanggalUnggah',
|
||||||
|
'Verifikasi',
|
||||||
|
'TanggalVerifikasi',
|
||||||
|
'Keterangan',
|
||||||
|
'Verifikator',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SumberSampah extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'SumberSampah';
|
||||||
|
|
||||||
|
protected $primaryKey = 'SumberSampahId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PerusahaanId',
|
||||||
|
'NamaSumber',
|
||||||
|
'IsDeleted',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function perusahaan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Perusahaan::class, 'PerusahaanId', 'PerusahaanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class System extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'System';
|
||||||
|
|
||||||
|
protected $primaryKey = 'SystemId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'Nama',
|
||||||
|
'Val',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TandaTerima extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'TandaTerima';
|
||||||
|
protected $primaryKey = 'TandaTerimaId';
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'Dokumen',
|
||||||
|
'Email',
|
||||||
|
'TanggalKirim',
|
||||||
|
'Oleh',
|
||||||
|
'Del',
|
||||||
|
'Parameter',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UdaraAmbienBakuMutu extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'UdaraAmbienBakuMutu';
|
||||||
|
|
||||||
|
protected $primaryKey = 'UdaraAmbienBakuMutuId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'UdaraAmbienParameterId',
|
||||||
|
'WaktuPengukuran',
|
||||||
|
'NilaiBaku',
|
||||||
|
'Satuan',
|
||||||
|
'SistemPengukuran',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model UdaraAmbienParameter.
|
||||||
|
*/
|
||||||
|
public function parameter()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(UdaraAmbienParameter::class, 'UdaraAmbienParameterId', 'UdaraAmbienParameterId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UdaraAmbienParameter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'UdaraAmbienParameter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'UdaraAmbienParameterId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'NamaParameter',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model UdaraAmbienBakuMutu.
|
||||||
|
*/
|
||||||
|
public function bakuMutu()
|
||||||
|
{
|
||||||
|
return $this->hasMany(UdaraAmbienBakuMutu::class, 'UdaraAmbienParameterId', 'UdaraAmbienParameterId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Verifikasi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'Verifikasi';
|
||||||
|
|
||||||
|
protected $primaryKey = 'VerifikasiId';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'PelaporanId',
|
||||||
|
'RefPelaporanId',
|
||||||
|
'Verifikasi',
|
||||||
|
'Tanggal',
|
||||||
|
'Oleh',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model Pelaporan.
|
||||||
|
*/
|
||||||
|
public function pelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelaporan::class, 'PelaporanId', 'PelaporanId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke model RefPelaporan.
|
||||||
|
*/
|
||||||
|
public function refPelaporan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(RefPelaporan::class, 'RefPelaporanId', 'RefPelaporanId');
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
"laravel/framework": "^11.0",
|
"laravel/framework": "^11.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
|
"league/flysystem-aws-s3-v3": "^3.29",
|
||||||
"spatie/laravel-permission": "6.4.0",
|
"spatie/laravel-permission": "6.4.0",
|
||||||
"tightenco/ziggy": "^2.0"
|
"tightenco/ziggy": "^2.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,159 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "953cea45b540b8469800ed81d3f1fba6",
|
"content-hash": "e092b6f6aa930da1b1a2e88395649a47",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "aws/aws-crt-php",
|
||||||
|
"version": "v1.2.7",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/awslabs/aws-crt-php.git",
|
||||||
|
"reference": "d71d9906c7bb63a28295447ba12e74723bd3730e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e",
|
||||||
|
"reference": "d71d9906c7bb63a28295447ba12e74723bd3730e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.8.35||^5.6.3||^9.5",
|
||||||
|
"yoast/phpunit-polyfills": "^1.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality."
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Apache-2.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "AWS SDK Common Runtime Team",
|
||||||
|
"email": "aws-sdk-common-runtime@amazon.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "AWS Common Runtime for PHP",
|
||||||
|
"homepage": "https://github.com/awslabs/aws-crt-php",
|
||||||
|
"keywords": [
|
||||||
|
"amazon",
|
||||||
|
"aws",
|
||||||
|
"crt",
|
||||||
|
"sdk"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/awslabs/aws-crt-php/issues",
|
||||||
|
"source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7"
|
||||||
|
},
|
||||||
|
"time": "2024-10-18T22:15:13+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aws/aws-sdk-php",
|
||||||
|
"version": "3.343.14",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||||
|
"reference": "8bb5b542b28c4538b44de4335396e77bf9fbedf6"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8bb5b542b28c4538b44de4335396e77bf9fbedf6",
|
||||||
|
"reference": "8bb5b542b28c4538b44de4335396e77bf9fbedf6",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"aws/aws-crt-php": "^1.2.3",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-pcre": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"guzzlehttp/guzzle": "^7.4.5",
|
||||||
|
"guzzlehttp/promises": "^2.0",
|
||||||
|
"guzzlehttp/psr7": "^2.4.5",
|
||||||
|
"mtdowling/jmespath.php": "^2.8.0",
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/http-message": "^2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"andrewsville/php-token-reflection": "^1.4",
|
||||||
|
"aws/aws-php-sns-message-validator": "~1.0",
|
||||||
|
"behat/behat": "~3.0",
|
||||||
|
"composer/composer": "^2.7.8",
|
||||||
|
"dms/phpunit-arraysubset-asserts": "^0.4.0",
|
||||||
|
"doctrine/cache": "~1.4",
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-openssl": "*",
|
||||||
|
"ext-pcntl": "*",
|
||||||
|
"ext-sockets": "*",
|
||||||
|
"phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5",
|
||||||
|
"psr/cache": "^2.0 || ^3.0",
|
||||||
|
"psr/simple-cache": "^2.0 || ^3.0",
|
||||||
|
"sebastian/comparator": "^1.2.3 || ^4.0 || ^5.0",
|
||||||
|
"symfony/filesystem": "^v6.4.0 || ^v7.1.0",
|
||||||
|
"yoast/phpunit-polyfills": "^2.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
|
||||||
|
"doctrine/cache": "To use the DoctrineCacheAdapter",
|
||||||
|
"ext-curl": "To send requests using cURL",
|
||||||
|
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
|
||||||
|
"ext-sockets": "To use client-side monitoring"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/functions.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Aws\\": "src/"
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"src/data/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Apache-2.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Amazon Web Services",
|
||||||
|
"homepage": "http://aws.amazon.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
|
||||||
|
"homepage": "http://aws.amazon.com/sdkforphp",
|
||||||
|
"keywords": [
|
||||||
|
"amazon",
|
||||||
|
"aws",
|
||||||
|
"cloud",
|
||||||
|
"dynamodb",
|
||||||
|
"ec2",
|
||||||
|
"glacier",
|
||||||
|
"s3",
|
||||||
|
"sdk"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"forum": "https://github.com/aws/aws-sdk-php/discussions",
|
||||||
|
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||||
|
"source": "https://github.com/aws/aws-sdk-php/tree/3.343.14"
|
||||||
|
},
|
||||||
|
"time": "2025-05-19T18:02:45+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
"version": "0.12.1",
|
"version": "0.12.1",
|
||||||
|
@ -1858,6 +2009,61 @@
|
||||||
},
|
},
|
||||||
"time": "2024-10-08T08:58:34+00:00"
|
"time": "2024-10-08T08:58:34+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "league/flysystem-aws-s3-v3",
|
||||||
|
"version": "3.29.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
|
||||||
|
"reference": "c6ff6d4606e48249b63f269eba7fabdb584e76a9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/c6ff6d4606e48249b63f269eba7fabdb584e76a9",
|
||||||
|
"reference": "c6ff6d4606e48249b63f269eba7fabdb584e76a9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"aws/aws-sdk-php": "^3.295.10",
|
||||||
|
"league/flysystem": "^3.10.0",
|
||||||
|
"league/mime-type-detection": "^1.0.0",
|
||||||
|
"php": "^8.0.2"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"guzzlehttp/guzzle": "<7.0",
|
||||||
|
"guzzlehttp/ringphp": "<1.1.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"League\\Flysystem\\AwsS3V3\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Frank de Jonge",
|
||||||
|
"email": "info@frankdejonge.nl"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "AWS S3 filesystem adapter for Flysystem.",
|
||||||
|
"keywords": [
|
||||||
|
"Flysystem",
|
||||||
|
"aws",
|
||||||
|
"file",
|
||||||
|
"files",
|
||||||
|
"filesystem",
|
||||||
|
"s3",
|
||||||
|
"storage"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.29.0"
|
||||||
|
},
|
||||||
|
"time": "2024-08-17T13:10:48+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem-local",
|
"name": "league/flysystem-local",
|
||||||
"version": "3.29.0",
|
"version": "3.29.0",
|
||||||
|
@ -2064,6 +2270,72 @@
|
||||||
],
|
],
|
||||||
"time": "2024-06-28T09:40:51+00:00"
|
"time": "2024-06-28T09:40:51+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "mtdowling/jmespath.php",
|
||||||
|
"version": "2.8.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jmespath/jmespath.php.git",
|
||||||
|
"reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc",
|
||||||
|
"reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2.5 || ^8.0",
|
||||||
|
"symfony/polyfill-mbstring": "^1.17"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/xdebug-handler": "^3.0.3",
|
||||||
|
"phpunit/phpunit": "^8.5.33"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/jp.php"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.8-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/JmesPath.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"JmesPath\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Graham Campbell",
|
||||||
|
"email": "hello@gjcampbell.co.uk",
|
||||||
|
"homepage": "https://github.com/GrahamCampbell"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Michael Dowling",
|
||||||
|
"email": "mtdowling@gmail.com",
|
||||||
|
"homepage": "https://github.com/mtdowling"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Declaratively specify how to extract elements from a JSON document",
|
||||||
|
"keywords": [
|
||||||
|
"json",
|
||||||
|
"jsonpath"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/jmespath/jmespath.php/issues",
|
||||||
|
"source": "https://github.com/jmespath/jmespath.php/tree/2.8.0"
|
||||||
|
},
|
||||||
|
"time": "2024-09-04T18:46:31+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
"version": "3.8.0",
|
"version": "3.8.0",
|
||||||
|
@ -8485,12 +8757,12 @@
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": {},
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('FILESYSTEM_DISK', 'public'),
|
'default' => env('FILESYSTEM_DISK', 's3'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -50,10 +50,11 @@ return [
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
'region' => env('AWS_DEFAULT_REGION'),
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
'bucket' => env('AWS_BUCKET'),
|
'bucket' => env('AWS_BUCKET'),
|
||||||
'url' => env('AWS_URL'),
|
'url' => env('AWS_URL') . '/' . env('AWS_BUCKET'),
|
||||||
'endpoint' => env('AWS_ENDPOINT'),
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
'use_path_style_endpoint' => true, // Always true for Minio
|
||||||
'throw' => false,
|
'throw' => true, // Change to true to catch errors
|
||||||
|
'visibility' => 'public',
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
|
@ -11,8 +11,8 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('HistoryKegiatan', function (Blueprint $table) {
|
Schema::create('RefHistoryKegiatan', function (Blueprint $table) {
|
||||||
$table->id('HistoryKegiatanId');
|
$table->id('RefHistoryKegiatanId');
|
||||||
$table->string('NamaHistoryKegiatan');
|
$table->string('NamaHistoryKegiatan');
|
||||||
$table->boolean('IsPublish')->default(1);
|
$table->boolean('IsPublish')->default(1);
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
|
@ -25,6 +25,6 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('HistoryKegiatan');
|
Schema::dropIfExists('RefHistoryKegiatan');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ return new class extends Migration
|
||||||
Schema::create('HistoryPerusahaan', function (Blueprint $table) {
|
Schema::create('HistoryPerusahaan', function (Blueprint $table) {
|
||||||
$table->id('HistoryPerusahaanId');
|
$table->id('HistoryPerusahaanId');
|
||||||
$table->unsignedInteger('PerusahaanId');
|
$table->unsignedInteger('PerusahaanId');
|
||||||
$table->unsignedInteger('HistoryKegiatanId');
|
$table->unsignedInteger('RefHistoryKegiatanId');
|
||||||
$table->date('TanggalHistory')->comment('tanggal surat');
|
$table->date('TanggalHistory')->comment('tanggal surat');
|
||||||
$table->string('NomorHistory', 100)->nullable()->comment('nomor surat');
|
$table->string('NomorHistory', 100)->nullable()->comment('nomor surat');
|
||||||
$table->text('KeteranganHistory')->nullable();
|
$table->text('KeteranganHistory')->nullable();
|
||||||
|
@ -22,7 +22,7 @@ return new class extends Migration
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('PerusahaanId')->references('PerusahaanId')->on('Perusahaan')->onDelete('set null');
|
$table->foreign('PerusahaanId')->references('PerusahaanId')->on('Perusahaan')->onDelete('set null');
|
||||||
$table->foreign('HistoryKegiatanId')->references('HistoryKegiatanId')->on('HistoryKegiatan')->onDelete('set null');
|
$table->foreign('RefHistoryKegiatanId')->references('RefHistoryKegiatanId')->on('RefHistoryKegiatan')->onDelete('set null');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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('JenisKomponen', function (Blueprint $table) {
|
||||||
|
$table->id('JenisKomponenId');
|
||||||
|
$table->string('NamaKomponen', 255);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('JenisKomponen');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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('Hasil', function (Blueprint $table) {
|
||||||
|
$table->id('HasilId');
|
||||||
|
$table->string('NamaHasil', 255);
|
||||||
|
$table->float('NilaiHasil');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('Hasil');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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('GroupHasil', function (Blueprint $table) {
|
||||||
|
$table->id('GroupHasilId');
|
||||||
|
$table->unsignedInteger('HasilId');
|
||||||
|
$table->foreign('HasilId')->references('HasilId')->on('Hasil')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('GroupHasil');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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('IzinPihakKetiga', function (Blueprint $table) {
|
||||||
|
$table->increments('IzinPihakKetigaId');
|
||||||
|
$table->string('NamaIzin', 100)->nullable()->comment('Nama Izin');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('IzinPihakKetiga');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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('PetugasTps', function (Blueprint $table) {
|
||||||
|
$table->id('PetugasTpsId');
|
||||||
|
$table->unsignedBigInteger('PerusahaanId');
|
||||||
|
$table->foreign('PerusahaanId')
|
||||||
|
->references('PerusahaanId')
|
||||||
|
->on('Perusahaan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->string('NamaPetugas', 255);
|
||||||
|
$table->tinyInteger('IsDeleted');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('PetugasTps', function (Blueprint $table) {
|
||||||
|
// Menghapus foreign key terlebih dahulu sebelum menghapus tabel
|
||||||
|
$table->dropForeign(['PerusahaanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('PetugasTps');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?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('SumberSampah', function (Blueprint $table) {
|
||||||
|
$table->id('SumberSampahId');
|
||||||
|
$table->unsignedInteger('PerusahaanId');
|
||||||
|
$table->string('NamaSumber', 255)->nullable()->comment('nama dan lokasi/sumber sampah');
|
||||||
|
$table->tinyInteger('IsDeleted');
|
||||||
|
|
||||||
|
$table->foreign('PerusahaanId')
|
||||||
|
->references('PerusahaanId')
|
||||||
|
->on('Perusahaan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('SumberSampah', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PerusahaanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('SumberSampah');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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('UdaraAmbienParameter', function (Blueprint $table) {
|
||||||
|
$table->id('UdaraAmbienParameterId');
|
||||||
|
$table->string('NamaParameter', 255)->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('UdaraAmbienParameter');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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('UdaraAmbienBakuMutu', function (Blueprint $table) {
|
||||||
|
$table->increments('UdaraAmbienBakuMutuId');
|
||||||
|
$table->unsignedInteger('UdaraAmbienParameterId')->nullable();
|
||||||
|
$table->string('WaktuPengukuran', 25)->nullable();
|
||||||
|
$table->decimal('NilaiBaku', 8, 2)->nullable()->comment('max value: 999.999,99');
|
||||||
|
$table->string('Satuan', 25)->nullable();
|
||||||
|
$table->tinyInteger('SistemPengukuran')->unsigned()->default(1)->comment('1=Aktif Kontinu, 2=Aktif Manual');
|
||||||
|
|
||||||
|
$table->foreign('UdaraAmbienParameterId')
|
||||||
|
->references('UdaraAmbienParameterId')
|
||||||
|
->on('UdaraAmbienParameter')
|
||||||
|
->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('UdaraAmbienBakuMutu', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['UdaraAmbienParameterId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('UdaraAmbienBakuMutu');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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('IndikatorKdm', function (Blueprint $table) {
|
||||||
|
$table->id('IndikatorKdmId');
|
||||||
|
$table->string('NamaIndikator', 255);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('IndikatorKdm');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?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('Verifikasi', function (Blueprint $table) {
|
||||||
|
$table->id('VerifikasiId');
|
||||||
|
$table->unsignedInteger('PelaporanId');
|
||||||
|
$table->unsignedInteger('RefPelaporanId');
|
||||||
|
$table->tinyInteger('Verif');
|
||||||
|
$table->dateTime('Tanggal');
|
||||||
|
$table->integer('Oleh');
|
||||||
|
|
||||||
|
// Membuat index
|
||||||
|
$table->index('PelaporanId', 'Index_PelaporanId');
|
||||||
|
$table->index('RefPelaporanId', 'Index_RefPelaporanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Pelaporan
|
||||||
|
$table->foreign('PelaporanId')
|
||||||
|
->references('PelaporanId')
|
||||||
|
->on('Pelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel RefPelaporan
|
||||||
|
$table->foreign('RefPelaporanId')
|
||||||
|
->references('RefPelaporanId')
|
||||||
|
->on('RefPelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Verifikasi', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PelaporanId']);
|
||||||
|
$table->dropForeign(['RefPelaporanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Verifikasi');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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('RefPelaporan', function (Blueprint $table) {
|
||||||
|
$table->id('RefPelaporanId');
|
||||||
|
$table->string('NamaPelaporan', 255);
|
||||||
|
$table->string('Keterangan', 255);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('RefPelaporan');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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('ChoicesLP', function (Blueprint $table) {
|
||||||
|
$table->id('ChoicesLPId');
|
||||||
|
$table->unsignedInteger('KomponenId')->nullable()->comment('id dari komponen');
|
||||||
|
$table->string('Nama', 100)->nullable();
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Komponen
|
||||||
|
$table->foreign('KomponenId')
|
||||||
|
->references('KomponenId')
|
||||||
|
->on('Komponen')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('ChoicesLP', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['KomponenId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('ChoicesLP');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?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('TandaTerima', function (Blueprint $table) {
|
||||||
|
$table->id('TandaTerimaId');
|
||||||
|
$table->unsignedInteger('PelaporanId');
|
||||||
|
$table->string('Dokumen', 255)->nullable();
|
||||||
|
$table->string('Email', 255)->nullable();
|
||||||
|
$table->dateTime('TanggalKirim')->nullable();
|
||||||
|
$table->integer('Oleh')->nullable();
|
||||||
|
$table->enum('Del', ['y', 'n'])->default('n');
|
||||||
|
$table->string('Parameter', 100)->nullable();
|
||||||
|
|
||||||
|
// Membuat index untuk kolom PelaporanId
|
||||||
|
$table->index('PelaporanId', 'Indexing_PelaporanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Pelaporan
|
||||||
|
$table->foreign('PelaporanId')
|
||||||
|
->references('PelaporanId')
|
||||||
|
->on('Pelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('TandaTerima', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PelaporanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('TandaTerima');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?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('Komponen', function (Blueprint $table) {
|
||||||
|
$table->id('KomponenId');
|
||||||
|
$table->unsignedInteger('RefPelaporanId');
|
||||||
|
$table->unsignedInteger('JenisKomponenId');
|
||||||
|
$table->unsignedInteger('GroupHasilId')->nullable();
|
||||||
|
$table->string('Kode', 45);
|
||||||
|
$table->string('Nama', 255);
|
||||||
|
$table->tinyInteger('Lampiran');
|
||||||
|
$table->text('Info')->nullable();
|
||||||
|
$table->decimal('Bobot', 5, 2)->nullable();
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel RefPelaporan
|
||||||
|
$table->foreign('RefPelaporanId')
|
||||||
|
->references('RefPelaporanId')
|
||||||
|
->on('RefPelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel JenisKomponen
|
||||||
|
$table->foreign('JenisKomponenId')
|
||||||
|
->references('JenisKomponenId')
|
||||||
|
->on('JenisKomponen')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel GroupHasil (opsional)
|
||||||
|
$table->foreign('GroupHasilId')
|
||||||
|
->references('GroupHasilId')
|
||||||
|
->on('GroupHasil')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Komponen', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['RefPelaporanId']);
|
||||||
|
$table->dropForeign(['JenisKomponenId']);
|
||||||
|
$table->dropForeign(['GroupHasilId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Komponen');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?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('Catatan', function (Blueprint $table) {
|
||||||
|
$table->id('CatatanId');
|
||||||
|
$table->unsignedInteger('PelaporanId');
|
||||||
|
$table->unsignedInteger('RefPelaporanId');
|
||||||
|
$table->text('IsiCatatan')->nullable();
|
||||||
|
$table->text('Evaluasi')->nullable();
|
||||||
|
|
||||||
|
// Menambahkan index untuk kolom PelaporanId dan RefPelaporanId
|
||||||
|
$table->index('PelaporanId', 'IndexCatatan_PelaporanId');
|
||||||
|
$table->index('RefPelaporanId', 'IndexCatatan_RefPelaporanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Pelaporan
|
||||||
|
$table->foreign('PelaporanId')
|
||||||
|
->references('PelaporanId')
|
||||||
|
->on('Pelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel RefPelaporan
|
||||||
|
$table->foreign('RefPelaporanId')
|
||||||
|
->references('RefPelaporanId')
|
||||||
|
->on('RefPelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Catatan', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PelaporanId']);
|
||||||
|
$table->dropForeign(['RefPelaporanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Catatan');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?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('RefCerobong', function (Blueprint $table) {
|
||||||
|
$table->increments('RefCerobongId');
|
||||||
|
$table->unsignedInteger('PerusahaanId');
|
||||||
|
$table->string('Kode', 45)->nullable();
|
||||||
|
$table->string('Nama', 255)->nullable();
|
||||||
|
$table->string('SumberEmisi', 255)->nullable();
|
||||||
|
$table->string('JenisBahanBakar', 255)->nullable();
|
||||||
|
$table->string('Konsumsi', 255)->nullable();
|
||||||
|
$table->string('Bentuk', 255)->nullable();
|
||||||
|
$table->float('Tinggi')->nullable();
|
||||||
|
$table->float('Diameter')->nullable();
|
||||||
|
$table->float('Posisi')->nullable();
|
||||||
|
$table->string('JenisPengendali', 255)->nullable();
|
||||||
|
$table->integer('JamOperasional')->nullable();
|
||||||
|
// Karena Laravel tidak mendukung tipe SET, gunakan ENUM sebagai gantinya
|
||||||
|
$table->enum('Del', ['y', 'n']);
|
||||||
|
$table->float('Kapasitas')->nullable();
|
||||||
|
$table->string('SatuanKapasitas', 255)->nullable();
|
||||||
|
$table->double('Lintang')->nullable()->comment('lintang in decimal degree');
|
||||||
|
$table->double('Bujur')->nullable()->comment('bujur in decimal degree');
|
||||||
|
|
||||||
|
// Membuat index untuk kolom PerusahaanId
|
||||||
|
$table->index('PerusahaanId', 'Indexing_PerusahaanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Perusahaan
|
||||||
|
$table->foreign('PerusahaanId')
|
||||||
|
->references('PerusahaanId')
|
||||||
|
->on('Perusahaan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('RefCerobong', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PerusahaanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('RefCerobong');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?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('RefCerobongParameter', function (Blueprint $table) {
|
||||||
|
$table->increments('RefCerobongParameterId');
|
||||||
|
$table->unsignedInteger('RefCerobongId');
|
||||||
|
$table->string('Nama', 255)->nullable();
|
||||||
|
$table->string('Satuan', 255)->nullable();
|
||||||
|
$table->enum('BakuMutuJenis', ['Angka Tunggal', 'Rentang Angka', 'Positif/Negatif', 'Tanpa Baku Mutu']);
|
||||||
|
$table->string('BakuMutuNilai1', 45);
|
||||||
|
$table->string('BakuMutuNilai2', 45)->nullable();
|
||||||
|
$table->enum('Del', ['y', 'n']);
|
||||||
|
|
||||||
|
$table->index('RefCerobongId', 'Index_RefCerobongId');
|
||||||
|
|
||||||
|
$table->foreign('RefCerobongId')
|
||||||
|
->references('RefCerobongId')
|
||||||
|
->on('RefCerobong')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('RefCerobongParameter', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['RefCerobongId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('RefCerobongParameter');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?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('Cerobong', function (Blueprint $table) {
|
||||||
|
$table->id('CerobongId');
|
||||||
|
$table->unsignedInteger('PelaporanId');
|
||||||
|
$table->unsignedInteger('RefCerobongId');
|
||||||
|
$table->string('Kode', 45)->nullable();
|
||||||
|
$table->string('Nama', 255)->nullable();
|
||||||
|
$table->string('SumberEmisi', 255)->nullable();
|
||||||
|
$table->string('JenisBahanBakar', 255)->nullable();
|
||||||
|
$table->string('Konsumsi', 255)->nullable();
|
||||||
|
$table->string('Bentuk', 255)->nullable();
|
||||||
|
$table->float('Tinggi')->nullable();
|
||||||
|
$table->float('Diameter')->nullable();
|
||||||
|
$table->float('Posisi')->nullable();
|
||||||
|
$table->string('JenisPengendali', 255)->nullable();
|
||||||
|
$table->float('JamOperasional')->nullable();
|
||||||
|
$table->float('Kapasitas')->nullable();
|
||||||
|
$table->string('SatuanKapasitas', 255)->nullable();
|
||||||
|
$table->double('Lintang')->nullable()->comment('lintang in decimal degree');
|
||||||
|
$table->double('Bujur')->nullable()->comment('bujur in decimal degree');
|
||||||
|
|
||||||
|
// Menambahkan index
|
||||||
|
$table->index('PelaporanId', 'IndexCerobong_PelaporanId');
|
||||||
|
$table->index('RefCerobongId', 'IndexCerobong_RefCerobongId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Pelaporan
|
||||||
|
$table->foreign('PelaporanId')
|
||||||
|
->references('PelaporanId')
|
||||||
|
->on('Pelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel RefCerobong
|
||||||
|
$table->foreign('RefCerobongId')
|
||||||
|
->references('RefCerobongId')
|
||||||
|
->on('RefCerobong')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Cerobong', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PelaporanId']);
|
||||||
|
$table->dropForeign(['RefCerobongId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Cerobong');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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('CerobongParameter', function (Blueprint $table) {
|
||||||
|
$table->id('CerobongParameterId');
|
||||||
|
$table->unsignedInteger('CerobongId');
|
||||||
|
$table->unsignedInteger('RefCerobongParameterId');
|
||||||
|
$table->string('Nama', 255)->nullable();
|
||||||
|
$table->string('Satuan', 255)->nullable();
|
||||||
|
$table->enum('BakuMutuJenis', ['Angka Tunggal', 'Rentang Angka', 'Positif/Negatif', 'Tanpa Baku Mutu']);
|
||||||
|
$table->string('BakuMutuNilai1', 45);
|
||||||
|
$table->string('BakuMutuNilai2', 45)->nullable();
|
||||||
|
$table->enum('Del', ['y', 'n']);
|
||||||
|
|
||||||
|
$table->index('CerobongId', 'Index_CerobongId');
|
||||||
|
$table->index('RefCerobongParameterId', 'Index_RefCerobongParameterId');
|
||||||
|
|
||||||
|
$table->foreign('CerobongId')
|
||||||
|
->references('CerobongId')
|
||||||
|
->on('Cerobong')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('RefCerobongParameterId')
|
||||||
|
->references('RefCerobongParameterId')
|
||||||
|
->on('RefCerobongParameter')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('CerobongParameter', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['CerobongId']);
|
||||||
|
$table->dropForeign(['RefCerobongParameterId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('CerobongParameter');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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('Evaluasi', function (Blueprint $table) {
|
||||||
|
$table->id('EvaluasiId');
|
||||||
|
$table->unsignedInteger('PelaporanId');
|
||||||
|
$table->string('DokumenEval', 255)->nullable();
|
||||||
|
$table->unsignedInteger('TipeDokumen')->default(0)->comment('0 = Surat Evaluasi SKL, 1 = SE Status Mutu, 2 = SE Lainnya');
|
||||||
|
$table->string('Email', 255)->nullable();
|
||||||
|
$table->dateTime('TanggalKirim')->nullable();
|
||||||
|
$table->integer('Oleh')->nullable();
|
||||||
|
|
||||||
|
$table->index('PelaporanId', 'IndexEvaluasi_PelaporanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi dengan tabel Pelaporan
|
||||||
|
$table->foreign('PelaporanId')
|
||||||
|
->references('PelaporanId')
|
||||||
|
->on('Pelaporan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Evaluasi', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PelaporanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Evaluasi');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?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('GroupPerusahaan', function (Blueprint $table) {
|
||||||
|
$table->id('GroupPerusahaanId');
|
||||||
|
// Kolom UserId merujuk pada id di tabel users
|
||||||
|
$table->unsignedInteger('UserId');
|
||||||
|
// Kolom PermissionId merujuk pada id di tabel permissions
|
||||||
|
$table->unsignedInteger('PerusahaanId');
|
||||||
|
|
||||||
|
// Menambahkan foreign key untuk relasi ke tabel users
|
||||||
|
$table->foreign('UserId')
|
||||||
|
->references('id')
|
||||||
|
->on('users')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('PerusahaanId')
|
||||||
|
->references('PerusahaanId')
|
||||||
|
->on('Perusahaan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('GroupPerusahaan', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['UserId']);
|
||||||
|
$table->dropForeign(['PerusahaanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('GroupPerusahaan');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?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('Lokasi', function (Blueprint $table) {
|
||||||
|
$table->id('LokasiId');
|
||||||
|
$table->unsignedInteger('PerusahaanId');
|
||||||
|
$table->string('Nama', 255);
|
||||||
|
$table->double('Lintang')->nullable()->comment('lintang in decimal degree');
|
||||||
|
$table->double('Bujur')->nullable()->comment('bujur in decimal degree');
|
||||||
|
$table->tinyInteger('Tipe')->unsigned()->default(0)->comment('0=kebisingan ambien, 1=udara ambien');
|
||||||
|
// Karena Laravel tidak mendukung tipe SET, kita gunakan ENUM sebagai gantinya
|
||||||
|
$table->enum('BakuMutuJenis', ['Angka Tunggal', 'Rentang Angka', 'Positif/Negatif']);
|
||||||
|
$table->string('BakuMutuNilai1', 45);
|
||||||
|
$table->string('BakuMutuNilai2', 45)->nullable();
|
||||||
|
$table->enum('Del', ['y', 'n']);
|
||||||
|
|
||||||
|
$table->index('PerusahaanId', 'IndexLokasi_PerusahaanId');
|
||||||
|
$table->foreign('PerusahaanId')
|
||||||
|
->references('PerusahaanId')
|
||||||
|
->on('Perusahaan')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('Lokasi', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['PerusahaanId']);
|
||||||
|
});
|
||||||
|
Schema::dropIfExists('Lokasi');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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('RefLog', function (Blueprint $table) {
|
||||||
|
$table->id('RefLog');
|
||||||
|
$table->string('Nama', 100);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('RefLog');
|
||||||
|
}
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue