Exemplo n.º 1
0
 public function printPreview($anak_id)
 {
     $anak = Anak::find($anak_id);
     $form = $anak->form->first();
     $pendampingan = Pendampingan::where('anak_id', '=', $anak->id)->paginate(100);
     $data = ['page_title' => 'Kasus Anak 6 (KA6) - Pendampingan', 'panel_title' => 'Pendampingan Table View', 'location' => 'view', 'table' => $pendampingan, 'form' => $form, 'anak' => $anak, 'form_id' => $form->id];
     return View::make('formka6.pendampingan.printpreview', $data);
 }
Exemplo n.º 2
0
 public function update()
 {
     $files = Input::get('files');
     $anak = Anak::find(Input::get('anak')['id']);
     FilesDAO::saveOrUpdate($files, $anak);
     Session::flash('message', "Informasi file berhasil di ubah!");
     return Redirect::to('/dash/anak/files/view/' . $anak->id);
 }
Exemplo n.º 3
0
 public static function delete($id)
 {
     $anak = Anak::find($id);
     if (!is_null($anak->first())) {
         return $anak->delete();
     } else {
         return false;
     }
 }
 public static function formDelete($form_id)
 {
     $user_from_id = Auth::user()->id;
     $form = Form::find($form_id);
     $fa = $form->anak->first();
     $anak = Anak::find($fa->id);
     $formLKA = $anak->form->first();
     $user = $formLKA->user->first();
     $uf_id = $user_from_id;
     $ut_id = $user->id;
     NotifikasiFormHelper::formDelete($uf_id, $ut_id, $form_id);
 }
Exemplo n.º 5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Anak::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'IdPasangan' => $this->IdPasangan, 'NoKTP' => $this->NoKTP, 'TglLahir' => $this->TglLahir, 'ExpKtp' => $this->ExpKtp]);
     $query->andFilterWhere(['like', 'Nama', $this->Nama])->andFilterWhere(['like', 'TmptLahir', $this->TmptLahir])->andFilterWhere(['like', 'Alamat', $this->Alamat])->andFilterWhere(['like', 'AlamatTinggal', $this->AlamatTinggal])->andFilterWhere(['like', 'Agama', $this->Agama])->andFilterWhere(['like', 'Status', $this->Status])->andFilterWhere(['like', 'Pekerjaan', $this->Pekerjaan])->andFilterWhere(['like', 'Kewarganegaraan', $this->Kewarganegaraan])->andFilterWhere(['like', 'GolDar', $this->GolDar]);
     return $dataProvider;
 }
Exemplo n.º 6
0
 public function update()
 {
     $fm = Input::get('form');
     $an = Input::get('anak');
     $jk = Input::get('jenis_kasus');
     $ti = Input::get('tindak_lanjut');
     $dis = Input::get('disposisi');
     $user = Auth::user();
     $sign = ['penerima' => $user];
     $sign = json_encode($sign);
     $fm['sign'] = $sign;
     // inject lka if not set
     if (!isset($fm['no_lka'])) {
         $form = Anak::find($an['id'])->form->first();
         $fm['no_lka'] = $form->no_lka;
     }
     // inject tanggal if not set
     if (!isset($fm['tanggal'])) {
         $form = Form::find($fm['id']);
         $fm['tanggal'] = $form->tanggal;
     }
     $form = FormDAO::saveOrUpdate($fm);
     $disposisi = DisposisiDAO::saveOrUpdate($dis, $form);
     $anak = Anak::find($an['id']);
     TindakLanjutDAO::attachAll($ti, $anak);
     //this part must be write after TindakLanjutDAO::attachAll
     //and cannot befote TindakLanjutDAO::attahcAll
     //otherwise it will detach other tindak lanjut
     if (isset($ti['other']['check'])) {
         if ($ti['other']['check'] == 1) {
             TindakLanjutDAO::saveOrUpdate($ti, $anak);
         }
     }
     //this part must be write after JenisKasusDAO::attachAll
     //and cannot befote JenisKasusDAO::attahcAll
     //otherwise it will detach other jenis kasus
     JenisKasusDAO::attachAll($jk, $anak);
     if (isset($jk['other']['check'])) {
         if ($jk['other']['check'] == 1) {
             JenisKasusDAO::saveOrUpdate($jk, $anak);
         }
     }
     $form = Form::find($form->id);
     //notifikasi
     NotifikasiDisposisiHelper::disposisiUpdate($form->id);
     Session::flash('message', "Form with No LKA {$form->no_lka} has been updated!");
     return Redirect::to('/dash/formka3');
 }
Exemplo n.º 7
0
 public static function getDisposisiKA5($form_id)
 {
     $form = Form::find($form_id);
     //ambil form id
     $fa = $form->anak->first();
     //ambil data anak dari form ini
     $anak = Anak::find($fa->id);
     //ambil data anak berdasarkan id anak pada form ka4
     $formAll = $anak->form;
     //ambil data banyak form dari anak
     $formDis = null;
     foreach ($formAll as $fm) {
         if ($fm->nama == "ka5") {
             //jika form sama dengan form ka3 maka
             $formDis = $fm;
             //simpan data from ka3 ke $formDis
         }
     }
     //ambil data disposisi
     $disposisi = json_decode($formDis->disposisi->first()->kepada);
     return $disposisi;
 }
