Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

list-institutions.blade.php 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <div>
  2. <div class="grid grid-cols-1 gap-4">
  3. @forelse($this->connectedInstitutions as $institution) {{-- Group connected accounts by 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 flex flex-col gap-3 overflow-hidden sm:flex-row sm:items-center px-6 py-4">
  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">
  15. @endif
  16. <div class="grid flex-1 gap-y-1">
  17. <h3 class="connected-account-section-header-heading text-lg font-semibold leading-[1.4] text-gray-950 dark:text-white">
  18. {{ $institution->name }}
  19. </h3>
  20. {{-- Eventually we will need to assert last updated time based on when the last time one of the accounts for the institution last has transactions imported --}}
  21. <p class="connected-account-section-header-description text-sm text-gray-500 dark:text-gray-400">
  22. {{ __('Last Updated') }} {{ $institution->updated_at->diffForHumans() }}
  23. </p>
  24. </div>
  25. {{ ($this->deleteBankConnection)(['institution' => $institution->id]) }}
  26. </header>
  27. @foreach($institution->connectedBankAccounts as $connectedBankAccount)
  28. <div class="border-t-2 border-gray-200 dark:border-white/10">
  29. <div class="p-6">
  30. <div class="flex justify-between items-start">
  31. <div class="flex flex-col space-y-2">
  32. <span class="account-name text-base font-medium text-gray-900 dark:text-white">{{ $connectedBankAccount->name }}</span>
  33. <span class="account-type text-sm 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 justify-between text-base text-gray-700 dark:text-gray-200 space-x-1">
  37. <strong>@money($connectedBankAccount->bankAccount->account->ending_balance, $connectedBankAccount->bankAccount->account->currency_code, true)</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 flex items-center space-x-2">
  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. </div>
  52. @endforeach
  53. </section>
  54. @empty
  55. <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">
  56. <div class="px-6 py-12 text-center">
  57. <div class="connected-account-empty-state-content mx-auto grid max-w-lg justify-items-center text-center">
  58. <div class="connected-account-empty-state-icon-ctn mb-4 rounded-full bg-platinum p-3 dark:bg-gray-500/20">
  59. <x-filament::icon
  60. icon="heroicon-o-x-mark"
  61. class="connected-account-empty-state-icon h-6 w-6 text-gray-500 dark:text-gray-400"
  62. />
  63. </div>
  64. <h4 class="connected-account-empty-state-heading text-base font-semibold leading-6 text-gray-950 dark:text-white">
  65. {{ __('No Connected Accounts') }}
  66. </h4>
  67. <p class="connected-account-empty-state-description text-sm text-gray-500 dark:text-gray-400 mt-1">
  68. {{ __('Connect your bank account to get started.') }}
  69. </p>
  70. <div class="connected-account-empty-state-action flex shrink-0 items-center gap-3 flex-wrap justify-center mt-6">
  71. <x-filament::button
  72. wire:click="$dispatch('createToken')"
  73. wire:loading.attr="disabled"
  74. >
  75. {{ __('Connect Account') }}
  76. </x-filament::button>
  77. </div>
  78. </div>
  79. </div>
  80. </section>
  81. @endforelse
  82. <x-filament-actions::modals />
  83. </div>
  84. {{-- Include Plaid's JavaScript SDK --}}
  85. @assets
  86. <script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
  87. @endassets
  88. {{-- Initialize Plaid Link --}}
  89. @script
  90. <script>
  91. $wire.on('initializeLink', token => {
  92. const handler = Plaid.create({
  93. token: token,
  94. onSuccess: (publicToken, metadata) => {
  95. $wire.dispatchSelf('linkSuccess', {publicToken: publicToken, metadata: metadata});
  96. },
  97. onExit: (err, metadata) => {},
  98. onEvent: (eventName, metadata) => {},
  99. });
  100. handler.open();
  101. });
  102. </script>
  103. @endscript
  104. </div>