Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

list-institutions.blade.php 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <div>
  2. <div class="grid grid-cols-1 gap-4">
  3. @forelse($this->connectedInstitutions as $institution)
  4. <section class="connected-account-section overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
  5. <header class="connected-account-header bg-primary-300/10 px-6 py-4 flex flex-col sm:flex-row sm:items-center gap-3">
  6. @if($institution->logo_url === null)
  7. <div class="flex-shrink-0 bg-platinum p-2 rounded-full dark:bg-gray-500/20">
  8. <x-filament::icon
  9. icon="heroicon-o-building-library"
  10. class="h-6 w-6 text-gray-500 dark:text-gray-400"
  11. />
  12. </div>
  13. @else
  14. <img src="{{ $institution->logo_url }}" alt="{{ $institution->name }}" class="h-10 object-contain object-left">
  15. @endif
  16. <div class="flex-auto">
  17. <h3 class="connected-account-section-header-heading text-lg font-semibold leading-6 text-gray-950 dark:text-white">
  18. {{ $institution->name }}
  19. </h3>
  20. @if($institution->getLastImportDate())
  21. <p class="connected-account-section-header-description text-sm leading-6 text-gray-500 dark:text-gray-400">
  22. {{ __('Last updated') }} {{ $institution->getLastImportDate() }}
  23. </p>
  24. @endif
  25. </div>
  26. {{ ($this->deleteBankConnection)(['institution' => $institution->id]) }}
  27. </header>
  28. @foreach($institution->connectedBankAccounts as $connectedBankAccount)
  29. <div class="border-t-2 border-gray-200 dark:border-white/10 px-6 py-4">
  30. <div class="flex flex-col sm:flex-row items-start gap-y-2">
  31. <div class="grid flex-auto gap-y-2">
  32. <span class="account-name text-base font-medium leading-6 text-gray-900 dark:text-white">{{ $connectedBankAccount->name }}</span>
  33. <span class="account-type text-sm leading-6 text-gray-600 dark:text-gray-200">{{ ucwords($connectedBankAccount->subtype) }} {{ $connectedBankAccount->masked_number }}</span>
  34. </div>
  35. @if($connectedBankAccount->bankAccount?->account)
  36. <div class="account-balance flex text-base leading-6 text-gray-700 dark:text-gray-200 space-x-1">
  37. <strong wire:poll.visible>{{ $this->getAccountBalance($connectedBankAccount->bankAccount->account) }}</strong>
  38. <p>{{ $connectedBankAccount->bankAccount->account->currency_code }}</p>
  39. </div>
  40. @endif
  41. </div>
  42. {{-- Add the toggle button to import transactions or not --}}
  43. <div class="mt-4">
  44. @if($connectedBankAccount->import_transactions)
  45. {{ ($this->stopImportingTransactions)(['connectedBankAccount' => $connectedBankAccount->id]) }}
  46. @else
  47. {{ ($this->startImportingTransactions)(['connectedBankAccount' => $connectedBankAccount->id]) }}
  48. @endif
  49. </div>
  50. </div>
  51. @endforeach
  52. </section>
  53. @empty
  54. <section class="connected-account-section overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
  55. <div class="px-6 py-12 text-center">
  56. <div class="connected-account-empty-state-content mx-auto grid max-w-lg justify-items-center text-center">
  57. <div class="connected-account-empty-state-icon-ctn mb-4 rounded-full bg-platinum p-3 dark:bg-gray-500/20">
  58. <x-filament::icon
  59. icon="heroicon-o-x-mark"
  60. class="connected-account-empty-state-icon h-6 w-6 text-gray-500 dark:text-gray-400"
  61. />
  62. </div>
  63. <h4 class="connected-account-empty-state-heading text-base font-semibold leading-6 text-gray-950 dark:text-white">
  64. {{ __('No Connected Accounts') }}
  65. </h4>
  66. <p class="connected-account-empty-state-description text-sm text-gray-500 dark:text-gray-400 mt-1">
  67. {{ __('Connect your bank account to get started.') }}
  68. </p>
  69. <div class="connected-account-empty-state-action flex shrink-0 items-center gap-3 flex-wrap justify-center mt-6">
  70. <x-filament::button
  71. wire:click="$dispatch('createToken')"
  72. wire:loading.attr="disabled"
  73. >
  74. {{ __('Connect Account') }}
  75. </x-filament::button>
  76. </div>
  77. </div>
  78. </div>
  79. </section>
  80. @endforelse
  81. <x-filament-actions::modals />
  82. </div>
  83. {{-- Include Plaid's JavaScript SDK --}}
  84. @assets
  85. <script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
  86. @endassets
  87. {{-- Initialize Plaid Link --}}
  88. @script
  89. <script>
  90. let data = Alpine.reactive({ windowWidth: 'max-w-2xl' });
  91. Alpine.effect(() => {
  92. $wire.$set('modalWidth', data.windowWidth);
  93. });
  94. window.addEventListener('resize', () => {
  95. data.windowWidth = window.innerWidth <= 480 ? 'screen' : 'max-w-2xl';
  96. });
  97. $wire.on('initializeLink', token => {
  98. const handler = Plaid.create({
  99. token: token,
  100. onSuccess: (publicToken, metadata) => {
  101. $wire.dispatchSelf('linkSuccess', {publicToken: publicToken, metadata: metadata});
  102. },
  103. onExit: (err, metadata) => {},
  104. onEvent: (eventName, metadata) => {},
  105. });
  106. handler.open();
  107. });
  108. </script>
  109. @endscript
  110. </div>