Samson Mutunga há 3 semanas atrás
pai
commit
b4fc318ebf

+ 5 - 0
app/Models/Invoice.php

@@ -21,4 +21,9 @@ class Invoice extends Model
     public function invoiceTransactions() {
         return $this->hasMany(InvoiceTransaction::class, 'invoice_id', 'id')->orderBy('created_at', 'ASC');
     }
+
+    public function getPayUrl(){
+        $detailJson = json_decode($this->detail_json ?? '{}', true);
+        return @$detailJson['payUrl'];
+    }
 }

+ 7 - 0
resources/views/app/patient/company-client/partials/customer-invoices.blade.php

@@ -31,6 +31,9 @@ $invoices = $customer->invoices;
             <tbody>
                 <?php $i = 1; ?>
                 @foreach ($invoices as $record)
+                    <?php 
+                        $payUrl = $record->getPayUrl();
+                    ?>
                     <tr>
                         <td>{{ $i++ }}</td>
                         <td>{{ $record->customer->company ? $record->customer->company->name : '---' }}</td>
@@ -72,8 +75,12 @@ $invoices = $customer->invoices;
                             {{-- <a href="#" data-invoice-uid="{{ $record->uid }}"
                                 data-uid="{{ $record->customer->uid }}" class="generate-and-visit-ic-pay" native
                                 target="_blank">Visit</a> --}}
+                            @if($payUrl)
+                                {{-- <small class="text-muted">Requested to pay</small> --}}
+                            @else
                             <a href="#" data-invoice-uid="{{ $record->uid }}" data-uid="{{ $record->customer->uid }}"
                                 class="generate-and-store-ic-pay-url" native target="_blank">Request Pay</a>
+                            @endif
                             <small class="text-muted px-1">|</small>
                             <a href="#" data-invoice-uid="{{ $record->uid }}"
                                 data-uid="{{ $record->customer->uid }}" class="generate-and-copy-ic-pay-url ml-1"