Ver Fonte

Updates - custpmers

Samson Mutunga há 1 ano atrás
pai
commit
91e87c69d5

+ 6 - 0
resources/views/app/patient/company-client/customers.blade.php

@@ -28,6 +28,7 @@
                     <th class="border-0 text-secondary">Customer Balance</th>
                     <th class="border-0 text-secondary">Pending Invoices Balance</th>
                     <th class="border-0 text-secondary w-25">Created At</th>
+                    <th class="border-0 text-secondary w-25">Portal</th>
                     <th class="border-0 text-secondary delete-column">&nbsp;</th>
                 </tr>
             </thead>
@@ -38,8 +39,13 @@
                         <td>${{ friendly_money($customer->customer_balance) }}</td>
                         <td>${{ friendly_money($customer->pending_invoices_balance_total) }}</td>
                         <td>{{ friendly_date($customer->created_at) }}</td>
+                        <td>
+                        <!-- <a href="#" data-uid="{{$customer->uid}}" class="generate-and-visit-ic-portal" native target="_blank">Visit</a> -->
+                        <a href="#" data-uid="{{$customer->uid}}" class="generate-and-copy-ic-portal-url ml-1" native target="_blank">Copy Url</a>
+                        </td>
                         <td>
                             <div class="d-flex align-items-center">
+                                @include('app.patient.company-client.partials.deactivate-reactivate-customer', ['record' => $customer])
                                 <a href="{{ route('patients.view.customer', ['patient' => $patient, 'slug' => $customer->slug]) }}" class="ml-2">View</a>
                             </div>
                         </td>

+ 3 - 84
resources/views/app/patient/company-client/partials/customer-invoices.blade.php

@@ -69,12 +69,12 @@ $invoices = $customer->invoices;
                             </div>
                         </td>
                         <td>
-                            <a href="#" data-invoice-uid="{{ $record->uid }}"
+                            {{-- <a href="#" data-invoice-uid="{{ $record->uid }}"
                                 data-uid="{{ $record->customer->uid }}" class="generate-and-visit-ic-pay" native
-                                target="_blank">Visit</a>
+                                target="_blank">Visit</a> --}}
                             <a href="#" data-invoice-uid="{{ $record->uid }}"
                                 data-uid="{{ $record->customer->uid }}" class="generate-and-copy-ic-pay-url ml-1"
-                                native target="_blank">Copy</a>
+                                native target="_blank">Copy Url</a>
                         </td>
                         <td>${{ is_null($record->paid) ? 0 : $record->paid }}</td>
                         <td>${{ is_null($record->balance) ? 0 : $record->balance }}</td>
@@ -129,84 +129,3 @@ $invoices = $customer->invoices;
         </table>
     @endif
 </div>
-
-<script>
-    (function() {
-        function init() {
-            initStagSuggest();
-            let parentSegment = $('body');
-            parentSegment.find('input[stag-suggest][target-key][target-field]')
-                .off('stag-suggest-selected')
-                .on('stag-suggest-selected', (_e, _input, _data) => {
-                    _input = $(_input);
-                    _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[
-                        _input.attr('target-key')]);
-                });
-            parentSegment.find('.copy-target')
-                .off('click.copy-target')
-                .on('click.copy-target', function() {
-                    copyTextToClipboard($(this).attr('data-target'));
-                    return false;
-                });
-
-            parentSegment.find('.generate-and-visit-ic-portal')
-                .off('click.generate-and-visit-ic-portal')
-                .on('click.generate-and-visit-ic-portal', function() {
-                    $.post('/api/session/proLogInAsCustomer', {
-                        customerUid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            window.location.href = '/ic/home/' + _data.data;
-                            return false;
-                        }
-                    });
-                    return false;
-                });
-
-            parentSegment.find('.generate-and-copy-ic-portal-url')
-                .off('click.generate-and-copy-ic-portal-url')
-                .on('click.generate-and-copy-ic-portal-url', function() {
-                    $.post('/api/session/proLogInAsCustomer', {
-                        customerUid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            copyTextToClipboard('{{ config('app.url') }}/ic/home/' + _data.data);
-                            return false;
-                        }
-                    });
-                    return false;
-                });
-
-            parentSegment.find('.generate-and-visit-ic-pay')
-                .off('click.generate-and-visit-ic-pay')
-                .on('click.generate-and-visit-ic-pay', function() {
-                    $.post('/api/session/proLogInAsCustomer', {
-                        customerUid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            window.location.href = '/ic/pay/' + $(this).attr('data-invoice-uid') + '/' +
-                                _data.data;
-                            return false;
-                        }
-                    });
-                    return false;
-                });
-
-            parentSegment.find('.generate-and-copy-ic-pay-url')
-                .off('click.generate-and-copy-ic-pay-url')
-                .on('click.generate-and-copy-ic-pay-url', function() {
-                    $.post('/api/session/proLogInAsCustomer', {
-                        customerUid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            copyTextToClipboard('{{ config('app.url') }}/ic/pay/' + $(this).attr(
-                                'data-invoice-uid') + '/' + _data.data);
-                            return false;
-                        }
-                    });
-                    return false;
-                });
-        }
-        addMCInitializer('generic-customer-invoices', init, '#generic-customer-invoices')
-    }).call(window);
-</script>

+ 0 - 37
resources/views/app/patient/company-client/partials/customer-payment-methods.blade.php

@@ -35,40 +35,3 @@
         <div class="my-3">You have not set up any payment methods!</div>
     @endif
 </div>
