|
@@ -31,7 +31,7 @@ class PracticeManagementController extends Controller
|
|
|
{
|
|
|
$proUid = $selectedProUid ? $selectedProUid : 'all';
|
|
|
$rates = ProRate::where('is_active', true);
|
|
|
- if($proUid !== 'all') {
|
|
|
+ if ($proUid !== 'all') {
|
|
|
$selectedPro = Pro::where('uid', $proUid)->first();
|
|
|
$rates = $rates->where('pro_id', $selectedPro->id);
|
|
|
}
|
|
@@ -85,7 +85,7 @@ class PracticeManagementController extends Controller
|
|
|
$query = $query->where('is_signed_by_hcp', false);
|
|
|
break;
|
|
|
|
|
|
- // more cases can be added as needed
|
|
|
+ // more cases can be added as needed
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -100,7 +100,7 @@ class PracticeManagementController extends Controller
|
|
|
switch ($filter) {
|
|
|
case 'not-yet-signed':
|
|
|
$query = $query
|
|
|
- ->where(function ($q) use($proID) {
|
|
|
+ ->where(function ($q) use ($proID) {
|
|
|
$q->where(function ($q2) use ($proID) {
|
|
|
$q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', false);
|
|
|
})
|
|
@@ -118,7 +118,7 @@ class PracticeManagementController extends Controller
|
|
|
|
|
|
case 'previous':
|
|
|
$query = $query
|
|
|
- ->where(function ($q) use($proID) {
|
|
|
+ ->where(function ($q) use ($proID) {
|
|
|
$q->where(function ($q2) use ($proID) {
|
|
|
$q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', true);
|
|
|
})
|
|
@@ -134,7 +134,7 @@ class PracticeManagementController extends Controller
|
|
|
});
|
|
|
break;
|
|
|
|
|
|
- // more cases can be added as needed
|
|
|
+ // more cases can be added as needed
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -151,10 +151,9 @@ class PracticeManagementController extends Controller
|
|
|
->orWhere('ordering_pro_id', $performer->pro_id)
|
|
|
->orWhere('initiating_pro_id', $performer->pro_id);
|
|
|
});
|
|
|
- if($filter === 'open') {
|
|
|
+ if ($filter === 'open') {
|
|
|
$myTickets = $myTickets->where('is_open', true);
|
|
|
- }
|
|
|
- else if($filter === 'closed') {
|
|
|
+ } else if ($filter === 'closed') {
|
|
|
$myTickets = $myTickets->where('is_open', false);
|
|
|
}
|
|
|
$myTickets = $myTickets->orderBy('created_at', 'desc')->get();
|
|
@@ -173,7 +172,7 @@ class PracticeManagementController extends Controller
|
|
|
$performer = $this->performer();
|
|
|
$myFavorites = ProFavorite::where('pro_id', $performer->pro_id)
|
|
|
->where('is_removed', false);
|
|
|
- if($filter !== 'all') {
|
|
|
+ if ($filter !== 'all') {
|
|
|
$myFavorites = $myFavorites->where('category', $filter);
|
|
|
}
|
|
|
$myFavorites = $myFavorites
|
|
@@ -188,49 +187,49 @@ class PracticeManagementController extends Controller
|
|
|
$performer = $this->performer();
|
|
|
$pro = $performer->pro;
|
|
|
|
|
|
- if($proUid){
|
|
|
+ if ($proUid) {
|
|
|
$pro = Pro::where('uid', $proUid)->first();
|
|
|
}
|
|
|
|
|
|
- if($request->get('pro_uid')){
|
|
|
+ if ($request->get('pro_uid')) {
|
|
|
$proUid = $request->get('pro_uid');
|
|
|
$pro = Pro::where('uid', $proUid)->first();
|
|
|
}
|
|
|
|
|
|
$selectedProUid = $pro->uid;
|
|
|
|
|
|
- $pros =$this->pros;
|
|
|
+ $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'=>[],
|
|
|
+ 'MONDAY' => [],
|
|
|
+ 'TUESDAY' => [],
|
|
|
+ 'WEDNESDAY' => [],
|
|
|
+ 'THURSDAY' => [],
|
|
|
+ 'FRIDAY' => [],
|
|
|
+ 'SATURDAY' => [],
|
|
|
+ 'SUNDAY' => [],
|
|
|
];
|
|
|
- foreach($generalAvailabilitiesList as $ga){
|
|
|
- if($ga->day_of_week == 'MONDAY'){
|
|
|
+ foreach ($generalAvailabilitiesList as $ga) {
|
|
|
+ if ($ga->day_of_week == 'MONDAY') {
|
|
|
$generalAvailabilities['MONDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'TUESDAY'){
|
|
|
+ if ($ga->day_of_week == 'TUESDAY') {
|
|
|
$generalAvailabilities['TUESDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'WEDNESDAY'){
|
|
|
+ if ($ga->day_of_week == 'WEDNESDAY') {
|
|
|
$generalAvailabilities['WEDNESDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'THURSDAY'){
|
|
|
+ if ($ga->day_of_week == 'THURSDAY') {
|
|
|
$generalAvailabilities['THURSDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'FRIDAY'){
|
|
|
+ if ($ga->day_of_week == 'FRIDAY') {
|
|
|
$generalAvailabilities['FRIDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'SATURDAY'){
|
|
|
+ if ($ga->day_of_week == 'SATURDAY') {
|
|
|
$generalAvailabilities['SATURDAY'][] = $ga;
|
|
|
}
|
|
|
- if($ga->day_of_week == 'SUNDAY'){
|
|
|
+ if ($ga->day_of_week == 'SUNDAY') {
|
|
|
$generalAvailabilities['SUNDAY'][] = $ga;
|
|
|
}
|
|
|
}
|
|
@@ -247,12 +246,21 @@ class PracticeManagementController extends Controller
|
|
|
$eventsData = $pro->getAvailabilityEvents($startDate, $endDate);
|
|
|
$events = json_encode($eventsData);
|
|
|
|
|
|
- return view('app.practice-management.pro-availability',
|
|
|
- compact('pros','generalAvailabilities', 'specificAvailabilities',
|
|
|
- 'specificUnavailabilities', 'events', 'selectedProUid'));
|
|
|
+ return view(
|
|
|
+ 'app.practice-management.pro-availability',
|
|
|
+ compact(
|
|
|
+ 'pros',
|
|
|
+ 'generalAvailabilities',
|
|
|
+ 'specificAvailabilities',
|
|
|
+ 'specificUnavailabilities',
|
|
|
+ 'events',
|
|
|
+ 'selectedProUid'
|
|
|
+ )
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- public function loadAvailability(Request $request, $proUid){
|
|
|
+ public function loadAvailability(Request $request, $proUid)
|
|
|
+ {
|
|
|
$performer = $this->performer();
|
|
|
$pro = $performer->pro;
|
|
|
$startDate = $request->get('start');
|
|
@@ -263,33 +271,36 @@ class PracticeManagementController extends Controller
|
|
|
return $selectedPro->getAvailabilityEvents($startDate, $endDate);
|
|
|
}
|
|
|
|
|
|
- public function proAvailabilityFilter(Request $request){
|
|
|
+ public function proAvailabilityFilter(Request $request)
|
|
|
+ {
|
|
|
$proUid = $request->get('proUid');
|
|
|
- return ['success'=>true, 'data'=>$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) {
|
|
|
+ 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;
|
|
|
- if(!empty($client)) {
|
|
|
+ if (!empty($client)) {
|
|
|
return view('app.video.call-minimal', compact('session', 'client'));
|
|
|
}
|
|
|
return view('app.video.call-agora-v2', compact('session', 'client'));
|
|
|
}
|
|
|
|
|
|
- public function getParticipantInfo(Request $request) {
|
|
|
+ public function getParticipantInfo(Request $request)
|
|
|
+ {
|
|
|
$sid = intval($request->get('uid')) - 1000000;
|
|
|
$session = AppSession::where('id', $sid)->first();
|
|
|
$result = [
|
|
|
"type" => '',
|
|
|
"name" => ''
|
|
|
];
|
|
|
- if($session) {
|
|
|
+ if ($session) {
|
|
|
$result["type"] = $session->session_type;
|
|
|
- switch($session->session_type) {
|
|
|
+ switch ($session->session_type) {
|
|
|
case 'PRO':
|
|
|
$pro = Pro::where('id', $session->pro_id)->first();
|
|
|
$result["name"] = $pro->displayName();
|
|
@@ -306,19 +317,29 @@ class PracticeManagementController extends Controller
|
|
|
// 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) {
|
|
|
+ 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) {
|
|
|
+ public function getPatientsInQueue(Request $request)
|
|
|
+ {
|
|
|
$requests = McpRequest::where('is_active', true)->limit(3)->get();
|
|
|
$results = [];
|
|
|
- if($requests && count($requests)) {
|
|
|
+ if ($requests && count($requests)) {
|
|
|
foreach ($requests as $mcpRequest) {
|
|
|
$client = $mcpRequest->client;
|
|
|
- if($client->initiative && strpos($this->performer->pro->initiative,$client->initiative) !== false){
|
|
|
+ if ($client->initiative) {
|
|
|
+ if (strpos($this->performer->pro->initiative, $client->initiative) !== false) {
|
|
|
+ $results[] = [
|
|
|
+ "clientUid" => $client->uid,
|
|
|
+ "name" => $client->displayName(),
|
|
|
+ "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
$results[] = [
|
|
|
"clientUid" => $client->uid,
|
|
|
"name" => $client->displayName(),
|
|
@@ -330,20 +351,24 @@ class PracticeManagementController extends Controller
|
|
|
return json_encode($results);
|
|
|
}
|
|
|
|
|
|
- public function currentWork(Request $request) {
|
|
|
+ public function currentWork(Request $request)
|
|
|
+ {
|
|
|
return view('app/current-work');
|
|
|
}
|
|
|
|
|
|
- public function calendar(Request $request, $proUid = null) {
|
|
|
+ public function calendar(Request $request, $proUid = null)
|
|
|
+ {
|
|
|
return view('app.practice-management.calendar');
|
|
|
}
|
|
|
|
|
|
- public function billingManager(Request $request, $proUid = null) {
|
|
|
+ public function billingManager(Request $request, $proUid = null)
|
|
|
+ {
|
|
|
$notes = Note::orderBy('created_at', 'desc')->paginate();
|
|
|
return view('app.practice-management.billing-manager', compact('notes'));
|
|
|
}
|
|
|
|
|
|
- public function tickets(Request $request, $proUid = null) {
|
|
|
+ public function tickets(Request $request, $proUid = null)
|
|
|
+ {
|
|
|
$tickets = Ticket::orderBy('created_at', 'desc')->paginate();
|
|
|
return view('app.practice-management.tickets', compact('tickets'));
|
|
|
}
|