From b262ce2fd5458353809f4cb9ed2bdace9ff6fe3a Mon Sep 17 00:00:00 2001 From: Abah Roland Date: Wed, 23 Oct 2024 20:35:03 +0700 Subject: [PATCH] Rilis v2410.1.0 --- .php-cs-fixer.php | 4 +- Modules/Analisis/Enums/TahapPedataanEnum.php | 39 +- Modules/Analisis/Enums/TipePertanyaanEnum.php | 14 +- .../Http/Controllers/Analisis_indikator.php | 38 +- .../Http/Controllers/Analisis_kategori.php | 10 +- .../Http/Controllers/Analisis_klasifikasi.php | 7 +- .../Http/Controllers/Analisis_laporan.php | 63 +- .../Http/Controllers/Analisis_master.php | 87 +- .../Http/Controllers/Analisis_periode.php | 33 +- .../Http/Controllers/Analisis_respon.php | 53 +- .../Analisis_statistik_jawaban.php | 2 +- Modules/Analisis/Libraries/Analisis.php | 32 +- Modules/Analisis/Libraries/Bdt.php | 23 +- Modules/Analisis/Libraries/Gform.php | 54 +- Modules/Analisis/Libraries/Import.php | 30 +- Modules/Analisis/Models/AnalisisIndikator.php | 6 +- Modules/Analisis/Models/AnalisisKategori.php | 3 +- Modules/Analisis/Models/AnalisisParameter.php | 4 +- Modules/Analisis/Models/AnalisisPeriode.php | 5 +- Modules/Analisis/Models/AnalisisRespon.php | 52 +- .../Analisis/Models/AnalisisResponBukti.php | 1 + Modules/Analisis/Routes/web.php | 116 ++- .../Analisis/Views/analisis/form.blade.php | 284 ++++--- .../Analisis/Views/analisis/import.blade.php | 12 +- .../Views/analisis/import_gform.blade.php | 39 +- .../Analisis/Views/analisis/index.blade.php | 320 +++---- .../Analisis/Views/analisis/menu.blade.php | 114 +-- .../Views/analisis/menu_default.blade.php | 46 +- .../Views/analisis_indikator/form.blade.php | 524 ++++++------ .../Views/analisis_indikator/index.blade.php | 342 ++++---- .../Views/analisis_kategori/form.blade.php | 29 +- .../Views/analisis_kategori/index.blade.php | 212 +++-- .../Views/analisis_klasifikasi/form.blade.php | 10 +- .../analisis_klasifikasi/index.blade.php | 224 +++-- .../analisis_laporan/ajax_multi.blade.php | 108 +-- .../Views/analisis_laporan/form.blade.php | 219 +++-- .../analisis_laporan/form_cetak.blade.php | 57 +- .../Views/analisis_laporan/index.blade.php | 338 ++++---- .../analisis_laporan/table_print.blade.php | 49 +- .../analisis_laporan/ttd_pamong.blade.php | 2 +- .../Views/analisis_parameter/form.blade.php | 49 +- .../Views/analisis_parameter/index.blade.php | 265 +++--- .../Views/analisis_periode/form.blade.php | 23 +- .../Views/analisis_periode/index.blade.php | 262 +++--- .../analisis_respon/child/form.blade.php | 273 +++--- .../Views/analisis_respon/form.blade.php | 484 +++++------ .../import/aturan_unduh.blade.php | 108 +-- .../import/data_ajax.blade.php | 37 +- .../import/data_unduh.blade.php | 263 +++--- .../import/impor_bdt.blade.php | 12 +- .../analisis_respon/import/import.blade.php | 10 +- .../Views/analisis_respon/index.blade.php | 385 ++++----- .../index.blade.php | 428 +++++----- .../parameter/grafik_table.blade.php | 283 ++++--- .../parameter/subjek_print.blade.php | 116 +-- .../parameter/subjek_table.blade.php | 226 +++-- .../table_print.blade.php | 149 ++-- .../Http/Controllers/Admin/Anjungan_menu.php | 2 +- .../Anjungan/Http/Controllers/Anjungan.php | 2 +- Modules/Anjungan/Models/Anjungan.php | 2 +- Modules/Anjungan/Models/AnjunganMenu.php | 2 +- Modules/Anjungan/Routes/web.php | 38 +- .../Statistik/StatistikJenisBantuanEnum.php | 601 +++++++++++++ app/Enums/Statistik/StatistikKeluargaEnum.php | 2 +- app/Enums/Statistik/StatistikPendudukEnum.php | 2 +- app/Enums/Statistik/StatistikRtmEnum.php | 529 ++++++++++++ app/Enums/TipeLinkEnum.php | 417 +++++++++ app/Libraries/Statistik.php | 425 ++++++++++ app/Libraries/TinyMCE/KodeIsianPenduduk.php | 2 +- app/Models/BantuanPeserta.php | 2 +- app/Models/FormatSurat.php | 2 +- app/Models/Keluarga.php | 2 +- app/Models/KeluargaAktif.php | 2 +- app/Models/Menu.php | 2 +- app/Models/Produk.php | 2 +- app/Models/SuratDinas.php | 2 +- app/Scopes/ConfigIdNullScope.php | 2 +- app/Services/LaporanPenduduk.php | 465 ++++++++++ assets/js/admin.js | 49 +- bootstrap/app.php | 40 +- catatan_rilis.md | 25 +- composer.lock | 58 +- config/app.php | 2 +- config/auth.php | 6 +- config/broadcasting.php | 55 +- config/cache.php | 1 + config/database.php | 15 +- config/datatables.php | 1 + config/hashing.php | 1 + config/logging.php | 1 + config/mail.php | 63 +- config/queue.php | 1 + config/session.php | 35 + config/view.php | 1 + config/zipstream.php | 41 +- donjo-app/Routes/Web/admin.php | 75 +- donjo-app/Routes/web.php | 5 + donjo-app/config/sid_ini.php | 11 + donjo-app/controllers/First.php | 2 +- donjo-app/controllers/Identitas_desa.php | 2 +- donjo-app/controllers/Info_sistem.php | 2 +- donjo-app/controllers/Keluarga.php | 2 +- donjo-app/controllers/Menu.php | 2 +- donjo-app/controllers/Penduduk.php | 2 +- donjo-app/controllers/Rentang_umur.php | 2 +- donjo-app/controllers/Statistik.php | 2 +- donjo-app/controllers/Statistik_bantuan.php | 553 ++++++++++++ donjo-app/controllers/Statistik_web.php | 2 +- donjo-app/controllers/Stunting.php | 2 +- donjo-app/controllers/Surat_dinas.php | 2 +- donjo-app/controllers/Surat_master.php | 2 +- donjo-app/controllers/Wilayah.php | 2 +- donjo-app/controllers/fweb/Embed.php | 497 +++++++++++ donjo-app/controllers/fweb/Kesehatan.php | 2 +- donjo-app/controllers/fweb/Lapak.php | 2 +- donjo-app/controllers/fweb/Statistik.php | 2 +- donjo-app/helpers/opensid_helper.php | 2 +- donjo-app/models/Laporan_penduduk_model.php | 2 +- donjo-app/models/Periksa_model.php | 2 +- .../models/migrations/Migrasi_2024102351.php | 54 ++ package-lock.json | 32 +- package.json | 2 +- .../dokumen/informasi_publik/form.blade.php | 41 +- .../views/admin/gis/content_desa.blade.php | 16 +- .../views/admin/gis/content_dusun.blade.php | 16 +- .../views/admin/gis/content_rt.blade.php | 16 +- .../views/admin/gis/content_rw.blade.php | 16 +- .../views/admin/identitas_desa/form.blade.php | 23 +- resources/views/admin/kelompok/form.blade.php | 10 +- .../views/admin/lapak/produk/form.blade.php | 10 +- .../layouts/components/format_cetak.blade.php | 54 +- .../views/admin/pengaturan/index.blade.php | 58 +- .../admin/pengaturan/pengguna/form.blade.php | 10 +- .../admin/pengaturan_surat/index.blade.php | 13 + .../admin/setting/info_sistem/index.blade.php | 5 + .../setting/info_sistem/log_login.blade.php | 65 ++ .../admin/statistik/bantuan/peserta.blade.php | 72 ++ .../admin/statistik/bantuan/program.blade.php | 302 +++++++ .../admin/statistik/bantuan/sasaran.blade.php | 405 +++++++++ .../views/admin/statistik/cetak.blade.php | 110 +++ .../views/admin/statistik/dialog.blade.php | 38 + .../views/admin/statistik/index.blade.php | 397 +++++++++ .../statistik/rentang_umur/index.blade.php | 8 +- .../views/admin/statistik/side.blade.php | 78 +- .../views/admin/stunting/cetak.blade.php | 10 +- .../surat_dinas/pengaturan/index.blade.php | 13 + .../views/admin/web/menu/ajax_form.blade.php | 12 +- resources/views/periksa/index.blade.php | 1 + .../keluarga_tanpa_nik_kepala.blade.php | 35 + resources/views/web/kesehatan/cetak.blade.php | 463 ++++++++++ resources/views/web/statistik/cetak.blade.php | 101 +++ storage/app/template/lampiran/f-1.06/view.php | 12 +- storage/app/template/lampiran/f-1.25/view.php | 2 +- storage/app/template/lampiran/n-6/view.php | 6 +- vendor/composer/installed.json | 42 +- vendor/composer/installed.php | 22 +- .../Drive/Resource/FilesAccessproposals.php | 1 + .../src/AuthHandler/Guzzle6AuthHandler.php | 10 +- vendor/google/apiclient/src/Client.php | 3 +- vendor/guzzlehttp/promises/src/Utils.php | 4 +- vendor/themes/esensi/layouts/embed.tpl.php | 75 ++ .../esensi/partials/kesehatan/scorecard.php | 795 +++++++++--------- .../esensi/partials/statistics/default.php | 10 + vendor/themes/natra/layouts/embed.tpl.php | 75 ++ .../natra/partials/kesehatan/scorecard.php | 30 +- vendor/themes/natra/partials/statistik.php | 10 + 166 files changed, 10403 insertions(+), 4237 deletions(-) create mode 100644 app/Enums/Statistik/StatistikJenisBantuanEnum.php create mode 100644 app/Enums/Statistik/StatistikRtmEnum.php create mode 100644 app/Enums/TipeLinkEnum.php create mode 100644 app/Libraries/Statistik.php create mode 100644 app/Services/LaporanPenduduk.php create mode 100644 donjo-app/controllers/Statistik_bantuan.php create mode 100644 donjo-app/controllers/fweb/Embed.php create mode 100644 donjo-app/models/migrations/Migrasi_2024102351.php create mode 100644 resources/views/admin/setting/info_sistem/log_login.blade.php create mode 100644 resources/views/admin/statistik/bantuan/peserta.blade.php create mode 100644 resources/views/admin/statistik/bantuan/program.blade.php create mode 100644 resources/views/admin/statistik/bantuan/sasaran.blade.php create mode 100644 resources/views/admin/statistik/cetak.blade.php create mode 100644 resources/views/admin/statistik/dialog.blade.php create mode 100644 resources/views/admin/statistik/index.blade.php create mode 100644 resources/views/periksa/keluarga_tanpa_nik_kepala.blade.php create mode 100644 resources/views/web/kesehatan/cetak.blade.php create mode 100644 resources/views/web/statistik/cetak.blade.php create mode 100644 vendor/themes/esensi/layouts/embed.tpl.php create mode 100644 vendor/themes/natra/layouts/embed.tpl.php diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index eb7c119f0..daa6cce5d 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -79,10 +79,12 @@ ->notPath('views/*') ->in([ __DIR__ . '/app', + __DIR__ . '/bootstrap', + __DIR__ . '/config', __DIR__ . '/donjo-app', + __DIR__ . '/Modules', ]) ->exclude([ - __DIR__ . '/donjo-app/Modules', __DIR__ . '/donjo-app/views', __DIR__ . '/donjo-app/third_party/*/views', __DIR__ . '/donjo-app/models/migrations', diff --git a/Modules/Analisis/Enums/TahapPedataanEnum.php b/Modules/Analisis/Enums/TahapPedataanEnum.php index 93f674594..3f2fee362 100644 --- a/Modules/Analisis/Enums/TahapPedataanEnum.php +++ b/Modules/Analisis/Enums/TahapPedataanEnum.php @@ -1,5 +1,40 @@ 'Belum Entri / Pedataan', - self::SEDANG_ENTRI => 'Sedang Dalam Pendataan', + self::BELUM_ENTRI => '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 index bcd82da5b..1954d29c9 100644 --- a/Modules/Analisis/Enums/TipePertanyaanEnum.php +++ b/Modules/Analisis/Enums/TipePertanyaanEnum.php @@ -43,21 +43,21 @@ class TipePertanyaanEnum extends BaseEnum { - public const PILIHAN_TUNGGAL = 1; - public const PILIHAN_GANDA = 2; + public const PILIHAN_TUNGGAL = 1; + public const PILIHAN_GANDA = 2; public const ISIAN_JUMLAH = 3; public const ISIAN_TEKS = 4; - + /** * Override method all() */ public static function all(): array { return [ - self::PILIHAN_TUNGGAL => 'Pilihan (Tunggal)', - self::PILIHAN_GANDA => 'Pilihan (Ganda)', - self::ISIAN_JUMLAH => 'Isian angka', - self::ISIAN_TEKS => 'Isian Tulisan' + self::PILIHAN_TUNGGAL => '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 index 69af8c4a2..85926222a 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_indikator.php +++ b/Modules/Analisis/Http/Controllers/Analisis_indikator.php @@ -90,7 +90,7 @@ public function datatables($master) ->addIndexColumn() ->addColumn('aksi', static function ($row) use ($canUpdate, $canDelete, $analisisMaster): string { $aksi = ''; - if($analisisMaster->isLock()){ + if ($analisisMaster->isLock()) { return $aksi; } if ($canUpdate) { @@ -117,17 +117,17 @@ public function datatables($master) 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); + $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['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['form_action'] = ci_route('analisis_indikator.' . $master . '.insert'); $data['analisis_indikator'] = null; $data['ubah'] = true; } @@ -139,15 +139,15 @@ 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)); + 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('success', 'Berhasil Tambah Data', ci_route('analisis_indikator.' . $master)); } - redirect_with('error', 'Gagal 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 @@ -155,33 +155,33 @@ public function update($master, $id = null): void isCan('u'); $analisisMaster = $this->analisisMaster; $dataUpdate = static::validate($this->request, $id); - if($analisisMaster->isSystem()){ + 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('success', 'Berhasil Ubah Data', ci_route('analisis_indikator.' . $master)); } - redirect_with('error', 'Gagal 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)); + 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 ($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('success', 'Berhasil Hapus Data', ci_route('analisis_indikator.' . $master)); } - redirect_with('error', 'Gagal 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 diff --git a/Modules/Analisis/Http/Controllers/Analisis_kategori.php b/Modules/Analisis/Http/Controllers/Analisis_kategori.php index c2a13b006..6216cb1df 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_kategori.php +++ b/Modules/Analisis/Http/Controllers/Analisis_kategori.php @@ -35,8 +35,8 @@ * */ -use Modules\Analisis\Models\AnalisisMaster; use Modules\Analisis\Models\AnalisisKategori; +use Modules\Analisis\Models\AnalisisMaster; defined('BASEPATH') || exit('No direct script access allowed'); @@ -128,8 +128,8 @@ public function insert($master): void public function update($master, $id = null): void { isCan('u'); - $dataUpdate = static::validate($this->request, $id); - $data = AnalisisKategori::findOrFail($id); + $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)); @@ -141,7 +141,7 @@ public function delete($master, $id = null): void { isCan('h'); $ids = $id ? [$id] : $this->request['id_cb']; - + foreach ($ids as $id) { $this->prosesDelete($master, $id); } @@ -165,7 +165,7 @@ private function prosesDelete($mater, $id = null): void protected static function validate(array $request = []): array { return [ - 'kategori' => htmlentities($request['kategori']), + 'kategori' => htmlentities($request['kategori']), ]; } } diff --git a/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php b/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php index 4c0369287..7a0b43d48 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php +++ b/Modules/Analisis/Http/Controllers/Analisis_klasifikasi.php @@ -68,8 +68,9 @@ public function index($master) public function datatables($master) { if ($this->input->is_ajax_request()) { - $canUpdate = can('u'); - $canDelete = can('h'); + $canUpdate = can('u'); + $canDelete = can('h'); + return datatables()->of(AnalisisKlasifikasi::whereIdMaster($master)) ->addColumn('ceklist', static function ($row) { if (can('h')) { @@ -82,7 +83,7 @@ public function datatables($master) 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">'; } diff --git a/Modules/Analisis/Http/Controllers/Analisis_laporan.php b/Modules/Analisis/Http/Controllers/Analisis_laporan.php index ecbd65a88..71c691b5f 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_laporan.php +++ b/Modules/Analisis/Http/Controllers/Analisis_laporan.php @@ -84,17 +84,16 @@ public function index($master): void 'list_klasifikasi' => AnalisisKlasifikasi::where('id_master', $master)->get(), 'analisis_periode' => $this->periodeAktif->id, 'wilayah' => Wilayah::treeAccess(), - 'namaPeriode' => $this->periodeAktif->nama + 'namaPeriode' => $this->periodeAktif->nama, ]; view('analisis_laporan.index', $data); } - public function datatables($master) { if ($this->input->is_ajax_request()) { - $sumberData = $this->sumberData(); + $sumberData = $this->sumberData(); return datatables()->of($sumberData) ->addIndexColumn() @@ -152,13 +151,13 @@ 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; + $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); } @@ -174,14 +173,14 @@ public function dialog_kuisioner($master, $id, $aksi = ''): void } 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); + { + $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(); @@ -194,30 +193,30 @@ public function daftar($master, $idSubjek, $aksi = ''): void // $aksi = cetak/unduh public function dialog($master, $aksi = ''): void { - // Simpan session lama + // Simpan session lama $data = $this->modal_penandatangan(); $data['aksi'] = ucwords((string) $aksi); - $data['form_action'] = ci_route("analisis_laporan.{$master}.cetak.{$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(); - + + $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['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']; + $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); } @@ -225,7 +224,7 @@ public function cetak($master, $aksi = ''): void public function ajax_multi_jawab($master): void { $data['jawab'] = session('jawab') ?? ''; - $data['main'] = (new Analisis)->multi_jawab($master); + $data['main'] = (new Analisis())->multi_jawab($master); $data['form_action'] = ci_route("analisis_laporan.{$master}.multi_jawab_proses"); view('analisis_laporan.ajax_multi', $data); @@ -245,7 +244,7 @@ public function multi_jawab_proses($master): void } set_session('jawab', $cb . '7777777'); $jawab = session('jawab'); - set_session('jmkf', AnalisisParameter::selectRaw('DISTINCT(id_indikator) AS id_jmkf')->whereRaw('id in ('.$jawab.')')->count()); + 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 index d860f004b..4aa47e4a9 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_master.php +++ b/Modules/Analisis/Http/Controllers/Analisis_master.php @@ -36,14 +36,14 @@ */ use App\Enums\AnalisisRefSubjekEnum; -use Modules\Analisis\Models\AnalisisIndikator; -use Modules\Analisis\Models\AnalisisKlasifikasi; -use Modules\Analisis\Models\AnalisisMaster; -use Modules\Analisis\Models\AnalisisPeriode; use App\Models\KelompokMaster; use App\Traits\Upload; use Modules\Analisis\Libraries\Gform; use Modules\Analisis\Libraries\Import; +use Modules\Analisis\Models\AnalisisIndikator; +use Modules\Analisis\Models\AnalisisKlasifikasi; +use Modules\Analisis\Models\AnalisisMaster; +use Modules\Analisis\Models\AnalisisPeriode; use OpenSpout\Common\Entity\Row; use OpenSpout\Common\Entity\Style\Border; use OpenSpout\Common\Entity\Style\BorderPart; @@ -56,6 +56,7 @@ class Analisis_master extends AdminModulController { use Upload; + public $moduleName = 'Analisis'; public $modul_ini = 'analisis'; public $kategori_pengaturan = 'Analisis'; @@ -64,7 +65,7 @@ public function __construct() { parent::__construct(); can('b'); - } + } public function index() { @@ -75,6 +76,7 @@ public function datatables() { if ($this->input->is_ajax_request()) { $canUpdate = can('u'); + return datatables()->of(AnalisisMaster::query()) ->addColumn('ceklist', static function ($row) { if (can('h')) { @@ -82,25 +84,25 @@ public function datatables() } }) ->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"> '; + ->addColumn('aksi', static function ($row) use ($canUpdate): string { + $aksi = ' '; + if ($canUpdate) { + $aksi .= ' '; + if ($row->gform_id) { + $aksi .= ' '; } - $aksi .= '   '; + $aksi .= '   '; if ($row->jenis != 1 ) { - $aksi .= ' id).'" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete"> '; + $aksi .= ' '; } } - $aksi .= 'id).'" class="btn bg-navy btn-sm" title="Ekspor Analisis"> '; + $aksi .= ' '; 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)) + ->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(); } @@ -116,13 +118,13 @@ public function form($id = null) $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); + $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; + $data['action'] = 'Tambah'; + $data['form_action'] = ci_route('analisis_master.insert'); + $data['analisis_master'] = null; } return view('analisis.form', $data); @@ -158,12 +160,12 @@ public function delete($id = null): void 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"); + $data['form_action'] = ci_route('analisis_master.import'); view('analisis.import', $data); } @@ -173,15 +175,16 @@ 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); + + $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()); + } catch (Exception $e) { + redirect_with('error', 'Gagal import analisis ' . $e->getMessage()); } - + } public function ekspor($id): void @@ -334,11 +337,11 @@ private function ekspor_klasifikasi(Writer $writer, array $master): void public function import_gform(): void { isCan('u'); - $data['form_action'] = ci_route("analisis_master.exec_import_gform"); + $data['form_action'] = ci_route('analisis_master.exec_import_gform'); view('analisis.import_gform', $data); - } - + } + /** * 1. Credential * 2. Id script @@ -349,8 +352,8 @@ public function import_gform(): void * - 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'); + { + $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]; @@ -378,7 +381,7 @@ public function exec_import_gform(): void $httpClient = $client->authorize(); $response = $httpClient->get($url); - $variabel = json_decode((string) $response->getBody(), true); + $variabel = json_decode((string) $response->getBody(), true); set_session('data_import', $variabel); set_session('gform_id', $this->request->get('formId')); set_session('success', 5); @@ -389,15 +392,16 @@ public function exec_import_gform(): void 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'); } @@ -418,7 +422,7 @@ public function update_gform($id = 0): void $httpClient = $client->authorize(); $response = $httpClient->get($url); - $variabel = json_decode((string) $response->getBody(), true); + $variabel = json_decode((string) $response->getBody(), true); (new Gform($this->request))->update($id, $variabel); redirect('analisis_master'); @@ -438,7 +442,8 @@ public function lock($id): void redirect_with('error', 'Gagal status analisis'); } - public function menu($master){ + public function menu($master) + { $data = [ 'analisis_master' => AnalisisMaster::findOrFail($master), ]; @@ -447,7 +452,7 @@ public function menu($master){ } protected static function validate(array $request = []): array - { + { return [ 'nama' => judul($request['nama']), 'subjek_tipe' => $request['subjek_tipe'], @@ -457,6 +462,6 @@ protected static function validate(array $request = []): array 'pembagi' => bilangan_titik($request['pembagi']), 'id_child' => $request['id_child'] ?: null, 'deskripsi' => htmlentities($request['deskripsi']), - ]; + ]; } } diff --git a/Modules/Analisis/Http/Controllers/Analisis_periode.php b/Modules/Analisis/Http/Controllers/Analisis_periode.php index b56356389..4be250bfa 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_periode.php +++ b/Modules/Analisis/Http/Controllers/Analisis_periode.php @@ -35,11 +35,10 @@ * */ - -use Modules\Analisis\Models\AnalisisRespon; -use Modules\Analisis\Models\AnalisisPeriode; use Modules\Analisis\Enums\TahapPedataanEnum; use Modules\Analisis\Models\AnalisisMaster; +use Modules\Analisis\Models\AnalisisPeriode; +use Modules\Analisis\Models\AnalisisRespon; use Modules\Analisis\Models\AnalisisResponHasil; defined('BASEPATH') || exit('No direct script access allowed'); @@ -72,8 +71,8 @@ public function index($master) public function datatables($master) { if ($this->input->is_ajax_request()) { - $canUpdate = can('u'); - $canDelete = can('h'); + $canUpdate = can('u'); + $canDelete = can('h'); return datatables()->of(AnalisisPeriode::whereIdMaster($master)) ->addColumn('ceklist', static function ($row) { @@ -142,8 +141,8 @@ public function insert($master): void public function update($master, $id = null): void { isCan('u'); - $dataUpdate = static::validate($this->request, $id); - $data = AnalisisPeriode::findOrFail($id); + $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)); @@ -175,10 +174,10 @@ public function delete($master, $id = null): void 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']), + 'nama' => htmlentities($request['nama']), + 'id_state' => bilangan($request['id_state']), + 'aktif' => bilangan($request['aktif']), + 'keterangan' => htmlentities($request['keterangan']), 'tahun_pelaksanaan' => bilangan($request['tahun_pelaksanaan']), ]; } @@ -191,18 +190,18 @@ private function duplikasi($idMaster, $idPeriode, $request): void } if ($request['duplikasi'] == 1) { - $dpd = AnalisisPeriode::where('id_master', $idMaster) - ->where('id', '!=', $idPeriode) - ->orderBy('id', 'desc') - ->first(); + $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']); + ->get(['id_subjek', 'id_indikator', 'id_parameter']); if ($dataRespon->isNotEmpty()) { - $dataRespon->each(function ($item) use ($skrg) { + $dataRespon->each(static function ($item) use ($skrg) { $item->id_periode = $skrg; }); diff --git a/Modules/Analisis/Http/Controllers/Analisis_respon.php b/Modules/Analisis/Http/Controllers/Analisis_respon.php index 02fd14489..bb4971099 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_respon.php +++ b/Modules/Analisis/Http/Controllers/Analisis_respon.php @@ -80,9 +80,9 @@ public function __construct() public function index($master) { - $data = array_merge([ - 'wilayah' => Wilayah::treeAccess(), - 'namaPeriode' => $this->periodeAktif->nama, + $data = array_merge([ + 'wilayah' => Wilayah::treeAccess(), + 'namaPeriode' => $this->periodeAktif->nama, ], Analisis::judul_subjek($this->analisisMaster->subjek_tipe)); return view('analisis_respon.index', $data); @@ -91,7 +91,7 @@ public function index($master) public function datatables($master) { if ($this->input->is_ajax_request()) { - $sumberData = $this->sumberData(); + $sumberData = $this->sumberData(); return datatables()->of($sumberData) ->addIndexColumn() @@ -154,10 +154,10 @@ private function sumberData() 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; + $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); @@ -222,28 +222,29 @@ public function data_ajax(): void */ public function data_unduh($master): void { - $paramDatatable = json_decode((string) $this->input->post('params'), 1); - $_GET = $paramDatatable; - $tipe = $this->input->post('tipe') ?? 1; + $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){ - + $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(); + ->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; + + 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['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, diff --git a/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php b/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php index fe720d91c..7f9bef293 100644 --- a/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php +++ b/Modules/Analisis/Http/Controllers/Analisis_statistik_jawaban.php @@ -263,7 +263,7 @@ public function cetak($master): void } public function cetak_subjek($master, $id, $par, $tipe = 'cetak'): void - { + { if ($tipe == 'unduh') { $tgl = date('d_m_Y'); header('Content-type: application/octet-stream'); diff --git a/Modules/Analisis/Libraries/Analisis.php b/Modules/Analisis/Libraries/Analisis.php index 6bd6874ac..be0d6c7a3 100644 --- a/Modules/Analisis/Libraries/Analisis.php +++ b/Modules/Analisis/Libraries/Analisis.php @@ -275,8 +275,8 @@ public function getSubjek($analisisMaster, $id) ') ->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') + ->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; @@ -401,14 +401,14 @@ public function listBukti($analisisMaster, $periode, $id) 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') + $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'; @@ -416,13 +416,13 @@ private function listJawabLaporan($periode, $idSubjek, $in) } 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']); + $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']; @@ -432,14 +432,14 @@ public function listIndikatorLaporan($analisisMaster, $periode, $id = 0) } 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(); + { + $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++) { diff --git a/Modules/Analisis/Libraries/Bdt.php b/Modules/Analisis/Libraries/Bdt.php index bf188007c..c8894cf88 100644 --- a/Modules/Analisis/Libraries/Bdt.php +++ b/Modules/Analisis/Libraries/Bdt.php @@ -34,6 +34,7 @@ * @link https://github.com/OpenSID/OpenSID * */ + namespace Modules\Analisis\Libraries; use App\Models\Penduduk; @@ -67,8 +68,8 @@ class Bdt public function __construct($idMaster, $periode) { - $this->idMaster = $idMaster; - $this->periode = $periode; + $this->idMaster = $idMaster; + $this->periode = $periode; $this->analisisMaster = AnalisisMaster::findOrFail($idMaster); } @@ -110,7 +111,7 @@ public function impor(): void } // Pakai parameter 'false' untuk mengurangi penggunaan memori - // https://github.com/jasonrogena/php-excel-reader/issues/96 + // 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); @@ -143,7 +144,7 @@ private function impor_respon($data_sheet): void $ada = 0; $sudah_proses = []; $per = $this->periode; - $indikator = AnalisisIndikator::where('id_master', $this->idMaster)->orderBy('id')->get()->toArray(); + $indikator = AnalisisIndikator::where('id_master', $this->idMaster)->orderBy('id')->get()->toArray(); $respon = []; @@ -176,7 +177,7 @@ private function impor_respon($data_sheet): void // echo var_dump($respon); $outp = empty($respon) ? false : AnalisisRespon::insert($respon); - (new AnalisisRespon())->pre_update($this->idMaster,$this->periode); + (new AnalisisRespon())->pre_update($this->idMaster, $this->periode); if (! $outp) { $_SESSION['success'] = -1; @@ -202,7 +203,7 @@ private function hapus_respon($list_id_subjek): void $list_id_subjek_str .= $prefix . "'" . $id . "'"; $prefix = ', '; } - + AnalisisRespon::where('id_periode', $per)->whereRaw("id_subjek in({$list_id_subjek_str})")->delete(); } @@ -244,13 +245,13 @@ private function tulis_rtm($baris, &$rtm) $nik = $baris[$this->kolom['nik']]; $pendudukObj = Penduduk::where('nik', $nik)->first(); - if (!$pendudukObj) { + 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 @@ -264,7 +265,7 @@ private function tulis_rtm($baris, &$rtm) if ($rtm_level == 1) { $rtm_data['nik_kepala'] = $pendudukObj->id; } - + $rtm = (Rtm::create($rtm_data))->id; } @@ -335,7 +336,7 @@ private function parameter_pilihan_ganda($id_indikator, $isi) $in_param = []; foreach ($id_isi as $isi) { - $param = AnalisisParameter::select('id')->where('id_indikator', $id_indikator)->where('kode_jawaban', $isi)->first()->toArray(); + $param = AnalisisParameter::select('id')->where('id_indikator', $id_indikator)->where('kode_jawaban', $isi)->first()->toArray(); if ($param['id'] != '') { $in_param[] = $param['id']; } @@ -360,7 +361,7 @@ private function parameter_isian($id_indikator, $isi) $parameter['jawaban'] = $isi; $parameter['id_indikator'] = $id_indikator; $parameter['asign'] = 0; - + $in_param = (AnalisisParameter::create($parameter))->id; } diff --git a/Modules/Analisis/Libraries/Gform.php b/Modules/Analisis/Libraries/Gform.php index a75517d0a..4adac6a37 100644 --- a/Modules/Analisis/Libraries/Gform.php +++ b/Modules/Analisis/Libraries/Gform.php @@ -38,23 +38,24 @@ namespace Modules\Analisis\Libraries; use App\Enums\AnalisisRefSubjekEnum; -use Modules\Analisis\Models\AnalisisIndikator; -use Modules\Analisis\Models\AnalisisKategori; -use Modules\Analisis\Models\AnalisisMaster; -use Modules\Analisis\Models\AnalisisParameter; -use Modules\Analisis\Models\AnalisisPeriode; -use Modules\Analisis\Models\AnalisisRespon; use App\Models\Keluarga; -use Illuminate\Http\Request; use App\Models\Penduduk; use Exception; use Google\Client; use Google\Service\Script; use Google\Service\Script\ExecutionRequest; +use Illuminate\Http\Request; +use Modules\Analisis\Models\AnalisisIndikator; +use Modules\Analisis\Models\AnalisisKategori; +use Modules\Analisis\Models\AnalisisMaster; +use Modules\Analisis\Models\AnalisisParameter; +use Modules\Analisis\Models\AnalisisPeriode; +use Modules\Analisis\Models\AnalisisRespon; class Gform -{ +{ private Request $request; + public function __construct($request) { $this->request = $request; @@ -79,8 +80,8 @@ public function save(): array 'gform_last_sync' => date('Y-m-d H:i:s'), 'config_id' => identitas('id'), ]; - $analisisMaster = AnalisisMaster::create($data_analisis_master); - $id_master = $analisisMaster->id; + $analisisMaster = AnalisisMaster::create($data_analisis_master); + $id_master = $analisisMaster->id; // SIMPAN KATEGORI ANALISIS $list_kategori = $this->request->get('kategori'); @@ -106,7 +107,7 @@ public function save(): array 'kategori_kode' => '', 'config_id' => identitas('id'), ]; - $kategori = AnalisisKategori::create($data_kategori); + $kategori = AnalisisKategori::create($data_kategori); $list_unique_kategori[$kategori->id] = $val; } @@ -139,7 +140,7 @@ public function save(): array } $data_indikator['config_id'] = identitas('id'); - $analisisIndikator = AnalisisIndikator::create($data_indikator); + $analisisIndikator = AnalisisIndikator::create($data_indikator); $id_indikator = $analisisIndikator->id; // Simpan Parameter untuk setiap unique value pada masing-masing indikator @@ -154,7 +155,7 @@ public function save(): array 'asign' => 0, 'config_id' => identitas('id'), ]; - $analisisParameter = AnalisisParameter::create($data_parameter); + $analisisParameter = AnalisisParameter::create($data_parameter); $id_parameter = $analisisParameter->id; $temp_idx_parameter[$id_parameter] = $param_val; } @@ -175,12 +176,12 @@ public function save(): array '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; + $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) @@ -202,21 +203,22 @@ public function save(): array 'id_periode' => $id_periode, ]; - AnalisisRespon::create($data_respon); + 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 + // 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); } @@ -356,7 +358,7 @@ public function update($id, $variabel) } } - if ($list_error) { + if ($list_error) { return ['error' => $list_error]; } @@ -391,8 +393,8 @@ public function update($id, $variabel) 'asign' => 0, 'config_id' => identitas('id'), ]; - $analisisParameter = AnalisisParameter::create($data_parameter); - $id_parameter = $analisisParameter->id; + $analisisParameter = AnalisisParameter::create($data_parameter); + $id_parameter = $analisisParameter->id; $data_parameter['id'] = $id_parameter; $new_parameter[$id_parameter] = $val_choice; } @@ -414,7 +416,7 @@ public function update($id, $variabel) 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 { @@ -446,7 +448,7 @@ public function update($id, $variabel) 'id_subjek' => $obj_respon['id_subjek'], 'id_periode' => $obj_respon['id_periode'], ]; - AnalisisRespon::create($data_respon); + AnalisisRespon::create($data_respon); } } else { // Jika Responden belum pernah disimpan (Responden Baru) @@ -495,13 +497,13 @@ 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(); + $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(); + $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; diff --git a/Modules/Analisis/Libraries/Import.php b/Modules/Analisis/Libraries/Import.php index e6f9963c8..447be1824 100644 --- a/Modules/Analisis/Libraries/Import.php +++ b/Modules/Analisis/Libraries/Import.php @@ -47,13 +47,15 @@ class Import { - private String $file; - public function __construct(String $file) + private string $file; + + public function __construct(string $file) { $this->file = $file; } + public function analisis($kode = '00000', $jenis = 2): void - { + { $reader = new Reader(); $reader->open($this->file); $id_master = null; @@ -75,11 +77,12 @@ public function analisis($kode = '00000', $jenis = 2): void case 'klasifikasi': $this->impor_klasifikasi($sheet, $id_master); break; - default: - } + + default: + } } $reader->close(); - } + } private function impor_master($sheet, $kode, $jenis) { @@ -123,7 +126,7 @@ private function impor_master($sheet, $kode, $jenis) $master['jenis'] = $jenis; $master['config_id'] = identitas('id'); - $analisisMaster = AnalisisMaster::create($master); + $analisisMaster = AnalisisMaster::create($master); $periode['id_master'] = $analisisMaster->id; $periode['aktif'] = 1; @@ -132,7 +135,7 @@ private function impor_master($sheet, $kode, $jenis) AnalisisPeriode::create($periode); return $analisisMaster->id; - } + } private function impor_pertanyaan($sheet, $id_master) { @@ -161,8 +164,9 @@ private function impor_pertanyaan($sheet, $id_master) } private function get_id_kategori($kategori, $id_master) - { - $adaKategori = AnalisisKategori::firstOrCreate(['kategori' => $kategori, 'id_master' =>$id_master]); + { + $adaKategori = AnalisisKategori::firstOrCreate(['kategori' => $kategori, 'id_master' => $id_master]); + return $adaKategori->id; } @@ -184,13 +188,13 @@ private function impor_jawaban($sheet, $id_master) if (! empty($cells[3]) && $cells[3]->getValue()) { $parameter['nilai'] = $cells[3]->getValue(); } - AnalisisParameter::create($parameter); + AnalisisParameter::create($parameter); } } private function get_id_indikator($kode_pertanyaan, $id_master) { - return AnalisisIndikator::where(['id_master' => $id_master, 'nomor' => $kode_pertanyaan])->first()?->id; + return AnalisisIndikator::where(['id_master' => $id_master, 'nomor' => $kode_pertanyaan])->first()?->id; } private function impor_klasifikasi($sheet, $id_master) @@ -208,7 +212,7 @@ private function impor_klasifikasi($sheet, $id_master) $klasifikasi['maxval'] = $cells[2]->getValue(); $klasifikasi['config_id'] = identitas('id'); - AnalisisKlasifikasi::create($klasifikasi); + AnalisisKlasifikasi::create($klasifikasi); } } } diff --git a/Modules/Analisis/Models/AnalisisIndikator.php b/Modules/Analisis/Models/AnalisisIndikator.php index 8998f47be..2d8e34d0e 100644 --- a/Modules/Analisis/Models/AnalisisIndikator.php +++ b/Modules/Analisis/Models/AnalisisIndikator.php @@ -411,11 +411,11 @@ public static function hubungan($sasaran) } return $data; - } + } public static function indikatorUnduh($idMaster, $parameter = 1) { - $data = self::where('id_master', $idMaster)->orderByRaw('LPAD(nomor, 10, " ")')->get()->toArray(); + $data = self::where('id_master', $idMaster)->orderByRaw('LPAD(nomor, 10, " ")')->get()->toArray(); $counter = count($data); for ($i = 0; $i < $counter; $i++) { @@ -423,7 +423,7 @@ public static function indikatorUnduh($idMaster, $parameter = 1) $data[$i]['par'] = null; if ($parameter == 2) { - $par = AnalisisParameter::where('id_indikator', $data[$i]['id'])->where('asign', 1)->get()->toArray(); + $par = AnalisisParameter::where('id_indikator', $data[$i]['id'])->where('asign', 1)->get()->toArray(); $data[$i]['par'] = $par; } } diff --git a/Modules/Analisis/Models/AnalisisKategori.php b/Modules/Analisis/Models/AnalisisKategori.php index 0d5df6d79..1ca065a74 100644 --- a/Modules/Analisis/Models/AnalisisKategori.php +++ b/Modules/Analisis/Models/AnalisisKategori.php @@ -37,9 +37,8 @@ namespace Modules\Analisis\Models; -use App\Traits\ConfigId; use App\Models\BaseModel; -use Modules\Analisis\Models\AnalisisIndikator; +use App\Traits\ConfigId; defined('BASEPATH') || exit('No direct script access allowed'); diff --git a/Modules/Analisis/Models/AnalisisParameter.php b/Modules/Analisis/Models/AnalisisParameter.php index 8563613dd..55bf417d7 100644 --- a/Modules/Analisis/Models/AnalisisParameter.php +++ b/Modules/Analisis/Models/AnalisisParameter.php @@ -46,17 +46,17 @@ class AnalisisParameter extends BaseModel { use ConfigId; + /** * {@inheritDoc} */ protected $table = 'analisis_parameter'; + protected $guarded = []; public $timestamps = false; /** * Get the kategori that owns the AnalisisIndikator - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function indikator(): BelongsTo { diff --git a/Modules/Analisis/Models/AnalisisPeriode.php b/Modules/Analisis/Models/AnalisisPeriode.php index 05d3b6312..02cec86e6 100644 --- a/Modules/Analisis/Models/AnalisisPeriode.php +++ b/Modules/Analisis/Models/AnalisisPeriode.php @@ -37,9 +37,9 @@ namespace Modules\Analisis\Models; -use App\Traits\ConfigId; use App\Models\BaseModel; -use \Modules\Analisis\Enums\TahapPedataanEnum; +use App\Traits\ConfigId; +use Modules\Analisis\Enums\TahapPedataanEnum; defined('BASEPATH') || exit('No direct script access allowed'); @@ -57,7 +57,6 @@ class AnalisisPeriode extends BaseModel protected $guarded = []; public $timestamps = false; - protected $appends = [ 'tahapan', ]; diff --git a/Modules/Analisis/Models/AnalisisRespon.php b/Modules/Analisis/Models/AnalisisRespon.php index 7e2056985..3c2300046 100644 --- a/Modules/Analisis/Models/AnalisisRespon.php +++ b/Modules/Analisis/Models/AnalisisRespon.php @@ -57,7 +57,7 @@ class AnalisisRespon extends BaseModel public $timestamps = false; public static function updateKuisioner($idMaster, $idPeriode, $postData, $id = null): void - { + { $ia = 0; $it = 0; $ir = 0; @@ -142,8 +142,8 @@ public static function updateKuisioner($idMaster, $idPeriode, $postData, $id = n unset($data); $indikator = key($id_ia); $dx = AnalisisParameter::firstOrCreate(['jawaban' => $id_p, 'id_indikator' => $indikator]); - - unset($data); + + unset($data); $data['id_parameter'] = $dx->id; $data['id_indikator'] = $indikator; $data['id_subjek'] = $id; @@ -161,7 +161,7 @@ public static function updateKuisioner($idMaster, $idPeriode, $postData, $id = n 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; @@ -172,9 +172,9 @@ public static function updateKuisioner($idMaster, $idPeriode, $postData, $id = n } } - $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]; - + $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; @@ -182,12 +182,12 @@ public static function updateKuisioner($idMaster, $idPeriode, $postData, $id = n $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; + $per = $periode; $subjek = $subjekTipe; $mas = $idMaster; $key = ($per + 3) * ($mas + 7) * ($subjek * 3); @@ -254,11 +254,11 @@ public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) for ($i = $br; $i <= $baris; $i++) { $id_subjek = $data->val($i, $kl - 1, $s); - if (strlen($id_subjek) > 14 && $subjek == 1) { + 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; + $id_subjek = Rtm::select('id')->where('id_rtm', $id_subjek)->first()?->id ?? null; } $j = $kl + $op; @@ -269,7 +269,7 @@ public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) if ($isi != '') { if ($indi['id_tipe'] == 1) { $param = AnalisisParameter::where('id_indikator', $indi['id']) - ->where(function ($query) use ($isi) { + ->where(static function ($query) use ($isi) { $query->where('kode_jawaban', $isi)->orWhere('jawaban', $isi); })->first()->toArray(); if ($param) { @@ -289,7 +289,7 @@ public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) } 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(); + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('jawaban', $isi)->first()->toArray(); // apakah sdh ada jawaban yg sama if ($param) { @@ -299,9 +299,9 @@ public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) $parameter['id_indikator'] = $indi['id']; $parameter['asign'] = 0; $parameter['config_id'] = identitas('id'); - AnalisisParameter::create($parameter); + AnalisisParameter::create($parameter); - $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('jawaban', $isi)->first()->toArray(); + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('jawaban', $isi)->first()->toArray(); $in_param = $param['id']; } @@ -319,7 +319,7 @@ public function import_respon($idMaster, $periode, $subjekTipe, $op = 0) } if (count($respon) > 0) { - AnalisisRespon::insert($respon); + AnalisisRespon::insert($respon); } else { return [ 'success' => false, @@ -350,9 +350,9 @@ private function respon_checkbox($indi, $isi, $id_subjek, $per, &$respon): void 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(); + $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(); + $param = AnalisisParameter::where('id_indikator', $indi['id'])->where('kode_jawaban', $isi_ini)->first()->toArray(); } if ($param['id'] != '') { $in_param = $param['id']; @@ -368,18 +368,18 @@ private function respon_checkbox($indi, $isi, $id_subjek, $per, &$respon): void } public function pre_update($idMaster, $per): void - { - $data = AnalisisRespon::selectRaw('distinct(id_subjek) as id')->where('id_periode', $per)->get()->toArray(); - + { + $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(); + 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]; + $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']; @@ -388,7 +388,7 @@ public function pre_update($idMaster, $per): void $upx[$i]['config_id'] = identitas('id'); } if (@$upx) { - AnalisisResponHasil::insert($upx); + AnalisisResponHasil::insert($upx); } } } diff --git a/Modules/Analisis/Models/AnalisisResponBukti.php b/Modules/Analisis/Models/AnalisisResponBukti.php index 4a24bc8c5..1e6fada8e 100644 --- a/Modules/Analisis/Models/AnalisisResponBukti.php +++ b/Modules/Analisis/Models/AnalisisResponBukti.php @@ -45,6 +45,7 @@ class AnalisisResponBukti extends BaseModel { use ConfigId; + /** * {@inheritDoc} */ diff --git a/Modules/Analisis/Routes/web.php b/Modules/Analisis/Routes/web.php index 88c7f142f..56e50ca74 100644 --- a/Modules/Analisis/Routes/web.php +++ b/Modules/Analisis/Routes/web.php @@ -1,98 +1,132 @@ Master Analisis -Route::group('analisis_master', ['namespace' => 'Analisis'], static function (): void { +/* + * + * 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 - 2024 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 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id) + * @license http://www.gnu.org/licenses/gpl.html GPL V3 + * @link https://github.com/OpenSID/OpenSID + * + */ + +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('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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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('', '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'); @@ -102,14 +136,14 @@ 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::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('', '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 + Route::get('cetak_subjek/{id}/{par}/{tipe?}', 'Analisis_statistik_jawaban@cetak_subjek')->name('analisis_statistik_jawaban.cetak_subjek'); +}); diff --git a/Modules/Analisis/Views/analisis/form.blade.php b/Modules/Analisis/Views/analisis/form.blade.php index fec50a3a8..250b0a5ca 100644 --- a/Modules/Analisis/Views/analisis/form.blade.php +++ b/Modules/Analisis/Views/analisis/form.blade.php @@ -2,178 +2,182 @@ @include('admin.layouts.components.asset_validasi') @section('title') -

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

+

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

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

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

    +
    +
    + +
    +

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

    +
    -
    -
    -
    - -
    - -

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

    +
    +
    + +
    + +

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

    +
    -
    -
    -
    - -
    - -

    Kosongkan jika tidak ada Analisis yang terhubung

    +
    +
    + +
    + +

    Kosongkan jika tidak ada Analisis yang terhubung

    +
    -
    -
    -
    - -
    - +
    +
    + +
    + +
    -
    - @if($analisis_master['gform_id']) -
    -
    - -
    - + @if ($analisis_master['gform_id']) +
    +
    + +
    + +
    +
    -
    -
    -
    -
    - -
    - +
    +
    + +
    + +
    +
    -
    + @endif
    - @endif
    + +
    - -
    -
    @endsection @push('scripts') - + @endpush diff --git a/Modules/Analisis/Views/analisis/import.blade.php b/Modules/Analisis/Views/analisis/import.blade.php index 35e1ac1fd..c46461258 100644 --- a/Modules/Analisis/Views/analisis/import.blade.php +++ b/Modules/Analisis/Views/analisis/import.blade.php @@ -1,12 +1,12 @@