-
-<script>
-    (function() {
-        function init() {
-            initStagSuggest();
-            let parentSegment = $('body');
-            parentSegment.find('input[stag-suggest][target-key][target-field]')
-                .off('stag-suggest-selected')
-                .on('stag-suggest-selected', (_e, _input, _data) => {
-                    _input = $(_input);
-                    _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[
-                        _input.attr('target-key')]);
-                });
-            parentSegment.find('.copy-target')
-                .off('click.copy-target')
-                .on('click.copy-target', function() {
-                    copyTextToClipboard($(this).attr('data-target'));
-                    return false;
-                });
-
-            parentSegment.find('.generate-and-copy-ic-payment-method-url')
-                .off('click.generate-and-copy-ic-payment-method-url')
-                .on('click.generate-and-copy-ic-payment-method-url', function() {
-                    $.post('/api/session/proLogInAsCustomer', {
-                        customerUid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            copyTextToClipboard('{{ config('app.url') }}/ic/payment-methods/' + _data.data);
-                            return false;
-                        }
-                    });
-                    return false;
-                });
-        }
-        addMCInitializer('generic-customer-payment-methods', init, '#generic-customer-payment-methods')
-    }).call(window);
-</script>

+ 25 - 0
resources/views/app/patient/company-client/partials/deactivate-reactivate-customer.blade.php

@@ -0,0 +1,25 @@
+@if ($record->is_active)
+    <div moe class="mr-2">
+        <a href="" start show>Deactivate</a>
+        <form url="/api/customer/deactivate" class="mcp-theme-1" right>
+            <p class="mb-2 text-nowrap">Deactivate this customer?</p>
+            <input type="hidden" name="uid" value="{{ $record->uid }}">
+            <div>
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+@else
+    <div moe class="mr-2">
+        <a href="" start show>Reactivate</a>
+        <form url="/api/customer/reactivate" class="mcp-theme-1" right>
+            <p class="mb-2 text-nowrap">Reactivate this customer?</p>
+            <input type="hidden" name="uid" value="{{ $record->uid }}">
+            <div>
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+@endif

+ 96 - 1
resources/views/layouts/company-client-layout.blade.php

@@ -1,6 +1,101 @@
 @extends ('layouts.patient')
 @section('inner-content')
 
-@yield('company-client-content')
+<div id="company-client-{{ $patient->uid }}">
+    @yield('company-client-content')
+</div>
+
+<script>
+    (function () {
+        function init() {
+            initStagSuggest();
+            let parentSegment = $('body');
+            parentSegment.find('input[stag-suggest][target-key][target-field]')
+                .off('stag-suggest-selected')
+                .on('stag-suggest-selected', (_e, _input, _data) => {
+                    _input = $(_input);
+                    _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[_input.attr('target-key')]);
+                });
+            parentSegment.find('.copy-target')
+                .off('click.copy-target')
+                .on('click.copy-target', function() {
+                    copyTextToClipboard($(this).attr('data-target'));
+                    return false;
+                });
+
+            parentSegment.find('.generate-and-visit-ic-portal')
+                .off('click.generate-and-visit-ic-portal')
+                .on('click.generate-and-visit-ic-portal', function() {
+                    $.post('/api/session/proLogInAsCustomer', {
+                        customerUid: $(this).attr('data-uid')
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            window.location.href = '/ic/home/' + _data.data;
+                            return false;
+                        }
+                    });
+                    return false;
+                });
+
+            parentSegment.find('.generate-and-copy-ic-portal-url')
+                .off('click.generate-and-copy-ic-portal-url')
+                .on('click.generate-and-copy-ic-portal-url', function() {
+                    $.post('/api/session/proLogInAsCustomer', {
+                        customerUid: $(this).attr('data-uid')
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            copyTextToClipboard('{{config('app.url')}}/ic/home/' + _data.data);
+                            return false;
+                        }
+                    });
+                    return false;
+                });
+
+            parentSegment.find('.generate-and-visit-ic-pay')
+                .off('click.generate-and-visit-ic-pay')
+                .on('click.generate-and-visit-ic-pay', function() {
+                    $.post('/api/session/proLogInAsCustomer', {
+                        customerUid: $(this).attr('data-uid')
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            window.location.href = '/ic/pay/' + $(this).attr('data-invoice-uid') + '/' + _data.data;
+                            return false;
+                        }
+                    });
+                    return false;
+                });
+
+            parentSegment.find('.generate-and-copy-ic-pay-url')
+                .off('click.generate-and-copy-ic-pay-url')
+                .on('click.generate-and-copy-ic-pay-url', function() {
+                    $.post('/api/session/proLogInAsCustomer', {
+                        customerUid: $(this).attr('data-uid')
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            copyTextToClipboard('{{config('app.url')}}/ic/pay/' + $(this).attr('data-invoice-uid') + '/' + _data.data);
+                            return false;
+                        }
+                    });
+                    return false;
+                });
+
+                parentSegment.find('.generate-and-copy-ic-payment-method-url')
+                .off('click.generate-and-copy-ic-payment-method-url')
+                .on('click.generate-and-copy-ic-payment-method-url', function() {
+                    $.post('/api/session/proLogInAsCustomer', {
+                        customerUid: $(this).attr('data-uid')
+                    }, _data => {
+                        if (!hasResponseError(_data)) {
+                            copyTextToClipboard('{{ config('app.url') }}/ic/payment-methods/' + _data.data);
+                            return false;
+                        }
+                    });
+                    return false;
+                });
+        }
+        addMCInitializer('company-client-{{$patient->uid}}', init, '#company-client-{{$patient->uid}}')
+    }).call(window);
+</script>
+
 
 @endsection