first(); $rates = $rates->where('pro_id', $selectedPro->id); } $rates = $rates->orderBy('pro_id', 'asc')->get(); $pros = $this->pros; return view('app.practice-management.rates', compact('rates', 'pros', 'selectedProUid')); } public function previousBills(Request $request) { return view('app.practice-management.previous-bills'); } public function financialTransactions(Request $request) { $transactions = ProTransaction::where('pro_id', $this->performer()->pro->id)->orderBy('created_at', 'desc')->get(); return view('app.practice-management.financial-transactions', compact('transactions')); } public function pendingBillsToSign(Request $request) { return view('app.practice-management.pending-bills-to-sign'); } public function HR(Request $request) { return view('app.practice-management.hr'); } public function directDepositSettings(Request $request) { return view('app.practice-management.direct-deposit-settings'); } public function w9(Request $request) { return view('app.practice-management.w9'); } public function contract(Request $request) { return view('app.practice-management.contract'); } public function notes(Request $request, $filter = '') { $proID = $this->performer()->pro->id; $query = Note::where('hcp_pro_id', $proID); switch ($filter) { case 'not-yet-signed': $query = $query->where('is_signed_by_hcp', false); break; // more cases can be added as needed default: break; } $notes = $query->orderBy('created_at', 'desc')->get(); return view('app.practice-management.notes', compact('notes', 'filter')); } public function bills(Request $request, $filter = '') { $proID = $this->performer()->pro->id; $query = Bill::where('is_cancelled', false); switch ($filter) { case 'not-yet-signed': $query = $query ->where(function ($q) use($proID) { $q->where(function ($q2) use ($proID) { $q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', false); }) ->orWhere(function ($q2) use ($proID) { $q2->where('cm_pro_id', $proID)->where('is_signed_by_cm', false); }) ->orWhere(function ($q2) use ($proID) { $q2->where('rme_pro_id', $proID)->where('is_signed_by_rme', false); }) ->orWhere(function ($q2) use ($proID) { $q2->where('rmm_pro_id', $proID)->where('is_signed_by_rmm', false); }); }); break; case 'previous': $query = $query ->where(function ($q) use($proID) { $q->where(function ($q2) use ($proID) { $q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', true); }) ->orWhere(function ($q2) use ($proID) { $q2->where('cm_pro_id', $proID)->where('is_signed_by_cm', true); }) ->orWhere(function ($q2) use ($proID) { $q2->where('rme_pro_id', $proID)->where('is_signed_by_rme', true); }) ->orWhere(function ($q2) use ($proID) { $q2->where('rmm_pro_id', $proID)->where('is_signed_by_rmm', true); }); }); break; // more cases can be added as needed default: break; } $bills = $query->orderBy('created_at', 'desc')->get(); return view('app.practice-management.bills', compact('bills', 'filter')); } public function myTextShortcuts(Request $request) { $performer = $this->performer(); $myTextShortcuts = ProTextShortcut::where('pro_id', $performer->pro_id)->where('is_removed', false)->get(); return view('app.practice-management.my-text-shortcuts', compact('myTextShortcuts')); } public function proAvailability(Request $request, $proUid = null) { $performer = $this->performer(); $pro = $performer->pro; if($proUid){ $pro = Pro::where('uid', $proUid)->first(); } if($request->get('pro_uid')){ $proUid = $request->get('pro_uid'); $pro = Pro::where('uid', $proUid)->first(); } $selectedProUid = $pro->uid; $pros =$this->pros; $generalAvailabilitiesList = ProGeneralAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('created_at', 'asc')->get(); $generalAvailabilities = [ 'MONDAY'=>[], 'TUESDAY'=>[], 'WEDNESDAY'=>[], 'THURSDAY'=>[], 'FRIDAY'=>[], 'SATURDAY'=>[], 'SUNDAY'=>[], ]; foreach($generalAvailabilitiesList as $ga){ if($ga->day_of_week == 'MONDAY'){ $generalAvailabilities['MONDAY'][] = $ga; } if($ga->day_of_week == 'TUESDAY'){ $generalAvailabilities['TUESDAY'][] = $ga; } if($ga->day_of_week == 'WEDNESDAY'){ $generalAvailabilities['WEDNESDAY'][] = $ga; } if($ga->day_of_week == 'THURSDAY'){ $generalAvailabilities['THURSDAY'][] = $ga; } if($ga->day_of_week == 'FRIDAY'){ $generalAvailabilities['FRIDAY'][] = $ga; } if($ga->day_of_week == 'SATURDAY'){ $generalAvailabilities['SATURDAY'][] = $ga; } if($ga->day_of_week == 'SUNDAY'){ $generalAvailabilities['SUNDAY'][] = $ga; } } $specificAvailabilities = ProSpecificAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time')->get(); $specificUnavailabilities = ProSpecificUnavailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time', 'asc')->get(); //events for the calendar $startDate = date('Y-m-d', strtotime("sunday -1 week")); $endDateTime = new DateTime($startDate); $endDateTime->modify('+6 day'); $endDate = $endDateTime->format("Y-m-d"); $eventsData = $pro->getAvailabilityEvents($startDate, $endDate); $events = json_encode($eventsData); return view('app.practice-management.pro-availability', compact('pros','generalAvailabilities', 'specificAvailabilities', 'specificUnavailabilities', 'events', 'selectedProUid')); } public function loadAvailability(Request $request, $proUid){ $performer = $this->performer(); $pro = $performer->pro; $startDate = $request->get('start'); $endDate = $request->get('end'); $selectedPro = Pro::where('uid', $proUid)->first(); return $selectedPro->getAvailabilityEvents($startDate, $endDate); } public function proAvailabilityFilter(Request $request){ $proUid = $request->get('proUid'); return ['success'=>true, 'data'=>$proUid]; } // video call page (RHS) // generic call handle (no uid) // specific call handle (uid of client) public function meet(Request $request, $uid = false) { $session = AppSession::where('session_key', $request->cookie('sessionKey'))->first(); $client = !empty($uid) ? Client::where('uid', $uid)->first() : null; return view('app.video.call', compact('session', 'client')); } // ajax ep used by the video page // this is needed bcoz meet() is used not // just for the client passed to the view public function getOpentokSessionKey(Request $request, $uid) { $client = Client::where('uid', $uid)->first(); return json_encode(["data" => $client ? $client->opentok_session_id : '']); } // poll to check if there are patients with active mcp requests public function getPatientsInQueue(Request $request) { $requests = McpRequest::where('is_active', true)->limit(3)->get(); $results = []; if($requests && count($requests)) { foreach ($requests as $mcpRequest) { $client = $mcpRequest->client; $results[] = [ "clientUid" => $client->uid, "name" => $client->displayName(), "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1) ]; } // $results = $requests; } return json_encode($results); } public function currentWork(Request $request) { return view('app/current-work'); } }