performer()->pro->id; $rates = ProRate::where('pro_id', $proID)->where('is_active', true)->orderBy('created_at', 'desc')->get(); return view('app.practice-management.rates', compact('rates')); } 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 myAvailability(Request $request) { $performer = $this->performer(); $pro = $performer->pro; $generalAvailabilitiesList = ProGeneralAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('created_at', 'asc')->get(); $generalAvailabilities = []; 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 = ProSpecificUnavailability::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(); return view('app.practice-management.my-availability', compact('generalAvailabilities', 'specificAvailabilities', 'specificUnavailabilities')); } // 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'); } }