Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function savedatalokasi_post()
- {
- $username = trim($this->post('username'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username Kosong.',
- ];
- } elseif ($this->post('id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Permohonan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('provinsi_id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Provinsi Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('kabupaten_id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Kabupaten Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('kecamatan_id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Kecamatan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('desa_id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Desa/Kelurahan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('alamat') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Alamat Bangunan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('jml_lantai') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Jumlah Lantai Tidak Boleh Kosong.',
- ];
- } else {
- $id = $this->post('id');
- $checkdata = $this->db->get_where('c39_imb_bangunan', array('id_pemohon' => $id))->row();
- if (count($checkdata) > 0) {
- $data = array(
- 'propinsi' => $this->post('provinsi_id', 'true'),
- 'kabupaten' => $this->post('kabupaten_id', 'true'),
- 'kecamatan' => $this->post('kecamatan_id', 'true'),
- 'kelurahan' => $this->post('desa_id', 'true'),
- 'alamat_bangunan' => strtoupper(trim($this->post('alamat', 'true'))),
- 'jum_lantai_fsutama' => $this->post('jml_lantai', 'true'),
- 'ket_lantai_lain' => trim($this->post('keterangan', 'true')),
- );
- $this->db->where('id_pemohon', $id);
- $this->db->update('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Lokasi Bangunan Ter-Update.',
- ];
- } else {
- $data = array(
- 'id_pemohon' => $this->post('id', 'true'),
- 'propinsi' => $this->post('provinsi_id', 'true'),
- 'kabupaten' => $this->post('kabupaten_id', 'true'),
- 'kecamatan' => $this->post('kecamatan_id', 'true'),
- 'kelurahan' => $this->post('desa_id', 'true'),
- 'alamat_bangunan' => strtoupper(trim($this->post('alamat', 'true'))),
- 'jum_lantai_fsutama' => $this->post('jml_lantai', 'true'),
- 'ket_lantai_lain' => trim($this->post('keterangan', 'true')),
- );
- $this->db->insert('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Lokasi Bangunan Tersimpan.',
- ];
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement