diff --git a/.gitignore b/.gitignore index 7a221eed3..edd050e00 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,8 @@ Modules/* # Do not ignore Anjungan folder and its contents !Modules/Anjungan/ !Modules/Anjungan/** +!Modules/Analisis/ +!Modules/Analisis/** # Do not ignore specific files !Modules/.gitkeep diff --git a/Modules/Analisis/Config/index.html b/Modules/Analisis/Config/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/Modules/Analisis/Config/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/Modules/Analisis/Enums/TahapPedataanEnum.php b/Modules/Analisis/Enums/TahapPedataanEnum.php new file mode 100644 index 000000000..93f674594 --- /dev/null +++ b/Modules/Analisis/Enums/TahapPedataanEnum.php @@ -0,0 +1,24 @@ + 'Belum Entri / Pedataan', + self::SEDANG_ENTRI => 'Sedang Dalam Pendataan', + self::SELESAI_ENTRI => 'Selesai Entri / Pedataan', + ]; + } +} diff --git a/Modules/Analisis/Enums/TipePertanyaanEnum.php b/Modules/Analisis/Enums/TipePertanyaanEnum.php new file mode 100644 index 000000000..bcd82da5b --- /dev/null +++ b/Modules/Analisis/Enums/TipePertanyaanEnum.php @@ -0,0 +1,63 @@ + 'Pilihan (Tunggal)', + self::PILIHAN_GANDA => 'Pilihan (Ganda)', + self::ISIAN_JUMLAH => 'Isian angka', + self::ISIAN_TEKS => 'Isian Tulisan' + ]; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_indikator.php b/Modules/Analisis/Http/Controllers/Analisis_indikator.php new file mode 100644 index 000000000..69af8c4a2 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_indikator.php @@ -0,0 +1,207 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master) + { + return view('analisis_indikator.index', [ + 'tipeKategori' => AnalisisKategori::where(['id_master' => $master])->pluck('kategori', 'id'), + ]); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $canUpdate = can('u'); + $canDelete = can('h'); + $orderColumn = $this->input->get('order')[0]['column']; + $orderDesc = $this->input->get('order')[0]['dir']; + $analisisMaster = $this->analisisMaster; + + return datatables()->of(AnalisisIndikator::with(['kategori'])->whereIdMaster($master) + ->when($orderColumn == 3, static fn ($q) => $q->orderByRaw("LPAD(nomor, 10, ' ') {$orderDesc}"))) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($canUpdate, $canDelete, $analisisMaster): string { + $aksi = ''; + if($analisisMaster->isLock()){ + return $aksi; + } + if ($canUpdate) { + if (in_array($row->id_tipe, [TipePertanyaanEnum::PILIHAN_TUNGGAL, TipePertanyaanEnum::PILIHAN_GANDA])) { + $aksi .= ' id}.parameter", $row->id) . '" class="btn bg-purple btn-sm" title="Jawaban">'; + } + } + $aksi .= ' id}.form", $row->id) . '" class="btn bg-orange btn-sm" title="Ubah Data">'; + if ($analisisMaster->jenis != TipePertanyaanEnum::PILIHAN_TUNGGAL && $canDelete) { + $aksi .= ' id}.delete", $row->id) . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete">'; + } + + return $aksi; + }) + ->editColumn('act_analisis', static fn ($q) => StatusEnum::valueOf($q->act_analisis)) + ->editColumn('id_tipe', static fn ($q) => TipePertanyaanEnum::valueOf($q->id_tipe)) + ->rawColumns(['ceklist', 'aksi']) + ->make(); + } + + return show_404(); + } + + public function form($master, $id = null) + { + isCan('u'); + $analisisMaster = $this->analisisMaster; + $data['list_kategori'] = AnalisisKategori::where(['id_master' => $master])->pluck('kategori', 'id'); + $data['data_tabel'] = AnalisisIndikator::hubungan($analisisMaster->subjek_tipe); + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_indikator.'.$master.'.update', $id); + $data['analisis_indikator'] = AnalisisIndikator::findOrFail($id); + $data['ubah'] = (AnalisisParameter::where('id_indikator', $id)->exists() && in_array($data['analisis_indikator']['id_tipe'], [1, 2])) ? false : true; + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_indikator.'.$master.'.insert'); + $data['analisis_indikator'] = null; + $data['ubah'] = true; + } + + return view('analisis_indikator.form', $data); + } + + public function insert($master): void + { + isCan('u'); + $analisisMaster = $this->analisisMaster; + if($analisisMaster->isSystem()){ + redirect_with('error', 'Analisis sistem tidak boleh dirubah', ci_route('analisis_indikator.'.$master)); + } + $dataInsert = static::validate($this->request); + $dataInsert['id_master'] = $master; + if (AnalisisIndikator::create($dataInsert)) { + redirect_with('success', 'Berhasil Tambah Data', ci_route('analisis_indikator.'.$master)); + } + redirect_with('error', 'Gagal Tambah Data', ci_route('analisis_indikator.'.$master)); + } + + public function update($master, $id = null): void + { + isCan('u'); + $analisisMaster = $this->analisisMaster; + $dataUpdate = static::validate($this->request, $id); + if($analisisMaster->isSystem()){ + // Hanya kolom yang boleh diubah untuk analisis sistem + $dataUpdate = ['is_publik' => $dataUpdate['is_publik']]; + } + $data = AnalisisIndikator::findOrFail($id); + + if ($data->update($dataUpdate)) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_indikator.'.$master)); + } + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_indikator.'.$master)); + } + + public function delete($master, $id = null): void + { + isCan('h'); + $analisisMaster = $this->analisisMaster; + if($analisisMaster->isSystem()){ + redirect_with('error', 'Analisis sistem tidak boleh dihapus', ci_route('analisis_indikator.'.$master)); + } + $adaParameter = AnalisisIndikator::whereIn('id', $id ? [$id] : $this->request['id_cb'])->whereHas('parameter')->exists(); + if($adaParameter){ + redirect_with('error', 'Gagal hapus, masih ada parameter dalam indikator tersebut', ci_route('analisis_indikator.'.$master)); + } + if (AnalisisIndikator::destroy($id ?? $this->request['id_cb']) !== 0) { + redirect_with('success', 'Berhasil Hapus Data', ci_route('analisis_indikator.'.$master)); + } + redirect_with('error', 'Gagal Hapus Data', ci_route('analisis_indikator.'.$master)); + } + + protected static function validate(array $request = []): array + { + $data = [ + 'id_tipe' => $request['id_tipe'], + 'referensi' => $request['referensi'] ?? null, + 'nomor' => nomor_surat_keputusan($request['nomor']), + 'pertanyaan' => htmlentities($request['pertanyaan']), + 'id_kategori' => $request['id_kategori'] ?? null, + 'bobot' => bilangan($request['bobot']), + 'act_analisis' => $request['act_analisis'], + 'is_publik' => $request['is_publik'], + ]; + + if ($data['id_tipe'] != 1) { + $data['act_analisis'] = 2; + $data['bobot'] = 0; + } + + return $data; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_kategori.php b/Modules/Analisis/Http/Controllers/Analisis_kategori.php new file mode 100644 index 000000000..c2a13b006 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_kategori.php @@ -0,0 +1,171 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master) + { + return view('analisis_kategori.index'); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $canUpdate = can('u'); + $canDelete = can('h'); + $analisisMaster = $this->analisisMaster; + + return datatables()->of(AnalisisKategori::whereIdMaster($master)) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($canUpdate, $canDelete, $analisisMaster): string { + $aksi = ''; + if ($canUpdate) { + $aksi .= 'id}.form", $row->id) . '" class="btn bg-orange btn-sm" title="Ubah Data" data-remote="false" data-toggle="modal" data-target="#modalBox" data-title="Ubah Data">'; + } + + if ($canDelete) { + $aksi .= ' id}.delete", $row->id) . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete">'; + } + + return $aksi; + }) + ->rawColumns(['ceklist', 'aksi']) + ->make(); + } + + return show_404(); + } + + public function form($master, $id = null) + { + isCan('u'); + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_kategori.' . $master . '.update', $id); + $data['analisis_kategori'] = AnalisisKategori::findOrFail($id); + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_kategori.' . $master . '.insert'); + $data['analisis_kategori'] = null; + } + + return view('analisis_kategori.form', $data); + } + + public function insert($master): void + { + isCan('u'); + $dataInsert = static::validate($this->request); + $dataInsert['id_master'] = $master; + if (AnalisisKategori::create($dataInsert)) { + redirect_with('success', 'Berhasil Tambah Data', ci_route('analisis_kategori.' . $master)); + } + redirect_with('error', 'Gagal Tambah Data', ci_route('analisis_kategori.' . $master)); + } + + public function update($master, $id = null): void + { + isCan('u'); + $dataUpdate = static::validate($this->request, $id); + $data = AnalisisKategori::findOrFail($id); + + if ($data->update($dataUpdate)) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_kategori.' . $master)); + } + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_kategori.' . $master)); + } + + public function delete($master, $id = null): void + { + isCan('h'); + $ids = $id ? [$id] : $this->request['id_cb']; + + foreach ($ids as $id) { + $this->prosesDelete($master, $id); + } + } + + private function prosesDelete($mater, $id = null): void + { + $cek = AnalisisKategori::withCount('indikator')->findOrFail($id); + + if ($cek->indikator_count > 0) { + redirect_with('error', 'Gagal Hapus Data, Kategori masih digunakan', ci_route('analisis_kategori.' . $mater)); + } + + if ($cek->delete()) { + redirect_with('success', 'Berhasil Hapus Data', ci_route('analisis_kategori.' . $mater)); + } + + redirect_with('error', 'Gagal Hapus Data', ci_route('analisis_kategori.' . $mater)); + } + + protected static function validate(array $request = []): array + { + return [ + 'kategori' => htmlentities($request['kategori']), + ]; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php b/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php new file mode 100644 index 000000000..4c0369287 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php @@ -0,0 +1,156 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master) + { + return view('analisis_klasifikasi.index'); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $canUpdate = can('u'); + $canDelete = can('h'); + return datatables()->of(AnalisisKlasifikasi::whereIdMaster($master)) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($canUpdate, $canDelete, $master) { + $aksi = ''; + if ($canUpdate) { + $aksi .= 'id) . '" class="btn bg-orange btn-sm" title="Ubah Data" data-remote="false" data-toggle="modal" data-target="#modalBox" data-title="Ubah Data">'; + } + + if ($canDelete) { + $aksi .= ' id) . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete">'; + } + + return $aksi; + }) + ->rawColumns(['ceklist', 'aksi']) + ->make(); + } + + return show_404(); + } + + public function form($master, $id = null) + { + isCan('u'); + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_klasifikasi.' . $master . '.update', $id); + $data['analisis_klasifikasi'] = AnalisisKlasifikasi::findOrFail($id); + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_klasifikasi.' . $master . '.insert'); + $data['analisis_klasifikasi'] = null; + } + + return view('analisis_klasifikasi.form', $data); + } + + public function insert($master): void + { + isCan('u'); + $dataInsert = static::validate($this->request); + $dataInsert['id_master'] = $master; + if (AnalisisKlasifikasi::create($dataInsert)) { + redirect_with('success', 'Berhasil Tambah Data', ci_route('analisis_klasifikasi.' . $master)); + } + redirect_with('error', 'Gagal Tambah Data', ci_route('analisis_klasifikasi.' . $master)); + } + + public function update($master, $id = null): void + { + isCan('u'); + $dataUpdate = static::validate($this->request, $id); + $data = AnalisisKlasifikasi::findOrFail($id); + + if ($data->update($dataUpdate)) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_klasifikasi.' . $master)); + } + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_klasifikasi.' . $master)); + } + + public function delete($master, $id = null): void + { + isCan('h'); + + if (AnalisisKlasifikasi::destroy($id ?? $this->request['id_cb']) !== 0) { + redirect_with('success', 'Berhasil Hapus Data', ci_route('analisis_klasifikasi.' . $master)); + } + redirect_with('error', 'Gagal Hapus Data', ci_route('analisis_klasifikasi.' . $master)); + } + + protected static function validate(array $request = []): array + { + return [ + 'nama' => nomor_surat_keputusan($request['nama']), + 'minval' => bilangan_titik($request['minval']), + 'maxval' => bilangan_titik($request['maxval']), + ]; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_laporan.php b/Modules/Analisis/Http/Controllers/Analisis_laporan.php new file mode 100644 index 000000000..ecbd65a88 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_laporan.php @@ -0,0 +1,253 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + if ($master) { + $this->periodeAktif = AnalisisPeriode::whereIdMaster($master)->where(['aktif' => StatusEnum::YA])->first(); + if (! $this->periodeAktif) { + redirect_with('error', 'Tidak ada periode aktif. Untuk laporan ini harus ada periode aktif.', ci_route('analisis_periode', $master)); + } + } + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master): void + { + $data = [ + 'judul' => Analisis::judul_subjek($this->analisisMaster->subjek_tipe), + 'list_klasifikasi' => AnalisisKlasifikasi::where('id_master', $master)->get(), + 'analisis_periode' => $this->periodeAktif->id, + 'wilayah' => Wilayah::treeAccess(), + 'namaPeriode' => $this->periodeAktif->nama + ]; + + view('analisis_laporan.index', $data); + } + + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $sumberData = $this->sumberData(); + + return datatables()->of($sumberData) + ->addIndexColumn() + ->addColumn('aksi', static fn ($row): string => 'id) . '" class="btn bg-purple btn-sm" title="Input Data">')->editColumn('alamat', static fn ($q) => strtoupper($q->alamat . ' ' . 'RT/RW ' . $q->rt . '/' . $q->rw . ' - ' . setting('sebutan_dusun') . ' ' . $q->dusun)) + ->editColumn('nilai', static fn ($q) => $q->nilai ? number_format($q->nilai, 2, ',', '.') : '-') + ->editColumn('sex', static fn ($q) => strtoupper(JenisKelaminEnum::valueOf($q->sex))) + ->editColumn('cek', static fn ($q) => '') + ->rawColumns(['ceklist', 'aksi', 'cek']) + ->make(); + } + + return show_404(); + } + + private function sumberData() + { + $dusun = $this->input->get('dusun') ?? null; + $rw = $this->input->get('rw') ?? null; + $rt = $this->input->get('rt') ?? null; + $klasifikasi = $this->input->get('klasifikasi') ?? null; + + $idCluster = $rt ? [$rt] : []; + + if (empty($idCluster) && ! empty($rw)) { + [$namaDusun, $namaRw] = explode('__', $rw); + $idCluster = Wilayah::whereDusun($namaDusun)->whereRw($namaRw)->select(['id'])->get()->pluck('id')->toArray(); + } + + if (empty($idCluster) && ! empty($dusun)) { + $idCluster = Wilayah::whereDusun($dusun)->select(['id'])->get()->pluck('id')->toArray(); + } + + $analisisMaster = $this->analisisMaster; + $analisSumberData = Analisis::sumberData($analisisMaster->subjek_tipe, $idCluster); + $utama = $analisSumberData['utama']; + $sumber = $analisSumberData['sumber']; + $pembagi = (int) $analisisMaster->pembagi; + + $sumber->selectRaw("CAST((analisis_respon_hasil.akumulasi/{$pembagi}) AS decimal(8,3)) AS nilai, analisis_klasifikasi.nama AS klasifikasi") + ->leftJoin('analisis_respon_hasil', $utama . '.id', '=', 'analisis_respon_hasil.id_subjek') + ->leftJoin('analisis_klasifikasi', static function ($join) use ($pembagi, $analisisMaster) { + $join->on(DB::raw("analisis_respon_hasil.akumulasi / {$pembagi}"), '>=', 'analisis_klasifikasi.minval') + ->on(DB::raw("analisis_respon_hasil.akumulasi / {$pembagi}"), '<=', 'analisis_klasifikasi.maxval') + ->on('analisis_klasifikasi.id_master', '=', DB::raw($analisisMaster->id)); + }) + ->where('analisis_respon_hasil.id_periode', $this->periodeAktif->id); + if ($klasifikasi) { + $sumber->where('analisis_klasifikasi.id', $klasifikasi); + } + + return $sumber; + } + + public function form($master, $idSubjek): void + { + $analisis = new Analisis(); + + $data['total'] = AnalisisResponHasil::where(['id_subjek' => $idSubjek, 'id_periode' => $this->periodeAktif->id])->first()->akumulasi ?? 0; + $data['subjek'] = $analisis->getSubjek($this->analisisMaster, $idSubjek) ?? show_404(); + $data['list_jawab'] = $analisis->listIndikatorLaporan($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_bukti'] = $analisis->listBukti($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_anggota'] = $analisis->listAnggota($this->analisisMaster, $idSubjek); + $data['asubjek'] = $this->analisisMaster->subjek_tipe == AnalisisRefSubjekEnum::DESA ? ucwords(setting('sebutan_desa')) : AnalisisRefSubjekEnum::valueOf($this->analisisMaster->subjek_tipe); + $data['id'] = $idSubjek; + + view('analisis_laporan.form', $data); + } + + // $aksi = cetak/unduh + public function dialog_kuisioner($master, $id, $aksi = ''): void + { + $data = $this->modal_penandatangan(); + $data['aksi'] = ucwords((string) $aksi); + $data['form_action'] = ci_route("analisis_laporan.{$master}.daftar.{$id}.{$aksi}"); + + view('admin.layouts.components.ttd_pamong', $data); + } + + public function daftar($master, $idSubjek, $aksi = ''): void + { + $analisis = new Analisis(); + $data['total'] = AnalisisResponHasil::where(['id_subjek' => $idSubjek, 'id_periode' => $this->periodeAktif->id])->first()->akumulasi ?? 0; + $data['subjek'] = $analisis->getSubjek($this->analisisMaster, $idSubjek) ?? show_404(); + $data['list_jawab'] = $analisis->listIndikatorLaporan($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_bukti'] = $analisis->listBukti($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_anggota'] = $analisis->listAnggota($this->analisisMaster, $idSubjek); + $data['asubjek'] = $this->analisisMaster->subjek_tipe == AnalisisRefSubjekEnum::DESA ? ucwords(setting('sebutan_desa')) : AnalisisRefSubjekEnum::valueOf($this->analisisMaster->subjek_tipe); + + $data['config'] = $this->header['desa']; + $data['pamong_ttd'] = Pamong::selectData()->where(['pamong_id' => $this->input->post('pamong_ttd')])->first()->toArray(); + $data['pamong_ketahui'] = Pamong::selectData()->where(['pamong_id' => $this->input->post('pamong_ketahui')])->first()->toArray(); + $data['aksi'] = $aksi; + + view('analisis_laporan.form_cetak', $data); + } + + // $aksi = cetak/unduh + public function dialog($master, $aksi = ''): void + { + // Simpan session lama + $data = $this->modal_penandatangan(); + $data['aksi'] = ucwords((string) $aksi); + $data['form_action'] = ci_route("analisis_laporan.{$master}.cetak.{$aksi}"); + + view('analisis_laporan.ttd_pamong', $data); + } + + public function cetak($master, $aksi = ''): void + { + $paramDatatable = json_decode((string) $this->input->post('params'), 1); + $_GET = $paramDatatable; + + $query = $this->sumberData(); + + $data['pamong_ttd'] = Pamong::selectData()->where(['pamong_id' => $this->input->post('pamong_ttd')])->first()->toArray(); + $data['pamong_ketahui'] = Pamong::selectData()->where(['pamong_id' => $this->input->post('pamong_ketahui')])->first()->toArray(); + $data['aksi'] = $aksi; + $data['config'] = $this->header['desa']; + // $data['judul'] = Analisis::judul_subjek($this->analisisMaster->subjek_tipe); + $data['file'] = 'Laporan Hasil Analisis ' . AnalisisRefSubjekEnum::valueOf($this->analisisMaster->subjek_tipe); + $data['isi'] = 'analisis_laporan.table_print'; + $data['main'] = $query->get(); + $data['letak_ttd'] = ['2', '2', '1']; + + view('admin.layouts.components.format_cetak', $data); + } + + public function ajax_multi_jawab($master): void + { + $data['jawab'] = session('jawab') ?? ''; + $data['main'] = (new Analisis)->multi_jawab($master); + $data['form_action'] = ci_route("analisis_laporan.{$master}.multi_jawab_proses"); + + view('analisis_laporan.ajax_multi', $data); + } + + public function multi_jawab_proses($master): void + { + if (isset($_POST['id_cb'])) { + unset($_SESSION['jawab'], $_SESSION['jmkf']); + + $id_cb = $_POST['id_cb']; + $cb = ''; + if (count($id_cb) > 0) { + foreach ($id_cb as $id) { + $cb .= $id . ','; + } + } + set_session('jawab', $cb . '7777777'); + $jawab = session('jawab'); + set_session('jmkf', AnalisisParameter::selectRaw('DISTINCT(id_indikator) AS id_jmkf')->whereRaw('id in ('.$jawab.')')->count()); + } + + redirect(ci_route("analisis_laporan.{$master}")); + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_master.php b/Modules/Analisis/Http/Controllers/Analisis_master.php new file mode 100644 index 000000000..d860f004b --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_master.php @@ -0,0 +1,462 @@ +input->is_ajax_request()) { + $canUpdate = can('u'); + return datatables()->of(AnalisisMaster::query()) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use($canUpdate) : string { + $aksi = 'id).'" class="btn bg-purple btn-sm" title="Rincian Analisis"> '; + if ($canUpdate){ + $aksi .= ' id).'" class="btn bg-orange btn-sm" title="Ubah Data"> '; + if ($row->gform_id){ + $aksi .= ' id).'" class="btn bg-navy btn-sm" title="Update Data Google Form"> '; + } + $aksi .= '   '; + + if ($row->jenis != 1 ) { + $aksi .= ' id).'" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete"> '; + } + } + $aksi .= 'id).'" class="btn bg-navy btn-sm" title="Ekspor Analisis"> '; + + return $aksi; + }) + ->editColumn('subjek_tipe', static fn($q) => AnalisisRefSubjekEnum::valueOf($q->subjek_tipe)) + ->editColumn('gform_last_sync', static fn($q) => tgl_indo($q->gform_last_sync)) + ->rawColumns(['ceklist', 'aksi', 'gform_last_sync']) + ->make(); + } + + return show_404(); + } + + public function form($id = null) + { + isCan('u'); + $data['list_format_impor'] = ['1' => 'BDT 2015']; + $data['list_subjek'] = AnalisisRefSubjekEnum::all(); + $data['list_kelompok'] = KelompokMaster::get()->toArray(); + $data['list_analisis'] = AnalisisMaster::subjekPenduduk()->get()->toArray(); + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_master.update', $id); + $data['analisis_master'] = AnalisisMaster::findOrFail($id); + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_master.insert'); + $data['analisis_master'] = null; + } + + return view('analisis.form', $data); + } + + public function insert(): void + { + isCan('u'); + + if (AnalisisMaster::create(static::validate($this->request))) { + redirect_with('success', 'Berhasil Tambah Data'); + } + redirect_with('error', 'Gagal Tambah Data'); + } + + public function update($id = null): void + { + isCan('u'); + + $data = AnalisisMaster::findOrFail($id); + + if ($data->update(static::validate($this->request, $id))) { + redirect_with('success', 'Berhasil Ubah Data'); + } + redirect_with('error', 'Gagal Ubah Data'); + } + + public function delete($id = null): void + { + isCan('h'); + + if (AnalisisMaster::destroy($id ?? $this->request['id_cb']) !== 0) { + redirect_with('success', 'Berhasil Hapus Data'); + } + redirect_with('error', 'Gagal Hapus Data'); + } + + public function import_analisis(): void + { + isCan('u'); + $data['form_action'] = ci_route("analisis_master.import"); + + view('analisis.import', $data); + } + + public function import(): void + { + isCan('u'); + $config['upload_path'] = sys_get_temp_dir(); + $config['allowed_types'] = 'xlsx'; + + $namaFile = $config['upload_path'].DIRECTORY_SEPARATOR.$this->upload('userfile', $config); + try { + (new Import($namaFile))->analisis(); + redirect_with('success', 'Berhasil import analisis'); + } catch (\Exception $e) { + redirect_with('error', 'Gagal import analisis '.$e->getMessage()); + } + + } + + public function ekspor($id): void + { + $writer = new Writer(); + $master = AnalisisMaster::find($id) ?? show_404(); + $master = $master->toArray(); + //Nama File + $tgl = date('Y_m_d'); + $fileName = 'analisis_' . urlencode((string) $master['nama']) . '_' . $tgl . '.xlsx'; + $writer->openToBrowser($fileName); // stream data directly to the browser + + $this->ekspor_master($writer, $master); + $this->ekspor_pertanyaan($writer, $master); + $this->ekspor_jawaban($writer, $master); + $this->ekspor_klasifikasi($writer, $master); + + $writer->close(); + + redirect('analisis_master'); + } + + private function style_judul(): Style + { + $border = new Border( + new BorderPart(Border::TOP, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::BOTTOM, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::LEFT, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::RIGHT, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID) + ); + + return (new Style()) + ->setFontBold() + ->setFontSize(14) + ->setBorder($border); + } + + private function style_baris(): Style + { + $border = new Border( + new BorderPart(Border::TOP, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::BOTTOM, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::LEFT, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID), + new BorderPart(Border::RIGHT, Color::GREEN, Border::WIDTH_THIN, Border::STYLE_SOLID) + ); + + return (new Style()) + ->setBorder($border); + } + + private function ekspor_master(Writer $writer, array $master): void + { + $sheet = $writer->getCurrentSheet(); + $sheet->setName('master'); + $periode = AnalisisPeriode::active()->where('id_master', $master['id'])->first(); + //Tulis judul + $master_analisis = [ + ['NAMA ANALISIS', $master['nama']], + ['SUBJEK', $master['subjek_tipe']], + ['STATUS', $master['lock']], + ['BILANGAN PEMBAGI', $master['pembagi']], + ['DESKRIPSI ANALISIS', $master['deskripsi']], + ['NAMA PERIODE', $periode->nama ?? ''], + ['TAHUN PENDATAAN', $periode->tahun_pelaksanaan ?? ''], + ]; + + foreach ($master_analisis as $baris_master) { + $baris = [ + $baris_master[0], + $baris_master[1], + ]; + $row = Row::fromValues($baris); + $writer->addRow($row); + } + } + + private function ekspor_pertanyaan(Writer $writer, array $master): void + { + $sheet = $writer->addNewSheetAndMakeItCurrent(); + $sheet->setName('pertanyaan'); + //Tulis judul + $daftar_kolom = [ + ['NO / KODE', 'nomor'], + ['PERTANYAAN / INDIKATOR', 'pertanyaan'], + ['KATEGORI / ASPEK', 'kategori'], + ['TIPE PERTANYAAN', 'id_tipe'], + ['BOBOT', 'bobot'], + ['AKSI ANALISIS', 'act_analisis'], + ]; + $judul = array_column($daftar_kolom, 0); + $header = Row::fromValues($judul, $this->style_judul()); + $writer->addRow($header); + // Tulis data + $indikator = AnalisisIndikator::with(['kategori'])->where(['id_master' => $master['id']])->get()->toArray(); + + foreach ($indikator as $p) { + $baris_data = [$p['nomor'], $p['pertanyaan'], $p['kategori']['kategori'] ?? '', $p['id_tipe'], $p['bobot'], $p['act_analisis']]; + $baris = Row::fromValues($baris_data, $this->style_baris()); + $writer->addRow($baris); + } + } + + private function ekspor_jawaban(Writer $writer, array $master): void + { + $jawaban = $writer->addNewSheetAndMakeItCurrent(); + $jawaban->setName('jawaban'); + //Tulis judul + $daftar_kolom = [ + ['KODE PERTANYAAN', 'nomor'], + ['KODE JAWABAN', 'kode_jawaban'], + ['ISI JAWABAN', 'jawaban'], + ['NILAI', 'nilai'], + ]; + $judul = array_column($daftar_kolom, 0); + $header = Row::fromValues($judul, $this->style_judul()); + $writer->addRow($header); + // Tulis data + $parameter = AnalisisIndikator::with(['parameter'])->where(['id_master' => $master['id']])->get(); + + foreach ($parameter as $p) { + $baris_data = [$p['nomor'], $p['parameter']['kode_jawaban'] ?? '', $p['parameter']['jawaban'] ?? '', $p['parameter']['nilai'] ?? '']; + $baris = Row::fromValues($baris_data, $this->style_baris()); + $writer->addRow($baris); + } + } + + private function ekspor_klasifikasi(Writer $writer, array $master): void + { + $klasifikasi = $writer->addNewSheetAndMakeItCurrent(); + $klasifikasi->setName('klasifikasi'); + //Tulis judul + $daftar_kolom = [ + ['KLASIFIKASI', 'nama'], + ['NILAI MINIMAL', 'minval'], + ['NILAI MAKSIMAL', 'maxval'], + ]; + $judul = array_column($daftar_kolom, 0); + $header = Row::fromValues($judul, $this->style_judul()); + $writer->addRow($header); + // Tulis data + $klasifikasi = AnalisisKlasifikasi::where(['id_master' => $master['id']])->get(); + + foreach ($klasifikasi as $k) { + $baris_data = [$k['nama'], $k['minval'], $k['maxval']]; + $baris = Row::fromValues($baris_data, $this->style_baris()); + $writer->addRow($baris); + } + } + + public function import_gform(): void + { + isCan('u'); + $data['form_action'] = ci_route("analisis_master.exec_import_gform"); + + view('analisis.import_gform', $data); + } + + /** + * 1. Credential + * 2. Id script + * 3. Redirect URI + * + * - Jika 1 dan 2 diisi (asumsi user pakai akun google sendiri) eksekusi dari nilai yg diisi user. Abaikan isisan 3. Redirect ambil dari isian 1 + * - Jika 1 dan 2 kosong. 3 diisi. Import gform langsung menuju redirect field 3 + * - Jika semua tidak terisi (asumsi opensid ini yang jalan di server OpenDesa) ambil credential setting di file config + */ + private function get_redirect_uri() + { + $api_gform_credential = setting('api_gform_credential')?? config_item('api_gform_credential'); + if ($api_gform_credential) { + $credential_data = json_decode(str_replace('\"', '"', $api_gform_credential), true); + $redirect_uri = $credential_data['web']['redirect_uris'][0]; + } + if (empty($redirect_uri)) { + return setting('api_gform_redirect_uri'); + } + + return $redirect_uri; + } + + public function exec_import_gform(): void + { + isCan('u'); + $this->session->google_form_id = $this->request->get('input-form-id'); + + $REDIRECT_URI = $this->get_redirect_uri(); + $protocol = (! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://'; + $self_link = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; + + if ($this->request->get('outsideRetry') == 'true') { + $url = $REDIRECT_URI . '?formId=' . $this->request->get('formId') . '&redirectLink=' . $self_link . '&outsideRetry=true&code=' . $this->input->get('code'); + + $client = new Google\Client(); + $httpClient = $client->authorize(); + $response = $httpClient->get($url); + + $variabel = json_decode((string) $response->getBody(), true); + set_session('data_import', $variabel); + set_session('gform_id', $this->request->get('formId')); + set_session('success', 5); + + redirect('analisis_master'); + } else { + $url = $REDIRECT_URI . '?formId=' . $this->request->get('input-form-id') . '&redirectLink=' . $self_link; + header('Location: ' . $url); + } + } + + public function save_import_gform(): void + { + isCan('u'); + try { + (new Gform($this->request))->save(); + } catch (Exception $e) { + redirect_with('error', $e->getMessage()); + } + + redirect('analisis_master'); + } + + public function update_gform($id = 0): void + { + isCan('u'); + $form_id = AnalisisMaster::find($id)?->gform_id; + + $REDIRECT_URI = $this->get_redirect_uri(); + $protocol = (! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://'; + $self_link = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; + + if ($this->input->get('outsideRetry') == 'true') { + $url = $REDIRECT_URI . '?formId=' . $this->input->get('formId') . '&redirectLink=' . $self_link . '&outsideRetry=true&code=' . $this->input->get('code'); + + $client = new Google\Client(); + $httpClient = $client->authorize(); + $response = $httpClient->get($url); + + $variabel = json_decode((string) $response->getBody(), true); + (new Gform($this->request))->update($id, $variabel); + + redirect('analisis_master'); + } else { + $url = $REDIRECT_URI . '?formId=' . $this->session->google_form_id . '&redirectLink=' . $self_link; + header('Location: ' . $url); + } + } + + public function lock($id): void + { + isCan('u'); + if (AnalisisMaster::gantiStatus($id, 'lock')) { + redirect_with('success', 'Berhasil ubah status analisis'); + } + + redirect_with('error', 'Gagal status analisis'); + } + + public function menu($master){ + $data = [ + 'analisis_master' => AnalisisMaster::findOrFail($master), + ]; + + return view('analisis.menu_default', $data); + } + + protected static function validate(array $request = []): array + { + return [ + 'nama' => judul($request['nama']), + 'subjek_tipe' => $request['subjek_tipe'], + 'id_kelompok' => $request['id_kelompok'] ?: null, + 'lock' => $request['lock'] ?: null, + 'format_impor' => $request['format_impor'] ?: null, + 'pembagi' => bilangan_titik($request['pembagi']), + 'id_child' => $request['id_child'] ?: null, + 'deskripsi' => htmlentities($request['deskripsi']), + ]; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_parameter.php b/Modules/Analisis/Http/Controllers/Analisis_parameter.php new file mode 100644 index 000000000..45cc26bb0 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_parameter.php @@ -0,0 +1,175 @@ + AnalisisMaster::findOrFail($master), + 'selectedMenu' => $this->selectedMenu, + 'baseRoute' => ci_route('analisis_indikator.' . $master . '.parameter.' . $indikator), + ]; + + return view('analisis_parameter.index', $data); + } + + public function datatables($master, $indikator) + { + if ($this->input->is_ajax_request()) { + $canUpdate = can('u'); + $analisisMaster = AnalisisMaster::find($master); + $analisisIndikator = AnalisisIndikator::findOrFail($indikator); + + return datatables()->of(AnalisisParameter::whereIdIndikator($indikator)) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($canUpdate, $analisisMaster, $analisisIndikator): string { + $aksi = ''; + if ($canUpdate) { + $aksi .= 'id}.parameter.{$row->id_indikator}.form", $row->id) . '" class="btn bg-orange btn-sm" title="Ubah Data" data-remote="false" data-toggle="modal" data-target="#modalBox" data-title="Ubah Data Parameter">'; + } + + if ($analisisMaster->jenis != 1 && ! $analisisIndikator->referensi) { + $aksi .= ' id}.parameter.{$row->id_indikator}.delete", $row->id) . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete">'; + } + + return $aksi; + }) + ->rawColumns(['ceklist', 'aksi']) + ->make(); + } + + return show_404(); + } + + public function form($master, $indikator, $id = null) + { + isCan('u'); + $analisisMaster = AnalisisMaster::find($master); + $data['selectedMenu'] = $this->selectedMenu; + $data['analisis_master'] = $analisisMaster; + $data['analisis_indikator'] = AnalisisIndikator::findOrFail($indikator); + $data['analisis_parameter'] = null; + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_indikator.' . $master . '.parameter.' . $indikator . '.update', $id); + $data['analisis_parameter'] = AnalisisParameter::findOrFail($id); + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_indikator.' . $master . '.parameter.' . $indikator . '.insert'); + } + + return view('analisis_parameter.form', $data); + } + + public function insert($master, $indikator): void + { + isCan('u'); + $analisisMaster = AnalisisMaster::findOrFail($master); + if ($analisisMaster->isSystem()) { + redirect_with('error', 'Analisis sistem tidak boleh dirubah', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + $dataInsert = static::validate($this->request); + $dataInsert['id_indikator'] = $indikator; + if (AnalisisParameter::create($dataInsert)) { + redirect_with('success', 'Berhasil Tambah Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + redirect_with('error', 'Gagal Tambah Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + + public function update($master, $indikator, $id = null): void + { + isCan('u'); + $analisisMaster = AnalisisMaster::findOrFail($master); + $dataUpdate = static::validate($this->request, $id); + if ($analisisMaster->isSystem() || $this->request->referensi) { + unset($dataUpdate['kode_jawaban'], $dataUpdate['jawaban']); + } + $data = AnalisisParameter::findOrFail($id); + + if ($data->update($dataUpdate)) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + + public function delete($master, $indikator, $id = null): void + { + isCan('h'); + $analisisMaster = AnalisisMaster::findOrFail($master); + if ($analisisMaster->isSystem()) { + redirect_with('error', 'Analisis sistem tidak boleh dihapus', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + if (AnalisisParameter::destroy($id ?? $this->request['id_cb']) !== 0) { + redirect_with('success', 'Berhasil Hapus Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + redirect_with('error', 'Gagal Hapus Data', ci_route('analisis_indikator.' . $master . '.parameter', $indikator)); + } + + protected static function validate(array $request = []): array + { + return [ + 'kode_jawaban' => bilangan($request['kode_jawaban']), + 'jawaban' => htmlentities($request['jawaban']), + 'nilai' => bilangan($request['nilai']), + ]; + + return $data; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_periode.php b/Modules/Analisis/Http/Controllers/Analisis_periode.php new file mode 100644 index 000000000..b56356389 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_periode.php @@ -0,0 +1,214 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master) + { + return view('analisis_periode.index'); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $canUpdate = can('u'); + $canDelete = can('h'); + + return datatables()->of(AnalisisPeriode::whereIdMaster($master)) + ->addColumn('ceklist', static function ($row) { + if (can('h')) { + return ''; + } + }) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($canUpdate, $canDelete, $master): string { + $aksi = ''; + if ($canUpdate) { + $aksi .= 'id) . '" class="btn bg-orange btn-sm" title="Ubah Data" data-remote="false" data-toggle="modal" data-target="#modalBox" data-title="Ubah Data"> '; + + if ($row->isLock()) { + $aksi .= 'id) . '" class="btn bg-navy btn-sm" title="Nonaktikan"> '; + } else { + $aksi .= 'id) . '" class="btn bg-navy btn-sm" title="Aktifkan"> '; + } + } + + if ($canDelete) { + $aksi .= ' id) . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete"> '; + } + + return $aksi; + }) + ->rawColumns(['ceklist', 'aksi']) + ->make(); + } + + return show_404(); + } + + public function form($master, $id = null) + { + isCan('u'); + $data['tahapan'] = TahapPedataanEnum::all(); + if ($id) { + $data['action'] = 'Ubah'; + $data['form_action'] = ci_route('analisis_periode.' . $master . '.update', $id); + $data['analisis_periode'] = AnalisisPeriode::findOrFail($id); + } else { + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_periode.' . $master . '.insert'); + $data['analisis_periode'] = null; + } + + return view('analisis_periode.form', $data); + } + + public function insert($master): void + { + isCan('u'); + $dataInsert = static::validate($this->request); + $dataInsert['id_master'] = $master; + if ($result = AnalisisPeriode::create($dataInsert)) { + if ($this->request['duplikasi']) { + $this->duplikasi($master, $result->id, $this->request); + } + + redirect_with('success', 'Berhasil Tambah Data', ci_route('analisis_periode.' . $master)); + } + redirect_with('error', 'Gagal Tambah Data', ci_route('analisis_periode.' . $master)); + } + + public function update($master, $id = null): void + { + isCan('u'); + $dataUpdate = static::validate($this->request, $id); + $data = AnalisisPeriode::findOrFail($id); + + if ($data->update($dataUpdate)) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_periode.' . $master)); + } + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_periode.' . $master)); + } + + public function lock($master, $id = null): void + { + isCan('u'); + + if (AnalisisPeriode::gantiStatus($id, 'aktif')) { + redirect_with('success', 'Berhasil Ubah Data', ci_route('analisis_periode.' . $master)); + } + + redirect_with('error', 'Gagal Ubah Data', ci_route('analisis_periode.' . $master)); + } + + public function delete($master, $id = null): void + { + isCan('h'); + + if (AnalisisPeriode::destroy($id ?? $this->request['id_cb']) !== 0) { + redirect_with('success', 'Berhasil Hapus Data', ci_route('analisis_periode.' . $master)); + } + redirect_with('error', 'Gagal Hapus Data', ci_route('analisis_periode.' . $master)); + } + + protected static function validate(array $request = []): array + { + return [ + 'nama' => htmlentities($request['nama']), + 'id_state' => bilangan($request['id_state']), + 'aktif' => bilangan($request['aktif']), + 'keterangan' => htmlentities($request['keterangan']), + 'tahun_pelaksanaan' => bilangan($request['tahun_pelaksanaan']), + ]; + } + + private function duplikasi($idMaster, $idPeriode, $request): void + { + // Jika status aktif, maka nonaktifkan semua periode yang aktif lainnya pada master yang sama + if ($request['aktif'] == 1) { + AnalisisPeriode::where('id_master', $idMaster)->where('id', '!=', $idPeriode)->update(['aktif' => 0]); + } + + if ($request['duplikasi'] == 1) { + $dpd = AnalisisPeriode::where('id_master', $idMaster) + ->where('id', '!=', $idPeriode) + ->orderBy('id', 'desc') + ->first(); + $sblm = $dpd->id; + $skrg = $idPeriode; + + $dataRespon = AnalisisRespon::where('id_periode', $sblm) + ->get(['id_subjek', 'id_indikator', 'id_parameter']); + + if ($dataRespon->isNotEmpty()) { + $dataRespon->each(function ($item) use ($skrg) { + $item->id_periode = $skrg; + }); + + AnalisisRespon::insert($dataRespon->toArray()); + AnalisisResponHasil::preUpdate($idMaster, $skrg); + } + } + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_respon.php b/Modules/Analisis/Http/Controllers/Analisis_respon.php new file mode 100644 index 000000000..02fd14489 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_respon.php @@ -0,0 +1,312 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + if ($master) { + $this->periodeAktif = AnalisisPeriode::whereIdMaster($master)->where(['aktif' => StatusEnum::YA])->first(); + if (! $this->periodeAktif) { + redirect_with('error', 'Tidak ada periode aktif. Entri data respon harus ada periode aktif.', ci_route('analisis_periode', $master)); + } + } + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master) + { + $data = array_merge([ + 'wilayah' => Wilayah::treeAccess(), + 'namaPeriode' => $this->periodeAktif->nama, + ], Analisis::judul_subjek($this->analisisMaster->subjek_tipe)); + + return view('analisis_respon.index', $data); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $sumberData = $this->sumberData(); + + return datatables()->of($sumberData) + ->addIndexColumn() + ->addColumn('aksi', static function ($row) use ($master): string { + $aksi = 'id) . '" class="btn bg-purple btn-sm" title="Input Data">'; + if ($row->bukti_pengesahan) { + $aksi .= ' '; + } + + return $aksi; + })->editColumn('cek', static fn ($q) => '') + ->rawColumns(['ceklist', 'aksi', 'cek']) + ->make(); + } + + return show_404(); + } + + private function sumberData() + { + $dusun = $this->input->get('dusun') ?? null; + $rw = $this->input->get('rw') ?? null; + $rt = $this->input->get('rt') ?? null; + $isi = $this->input->get('isi') ?? null; + + $idCluster = $rt ? [$rt] : []; + + if (empty($idCluster) && ! empty($rw)) { + [$namaDusun, $namaRw] = explode('__', $rw); + $idCluster = Wilayah::whereDusun($namaDusun)->whereRw($namaRw)->select(['id'])->get()->pluck('id')->toArray(); + } + + if (empty($idCluster) && ! empty($dusun)) { + $idCluster = Wilayah::whereDusun($dusun)->select(['id'])->get()->pluck('id')->toArray(); + } + + $analisisMaster = $this->analisisMaster; + $analisSumberData = Analisis::sumberData($analisisMaster->subjek_tipe, $idCluster); + $utama = $analisSumberData['utama']; + $sumber = $analisSumberData['sumber']; + + $sumber->selectRaw('(SELECT a.id_subjek FROM analisis_respon a WHERE a.id_subjek = ' . $utama . ".id AND a.id_periode = {$this->periodeAktif->id} LIMIT 1) as cek") + ->selectRaw("(SELECT b.pengesahan FROM analisis_respon_bukti b WHERE b.id_master = {$analisisMaster->id} AND b.id_periode = {$this->periodeAktif->id} AND b.id_subjek = " . $utama . '.id limit 1) as bukti_pengesahan'); + + if ($isi) { + switch($isi) { + case 1: + $sumber->whereRaw("(SELECT COUNT(id_subjek) FROM analisis_respon_hasil WHERE id_subjek = {$utama}.id AND id_periode = {$this->periodeAktif->id}) > 0"); + break; + + case 2: + $sumber->whereRaw("(SELECT COUNT(id_subjek) FROM analisis_respon_hasil WHERE id_subjek = {$utama}.id AND id_periode = {$this->periodeAktif->id}) = 0"); + break; + } + } + + return $sumber; + } + + public function form($master, $idSubjek) + { + isCan('u'); + $analisis = new Analisis(); + $data['fullscreen'] = $this->input->get('fs') ?? null; + $data['form_action'] = ci_route('analisis_respon.' . $master . '.update', $idSubjek); + $data['idSubjek'] = $idSubjek; + + $data['subjek'] = $analisis->getSubjek($this->analisisMaster, $idSubjek) ?? show_404(); + $data['list_jawab'] = $analisis->listIndikator($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_bukti'] = $analisis->listBukti($this->analisisMaster, $this->periodeAktif->id, $idSubjek); + $data['list_anggota'] = $analisis->listAnggota($this->analisisMaster, $idSubjek); + $data['perbaharui'] = ci_route('analisis_respon.' . $master . '.perbaharui', $idSubjek); + + return view('analisis_respon.form', $data); + } + + public function update($master, $idSubjek): void + { + isCan('u'); + DB::beginTransaction(); + + try { + if (! empty($_FILES['pengesahan']['name'])) { + $per = $this->periodeAktif->id; + $namaFile = implode('_', [$master, $per, $idSubjek, random_int(10000, 99999)]) . '.jpg'; + $config['upload_path'] = LOKASI_PENGESAHAN; + $config['allowed_types'] = 'jpg|jpeg'; + $config['max_size'] = 1024; + $config['file_name'] = $namaFile; + + $namaFile = $this->upload('pengesahan', $config, ci_route('analisis_respon.' . $master . '.form', $idSubjek)); + $bukti['pengesahan'] = $namaFile; + $bukti['id_master'] = $master; + $bukti['id_subjek'] = $idSubjek; + $bukti['id_periode'] = $per; + $bukti = AnalisisResponBukti::firstOrCreate($bukti); + $bukti->pengesahan = $namaFile; + $bukti->save(); + } + AnalisisRespon::updateKuisioner($master, $this->periodeAktif->id, $_POST, $idSubjek); + DB::commit(); + redirect_with('success', 'Berhasil Simpan Data Kuisioner', ci_route('analisis_respon.' . $master . '.form', $idSubjek)); + } catch (Exception $e) { + DB::rollBack(); + log_message('error', $e->getMessage()); + redirect_with('error', 'Gagal Ubah Data Kuisioner ' . $e->getMessage(), ci_route('analisis_respon.' . $master . '.form', $idSubjek)); + } + } + + public function perbaharui($master, $idSubjek): void + { + isCan('u'); + AnalisisRespon::where('id_subjek', $idSubjek)->whereIn('id_indikator', static fn ($q) => $q->select('id')->from('analisis_indikator')->where(['id_master' => $master]))->delete(); + redirect(ci_route('analisis_respon.' . $master . '.form', $idSubjek)); + } + + public function data_ajax(): void + { + $data['analisis_master'] = $this->analisisMaster; + view('analisis_respon.import.data_ajax', $data); + } + + /** + * Unduh data analisis respon + * + * @param int $tipe | 1. Dengan isian data, 2. Dengan kode isian + * @param mixed $master + */ + public function data_unduh($master): void + { + $paramDatatable = json_decode((string) $this->input->post('params'), 1); + $_GET = $paramDatatable; + $tipe = $this->input->post('tipe') ?? 1; + $data['subjek_tipe'] = $this->analisisMaster->subjek_tipe; + $data['main'] = $this->sumberData()->get()->map(function($item){ + + $par = AnalisisRespon::selectRaw('kode_jawaban, asign, jawaban, analisis_respon.id_indikator, analisis_respon.id_parameter AS korek') + ->from('analisis_respon') + ->join('analisis_parameter', 'analisis_parameter.id' ,'=', 'analisis_respon.id_parameter') + ->where('analisis_respon.id_periode', $this->periodeAktif->id) + ->where('analisis_respon.id_subjek', $item->id) + ->orderBy('analisis_respon.id_indikator') + ->get() + ->toArray(); + $item['par'] = $par; + return $item; + })->toArray(); + $data['periode'] = $this->periodeAktif->id; + $data['indikator'] = AnalisisIndikator::indikatorUnduh($master); + $data['tipe'] = $tipe; + $key = ($data['periode'] + 3) * ($this->analisisMaster->id + 7) * ($this->analisisMaster->subjek_tipe * 3); + $data['key'] = 'AN' . $key; + + $data['span_kolom'] = match ($this->analisisMaster->subjek_tipe) { + 5, 6 => 3, + 7 => 5, + 8 => 6, + default => 7, + }; + $data['judul'] = Analisis::judul_subjek($this->analisisMaster->subjek_tipe); + + view('analisis_respon.import.data_unduh', $data); + } + + public function import($master, $op = 0): void + { + isCan('u'); + $data['form_action'] = ci_route("analisis_respon.{$master}.import_proses", $op); + + view('analisis_respon.import.import', $data); + } + + public function import_proses($master, $op = 0): void + { + isCan('u'); + $periode = $this->periodeAktif->id; + $subjekTipe = $this->analisisMaster->subjek_tipe; + DB::beginTransaction(); + + try { + $result = (new AnalisisRespon())->import_respon($master, $periode, $subjekTipe, $op); + DB::commit(); + redirect_with('success', 'Data berhasil diimport', ci_route('analisis_respon.' . $master)); + } catch (Exception $e) { + DB::rollBack(); + redirect_with('error', 'Data gagal diimport ' . $result['pesan'] . ' ' . $e->getMessage(), ci_route('analisis_respon.' . $master)); + } + } + + public function form_impor_bdt($master): void + { + isCan('u'); + $data['form_action'] = ci_route("analisis_respon.{$master}.impor_bdt"); + $data['analisis_master'] = $this->analisisMaster; + + view('analisis_respon.import.impor_bdt', $data); + } + + public function impor_bdt($master): void + { + isCan('u'); + DB::beginTransaction(); + + try { + (new Bdt($master, $this->periodeAktif->id))->impor(); + DB::commit(); + redirect_with('success', 'Data berhasil diimport', ci_route('analisis_respon.' . $master)); + } catch (Exception $e) { + DB::rollBack(); + redirect_with('error', 'Data gagal diimport ' . $e->getMessage(), ci_route('analisis_respon.' . $master)); + } + } + + public function unduh_form_bdt(): void + { + header('location:' . base_url('assets/import/contoh-data-bdt2015.xls')); + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_respon_child.php b/Modules/Analisis/Http/Controllers/Analisis_respon_child.php new file mode 100644 index 000000000..1a17c03a1 --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_respon_child.php @@ -0,0 +1,132 @@ +getPeriodeChild(); + $data['list_jawab'] = $this->listIndikatorChild($idSubjek, $per); + + return view('analisis_respon.child.form', $data); + } + + public function updateChild($master, $parentSubjek, $idSubjek): void + { + isCan('u'); + DB::beginTransaction(); + $per = $this->getPeriodeChild(); + + try { + AnalisisRespon::updateKuisioner($master, $per, $_POST, $idSubjek); + DB::commit(); + redirect_with('success', 'Berhasil Simpan Data Kuisioner', ci_route('analisis_respon.' . $master . '.form', $parentSubjek)); + } catch (Exception $e) { + DB::rollBack(); + log_message('error', $e->getMessage()); + redirect_with('error', 'Gagal Ubah Data Kuisioner ' . $e->getMessage(), ci_route('analisis_respon.' . $master . '.form', $parentSubjek)); + } + } + + public function listIndikatorChild($idSubjek, $periode) + { + $idChild = $this->analisisMaster->id_child; + $per = $periode; + $delik = session('delik'); + $data = AnalisisIndikator::where('id_master', $idChild) + ->orderBy('nomor') + ->get() + ->toArray(); + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $data[$i]['no'] = $i + 1; + + if ($data[$i]['id_tipe'] == 1 || $data[$i]['id_tipe'] == 2) { + $data[$i]['parameter_respon'] = $this->list_jawab4($idSubjek, $data[$i]['id'], $per); + } else { + $data[$i]['parameter_respon'] = ($delik) ? '' : $this->list_jawab5($idSubjek, $data[$i]['id'], $per); + } + } + + return $data; + } + + private function list_jawab4($id = 0, $in = 0, $per = 0) + { + $delik = session('delik'); + $query = AnalisisParameter::selectRaw('id as id_parameter,jawaban,kode_jawaban') + ->where('id_indikator', $in) + ->orderBy('kode_jawaban', 'ASC'); + if ($delik) { + $query->selectRaw('0 as cek'); + } else { + $query->selectRaw('(SELECT count(id_subjek) FROM analisis_respon WHERE id_parameter = analisis_parameter.id AND id_subjek =' . $id . ' AND id_periode=' . $per . ') as cek'); + } + + return $query->get()->toArray(); + } + + private function list_jawab5($id = 0, $in = 0, $per = 0) + { + return AnalisisRespon::selectRaw('analisis_parameter.id as id_parameter,analisis_parameter.jawaban') + ->leftJoin('analisis_parameter', 'analisis_respon.id_parameter', '=', 'analisis_parameter.id') + ->where(['analisis_respon.id_indikator' => $in, 'analisis_respon.id_subjek' => $id, 'analisis_respon.id_periode' => $per]) + ->get() + ->toArray(); + } + + public function getPeriodeChild() + { + $idChild = $this->analisisMaster->id_child; + + return AnalisisPeriode::select('id')->where('id_master', $idChild)->where('aktif', 1)->first()->id; + } +} diff --git a/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php b/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php new file mode 100644 index 000000000..fe720d91c --- /dev/null +++ b/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php @@ -0,0 +1,284 @@ +segment(2); + $this->analisisMaster = AnalisisMaster::findOrFail($master); + if ($master) { + $this->periodeAktif = AnalisisPeriode::whereIdMaster($master)->where(['aktif' => StatusEnum::YA])->first(); + if (! $this->periodeAktif) { + redirect_with('error', 'Tidak ada periode aktif. Untuk laporan ini harus ada periode aktif.', ci_route('analisis_periode', $master)); + } + } + view()->share([ + 'selectedMenu' => $this->selectedMenu, + 'analisis_master' => $this->analisisMaster, + ]); + } + + public function index($master): void + { + + $data['list_tipe'] = TipePertanyaanEnum::all(); + $data['list_kategori'] = AnalisisKategori::where(['id_master' => $master])->get(); + $data['wilayah'] = Wilayah::treeAccess(); + + view('analisis_statistik_jawaban.index', $data); + } + + public function datatables($master) + { + if ($this->input->is_ajax_request()) { + $sumberData = $this->sumberData(); + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $per = $this->periodeAktif->id; + $listCluster = http_build_query($this->listCluster); + + return datatables()->of($sumberData) + ->addIndexColumn() + ->addColumn('par', static fn ($q) => DB::select("SELECT i.id,i.kode_jawaban,i.jawaban,(SELECT COUNT(r.id_subjek) FROM analisis_respon r {$sbj} WHERE r.id_parameter = i.id AND r.id_periode = {$per}) AS jml_p FROM analisis_parameter i WHERE i.id_indikator = {$q->id} ORDER BY i.kode_jawaban AND i.config_id = " . identitas('id'))) + ->editColumn('bobot', static fn ($q) => 'id) . '?' . $listCluster . '" > ' . $q->bobot . '') + ->addColumn('list_cluster', $listCluster) + ->editColumn('act_analisis', static fn ($q) => StatusEnum::valueOf($q->act_analisis)) + ->editColumn('id_tipe', static fn ($q) => TipePertanyaanEnum::valueOf($q->id_tipe)) + ->rawColumns(['ceklist', 'bobot']) + ->make(); + } + + return show_404(); + } + + private function sumberData() + { + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $analisisMaster = $this->analisisMaster; + + return AnalisisIndikator::with(['kategori']) + ->selectRaw('analisis_indikator.*') + ->selectRaw("(SELECT COUNT(DISTINCT r.id_subjek) AS jml FROM analisis_respon r {$sbj} WHERE r.id_indikator = analisis_indikator.id AND r.id_periode = {$this->periodeAktif->id} AND id_parameter > 0) as bobot") + ->where(['id_master' => $analisisMaster->id]); + } + + private function getCluster() + { + $dusun = $this->input->get('dusun') ?? null; + $rw = $this->input->get('rw') ?? null; + $rt = $this->input->get('rt') ?? null; + if ($rt) { + [$namaDusun, $namaRw] = explode('__', $rw); + $this->listCluster['dusun'] = $namaDusun; + $this->listCluster['rw'] = $namaRw; + $this->listCluster['rt'] = $rt; + } + $idCluster = $rt ? [$rt] : []; + + if (empty($idCluster) && ! empty($rw)) { + if (Str::contains($rw, '__') ) { + [$namaDusun, $namaRw] = explode('__', $rw); + } else { + $namaDusun = $dusun; + $namaRw = $rw; + } + + $idCluster = Wilayah::whereDusun($namaDusun)->whereRw($namaRw)->select(['id'])->get()->pluck('id')->toArray(); + $this->listCluster['dusun'] = $namaDusun; + $this->listCluster['rw'] = $namaRw; + } + + if (empty($idCluster) && ! empty($dusun)) { + $idCluster = Wilayah::whereDusun($dusun)->select(['id'])->get()->pluck('id')->toArray(); + $this->listCluster['dusun'] = $dusun; + } + + return $idCluster; + } + + private function getQuerySubject($idCluster) + { + $sbj = ''; + $clusterStr = $idCluster ? ' and a.id in (' . implode(',', $idCluster) . ')' : ''; + + switch ($this->analisisMaster->subjek_tipe) { + case AnalisisRefSubjekEnum::PENDUDUK: $sbj = 'JOIN tweb_penduduk p ON r.id_subjek = p.id JOIN tweb_wil_clusterdesa a ON p.id_cluster = a.id '; + break; + + case AnalisisRefSubjekEnum::KELUARGA: $sbj = 'JOIN tweb_keluarga v ON r.id_subjek = v.id JOIN tweb_penduduk p ON v.nik_kepala = p.id JOIN tweb_wil_clusterdesa a ON p.id_cluster = a.id '; + break; + + case AnalisisRefSubjekEnum::RUMAH_TANGGA: $sbj = 'JOIN tweb_rtm v ON r.id_subjek = v.id JOIN tweb_penduduk p ON v.nik_kepala = p.id JOIN tweb_wil_clusterdesa a ON p.id_cluster = a.id '; + break; + + case AnalisisRefSubjekEnum::KELOMPOK: $sbj = 'JOIN kelompok v ON r.id_subjek = v.id JOIN tweb_penduduk p ON v.id_ketua = p.id JOIN tweb_wil_clusterdesa a ON p.id_cluster = a.id '; + break; + } + $sbj .= $clusterStr; + + return $sbj; + } + + public function grafik_parameter($master, $id = ''): void + { + if ($this->input->get('dusun')) { + $this->filterColumn['dusun'] = $this->input->get('dusun'); + } + if ($this->input->get('rw')) { + $this->filterColumn['rw'] = $this->input->get('rw'); + } + if ($this->input->get('rt')) { + $this->filterColumn['rt'] = $this->input->get('rt'); + } + + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $per = $this->periodeAktif->id; + $data['form_action'] = ci_route("analisis_statistik_jawaban.{$master}.grafik_parameter", $id); + $data['filterColumn'] = $this->filterColumn; + $data['wilayah'] = Wilayah::treeAccess(); + $data['analisis_statistik_jawaban'] = AnalisisIndikator::findOrFail($id); + $data['analisis_master'] = $this->analisisMaster; + $data['main'] = AnalisisParameter::selectRaw('analisis_parameter.*') + ->selectRaw("(SELECT COUNT(r.id_subjek) FROM analisis_respon r {$sbj} WHERE r.id_parameter = analisis_parameter.id AND r.id_periode = {$per}) as nilai") + ->where('id_indikator', $id)->orderBy('kode_jawaban')->get()->toArray(); + + view('analisis_statistik_jawaban.parameter.grafik_table', $data); + } + + public function subjek_parameter($master, $id, $par): void + { + + if ($this->input->get('dusun')) { + $this->filterColumn['dusun'] = $this->input->get('dusun'); + } + if ($this->input->get('rw')) { + $this->filterColumn['rw'] = $this->input->get('rw'); + } + if ($this->input->get('rt')) { + $this->filterColumn['rt'] = $this->input->get('rt'); + } + + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $per = $this->periodeAktif->id; + $listCluster = http_build_query($this->listCluster); + $sql = "SELECT p.id AS id_pend,r.id_subjek,p.nama,p.nik,(SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(tanggallahir)), '%Y')+0 FROM tweb_penduduk WHERE id = p.id AND config_id = " . identitas('id') . ") AS umur,p.sex,a.dusun,a.rw,a.rt FROM analisis_respon r {$sbj} WHERE r.id_parameter = {$par} AND r.id_periode = {$per}"; + $data['filterColumn'] = $this->filterColumn; + $data['wilayah'] = Wilayah::treeAccess(); + $data['form_action'] = ci_route("analisis_statistik_jawaban.{$master}.subjek_parameter.{$id}", $par); + $data['analisis_statistik_pertanyaan'] = AnalisisIndikator::findOrFail($id); + $data['analisis_statistik_jawaban'] = AnalisisParameter::findOrFail($par); + $data['cetak_action'] = ci_route("analisis_statistik_jawaban.{$master}.cetak_subjek.{$id}.{$par}.cetak") . '?' . $listCluster; + $data['unduh_action'] = ci_route("analisis_statistik_jawaban.{$master}.cetak_subjek.{$id}.{$par}.unduh") . '?' . $listCluster; + $data['analisis_master'] = $this->analisisMaster; + $data['main'] = DB::select($sql); + + view('analisis_statistik_jawaban.parameter.subjek_table', $data); + } + + public function cetak($master): void + { + $tipe = $this->input->post('tipe') ?? 'cetak'; + if ($tipe == 'unduh') { + $tgl = date('d_m_Y'); + header('Content-type: application/octet-stream'); + header("Content-Disposition: attachment; filename=statistik_analisis_jawaban_{$tgl}.xls"); + header('Pragma: no-cache'); + header('Expires: 0'); + } + $paramDatatable = json_decode((string) $this->input->post('params'), 1); + $_GET = $paramDatatable; + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $per = $this->periodeAktif->id; + $data['main'] = $this->sumberData()->get()->map(static function ($item) use ($per, $sbj) { + $par = DB::select("SELECT i.id,i.kode_jawaban,i.jawaban,(SELECT COUNT(r.id_subjek) FROM analisis_respon r {$sbj} WHERE r.id_parameter = i.id AND r.id_periode = {$per}) AS jml_p FROM analisis_parameter i WHERE i.id_indikator = {$item->id} ORDER BY i.kode_jawaban AND i.config_id = " . identitas('id')); + $item['par'] = $par; + + return $item; + })->toArray(); + view('analisis_statistik_jawaban.table_print', $data); + } + + public function cetak_subjek($master, $id, $par, $tipe = 'cetak'): void + { + if ($tipe == 'unduh') { + $tgl = date('d_m_Y'); + header('Content-type: application/octet-stream'); + header("Content-Disposition: attachment; filename=subjek_analisis_{$tgl}.xls"); + header('Pragma: no-cache'); + header('Expires: 0'); + } + + $idCluster = $this->getCluster(); + $sbj = $this->getQuerySubject($idCluster); + $per = $this->periodeAktif->id; + $data['analisis_statistik_pertanyaan'] = AnalisisIndikator::findOrFail($id); + $data['analisis_statistik_jawaban'] = AnalisisParameter::findOrFail($par); + $sql = "SELECT p.id AS id_pend,r.id_subjek,p.nama,p.nik,(SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(tanggallahir)), '%Y')+0 FROM tweb_penduduk WHERE id = p.id AND config_id = " . identitas('id') . ") AS umur,p.sex,a.dusun,a.rw,a.rt FROM analisis_respon r {$sbj} WHERE r.id_parameter = {$par} AND r.id_periode = {$per}"; + $data['main'] = DB::select($sql); + view('analisis_statistik_jawaban.parameter.subjek_print', $data); + } +} diff --git a/Modules/Analisis/Http/Controllers/index.html b/Modules/Analisis/Http/Controllers/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/Modules/Analisis/Http/Controllers/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/Modules/Analisis/Http/index.html b/Modules/Analisis/Http/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/Modules/Analisis/Http/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/Modules/Analisis/Libraries/Analisis.php b/Modules/Analisis/Libraries/Analisis.php new file mode 100644 index 000000000..6bd6874ac --- /dev/null +++ b/Modules/Analisis/Libraries/Analisis.php @@ -0,0 +1,451 @@ + 'Nama', + 'nomor' => 'NIK', + 'kolom' => [ + ['data' => 'nid', 'name' => 'nik'], + ['data' => 'nama', 'name' => 'nama'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::KELUARGA: + $judul = [ + 'nama' => 'Kepala Keluarga', + 'nomor' => 'Nomor KK', + 'kolom' => [ + ['data' => 'nid', 'name' => 'no_kk'], + ['data' => 'nama', 'name' => 'penduduk_hidup.nama'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::RUMAH_TANGGA: + $judul = [ + 'nama' => 'Kepala Rumah Tangga', + 'nomor' => 'Nomor Rumah Tangga', + 'kolom' => [ + ['data' => 'nid', 'name' => 'tweb_rtm.no_kk'], + ['data' => 'nama', 'name' => 'penduduk_hidup.nama'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::KELOMPOK: + $judul = [ + 'nama' => 'Nama Kelompok', + 'nomor' => 'ID Kelompok', + 'kolom' => [ + ['data' => 'nid', 'name' => 'kode'], + ['data' => 'nama', 'name' => 'nama'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::DESA: + $desa = ucwords(setting('sebutan_desa')); + $judul = [ + 'nama' => "Nama {$desa}", + 'nomor' => "Kode {$desa}", + 'kolom' => [ + ['data' => 'nid', 'name' => 'kode_desa'], + ['data' => 'nama', 'name' => 'nama_desa'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::DUSUN: + $dusun = ucwords(setting('sebutan_dusun')); + $judul = [ + 'nama' => "Nama {$dusun}", + 'nomor' => $dusun, + 'kolom' => [ + ['data' => 'nid', 'name' => 'dusun'], + ['data' => 'nama', 'name' => 'dusun'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::RW: + $judul = [ + 'nama' => 'Nama ' . setting('sebutan_dusun') . '/RW', + 'nomor' => 'RW', + 'kolom' => [ + ['data' => 'nid', 'name' => 'rw'], + ['data' => 'nama', 'name' => 'rw'], + ], + ]; + break; + + case AnalisisRefSubjekEnum::RT: + $judul = [ + 'nama' => 'Nama ' . setting('sebutan_dusun') . '/RW/RT', + 'nomor' => 'RT', + 'kolom' => [ + ['data' => 'nid', 'name' => 'rt'], + ['data' => 'nama', 'name' => 'rt'], + ], + ]; + break; + + default: + $judul = null; + } + + return $judul; + } + + public static function sumberData($subjek_tipe, $idCluster = []) + { + $sumber = null; + $utama = ''; + + switch ($subjek_tipe) { + case AnalisisRefSubjekEnum::PENDUDUK: + $utama = 'penduduk_hidup'; + $sumber = PendudukHidup::join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->join('tweb_keluarga', 'tweb_keluarga.id', '=', 'penduduk_hidup.id_kk') + ->when($idCluster, static fn ($q) => $q->whereIn('penduduk_hidup.id_cluster', $idCluster)) + ->selectRaw('penduduk_hidup.id, nik AS nid, penduduk_hidup.nama, tweb_keluarga.no_kk as kk, tweb_keluarga.alamat, sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt'); + break; + + case AnalisisRefSubjekEnum::KELUARGA: + $utama = 'keluarga_aktif'; + $sumber = KeluargaAktif::join('penduduk_hidup', 'keluarga_aktif.nik_kepala', '=', 'penduduk_hidup.id') + ->join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->when($idCluster, static fn ($q) => $q->whereIn('penduduk_hidup.id_cluster', $idCluster)) + ->selectRaw('keluarga_aktif.id, keluarga_aktif.no_kk AS nid, penduduk_hidup.nama, penduduk_hidup.nik as kk, keluarga_aktif.alamat, penduduk_hidup.sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt'); + break; + + case AnalisisRefSubjekEnum::RUMAH_TANGGA: + $utama = 'tweb_rtm'; + $sumber = Rtm::join('penduduk_hidup', 'tweb_rtm.nik_kepala', '=', 'penduduk_hidup.id') + ->join('tweb_keluarga', 'tweb_keluarga.id', '=', 'penduduk_hidup.id_kk') + ->join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->when($idCluster, static fn ($q) => $q->whereIn('penduduk_hidup.id_cluster', $idCluster)) + ->selectRaw('tweb_rtm.id, tweb_rtm.no_kk AS nid, penduduk_hidup.nama, penduduk_hidup.nik as kk, tweb_keluarga.alamat, penduduk_hidup.sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt'); + break; + + case AnalisisRefSubjekEnum::KELOMPOK: + $utama = 'kelompok'; + $sumber = Kelompok::leftJoin('penduduk_hidup', 'kelompok.id_ketua', '=', 'penduduk_hidup.id') + ->join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->when($idCluster, static fn ($q) => $q->whereIn('penduduk_hidup.id_cluster', $idCluster)) + ->selectRaw('kelompok.id, kelompok.kode AS nid, kelompok.nama, penduduk_hidup.sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt'); + break; + + case AnalisisRefSubjekEnum::DESA: + $utama = 'config'; + $sumber = Config::selectRaw('config.id, config.kode_desa as nid, config.nama_desa as nama, "-" as sex, "-" as dusun, "-" as rw, "-" as rt'); + break; + + case AnalisisRefSubjekEnum::DUSUN: + $sebutanDusun = setting('sebutan_dusun'); + $utama = 'tweb_wil_clusterdesa'; + $sumber = Wilayah::where('rt', '0')->where('rw', '0') + ->when($idCluster, static fn ($q) => $q->whereIn('id', $idCluster)) + ->selectRaw("id, dusun AS nid, CONCAT(UPPER('" . $sebutanDusun . " '), dusun) as nama, '-' as sex, dusun, '-' as rw, '-' as rt"); + break; + + case AnalisisRefSubjekEnum::RW: + $sebutanDusun = setting('sebutan_dusun'); + $utama = 'tweb_wil_clusterdesa'; + $sumber = Wilayah::where('rt', '0')->where('rw', '!=', '0')->where('rw', '!=', '-') + ->when($idCluster, static fn ($q) => $q->whereIn('id', $idCluster)) + ->selectRaw("id, rw AS nid, CONCAT( UPPER('" . $sebutanDusun . " '), dusun, ' RW ', rw) as nama, '-' as sex, dusun, rw, '-' as rt"); + break; + + case AnalisisRefSubjekEnum::RT: + $sebutanDusun = setting('sebutan_dusun'); + $utama = 'tweb_wil_clusterdesa'; + $sumber = Wilayah::where('rt', '!=', '0')->where('rt', '!=', '-') + ->when($idCluster, static fn ($q) => $q->whereIn('id', $idCluster)) + ->selectRaw("id, rt AS nid, CONCAT( UPPER('" . $sebutanDusun . " '), dusun, ' RW ', rw, ' RT ', rt) as nama, '-' as sex, dusun, rw, rt"); + break; + } + + return ['sumber' => $sumber, 'utama' => $utama]; + } + + public function getSubjek($analisisMaster, $id) + { + $sebutan_dusun = ucwords(setting('sebutan_dusun')); + $subjekTipe = $analisisMaster->subjek_tipe; + $sumber = null; + + switch ($subjekTipe) { + case AnalisisRefSubjekEnum::PENDUDUK: + $sumber = PendudukHidup::selectRaw('penduduk_hidup.*, penduduk_hidup.nik AS nid, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt') + ->selectRaw("CONCAT('{$sebutan_dusun} ', tweb_wil_clusterdesa.dusun, ', RT ', tweb_wil_clusterdesa.rt, ' / RW ', tweb_wil_clusterdesa.rw) as wilayah") + ->join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->where('penduduk_hidup.id', $id); + break; + + case AnalisisRefSubjekEnum::KELUARGA: + $sumber = KeluargaAktif::selectRaw('keluarga_aktif.*, keluarga_aktif.no_kk AS nid, penduduk_hidup.nik AS nik_kepala, penduduk_hidup.nama, penduduk_hidup.sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt') + ->selectRaw("CONCAT('{$sebutan_dusun} ', tweb_wil_clusterdesa.dusun, ', RT ', tweb_wil_clusterdesa.rt, ' / RW ', tweb_wil_clusterdesa.rw) as wilayah") + ->leftJoin('penduduk_hidup', 'keluarga_aktif.nik_kepala', '=', 'penduduk_hidup.id') + ->leftJoin('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->where('keluarga_aktif.id', $id); + + break; + + case AnalisisRefSubjekEnum::RUMAH_TANGGA: + $sumber = Rtm::selectRaw('tweb_rtm.id, tweb_rtm.no_kk AS nid, penduduk_hidup.nama, penduduk_hidup.sex, tweb_wil_clusterdesa.dusun, tweb_wil_clusterdesa.rw, tweb_wil_clusterdesa.rt') + ->join('penduduk_hidup', 'tweb_rtm.nik_kepala', '=', 'penduduk_hidup.id') + ->join('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->where('tweb_rtm.id', $id); + break; + + case AnalisisRefSubjekEnum::KELOMPOK: + $sumber = Kelompok::selectRaw('kelompok.nama AS no_kk, penduduk_hidup.nama') + ->leftJoin('penduduk_hidup', 'kelompok.id_ketua', '=', 'penduduk_hidup.id') + ->leftJoin('tweb_wil_clusterdesa', 'penduduk_hidup.id_cluster', '=', 'tweb_wil_clusterdesa.id') + ->where('kelompok.id', $id); + break; + + case AnalisisRefSubjekEnum::DESA: + $sumber = Config::selectRaw("config.id, config.kode_desa AS nid, config.nama_desa as nama, '-' as sex, '-' as dusun, '-' as rw, '-' as rt") + ->selectRaw(" + config.nama_desa, config.kode_desa, config.kode_pos, config.alamat_kantor, config.telepon as no_telepon_kantor_desa, config.email_desa, CONCAT('Lintang : ', config.lat, ', ', 'Bujur : ', config.lng) as titik_koordinat_desa") + ->selectRaw(' + tweb_desa_pamong.pamong_nip AS nip_kepala_desa, + (case when tweb_penduduk.sex is not null then tweb_penduduk.sex else tweb_desa_pamong.pamong_sex end) as jk_kepala_desa, + (case when tweb_penduduk.pendidikan_kk_id is not null then pendidikan_warga.nama else pendidikan_pamong.nama end) as pendidikan_kepala_desa, + (case when tweb_penduduk.nama is not null then tweb_penduduk.nama else tweb_desa_pamong.pamong_nama end) AS nama_kepala_desa, + tweb_penduduk.telepon as no_telepon_kepala_desa + ') + ->leftJoin('tweb_desa_pamong', 'config.pamong_id', '=', 'tweb_desa_pamong.pamong_id') + ->leftJoin('tweb_penduduk', 'tweb_desa_pamong.id_pend', '=', 'tweb_penduduk.id') + ->leftJoin('tweb_penduduk_pendidikan_kk as pendidikan_warga', 'tweb_penduduk.pendidikan_kk_id', '=', 'pendidikan_warga.id') + ->leftJoin('tweb_penduduk_pendidikan_kk as pendidikan_pamong', 'tweb_desa_pamong.pamong_pendidikan', '=', 'pendidikan_pamong.id') + ->where('config.id', $id); + break; + + case AnalisisRefSubjekEnum::DUSUN: + $sumber = Wilayah::selectRaw("id, dusun AS nid, UPPER('{$sebutan_dusun}') as nama, '-' as sex, dusun, '-' as rw, '-' as rt") + ->where('rt', '0')->where('rw', '0')->where('tweb_wil_clusterdesa.id', $id); + break; + + case AnalisisRefSubjekEnum::RW: + $sumber = Wilayah::selectRaw("id, rw AS nid, CONCAT( UPPER('{$sebutan_dusun} '), dusun, ' RW ', rw) as nama, '-' as sex, dusun, rw, '-' as rt") + ->where('rt', '0')->where('rw', '!=', '0')->where('tweb_wil_clusterdesa.id', $id); + break; + + case AnalisisRefSubjekEnum::RT: + $sumber = Wilayah::selectRaw("id, rt AS nid, CONCAT( UPPER('{$sebutan_dusun} '), dusun, ' RW ', rw, ' RT ', rt) as nama, '-' as sex, dusun, rw, rt") + ->where('rt', '!=', '0')->where('rt', '!=', '-')->where('tweb_wil_clusterdesa.id', $id); + break; + + default: return null; + } + $data = $sumber->first()?->toArray(); + + // Data tambahan subjek desa + if ($subjekTipe == 5) { + $tambahan = [ + 'jumlah_total_penduduk' => PendudukHidup::count(), + 'jumlah_penduduk_laki_laki' => PendudukHidup::where('sex', JenisKelaminEnum::LAKI_LAKI)->count(), + 'jumlah_penduduk_perempuan' => PendudukHidup::where('sex', JenisKelaminEnum::PEREMPUAN)->count(), + 'jumlah_penduduk_pedatang' => PendudukHidup::where('status', 2)->count(), + 'jumlah_penduduk_yang_pergi' => LogPenduduk::where('kode_peristiwa', 3)->count(), + 'jumlah_total_kepala_keluarga' => KeluargaAktif::leftJoin('penduduk_hidup', 'keluarga_aktif.nik_kepala', '=', 'penduduk_hidup.id')->count(), + 'jumlah_kepala_keluarga_laki_laki' => KeluargaAktif::leftJoin('penduduk_hidup', 'keluarga_aktif.nik_kepala', '=', 'penduduk_hidup.id')->where('sex', JenisKelaminEnum::LAKI_LAKI)->count(), + 'jumlah_kepala_keluarga_perempuan' => KeluargaAktif::leftJoin('penduduk_hidup', 'keluarga_aktif.nik_kepala', '=', 'penduduk_hidup.id')->where('sex', JenisKelaminEnum::PEREMPUAN)->count(), + 'jumlah_peserta_bpjs' => PendudukHidup::whereNotNull('bpjs_ketenagakerjaan')->count(), + ]; + + $data = array_merge($data, $tambahan); + } + + return $data; + } + + public function listAnggota($analisisMaster, $id) + { + $subjek = $analisisMaster->subjek_tipe; + if (in_array($subjek, [AnalisisRefSubjekEnum::KELUARGA, AnalisisRefSubjekEnum::RUMAH_TANGGA])) { + switch ($subjek) { + case AnalisisRefSubjekEnum::KELUARGA: + return PendudukHidup::where('id_kk', $id)->orderBy('kk_level')->get()->toArray(); + + case AnalisisRefSubjekEnum::RUMAH_TANGGA: + return PendudukHidup::where('id_rtm', $id)->orderBy('rtm_level')->get()->toArray(); + + default: return null; + } + } + + return null; + } + + public function listIndikator($analisisMaster, $periode, $id) + { + $per = $periode; + $delik = session('delik'); + + $data = AnalisisIndikator::with(['kategori']) + ->where('id_master', $analisisMaster->id) + ->orderByRaw("LPAD(nomor, 10, ' ') ASC") + ->get() + ->toArray(); + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $data[$i]['no'] = $i + 1; + $data[$i]['kategori'] = $data[$i]['kategori']['kategori']; + if ($data[$i]['id_tipe'] == 1 || $data[$i]['id_tipe'] == 2) { + $data[$i]['parameter_respon'] = $this->listJawab2($id, $data[$i]['id'], $per); + } else { + $data[$i]['parameter_respon'] = $delik ? '' : $this->listJawab3($id, $data[$i]['id'], $per); + } + } + + return $data; + } + + private function listJawab2($id = 0, $in = 0, $per = 0) + { + $delik = session('delik'); + $query = AnalisisParameter::selectRaw('id as id_parameter,jawaban,kode_jawaban') + ->where('id_indikator', $in) + ->orderBy('kode_jawaban', 'ASC'); + if ($delik) { + $query->selectRaw('0 as cek'); + } else { + $query->selectRaw('(SELECT count(id_subjek) FROM analisis_respon WHERE id_parameter = analisis_parameter.id AND id_subjek =' . $id . ' AND id_periode=' . $per . ') as cek'); + } + + return $query->get()->toArray(); + } + + private function listJawab3($id = 0, $in = 0, $per = 0) + { + return AnalisisRespon::selectRaw('analisis_parameter.id as id_parameter,analisis_parameter.jawaban') + ->leftJoin('analisis_parameter', 'analisis_respon.id_parameter', '=', 'analisis_parameter.id') + ->where(['analisis_respon.id_indikator' => $in, 'analisis_respon.id_subjek' => $id, 'analisis_respon.id_periode' => $per]) + ->get() + ->toArray(); + } + + public function listBukti($analisisMaster, $periode, $id) + { + $per = $periode; + + return AnalisisResponBukti::select(['pengesahan']) + ->where('id_subjek', $id) + ->where('id_master', $analisisMaster->id) + ->where('id_periode', $per) + ->orderBy('tgl_update', 'DESC') + ->get() + ->toArray(); + } + + private function listJawabLaporan($periode, $idSubjek, $in) + { + $per = $periode; + $obj = AnalisisRespon::selectRaw('analisis_parameter.id as id_parameter, analisis_parameter.jawaban as jawaban,analisis_parameter.nilai') + ->join('analisis_parameter','analisis_respon.id_parameter', '=', 'analisis_parameter.id') + ->where('id_subjek', $idSubjek) + ->where('id_periode', $per) + ->where('analisis_respon.id_indikator', $in) + ->first(); + + $data['jawaban'] = $obj->jawaban ?? '-'; + $data['nilai'] = $obj->nilai ?? '0'; + + return $data; + } + + public function listIndikatorLaporan($analisisMaster, $periode, $id = 0) + { + $data = AnalisisIndikator::where('id_master', $analisisMaster->id)->orderBy('nomor')->get()->toArray(); + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $data[$i]['no'] = $i + 1; + $ret = $this->listJawabLaporan($periode, $id, $data[$i]['id']); + $data[$i]['jawaban'] = $ret['jawaban']; + $data[$i]['nilai'] = $ret['nilai']; + $data[$i]['poin'] = $data[$i]['bobot'] * $ret['nilai']; + } + + return $data; + } + + public function multi_jawab($master) + { + $kf = session('jawab') ?? '7777777'; + + $data = AnalisisIndikator::selectRaw('analisis_indikator.pertanyaan,analisis_indikator.nomor,analisis_parameter.jawaban,analisis_parameter.id AS id_jawaban,analisis_parameter.kode_jawaban') + ->selectRaw("(SELECT count(id) FROM analisis_parameter WHERE id IN ({$kf}) AND id = analisis_parameter.id AND analisis_indikator.config_id = " . identitas('id') . ") AS cek") + ->where('id_master', $master) + ->join('analisis_parameter', 'analisis_parameter.id_indikator', '=', 'analisis_indikator.id') + ->orderBy('nomor')->orderBy('kode_jawaban')->get()->toArray(); + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $data[$i]['no'] = $i + 1; + } + + return $data; + } +} diff --git a/Modules/Analisis/Libraries/Bdt.php b/Modules/Analisis/Libraries/Bdt.php new file mode 100644 index 000000000..bf188007c --- /dev/null +++ b/Modules/Analisis/Libraries/Bdt.php @@ -0,0 +1,369 @@ + 2, + 'nama' => 80, + 'nik' => 81, + 'rtm_level' => 82, + 'awal_respon_rt' => 14, + 'awal_respon_penduduk' => 82, + ]; + private $kolom_subjek; + private $kolom_indikator_pertama; + private $list_id_subjek; + + public function __construct($idMaster, $periode) + { + $this->idMaster = $idMaster; + $this->periode = $periode; + $this->analisisMaster = AnalisisMaster::findOrFail($idMaster); + } + + private function file_import_valid() + { + // error 1 = UPLOAD_ERR_INI_SIZE; lihat Upload.php + // TODO: pakai cara upload yg disediakan Codeigniter + if ($_FILES['bdt']['error'] == 1) { + $upload_mb = max_upload(); + $_SESSION['error_msg'] .= ' -> Ukuran file melebihi batas ' . $upload_mb . ' MB'; + $_SESSION['success'] = -1; + + return false; + } + $tipe_file = TipeFile($_FILES['bdt']); + $mime_type_excel = ['application/vnd.ms-excel', 'application/octet-stream']; + if (! in_array($tipe_file, $mime_type_excel)) { + $_SESSION['error_msg'] .= ' -> Jenis file salah: ' . $tipe_file; + $_SESSION['success'] = -1; + + return false; + } + + return true; + } + + /* + * 1. Impor pengelompokan rumah tangga + * 2. Impor data BDT 2015 ke dalam analisis_respon + * + * Abaikan subjek di data BDT yang tidak ada di database + */ + public function impor(): void + { + $_SESSION['error_msg'] = ''; + $_SESSION['success'] = 1; + if ($this->file_import_valid() == false) { + return; + } + + // Pakai parameter 'false' untuk mengurangi penggunaan memori + // https://github.com/jasonrogena/php-excel-reader/issues/96 + $data = new Spreadsheet_Excel_Reader($_FILES['bdt']['tmp_name'], false); + // Baca jumlah baris berkas BDT + $this->jml_baris = $data->rowcount($sheet_index = 0); + $this->baris_pertama = $this->cari_baris_pertama($data, $this->jml_baris); + if ($this->baris_pertama <= 0) { + $_SESSION['error_msg'] .= ' -> Tidak ada data'; + $_SESSION['success'] = -1; + + return; + } + + // BDT2015 terbatas pada subjek rumah tangga dan penduduk + if ($_SESSION['subjek_tipe'] == 3) { + // Rumah tangga + $this->kolom_subjek = $this->kolom['id_rtm']; + $this->kolom_indikator_pertama = $this->kolom['awal_respon_rt']; + } else { + // Penduduk + $this->kolom_subjek = $this->kolom['nik']; + $this->kolom_indikator_pertama = $this->kolom['awal_respon_penduduk']; + } + + $data_sheet = $data->sheets[0]['cells']; + $this->impor_respon($data_sheet); + } + + private function impor_respon($data_sheet): void + { + $gagal = 0; + $ada = 0; + $sudah_proses = []; + $per = $this->periode; + $indikator = AnalisisIndikator::where('id_master', $this->idMaster)->orderBy('id')->get()->toArray(); + + $respon = []; + + for ($i = $this->baris_pertama; $i <= $this->jml_baris; $i++) { + $data_subjek = $this->tulis_rtm($data_sheet[$i], $rtm); + if (! $data_subjek) { + $gagal++; + + continue; // Jangan impor jika NIK tidak ada di database + } + // Proses setiap subjek sekali saja + if (! in_array($data_sheet[$i][$this->kolom_subjek], $sudah_proses)) { + // $list_id_subjek[nik] = id-penduduk atau $list_id_subjek[id_rtm] = id-rumah-tangga + if ($this->analisisMaster->subjek_tipe == 3) { + $this->list_id_subjek[$data_sheet[$i][$this->kolom_subjek]] = $rtm; + } else { + $this->list_id_subjek[$data_sheet[$i][$this->kolom_subjek]] = $data_subjek['id_penduduk']; + } + $this->siapkan_respon($indikator, $per, $data_sheet[$i], $respon); + $sudah_proses[] = $data_sheet[$i][$this->kolom_subjek]; + $ada++; + } + } + + // echo '

'; + // echo var_dump($this->list_id_subjek); + $this->hapus_respon($this->list_id_subjek); + + // echo '

'; + // echo var_dump($respon); + + $outp = empty($respon) ? false : AnalisisRespon::insert($respon); + (new AnalisisRespon())->pre_update($this->idMaster,$this->periode); + + if (! $outp) { + $_SESSION['success'] = -1; + } + + $nama_subjek = ($_SESSION['subjek_tipe'] == 3) ? 'RUMAH TANGGA' : 'PENDUDUK'; + echo "
JUMLAH PENDUDUK GAGAL : {$gagal}
"; + echo "
JUMLAH {$nama_subjek} BERHASIL : {$ada}
"; + echo 'LANJUT'; + } + + // Hapus semua respon untuk semua subjek pada periode aktif + private function hapus_respon($list_id_subjek): void + { + if (empty($list_id_subjek)) { + return; + } + + $per = $this->periode; + $prefix = $list_id_subjek_str = ''; + + foreach ($list_id_subjek as $id) { + $list_id_subjek_str .= $prefix . "'" . $id . "'"; + $prefix = ', '; + } + + AnalisisRespon::where('id_periode', $per)->whereRaw("id_subjek in({$list_id_subjek_str})")->delete(); + } + + private function cari_baris_pertama(Spreadsheet_Excel_Reader $data, $jml_baris) + { + if ($jml_baris <= 1) { + return 0; + } + + $ada_baris = false; + + // Baris pertama baris judul kolom + for ($i = 2; $i <= $jml_baris; $i++) { + // Baris kedua yang mungkin ditambahkan untuk memudahkan penomoran kolom + if ($data->val($i, 1) == 'KOLOM') { + continue; + } + if (empty($data->val($i, 1))) { + continue; + } + $ada_baris = true; + $baris_pertama = $i; + break; + } + if ($ada_baris) { + return $baris_pertama; + } + + return 0; + } + + private function tulis_rtm($baris, &$rtm) + { + $id_rtm = $baris[$this->kolom['id_rtm']]; + $rtm_level = $baris[$this->kolom['rtm_level']]; + if ($rtm_level > 1) { + $rtm_level = 2; + } //Hanya rekam kepala & anggota rumah tangga + $nik = $baris[$this->kolom['nik']]; + + $pendudukObj = Penduduk::where('nik', $nik)->first(); + if (!$pendudukObj) { + // Laporkan penduduk BDT tidak ada di database + echo "" . $id_rtm . ' ' . $rtm_level . ' ' . $nik . ' ' . $baris[$this->kolom['nama']] . ' == tidak ditemukan di database penduduk.
'; + + return false; + } + + $rtm = Rtm::where('no_kk', $id_rtm)->first()->id; + if ($rtm) { + // Update rumah tangga + if ($rtm_level == 1) { + Rtm::where('id', $rtm)->update(['nik_kepala' => $pendudukObj->id]); + } + } else { + // Tambah rumah tangga + $rtm_data = []; + $rtm_data['no_kk'] = $id_rtm; + if ($rtm_level == 1) { + $rtm_data['nik_kepala'] = $pendudukObj->id; + } + + $rtm = (Rtm::create($rtm_data))->id; + } + + $penduduk = []; + $penduduk['id_rtm'] = $id_rtm; + $penduduk['rtm_level'] = $rtm_level; + $penduduk['updated_at'] = date('Y-m-d H:i:s'); + $penduduk['updated_by'] = auth()->id; + Penduduk::where('nik', $nik)->update($penduduk); + $penduduk['id_penduduk'] = $pendudukObj->id; + + return $penduduk; + } + + private function siapkan_respon($indikator, $per, $baris, &$respon): void + { + foreach ($indikator as $key => $indi) { + $isi = $baris[$this->kolom_indikator_pertama + $key]; + + switch ($indi['id_tipe']) { + case 1: + $list_parameter = $this->parameter_pilihan_tunggal($indi['id'], $isi); + break; + + case 2: + $list_parameter = $this->parameter_pilihan_ganda($indi['id'], $isi); + break; + + default: + $list_parameter = $this->parameter_isian($indi['id'], $isi); + break; + } + + // Himpun respon untuk semua indikator untuk semua baris + foreach ($list_parameter as $parameter) { + if (! empty($parameter)) { + $respon[] = [ + 'id_indikator' => $indi['id'], + 'id_subjek' => $this->list_id_subjek[$baris[$this->kolom_subjek]], + 'id_periode' => $per, + 'id_parameter' => $parameter, + ]; + } + } + } + } + + private function parameter_pilihan_tunggal($id_indikator, $isi) + { + $param = AnalisisParameter::select('id')->where('id_indikator', $id_indikator)->where('kode_jawaban', $isi)->first()->toArray(); + if ($param) { + $in_param = $param['id']; + } elseif ($isi == '') { + $in_param = 0; + } else { + $in_param = -1; + } + + return [$in_param]; + } + + private function parameter_pilihan_ganda($id_indikator, $isi) + { + if (empty($isi)) { + return [null]; + } + $id_isi = explode(',', $isi); + $in_param = []; + + foreach ($id_isi as $isi) { + $param = AnalisisParameter::select('id')->where('id_indikator', $id_indikator)->where('kode_jawaban', $isi)->first()->toArray(); + if ($param['id'] != '') { + $in_param[] = $param['id']; + } + } + + return $in_param; + } + + private function parameter_isian($id_indikator, $isi) + { + if (empty($isi)) { + return [null]; + } + $param = AnalisisParameter::select('id')->where('id_indikator', $id_indikator)->where('jawaban', $isi)->first()->toArray(); + + // apakah sdh ada jawaban yg sama + if ($param) { + $in_param = $param['id']; + } else { + // simpan setiap jawaban yang baru + $parameter = []; + $parameter['jawaban'] = $isi; + $parameter['id_indikator'] = $id_indikator; + $parameter['asign'] = 0; + + $in_param = (AnalisisParameter::create($parameter))->id; + } + + return [$in_param]; + } +} diff --git a/Modules/Analisis/Libraries/Gform.php b/Modules/Analisis/Libraries/Gform.php new file mode 100644 index 000000000..a75517d0a --- /dev/null +++ b/Modules/Analisis/Libraries/Gform.php @@ -0,0 +1,513 @@ +request = $request; + } + + public function save(): array + { + $list_error = []; + + // SIMPAN ANALISIS MASTER + $data_analisis_master = [ + 'nama' => $this->request->get('nama_form') == '' ? 'Response Google Form ' . date('dmY_His') : $this->request->get('nama_form'), + 'subjek_tipe' => $this->request->get('subjek_analisis') == 0 ? 1 : $this->request->get('subjek_analisis'), + 'id_kelompok' => 0, + 'lock' => 1, + 'format_impor' => 0, + 'pembagi' => 1, + 'id_child' => 0, + 'deskripsi' => '', + 'gform_id' => $this->request->get('gform-form-id'), + 'gform_nik_item_id' => $this->request->get('gform-id-nik-kk'), + 'gform_last_sync' => date('Y-m-d H:i:s'), + 'config_id' => identitas('id'), + ]; + $analisisMaster = AnalisisMaster::create($data_analisis_master); + $id_master = $analisisMaster->id; + + // SIMPAN KATEGORI ANALISIS + $list_kategori = $this->request->get('kategori'); + $temp_unique_kategori = []; + $list_unique_kategori = []; + + // Get Unique Value dari Kategori + foreach ($list_kategori as $key => $val) { + if ($this->request->get('is_selected')[$key] != 'true') { + continue; + } + if (in_array($val, $temp_unique_kategori)) { + continue; + } + $temp_unique_kategori[] = $val; + } + + // Simpan Unique Value dari Kategori + foreach ($temp_unique_kategori as $key => $val) { + $data_kategori = [ + 'id_master' => $id_master, + 'kategori' => $val, + 'kategori_kode' => '', + 'config_id' => identitas('id'), + ]; + $kategori = AnalisisKategori::create($data_kategori); + + $list_unique_kategori[$kategori->id] = $val; + } + + // SIMPAN PERTANYAAN/INDIKATOR ANALISIS + $id_column_nik_kk = $this->request->get('id-row-nik-kk'); + $count_indikator = 1; + $db_idx_parameter = []; + $db_idx_indikator = []; + + foreach ($this->request->get('pertanyaan') as $key => $val) { + $temp_idx_parameter = []; + $id_indikator = 0; + if ($this->request->get('is_selected')[$key] == 'true' && $key != $id_column_nik_kk) { + $data_indikator = [ + 'id_master' => $id_master, + 'nomor' => $count_indikator, + 'pertanyaan' => $val, + 'id_tipe' => $this->request->get('tipe')[$key], + 'bobot' => $this->request->get('bobot')[$key], + 'act_analisis' => 0, + 'id_kategori' => array_search($this->request->get('kategori')[$key], $list_unique_kategori, true), + 'is_publik' => 0, + 'is_teks' => 0, + ]; + + if ($data_indikator['id_tipe'] != 1) { + $data_indikator['act_analisis'] = 2; + $data_indikator['bobot'] = 0; + } + + $data_indikator['config_id'] = identitas('id'); + $analisisIndikator = AnalisisIndikator::create($data_indikator); + $id_indikator = $analisisIndikator->id; + + // Simpan Parameter untuk setiap unique value pada masing-masing indikator + foreach ($this->request->get('unique-param-value-' . $key) as $param_key => $param_val) { + $param_nilai = ($this->request->get('unique-param-nilai-' . $key)[$param_key] == '') ? 0 : $this->request->get('unique-param-nilai-' . $key)[$param_key]; + + $data_parameter = [ + 'id_indikator' => $id_indikator, + 'jawaban' => $this->request->get('unique-param-value-' . $key)[$param_key], + 'nilai' => $param_nilai, + 'kode_jawaban' => ($param_key + 1), + 'asign' => 0, + 'config_id' => identitas('id'), + ]; + $analisisParameter = AnalisisParameter::create($data_parameter); + $id_parameter = $analisisParameter->id; + $temp_idx_parameter[$id_parameter] = $param_val; + } + + $count_indikator++; + } + $db_idx_indikator[$id_indikator] = $key; + $db_idx_parameter[] = $temp_idx_parameter; + } + + // SIMPAN PERIODE ANALISIS + $data_periode = [ + 'id_master' => $id_master, + 'nama' => 'Pendataan ' . date('dmY_His'), + 'id_state' => 1, + 'aktif' => 1, + 'keterangan' => 0, + 'tahun_pelaksanaan' => $this->request->get('tahun_pendataan') == '' ? date('Y') : $this->request->get('tahun_pendataan'), + 'config_id' => identitas('id'), + ]; + $analisisPeriode = AnalisisPeriode::create($data_periode); + $id_periode = $analisisPeriode->id; + + // SIMPAN RESPON ANALISIS + $data_import = session('data_import'); + + // Iterasi untuk setiap subjek + foreach ($data_import['jawaban'] as $key_jawaban => $val_jawaban) { + // Get Id Subjek berdasarkan Tipe Subjek (Penduduk / Keluarga / Rumah Tangga / Kelompok) + $nik_kk_subject = $val_jawaban[$id_column_nik_kk]; + if ($data_analisis_master['subjek_tipe'] == AnalisisRefSubjekEnum::KELUARGA) { + $id_subject = Keluarga::where(['no_kk' => $nik_kk_subject])->first()?->id; + } else { + $id_subject = Penduduk::where(['nik' => $nik_kk_subject])->first()?->id; + } + + if ($id_subject != null && $id_subject != '') { + // Iterasi untuk setiap indikator / jawaban dari subjek + foreach ($this->request->get('pertanyaan') as $key_pertanyaan => $val_pertanyaan) { + if ($this->request->get('is_selected')[$key_pertanyaan] == 'true' && $key_pertanyaan != $id_column_nik_kk) { + $data_respon = [ + 'id_indikator' => array_search($key_pertanyaan, $db_idx_indikator, true), + 'id_parameter' => array_search($val_jawaban[$key_pertanyaan], $db_idx_parameter[$key_pertanyaan], true), + 'id_subjek' => $id_subject, + 'id_periode' => $id_periode, + ]; + + AnalisisRespon::create($data_respon); + } + } + } else { + $list_error[] = 'NIK / No. KK data ke-' . ($key_jawaban + 1) . ' (' . $nik_kk_subject . ') ' . $id_subject . ' tidak valid'; + } + } + + return ['error' => $list_error]; + } + + protected function getOAuthCredentialsFile() + { + // Hanya ambil dari config jika tidak ada setting aplikasi utk redirect_uri + $api_gform_credential = setting('api_gform_credential') ?? config_item('api_gform_credential'); + return json_decode(str_replace('\"', '"', $api_gform_credential), true); + } + + public function import_gform($redirect_link = '') + { + // Check Credential File + if (! $oauth_credentials = $this->getOAuthCredentialsFile()) { + echo 'ERROR - File Credential Not Found'; + + return; + } + + $redirect_uri = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; + + // Get the API client and construct the service object. + $client = new Client(); + $client->setAuthConfig($oauth_credentials); + $client->setRedirectUri($redirect_uri); + $client->addScope('https://www.googleapis.com/auth/forms'); + $client->addScope('https://www.googleapis.com/auth/spreadsheets'); + $service = new Script($client); + + // API script id + // Hanya ambil dari config jika tidak ada setting aplikasi unrtuk redirect_uri + if (empty(setting('api_gform_id_script')) && empty(setting('api_gform_redirect_uri'))) { + $script_id = config_item('api_gform_script_id'); + } else { + $script_id = setting('api_gform_id_script'); + } + // add "?logout" to the URL to remove a token from the session + if (isset($_REQUEST['logout'])) { + unset($_SESSION['upload_token']); + } + + if (isset($_GET['code'])) { + $token = $client->fetchAccessTokenWithAuthCode($_GET['code']); + $client->setAccessToken($token); + + // store in the session also + $_SESSION['upload_token'] = $token; + } + + // set the access token as part of the client + if (! empty($_SESSION['upload_token'])) { + $client->setAccessToken($_SESSION['upload_token']); + if ($client->isAccessTokenExpired()) { + unset($_SESSION['upload_token']); + } + } else { + $authUrl = $client->createAuthUrl(); + } + + // Create an execution request object. + $request = new ExecutionRequest(); + $request->setFunction('getFormItems'); + $form_id = session('google_form_id'); + if ($form_id == '') { + $form_id = session('gform_id'); + } + $request->setParameters($form_id); + + try { + if (isset($authUrl) && $_SESSION['inside_retry'] != true) { + // If no authentication before + set_session('form_id', $form_id); + set_session('inside_retry', true); + set_session('inside_redirect_link', $redirect_link); + header('Location: ' . $authUrl); + } else { + // If it has authenticated + // Make the API request. + $response = $service->scripts->run($script_id, $request); + + if ($response->getError()) { + echo 'Error'; + // The API executed, but the script returned an error. + + // Extract the first (and only) set of error details. The values of this + // object are the script's 'errorMessage' and 'errorType', and an array of + // stack trace elements. + $error = $response->getError()['details'][0]; + printf("Script error message: %s\n", $error['errorMessage']); + + if (array_key_exists('scriptStackTraceElements', $error)) { + // There may not be a stacktrace if the script didn't start executing. + echo "Script error stacktrace:\n"; + + foreach ($error['scriptStackTraceElements'] as $trace) { + printf("\t%s: %d\n", $trace['function'], $trace['lineNumber']); + } + } + } else { + // Get Response + $resp = $response->getResponse(); + + return $resp['result']; + } + } + } catch (Exception $e) { + // The API encountered a problem before the script started executing. + echo 'Caught exception: ', $e->getMessage(), "\n"; + } + + return '0'; + } + + public function update($id, $variabel) + { + // Get data analisis master + $master_data = AnalisisMaster::find($id)->toArray(); + + // Get existing data indikator (pertanyaan) dan parameter (jawaban) + $existing_data = AnalisisIndikator::where(['id_master' => $id])->get()?->toArray(); + + // Get existing respon + $id_periode_aktif = AnalisisPeriode::active()->where(['id_master' => $id])->first()->toArray(); + $existing_respon = $this->get_respon_by_id_periode($id_periode_aktif, $master_data['subjek_tipe']); + + $id_column_nik_kk = 0; + $list_error = []; + $list_pertanyaan = []; + + $deleted_responden = []; + $deleted_jawaban = []; + + foreach ($variabel['pertanyaan'] as $key_pertanyaan => $val_pertanyaan) { + // Mencari kolom NIK/No. KK pada form + if ($val_pertanyaan['itemId'] == $master_data['gform_nik_item_id']) { + $id_column_nik_kk = $key_pertanyaan; + } + } + + // Cek keberadaan existing indikator pada data terkini, jika SALAH SATU SAJA hilang maka proses tidak dapat dilanjutkan + foreach ($existing_data['indikator'] as $key_indikator => $val_indikator) { + if (! array_search($val_indikator, array_column($variabel['pertanyaan'], 'title'), true)) { + $list_error[] = 'Terdapat kolom yang hilang pada hasil response Google Form terkini (' . $val_indikator . ')'; + } + } + + if ($list_error) { + + return ['error' => $list_error]; + } + + // Mencari nilai untuk pertanyaan-pertanyaan yang dimasukkan sebelumnya + foreach ($existing_data['indikator'] as $key_indikator => $val_indikator) { + foreach ($variabel['pertanyaan'] as $val_pertanyaan) { + if ($val_indikator == $val_pertanyaan['title']) { + // Mengisi nilai + $list_pertanyaan[$key_indikator] = $val_pertanyaan; + + // Cek jawaban yang tidak terpakai + $deleted_jawaban[$key_indikator] = $existing_data['parameter'][$key_indikator]; + + foreach ($existing_data['parameter'][$key_indikator] as $key_param => $val_param) { + if (array_search($val_param, $val_pertanyaan['choices'], true)) { + unset($deleted_jawaban[$key_indikator][$key_param]); + } + } + + $new_parameter = []; + + // Insert jawaban baru + foreach ($val_pertanyaan['choices'] as $val_choice) { + // Jika nilai belum ada di database, maka tambahkan data parameter baru + if (! (array_search($val_choice, $existing_data['parameter'][$key_indikator], true))) { + $data_parameter = [ + 'id_indikator' => $key_indikator, + 'jawaban' => $val_choice, + 'nilai' => 0, + 'kode_jawaban' => 0, + 'asign' => 0, + 'config_id' => identitas('id'), + ]; + $analisisParameter = AnalisisParameter::create($data_parameter); + $id_parameter = $analisisParameter->id; + $data_parameter['id'] = $id_parameter; + $new_parameter[$id_parameter] = $val_choice; + } + } + + // Update list parameter dengan operasi Union antara parameter yang sudah ada dengan parameter yang baru ditambahkan + $existing_data['parameter'][$key_indikator] += $new_parameter; + + break; + } + } + } + + foreach ($existing_respon as $key_respon => $val_respon) { + if (! in_array($key_respon, array_column($variabel['jawaban'], $id_column_nik_kk), true)) { + $deleted_responden[$key_respon] = $val_respon; + } + } + + foreach ($variabel['jawaban'] as $key_responden => $val_responden) { + $nik_kk = $val_responden[$id_column_nik_kk]; + + if ($master_data['subjek_tipe'] == AnalisisRefSubjekEnum::KELUARGA) { + $id_subject = Keluarga::where(['no_kk' => $nik_kk])->first()?->id; + } else { + $id_subject = Penduduk::where(['no_kk' => $nik_kk])->first()?->id; + } + + if ($id_subject != null && $id_subject != '') { // Jika NIK valid + foreach ($val_responden as $key_jawaban => $val_jawaban) { + $id_indikator = array_search($variabel['pertanyaan'][$key_jawaban], $list_pertanyaan, true); // Cek apakah kolom yang telah ada + + if ($id_indikator) { + $id_parameter = array_search($val_jawaban, $existing_data['parameter'][$id_indikator], true); // Jawaban terkini + + if (isset($existing_respon[$val_responden[$id_column_nik_kk]])) { + // Jika Responden sudah pernah disimpan + $obj_respon = $existing_respon[$nik_kk][$id_indikator]; + + if ($obj_respon['id_parameter'] != $id_parameter) { + $where = [ + 'id_indikator' => $id_indikator, + 'id_subjek' => $obj_respon['id_subjek'], + 'id_periode' => $obj_respon['id_periode'], + ]; + AnalisisRespon::where($where)->delete(); + + $data_respon = [ + 'id_indikator' => $id_indikator, + 'id_parameter' => $id_parameter, + 'id_subjek' => $obj_respon['id_subjek'], + 'id_periode' => $obj_respon['id_periode'], + ]; + AnalisisRespon::create($data_respon); + } + } else { + // Jika Responden belum pernah disimpan (Responden Baru) + $data_respon = [ + 'id_indikator' => $id_indikator, + 'id_parameter' => $id_parameter, + 'id_subjek' => $id_subject, + 'id_periode' => $id_periode_aktif, + ]; + + AnalisisRespon::create($data_respon); + } + } + } + } else { + $list_error[] = 'NIK / No. KK data ke-' . ($key_responden + 1) . ' (' . $nik_kk . ') tidak valid'; + } + } + + // Hapus data responden yang tidak ada di response terkini + foreach (array_keys($deleted_responden) as $key_responden) { + if ($master_data['subjek_tipe'] == AnalisisRefSubjekEnum::KELUARGA) { + $id_subject = Keluarga::where(['no_kk' => $nik_kk])->first()?->id; + } else { + $id_subject = Penduduk::where(['no_kk' => $nik_kk])->first()?->id; + } + + $where = [ + 'id_subjek' => $id_subject, + 'id_periode' => $id_periode_aktif, + ]; + AnalisisRespon::where($where)->delete(); + } + + // Update gform_last_sync + $update_data = [ + 'gform_last_sync' => date('Y-m-d H:i:s'), + ]; + + AnalisisMaster::where('id', $id)->update($update_data); + + return ['error' => $list_error]; + } + + public function get_respon_by_id_periode($id_periode = 0, $subjek = 1) + { + $result = []; + if ($subjek == 1) { // Untuk Subjek Penduduk + $list_penduduk = AnalisisRespon::selectRaw('analisis_respon.*, tweb_penduduk.nik')->join('tweb_penduduk','tweb_penduduk.id','analisis_respon.id_subjek')->where(['id_periode' => $id_periode])->get()?->toArray(); + + foreach ($list_penduduk as $penduduk) { + $result[$penduduk['nik']][$penduduk['id_indikator']] = $penduduk; + } + } else { // Untuk Subjek Keluarga + $list_keluarga = AnalisisRespon::selectRaw('analisis_respon.*, tweb_keluarga.no_kkk')->join('tweb_keluarga','tweb_keluarga.id','analisis_respon.id_subjek')->where(['id_periode' => $id_periode])->get()?->toArray(); + + foreach ($list_keluarga as $keluarga) { + $result[$keluarga['no_kk']][$keluarga['id_indikator']] = $keluarga; + } + } + + return $result; + } +} diff --git a/Modules/Analisis/Libraries/Import.php b/Modules/Analisis/Libraries/Import.php new file mode 100644 index 000000000..e6f9963c8 --- /dev/null +++ b/Modules/Analisis/Libraries/Import.php @@ -0,0 +1,214 @@ +file = $file; + } + public function analisis($kode = '00000', $jenis = 2): void + { + $reader = new Reader(); + $reader->open($this->file); + $id_master = null; + + foreach ($reader->getSheetIterator() as $sheet) { + switch ($sheet->getName()) { + case 'master': + $id_master = $this->impor_master($sheet, $kode, $jenis); + break; + + case 'pertanyaan': + $this->impor_pertanyaan($sheet, $id_master); + break; + + case 'jawaban': + $this->impor_jawaban($sheet, $id_master); + break; + + case 'klasifikasi': + $this->impor_klasifikasi($sheet, $id_master); + break; + default: + } + } + $reader->close(); + } + + private function impor_master($sheet, $kode, $jenis) + { + $master = []; + + foreach ($sheet->getRowIterator() as $index => $row) { + $cells = $row->getCells(); + + switch ($index) { + case 1: // Nama analisis + $master['nama'] = $cells[1]->getValue(); + break; + + case 2: // Subjek + $master['subjek_tipe'] = $cells[1]->getValue(); + break; + + case 3: // Status + $master['lock'] = $cells[1]->getValue(); + break; + + case 4: // Bilangan Pembagi + $master['pembagi'] = $cells[1]->getValue(); + break; + + case 5: // Deskripsi Analisis + $master['deskripsi'] = $cells[1]->getValue(); + $periode['keterangan'] = $cells[1]->getValue(); + break; + + case 6: // Nama Periode + $periode['nama'] = $cells[1]->getValue(); + break; + + case 7: // Tahun Pendataan + $periode['tahun_pelaksanaan'] = $cells[1]->getValue(); + break; + } + } + $master['kode_analisis'] = $kode; + $master['jenis'] = $jenis; + $master['config_id'] = identitas('id'); + + $analisisMaster = AnalisisMaster::create($master); + + $periode['id_master'] = $analisisMaster->id; + $periode['aktif'] = 1; + $periode['config_id'] = identitas('id'); + + AnalisisPeriode::create($periode); + + return $analisisMaster->id; + } + + private function impor_pertanyaan($sheet, $id_master) + { + foreach ($sheet->getRowIterator() as $index => $row) { + if ($index == 1) { + continue; + } // Abaikan baris judul + $cells = $row->getCells(); + // Tambahkan indikator + $indikator = []; + $indikator['id_master'] = $id_master; + $indikator['nomor'] = $cells[0]->getValue(); + $indikator['pertanyaan'] = $cells[1]->getValue(); + $indikator['id_kategori'] = $this->get_id_kategori($cells[2]->getValue(), $id_master); + $indikator['id_tipe'] = $cells[3]->getValue(); + $indikator['config_id'] = identitas('id'); + if (! empty($cells[4]) && $cells[4]->getValue()) { + $indikator['bobot'] = (int) $cells[4]->getValue(); + } + if (! empty($cells[5]) && $cells[5]->getValue()) { + $indikator['act_analisis'] = $cells[5]->getValue(); + } + + AnalisisIndikator::create($indikator); + } + } + + private function get_id_kategori($kategori, $id_master) + { + $adaKategori = AnalisisKategori::firstOrCreate(['kategori' => $kategori, 'id_master' =>$id_master]); + return $adaKategori->id; + } + + private function impor_jawaban($sheet, $id_master) + { + foreach ($sheet->getRowIterator() as $index => $row) { + if ($index == 1) { + continue; + } // Abaikan baris judul + $cells = $row->getCells(); + // Tambahkan parameter + $parameter = []; + $parameter['id_indikator'] = $this->get_id_indikator($cells[0]->getValue(), $id_master); + $parameter['jawaban'] = $cells[2]->getValue(); + $parameter['config_id'] = identitas('id'); + if (! empty($cells[1]) && $cells[1]->getValue()) { + $parameter['kode_jawaban'] = $cells[1]->getValue(); + } + if (! empty($cells[3]) && $cells[3]->getValue()) { + $parameter['nilai'] = $cells[3]->getValue(); + } + AnalisisParameter::create($parameter); + } + } + + private function get_id_indikator($kode_pertanyaan, $id_master) + { + return AnalisisIndikator::where(['id_master' => $id_master, 'nomor' => $kode_pertanyaan])->first()?->id; + } + + private function impor_klasifikasi($sheet, $id_master) + { + foreach ($sheet->getRowIterator() as $index => $row) { + if ($index == 1) { + continue; + } // Abaikan baris judul + $cells = $row->getCells(); + // Tambahkan parameter + $klasifikasi = []; + $klasifikasi['id_master'] = $id_master; + $klasifikasi['nama'] = $cells[0]->getValue(); + $klasifikasi['minval'] = $cells[1]->getValue(); + $klasifikasi['maxval'] = $cells[2]->getValue(); + $klasifikasi['config_id'] = identitas('id'); + + AnalisisKlasifikasi::create($klasifikasi); + } + } +} diff --git a/Modules/Analisis/Models/AnalisisIndikator.php b/Modules/Analisis/Models/AnalisisIndikator.php new file mode 100644 index 000000000..8998f47be --- /dev/null +++ b/Modules/Analisis/Models/AnalisisIndikator.php @@ -0,0 +1,433 @@ +belongsTo(AnalisisKategori::class, 'id_kategori'); + } + + /** + * Get all of the parameter for the AnalisisIndikator + */ + public function parameter(): HasMany + { + return $this->hasMany(AnalisisParameter::class, 'id_indikator'); + } + + public static function hubungan($sasaran) + { + switch ($sasaran) { + + // Penduduk + case 1: + $data = [ + 'kk_level' => [ + 'judul' => 'Hubungan Dalam Keluarga', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_hubungan'), + ], + 'rtm_level' => [ + 'judul' => 'Hubungan Dalam Rumah Tangga', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_rtm_hubungan'), + ], + 'sex' => [ + 'judul' => 'Jenis Kelamin', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_sex'), + ], + 'tempatlahir' => [ + 'judul' => 'Tempat Lahir', + ], + 'tanggallahir' => [ + 'judul' => 'Tanggal Lahir', + ], + 'agama_id' => [ + 'judul' => 'Agama', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_agama'), + ], + 'pendidikan_kk_id' => [ + 'judul' => 'Pendidikan Dalam KK', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_pendidikan_kk'), + ], + 'pendidikan_sedang_id' => [ + 'judul' => 'Pendidikan Sedang Ditempuh', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_pendidikan'), + ], + 'pekerjaan_id' => [ + 'judul' => 'Pekerjaan', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_pekerjaan'), + ], + 'status_kawin' => [ + 'judul' => 'Status_perkawinan', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_kawin'), + ], + 'warganegara_id' => [ + 'judul' => 'Kewarganegaraan', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_warganegara'), + ], + 'dokumen_pasport' => [ + 'judul' => 'Dokumen Passport', + ], + 'dokumen_kitas' => [ + 'judul' => 'Dokumen KITAS', + ], + 'ayah_nik' => [ + 'judul' => 'NIK Ayah', + ], + 'nama_ayah' => [ + 'judul' => 'Nama Ayah', + ], + 'ibu_nik' => [ + 'judul' => 'NIK Ibu', + ], + 'nama_ibu' => [ + 'judul' => 'Nama Ibu', + ], + 'golongan_darah_id' => [ + 'judul' => 'Golongan Darah', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_golongan_darah'), + ], + // id_cluster => wilayah, agar tdk duplikasi + 'wilayah' => [ + 'judul' => 'Wilayah (Dusun/RW/RT)', + ], + 'status' => [ + 'judul' => 'Status Penduduk', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_status'), + ], + 'alamat_sebelumnya' => [ + 'judul' => 'Alamat Sebelumnya', + ], + 'alamat_sekarang' => [ + 'judul' => 'Alamat Sekarang', + ], + 'status_dasar' => [ + 'judul' => 'Status Dasar', + // 'referensi' => $this->referensi_model->list_data('tweb_status_dasar'), + ], + 'hamil' => [ + 'judul' => 'Status Kehamilan', + ], + 'cacat_id' => [ + 'judul' => 'Jenis Cacat', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_cacat'), + ], + 'sakit_menahun_id' => [ + 'judul' => 'Sakit Menahun', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_sakit_menahun'), + ], + 'akta_lahir' => [ + 'judul' => 'Akta Lahir', + ], + 'akta_perkawinan' => [ + 'judul' => 'Akta Perkawinan', + ], + 'tanggalperkawinan' => [ + 'judul' => 'Tanggal Perkawinan', + ], + 'akta_perceraian' => [ + 'judul' => 'Akta Perceraian', + ], + 'tanggalperceraian' => [ + 'judul' => 'Tanggal Perceraian', + ], + 'cara_kb_id' => [ + 'judul' => 'Akseptor KB', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_cara_kb'), + ], + 'telepon' => [ + 'judul' => 'Telepon', + ], + 'tanggal_akhir_paspor' => [ + 'judul' => 'Tanggal Akhir Paspor', + ], + 'no_kk_sebelumnya' => [ + 'judul' => 'No. KK Sebelumnya', + ], + 'ktp_el' => [ + 'judul' => 'E-KTP', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_status_ktp'), + ], + 'status_rekam' => [ + 'judul' => 'Status Rekam', + // 'referensi' => $this->referensi_model->list_status_rekam(), + ], + 'waktu_lahir' => [ + 'judul' => 'Waktu Lahir', + ], + 'tempat_dilahirkan' => [ + 'judul' => 'Tempat Dilahirkan', + ], + 'jenis_kelahiran' => [ + 'judul' => 'Jenis Kelahiran', + ], + 'kelahiran_anak_ke' => [ + 'judul' => 'Kelahiran Anak Ke - ', + 'tipe' => 3, + ], + 'penolong_kelahiran' => [ + 'judul' => 'Penolong Kelahiran', + ], + 'berat_lahir' => [ + 'judul' => 'Berat lahir', + 'tipe' => 3, + ], + 'panjang_lahir' => [ + 'judul' => 'Panjang Lahir', + 'tipe' => 3, + ], + 'tag_id_card' => [ + 'judul' => 'Tag ID Card', + ], + 'id_asuransi' => [ + 'judul' => 'ID Asuransi', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_asuransi'), + ], + 'no_asuransi' => [ + 'judul' => 'No. Asusransi', + ], + 'email' => [ + 'judul' => 'Email', + ], + 'bahasa_id' => [ + 'judul' => 'Dapat Membaca Huruf', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('ref_penduduk_bahasa'), + ], + 'negara_asal' => [ + 'judul' => 'Negara Asal', + ], + 'tempat_cetak_ktp' => [ + 'judul' => 'Tempat Cetak KTP', + ], + 'tanggal_cetak_ktp' => [ + 'judul' => 'Tanggal Cetak KTP', + ], + 'suku' => [ + 'judul' => 'Suku/Etnis', + ], + 'bpjs_ketenagakerjaan' => [ + 'judul' => 'BPJS Ketenagakerjaan', + ], + ]; + break; + + // Keluarga + case 2: + $data = [ + 'nik_kepala' => [ + 'judul' => 'NIK Kepala KK', + ], + 'kelas_sosial' => [ + 'judul' => 'Kelas Sosial', + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_keluarga_sejahtera'), + ], + 'alamat' => [ + 'judul' => 'Alamat', + ], + // id_cluster => wilayah, agar tdk duplikasi + 'wilayah' => [ + 'judul' => 'Wilayah (Dusun/RW/RT)', + ], + ]; + break; + + // Desa + default: + + $desa = setting('sebutan_desa'); + $kepala = setting('sebutan_kepala_desa'); + + $data = [ + + // IDENTITAS DESA + 'nama_desa' => [ + 'judul' => 'Nama ' . $desa, + ], + 'kode_desa' => [ + 'judul' => 'Kode ' . $desa, + ], + 'kode_pos' => [ + 'judul' => 'Kode POS', + ], + 'nama_kepala_desa' => [ + 'judul' => 'Nama ' . $kepala, + ], + 'nip_kepala_desa' => [ + 'judul' => 'NIP ' . $kepala, + ], + 'jk_kepala_desa' => [ + 'judul' => 'Jenis Kelamin ' . $kepala, + 'tipe' => 1, + // 'referensi' => $this->referensi_model->list_data('tweb_penduduk_sex'), + ], + 'titik_koordinat_desa' => [ + 'judul' => 'Titik Koordinat ' . $desa . ' (Lintang / Bujur)', + ], + 'alamat_kantor' => [ + 'judul' => 'Alamat Kantor', + ], + 'no_telepon_kepala_desa' => [ + 'judul' => 'Nomor Telepon Rumah / HP ' . $kepala, + ], + 'no_telepon_kantor_desa' => [ + 'judul' => 'Nomor Telepon Kantor ' . $desa, + ], + 'email_desa' => [ + 'judul' => 'Email ' . $desa, + ], + 'pendidikan_kepala_desa' => [ + 'judul' => 'Pendidikan Terakhir ' . $kepala, + ], + 'nama_kecamatan' => [ + 'judul' => 'Nama Kecamatan', + ], + 'kode_kecamatan' => [ + 'judul' => 'Kode Kecamatan', + ], + 'nama_kepala_camat' => [ + 'judul' => 'Nama Kepala Camat', + ], + 'nip_kepala_camat' => [ + 'judul' => 'NIP Kepala Camat', + ], + 'kode_kabupaten' => [ + 'judul' => 'Kode Kabupaten', + ], + 'nama_propinsi' => [ + 'judul' => 'Nama Provinsi', + ], + 'kode_propinsi' => [ + 'judul' => 'Kode Provinsi', + ], + + // DEMOGRAFI + // # Penduduk + 'jumlah_total_penduduk' => [ + 'judul' => 'Jumlah Total Penduduk', + ], + 'jumlah_penduduk_laki_laki' => [ + 'judul' => 'Jumlah Penduduk Laki-laki', + ], + 'jumlah_penduduk_perempuan' => [ + 'judul' => 'Jumlah Penduduk Perempuan', + ], + 'jumlah_penduduk_pedatang' => [ + 'judul' => 'Jumlah Penduduk Pendatang', + ], + 'jumlah_penduduk_yang_pergi' => [ + 'judul' => 'Jumlah Penduduk Yang Pergi', + ], + + // # Kepala Keluarga + 'jumlah_total_kepala_keluarga' => [ + 'judul' => 'Jumlah Total Kepala Keluarga', + ], + 'jumlah_kepala_keluarga_laki_laki' => [ + 'judul' => 'Jumlah Kepala Keluarga Laki-laki', + ], + 'jumlah_kepala_keluarga_perempuan' => [ + 'judul' => 'Jumlah Kepala Keluarga Perempuan', + ], + + 'jumlah_peserta_bpjs' => [ + 'judul' => 'Jumlah Penduduk Terdaftar BPJS Kesehatan / JKN', + ], + ]; + break; + } + + return $data; + } + + public static function indikatorUnduh($idMaster, $parameter = 1) + { + $data = self::where('id_master', $idMaster)->orderByRaw('LPAD(nomor, 10, " ")')->get()->toArray(); + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $data[$i]['no'] = $i + 1; + $data[$i]['par'] = null; + + if ($parameter == 2) { + $par = AnalisisParameter::where('id_indikator', $data[$i]['id'])->where('asign', 1)->get()->toArray(); + $data[$i]['par'] = $par; + } + } + + return $data; + } +} diff --git a/Modules/Analisis/Models/AnalisisKategori.php b/Modules/Analisis/Models/AnalisisKategori.php new file mode 100644 index 000000000..0d5df6d79 --- /dev/null +++ b/Modules/Analisis/Models/AnalisisKategori.php @@ -0,0 +1,62 @@ +hasMany(AnalisisIndikator::class, 'id_kategori'); + } +} diff --git a/Modules/Analisis/Models/AnalisisKlasifikasi.php b/Modules/Analisis/Models/AnalisisKlasifikasi.php new file mode 100644 index 000000000..5abd3f327 --- /dev/null +++ b/Modules/Analisis/Models/AnalisisKlasifikasi.php @@ -0,0 +1,56 @@ +attributes['lock'] == self::LOCK; + } + + public function isSystem(): bool + { + return $this->attributes['jenis'] == 1; + } + + protected function scopeSubjekPenduduk($query) + { + return $query->where('subjek_tipe', AnalisisRefSubjekEnum::PENDUDUK); + } +} diff --git a/Modules/Analisis/Models/AnalisisParameter.php b/Modules/Analisis/Models/AnalisisParameter.php new file mode 100644 index 000000000..8563613dd --- /dev/null +++ b/Modules/Analisis/Models/AnalisisParameter.php @@ -0,0 +1,65 @@ +belongsTo(AnalisisIndikator::class, 'id_indikator'); + } +} diff --git a/Modules/Analisis/Models/AnalisisPeriode.php b/Modules/Analisis/Models/AnalisisPeriode.php new file mode 100644 index 000000000..05d3b6312 --- /dev/null +++ b/Modules/Analisis/Models/AnalisisPeriode.php @@ -0,0 +1,84 @@ +id_state]; + } + + public function isLock(): bool + { + return $this->attributes['aktif'] == self::LOCK; + } + + public function isUnlock(): bool + { + return $this->attributes['aktif'] == self::UNLOCK; + } + + public function scopeActive($query) + { + return $query->where('aktif', self::UNLOCK); + } +} diff --git a/Modules/Analisis/Models/AnalisisRespon.php b/Modules/Analisis/Models/AnalisisRespon.php new file mode 100644 index 000000000..7e2056985 --- /dev/null +++ b/Modules/Analisis/Models/AnalisisRespon.php @@ -0,0 +1,394 @@ +where('id_periode', $idPeriode)->delete(); + if (! empty($postData['rb'])) { + $id_rb = $postData['rb']; + + foreach ($id_rb as $id_p) { + if (empty($id_p)) { + continue; + } // Abaikan isian kosong + $p = preg_split('/\\./', $id_p); + + $data['id_subjek'] = $id; + $data['id_periode'] = $idPeriode; + $data['id_indikator'] = $p[0]; + $data['id_parameter'] = $p[1]; + self::insert($data); + } + } + if (isset($postData['cb'])) { + $id_cb = $postData['cb']; + if ($id_cb) { + foreach ($id_cb as $id_p) { + $p = preg_split('/\\./', $id_p); + + $data['id_subjek'] = $id; + $data['id_periode'] = $idPeriode; + $data['id_indikator'] = $p[0]; + $data['id_parameter'] = $p[1]; + self::insert($data); + } + } + } + + if (isset($postData['ia'])) { + $id_ia = $postData['ia']; + + foreach ($id_ia as $id_p) { + if ($id_p != '') { + unset($data); + $indikator = key($id_ia); + $dx = AnalisisParameter::firstOrCreate(['jawaban' => $id_p, 'id_indikator' => $indikator]); + + unset($data); + $data['id_parameter'] = $dx->id; + $data['id_indikator'] = $indikator; + $data['id_subjek'] = $id; + $data['id_periode'] = $idPeriode; + self::create($data); + } + next($id_ia); + } + } + if (isset($postData['it'])) { + $id_it = $postData['it']; + + foreach ($id_it as $id_p) { + if ($id_p != '') { + unset($data); + $indikator = key($id_it); + $dx = AnalisisParameter::firstOrCreate(['jawaban' => $id_p, 'id_indikator' => $indikator]); + + $data2['id_parameter'] = $dx->id; + $data2['id_indikator'] = $indikator; + $data2['id_subjek'] = $id; + $data2['id_periode'] = $idPeriode; + self::create($data2); + } + next($id_it); + } + } + + $sql = 'SELECT SUM(i.bobot * nilai) as jml FROM analisis_respon r LEFT JOIN analisis_indikator i ON r.id_indikator = i.id LEFT JOIN analisis_parameter z ON r.id_parameter = z.id WHERE r.id_subjek = ? AND i.act_analisis=1 AND r.id_periode=? '; + $dx = (array) DB::select($sql, [$id, $idPeriode])[0]; + + $upx['id_master'] = $idMaster; + $upx['akumulasi'] = 0 + $dx['jml']; + $upx['id_subjek'] = $id; + $upx['id_periode'] = $idPeriode; + $upx['config_id'] = identitas('id'); + AnalisisResponHasil::where('id_subjek', $id)->where('id_periode', $idPeriode)->delete(); + AnalisisResponHasil::create($upx); + } + } + + public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) + { + $per = $periode; + $subjek = $subjekTipe; + $mas = $idMaster; + $key = ($per + 3) * ($mas + 7) * ($subjek * 3); + $key = 'AN' . $key; + $respon = []; + + $indikator = AnalisisIndikator::where('id_master', $idMaster)->orderBy('id')->get()->toArray(); + + try { + if ($_FILES['respon']['type'] != 'application/vnd.ms-excel') { + return [ + 'success' => false, + 'message' => 'File yang diunggah harus berformat .xls', + ]; + } + $data = new Spreadsheet_Excel_Reader($_FILES['respon']['tmp_name']); + $s = 0; + $baris = $data->rowcount($s); + $kolom = $data->colcount($s); + + $ketemu = 0; + + for ($b = 1; $b <= $baris; $b++) { + for ($k = 1; $k <= $kolom; $k++) { + $isi = $data->val($b, $k, $s); + // ketemu njuk stop + if ($isi == $key) { + $br = $b + 1; + $kl = $k + 1; + + $b = $baris + 1; + $k = $kolom + 1; + $ketemu = 1; + } + } + } + if ($ketemu == 1) { + $dels = ''; + $true = 0; + + for ($i = $br; $i <= $baris; $i++) { + $id_subjek = $data->val($i, $kl - 1, $s); + + $j = $kl; + + foreach ($indikator as $indi) { + $isi = $data->val($i, $j, $s); + if ($isi != '') { + $true = 1; + } + + $j++; + } + if ($true == 1) { + $dels .= $id_subjek . ','; + $true = 0; + } + } + + $dels .= '9999999'; + //cek ada row + self::where('id_periode', $per)->whereRaw("id_subjek in({$dels})")->delete(); + $dels = ''; + + for ($i = $br; $i <= $baris; $i++) { + $id_subjek = $data->val($i, $kl - 1, $s); + if (strlen($id_subjek) > 14 && $subjek == 1) { + $id_subjek = PendudukHidup::select(['id'])->where('nik', $id_subjek)->first()?->id ?? null; + } elseif ($subjek == 3) { + // sasaran rumah tangga, simpan id, bukan nomor rumah tangga + $id_subjek = Rtm::select('id')->where('id_rtm', $id_subjek)->first()?->id ?? null; + } + + $j = $kl + $op; + $all = ''; + + foreach ($indikator as $indi) { + $isi = $data->val($i, $j, $s); + if ($isi != '') { + if ($indi['id_tipe'] == 1) { + $param = AnalisisParameter::where('id_indikator', $indi['id']) + ->where(function ($query) use ($isi) { + $query->where('kode_jawaban', $isi)->orWhere('jawaban', $isi); + })->first()->toArray(); + if ($param) { + $in_param = $param['id']; + } elseif ($isi == '') { + $in_param = 0; + } else { + $in_param = -1; + } + + $respon[] = [ + 'id_parameter' => $in_param, + 'id_indikator' => $indi['id'], + 'id_subjek' => $id_subjek, + 'id_periode' => $per, + ]; + } elseif ($indi['id_tipe'] == 2) { + $this->respon_checkbox($indi, $isi, $id_subjek, $per, $respon); + } else { + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('jawaban', $isi)->first()->toArray(); + + // apakah sdh ada jawaban yg sama + if ($param) { + $in_param = $param['id']; + } else { + $parameter['jawaban'] = $isi; + $parameter['id_indikator'] = $indi['id']; + $parameter['asign'] = 0; + $parameter['config_id'] = identitas('id'); + AnalisisParameter::create($parameter); + + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('jawaban', $isi)->first()->toArray(); + $in_param = $param['id']; + } + + $respon[] = [ + 'id_parameter' => $in_param, + 'id_indikator' => $indi['id'], + 'id_subjek' => $id_subjek, + 'id_periode' => $per, + ]; + } + } + + $j++; + } + } + + if (count($respon) > 0) { + AnalisisRespon::insert($respon); + } else { + return [ + 'success' => false, + 'message' => 'Tidak ada data yang diimpor', + ]; + } + } + + $this->pre_update($idMaster, $per); + } catch (Exception $e) { + return [ + 'success' => false, + 'pesan' => $e->getMessage(), + ]; + } + + return [ + 'success' => true, + 'message' => 'Data berhasil diimpor', + ]; + } + + private function respon_checkbox($indi, $isi, $id_subjek, $per, &$respon): void + { + $list_isi = explode(',', $isi); + + foreach ($list_isi as $isi_ini) { + if ($indi['is_teks'] == 1) { + // Isian sebagai teks pilihan bukan kode + $teks = strtolower($isi_ini); + $param = AnalisisParameter::where('id_indikator', $indi['id'])->whereRaw("LOWER(jawaban) = '{$teks}'")->first()->toArray(); + } else { + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('kode_jawaban', $isi_ini)->first()->toArray(); + } + if ($param['id'] != '') { + $in_param = $param['id']; + $respon[] = [ + 'id_parameter' => $in_param, + 'id_indikator' => $indi['id'], + 'id_subjek' => $id_subjek, + 'id_periode' => $per, + 'config_id' => identitas('id'), + ]; + } + } + } + + public function pre_update($idMaster, $per): void + { + $data = AnalisisRespon::selectRaw('distinct(id_subjek) as id')->where('id_periode', $per)->get()->toArray(); + + AnalisisResponHasil::where('id_subjek', 0)->delete(); + AnalisisRespon::where('id_subjek', 0)->delete(); + AnalisisResponHasil::where('id_periode', $per)->delete(); + + $counter = count($data); + + for ($i = 0; $i < $counter; $i++) { + $sql = 'SELECT SUM(i.bobot * nilai) as jml FROM analisis_respon r LEFT JOIN analisis_indikator i ON r.id_indikator = i.id LEFT JOIN analisis_parameter z ON r.id_parameter = z.id WHERE r.id_subjek = ? AND i.act_analisis=1 AND r.id_periode=?'; + $dx = (array) DB::select($sql, [$data[$i]['id'], $per])[0]; + + $upx[$i]['id_master'] = $idMaster; + $upx[$i]['akumulasi'] = 0 + $dx['jml']; + $upx[$i]['id_subjek'] = $data[$i]['id']; + $upx[$i]['id_periode'] = $per; + $upx[$i]['config_id'] = identitas('id'); + } + if (@$upx) { + AnalisisResponHasil::insert($upx); + } + } +} diff --git a/Modules/Analisis/Models/AnalisisResponBukti.php b/Modules/Analisis/Models/AnalisisResponBukti.php new file mode 100644 index 000000000..4a24bc8c5 --- /dev/null +++ b/Modules/Analisis/Models/AnalisisResponBukti.php @@ -0,0 +1,55 @@ +active()->value('id'); + $data = self::where('id_periode', $per)->distinct()->pluck('id_subjek'); + + self::where('id_subjek', 0)->delete(); + AnalisisRespon::where('id_subjek', 0)->delete(); + self::where('id_periode', $per)->delete(); + + $upx = $data->map(static function ($id_subjek) use ($per, $idMaster) { + $akumulasi = self::where('id_subjek', $id_subjek) + ->where('id_periode', $per) + ->whereHas('indikator', static fn ($query) => $query->where('act_analisis', 1)) + ->sum(DB::raw('analisis_indikator.bobot * nilai')); + + return [ + 'id_master' => $idMaster, + 'akumulasi' => $akumulasi ?: 0, + 'id_subjek' => $id_subjek, + 'id_periode' => $per, + ]; + })->toArray(); + + if ($upx) { + self::insert($upx); + } + } +} diff --git a/Modules/Analisis/Models/index.html b/Modules/Analisis/Models/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/Modules/Analisis/Models/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/Modules/Analisis/Routes/index.html b/Modules/Analisis/Routes/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/Modules/Analisis/Routes/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/Modules/Analisis/Routes/web.php b/Modules/Analisis/Routes/web.php new file mode 100644 index 000000000..88c7f142f --- /dev/null +++ b/Modules/Analisis/Routes/web.php @@ -0,0 +1,115 @@ + Master Analisis +Route::group('analisis_master', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_master@index')->name('analisis_master.index-default'); + Route::get('clear', 'Analisis_master@index')->name('analisis_master.clear'); + Route::get('datatables', 'Analisis_master@datatables')->name('analisis_master.datatables'); + Route::get('form/{id?}', 'Analisis_master@form')->name('analisis_master.form'); + Route::post('insert', 'Analisis_master@insert')->name('analisis_master.insert'); + Route::post('update/{id?}', 'Analisis_master@update')->name('analisis_master.update'); + Route::get('delete/{id?}', 'Analisis_master@delete')->name('analisis_master.delete'); + Route::post('delete', 'Analisis_master@delete')->name('analisis_master.delete-all'); + Route::get('lock/{id}', 'Analisis_master@lock')->name('analisis_master.lock'); + Route::get('panduan', 'Analisis_master@panduan')->name('analisis_master.panduan'); + Route::get('import_analisis', 'Analisis_master@import_analisis')->name('analisis_master.import_analisis'); + Route::post('import', 'Analisis_master@import')->name('analisis_master.import'); + Route::get('ekspor/{id}', 'Analisis_master@ekspor')->name('analisis_master.ekspor'); + Route::get('import_gform/{id?}', 'Analisis_master@import_gform')->name('analisis_master.import_gform'); + Route::get('menu/{id?}', 'Analisis_master@menu')->name('analisis_master.menu'); + Route::post('exec_import_gform', 'Analisis_master@exec_import_gform')->name('analisis_master.exec_import_gform'); + Route::post('save_import_gform/{id?}', 'Analisis_master@save_import_gform')->name('analisis_master.save_import_gform'); + Route::match(['GET', 'POST'], '/update_gform/{id?}', 'Analisis_master@update_gform')->name('analisis_master.update_gform'); +}); + +Route::group('analisis_indikator/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_indikator@index')->name('analisis_indikator.index-default'); + Route::get('datatables', 'Analisis_indikator@datatables')->name('analisis_indikator.datatables'); + Route::get('form/{id?}', 'Analisis_indikator@form')->name('analisis_indikator.form'); + Route::post('insert', 'Analisis_indikator@insert')->name('analisis_indikator.insert'); + Route::post('update/{id?}', 'Analisis_indikator@update')->name('analisis_indikator.update'); + Route::get('delete/{id?}', 'Analisis_indikator@delete')->name('analisis_indikator.delete'); + Route::post('delete', 'Analisis_indikator@delete')->name('analisis_indikator.delete-all'); + Route::group('parameter/{indikator}', static function (): void { + Route::get('', 'Analisis_parameter@index')->name('analisis_parameter.index-default'); + Route::get('datatables', 'Analisis_parameter@datatables')->name('analisis_parameter.datatables'); + Route::get('form/{id?}', 'Analisis_parameter@form')->name('analisis_parameter.form'); + Route::post('insert', 'Analisis_parameter@insert')->name('analisis_parameter.insert'); + Route::post('update/{id?}', 'Analisis_parameter@update')->name('analisis_parameter.update'); + Route::get('delete/{id?}', 'Analisis_parameter@delete')->name('analisis_parameter.delete'); + Route::post('delete', 'Analisis_parameter@delete')->name('analisis_parameter.delete-all'); + }); +}); + +Route::group('analisis_kategori/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_kategori@index')->name('analisis_kategori.index-default'); + Route::get('datatables', 'Analisis_kategori@datatables')->name('analisis_kategori.datatables'); + Route::get('form/{id?}', 'Analisis_kategori@form')->name('analisis_kategori.form'); + Route::post('insert', 'Analisis_kategori@insert')->name('analisis_kategori.insert'); + Route::post('update/{id?}', 'Analisis_kategori@update')->name('analisis_kategori.update'); + Route::get('delete/{id?}', 'Analisis_kategori@delete')->name('analisis_kategori.delete'); + Route::post('delete', 'Analisis_kategori@delete')->name('analisis_kategori.delete-all'); +}); + +Route::group('analisis_klasifikasi/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_klasifikasi@index')->name('analisis_klasifikasi.index-default'); + Route::get('datatables', 'Analisis_klasifikasi@datatables')->name('analisis_klasifikasi.datatables'); + Route::get('form/{id?}', 'Analisis_klasifikasi@form')->name('analisis_klasifikasi.form'); + Route::post('insert', 'Analisis_klasifikasi@insert')->name('analisis_klasifikasi.insert'); + Route::post('update/{id?}', 'Analisis_klasifikasi@update')->name('analisis_klasifikasi.update'); + Route::get('delete/{id?}', 'Analisis_klasifikasi@delete')->name('analisis_klasifikasi.delete'); + Route::post('delete', 'Analisis_klasifikasi@delete')->name('analisis_klasifikasi.delete-all'); +}); + +Route::group('analisis_respon/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_respon@index'); + Route::get('datatables', 'Analisis_respon@datatables')->name('analisis_respon.datatables'); + Route::get('form/{id}/{fs?}', 'Analisis_respon@form')->name('analisis_respon.form'); + Route::get('perbaharui/{id_subjek}', 'Analisis_respon@perbaharui')->name('analisis_respon.perbaharui'); + Route::post('update/{id}', 'Analisis_respon@update')->name('analisis_respon.update'); + Route::get('aturan_unduh', 'Analisis_respon@aturan_unduh')->name('analisis_respon.aturan_unduh'); + Route::get('data_ajax', 'Analisis_respon@data_ajax')->name('analisis_respon.data_ajax'); + Route::post('data_unduh', 'Analisis_respon@data_unduh')->name('analisis_respon.data_unduh'); + Route::get('import/{op?}', 'Analisis_respon@import')->name('analisis_respon.import'); + Route::post('import_proses/{op?}', 'Analisis_respon@import_proses')->name('analisis_respon.import_proses'); + Route::get('form_impor_bdt/{id?}', 'Analisis_respon@form_impor_bdt')->name('analisis_respon.form_impor_bdt'); + Route::post('impor_bdt', 'Analisis_respon@impor_bdt')->name('analisis_respon.impor_bdt'); + Route::get('unduh_form_bdt/{id?}', 'Analisis_respon@unduh_form_bdt')->name('analisis_respon.unduh_form_bdt'); + Route::group('child', static function() : void { + Route::get('form/{id}/{idc?}', 'Analisis_respon_child@formChild')->name('analisis_respon.form_child'); + Route::post('update/{id}/{idc?}', 'Analisis_respon_child@updateChild')->name('analisis_respon.update_child'); + }); +}); +Route::group('analisis_periode/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_periode@index')->name('analisis_periode.index-default'); + Route::get('datatables', 'Analisis_periode@datatables')->name('analisis_periode.datatables'); + Route::get('form/{id?}', 'Analisis_periode@form')->name('analisis_periode.form'); + Route::post('insert', 'Analisis_periode@insert')->name('analisis_periode.insert'); + Route::post('update/{id?}', 'Analisis_periode@update')->name('analisis_periode.update'); + Route::get('lock/{id}', 'Analisis_periode@lock')->name('analisis_periode.lock'); + Route::get('delete/{id?}', 'Analisis_periode@delete')->name('analisis_periode.delete'); + Route::post('delete', 'Analisis_periode@delete')->name('analisis_periode.delete-all'); +}); + +Route::group('analisis_laporan/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_laporan@index'); + Route::get('datatables', 'Analisis_laporan@datatables')->name('analisis_laporan.datatables'); + Route::get('form/{id}', 'Analisis_laporan@form')->name('analisis_laporan.form'); + Route::get('dialog_kuisioner/{id}/{aksi?}', 'Analisis_laporan@dialog_kuisioner')->name('analisis_laporan.dialog_kuisioner'); + Route::post('daftar/{id}/{aksi?}', 'Analisis_laporan@daftar')->name('analisis_laporan.daftar'); + Route::get('dialog/{aksi?}', 'Analisis_laporan@dialog')->name('analisis_laporan.dialog'); + Route::post('cetak/{aksi?}', 'Analisis_laporan@cetak')->name('analisis_laporan.cetak'); + Route::get('multi_jawab', 'Analisis_laporan@multi_jawab')->name('analisis_laporan.multi_jawab'); + Route::post('multi_exec', 'Analisis_laporan@multi_exec')->name('analisis_laporan.multi_exec'); + Route::get('ajax_multi_jawab', 'Analisis_laporan@ajax_multi_jawab')->name('analisis_laporan.ajax_multi_jawab'); + Route::post('multi_jawab_proses', 'Analisis_laporan@multi_jawab_proses')->name('analisis_laporan.multi_jawab_proses'); +}); + +Route::group('analisis_statistik_jawaban/{master}', ['namespace' => 'Analisis'], static function (): void { + Route::get('', 'Analisis_statistik_jawaban@index'); + Route::get('datatables', 'Analisis_statistik_jawaban@datatables')->name('analisis_statistik_jawaban.datatables'); + Route::get('grafik_parameter/{id?}', 'Analisis_statistik_jawaban@grafik_parameter')->name('analisis_statistik_jawaban.grafik_parameter'); + Route::get('subjek_parameter/{id}/{par}', 'Analisis_statistik_jawaban@subjek_parameter')->name('analisis_statistik_jawaban.subjek_parameter'); + Route::post('cetak', 'Analisis_statistik_jawaban@cetak')->name('analisis_statistik_jawaban.cetak'); + Route::get('cetak_subjek/{id}/{par}/{tipe?}', 'Analisis_statistik_jawaban@cetak_subjek')->name('analisis_statistik_jawaban.cetak_subjek'); +}); \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis/form.blade.php b/Modules/Analisis/Views/analisis/form.blade.php new file mode 100644 index 000000000..fec50a3a8 --- /dev/null +++ b/Modules/Analisis/Views/analisis/form.blade.php @@ -0,0 +1,179 @@ +@extends('admin.layouts.index') +@include('admin.layouts.components.asset_validasi') + +@section('title') +

+ Pengaturan Master Analisis + {{ $action }} Data +

+@endsection + +@section('breadcrumb') + +
  • Pengaturan Master Analisis
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') + +
    +
    + + Kembali ke Master Analisis + +
    +
    + {!! form_open($form_action, 'class="form-horizontal" id="validasi"') !!} +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    +

    + Sigma (Bobot (indikator) x Nilai (parameter)) / Bilangan Pembagi +

    +
    +
    +
    +
    +
    + +
    + +

    Untuk tanda koma "," gunakan tanda titik "." sebagai substitusinya

    +
    +
    +
    +
    +
    + +
    + +

    Kosongkan jika tidak ada Analisis yang terhubung

    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + @if($analisis_master['gform_id']) +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + @endif +
    +
    + + +
    +
    +@endsection +@push('scripts') + +@endpush diff --git a/Modules/Analisis/Views/analisis/import.blade.php b/Modules/Analisis/Views/analisis/import.blade.php new file mode 100644 index 000000000..35e1ac1fd --- /dev/null +++ b/Modules/Analisis/Views/analisis/import.blade.php @@ -0,0 +1,36 @@ +
    + + +
    + + \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis/import_gform.blade.php b/Modules/Analisis/Views/analisis/import_gform.blade.php new file mode 100644 index 000000000..a9da47a26 --- /dev/null +++ b/Modules/Analisis/Views/analisis/import_gform.blade.php @@ -0,0 +1,20 @@ +
    + +
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis/index.blade.php b/Modules/Analisis/Views/analisis/index.blade.php new file mode 100644 index 000000000..5aef2a20b --- /dev/null +++ b/Modules/Analisis/Views/analisis/index.blade.php @@ -0,0 +1,182 @@ +@include('admin.layouts.components.asset_datatables') + +@extends('admin.layouts.index') + +@section('title') +

    + Master Analisis Data Potensi/Sumber Daya +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @if (can('u')) + + @endif + @if (can('h')) + + Hapus + @endif + @if(can('u')) + Impor Analisis + @endif +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis/menu.blade.php b/Modules/Analisis/Views/analisis/menu.blade.php new file mode 100644 index 000000000..d3d45cc5b --- /dev/null +++ b/Modules/Analisis/Views/analisis/menu.blade.php @@ -0,0 +1,65 @@ +@if (can('b', 'analisis-kategori') || can('b', 'analisis-indikator') || can('b', 'analisis-klasifikasi') || can('b', 'analisis-periode')) +
    +
    +

    Pengaturan Analisis

    +
    + +
    +
    +
    + +
    +
    +@endif + +@if (can('b', 'analisis-respon')) +
    +
    +

    Input Data Analisis

    +
    + +
    +
    +
    + +
    +
    +@endif + +@if (can('b', 'analisis-laporan') || can('b', 'analisis-statistik-jawaban')) +
    +
    +

    Laporan Analisis

    +
    + +
    +
    +
    + +
    +
    +@endif diff --git a/Modules/Analisis/Views/analisis/menu_default.blade.php b/Modules/Analisis/Views/analisis/menu_default.blade.php new file mode 100644 index 000000000..4fd512dba --- /dev/null +++ b/Modules/Analisis/Views/analisis/menu_default.blade.php @@ -0,0 +1,39 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Indikator {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    +
    + +
    +
    +
    +

    {{ $analisis_master['nama'] }}

    + +
    +
    +
    +
    +
    +
    +@endsection diff --git a/Modules/Analisis/Views/analisis_indikator/form.blade.php b/Modules/Analisis/Views/analisis_indikator/form.blade.php new file mode 100644 index 000000000..e8a20378d --- /dev/null +++ b/Modules/Analisis/Views/analisis_indikator/form.blade.php @@ -0,0 +1,261 @@ +@extends('admin.layouts.index') +@include('admin.layouts.components.asset_validasi') + +@section('title') +

    + Pengaturan Indikator Analisis {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • Indikator Analisis
  • +
  • Pengaturan Indikator Analisis
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') + + +
    + {!! form_open($form_action, 'class="form-horizontal" id="validasi"') !!} +
    +
    + @include('analisis.menu') +
    +
    +
    + +
    +
    + @php $disabled = ($analisis_master['jenis'] == 1 || $analisis_indikator['referensi'] || $ubah == false) ? 'disabled' : '' @endphp +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    *) Tampilkan data indikator di halaman depan + website desa melalui menu statis/menu atas

    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    + +@endsection +@push('css') + +@endpush +@push('scripts') + +@endpush diff --git a/Modules/Analisis/Views/analisis_indikator/index.blade.php b/Modules/Analisis/Views/analisis_indikator/index.blade.php new file mode 100644 index 000000000..7bcdf84fc --- /dev/null +++ b/Modules/Analisis/Views/analisis_indikator/index.blade.php @@ -0,0 +1,200 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Indikator - {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Indikator
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Pengaturan Indikator
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + @if (can('u')) + + Tambah + + @endif + @if (can('h')) + + Hapus + @endif + {{ $analisis_master['nama'] }} +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection + +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis_kategori/form.blade.php b/Modules/Analisis/Views/analisis_kategori/form.blade.php new file mode 100644 index 000000000..9d917f1a0 --- /dev/null +++ b/Modules/Analisis/Views/analisis_kategori/form.blade.php @@ -0,0 +1,14 @@ +@include('admin.layouts.components.validasi_form') +
    + + +
    diff --git a/Modules/Analisis/Views/analisis_kategori/index.blade.php b/Modules/Analisis/Views/analisis_kategori/index.blade.php new file mode 100644 index 000000000..87f231b83 --- /dev/null +++ b/Modules/Analisis/Views/analisis_kategori/index.blade.php @@ -0,0 +1,124 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Kategori - {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Kategori
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Pengaturan Kategori
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + @if (can('u')) + + Tambah + + @endif + @if (can('h')) + + Hapus + @endif + {{ $analisis_master['nama'] }} +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis_klasifikasi/form.blade.php b/Modules/Analisis/Views/analisis_klasifikasi/form.blade.php new file mode 100644 index 000000000..303025b9b --- /dev/null +++ b/Modules/Analisis/Views/analisis_klasifikasi/form.blade.php @@ -0,0 +1,23 @@ +@include('admin.layouts.components.validasi_form') +
    + + +
    diff --git a/Modules/Analisis/Views/analisis_klasifikasi/index.blade.php b/Modules/Analisis/Views/analisis_klasifikasi/index.blade.php new file mode 100644 index 000000000..53e4c7e4d --- /dev/null +++ b/Modules/Analisis/Views/analisis_klasifikasi/index.blade.php @@ -0,0 +1,140 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Klasifikasi - {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Klasifikasi
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Pengaturan Klasifikasi
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + @if (can('u')) + + Tambah + + @endif + @if (can('h')) + + Hapus + @endif + {{ $analisis_master['nama'] }} +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis_laporan/ajax_multi.blade.php b/Modules/Analisis/Views/analisis_laporan/ajax_multi.blade.php new file mode 100644 index 000000000..b9feca698 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/ajax_multi.blade.php @@ -0,0 +1,97 @@ + + + +
    + + +
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_laporan/form.blade.php b/Modules/Analisis/Views/analisis_laporan/form.blade.php new file mode 100644 index 000000000..80f1ab310 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/form.blade.php @@ -0,0 +1,135 @@ +@extends('admin.layouts.index') + +@section('title') +

    + Laporan Hasil Analisis +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Laporan Hasil Klasifikasi
  • +@endsection + +@section('content') +
    +
    + @include('analisis.menu') +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + +
    Hasil Pendataan:{{ $analisis_master['nama'] }} +
    Nomor Identitas:{{ $subjek['nid'] }}
    Nama Subjek:{{ $subjek['nama'] }}
    +
    +
    +
    +
    +
    +
    DAFTAR ANGGOTA
    +
    + + + + + + + + + + + + @foreach ($list_anggota as $ang) + + + + + + + + @endforeach + +
    NONIKNAMATANGGAL LAHIRJENIS KELAMIN
    {{ $loop->iteration }}{{ $ang['nik'] }}{{ $ang['nama'] }}{{ tgl_indo(implode('-',array_reverse(explode('-',$ang['tanggallahir'])))) }}{{ strtoupper(App\Enums\JenisKelaminEnum::valueOf($ang['sex']) ) }}
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + @foreach ($list_jawab as $data) + + + + + + + + + @endforeach + + + + + + + +
    NoPertanyaan / IndikatorBobot + JawabanNilaiPoin
    {{ $data['no'] }}{{ $data['pertanyaan'] }}{{ $data['bobot'] }}{{ $data['jawaban'] }}{{ $data['nilai'] }}{{ $data['poin'] }}
    TOTAL{{ $total }}
    +
    +
    +
    +
    +
    +
    +
    +@endsection + + diff --git a/Modules/Analisis/Views/analisis_laporan/form_cetak.blade.php b/Modules/Analisis/Views/analisis_laporan/form_cetak.blade.php new file mode 100644 index 000000000..8349220e0 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/form_cetak.blade.php @@ -0,0 +1,143 @@ + + + + + + + Laporan Hasil Analisis {{ $asubjek }} + + + + + +
    + +
    + + + + + + + + + + + + + + + +
    + @if ($aksi != 'unduh') + + @endif +

    + PEMERINTAH {!! strtoupper(setting('sebutan_kabupaten') . ' ' . $config['nama_kabupaten'] + . '
    ' . setting('sebutan_kecamatan') . ' ' . $config['nama_kecamatan'] . '
    ' . + setting('sebutan_desa') . ' ' . $config['nama_desa']) !!} +

    +

    +
    +
    +

    Laporan Hasil Analisis {{ $asubjek }}

    +
    + Nomor Identitas : {{ $subjek['nid'] }}
    + Nama Subjek : {{ $subjek['nama'] }} +
    +
    + +

    DAFTAR ANGGOTA

    +
    + + + + + + + + + + + + @foreach ($list_anggota as $ang) + + + + + + + + @endforeach + +
    NONIKNAMATANGGAL LAHIRJENIS KELAMIN
    {{ $loop->iteration }}{{ $ang['nik'] }}{{ $ang['nama'] }}{{ tgl_indo(implode('-',array_reverse(explode('-',$ang['tanggallahir'])))) }}{{ strtoupper(App\Enums\JenisKelaminEnum::valueOf($ang['sex']) ) }}
    +
    +
    + + + + + + + + + + + + + @foreach ($list_jawab as $data) + + + + + + + + + @endforeach + + + + + + + +
    NOPERTANYAAN / INDIKATORBOBOTJAWABANNILAIPOIN
    {{ $data['no'] }}{{ $data['pertanyaan'] }}{{ $data['bobot'] }}{{ $data['jawaban'] }}{{ $data['nilai'] }}{{ $data['poin'] }}
    TOTAL{{ $total }}
    +
    + + + + + + + + + +
      + Mengetahui +
    {{ $pamong_ketahui['jabatan'] . ' ' . $config['nama_desa'] }} +



    +
    ( {{ $pamong_ketahui['pamong_nama'] }} ) +
    {{ setting('sebutan_nip_desa') }}/NIP : {{ $pamong_ketahui['pamong_nip'] }} +
       + {{ ucwords(setting('sebutan_desa')) . ' ' . $config['nama_desa'] }}, {{ tgl_indo(date('Y m d')) }} +
    {{ $pamong_ttd['jabatan'] . ' ' . $config['nama_desa'] }} +



    +
    ( {{ $pamong_ttd['pamong_nama'] }} ) +
    {{ setting('sebutan_nip_desa') }}/NIP : {{ $pamong_ketahui['pamong_nip'] }} +
     
    + +
    + + + \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_laporan/index.blade.php b/Modules/Analisis/Views/analisis_laporan/index.blade.php new file mode 100644 index 000000000..aabd205a9 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/index.blade.php @@ -0,0 +1,196 @@ +@include('admin.layouts.components.asset_datatables') +@include('admin.layouts.components.datetime_picker') +@extends('admin.layouts.index') + +@section('title') +

    + Laporan Hasil Analisis +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Laporan Hasil Klasifikasi
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + +
    Nama Analisis:{{ $analisis_master['nama'] }} +
    Subjek Analisis:{{ App\Enums\AnalisisRefSubjekEnum::valueOf($analisis_master['subjek_tipe']) }}
    Periode:{{ $namaPeriode }}
    +
    +
    +
    +
    +
    + +
    + @include('admin.layouts.components.wilayah') +
    +
    + +
    +
    +
    +
    + +@endsection +@push('scripts') + +@endpush diff --git a/Modules/Analisis/Views/analisis_laporan/table_print.blade.php b/Modules/Analisis/Views/analisis_laporan/table_print.blade.php new file mode 100644 index 000000000..b72b670e5 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/table_print.blade.php @@ -0,0 +1,110 @@ + Analisis Laporan + * + * donjo-app/views/analisis_laporan/table_print.php + * + */ +/* + * File ini bagian dari: + * + * OpenSID + * + * Sistem informasi desa sumber terbuka untuk memajukan desa + * + * Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3 + * + * Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) + * Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) + * + * Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan + * dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan + * tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan, + * asal tunduk pada syarat berikut: + * + * Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam + * setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan + * pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini. + * + * PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN + * TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU + * KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI. + * + * @package OpenSID + * @author Tim Pengembang OpenDesa + * @copyright Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) + * @copyright Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) + * @license http://www.gnu.org/licenses/gpl.html GPL V3 + * @link https://github.com/OpenSID/OpenSID + */ +?> + + + + + + + + + + + + + +
    + @if ($aksi != 'unduh') + + @endif +

    + PEMERINTAH {!! strtoupper(setting('sebutan_kabupaten') . ' ' . $config['nama_kabupaten'] . '
    ' . + setting('sebutan_kecamatan') . ' ' . $config['nama_kecamatan'] . '
    ' . setting('sebutan_desa') . + ' ' . $config['nama_desa']) !!} +

    +

    +
    +
    +

    Laporan Hasil Analisis {{ $judul['asubjek'] }}

    +
    +
    + + + + + + @if (in_array($analisis_master['subjek_tipe'], [App\Enums\AnalisisRefSubjekEnum::PENDUDUK, + App\Enums\AnalisisRefSubjekEnum::KELUARGA, App\Enums\AnalisisRefSubjekEnum::RUMAH_TANGGA])) + + @endif + + @if (in_array($analisis_master['subjek_tipe'], [1, 2, 3, 4])) + + + @endif + + + + + + @foreach ($main as $data) + + + + @if (in_array($analisis_master['subjek_tipe'], [1, 2, 3])) + + @endif + + @if (in_array($analisis_master['subjek_tipe'], [1, 2, 3, 4])) + + + @endif + + + + @endforeach + +
    NO{{ strtoupper($judul['nomor']) }}{{ $analisis_master['subjek_tipe'] == App\Enums\AnalisisRefSubjekEnum::PENDUDUK ? 'No. KK' : 'NIK KK' }} + {{ strtoupper($judul['nama']) }}JENIS KELAMINALAMATNILAIKLASIFIKASI
    {{ $loop->iteration }}{{ $data[$judul['kolom'][0]] }}{{ $data['kk'] }}{{ $data[$judul['kolom'][1]] }}{{ App\Enums\JenisKelaminEnum::valueOf($data['sex']) }}{{ strtoupper($data['alamat'] . ' ' . 'RT/RW ' . $data['rt'] . '/' . $data['rw'] . ' - ' . + setting('sebutan_dusun') . ' ' . $data['dusun']) }}{{ $data['nilai'] ? number_format($data['nilai'], 2, ',', '.') : '-' }}{{ $data['klasifikasi'] }}
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_laporan/ttd_pamong.blade.php b/Modules/Analisis/Views/analisis_laporan/ttd_pamong.blade.php new file mode 100644 index 000000000..0b6a92be9 --- /dev/null +++ b/Modules/Analisis/Views/analisis_laporan/ttd_pamong.blade.php @@ -0,0 +1,10 @@ +@include('admin.layouts.components.ttd_pamong') + diff --git a/Modules/Analisis/Views/analisis_parameter/form.blade.php b/Modules/Analisis/Views/analisis_parameter/form.blade.php new file mode 100644 index 000000000..93660c74a --- /dev/null +++ b/Modules/Analisis/Views/analisis_parameter/form.blade.php @@ -0,0 +1,22 @@ +@include('admin.layouts.components.validasi_form') +
    + + + +
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_parameter/index.blade.php b/Modules/Analisis/Views/analisis_parameter/index.blade.php new file mode 100644 index 000000000..1d3c5c1d2 --- /dev/null +++ b/Modules/Analisis/Views/analisis_parameter/index.blade.php @@ -0,0 +1,147 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Ukuran/Nilai Indikator Analisis +

    +@endsection + +@section('breadcrumb') +
  • Master Indikator
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Pengaturan Indikator Analisis
  • +
  • Pengaturan Nilai
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + @if (can('u')) + Tambah Ukuran Ukuran/Nilai Baru + @endif + @if (can('h')) + + Hapus + @endif + Kembali Indikator Analisis +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis_periode/form.blade.php b/Modules/Analisis/Views/analisis_periode/form.blade.php new file mode 100644 index 000000000..fa8caa5ed --- /dev/null +++ b/Modules/Analisis/Views/analisis_periode/form.blade.php @@ -0,0 +1,51 @@ +@include('admin.layouts.components.validasi_form') +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    + @if(! $analisis_periode) +
    + + +
    + @endif +
    + + +
    +
    + + +
    +
    + +
    diff --git a/Modules/Analisis/Views/analisis_periode/index.blade.php b/Modules/Analisis/Views/analisis_periode/index.blade.php new file mode 100644 index 000000000..52866d562 --- /dev/null +++ b/Modules/Analisis/Views/analisis_periode/index.blade.php @@ -0,0 +1,160 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Pengaturan Periode - {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Periode
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Pengaturan Periode
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + @if (can('u')) + + Tambah + + @endif + @if (can('h')) + + Hapus + @endif + {{ $analisis_master['nama'] }} +
    +
    +
    +
    + +
    +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    +@include('admin.layouts.components.konfirmasi_hapus') +@endsection +@push('scripts') + + +@endpush diff --git a/donjo-app/views/analisis_respon/form_ajax.php b/Modules/Analisis/Views/analisis_respon/child/form.blade.php similarity index 55% rename from donjo-app/views/analisis_respon/form_ajax.php rename to Modules/Analisis/Views/analisis_respon/child/form.blade.php index 6c73ee84c..699c46463 100644 --- a/donjo-app/views/analisis_respon/form_ajax.php +++ b/Modules/Analisis/Views/analisis_respon/child/form.blade.php @@ -57,7 +57,7 @@ font-weight:bold; } -
    + diff --git a/Modules/Analisis/Views/analisis_respon/form.blade.php b/Modules/Analisis/Views/analisis_respon/form.blade.php new file mode 100644 index 000000000..ee554564e --- /dev/null +++ b/Modules/Analisis/Views/analisis_respon/form.blade.php @@ -0,0 +1,280 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Data Sensus {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Data Sensus
  • +
  • Input Data
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    + +
    + +
    +
    + +
    +
    +@endsection +@push('scripts') + +@endpush diff --git a/donjo-app/views/analisis_respon/import/aturan_unduh.php b/Modules/Analisis/Views/analisis_respon/import/aturan_unduh.blade.php similarity index 59% rename from donjo-app/views/analisis_respon/import/aturan_unduh.php rename to Modules/Analisis/Views/analisis_respon/import/aturan_unduh.blade.php index 20617302f..2b2f2f377 100644 --- a/donjo-app/views/analisis_respon/import/aturan_unduh.php +++ b/Modules/Analisis/Views/analisis_respon/import/aturan_unduh.blade.php @@ -5,7 +5,7 @@ header("Content-Disposition: attachment; filename=statistik_analisis_jawaban_{$tgl}.xls"); header('Pragma: no-cache'); header('Expires: 0'); - ?> +?> +
    + + + + + + @if (in_array($subjek_tipe, [1, 2, 3, 4])) + + @endif + @if (in_array($subjek_tipe, [1, 2, 3, 4, 7, 8])) + + @if ($subjek_tipe != 6) + + @if ($subjek_tipe != 7) + + @endif + @endif + @endif + + @foreach ($indikator as $pt) + @php + if ($pt['par']){ + $w = ''; + }else{ + $w = "width='80'"; + } + @endphp + + @if ($pt['id_tipe'] == 1) + + @else + @if ($pt['id_tipe'] == 2) + + @elseif ($pt['id_tipe'] == 3) + + @else + + @endif + @endif + @endforeach + + + + + + @php + $tot = count($indikator); + @endphp + @foreach ($indikator as $pt) + + @endforeach + + @foreach ($main as $data) + + + + + @if (in_array($subjek_tipe, [1, 2, 3, 4])) + + @endif + @if (in_array($subjek_tipe, [1, 2, 3, 4, 7, 8])) + + @if ($subjek_tipe != 6) + + @if ($subjek_tipe != 7) + + @endif + @endif + @endif + + + @if (!$data['par']) + @for ($j = 0; $j < $tot; $j++) + + @endfor + @else + @foreach ($indikator as $pt) + @php + //cumawarna + $bx = ''; + $false = 0; + + foreach ($data['par'] as $jawab): + $isi = ''; + if ($pt['id'] == $jawab['id_indikator'] && $false == 0): + if ($pt['id_tipe'] == 1): + $isi = $jawab['kode_jawaban']; + elseif ($pt['id_tipe'] == 2): + $isi .= $jawab['kode_jawaban']; + else: + $isi = $jawab['jawaban']; + endif; + + //kosong dia + if ($isi == ''): + $bx = "style='background-color:#bbffbb;'"; + endif; + + //koreksi + if ($jawab['korek'] == -1): + $bx = "style='background-color:#ff9999;'"; + endif; + + if ($pt['id_tipe'] != 2): + $false = 1; + endif; + endif; + endforeach + @endphp + + + @endforeach + @endif + + @endforeach +
    No{{ $judul['nomor'] }}{{ $judul['nama'] }}L/P{{ ucwords(setting('sebutan_dusun')) }}RWRTBatas + {{ $pt['no']}}
    {{ $pt['pertanyaan'] }} + @if ($pt['par']): + @foreach ($pt['par'] as $jb) +
    {{ $jb['kode_jawaban']}} {{ $jb['jawaban']}} + @endforeach; + @endif +
    + {{ $pt['no']}}
    {{ $pt['pertanyaan']}} + @if ($pt['par']) + @foreach ($pt['par'] as $jb) +
    {{ $jb['kode_jawaban']}} {{ $jb['jawaban']}} + @endforeach + @endif +
    + {{ $pt['no']}}
    {{ $pt['pertanyaan']}} +
    + {{ $pt['no']}}
    {{ $pt['pertanyaan']}} +
    {{ $key}} + {{ $pt['nomor']}} +
    {{ $data['no']}}{{ $data['nid']}}{{ $data['nama']}}{{ $data['sex'] == 1 ? 'L' : 'P' }}{{ $data['dusun']}}{{ $data['rw']}}{{ $data['rt']}}{{ $data['id']}} + + @php + $false = 0; + $isi = ''; + + foreach ($data['par'] as $jawab): + if ($pt['id'] == $jawab['id_indikator'] && $false == 0): + if ($pt['id_tipe'] == 1): + $isi = ($tipe == 1) ? $jawab['jawaban'] : $jawab['kode_jawaban']; + elseif ($pt['id_tipe'] == 2 && $pt['is_teks'] == 0): + $isi .= ($tipe == 1) ? $jawab['jawaban'] : $jawab['kode_jawaban'] . ','; + elseif ($pt['id_tipe'] == 2 && $pt['is_teks'] == 1): + $isi .= $jawab['jawaban'] . ','; + else: + $isi = $jawab['jawaban']; + endif; + + //kosong dia + if ($isi == ''): + $bx = "style='background-color:#bbffbb;'"; + endif; + + //koreksi + if ($jawab['korek'] == -1): + $isi = 'xxx'; + $bx = "style='background-color:#ff9999;'"; + endif; + + if ($pt['id_tipe'] != 2): + $false = 1; + endif; + endif; + endforeach; + + //DEL last koma + if ($pt['id_tipe'] == 2): + $jml = strlen($isi); + $isi = substr($isi, 0, $jml - 1); + endif + + @endphp + {{ $isi }} +
    +
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_respon/import/impor_bdt.blade.php b/Modules/Analisis/Views/analisis_respon/import/impor_bdt.blade.php new file mode 100644 index 000000000..dd53fa70c --- /dev/null +++ b/Modules/Analisis/Views/analisis_respon/import/impor_bdt.blade.php @@ -0,0 +1,35 @@ + +
    + + + +
    diff --git a/Modules/Analisis/Views/analisis_respon/import/import.blade.php b/Modules/Analisis/Views/analisis_respon/import/import.blade.php new file mode 100644 index 000000000..894702d1c --- /dev/null +++ b/Modules/Analisis/Views/analisis_respon/import/import.blade.php @@ -0,0 +1,34 @@ + +
    + + + +
    \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_respon/index.blade.php b/Modules/Analisis/Views/analisis_respon/index.blade.php new file mode 100644 index 000000000..a884b7392 --- /dev/null +++ b/Modules/Analisis/Views/analisis_respon/index.blade.php @@ -0,0 +1,215 @@ +@include('admin.layouts.components.asset_datatables') +@extends('admin.layouts.index') + +@section('title') +

    + Data Sensus {{ $analisis_master['nama'] }} +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    + +
    +
    + + Unduh + + @if (can('u')) + + Impor + + @if ($analisis_master['format_impor'] == 1) + + Impor BDT 2015 + + @endif + @endif + {{ $analisis_master['nama'] }} +
    +
    +
    + + + + + + + + + + + + + + + + + @if ($analisis_master['gform_id']) + + + + + + @endif +
    Nama Analisis:{{ $analisis_master['nama'] }} +
    Subjek Analisis:{{ App\Enums\AnalisisRefSubjekEnum::valueOf($analisis_master['subjek_tipe']) }}
    Periode:{{ $namaPeriode }}
    Sinkronisasi Terakhir:{{ tgl_indo2($analisis_master['gform_last_sync']) }}
    +
    +
    +
    +
    + +
    + @include('admin.layouts.components.wilayah') +
    +
    + {!! form_open(null, 'id="mainform" name="mainform"') !!} +
    +
    + +
    +
    + +
    +
    +
    +
    + +@endsection +@push('scripts') + + +@endpush diff --git a/Modules/Analisis/Views/analisis_statistik_jawaban/index.blade.php b/Modules/Analisis/Views/analisis_statistik_jawaban/index.blade.php new file mode 100644 index 000000000..626d8d32b --- /dev/null +++ b/Modules/Analisis/Views/analisis_statistik_jawaban/index.blade.php @@ -0,0 +1,247 @@ +@include('admin.layouts.components.asset_datatables') +@include('admin.layouts.components.datetime_picker') +@extends('admin.layouts.index') + +@section('title') +

    + Laporan Statistik Jawaban +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Laporan Per Indikator
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    +
    +
    +
    + + + + Kembali Ke + {{ $analisis_master['nama'] }} +
    + +
    +
    +
    Analisis Statistik Jawaban - {{ $analisis_master['nama'] }} +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    + @include('admin.layouts.components.wilayah') +
    +
    + +
    +
    +
    +
    + +@endsection +@push('scripts') + +@endpush +@push('css') + +@endpush \ No newline at end of file diff --git a/Modules/Analisis/Views/analisis_statistik_jawaban/parameter/grafik_table.blade.php b/Modules/Analisis/Views/analisis_statistik_jawaban/parameter/grafik_table.blade.php new file mode 100644 index 000000000..c53ce4d98 --- /dev/null +++ b/Modules/Analisis/Views/analisis_statistik_jawaban/parameter/grafik_table.blade.php @@ -0,0 +1,173 @@ +@include('admin.layouts.components.datetime_picker') +@extends('admin.layouts.index') + +@section('title') +

    + Statistik Jawaban +

    +@endsection + +@section('breadcrumb') +
  • Master Analisis
  • +
  • {{ $analisis_master['nama'] }}
  • +
  • Laporan Per Indikator
  • +@endsection + +@section('content') +@include('admin.layouts.components.notifikasi') +
    +
    + @include('analisis.menu') +
    +
    +
    +
    +
    + @include('admin.layouts.components.wilayah') + +
    +
    +
    +
    {{ $analisis_statistik_jawaban['pertanyaan'] }}
    +
    + + + + + + + + + + @foreach ($main as $data) + + + + + + @endforeach + +
    NoJawabanJumlah
    {{ $loop->iteration }}{{ $data['jawaban'] }}{{ $data['nilai'] }}
    +
    +
    +
    +
    +
    +
    +
    + +@endsection +@push('scripts') + + + + + + +@endpush diff --git a/donjo-app/views/analisis_statistik_jawaban/parameter/subjek_excel.php b/Modules/Analisis/Views/analisis_statistik_jawaban/parameter/subjek_print.blade.php similarity index 53% rename from donjo-app/views/analisis_statistik_jawaban/parameter/subjek_excel.php rename to Modules/Analisis/Views/analisis_statistik_jawaban/parameter/subjek_print.blade.php index 064298f94..004b97b6c 100644 --- a/donjo-app/views/analisis_statistik_jawaban/parameter/subjek_excel.php +++ b/Modules/Analisis/Views/analisis_statistik_jawaban/parameter/subjek_print.blade.php @@ -1,17 +1,9 @@ - Data Subjek Analisis - + -
    -
    -

    Pengaturan Indikator Analisis [ ]

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - - - - -
    -
    -
    -
    -
    - -
    - > -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - - -
    -
    -
    -
    -
    - -
    - - -
    - -

    *) Tampilkan data indikator di halaman depan website desa melalui menu statis/menu atas

    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - - diff --git a/donjo-app/views/analisis_indikator/parameter/ajax_form.php b/donjo-app/views/analisis_indikator/parameter/ajax_form.php deleted file mode 100644 index 823c5d2a8..000000000 --- a/donjo-app/views/analisis_indikator/parameter/ajax_form.php +++ /dev/null @@ -1,22 +0,0 @@ -load->view('global/validasi_form'); ?> -
    - - - -
    diff --git a/donjo-app/views/analisis_indikator/parameter/table.php b/donjo-app/views/analisis_indikator/parameter/table.php deleted file mode 100644 index 0e15bb6ec..000000000 --- a/donjo-app/views/analisis_indikator/parameter/table.php +++ /dev/null @@ -1,88 +0,0 @@ -
    -
    -

    Pengaturan Ukuran/Nilai Indikator Analisis

    - -
    - -
    -
    -
    - -
    -
    -load->view('global/confirm_delete'); ?> - diff --git a/donjo-app/views/analisis_indikator/table.php b/donjo-app/views/analisis_indikator/table.php deleted file mode 100644 index 271e5eb2d..000000000 --- a/donjo-app/views/analisis_indikator/table.php +++ /dev/null @@ -1,220 +0,0 @@ - -
    -
    -

    Pengaturan Indikator -

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -load->view('global/confirm_delete'); ?> diff --git a/donjo-app/views/analisis_kategori/ajax_form.php b/donjo-app/views/analisis_kategori/ajax_form.php deleted file mode 100644 index cf9db36b7..000000000 --- a/donjo-app/views/analisis_kategori/ajax_form.php +++ /dev/null @@ -1,22 +0,0 @@ - - - -
    - - -
    - diff --git a/donjo-app/views/analisis_kategori/table.php b/donjo-app/views/analisis_kategori/table.php deleted file mode 100644 index 55029a897..000000000 --- a/donjo-app/views/analisis_kategori/table.php +++ /dev/null @@ -1,112 +0,0 @@ - -
    -
    -

    Pengaturan Kategori -

    - -
    - -
    -
    -
    - -
    -
    -load->view('global/confirm_delete'); ?> diff --git a/donjo-app/views/analisis_klasifikasi/ajax_form.php b/donjo-app/views/analisis_klasifikasi/ajax_form.php deleted file mode 100644 index 86887693b..000000000 --- a/donjo-app/views/analisis_klasifikasi/ajax_form.php +++ /dev/null @@ -1,23 +0,0 @@ -
    - - -
    -load->view('global/validasi_form'); ?> diff --git a/donjo-app/views/analisis_klasifikasi/table.php b/donjo-app/views/analisis_klasifikasi/table.php deleted file mode 100644 index ffaf655bc..000000000 --- a/donjo-app/views/analisis_klasifikasi/table.php +++ /dev/null @@ -1,129 +0,0 @@ - -
    -
    -

    Pengaturan Klasifikasi -

    - -
    - -
    -
    -
    - -
    -
    -load->view('global/confirm_delete'); ?> \ No newline at end of file diff --git a/donjo-app/views/analisis_laporan/ajax_multi.php b/donjo-app/views/analisis_laporan/ajax_multi.php deleted file mode 100644 index 4f0145e5c..000000000 --- a/donjo-app/views/analisis_laporan/ajax_multi.php +++ /dev/null @@ -1,97 +0,0 @@ - - - -
    - -
    diff --git a/donjo-app/views/analisis_laporan/form.php b/donjo-app/views/analisis_laporan/form.php deleted file mode 100644 index 3a31d3a28..000000000 --- a/donjo-app/views/analisis_laporan/form.php +++ /dev/null @@ -1,125 +0,0 @@ -
    -
    -

    Laporan Hasil Analisis

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    Hasil Pendataan:">
    Nomor Identitas:
    Nama Subjek:
    -
    -
    -
    -
    -
    -
    DAFTAR ANGGOTA
    -
    - - - - - - - - - - - - - - - - - - - - - -
    NONIKNAMATANGGAL LAHIRJENIS KELAMIN
    LAKI-LAKIPEREMPUAN
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - = 1 ? "class='bg'" : ''; ?> - - - - - - - - - - - - - - - - -
    NoPertanyaan / IndikatorBobot - JawabanNilaiPoin
    TOTAL
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - diff --git a/donjo-app/views/analisis_laporan/form_cetak.php b/donjo-app/views/analisis_laporan/form_cetak.php deleted file mode 100644 index 9b3d71d3f..000000000 --- a/donjo-app/views/analisis_laporan/form_cetak.php +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - Laporan Hasil Analisis <?= $asubjek ?> - - - - -
    - -
    - - - - - - - - - - - - - - - -
    - - - -

    - PEMERINTAH setting->sebutan_kabupaten . ' ' . $config['nama_kabupaten'] . '
    ' . $this->setting->sebutan_kecamatan . ' ' . $config['nama_kecamatan'] . '
    ' . $this->setting->sebutan_desa . ' ' . $config['nama_desa']); ?> -

    -


    -

    Laporan Hasil Analisis

    -
    - Nomor Identitas :
    - Nama Subjek : -
    -
    -

    DAFTAR ANGGOTA

    - - - - - - - - - - - - - - - - - - - - - - -
    NONIKNAMATANGGAL LAHIRJENIS KELAMIN
    LAKI-LAKIPEREMPUAN
    -
    -
    - - - - - - - - - - - - - - - = 1 ? "class='bg'" : ''; ?> - - - - - - - - - - - - - - - - -
    NOPERTANYAAN / INDIKATORBOBOTJAWABANNILAIPOIN
    TOTAL
    -
    - - - - - - - - - -
      - Mengetahui -
    -



    -
    ( ) -
    setting->sebutan_nip_desa ?>/NIP : -
       - setting->sebutan_desa) . ' ' . $config['nama_desa']?>, -
    -



    -
    ( ) -
    setting->sebutan_nip_desa ?>/NIP : -
     
    - -
    - - \ No newline at end of file diff --git a/donjo-app/views/analisis_laporan/table.php b/donjo-app/views/analisis_laporan/table.php deleted file mode 100644 index 27593d0b8..000000000 --- a/donjo-app/views/analisis_laporan/table.php +++ /dev/null @@ -1,179 +0,0 @@ - Analisis Laporan - * - * donjo-app/views/analisis_laporan/table.php - * - */ -/* - * File ini bagian dari: - * - * OpenSID - * - * Sistem informasi desa sumber terbuka untuk memajukan desa - * - * Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3 - * - * Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) - * Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) - * - * Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan - * dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan - * tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan, - * asal tunduk pada syarat berikut: - * - * Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam - * setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan - * pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini. - * - * PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN - * TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU - * KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI. - * - * @package OpenSID - * @author Tim Pengembang OpenDesa - * @copyright Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) - * @copyright Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) - * @license http://www.gnu.org/licenses/gpl.html GPL V3 - * @link https://github.com/OpenSID/OpenSID - */ -?> - - -
    -
    -

    Laporan Hasil Analisis

    - -
    - -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    Nama Analisis:">
    Subjek Analisis:
    Periode:nama; ?>
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -load->view('global/confirm_delete'); ?> diff --git a/donjo-app/views/analisis_laporan/table_print.php b/donjo-app/views/analisis_laporan/table_print.php deleted file mode 100644 index d8c0a59fd..000000000 --- a/donjo-app/views/analisis_laporan/table_print.php +++ /dev/null @@ -1,103 +0,0 @@ - Analisis Laporan - * - * donjo-app/views/analisis_laporan/table_print.php - * - */ -/* - * File ini bagian dari: - * - * OpenSID - * - * Sistem informasi desa sumber terbuka untuk memajukan desa - * - * Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3 - * - * Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) - * Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) - * - * Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan - * dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan - * tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan, - * asal tunduk pada syarat berikut: - * - * Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam - * setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan - * pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini. - * - * PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN - * TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU - * KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI. - * - * @package OpenSID - * @author Tim Pengembang OpenDesa - * @copyright Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/) - * @copyright Hak Cipta 2016 - 2020 Perkumpulan Desa Digital Terbuka (https://opendesa.id) - * @license http://www.gnu.org/licenses/gpl.html GPL V3 - * @link https://github.com/OpenSID/OpenSID - */ -?> - - - - - - - - - - - - - -
    - - - -

    - PEMERINTAH setting->sebutan_kabupaten . ' ' . $config['nama_kabupaten'] . '
    ' . $this->setting->sebutan_kecamatan . ' ' . $config['nama_kecamatan'] . '
    ' . $this->setting->sebutan_desa . ' ' . $config['nama_desa']); ?> -

    -


    -

    Laporan Hasil Analisis

    -
    -
    - - - - - - - - - - - - - - - - - - - $data): ?> - - - - - - - - - - - - - - - - -
    NOJENIS KELAMINALAMATNILAIKLASIFIKASI
    setting->sebutan_dusun . ' ' . $data['dusun']) ?>
    diff --git a/donjo-app/views/analisis_master/form.php b/donjo-app/views/analisis_master/form.php deleted file mode 100644 index 3ddd1bcf9..000000000 --- a/donjo-app/views/analisis_master/form.php +++ /dev/null @@ -1,165 +0,0 @@ - - -
    -
    -

    Pengaturan Master Analisis

    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -

    - Sigma (Bobot (indikator) x Nilai (parameter)) / Bilangan Pembagi -

    -
    -
    -
    -
    -
    - -
    - -

    Untuk tanda koma "," gunakan tanda titik "." sebagai substitusinya

    -
    -
    -
    -
    -
    - -
    - -

    Kosongkan jika tidak ada Analisis yang terhubung

    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    diff --git a/donjo-app/views/analisis_master/import.php b/donjo-app/views/analisis_master/import.php deleted file mode 100644 index 296ba2e5d..000000000 --- a/donjo-app/views/analisis_master/import.php +++ /dev/null @@ -1,24 +0,0 @@ -
    - - -
    -load->view('global/validasi_form'); ?> diff --git a/donjo-app/views/analisis_master/import_gform.php b/donjo-app/views/analisis_master/import_gform.php deleted file mode 100644 index 291293d3f..000000000 --- a/donjo-app/views/analisis_master/import_gform.php +++ /dev/null @@ -1,34 +0,0 @@ - -
    - -
    \ No newline at end of file diff --git a/donjo-app/views/analisis_master/left.php b/donjo-app/views/analisis_master/left.php deleted file mode 100644 index a121dc996..000000000 --- a/donjo-app/views/analisis_master/left.php +++ /dev/null @@ -1,43 +0,0 @@ -
    -
    -

    Pengaturan Analisis

    -
    - -
    -
    -
    - -
    -
    -
    -
    -

    Input Data Analisis

    -
    - -
    -
    -
    - -
    -
    -
    -
    -

    Laporan Analisis

    -
    - -
    -
    -
    - -
    -
    diff --git a/donjo-app/views/analisis_master/menu.php b/donjo-app/views/analisis_master/menu.php deleted file mode 100644 index d0d94e2da..000000000 --- a/donjo-app/views/analisis_master/menu.php +++ /dev/null @@ -1,42 +0,0 @@ - -
    -
    -

    [ ]

    - -
    -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    -
    -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    - diff --git a/donjo-app/views/analisis_master/modal_hasil_import.php b/donjo-app/views/analisis_master/modal_hasil_import.php deleted file mode 100644 index 2d5d481c5..000000000 --- a/donjo-app/views/analisis_master/modal_hasil_import.php +++ /dev/null @@ -1,64 +0,0 @@ - - \ No newline at end of file diff --git a/donjo-app/views/analisis_master/modal_jawaban_pilihan.php b/donjo-app/views/analisis_master/modal_jawaban_pilihan.php deleted file mode 100644 index db57f4f99..000000000 --- a/donjo-app/views/analisis_master/modal_jawaban_pilihan.php +++ /dev/null @@ -1,115 +0,0 @@ - - \ No newline at end of file diff --git a/donjo-app/views/analisis_master/modal_pertanyaan.php b/donjo-app/views/analisis_master/modal_pertanyaan.php deleted file mode 100644 index 2fa7aed09..000000000 --- a/donjo-app/views/analisis_master/modal_pertanyaan.php +++ /dev/null @@ -1,92 +0,0 @@ - - \ No newline at end of file diff --git a/donjo-app/views/analisis_master/nav.php b/donjo-app/views/analisis_master/nav.php deleted file mode 100644 index f4f70105e..000000000 --- a/donjo-app/views/analisis_master/nav.php +++ /dev/null @@ -1,49 +0,0 @@ - - \ No newline at end of file diff --git a/donjo-app/views/analisis_master/table.php b/donjo-app/views/analisis_master/table.php deleted file mode 100644 index cc40a2279..000000000 --- a/donjo-app/views/analisis_master/table.php +++ /dev/null @@ -1,162 +0,0 @@ - -
    -
    -

    Master Analisis Data Potensi/Sumber Daya

    - -
    -
    - - -
    -
    -load->view('global/confirm_delete'); ?> -load->view('analisis_master/modal_pertanyaan', $data); ?> -load->view('analisis_master/modal_jawaban_pilihan', $data); ?> -load->view('analisis_master/modal_hasil_import', $data); ?> - \ No newline at end of file diff --git a/donjo-app/views/analisis_periode/form.php b/donjo-app/views/analisis_periode/form.php deleted file mode 100644 index 5aaef05e6..000000000 --- a/donjo-app/views/analisis_periode/form.php +++ /dev/null @@ -1,138 +0,0 @@ - - -
    -
    -

    Pengaturan Priode Analisis

    - -
    -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - - - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - -
    - - -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/donjo-app/views/analisis_periode/table.php b/donjo-app/views/analisis_periode/table.php deleted file mode 100644 index d7df145d3..000000000 --- a/donjo-app/views/analisis_periode/table.php +++ /dev/null @@ -1,174 +0,0 @@ - -
    -
    -

    Pengaturan Periode -

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -load->view('global/confirm_delete'); ?> \ No newline at end of file diff --git a/donjo-app/views/analisis_respon/form.php b/donjo-app/views/analisis_respon/form.php deleted file mode 100644 index 20cc740b5..000000000 --- a/donjo-app/views/analisis_respon/form.php +++ /dev/null @@ -1,235 +0,0 @@ -
    -
    -

    Input Data Sensus -

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    - -
    -
    - -
    -
    - \ No newline at end of file diff --git a/donjo-app/views/analisis_respon/import/data_ajax.php b/donjo-app/views/analisis_respon/import/data_ajax.php deleted file mode 100644 index 19a12558d..000000000 --- a/donjo-app/views/analisis_respon/import/data_ajax.php +++ /dev/null @@ -1,23 +0,0 @@ - - diff --git a/donjo-app/views/analisis_respon/import/data_unduh.php b/donjo-app/views/analisis_respon/import/data_unduh.php deleted file mode 100644 index 34d2d6078..000000000 --- a/donjo-app/views/analisis_respon/import/data_unduh.php +++ /dev/null @@ -1,201 +0,0 @@ - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - -
    NoL/PRWRTBatas> -
    - -
      - -
    style='background-color:#aaaafe;'> -
    - -
      - -
    -
    -
    -
    -
    - -
    > - - - - -
    -
    \ No newline at end of file diff --git a/donjo-app/views/analisis_respon/import/impor_bdt.php b/donjo-app/views/analisis_respon/import/impor_bdt.php deleted file mode 100644 index a7ca2acaa..000000000 --- a/donjo-app/views/analisis_respon/import/impor_bdt.php +++ /dev/null @@ -1,45 +0,0 @@ - -
    - -
    diff --git a/donjo-app/views/analisis_respon/import/import.php b/donjo-app/views/analisis_respon/import/import.php deleted file mode 100644 index f52c1dd67..000000000 --- a/donjo-app/views/analisis_respon/import/import.php +++ /dev/null @@ -1,44 +0,0 @@ - -
    - -
    \ No newline at end of file diff --git a/donjo-app/views/analisis_respon/table.php b/donjo-app/views/analisis_respon/table.php deleted file mode 100644 index 530612669..000000000 --- a/donjo-app/views/analisis_respon/table.php +++ /dev/null @@ -1,230 +0,0 @@ - -
    -
    -

    Data Sensus -

    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    Nama Analisis:">
    Subjek Analisis:
    Periode:nama ?>
    Sinkronisasi Terakhir:
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -load->view('global/confirm_delete'); ?> diff --git a/donjo-app/views/analisis_statistik_jawaban/parameter/grafik_table.php b/donjo-app/views/analisis_statistik_jawaban/parameter/grafik_table.php deleted file mode 100644 index b62152180..000000000 --- a/donjo-app/views/analisis_statistik_jawaban/parameter/grafik_table.php +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - -
    -
    -

    Statistik Jawaban

    - -
    -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - diff --git a/donjo-app/views/analisis_statistik_jawaban/parameter/subjek_table.php b/donjo-app/views/analisis_statistik_jawaban/parameter/subjek_table.php deleted file mode 100644 index 741f07c96..000000000 --- a/donjo-app/views/analisis_statistik_jawaban/parameter/subjek_table.php +++ /dev/null @@ -1,125 +0,0 @@ -
    -
    -

    Daftar Responden -

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    Indikator Pertanyaan:
    Jawaban:
    -
    -
    -
    -
    Daftar Responden
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    - diff --git a/donjo-app/views/analisis_statistik_jawaban/parameter/table_print.php b/donjo-app/views/analisis_statistik_jawaban/parameter/table_print.php deleted file mode 100644 index ed1b63b09..000000000 --- a/donjo-app/views/analisis_statistik_jawaban/parameter/table_print.php +++ /dev/null @@ -1,60 +0,0 @@ - - - - Data Analisis - - - - - - -
    -
    -

    DATA Analisis

    -

    -

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NoNIKNamaDusunRWRTUmurJ. Kelamin
    -
    - - -
    - - \ No newline at end of file diff --git a/donjo-app/views/analisis_statistik_jawaban/table.php b/donjo-app/views/analisis_statistik_jawaban/table.php deleted file mode 100644 index 5b7a7ef9f..000000000 --- a/donjo-app/views/analisis_statistik_jawaban/table.php +++ /dev/null @@ -1,199 +0,0 @@ - -
    -
    -

    Laporan Statistik Jawaban

    - -
    - -
    -
    -
    -
    - load->view('analisis_master/left', $data); ?> -
    -
    -
    - -
    -
    Analisis Statistik Jawaban - ">">
    -
    -
    - -
    -
    -
    -
    - -
    -
    diff --git a/donjo-app/views/analisis_statistik_jawaban/table_excel.php b/donjo-app/views/analisis_statistik_jawaban/table_excel.php deleted file mode 100644 index f008d4088..000000000 --- a/donjo-app/views/analisis_statistik_jawaban/table_excel.php +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Data Analisis Jawaban - - - - - -
    -
    -
    - -

    DATA STATISTIK ANALISIS JAWABAN

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NoPertanyaanTotalKodeJawabanRespondenTipe IndikatorKategori IndikatorAksi Analisis
    - - .
    - -
    - -
    - -
    - -
    - -
    -
    - -
    - - \ No newline at end of file diff --git a/resources/views/admin/pendaftaran_kerjasama/template.blade.php b/resources/views/admin/pendaftaran_kerjasama/template.blade.php index 24c708e32..e8e3f788a 100644 --- a/resources/views/admin/pendaftaran_kerjasama/template.blade.php +++ b/resources/views/admin/pendaftaran_kerjasama/template.blade.php @@ -106,7 +106,8 @@

    - Jabatan Ketua Umum Perkumpulan Desa Digital Terbuka, berkedudukan di Sekretariat Nasional Perkumpulan Desa Digital Terbuka, Nagari Tanjung Haro Sikabu-kabu Padang panjang Kecamatan Luak kabupaten Lima Puluh Kota Provinsi Sumatera Barat, dalam hal ini bertindak untuk atas nama + Jabatan Ketua Umum Perkumpulan Desa Digital Terbuka, berkedudukan di Sekretariat Nasional Perkumpulan Desa Digital Terbuka, Nagari Tanjung Haro Sikabu-kabu Padang panjang {{ ucwords(setting('sebutan_kecamatan')) }} Luak kabupaten Lima Puluh Kota Provinsi Sumatera Barat, + dalam hal ini bertindak untuk atas nama perkumpulan desa digital terbuka, selanjutnya disebut PIHAK KEDUA.

    diff --git a/resources/views/admin/pendaftaran_kerjasama/terdaftar.blade.php b/resources/views/admin/pendaftaran_kerjasama/terdaftar.blade.php index 403433c5d..09dab0167 100644 --- a/resources/views/admin/pendaftaran_kerjasama/terdaftar.blade.php +++ b/resources/views/admin/pendaftaran_kerjasama/terdaftar.blade.php @@ -73,7 +73,7 @@ {{ strtoupper(setting('sebutan_desa')) }} : {{-- prettier-ignore-start --}} - {{ "Desa {$response->data->desa->nama_desa}, Kecamatan {$response->data->desa->nama_kec}, Kabupaten {$response->data->desa->nama_kab}, Provinsi {$response->data->desa->nama_prov}" }} + {{ "Desa {$response->data->desa->nama_desa}, {{ ucwords(setting('sebutan_kecamatan')) }} {$response->data->desa->nama_kec}, Kabupaten {$response->data->desa->nama_kab}, Provinsi {$response->data->desa->nama_prov}" }} {{-- prettier-ignore-end --}} diff --git a/resources/views/admin/penduduk/rtm/cetak_rtm.blade.php b/resources/views/admin/penduduk/rtm/cetak_rtm.blade.php index 7a517269a..51eaac9a0 100644 --- a/resources/views/admin/penduduk/rtm/cetak_rtm.blade.php +++ b/resources/views/admin/penduduk/rtm/cetak_rtm.blade.php @@ -25,7 +25,7 @@ Nama KK : {{ strtoupper($kepala_kk['nama']) }} - Kecamatan + {{ ucwords(setting('sebutan_kecamatan')) }} : {{ strtoupper($desa['nama_kecamatan']) }} diff --git a/resources/views/admin/pengaturan_surat/asset_tinymce.blade.php b/resources/views/admin/pengaturan_surat/asset_tinymce.blade.php index 73c110d06..b4b9f0b93 100644 --- a/resources/views/admin/pengaturan_surat/asset_tinymce.blade.php +++ b/resources/views/admin/pengaturan_surat/asset_tinymce.blade.php @@ -7,11 +7,11 @@ $fonts .= $nameFont . '=' . pathinfo($font, PATHINFO_FILENAME) . '; '; $cssFont .= " - @font-face { - font-family: '{$nameFont}'; - src: url($url) format('truetype'); - } - "; +@font-face { +font-family: '{$nameFont}'; +src: url($url) format('truetype'); +} +"; } $fonts = trim($fonts); $cssFont = trim($cssFont); @@ -102,10 +102,15 @@ classes: 'alignbottom' relative_urls: false, remove_script_host: false, entity_encoding: 'raw', - font_size_input_default_units: 'pt', + font_size_input_default_unit: 'pt', line_height_formats: '1 1.15 1.5 2 2.5 3', font_family_formats: `Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black; Bookman Old Style=bookman old style; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Tahoma=tahoma,arial,helvetica,sans-serif; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva;${fonts}`, setup: function(ed) { + ed.on('init', function() { + setTimeout(function() { + ed.execCommand('fontSize', false, '12pt'); + }, 500); + }); ed.on('BeforeExecCommand', function(e) { if (e.command === 'mcePageBreak') { e.preventDefault(); @@ -118,10 +123,6 @@ classes: 'alignbottom' insertPagebreak(ed); } }); - ed.options.register('fontsize_formats', { - processor: 'string', - default: '8pt 10pt 12pt 14pt 18pt 24pt 36pt' - }); }, content_style: ` body { diff --git a/resources/views/admin/pengaturan_surat/form.blade.php b/resources/views/admin/pengaturan_surat/form.blade.php index 90f5da2bc..60446e1ca 100644 --- a/resources/views/admin/pengaturan_surat/form.blade.php +++ b/resources/views/admin/pengaturan_surat/form.blade.php @@ -60,7 +60,6 @@ // Disable all input form elements $('form :input') .prop('readonly', true); - $('input[type="checkbox"]').prop('disabled', true); // Disable all button form elements @@ -140,6 +139,10 @@ }); $('#preview').click(function(e) { + if (viewOnly) { + $('form :input').prop('required', false); + $('form :input').removeClass('required'); + } if (!$('#validasi').valid()) return false; diff --git a/resources/views/admin/pengaturan_surat/index.blade.php b/resources/views/admin/pengaturan_surat/index.blade.php index bb6f6e035..c93cc85f1 100644 --- a/resources/views/admin/pengaturan_surat/index.blade.php +++ b/resources/views/admin/pengaturan_surat/index.blade.php @@ -20,9 +20,8 @@ Tambah @endif @if (can('h')) - + Hapus @endif @if (can('u')) diff --git a/resources/views/admin/pengaturan_surat/kembali.blade.php b/resources/views/admin/pengaturan_surat/kembali.blade.php index 9d1a8df69..8a0dc9b3d 100644 --- a/resources/views/admin/pengaturan_surat/kembali.blade.php +++ b/resources/views/admin/pengaturan_surat/kembali.blade.php @@ -12,8 +12,8 @@

    Info !

    - Jika surat ingin dikirim ke kecamatan, letakan kode [qr_camat] pada tempat yang ingin ditempelkan QRCode - Kecamatan. + Jika surat ingin dikirim ke {{ setting('sebutan_kecamatan') }}, letakan kode [qr_camat] pada tempat yang ingin ditempelkan QRCode + {{ setting('sebutan_kecamatan') }}.
    @endif @endif diff --git a/resources/views/admin/surat/keluar/index.blade.php b/resources/views/admin/surat/keluar/index.blade.php index 8bb773056..dc70ea4e2 100644 --- a/resources/views/admin/surat/keluar/index.blade.php +++ b/resources/views/admin/surat/keluar/index.blade.php @@ -327,7 +327,7 @@ class: 'aksi', e.preventDefault(); var id = $(e.target).closest('a').data('id') Swal.fire({ - title: 'Apakah anda yakin ingin mengirim surat ini ke kecamatan?', + title: 'Apakah anda yakin ingin mengirim surat ini ke ' + '{{ ucwords(setting('sebutan_kecamatan')) }}' + ' ?', showCancelButton: true, confirmButtonText: 'Kirim', showLoaderOnConfirm: true, @@ -368,11 +368,13 @@ class: 'aksi', } else { Swal.fire({ icon: 'success', - title: 'Dokumen berhasil dikirim ke kecamatan', + title: 'Dokumen berhasil dikirim ke ' + '{{ ucwords(setting('sebutan_kecamatan')) }}', showConfirmButton: true, }).then((result) => { - window.location.replace("{{ ci_route('keluar') }}"); - }) + if (result.isConfirmed) { + window.location.replace("{{ ci_route('keluar') }}"); + } + }); } } diff --git a/resources/views/admin/surat/keluar/widgets.blade.php b/resources/views/admin/surat/keluar/widgets.blade.php index 51d92b226..6b7ca8101 100644 --- a/resources/views/admin/surat/keluar/widgets.blade.php +++ b/resources/views/admin/surat/keluar/widgets.blade.php @@ -1,7 +1,7 @@ @if (setting('sinkronisasi_opendk'))

    Info Penting!

    - Fitur Sinkronisasi Surat TTE ke kecamatan saat ini masih berupa demo menunggu proses penyempurnaan dan terdapat kecamatan yang sudah mengimplentasikan TTE. + Fitur Sinkronisasi Surat TTE ke {{ setting('sebutan_kecamatan') }} saat ini masih berupa demo menunggu proses penyempurnaan dan terdapat {{ setting('sebutan_kecamatan') }} yang sudah mengimplentasikan TTE. Kami juga menghimbau kepada seluruh pengguna memberikan masukan terkait penyempurnaan fitur ini baik dari sisi OpenSID maupun OpenDK. Masukan dapat disampaikan di grup telegram, forum opendesa maupun issue di github.
    @@ -63,7 +63,7 @@
    - Kecamatan + {{ ucwords(setting('sebutan_kecamatan')) }} {{ $widgets['kecamatan'] }}
    diff --git a/resources/views/admin/surat_dinas/arsip/index.blade.php b/resources/views/admin/surat_dinas/arsip/index.blade.php index 58f7b473d..1f39647a0 100644 --- a/resources/views/admin/surat_dinas/arsip/index.blade.php +++ b/resources/views/admin/surat_dinas/arsip/index.blade.php @@ -303,7 +303,7 @@ class: 'aksi', e.preventDefault(); var id = $(e.target).closest('a').data('id') Swal.fire({ - title: 'Apakah anda yakin ingin mengirim surat ini ke kecamatan?', + title: 'Apakah anda yakin ingin mengirim surat ini ke ' + '{{ setting('sebutan_kecamatan') }}' + ' ?', showCancelButton: true, confirmButtonText: 'Kirim', showLoaderOnConfirm: true, diff --git a/storage/app/template/lampiran/f-2.01-kelahiran/data.php b/storage/app/template/lampiran/f-2.01-kelahiran/data.php new file mode 100644 index 000000000..4220f1597 --- /dev/null +++ b/storage/app/template/lampiran/f-2.01-kelahiran/data.php @@ -0,0 +1,94 @@ +surat_model->surat_model->get_data_ibu($individu['id']); +if ($ibu) { + $input['nik_ibu'] = get_nik($ibu['nik']); + $input['nama_ibu'] = $ibu['nama']; + $input['tempat_lahir_ibu'] = strtoupper($ibu['tempatlahir']); + $input['tanggal_lahir_ibu'] = $ibu['tanggallahir']; + $input['umur_ibu'] = str_pad($ibu['umur'], 3, '0', STR_PAD_LEFT); + $input['pekerjaanid_ibu'] = str_pad($ibu['pekerjaan_id'], 2, '0', STR_PAD_LEFT); + $input['pekerjaanibu'] = $ibu['pek']; + $input['alamat_ibu'] = trim($ibu['alamat'] . ' ' . $ibu['dusun']); + $input['rt_ibu'] = $ibu['rt']; + $input['rw_ibu'] = $ibu['rw']; + $input['desaibu'] = $config['nama_desa']; + $input['kecibu'] = $config['nama_kecamatan']; + $input['kabibu'] = $config['nama_kabupaten']; + $input['provinsiibu'] = $config['nama_propinsi']; + $input['kewarganegaraan_ibu'] = $ibu['wn']; +} else { + $input['pekerjaanid_ibu'] = str_pad($input['pekerjaanid_ibu'], 2, '0', STR_PAD_LEFT); + $input['umur_ibu'] = str_pad($input['umur_ibu'], 3, '0', STR_PAD_LEFT); +} + +$ayah = $this->surat_model->get_data_ayah($individu['id']); +if ($ayah) { + $input['nik_ayah'] = get_nik($ayah['nik']); + $input['nama_ayah'] = $ayah['nama']; + $input['tempat_lahir_ayah'] = strtoupper($ayah['tempatlahir']); + $input['tanggal_lahir_ayah'] = $ayah['tanggallahir']; + $input['umur_ayah'] = str_pad($ayah['umur'], 3, '0', STR_PAD_LEFT); + $input['pekerjaanid_ayah'] = str_pad($ayah['pekerjaan_id'], 2, '0', STR_PAD_LEFT); + $input['pekerjaanayah'] = $ayah['pek']; + $input['alamat_ayah'] = trim($ayah['alamat'] . ' ' . $ayah['dusun']); + $input['rt_ayah'] = $ayah['rt']; + $input['rw_ayah'] = $ayah['rw']; + $input['desaayah'] = $config['nama_desa']; + $input['kecayah'] = $config['nama_kecamatan']; + $input['kabayah'] = $config['nama_kabupaten']; + $input['provinsiayah'] = $config['nama_propinsi']; + $input['kewarganegaraan_ayah'] = $ayah['wn']; +} else { + $input['pekerjaanid_ayah'] = str_pad($input['pekerjaanid_ayah'], 2, '0', STR_PAD_LEFT); + $input['umur_ayah'] = str_pad($input['umur_ayah'], 3, '0', STR_PAD_LEFT); +} \ No newline at end of file diff --git a/storage/app/template/lampiran/f-2.01-kelahiran/view.php b/storage/app/template/lampiran/f-2.01-kelahiran/view.php new file mode 100644 index 000000000..51b1f86b5 --- /dev/null +++ b/storage/app/template/lampiran/f-2.01-kelahiran/view.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/storage/app/template/lampiran/f-2.01-kematian/data.php b/storage/app/template/lampiran/f-2.01-kematian/data.php new file mode 100644 index 000000000..5d56abad2 --- /dev/null +++ b/storage/app/template/lampiran/f-2.01-kematian/data.php @@ -0,0 +1,103 @@ +surat_model->surat_model->get_data_ibu($individu['id']); +if ($ibu) { + $input['nik_ibu'] = get_nik($ibu['nik']); + $input['nama_ibu'] = $ibu['nama']; + $input['tempat_lahir_ibu'] = strtoupper($ibu['tempatlahir']); + $input['tanggal_lahir_ibu'] = $ibu['tanggallahir']; + $input['umur_ibu'] = str_pad($ibu['umur'], 3, '0', STR_PAD_LEFT); + $input['pekerjaanid_ibu'] = str_pad($ibu['pekerjaan_id'], 2, '0', STR_PAD_LEFT); + $input['pekerjaanibu'] = $ibu['pek']; + $input['alamat_ibu'] = trim($ibu['alamat'] . ' ' . $ibu['dusun']); + $input['rt_ibu'] = $ibu['rt']; + $input['rw_ibu'] = $ibu['rw']; + $input['desaibu'] = $config['nama_desa']; + $input['kecibu'] = $config['nama_kecamatan']; + $input['kabibu'] = $config['nama_kabupaten']; + $input['provinsiibu'] = $config['nama_propinsi']; + $input['kewarganegaraan_ibu'] = $ibu['wn']; +} else { + $input['pekerjaanid_ibu'] = str_pad($input['pekerjaanid_ibu'], 2, '0', STR_PAD_LEFT); + $input['umur_ibu'] = str_pad($input['umur_ibu'], 3, '0', STR_PAD_LEFT); +} + +$ayah = $this->surat_model->get_data_ayah($individu['id']); +if ($ayah) { + $input['nik_ayah'] = get_nik($ayah['nik']); + $input['nama_ayah'] = $ayah['nama']; + $input['tempat_lahir_ayah'] = strtoupper($ayah['tempatlahir']); + $input['tanggal_lahir_ayah'] = $ayah['tanggallahir']; + $input['umur_ayah'] = str_pad($ayah['umur'], 3, '0', STR_PAD_LEFT); + $input['pekerjaanid_ayah'] = str_pad($ayah['pekerjaan_id'], 2, '0', STR_PAD_LEFT); + $input['pekerjaanayah'] = $ayah['pek']; + $input['alamat_ayah'] = trim($ayah['alamat'] . ' ' . $ayah['dusun']); + $input['rt_ayah'] = $ayah['rt']; + $input['rw_ayah'] = $ayah['rw']; + $input['desaayah'] = $config['nama_desa']; + $input['kecayah'] = $config['nama_kecamatan']; + $input['kabayah'] = $config['nama_kabupaten']; + $input['provinsiayah'] = $config['nama_propinsi']; + $input['kewarganegaraan_ayah'] = $ayah['wn']; +} else { + $input['pekerjaanid_ayah'] = str_pad($input['pekerjaanid_ayah'], 2, '0', STR_PAD_LEFT); + $input['umur_ayah'] = str_pad($input['umur_ayah'], 3, '0', STR_PAD_LEFT); +} + +// Karena data F-2.01 berisi berbagai jenis lampiran, sehingga yang dimaksud data utama belum sesuai +$input['nik_kematian'] = get_nik($individu['nik']); +$input['nama_kematian'] = $individu['nama']; +$data_mati = $this->surat_model->get_data_mati($individu['id']); +$input['tanggal_kematian'] = $data_mati->tgl_peristiwa; +$input['jam_kematian'] = $data_mati->jam_mati; +$input['sebab_kematian'] = $data_mati->sebab; +$input['tempat_kematian'] = $data_mati->meninggal_di; +$input['penolong_kematian'] = $data_mati->penolong_mati; diff --git a/storage/app/template/lampiran/f-2.01-kematian/view.php b/storage/app/template/lampiran/f-2.01-kematian/view.php new file mode 100644 index 000000000..51b1f86b5 --- /dev/null +++ b/storage/app/template/lampiran/f-2.01-kematian/view.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/storage/app/template/lampiran/f-2.01/data.php b/storage/app/template/lampiran/f-2.01/data.php index 27dbdf713..560c6950f 100644 --- a/storage/app/template/lampiran/f-2.01/data.php +++ b/storage/app/template/lampiran/f-2.01/data.php @@ -37,40 +37,46 @@ defined('BASEPATH') || exit('No direct script access allowed'); +$tampil_data_anak = false; +$tampil_data_orang_tua = false; +$tampil_data_pelapor = false; +$tampil_data_saksi = false; +$tampil_data_kematian = false; +$tampil_data_subjek_akta_1 = false; +$tampil_data_subjek_akta_2 = false; +$tampil_data_lahir_mati = false; +$tampil_data_perkawinan = false; +$tampil_data_perceraian = false; +$tampil_data_pengankatan_anak = false; +$tampil_data_pengakuan_anak = false; +$tampil_data_pengesahan_anak = false; +$tampil_data_perubahan_nama = false; +$tampil_data_perubahan_status_kewarganeraan = false; +$tampil_data_perubahan_peristiwa_lain = false; +$tampil_data_perubahan_akta = false; +$tampil_data_pelaporan_luar_nkri = false; + switch ($surat->url_surat) { - case 'surat-keterangan-kelahiran': - $format_f201 = 1; - $tampil_data_anak = true; - $tampil_data_orang_tua = true; - $tampil_data_pelapor = true; - $tampil_data_saksi = true; - $tampil_data_kematian = true; - $tampil_data_subjek_akta_1 = true; - $tampil_data_subjek_akta_2 = true; - $tampil_data_lahir_mati = true; - $tampil_data_perkawinan = true; - $tampil_data_perceraian = true; - $tampil_data_pengankatan_anak = true; - $tampil_data_pengakuan_anak = true; - $tampil_data_pengesahan_anak = true; - $tampil_data_perubahan_nama = true; - $tampil_data_perubahan_status_kewarganeraan = true; - $tampil_data_perubahan_peristiwa_lain = true; - $tampil_data_perubahan_akta = true; - $tampil_data_pelaporan_luar_nkri = true; + case Illuminate\Support\Str::contains($surat->url_surat, 'surat-keterangan-kelahiran'): + $format_f201 = 1; + $tampil_data_anak = true; + $tampil_data_orang_tua = true; + $tampil_data_pelapor = true; + $tampil_data_saksi = true; + $tampil_data_lahir_mati = true; break; - case 'surat-keterangan-kematian': + case Illuminate\Support\Str::contains($surat->url_surat, 'surat-keterangan-kematian'): $format_f201 = 7; $tampil_data_kematian = true; $tampil_data_orang_tua = true; $tampil_data_pelapor = true; $tampil_data_saksi = true; - break; + break; - default: - // code... - break; + default: + // code... + break; } // include data pelapor dan saksi diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ec07b172a..be3208946 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -940,17 +940,17 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.3.3", - "version_normalized": "3.3.3.0", + "version": "v3.4.0", + "version_normalized": "3.4.0.0", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a" + "reference": "8c784d071debd117328803d86b2097615b457500" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/8c784d071debd117328803d86b2097615b457500", + "reference": "8c784d071debd117328803d86b2097615b457500", "shasum": "" }, "require": { @@ -963,11 +963,15 @@ "require-dev": { "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.0", - "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^7.0|^8.0|^9.0" }, - "time": "2023-08-10T19:36:49+00:00", + "time": "2024-10-09T13:47:03+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { @@ -992,7 +996,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.3" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.4.0" }, "funding": [ { @@ -1396,17 +1400,17 @@ }, { "name": "google/apiclient-services", - "version": "v0.375.0", - "version_normalized": "0.375.0.0", + "version": "v0.377.0", + "version_normalized": "0.377.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "ad8c4fcf925fd10198c20e2d7a3390183dc24bf1" + "reference": "912727289dd617a97da7d2700debbe81a59cea19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ad8c4fcf925fd10198c20e2d7a3390183dc24bf1", - "reference": "ad8c4fcf925fd10198c20e2d7a3390183dc24bf1", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/912727289dd617a97da7d2700debbe81a59cea19", + "reference": "912727289dd617a97da7d2700debbe81a59cea19", "shasum": "" }, "require": { @@ -1415,7 +1419,7 @@ "require-dev": { "phpunit/phpunit": "^9.6" }, - "time": "2024-09-29T01:10:26+00:00", + "time": "2024-10-14T00:56:24+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1437,7 +1441,7 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.375.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.377.0" }, "install-path": "../google/apiclient-services" }, @@ -4154,17 +4158,17 @@ }, { "name": "league/flysystem", - "version": "3.29.0", - "version_normalized": "3.29.0.0", + "version": "3.29.1", + "version_normalized": "3.29.1.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0" + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0adc0d9a51852e170e0028a60bd271726626d3f0", - "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319", + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319", "shasum": "" }, "require": { @@ -4200,7 +4204,7 @@ "phpunit/phpunit": "^9.5.11|^10.0", "sabre/dav": "^4.6.0" }, - "time": "2024-09-29T11:59:11+00:00", + "time": "2024-10-08T08:58:34+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4234,7 +4238,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.29.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.29.1" }, "install-path": "../league/flysystem" }, @@ -4400,17 +4404,17 @@ }, { "name": "maennchen/zipstream-php", - "version": "3.1.0", - "version_normalized": "3.1.0.0", + "version": "3.1.1", + "version_normalized": "3.1.1.0", "source": { "type": "git", "url": "https://github.com/maennchen/ZipStream-PHP.git", - "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1" + "reference": "6187e9cc4493da94b9b63eb2315821552015fca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1", - "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/6187e9cc4493da94b9b63eb2315821552015fca9", + "reference": "6187e9cc4493da94b9b63eb2315821552015fca9", "shasum": "" }, "require": { @@ -4431,7 +4435,7 @@ "guzzlehttp/psr7": "^2.4", "psr/http-message": "^2.0" }, - "time": "2023-06-21T14:59:35+00:00", + "time": "2024-10-10T12:33:01+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4468,16 +4472,12 @@ ], "support": { "issues": "https://github.com/maennchen/ZipStream-PHP/issues", - "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0" + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.1" }, "funding": [ { "url": "https://github.com/maennchen", "type": "github" - }, - { - "url": "https://opencollective.com/zipstream", - "type": "open_collective" } ], "install-path": "../maennchen/zipstream-php" @@ -4810,29 +4810,29 @@ }, { "name": "nette/schema", - "version": "v1.3.0", - "version_normalized": "1.3.0.0", + "version": "v1.3.2", + "version_normalized": "1.3.2.0", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + "reference": "da801d52f0354f70a638673c4a0f04e16529431d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", + "reference": "da801d52f0354f70a638673c4a0f04e16529431d", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "phpstan/phpstan-nette": "^1.0", "tracy/tracy": "^2.8" }, - "time": "2023-12-11T11:54:22+00:00", + "time": "2024-10-06T23:10:23+00:00", "type": "library", "extra": { "branch-alias": { @@ -4869,7 +4869,7 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.0" + "source": "https://github.com/nette/schema/tree/v1.3.2" }, "install-path": "../nette/schema" }, @@ -4964,37 +4964,36 @@ }, { "name": "nunomaduro/termwind", - "version": "v1.15.1", - "version_normalized": "1.15.1.0", + "version": "v1.16.0", + "version_normalized": "1.16.0.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc" + "reference": "dcf1ec3dfa36137b7ce41d43866644a7ab8fc257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/8ab0b32c8caa4a2e09700ea32925441385e4a5dc", - "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/dcf1ec3dfa36137b7ce41d43866644a7ab8fc257", + "reference": "dcf1ec3dfa36137b7ce41d43866644a7ab8fc257", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": "^8.0", - "symfony/console": "^5.3.0|^6.0.0" + "php": "^8.1", + "symfony/console": "^6.4.12" }, "require-dev": { - "ergebnis/phpstan-rules": "^1.0.", - "illuminate/console": "^8.0|^9.0", - "illuminate/support": "^8.0|^9.0", - "laravel/pint": "^1.0.0", - "pestphp/pest": "^1.21.0", - "pestphp/pest-plugin-mock": "^1.0", - "phpstan/phpstan": "^1.4.6", - "phpstan/phpstan-strict-rules": "^1.1.0", - "symfony/var-dumper": "^5.2.7|^6.0.0", + "illuminate/console": "^10.48.22", + "illuminate/support": "^10.48.22", + "laravel/pint": "^1.18.1", + "pestphp/pest": "^2", + "pestphp/pest-plugin-mock": "2.0.0", + "phpstan/phpstan": "^1.12.6", + "phpstan/phpstan-strict-rules": "^1.6.1", + "symfony/var-dumper": "^6.4.11", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, - "time": "2023-02-08T01:06:31+00:00", + "time": "2024-10-15T15:27:12+00:00", "type": "library", "extra": { "laravel": { @@ -5033,7 +5032,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v1.15.1" + "source": "https://github.com/nunomaduro/termwind/tree/v1.16.0" }, "funding": [ { @@ -8787,23 +8786,23 @@ }, { "name": "tecnickcom/tcpdf", - "version": "6.7.5", - "version_normalized": "6.7.5.0", + "version": "6.7.6", + "version_normalized": "6.7.6.0", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36" + "reference": "4cf1ab192e87e6916d20f93077b2bdfa96a2f848" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/4cf1ab192e87e6916d20f93077b2bdfa96a2f848", + "reference": "4cf1ab192e87e6916d20f93077b2bdfa96a2f848", "shasum": "" }, "require": { "php": ">=5.5.0" }, - "time": "2024-04-20T17:25:10+00:00", + "time": "2024-10-06T10:54:28+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -8850,7 +8849,7 @@ ], "support": { "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.5" + "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.6" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index aeddc9cdc..0203d1a13 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'opendesa/opensid', - 'pretty_version' => '2406.0.0.x-dev', - 'version' => '2406.0.0.9999999-dev', - 'reference' => 'fc14e1a133cae66fc0f10d35a5ebe778c99276a9', + 'pretty_version' => '2405.0.3.x-dev', + 'version' => '2405.0.3.9999999-dev', + 'reference' => 'f6814b786b6ae2e836d836695e0ce70f4269967b', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -119,9 +119,9 @@ 'dev_requirement' => false, ), 'dragonmantank/cron-expression' => array( - 'pretty_version' => 'v3.3.3', - 'version' => '3.3.3.0', - 'reference' => 'adfb1f505deb6384dc8b39804c5065dd3c8c8c0a', + 'pretty_version' => 'v3.4.0', + 'version' => '3.4.0.0', + 'reference' => '8c784d071debd117328803d86b2097615b457500', 'type' => 'library', 'install_path' => __DIR__ . '/../dragonmantank/cron-expression', 'aliases' => array(), @@ -182,9 +182,9 @@ 'dev_requirement' => false, ), 'google/apiclient-services' => array( - 'pretty_version' => 'v0.375.0', - 'version' => '0.375.0.0', - 'reference' => 'ad8c4fcf925fd10198c20e2d7a3390183dc24bf1', + 'pretty_version' => 'v0.377.0', + 'version' => '0.377.0.0', + 'reference' => '912727289dd617a97da7d2700debbe81a59cea19', 'type' => 'library', 'install_path' => __DIR__ . '/../google/apiclient-services', 'aliases' => array(), @@ -560,9 +560,9 @@ 'dev_requirement' => false, ), 'league/flysystem' => array( - 'pretty_version' => '3.29.0', - 'version' => '3.29.0.0', - 'reference' => '0adc0d9a51852e170e0028a60bd271726626d3f0', + 'pretty_version' => '3.29.1', + 'version' => '3.29.1.0', + 'reference' => 'edc1bb7c86fab0776c3287dbd19b5fa278347319', 'type' => 'library', 'install_path' => __DIR__ . '/../league/flysystem', 'aliases' => array(), @@ -596,9 +596,9 @@ 'dev_requirement' => false, ), 'maennchen/zipstream-php' => array( - 'pretty_version' => '3.1.0', - 'version' => '3.1.0.0', - 'reference' => 'b8174494eda667f7d13876b4a7bfef0f62a7c0d1', + 'pretty_version' => '3.1.1', + 'version' => '3.1.1.0', + 'reference' => '6187e9cc4493da94b9b63eb2315821552015fca9', 'type' => 'library', 'install_path' => __DIR__ . '/../maennchen/zipstream-php', 'aliases' => array(), @@ -647,9 +647,9 @@ 'dev_requirement' => false, ), 'nette/schema' => array( - 'pretty_version' => 'v1.3.0', - 'version' => '1.3.0.0', - 'reference' => 'a6d3a6d1f545f01ef38e60f375d1cf1f4de98188', + 'pretty_version' => 'v1.3.2', + 'version' => '1.3.2.0', + 'reference' => 'da801d52f0354f70a638673c4a0f04e16529431d', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/schema', 'aliases' => array(), @@ -665,18 +665,18 @@ 'dev_requirement' => false, ), 'nunomaduro/termwind' => array( - 'pretty_version' => 'v1.15.1', - 'version' => '1.15.1.0', - 'reference' => '8ab0b32c8caa4a2e09700ea32925441385e4a5dc', + 'pretty_version' => 'v1.16.0', + 'version' => '1.16.0.0', + 'reference' => 'dcf1ec3dfa36137b7ce41d43866644a7ab8fc257', 'type' => 'library', 'install_path' => __DIR__ . '/../nunomaduro/termwind', 'aliases' => array(), 'dev_requirement' => false, ), 'opendesa/opensid' => array( - 'pretty_version' => '2406.0.0.x-dev', - 'version' => '2406.0.0.9999999-dev', - 'reference' => 'fc14e1a133cae66fc0f10d35a5ebe778c99276a9', + 'pretty_version' => '2405.0.3.x-dev', + 'version' => '2405.0.3.9999999-dev', + 'reference' => 'f6814b786b6ae2e836d836695e0ce70f4269967b', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -1202,9 +1202,9 @@ 'dev_requirement' => false, ), 'tecnickcom/tcpdf' => array( - 'pretty_version' => '6.7.5', - 'version' => '6.7.5.0', - 'reference' => '951eabf0338ec2522bd0d5d9c79b08a3a3d36b36', + 'pretty_version' => '6.7.6', + 'version' => '6.7.6.0', + 'reference' => '4cf1ab192e87e6916d20f93077b2bdfa96a2f848', 'type' => 'library', 'install_path' => __DIR__ . '/../tecnickcom/tcpdf', 'aliases' => array(), diff --git a/vendor/dragonmantank/cron-expression/composer.json b/vendor/dragonmantank/cron-expression/composer.json index 657a5b47c..fdb46ee41 100644 --- a/vendor/dragonmantank/cron-expression/composer.json +++ b/vendor/dragonmantank/cron-expression/composer.json @@ -18,7 +18,6 @@ "require-dev": { "phpstan/phpstan": "^1.0", "phpunit/phpunit": "^7.0|^8.0|^9.0", - "phpstan/phpstan-webmozart-assert": "^1.0", "phpstan/extension-installer": "^1.0" }, "autoload": { @@ -38,6 +37,11 @@ "phpstan": "./vendor/bin/phpstan analyze", "test": "phpunit" }, + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "config": { "allow-plugins": { "ocramius/package-versions": true, diff --git a/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php index 216ce432f..f3d8eb003 100644 --- a/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php +++ b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php @@ -12,7 +12,6 @@ use InvalidArgumentException; use LogicException; use RuntimeException; -use Webmozart\Assert\Assert; /** * CRON expression parser that can determine whether or not a CRON expression is @@ -148,7 +147,7 @@ public static function getAliases(): array /** * @deprecated since version 3.0.2, use __construct instead. */ - public static function factory(string $expression, FieldFactoryInterface $fieldFactory = null): CronExpression + public static function factory(string $expression, ?FieldFactoryInterface $fieldFactory = null): CronExpression { /** @phpstan-ignore-next-line */ return new static($expression, $fieldFactory); @@ -179,7 +178,7 @@ public static function isValidExpression(string $expression): bool * @param null|FieldFactoryInterface $fieldFactory Factory to create cron fields * @throws InvalidArgumentException */ - public function __construct(string $expression, FieldFactoryInterface $fieldFactory = null) + public function __construct(string $expression, ?FieldFactoryInterface $fieldFactory = null) { $shortcut = strtolower($expression); $expression = self::$registeredAliases[$shortcut] ?? $expression; @@ -200,7 +199,12 @@ public function __construct(string $expression, FieldFactoryInterface $fieldFact public function setExpression(string $value): CronExpression { $split = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); - Assert::isArray($split); + + if (!\is_array($split)) { + throw new InvalidArgumentException( + $value . ' is not a valid CRON expression' + ); + } $notEnoughParts = \count($split) < 5; @@ -334,7 +338,10 @@ public function getMultipleRunDates(int $total, $currentTime = 'now', bool $inve $currentTime = new DateTime($currentTime); } - Assert::isInstanceOf($currentTime, DateTime::class); + if (!$currentTime instanceof DateTime) { + throw new InvalidArgumentException('invalid current time'); + } + $currentTime->setTimezone(new DateTimeZone($timeZone)); $matches = []; @@ -420,7 +427,10 @@ public function isDue($currentTime = 'now', $timeZone = null): bool $currentTime = new DateTime($currentTime); } - Assert::isInstanceOf($currentTime, DateTime::class); + if (!$currentTime instanceof DateTime) { + throw new InvalidArgumentException('invalid current time'); + } + $currentTime->setTimezone(new DateTimeZone($timeZone)); // drop the seconds to 0 @@ -462,7 +472,10 @@ protected function getRunDate($currentTime = null, int $nth = 0, bool $invert = $currentDate = new DateTime('now'); } - Assert::isInstanceOf($currentDate, DateTime::class); + if (!$currentDate instanceof DateTime) { + throw new InvalidArgumentException('invalid current date'); + } + $currentDate->setTimezone(new DateTimeZone($timeZone)); // Workaround for setTime causing an offset change: https://bugs.php.net/bug.php?id=81074 $currentDate = DateTime::createFromFormat("!Y-m-d H:iO", $currentDate->format("Y-m-d H:iP"), $currentDate->getTimezone()); diff --git a/vendor/google/apiclient-services/src/Drive.php b/vendor/google/apiclient-services/src/Drive.php index 1e1442836..ec2fafc18 100644 --- a/vendor/google/apiclient-services/src/Drive.php +++ b/vendor/google/apiclient-services/src/Drive.php @@ -72,6 +72,7 @@ class Drive extends \Google\Service public $comments; public $drives; public $files; + public $files_accessproposals; public $operation; public $operations; public $permissions; @@ -900,6 +901,66 @@ public function __construct($clientOrConfig = [], $rootUrl = null) ] ] ); + $this->files_accessproposals = new Drive\Resource\FilesAccessproposals( + $this, + $this->serviceName, + 'accessproposals', + [ + 'methods' => [ + 'list' => [ + 'path' => 'files/{fileId}/accessproposals', + 'httpMethod' => 'GET', + 'parameters' => [ + 'fileId' => [ + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ], + 'pageSize' => [ + 'location' => 'query', + 'type' => 'integer', + ], + 'pageToken' => [ + 'location' => 'query', + 'type' => 'string', + ], + ], + ],'resolve' => [ + 'path' => 'files/{fileId}/accessproposals/{proposalId}:resolve', + 'httpMethod' => 'POST', + 'parameters' => [ + 'fileId' => [ + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ], + 'proposalId' => [ + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ], + 'action' => [ + 'location' => 'query', + 'type' => 'string', + ], + 'role' => [ + 'location' => 'query', + 'type' => 'string', + 'repeated' => true, + ], + 'sendNotification' => [ + 'location' => 'query', + 'type' => 'boolean', + ], + 'view' => [ + 'location' => 'query', + 'type' => 'string', + ], + ], + ], + ] + ] + ); $this->operation = new Drive\Resource\Operation( $this, $this->serviceName, diff --git a/vendor/google/apiclient-services/src/Drive/AccessProposal.php b/vendor/google/apiclient-services/src/Drive/AccessProposal.php new file mode 100644 index 000000000..034d7dc52 --- /dev/null +++ b/vendor/google/apiclient-services/src/Drive/AccessProposal.php @@ -0,0 +1,151 @@ +createTime = $createTime; + } + /** + * @return string + */ + public function getCreateTime() + { + return $this->createTime; + } + /** + * @param string + */ + public function setFileId($fileId) + { + $this->fileId = $fileId; + } + /** + * @return string + */ + public function getFileId() + { + return $this->fileId; + } + /** + * @param string + */ + public function setProposalId($proposalId) + { + $this->proposalId = $proposalId; + } + /** + * @return string + */ + public function getProposalId() + { + return $this->proposalId; + } + /** + * @param string + */ + public function setRecipientEmailAddress($recipientEmailAddress) + { + $this->recipientEmailAddress = $recipientEmailAddress; + } + /** + * @return string + */ + public function getRecipientEmailAddress() + { + return $this->recipientEmailAddress; + } + /** + * @param string + */ + public function setRequestMessage($requestMessage) + { + $this->requestMessage = $requestMessage; + } + /** + * @return string + */ + public function getRequestMessage() + { + return $this->requestMessage; + } + /** + * @param string + */ + public function setRequesterEmailAddress($requesterEmailAddress) + { + $this->requesterEmailAddress = $requesterEmailAddress; + } + /** + * @return string + */ + public function getRequesterEmailAddress() + { + return $this->requesterEmailAddress; + } + /** + * @param AccessProposalRoleAndView[] + */ + public function setRolesAndViews($rolesAndViews) + { + $this->rolesAndViews = $rolesAndViews; + } + /** + * @return AccessProposalRoleAndView[] + */ + public function getRolesAndViews() + { + return $this->rolesAndViews; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AccessProposal::class, 'Google_Service_Drive_AccessProposal'); diff --git a/vendor/google/apiclient-services/src/Drive/AccessProposalRoleAndView.php b/vendor/google/apiclient-services/src/Drive/AccessProposalRoleAndView.php new file mode 100644 index 000000000..5029225d8 --- /dev/null +++ b/vendor/google/apiclient-services/src/Drive/AccessProposalRoleAndView.php @@ -0,0 +1,62 @@ +role = $role; + } + /** + * @return string + */ + public function getRole() + { + return $this->role; + } + /** + * @param string + */ + public function setView($view) + { + $this->view = $view; + } + /** + * @return string + */ + public function getView() + { + return $this->view; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AccessProposalRoleAndView::class, 'Google_Service_Drive_AccessProposalRoleAndView'); diff --git a/vendor/google/apiclient-services/src/Drive/ListAccessProposalsResponse.php b/vendor/google/apiclient-services/src/Drive/ListAccessProposalsResponse.php new file mode 100644 index 000000000..e50de4eef --- /dev/null +++ b/vendor/google/apiclient-services/src/Drive/ListAccessProposalsResponse.php @@ -0,0 +1,61 @@ +accessProposals = $accessProposals; + } + /** + * @return AccessProposal[] + */ + public function getAccessProposals() + { + return $this->accessProposals; + } + /** + * @param string + */ + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + /** + * @return string + */ + public function getNextPageToken() + { + return $this->nextPageToken; + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ListAccessProposalsResponse::class, 'Google_Service_Drive_ListAccessProposalsResponse'); diff --git a/vendor/google/apiclient-services/src/Drive/Resource/FilesAccessproposals.php b/vendor/google/apiclient-services/src/Drive/Resource/FilesAccessproposals.php new file mode 100644 index 000000000..4934ddc92 --- /dev/null +++ b/vendor/google/apiclient-services/src/Drive/Resource/FilesAccessproposals.php @@ -0,0 +1,77 @@ + + * $driveService = new Google\Service\Drive(...); + * $accessproposals = $driveService->files_accessproposals; + * + */ +class FilesAccessproposals extends \Google\Service\Resource +{ + /** + * List the AccessProposals on a file. Note: Only approvers are able to list + * AccessProposals on a file. If the user is not an approver, returns a 403. + * (accessproposals.listFilesAccessproposals) + * + * @param string $fileId Required. The id of the item the request is on. + * @param array $optParams Optional parameters. + * + * @opt_param int pageSize Optional. The number of results per page + * @opt_param string pageToken Optional. The continuation token on the list of + * access requests. + * @return ListAccessProposalsResponse + * @throws \Google\Service\Exception + */ + public function listFilesAccessproposals($fileId, $optParams = []) + { + $params = ['fileId' => $fileId]; + $params = array_merge($params, $optParams); + return $this->call('list', [$params], ListAccessProposalsResponse::class); + } + /** + * Used to approve or deny an Access Proposal. (accessproposals.resolve) + * + * @param string $fileId Required. The id of the item the request is on. + * @param string $proposalId Required. The id of the access proposal to resolve. + * @param array $optParams Optional parameters. + * + * @opt_param string action Required. The action to take on the AccessProposal. + * @opt_param string role Optional. The roles the approver has allowed, if any. + * @opt_param bool sendNotification Optional. Whether to send an email to the + * requester when the AccessProposal is denied or accepted. + * @opt_param string view Optional. Indicates the view for this access proposal. + * This should only be set when the proposal belongs to a view. `published` is + * the only supported value. + * @throws \Google\Service\Exception + */ + public function resolve($fileId, $proposalId, $optParams = []) + { + $params = ['fileId' => $fileId, 'proposalId' => $proposalId]; + $params = array_merge($params, $optParams); + return $this->call('resolve', [$params]); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FilesAccessproposals::class, 'Google_Service_Drive_Resource_FilesAccessproposals'); diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php index a5ee34e26..4fb30cc10 100644 --- a/vendor/league/flysystem/src/Filesystem.php +++ b/vendor/league/flysystem/src/Filesystem.php @@ -187,7 +187,10 @@ public function publicUrl(string $path, array $config = []): string ?? throw UnableToGeneratePublicUrl::noGeneratorConfigured($path); $config = $this->config->extend($config); - return $this->publicUrlGenerator->publicUrl($this->pathNormalizer->normalizePath($path), $config); + return $this->publicUrlGenerator->publicUrl( + $this->pathNormalizer->normalizePath($path), + $config, + ); } public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string @@ -214,9 +217,15 @@ public function checksum(string $path, array $config = []): string } try { - return $this->adapter->checksum($path, $config); + return $this->adapter->checksum( + $this->pathNormalizer->normalizePath($path), + $config, + ); } catch (ChecksumAlgoIsNotSupported) { - return $this->calculateChecksumFromStream($path, $config); + return $this->calculateChecksumFromStream( + $this->pathNormalizer->normalizePath($path), + $config, + ); } } diff --git a/vendor/maennchen/zipstream-php/.gitattributes b/vendor/maennchen/zipstream-php/.gitattributes new file mode 100644 index 000000000..e058ebd0a --- /dev/null +++ b/vendor/maennchen/zipstream-php/.gitattributes @@ -0,0 +1,6 @@ +.gitignore text eol=lf +.gitattributes text eol=lf +*.md text eol=lf +*.php text eol=lf +*.yml text eol=lf +*.xml text eol=lf diff --git a/vendor/maennchen/zipstream-php/.phive/phars.xml b/vendor/maennchen/zipstream-php/.phive/phars.xml index 569106af2..183927b12 100644 --- a/vendor/maennchen/zipstream-php/.phive/phars.xml +++ b/vendor/maennchen/zipstream-php/.phive/phars.xml @@ -1,4 +1,4 @@ - + diff --git a/vendor/maennchen/zipstream-php/.php-cs-fixer.dist.php b/vendor/maennchen/zipstream-php/.php-cs-fixer.dist.php index b978f0646..38d6a7658 100644 --- a/vendor/maennchen/zipstream-php/.php-cs-fixer.dist.php +++ b/vendor/maennchen/zipstream-php/.php-cs-fixer.dist.php @@ -50,7 +50,6 @@ 'semicolon_after_instruction' => true, 'short_scalar_cast' => true, 'simplified_null_return' => true, - 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => true, 'single_line_comment_style' => true, 'single_quote' => true, diff --git a/vendor/maennchen/zipstream-php/.tool-versions b/vendor/maennchen/zipstream-php/.tool-versions index 261817810..4a3dc9dfd 100644 --- a/vendor/maennchen/zipstream-php/.tool-versions +++ b/vendor/maennchen/zipstream-php/.tool-versions @@ -1 +1 @@ -php 8.2.5 +php 8.3.1 diff --git a/vendor/maennchen/zipstream-php/composer.json b/vendor/maennchen/zipstream-php/composer.json index 98c536a43..de5e62413 100644 --- a/vendor/maennchen/zipstream-php/composer.json +++ b/vendor/maennchen/zipstream-php/composer.json @@ -52,7 +52,7 @@ "test:formatted": "@format --dry-run --stop-on-violation --using-cache=no", "test:lint": "psalm --stats --show-info=true --find-unused-psalm-suppress", "coverage:report": "php-coveralls --coverage_clover=coverage.clover.xml --json_path=coveralls-upload.json --insecure", - "install:tools": "phive install --trust-gpg-keys 0x67F861C3D889C656", + "install:tools": "phive install --trust-gpg-keys 0x67F861C3D889C656 --trust-gpg-keys 0x8AC0BAA79732DD42", "docs:generate": "tools/phpdocumentor --sourcecode" }, "autoload": { diff --git a/vendor/maennchen/zipstream-php/guides/index.rst b/vendor/maennchen/zipstream-php/guides/index.rst index 4583ca58e..48f465aea 100644 --- a/vendor/maennchen/zipstream-php/guides/index.rst +++ b/vendor/maennchen/zipstream-php/guides/index.rst @@ -113,7 +113,7 @@ The native Mac OS archive extraction tool prior to macOS 10.15 might not open archives in some conditions. A workaround is to disable the Zip64 feature with the option ``enableZip64: false``. This limits the archive to 4 Gb and 64k files but will allow users on macOS 10.14 and below to open them without issue. -See `#116 `_. +See `#116 `_. The linux ``unzip`` utility might not handle properly unicode characters. It is recommended to extract with another tool like diff --git a/vendor/maennchen/zipstream-php/results.sarif b/vendor/maennchen/zipstream-php/results.sarif new file mode 100644 index 000000000..c99a3f47f --- /dev/null +++ b/vendor/maennchen/zipstream-php/results.sarif @@ -0,0 +1 @@ +{"version":"2.1.0","$schema":"https:\/\/json.schemastore.org\/sarif-2.1.0.json","runs":[{"tool":{"driver":{"name":"Psalm","informationUri":"https:\/\/psalm.dev","version":"5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0"}},"results":[]}]} diff --git a/vendor/maennchen/zipstream-php/src/Exception.php b/vendor/maennchen/zipstream-php/src/Exception.php index 27f4f3010..2e81e307b 100644 --- a/vendor/maennchen/zipstream-php/src/Exception.php +++ b/vendor/maennchen/zipstream-php/src/Exception.php @@ -4,6 +4,4 @@ namespace ZipStream; -abstract class Exception extends \Exception -{ -} +abstract class Exception extends \Exception {} diff --git a/vendor/maennchen/zipstream-php/src/File.php b/vendor/maennchen/zipstream-php/src/File.php index 3f35de466..0462196e2 100644 --- a/vendor/maennchen/zipstream-php/src/File.php +++ b/vendor/maennchen/zipstream-php/src/File.php @@ -95,7 +95,7 @@ public function process(): string if ($this->enableZeroHeader) { // No calculation required - } elseif ($this->isSimulation() && $forecastSize) { + } elseif ($this->isSimulation() && $forecastSize !== null) { $this->uncompressedSize = $forecastSize; $this->compressedSize = $forecastSize; } else { @@ -107,11 +107,11 @@ public function process(): string $this->addFileHeader(); - $detectedSize = $forecastSize ?? $this->compressedSize; + $detectedSize = $forecastSize ?? ($this->compressedSize > 0 ? $this->compressedSize : null); if ( $this->isSimulation() && - $detectedSize > 0 + $detectedSize !== null ) { ($this->recordSentBytes)($detectedSize); } else { @@ -158,7 +158,7 @@ private function forecastSize(): ?int if ($this->compressionMethod !== CompressionMethod::STORE) { return null; } - if ($this->exactSize) { + if ($this->exactSize !== null) { return $this->exactSize; } $fstat = fstat($this->unpackStream()); @@ -184,7 +184,7 @@ private function addFileHeader(): void $zip64Enabled = $footer !== ''; - if($zip64Enabled) { + if ($zip64Enabled) { $this->version = Version::ZIP64; } @@ -350,7 +350,7 @@ private function readStream(bool $send): void } } - if ($this->exactSize && $this->uncompressedSize !== $this->exactSize) { + if ($this->exactSize !== null && $this->uncompressedSize !== $this->exactSize) { throw new FileSizeIncorrectException(expectedSize: $this->exactSize, actualSize: $this->uncompressedSize); } @@ -359,7 +359,7 @@ private function readStream(bool $send): void private function compressionInit(): ?DeflateContext { - switch($this->compressionMethod) { + switch ($this->compressionMethod) { case CompressionMethod::STORE: // Noting to do return null; @@ -390,7 +390,7 @@ private function getCdrFile(): string return CentralDirectoryFileHeader::generate( versionMadeBy: ZipStream::ZIP_VERSION_MADE_BY, - versionNeededToExtract:$this->version->value, + versionNeededToExtract: $this->version->value, generalPurposeBitFlag: $this->generalPurposeBitFlag, compressionMethod: $this->compressionMethod, lastModificationDateTime: $this->lastModificationDateTime, diff --git a/vendor/maennchen/zipstream-php/src/PackField.php b/vendor/maennchen/zipstream-php/src/PackField.php index 3370dd8d0..892b4009a 100644 --- a/vendor/maennchen/zipstream-php/src/PackField.php +++ b/vendor/maennchen/zipstream-php/src/PackField.php @@ -19,8 +19,7 @@ class PackField public function __construct( public readonly string $format, public readonly int|string $value - ) { - } + ) {} /** * Create a format string and argument list for pack(), then call @@ -33,7 +32,7 @@ public static function pack(self ...$fields): string }, ''); $args = array_map(function (self $field) { - switch($field->format) { + switch ($field->format) { case 'V': if ($field->value > self::MAX_V) { throw new RuntimeException(print_r($field->value, true) . ' is larger than 32 bits'); diff --git a/vendor/maennchen/zipstream-php/src/Time.php b/vendor/maennchen/zipstream-php/src/Time.php index 4bfba3cc5..1b4121ca9 100644 --- a/vendor/maennchen/zipstream-php/src/Time.php +++ b/vendor/maennchen/zipstream-php/src/Time.php @@ -26,20 +26,14 @@ public static function dateTimeToDosTime(DateTimeInterface $dateTime): int $dateTime = DateTimeImmutable::createFromInterface($dateTime)->sub(new DateInterval('P1980Y')); - ['year' => $year, - 'mon' => $month, - 'mday' => $day, - 'hours' => $hour, - 'minutes' => $minute, - 'seconds' => $second - ] = getdate($dateTime->getTimestamp()); + [$year, $month, $day, $hour, $minute, $second] = explode(' ', $dateTime->format('Y n j G i s')); return - ($year << 25) | - ($month << 21) | - ($day << 16) | - ($hour << 11) | - ($minute << 5) | - ($second >> 1); + ((int) $year << 25) | + ((int) $month << 21) | + ((int) $day << 16) | + ((int) $hour << 11) | + ((int) $minute << 5) | + ((int) $second >> 1); } } diff --git a/vendor/maennchen/zipstream-php/src/Zip64/ExtendedInformationExtraField.php b/vendor/maennchen/zipstream-php/src/Zip64/ExtendedInformationExtraField.php index b647ce6cd..aaac51c83 100644 --- a/vendor/maennchen/zipstream-php/src/Zip64/ExtendedInformationExtraField.php +++ b/vendor/maennchen/zipstream-php/src/Zip64/ExtendedInformationExtraField.php @@ -23,8 +23,7 @@ public static function generate( new PackField(format: 'v', value: self::TAG), new PackField( format: 'v', - value: - ($originalSize === null ? 0 : 8) + + value: ($originalSize === null ? 0 : 8) + ($compressedSize === null ? 0 : 8) + ($relativeHeaderOffset === null ? 0 : 8) + ($diskStartNumber === null ? 0 : 4) diff --git a/vendor/maennchen/zipstream-php/src/ZipStream.php b/vendor/maennchen/zipstream-php/src/ZipStream.php index cd308a493..3f4f481a8 100644 --- a/vendor/maennchen/zipstream-php/src/ZipStream.php +++ b/vendor/maennchen/zipstream-php/src/ZipStream.php @@ -59,7 +59,7 @@ * * // read and add each file to the archive * foreach ($files as $path) - * $zip->addFileFormPath(fileName: $path, $path); + * $zip->addFileFromPath(fileName: $path, $path); * * // write archive footer to stream * $zip->finish(); @@ -263,7 +263,7 @@ public function addFile( ): void { $this->addFileFromCallback( fileName: $fileName, - callback: fn () => $data, + callback: fn() => $data, comment: $comment, compressionMethod: $compressionMethod, deflateLevel: $deflateLevel, @@ -293,7 +293,7 @@ public function addFile( * // add a file named 'bigfile.rar' from the local file * // '/usr/share/bigfile.rar' with a comment and a last-modified * // time of two hours ago - * $zip->addFile( + * $zip->addFileFromPath( * fileName: 'bigfile.rar', * path: '/usr/share/bigfile.rar', * comment: 'this is a comment about bigfile.rar', @@ -330,7 +330,8 @@ public function addFileFromPath( throw new FileNotReadableException($path); } - if ($fileTime = filemtime($path)) { + $fileTime = filemtime($path); + if ($fileTime !== false) { $lastModificationDateTime ??= (new DateTimeImmutable())->setTimestamp($fileTime); } @@ -394,7 +395,7 @@ public function addFileFromStream( ): void { $this->addFileFromCallback( fileName: $fileName, - callback: fn () => $stream, + callback: fn() => $stream, comment: $comment, compressionMethod: $compressionMethod, deflateLevel: $deflateLevel, @@ -473,7 +474,7 @@ public function addFileFromPsr7Stream( ): void { $this->addFileFromCallback( fileName: $fileName, - callback: fn () => $stream, + callback: fn() => $stream, comment: $comment, compressionMethod: $compressionMethod, deflateLevel: $deflateLevel, @@ -494,7 +495,7 @@ public function addFileFromPsr7Stream( * * ```php * foreach($files as $name => $size) { - * $archive->addFileFromPsr7Stream( + * $archive->addFileFromCallback( * fileName: 'streamfile.txt', * exactSize: $size, * callback: function() use($name): Psr\Http\Message\StreamInterface { @@ -563,11 +564,11 @@ public function addFileFromCallback( dataCallback: function () use ($callback, $maxSize) { $data = $callback(); - if(is_resource($data)) { + if (is_resource($data)) { return $data; } - if($data instanceof StreamInterface) { + if ($data instanceof StreamInterface) { return StreamWrapper::getResource($data); } @@ -611,7 +612,7 @@ public function addFileFromCallback( enableZeroHeader: $enableZeroHeader ?? $this->defaultEnableZeroHeader, ); - if($this->operationMode !== OperationMode::NORMAL) { + if ($this->operationMode !== OperationMode::NORMAL) { $this->recordedSimulation[] = $file; } @@ -629,7 +630,7 @@ public function addFileFromCallback( * * ```php * // add a directory named 'world/' - * $zip->addFile(fileName: 'world/'); + * $zip->addDirectory(fileName: 'world/'); * ``` */ public function addDirectory( @@ -676,11 +677,11 @@ public function addDirectory( */ public function executeSimulation(): void { - if($this->operationMode !== OperationMode::NORMAL) { + if ($this->operationMode !== OperationMode::NORMAL) { throw new RuntimeException('Zip simulation is not finished.'); } - foreach($this->recordedSimulation as $file) { + foreach ($this->recordedSimulation as $file) { $this->centralDirectoryRecords[] = $file->cloneSimulationExecution()->process(); } @@ -815,15 +816,15 @@ private function send(string $data): void } } - /** - * Send HTTP headers for this stream. - */ + /** + * Send HTTP headers for this stream. + */ private function sendHttpHeaders(): void { // grab content disposition $disposition = $this->contentDisposition; - if ($this->outputName) { + if ($this->outputName !== null) { // Various different browsers dislike various characters here. Strip them all for safety. $safeOutput = trim(str_replace(['"', "'", '\\', ';', "\n", "\r"], '', $this->outputName)); @@ -854,7 +855,7 @@ private function clear(): void $this->centralDirectoryRecords = []; $this->offset = 0; - if($this->operationMode === OperationMode::NORMAL) { + if ($this->operationMode === OperationMode::NORMAL) { $this->ready = false; $this->recordedSimulation = []; } else { diff --git a/vendor/nette/schema/composer.json b/vendor/nette/schema/composer.json index 626e98f92..56b845278 100644 --- a/vendor/nette/schema/composer.json +++ b/vendor/nette/schema/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php": "8.1 - 8.3", + "php": "8.1 - 8.4", "nette/utils": "^4.0" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "tracy/tracy": "^2.8", "phpstan/phpstan-nette": "^1.0" }, diff --git a/vendor/nette/schema/src/Schema/Elements/Structure.php b/vendor/nette/schema/src/Schema/Elements/Structure.php index 56f5ffe89..66e501a4d 100644 --- a/vendor/nette/schema/src/Schema/Elements/Structure.php +++ b/vendor/nette/schema/src/Schema/Elements/Structure.php @@ -31,12 +31,12 @@ final class Structure implements Schema /** - * @param Schema[] $items + * @param Schema[] $shape */ - public function __construct(array $items) + public function __construct(array $shape) { - (function (Schema ...$items) {})(...array_values($items)); - $this->items = $items; + (function (Schema ...$items) {})(...array_values($shape)); + $this->items = $shape; $this->castTo('object'); $this->required = true; } @@ -76,6 +76,19 @@ public function skipDefaults(bool $state = true): self } + public function extend(array|self $shape): self + { + $shape = $shape instanceof self ? $shape->items : $shape; + return new self(array_merge($this->items, $shape)); + } + + + public function getShape(): array + { + return $this->items; + } + + /********************* processing ****************d*g**/ @@ -117,25 +130,22 @@ public function merge(mixed $value, mixed $base): mixed } if (is_array($value) && is_array($base)) { - $index = 0; + $index = $this->otherItems === null ? null : 0; foreach ($value as $key => $val) { if ($key === $index) { $base[] = $val; $index++; - } elseif (array_key_exists($key, $base)) { - $itemSchema = $this->items[$key] ?? $this->otherItems; - $base[$key] = $itemSchema - ? $itemSchema->merge($val, $base[$key]) - : Helpers::merge($val, $base[$key]); } else { - $base[$key] = $val; + $base[$key] = array_key_exists($key, $base) && ($itemSchema = $this->items[$key] ?? $this->otherItems) + ? $itemSchema->merge($val, $base[$key]) + : $val; } } return $base; } - return Helpers::merge($value, $base); + return $value ?? $base; } diff --git a/vendor/nette/schema/src/Schema/Elements/Type.php b/vendor/nette/schema/src/Schema/Elements/Type.php index 4094442ec..69d529952 100644 --- a/vendor/nette/schema/src/Schema/Elements/Type.php +++ b/vendor/nette/schema/src/Schema/Elements/Type.php @@ -75,7 +75,7 @@ public function max(?float $max): self /** * @internal use arrayOf() or listOf() */ - public function items(string|Schema $valueType = 'mixed', string|Schema $keyType = null): self + public function items(string|Schema $valueType = 'mixed', string|Schema|null $keyType = null): self { $this->itemsValue = $valueType instanceof Schema ? $valueType diff --git a/vendor/nette/schema/src/Schema/Expect.php b/vendor/nette/schema/src/Schema/Expect.php index 38f1c81f6..eab3c84c8 100644 --- a/vendor/nette/schema/src/Schema/Expect.php +++ b/vendor/nette/schema/src/Schema/Expect.php @@ -24,7 +24,6 @@ * @method static Type float($default = null) * @method static Type bool($default = null) * @method static Type null() - * @method static Type array($default = []) * @method static Type list($default = []) * @method static Type mixed($default = null) * @method static Type email($default = null) @@ -56,11 +55,11 @@ public static function anyOf(mixed ...$set): AnyOf /** - * @param Schema[] $items + * @param Schema[] $shape */ - public static function structure(array $items): Structure + public static function structure(array $shape): Structure { - return new Structure($items); + return new Structure($shape); } @@ -95,7 +94,18 @@ public static function from(object $object, array $items = []): Structure } - public static function arrayOf(string|Schema $valueType, string|Schema $keyType = null): Type + /** + * @param mixed[] $shape + */ + public static function array(?array $shape = []): Structure|Type + { + return Nette\Utils\Arrays::first($shape ?? []) instanceof Schema + ? (new Structure($shape))->castTo('array') + : (new Type('array'))->default($shape); + } + + + public static function arrayOf(string|Schema $valueType, string|Schema|null $keyType = null): Type { return (new Type('array'))->items($valueType, $keyType); } diff --git a/vendor/nunomaduro/termwind/Makefile b/vendor/nunomaduro/termwind/Makefile deleted file mode 100644 index a71576bf6..000000000 --- a/vendor/nunomaduro/termwind/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Well documented Makefiles -DEFAULT_GOAL := help -help: - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-40s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ [Docker] -start: ## Spin up the container - docker-compose up -d - -stop: ## Shut down the containers - docker-compose down - -build: ## Build all docker images - docker-compose build - -##@ [Application] -composer: ## Run composer commands. Specify the command e.g. via "make composer ARGS="install|update|require " - docker-compose run --rm app composer $(ARGS) - -lint: ## Run the Linter - docker-compose run --rm app ./vendor/bin/pint -v - -test-lint: ## Run the Linter Test - docker-compose run --rm app ./vendor/bin/pint --test -v - -test-types: ## Run the PHPStan analysis - docker-compose run --rm app ./vendor/bin/phpstan analyse --ansi - -test-unit: ## Run the Pest Test Suite - docker-compose run --rm app ./vendor/bin/pest --colors=always - -test: ## Run the tests. Apply arguments via make test ARGS="--init" - make test-lint && make test-types && make test-unit diff --git a/vendor/nunomaduro/termwind/composer.json b/vendor/nunomaduro/termwind/composer.json index 6c4f59b69..b20d5d70a 100644 --- a/vendor/nunomaduro/termwind/composer.json +++ b/vendor/nunomaduro/termwind/composer.json @@ -10,20 +10,19 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "ext-mbstring": "*", - "symfony/console": "^5.3.0|^6.0.0" + "symfony/console": "^6.4.12" }, "require-dev": { - "ergebnis/phpstan-rules": "^1.0.", - "illuminate/console": "^8.0|^9.0", - "illuminate/support": "^8.0|^9.0", - "laravel/pint": "^1.0.0", - "pestphp/pest": "^1.21.0", - "pestphp/pest-plugin-mock": "^1.0", - "phpstan/phpstan": "^1.4.6", - "phpstan/phpstan-strict-rules": "^1.1.0", - "symfony/var-dumper": "^5.2.7|^6.0.0", + "illuminate/console": "^10.48.22", + "illuminate/support": "^10.48.22", + "laravel/pint": "^1.18.1", + "pestphp/pest": "^2", + "pestphp/pest-plugin-mock": "2.0.0", + "phpstan/phpstan": "^1.12.6", + "phpstan/phpstan-strict-rules": "^1.6.1", + "symfony/var-dumper": "^6.4.11", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "autoload": { diff --git a/vendor/nunomaduro/termwind/docker/Dockerfile b/vendor/nunomaduro/termwind/docker/Dockerfile deleted file mode 100644 index 53732e733..000000000 --- a/vendor/nunomaduro/termwind/docker/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM php:8.2-cli-alpine - -# INSTALL AND UPDATE COMPOSER -COPY --from=composer /usr/bin/composer /usr/bin/composer -RUN composer self-update - -WORKDIR /usr/src/app -COPY . . - -# INSTALL YOUR DEPENDENCIES -RUN composer install --prefer-dist diff --git a/vendor/nunomaduro/termwind/pint.json b/vendor/nunomaduro/termwind/pint.json new file mode 100644 index 000000000..2b25b3d21 --- /dev/null +++ b/vendor/nunomaduro/termwind/pint.json @@ -0,0 +1,7 @@ +{ + "rules": { + "yoda_style": false, + "nullable_type_declaration": false, + "nullable_type_declaration_for_default_null_value": false + } +} \ No newline at end of file diff --git a/vendor/nunomaduro/termwind/playground.php b/vendor/nunomaduro/termwind/playground.php index 9e6b81007..3f94c391e 100644 --- a/vendor/nunomaduro/termwind/playground.php +++ b/vendor/nunomaduro/termwind/playground.php @@ -5,10 +5,18 @@ use function Termwind\render; render(<<<'HTML' -
    -
    - Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sunt illo et nisi omnis porro at, mollitia harum quas esse, aperiam dolorem ab recusandae fugiat nesciunt doloribus rem eaque nostrum itaque. - DONE -
    +
    +
    +  ─                   ─        ─    ─
    +│ │                 │ │      │ │  │ │
    +│ │     ──,         │ │  ──, │ │  │ │  ─
    +│/ \   /  │  │   │  │/  /  │ │/ \─│/  │/
    +│   │─/\─/│─/ \─/│─/│──/\─/│─/\─/ │──/│──/
    +        
    +
    by ⚙️ Configured
    +
    {{ $version }}
    + + Create portable PHP CLI applications w/ PHP Micro +
    HTML); diff --git a/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php b/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php index 6debb8fdc..b17bfbf6e 100644 --- a/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php +++ b/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php @@ -59,8 +59,6 @@ public static function multiple(Styles $styles, string $stylesString): Styles /** * Converts the given style to a method name. - * - * @return Styles */ public function __invoke(string|int ...$arguments): Styles { @@ -98,6 +96,7 @@ public function __invoke(string|int ...$arguments): Styles return $this->__invoke(...$arguments); } + // @phpstan-ignore-next-line return $this->styles ->setStyle($this->style) ->$methodName(...array_reverse($arguments)); diff --git a/vendor/nunomaduro/termwind/src/Components/Anchor.php b/vendor/nunomaduro/termwind/src/Components/Anchor.php index aa29fa207..2a61731a3 100644 --- a/vendor/nunomaduro/termwind/src/Components/Anchor.php +++ b/vendor/nunomaduro/termwind/src/Components/Anchor.php @@ -4,6 +4,4 @@ namespace Termwind\Components; -final class Anchor extends Element -{ -} +final class Anchor extends Element {} diff --git a/vendor/nunomaduro/termwind/src/Components/Element.php b/vendor/nunomaduro/termwind/src/Components/Element.php index 9ec8fbfc1..9becdb8d3 100644 --- a/vendor/nunomaduro/termwind/src/Components/Element.php +++ b/vendor/nunomaduro/termwind/src/Components/Element.php @@ -70,7 +70,7 @@ final public static function fromStyles(OutputInterface $output, array|string $c public function toString(): string { if (is_array($this->content)) { - $inheritance = new InheritStyles(); + $inheritance = new InheritStyles; $this->content = implode('', $inheritance($this->content, $this->styles)); } @@ -83,6 +83,7 @@ public function toString(): string public function __call(string $name, array $arguments): mixed { if (method_exists($this->styles, $name)) { + // @phpstan-ignore-next-line $result = $this->styles->{$name}(...$arguments); if (str_starts_with($name, 'get') || str_starts_with($name, 'has')) { diff --git a/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php b/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php index 0f753dd03..73b4f444a 100644 --- a/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php +++ b/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php @@ -9,6 +9,4 @@ /** * @internal */ -final class ColorNotFound extends InvalidArgumentException -{ -} +final class ColorNotFound extends InvalidArgumentException {} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php index cb32e996b..c75fc87d7 100644 --- a/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php @@ -9,6 +9,4 @@ /** * @internal */ -final class InvalidChild extends InvalidArgumentException -{ -} +final class InvalidChild extends InvalidArgumentException {} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php index d45afa1f7..c09e332b9 100644 --- a/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php @@ -9,6 +9,4 @@ /** * @internal */ -final class InvalidColor extends InvalidArgumentException -{ -} +final class InvalidColor extends InvalidArgumentException {} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php index 6bcc6dd7c..5000f857a 100644 --- a/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php @@ -9,6 +9,4 @@ /** * @internal */ -final class InvalidStyle extends InvalidArgumentException -{ -} +final class InvalidStyle extends InvalidArgumentException {} diff --git a/vendor/nunomaduro/termwind/src/Functions.php b/vendor/nunomaduro/termwind/src/Functions.php index 7ce103933..9b073b2c1 100644 --- a/vendor/nunomaduro/termwind/src/Functions.php +++ b/vendor/nunomaduro/termwind/src/Functions.php @@ -14,7 +14,7 @@ /** * Sets the renderer implementation. */ - function renderUsing(OutputInterface|null $renderer): void + function renderUsing(?OutputInterface $renderer): void { Termwind::renderUsing($renderer); } @@ -24,9 +24,9 @@ function renderUsing(OutputInterface|null $renderer): void /** * Creates a new style. * - * @param (Closure(Styles $renderable, string|int ...$arguments): Styles)|null $callback + * @param (Closure(Styles $renderable, string|int ...$arguments): Styles)|null $callback */ - function style(string $name, Closure $callback = null): Style + function style(string $name, ?Closure $callback = null): Style { return StyleRepository::create($name, $callback); } @@ -58,7 +58,7 @@ function terminal(): Terminal * * @param iterable|null $autocomplete */ - function ask(string $question, iterable $autocomplete = null): mixed + function ask(string $question, ?iterable $autocomplete = null): mixed { return (new Question)->ask($question, $autocomplete); } diff --git a/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php b/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php index 6950cfdb1..f75898bc3 100644 --- a/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php +++ b/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php @@ -173,7 +173,6 @@ private function tokenize(string $source): array * Splits tokens into lines. * * @param array $tokens - * @param int $startLine * @return array> */ private function splitToLines(array $tokens, int $startLine): array @@ -228,8 +227,6 @@ private function colorLines(array $tokenLines): array * Prepends line numbers into lines. * * @param array $lines - * @param int $markLine - * @return string */ private function lineNumbers(array $lines, int $markLine): string { diff --git a/vendor/nunomaduro/termwind/src/Html/TableRenderer.php b/vendor/nunomaduro/termwind/src/Html/TableRenderer.php index 60b73d4e0..81859a4b5 100644 --- a/vendor/nunomaduro/termwind/src/Html/TableRenderer.php +++ b/vendor/nunomaduro/termwind/src/Html/TableRenderer.php @@ -122,7 +122,7 @@ private function parseFoot(Node $node): void if ($child->isName('tr')) { $rows = iterator_to_array($this->parseRow($child)); if (count($rows) > 0) { - $this->table->addRow(new TableSeparator()); + $this->table->addRow(new TableSeparator); $this->table->addRows($rows); } } @@ -203,7 +203,7 @@ private function parseRow(Node $node): Iterator $border = (int) $node->getAttribute('border'); for ($i = $border; $i--; $i > 0) { - yield new TableSeparator(); + yield new TableSeparator; } } diff --git a/vendor/nunomaduro/termwind/src/HtmlRenderer.php b/vendor/nunomaduro/termwind/src/HtmlRenderer.php index 568c946a9..4f4d6b83c 100644 --- a/vendor/nunomaduro/termwind/src/HtmlRenderer.php +++ b/vendor/nunomaduro/termwind/src/HtmlRenderer.php @@ -29,7 +29,7 @@ public function render(string $html, int $options): void */ public function parse(string $html): Components\Element { - $dom = new DOMDocument(); + $dom = new DOMDocument; if (strip_tags($html) === $html) { return Termwind::span($html); diff --git a/vendor/nunomaduro/termwind/src/Question.php b/vendor/nunomaduro/termwind/src/Question.php index 289f86678..f20682bd0 100644 --- a/vendor/nunomaduro/termwind/src/Question.php +++ b/vendor/nunomaduro/termwind/src/Question.php @@ -27,9 +27,9 @@ final class Question */ private SymfonyQuestionHelper $helper; - public function __construct(SymfonyQuestionHelper $helper = null) + public function __construct(?SymfonyQuestionHelper $helper = null) { - $this->helper = $helper ?? new QuestionHelper(); + $this->helper = $helper ?? new QuestionHelper; } /** @@ -37,7 +37,7 @@ public function __construct(SymfonyQuestionHelper $helper = null) */ public static function setStreamableInput(StreamableInputInterface|null $streamableInput): void { - self::$streamableInput = $streamableInput ?? new ArgvInput(); + self::$streamableInput = $streamableInput ?? new ArgvInput; } /** @@ -45,7 +45,7 @@ public static function setStreamableInput(StreamableInputInterface|null $streama */ public static function getStreamableInput(): StreamableInputInterface { - return self::$streamableInput ??= new ArgvInput(); + return self::$streamableInput ??= new ArgvInput; } /** @@ -53,7 +53,7 @@ public static function getStreamableInput(): StreamableInputInterface * * @param iterable|null $autocomplete */ - public function ask(string $question, iterable $autocomplete = null): mixed + public function ask(string $question, ?iterable $autocomplete = null): mixed { $html = (new HtmlRenderer)->parse($question)->toString(); @@ -73,7 +73,7 @@ public function ask(string $question, iterable $autocomplete = null): mixed $currentHelper = $property->isInitialized($output) ? $property->getValue($output) - : new SymfonyQuestionHelper(); + : new SymfonyQuestionHelper; $property->setValue($output, new QuestionHelper); diff --git a/vendor/nunomaduro/termwind/src/Repositories/Styles.php b/vendor/nunomaduro/termwind/src/Repositories/Styles.php index 6dbada5e5..8c1d6f67d 100644 --- a/vendor/nunomaduro/termwind/src/Repositories/Styles.php +++ b/vendor/nunomaduro/termwind/src/Repositories/Styles.php @@ -21,10 +21,9 @@ final class Styles /** * Creates a new style from the given arguments. * - * @param (Closure(StylesValueObject $element, string|int ...$arguments): StylesValueObject)|null $callback - * @return Style + * @param (Closure(StylesValueObject $element, string|int ...$arguments): StylesValueObject)|null $callback */ - public static function create(string $name, Closure $callback = null): Style + public static function create(string $name, ?Closure $callback = null): Style { self::$storage[$name] = $style = new Style( $callback ?? static fn (StylesValueObject $styles) => $styles diff --git a/vendor/nunomaduro/termwind/src/Terminal.php b/vendor/nunomaduro/termwind/src/Terminal.php index 6b74885b4..d49b941a4 100644 --- a/vendor/nunomaduro/termwind/src/Terminal.php +++ b/vendor/nunomaduro/termwind/src/Terminal.php @@ -19,9 +19,9 @@ final class Terminal /** * Creates a new terminal instance. */ - public function __construct(ConsoleTerminal $terminal = null) + public function __construct(?ConsoleTerminal $terminal = null) { - $this->terminal = $terminal ?? new ConsoleTerminal(); + $this->terminal = $terminal ?? new ConsoleTerminal; } /** diff --git a/vendor/nunomaduro/termwind/src/Termwind.php b/vendor/nunomaduro/termwind/src/Termwind.php index 0ce1b5154..6dcaaed79 100644 --- a/vendor/nunomaduro/termwind/src/Termwind.php +++ b/vendor/nunomaduro/termwind/src/Termwind.php @@ -25,7 +25,7 @@ final class Termwind */ public static function renderUsing(OutputInterface|null $renderer): void { - self::$renderer = $renderer ?? new ConsoleOutput(); + self::$renderer = $renderer ?? new ConsoleOutput; } /** @@ -278,7 +278,7 @@ public static function breakLine(string $styles = '', array $properties = []): C */ public static function getRenderer(): OutputInterface { - return self::$renderer ??= new ConsoleOutput(); + return self::$renderer ??= new ConsoleOutput; } /** diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Node.php b/vendor/nunomaduro/termwind/src/ValueObjects/Node.php index 4f82a5d21..d42ca7956 100644 --- a/vendor/nunomaduro/termwind/src/ValueObjects/Node.php +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Node.php @@ -14,9 +14,7 @@ final class Node /** * A value object with helper methods for working with DOM node. */ - public function __construct(private \DOMNode $node) - { - } + public function __construct(private \DOMNode $node) {} /** * Gets the value of the node. @@ -34,7 +32,7 @@ public function getValue(): string public function getChildNodes(): Generator { foreach ($this->node->childNodes as $node) { - yield new static($node); + yield new self($node); } } @@ -106,7 +104,7 @@ public function getPreviousSibling(): static|null $node = $this->node; while ($node = $node->previousSibling) { - $node = new static($node); + $node = new self($node); if ($node->isEmpty()) { $node = $node->node; @@ -121,7 +119,7 @@ public function getPreviousSibling(): static|null $node = $node->node; } - return is_null($node) ? null : new static($node); + return is_null($node) ? null : new self($node); } /** @@ -132,7 +130,7 @@ public function getNextSibling(): static|null $node = $this->node; while ($node = $node->nextSibling) { - $node = new static($node); + $node = new self($node); if ($node->isEmpty()) { $node = $node->node; @@ -147,7 +145,7 @@ public function getNextSibling(): static|null $node = $node->node; } - return is_null($node) ? null : new static($node); + return is_null($node) ? null : new self($node); } /** diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Style.php b/vendor/nunomaduro/termwind/src/ValueObjects/Style.php index bc96e58a1..f1242e8a4 100644 --- a/vendor/nunomaduro/termwind/src/ValueObjects/Style.php +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Style.php @@ -16,7 +16,7 @@ final class Style /** * Creates a new value object instance. * - * @param Closure(Styles $styles, string|int ...$argument): Styles $callback + * @param Closure(Styles $styles, string|int ...$argument): Styles $callback */ public function __construct(private Closure $callback, private string $color = '') { diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php b/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php index 04140cff2..b29ee0569 100644 --- a/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php @@ -15,6 +15,7 @@ use Termwind\Exceptions\ColorNotFound; use Termwind\Exceptions\InvalidStyle; use Termwind\Repositories\Styles as StyleRepository; + use function Termwind\terminal; /** @@ -49,11 +50,9 @@ final public function __construct( private array $textModifiers = [], private array $styleModifiers = [], private array $defaultStyles = [] - ) { - } + ) {} /** - * @param Element $element * @return $this */ public function setElement(Element $element): self @@ -854,7 +853,7 @@ private function applyWidth(string $content): string preg_match_all("/\n+/", $content, $matches); - $width *= count($matches[0] ?? []) + 1; + $width *= count($matches[0] ?? []) + 1; // @phpstan-ignore-line $width += mb_strlen($matches[0][0] ?? '', 'UTF-8'); if ($length <= $width) { @@ -940,7 +939,7 @@ private function applyStyling(string $content): string /** * Get the length of the text provided without the styling tags. */ - public function getLength(string $text = null): int + public function getLength(?string $text = null): int { return mb_strlen(preg_replace( self::STYLING_REGEX, @@ -998,7 +997,6 @@ private static function calcWidthFromFraction(string $fraction, array $styles, a throw new InvalidStyle(sprintf('Style [%s] is invalid.', "w-$fraction")); } - /** @@phpstan-ignore-next-line */ $width = (int) floor($width * $matches[1] / $matches[2]); $width -= ($styles['ml'] ?? 0) + ($styles['mr'] ?? 0); @@ -1030,7 +1028,7 @@ public static function getParentWidth(array $styles): int $width = count($matches) !== 3 ? (int) $parentWidth - : (int) floor($width * $matches[1] / $matches[2]); //@phpstan-ignore-line + : (int) floor($width * $matches[1] / $matches[2]); if ($maxWidth > 0) { $width = min($maxWidth, $width); @@ -1052,6 +1050,7 @@ private static function trimText(string $text, int $width): string preg_match_all(self::STYLING_REGEX, $text, $matches, PREG_OFFSET_CAPTURE); $text = rtrim(mb_strimwidth(preg_replace(self::STYLING_REGEX, '', $text) ?? '', 0, $width, '', 'UTF-8')); + // @phpstan-ignore-next-line foreach ($matches[0] ?? [] as [$part, $index]) { $text = substr($text, 0, $index).$part.substr($text, $index, null); } diff --git a/vendor/tecnickcom/tcpdf/VERSION b/vendor/tecnickcom/tcpdf/VERSION index c56facf89..2ed16f40d 100644 --- a/vendor/tecnickcom/tcpdf/VERSION +++ b/vendor/tecnickcom/tcpdf/VERSION @@ -1 +1 @@ -6.7.5 +6.7.6 diff --git a/vendor/tecnickcom/tcpdf/composer.json b/vendor/tecnickcom/tcpdf/composer.json index 7389d0900..66724a17a 100644 --- a/vendor/tecnickcom/tcpdf/composer.json +++ b/vendor/tecnickcom/tcpdf/composer.json @@ -12,7 +12,7 @@ "barcodes" ], "homepage": "http://www.tcpdf.org/", - "version": "6.7.5", + "version": "6.7.6", "license": "LGPL-3.0-or-later", "authors": [ { diff --git a/vendor/tecnickcom/tcpdf/tcpdf.php b/vendor/tecnickcom/tcpdf/tcpdf.php index 60f93c416..429f4a991 100644 --- a/vendor/tecnickcom/tcpdf/tcpdf.php +++ b/vendor/tecnickcom/tcpdf/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.7.5 + * @version 6.7.6 * @author Nicola Asuni - info@tecnick.com * @IgnoreAnnotation("protected") * @IgnoreAnnotation("public") @@ -19010,29 +19010,29 @@ protected function openHTMLTagHandler($dom, $key, $cell) { $this->setLineWidth($hrHeight); $lineStyle = array(); - if (isset($tag['fgcolor'])) { - $lineStyle['color'] = $tag['fgcolor']; - } + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } - if (isset($tag['fgcolor'])) { - $lineStyle['color'] = $tag['fgcolor']; - } + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } - if (isset($tag['style']['cap'])) { - $lineStyle['cap'] = $tag['style']['cap']; - } + if (isset($tag['style']['cap'])) { + $lineStyle['cap'] = $tag['style']['cap']; + } - if (isset($tag['style']['join'])) { - $lineStyle['join'] = $tag['style']['join']; - } + if (isset($tag['style']['join'])) { + $lineStyle['join'] = $tag['style']['join']; + } - if (isset($tag['style']['dash'])) { - $lineStyle['dash'] = $tag['style']['dash']; - } + if (isset($tag['style']['dash'])) { + $lineStyle['dash'] = $tag['style']['dash']; + } - if (isset($tag['style']['phase'])) { - $lineStyle['phase'] = $tag['style']['phase']; - } + if (isset($tag['style']['phase'])) { + $lineStyle['phase'] = $tag['style']['phase']; + } $lineStyle = array_filter($lineStyle); @@ -19059,11 +19059,14 @@ protected function openHTMLTagHandler($dom, $key, $cell) { } else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) { $imgsrc = '@'.base64_decode($reg[2]); $type = $reg[1]; + } elseif (strpos($imgsrc, '../') !== false) { + // accessing parent folders is not allowed + break; } elseif ( $this->allowLocalFiles && substr($imgsrc, 0, 7) === 'file://') { - // get image type from a local file path - $imgsrc = substr($imgsrc, 7); - $type = TCPDF_IMAGES::getImageFileType($imgsrc); - } else { + // get image type from a local file path + $imgsrc = substr($imgsrc, 7); + $type = TCPDF_IMAGES::getImageFileType($imgsrc); + } else { if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); diff --git a/vendor/themes/esensi/partials/informasi_publik/index.php b/vendor/themes/esensi/partials/informasi_publik/index.php index c58534614..954873bc0 100644 --- a/vendor/themes/esensi/partials/informasi_publik/index.php +++ b/vendor/themes/esensi/partials/informasi_publik/index.php @@ -47,7 +47,7 @@ 'processing': true, 'serverSide': true, "pageLength": 10, - 'order': [], + "order": [4, 'desc'], "ajax": { "url": url, "type": "POST" diff --git a/vendor/themes/natra/partials/informasi_publik/index.php b/vendor/themes/natra/partials/informasi_publik/index.php index 87f22c634..4a08e4738 100644 --- a/vendor/themes/natra/partials/informasi_publik/index.php +++ b/vendor/themes/natra/partials/informasi_publik/index.php @@ -46,7 +46,7 @@ 'processing': true, 'serverSide': true, "pageLength": 10, - 'order': [], + 'order': [4, 'desc'], "ajax": { "url": url, "type": "POST" diff --git a/vendor/themes/natra/partials/menu_head.php b/vendor/themes/natra/partials/menu_head.php index 017922fe9..deb4041bd 100644 --- a/vendor/themes/natra/partials/menu_head.php +++ b/vendor/themes/natra/partials/menu_head.php @@ -1,40 +1,43 @@ + + +
    - - - \ No newline at end of file + \ No newline at end of file