Exemplo n.º 8
0
 public function update()
 {
     $fm = Input::get('form');
     $an = Input::get('anak');
     $jk = Input::get('jenis_kasus');
     // inject lka if not set
     if (!isset($fm['no_lka'])) {
         $form = Anak::find($an['id'])->form->first();
         $fm['no_lka'] = $form->no_lka;
     }
     // inject tanggal if not set
     if (!isset($fm['tanggal'])) {
         $fm['tanggal'] = date('Y-m-d');
     }
     $form = FormDAO::saveOrUpdate($fm);
     $anak = Anak::find($an['id']);
     //        //save many to many
     $form = Form::find($form->id);
     JenisKasusDAO::attachAll($jk, $anak);
     //this part must be write after JenisKasusDAO::attachAll
     //and cannot befote JenisKasusDAO::attahcAll
     //otherwise it will detach other jenis kasus
     if (isset($jk['other']['check'])) {
         if ($jk['other']['check'] == 1) {
             JenisKasusDAO::saveOrUpdate($jk, $anak);
         }
     }
     //notifikasi
     FormKA7DisposisiHelper::updateNotif($form->id);
     Session::flash('message', "Form with No LKA {$form->no_lka} has been updated!");
     return Redirect::to('/dash/formka7');
 }
Exemplo n.º 9
0
 public function delete($id)
 {
     $anak = Anak::find($id);
     $form = $anak->form;
     foreach ($form as $fm) {
         FormDAO::delete($fm->id);
     }
     $pendampingan = $anak->pendampingan;
     if ($pendampingan) {
         foreach ($pendampingan as $pen) {
             PendampinganDAO::delete($pen->id);
         }
     }
     $files = $anak->files;
     if ($files) {
         foreach ($files as $fl) {
             FilesDAO::delete($fl->id);
         }
     }
     $pelapor = $anak->pelapor->first();
     if ($pelapor) {
         $pelapor->delete();
     }
     $sumber = $anak->sumber_informasi->first();
     if ($sumber) {
         $sumber->delete();
     }
     $keluarga = $anak->keluarga;
     if ($keluarga) {
         $keluarga->delete();
     }
     $fisik = $anak->gambaran_fisik;
     if ($fisik) {
         $fisik->delete();
     }
     $identifikasi = $anak->identifikasi_masalah;
     if ($identifikasi) {
         $identifikasi->delete();
     }
     $psiko = $anak->kondisi_psikososial;
     if ($psiko) {
         $psiko->delete();
     }
     $contact = $anak->contact_person;
     if ($contact) {
         $contact->delete();
     }
     $jenis = $anak->jenis_kasus;
     foreach ($jenis as $jn) {
         if ($jn->other == "T") {
             JenisKasusDAO::delete($jn->id);
         }
     }
     $nama_anak = $anak->nama;
     $anak->delete();
     if ($anak) {
         Session::flash('message', "Anak dengan Nama {$nama_anak} been deleted!");
     } else {
         Session::flash('message', "Error, Anak dengan Nama {$nama_anak} tidak ditemukan!");
     }
     return Redirect::to('/dash/anak');
 }
Exemplo n.º 10
0
 public function update()
 {
     $fm = Input::get('form');
     $an = Input::get('anak');
     $jk = Input::get('jenis_kasus');
     $int = Input::get('intervensi');
     $dis = Input::get('disposisi');
     // inject lka if not set
     if (!isset($fm['no_lka'])) {
         $form = Anak::find($an['id'])->form->first();
         $fm['no_lka'] = $form->no_lka;
     }
     // inject tanggal if not set
     if (!isset($fm['tanggal'])) {
         $fm['tanggal'] = date('Y-m-d');
     }
     $form = FormDAO::saveOrUpdate($fm);
     DisposisiDAO::saveOrUpdate($dis, $form);
     $anak = Anak::find($an['id']);
     JenisKasusDAO::attachAll($jk, $anak);
     if ($jk['other']['check'] == 1) {
         JenisKasusDAO::saveOrUpdate($jk, $anak);
     }
     IntervensiDAO::attachAll($int, $anak);
     if ($int['other']['check'] == 1) {
         IntervensiDAO::saveOrUpdate($int, $anak);
     }
     //save many to many
     $form = Form::find($form->id);
     //notifikasi
     NotifikasiDisposisiHelper::disposisiUpdate($form->id);
     Session::flash('message', "Form with No LKA {$form->no_lka} has been updated!");
     return Redirect::to('dash/formka5');
 }
Exemplo n.º 11
0
 public function delete($id)
 {
     //notifikasi
     FormKA4DisposisiHelper::deleteNotif($id);
     $fm = Form::find($id);
     $anakId = 64;
     $anak = Anak::find($anakId);
     $forms = $anak->form;
     //delete semua form yang berkaitan
     foreach ($forms as $form) {
         if ($form->nama == "ka4" || $form->nama == "ka5" || $form->nama == "ka6" || $form->nama == "ka7") {
             FormDAO::delete($form->id);
         }
     }
     //delete data pendampingan
     $pendamping = $anak->Pendampingan()->get();
     foreach ($pendamping as $pd) {
         PendampinganDAO::delete($pd->id);
     }
     $gf = $anak->GambaranFisik()->get();
     foreach ($gf as $val) {
         GambaranFisikDAO::delete($val->id);
     }
     $kp = $anak->KondisiPsikososial()->get();
     foreach ($kp as $val) {
         KondisiPsikososialDAO::delete($val->id);
     }
     $im = $anak->IdentifikasiMasalah()->get();
     foreach ($im as $val) {
         IdentifikasiMasalahDAO::delete($val->id);
     }
     $kel = $anak->Keluarga()->get();
     foreach ($kel as $val) {
         KeluargaDAO::delete($val->id);
     }
     if ($fm) {
         Session::flash('message', "Form with {$id} has been deleted!");
     } else {
         Session::flash('message', "Error, Form with {$id} not found!");
     }
     return Redirect::to('/dash/formka4');
 }