Beispiel #1
0
         }
     } else {
         $arr['status'] = FALSE;
         $arr['msg'] = "Harap isi data dengan lengkap..";
     }
     echo json_encode($arr);
     break;
 case "ubah-konsumen":
     $arr = array();
     if (isset($_POST['txt-nama']) && $_POST['txt-nama'] != "" && isset($_POST['txt-alamat']) && $_POST['txt-alamat'] != "" && isset($_POST['txt-telp']) && $_POST['txt-telp'] != "" && isset($_POST['txt-id']) && $_POST['txt-id'] != "" && isset($_POST['txt-tempo']) && $_POST['txt-tempo'] != "" && isset($_POST['txt-pic']) && $_POST['txt-pic'] != "" && isset($_POST['txt-3kg']) && $_POST['txt-3kg'] != "" && isset($_POST['txt-12kg']) && $_POST['txt-12kg'] != "" && isset($_POST['txt-bg']) && $_POST['txt-bg'] != "" && isset($_POST['txt-50kg']) && $_POST['txt-50kg'] != "") {
         if (isset($_POST['cb-pangkalan']) && $_POST['cb-pangkalan'] != "") {
             $pangkalan = "1";
         } else {
             $pangkalan = "0";
         }
         if ($result = $konsumen->ubah($_POST['txt-id'], $_POST['txt-nama'], $_POST['txt-alamat'], $_POST['txt-telp'], $pangkalan, $_POST['txt-tempo'], $_POST['txt-pic'], $_POST['txt-3kg'], $_POST['txt-12kg'], $_POST['txt-bg'], $_POST['txt-50kg'])) {
             $arr['status'] = TRUE;
             $arr['msg'] = "Data tersimpan..";
         } else {
             $arr['status'] = FALSE;
             $arr['msg'] = "Gagal menyimpan..";
         }
     } else {
         $arr['status'] = FALSE;
         $arr['msg'] = "Harap isi data dengan lengkap..";
     }
     echo json_encode($arr);
     break;
 case "hapus-konsumen":
     $arr = array();
     if (isset($_POST['id']) && $_POST['id'] != "") {