Browse Source

Merge branch 'df'

Samson Mutunga 1 year ago
parent
commit
0c9282c32e
2 changed files with 21 additions and 1 deletions
  1. 6 0
      app/Models/CompanyClient.php
  2. 15 1
      resources/views/app/patient/companies.blade.php

+ 6 - 0
app/Models/CompanyClient.php

@@ -23,4 +23,10 @@ class CompanyClient extends Model
         return $this->hasMany(CompanyClientDocument::class, 'company_client_id', 'id')
             ->orderBy('created_at', 'desc');
     }
+
+    public function allowedDocuments()
+    {
+        return $this->hasMany(CompanyClientDocument::class, 'company_client_id', 'id')->where('is_removed', false)
+            ->orderBy('created_at', 'desc');
+    }
 }

+ 15 - 1
resources/views/app/patient/companies.blade.php

@@ -131,7 +131,7 @@
                             </span>
                             @if(count($linkedCompany->documents))
                                 <table class="table">
-                                    @foreach($linkedCompany->documents as $document)
+                                    @foreach($linkedCompany->allowedDocuments as $document)
                                         <tr>
                                             <td>
                                                 <a native target="_blank" href="/api/companyClientDocument/download/{{$document->uid}}">
@@ -154,6 +154,20 @@
                                                         </div>
                                                     </form>
                                                 </span>
+                                                <span moe class="ml-1" relative>
+                                                    <a class="" href="" show start><i class="fa fa-trash-alt text-danger"></i></a>
+                                                    <form url="/api/companyClientDocument/remove" right>
+                                                        <input type="hidden" name="uid" value="{{$document->uid}}">
+                                                        <div class="m-2">
+                                                            <label for="" class="control-label">Are you sure?</label>
+                                                        </div>
+
+                                                        <div class="mb-0">
+                                                            <button class="btn btn-primary btn-sm" submit>Remove</button>
+                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                        </div>
+                                                    </form>
+                                                </span>
                                             </td>
                                         </tr>
                                     @endforeach