Test Front End Fandi Ahmad Joansyah
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Order;
|
||||
use App\Models\Product;
|
||||
use App\Models\Customer;
|
||||
|
||||
class PasienController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function store(Request $request){
|
||||
|
||||
$data=new Order;
|
||||
$data->email= $request->email;
|
||||
$data->product_code = $request->code;
|
||||
$data->product_name = $request->name;
|
||||
$data->quantity = $request->quantity;
|
||||
$data->order_status = 0;
|
||||
$data->save();
|
||||
return Redirect()->route('all.orders');
|
||||
|
||||
}
|
||||
public function newStore(Request $request){
|
||||
|
||||
$data=new Order;
|
||||
$data->email= $request->email;
|
||||
$data->product_code = $request->code;
|
||||
$data->product_name = $request->name;
|
||||
$data->quantity = $request->quantity;
|
||||
$data->order_status = 0;
|
||||
$data->save();
|
||||
|
||||
//customer_track
|
||||
$customer = Customer::where('email', '=', $request->email)->first();
|
||||
if($customer === null){
|
||||
$data3=new Customer;
|
||||
$data3->name= $request->name;
|
||||
$data3->email= $request->email;
|
||||
$data3->company = $request->company;
|
||||
$data3->address = $request->address;
|
||||
$data3->phone = $request->phone;
|
||||
$data3->save();
|
||||
}
|
||||
return Redirect()->route('all.orders');
|
||||
|
||||
}
|
||||
|
||||
public function newformData(){
|
||||
$products = Product::all();
|
||||
$customers = Customer::get();
|
||||
return view('Admin.new_order',compact('products','customers'));
|
||||
}
|
||||
|
||||
public function ordersData(){
|
||||
$orders = Order::all();
|
||||
return view('Admin.all_orders',compact('orders'));
|
||||
}
|
||||
|
||||
public function pendingOrders(){
|
||||
$orders = Order::where('order_status','=','0')->get();
|
||||
return view('Admin.pending_orders',compact('orders'));
|
||||
}
|
||||
|
||||
public function deliveredOrders(){
|
||||
$orders = Order::where('order_status','!=','0')->get();
|
||||
return view('Admin.delivered_orders',compact('orders'));
|
||||
}
|
||||
|
||||
|
||||
public function daftarPasienBaru(){
|
||||
return view('manajemen_pasien.pendaftaran_pasien');
|
||||
}
|
||||
|
||||
public function lihatListKunjunganPasien(){
|
||||
|
||||
$json = json_decode(file_get_contents('http://10.10.123.135:8081/api/v1/visit'), true);
|
||||
$dataVisit = $json['data'];
|
||||
return view('manajemen_pasien.list_kunjungan_pasien', compact('dataVisit'));
|
||||
}
|
||||
|
||||
public function berhasilDaftarPasienBaru(){
|
||||
|
||||
$arrResult = [
|
||||
"status"=> "201",
|
||||
"message"=> "Berhasil menambah data pasien baru",
|
||||
"data" => [
|
||||
"nama_pasien"=>$_POST{'nama_pasien'},
|
||||
"alamat_pasien"=>$_POST{'alamat_pasien'},
|
||||
"no_telp"=>$_POST{'no_telp'},
|
||||
"penjamin"=>$_POST{'penjamin'},
|
||||
"no_bpjs"=>$_POST{'nomor_kartu_bpjs'},
|
||||
"poliklinik"=>$_POST{'poliklinik'},
|
||||
"dokter"=>$_POST{'dokter'}]
|
||||
|
||||
];
|
||||
echo json_encode($arrResult);
|
||||
|
||||
|
||||
//return view('manajemen_pasien.berhasil_daftar_pasien');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user