Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function senddata_post()
- {
- $username = trim($this->post('username'));
- $id = $this->post('id');
- $id_fbangun = trim($this->post('id_fbangun'));
- $id_jenisbangun = trim($this->post('id_jenisbangun'));
- $id_statustanah = trim($this->post('id_statustanah'));
- $kecamatan_id_lokasi = trim($this->post('kecamatan_id_lokasi'));
- $desa_id_lokasi = trim($this->post('desa_id_lokasi'));
- $nop = trim($this->post('nop'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username Kosong.',
- ];
- } elseif ($id == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Permohonan Tidak di Temukan.',
- ];
- } elseif ($id_fbangun == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Fungsi Utama Bangunan belum dipilih.',
- ];
- } elseif ($id_jenisbangun == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Jenis Bangunan belum dipilih.',
- ];
- } elseif ($id_statustanah == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Status Tanah belum dipilih.',
- ];
- } elseif ($kecamatan_id_lokasi == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Kecamatan Lokasi Bangunan belum dipilih.',
- ];
- } elseif ($desa_id_lokasi == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Desa/Kelurahan Lokasi Bangunan belum dipilih.',
- ];
- } elseif ($nop == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'N.O.P belum diisi.',
- ];
- } else {
- // Ubah Status ke Belum Validasi
- $data = array(
- 'tanggal' => date('Y-m-d'),
- 'sts_proses' => 0,
- );
- $this->db->where('id', $id);
- $this->db->update('c39_imb_pemohon', $data);
- // Insert Data ke Tabel Notifikasi
- $dataijin = $this->db->get_where('v_imb_dpm', array('id' => $id))->row();
- $pesan = 'Permohonan Baru IMB No. ' . $dataijin->no_register . ' Atas Nama : ' . $dataijin->nama;
- $dataNotif = array(
- 'user_pengirim' => $username,
- 'user_username' => $username,
- 'id' => $id,
- 'notifikasi_no_register' => $dataijin->no_register,
- 'notifikasi_date' => date('Y-m-d'),
- 'notifikasi_desc' => $pesan,
- 'notifikasi_level' => 'Front Office',
- );
- $this->db->insert('bpmppt_notifikasi', $dataNotif);
- // Kirim Notifikasi
- $listUser = $this->db->get_where('bpmppt_users', array('device_id !=' => '', 'user_level' => 'Front Office'))->result();
- if (count($listUser) > 0) {
- foreach ($listUser as $r) {
- sendNotification($r->device_id, $pesan);
- }
- }
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Permohonan Berhasil Terkirim.',
- ];
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement