Пример #1
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');
 }
Пример #2
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');
 }