company-client-layout.blade.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. @extends ('layouts.patient')
  2. @section('inner-content')
  3. <div id="company-client-{{ $patient->uid }}">
  4. @yield('company-client-content')
  5. </div>
  6. <script>
  7. (function () {
  8. function init() {
  9. initStagSuggest();
  10. let parentSegment = $('body');
  11. parentSegment.find('input[stag-suggest][target-key][target-field]')
  12. .off('stag-suggest-selected')
  13. .on('stag-suggest-selected', (_e, _input, _data) => {
  14. _input = $(_input);
  15. _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[_input.attr('target-key')]);
  16. });
  17. parentSegment.find('.copy-target')
  18. .off('click.copy-target')
  19. .on('click.copy-target', function() {
  20. copyTextToClipboard($(this).attr('data-target'));
  21. return false;
  22. });
  23. parentSegment.find('.generate-and-visit-ic-portal')
  24. .off('click.generate-and-visit-ic-portal')
  25. .on('click.generate-and-visit-ic-portal', function() {
  26. $.post('/api/session/proLogInAsCustomer', {
  27. customerUid: $(this).attr('data-uid')
  28. }, _data => {
  29. if(!hasResponseError(_data)) {
  30. window.location.href = '/ic/home/' + _data.data;
  31. return false;
  32. }
  33. });
  34. return false;
  35. });
  36. parentSegment.find('.generate-and-copy-ic-portal-url')
  37. .off('click.generate-and-copy-ic-portal-url')
  38. .on('click.generate-and-copy-ic-portal-url', function() {
  39. $.post('/api/session/proLogInAsCustomer', {
  40. customerUid: $(this).attr('data-uid')
  41. }, _data => {
  42. if(!hasResponseError(_data)) {
  43. copyTextToClipboard('{{config('app.url')}}/ic/home/' + _data.data);
  44. return false;
  45. }
  46. });
  47. return false;
  48. });
  49. parentSegment.find('.generate-and-visit-ic-pay')
  50. .off('click.generate-and-visit-ic-pay')
  51. .on('click.generate-and-visit-ic-pay', function() {
  52. $.post('/api/session/proLogInAsCustomer', {
  53. customerUid: $(this).attr('data-uid')
  54. }, _data => {
  55. if(!hasResponseError(_data)) {
  56. window.location.href = '/ic/pay/' + $(this).attr('data-invoice-uid') + '/' + _data.data;
  57. return false;
  58. }
  59. });
  60. return false;
  61. });
  62. parentSegment.find('.generate-and-copy-ic-pay-url')
  63. .off('click.generate-and-copy-ic-pay-url')
  64. .on('click.generate-and-copy-ic-pay-url', function() {
  65. $.post('/api/session/proLogInAsCustomer', {
  66. customerUid: $(this).attr('data-uid')
  67. }, _data => {
  68. if(!hasResponseError(_data)) {
  69. copyTextToClipboard('{{config('app.url')}}/ic/pay/' + $(this).attr('data-invoice-uid') + '/' + _data.data);
  70. return false;
  71. }
  72. });
  73. return false;
  74. });
  75. parentSegment.find('.generate-and-copy-ic-payment-method-url')
  76. .off('click.generate-and-copy-ic-payment-method-url')
  77. .on('click.generate-and-copy-ic-payment-method-url', function() {
  78. $.post('/api/session/proLogInAsCustomer', {
  79. customerUid: $(this).attr('data-uid')
  80. }, _data => {
  81. if (!hasResponseError(_data)) {
  82. copyTextToClipboard('{{ config('app.url') }}/ic/payment-methods/' + _data.data);
  83. return false;
  84. }
  85. });
  86. return false;
  87. });
  88. }
  89. addMCInitializer('company-client-{{$patient->uid}}', init, '#company-client-{{$patient->uid}}')
  90. }).call(window);
  91. </script>
  92. @endsection