|
@@ -30,6 +30,9 @@
|
|
|
<td>
|
|
|
@if ($patientRequest->invoice)
|
|
|
<a href="#" data-invoice-uid="{{ $patientRequest->invoice->uid }}" data-uid="{{ $patientRequest->invoice->customer->uid }}"
|
|
|
+ class="generate-and-store-ic-pay-url" native target="_blank">Request Pay</a>
|
|
|
+ <small class="text-muted px-1">|</small>
|
|
|
+ <a href="#" data-invoice-uid="{{ $patientRequest->invoice->uid }}" data-uid="{{ $patientRequest->invoice->customer->uid }}"
|
|
|
class="generate-and-copy-ic-pay-url" native target="_blank">Copy Pay Link</a>
|
|
|
@else
|
|
|
<div moe>
|
|
@@ -72,6 +75,7 @@
|
|
|
<script>
|
|
|
(function($) {
|
|
|
var patientRequestsComponent = {
|
|
|
+
|
|
|
init: function() {
|
|
|
let parentSegment = $('body');
|
|
|
parentSegment.find('.copy-target')
|
|
@@ -96,6 +100,29 @@
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
+
|
|
|
+ //Save pay url to invoice detailJson
|
|
|
+ parentSegment.find('.generate-and-store-ic-pay-url')
|
|
|
+ .off('click.generate-and-store-ic-pay-url')
|
|
|
+ .on('click.generate-and-store-ic-pay-url', function() {
|
|
|
+ $.post('/api/session/proLogInAsCustomer', {
|
|
|
+ customerUid: $(this).attr('data-uid')
|
|
|
+ }, _data => {
|
|
|
+ if (!hasResponseError(_data)) {
|
|
|
+ const invoiceUid = $(this).attr('data-invoice-uid');
|
|
|
+ const payUrl = '{{ config('app.url') }}/ic/pay/' + invoiceUid + '/' + _data.data
|
|
|
+ console.log({payUrl});
|
|
|
+ $.post('/customer/invoice/save-pay-url', {invoiceUid: invoiceUid, payUrl: payUrl }, function(response){
|
|
|
+ if(response.success){
|
|
|
+ toastr.success('Inoice payment url generated!');
|
|
|
+ }else{
|
|
|
+ toastr.error(response.message);
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
patientRequestsComponent.init();
|