فهرست منبع

My teams page (accessible only to DNAs)

Vijayakrishnan 3 سال پیش
والد
کامیت
d1b33775ba

+ 14 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -25,10 +25,12 @@ use App\Models\ProProAccess;
 use App\Models\ProRate;
 use App\Models\ProSpecificAvailability;
 use App\Models\ProSpecificUnavailability;
+use App\Models\ProTeam;
 use App\Models\ProTextShortcut;
 use App\Models\ProTransaction;
 use App\Models\Shipment;
 use App\Models\SupplyOrder;
+use App\Models\Team;
 use App\Models\Ticket;
 use App\Models\ClientMeasurementDaysPerMonth;
 use Illuminate\Support\Facades\DB;
@@ -1928,4 +1930,16 @@ ORDER BY c.name_last, c.name_first
         return view('app.practice-management.care-month-report', compact('records', 'date'));
     }
 
+    public function myTeams(Request $request) {
+        $pro = $this->pro;
+
+        // get all teams where the authed-pro is the assistant pro
+        $teams = ProTeam::where('assistant_pro_id', $pro->id)
+            ->where('is_active', true)
+            ->orderBy('slug')
+            ->get();
+
+        return view('app.practice-management.my-teams', compact('teams'));
+    }
+
 }

+ 9 - 0
app/Models/Pro.php

@@ -49,6 +49,15 @@ class Pro extends Model
         return $this->hasMany(Bill::class, 'hcp_pro_id');
     }
 
+    public function isDefaultNA()
+    {
+        $numTeams = ProTeam::where('assistant_pro_id', $this->id)
+            ->where('is_active', true)
+            ->count();
+
+        return !!$numTeams;
+    }
+
     public function lastPayment() {
         return ProTransaction
             ::where('pro_id', $this->id)

+ 25 - 0
app/Models/ProTeam.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class ProTeam extends Model
+{
+    protected $table = 'pro_team';
+
+    public function mcp()
+    {
+        return $this->hasOne(Pro::class, 'id', 'mcp_pro_id');
+    }
+
+    public function assistant()
+    {
+        return $this->hasOne(Pro::class, 'id', 'assistant_pro_id');
+    }
+
+    public function rd()
+    {
+        return $this->hasOne(Pro::class, 'id', 'rd_pro_id');
+    }
+}

+ 2 - 0
config/app.php

@@ -69,6 +69,8 @@ return [
 
     'temp_dir' => env('TEMP_DIR'),
 
+    'stagfe6_url' => env('STAGFE6_URL'),
+
     /*
     |--------------------------------------------------------------------------
     | Application Timezone

+ 52 - 0
resources/views/app/practice-management/my-teams.blade.php

@@ -0,0 +1,52 @@
+@extends ('layouts/template')
+
+@section('content')
+
+<div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user-injured"></i>
+                My Teams
+            </strong>
+        </div>
+        <div class="card-body p-0">
+
+            <table class="table table-sm table-condensed p-0 m-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="px-3 border-0">Team Name</th>
+                    <th class="border-0">Slug</th>
+                    <th class="border-0">MCP</th>
+                    <th class="border-0">RD</th>
+                    <th class="border-0">Created</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach ($teams as $team)
+                    <tr>
+                        <td class="px-3">
+                            {{ $team->internal_name }}
+                        </td>
+                        <td class="">
+                            <a native target="_blank" href="{{config('app.stagfe6_url') . '/' . $team->slug}}">{{ $team->slug }}</a>
+                        </td>
+                        <td class="">
+                            {{ $team->mcp ? $team->mcp->displayName() : '-' }}
+                        </td>
+                        <td class="">
+                            {{ $team->rd ? $team->rd->displayName() : '-' }}
+                        </td>
+                        <td class="px-3">
+                            {{ friendlier_date_time($team->created_at) }}
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
+
+@endsection

+ 6 - 1
resources/views/layouts/template.blade.php

@@ -101,7 +101,12 @@
                 @endif
                 <li class="nav-item dropdown">
                     <a class="nav-link dropdown-toggle" href="#" id="practice-management" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="mr-1 fas fa-tasks"></i> Practice</a>
-                    <div class="dropdown-menu mcp-theme-1 no-overflow-menu" aria-labelledby="practice-management">
+                    <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
+
+                        @if($pro->isDefaultNA())
+                            <a class="dropdown-item" href="/practice-management/my-teams">My Teams</a>
+                        @endif
+
                         {{--<a class="dropdown-item" href="{{ route('practice-management.dashboard') }}">Dashboard</a>--}}
                         @if($pro && $pro->pro_type == 'ADMIN')
                             <a class="dropdown-item" href="/practice-management/rates/all">Payment Rates</a>

+ 1 - 0
routes/web.php

@@ -108,6 +108,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('done-notes', 'PracticeManagementController@doneNotes')->name('done-notes');
         Route::get('get-next-note/{mode}', 'PracticeManagementController@getNextNote')->name('get-next-note');
 
+        Route::get('my-teams', 'PracticeManagementController@myTeams')->name('my-teams');
 
         Route::middleware('pro.auth.admin')->group(function(){