WuYongJie 9595267ee7
Some checks failed
Tests / PHP 8.1 (push) Has been cancelled
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
chore: 导入 Akaunting 初始源码与团队协作规则
2026-07-20 18:20:25 +08:00

175 lines
9.8 KiB
PHP

<x-layouts.admin>
<x-slot name="title">
{{ trans('fund_accounts.' . ($platform === 'bank' ? 'bank_accounts' : $platform . '_accounts')) }}
</x-slot>
<x-slot name="buttons">
@can('create-banking-accounts')
<a href="{{ route('fund-accounts.create', $platform) }}" class="inline-flex items-center bg-green hover:bg-green-700 text-white px-5 py-2 rounded-lg text-sm">
{{ trans('general.add_new') }}
</a>
@endcan
</x-slot>
<x-slot name="content">
<style>
#main-body > .container {
max-width: none;
width: auto;
margin-left: 1rem;
margin-right: 1rem;
}
@media (min-width: 1280px) {
#main-body > .container {
margin-left: 3rem;
margin-right: 1.5rem;
}
}
</style>
@php
$pageAccountIds = $accounts->pluck('id')->map(fn ($id) => (string) $id)->values();
@endphp
<div class="my-5 w-full" x-data="{ selected: [] }">
<form id="fund-accounts-export-form" method="GET" action="{{ route('fund-accounts.export', $platform) }}"></form>
<div class="mb-4 flex flex-wrap items-end justify-between gap-4 border-b border-gray-200 pb-4">
@can('create-banking-accounts')
<form method="POST" action="{{ route('fund-accounts.import', $platform) }}" enctype="multipart/form-data" class="flex flex-wrap items-end gap-3">
@csrf
<div>
<label for="fund-accounts-import" class="mb-1 block text-xs font-medium text-gray-600">
{{ trans('fund_accounts.choose_file') }}
</label>
<input
id="fund-accounts-import"
type="file"
name="import"
accept=".xlsx,.xls,.csv"
required
class="block max-w-xs text-sm text-gray-600"
/>
</div>
<button type="submit" class="inline-flex h-10 items-center gap-2 rounded-lg bg-green px-4 text-sm text-white hover:bg-green-700">
<span class="material-icons text-base" aria-hidden="true">upload_file</span>
{{ trans('fund_accounts.bulk_upload') }}
</button>
</form>
@endcan
<div class="flex flex-wrap items-center gap-3">
@can('create-banking-accounts')
<a href="{{ route('fund-accounts.template', $platform) }}" class="inline-flex h-10 items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 text-sm text-gray-700 hover:bg-gray-50">
<span class="material-icons text-base" aria-hidden="true">file_download</span>
{{ trans('fund_accounts.download_template') }}
</a>
@endcan
@can('update-banking-accounts')
<button type="submit" form="fund-accounts-export-form" class="inline-flex h-10 items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 text-sm text-gray-700 hover:bg-gray-50">
<span class="material-icons text-base" aria-hidden="true">download</span>
{{ trans('fund_accounts.bulk_download') }}
</button>
@endcan
</div>
</div>
@if ($errors->has('import'))
<div class="mb-4 border-l-4 border-red-500 bg-red-50 px-4 py-3 text-sm text-red-700">
@foreach ($errors->get('import') as $message)
<p>{{ $message }}</p>
@endforeach
</div>
@endif
<div class="overflow-x-auto border rounded-lg">
<table class="min-w-full whitespace-nowrap divide-y divide-gray-200 text-sm">
<thead class="bg-gray-50 text-left text-gray-500">
<tr>
<th class="w-12 px-4 py-3 text-center">
<input
type="checkbox"
aria-label="{{ trans('fund_accounts.select_all') }}"
@if ($pageAccountIds->isEmpty()) disabled @endif
x-on:change="selected = $event.target.checked ? @js($pageAccountIds) : []"
x-bind:checked="selected.length === {{ $pageAccountIds->count() }} && selected.length > 0"
class="h-4 w-4 rounded border-gray-300 text-green"
/>
</th>
<th class="px-5 py-3">{{ trans('fund_accounts.company_name') }}</th>
@if ($platform === 'bank')
<th class="px-5 py-3">{{ trans('fund_accounts.bank_name') }}</th>
<th class="px-5 py-3">{{ trans('fund_accounts.bank_type') }}</th>
@else
<th class="px-5 py-3">{{ trans('fund_accounts.account_name') }}</th>
@endif
<th class="px-5 py-3">{{ trans('fund_accounts.account_number') }}</th>
@if ($platform === 'bank')
<th class="px-5 py-3">{{ trans('fund_accounts.login_password') }}</th>
<th class="px-5 py-3">{{ trans('fund_accounts.reserved_phone') }}</th>
@endif
<th class="px-5 py-3">{{ trans('fund_accounts.notes') }}</th>
<th class="px-5 py-3 text-right">{{ trans('general.actions') }}</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 bg-white">
@if ($accounts->isEmpty())
<tr>
<td colspan="{{ $platform === 'bank' ? 9 : 6 }}" class="px-5 py-10 text-center text-gray-500">
{{ trans('general.no_records') }}
</td>
</tr>
@else
@foreach ($accounts as $account)
<tr>
<td class="px-4 py-4 text-center">
<input
type="checkbox"
name="ids[]"
value="{{ $account->id }}"
form="fund-accounts-export-form"
x-model="selected"
aria-label="{{ trans('fund_accounts.select_account') }}"
class="h-4 w-4 rounded border-gray-300 text-green"
/>
</td>
<td class="px-5 py-4">{{ $account->company_name }}</td>
@if ($platform === 'bank')
<td class="px-5 py-4">{{ $account->bank_name }}</td>
<td class="px-5 py-4">{{ $account->bank_type }}</td>
@else
<td class="px-5 py-4">{{ $account->account_name }}</td>
@endif
<td class="px-5 py-4 font-mono">{{ $account->masked_account_number }}</td>
@if ($platform === 'bank')
<td class="px-5 py-4">{{ $account->login_password ? trans('fund_accounts.password_configured') : trans('general.no') }}</td>
<td class="px-5 py-4">{{ $account->reserved_phone }}</td>
@endif
<td class="px-5 py-4 max-w-xs truncate" title="{{ $account->notes }}">{{ $account->notes }}</td>
<td class="px-5 py-4 text-right whitespace-nowrap">
@can('update-banking-accounts')
<a href="{{ route('fund-accounts.edit', [$platform, $account]) }}" class="text-purple hover:underline mr-4">{{ trans('general.edit') }}</a>
@endcan
@can('delete-banking-accounts')
<form action="{{ route('fund-accounts.destroy', [$platform, $account]) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:underline">{{ trans('general.delete') }}</button>
</form>
@endcan
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
@unless ($accounts->isEmpty())
<div class="mt-5">{{ $accounts->links() }}</div>
@endunless
</div>
</x-slot>
</x-layouts.admin>