﻿@extends('layouts.app')

@section('title', \App\Helpers\TranslationHelper::transFromDatabase('Add New Bank', __('Add New Bank')))

@section('content')
<div class="container m-auto p-4 sm:p-6 lg:p-8 py-8">
    <div class="flex justify-between items-center mb-6">
        <h1 class="text-2xl font-semibold text-gray-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Bank', __('Add New Bank')) }}</h1>
        <a href="{{ route('banking.banks.index') }}" class="bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded">
            <i class="fas fa-arrow-right ml-1"></i> {{ \App\Helpers\TranslationHelper::transFromDatabase('Back to List', __('Back to List')) }}
        </a>
    </div>

    <div class="bg-white shadow-md rounded-lg overflow-hidden p-6">
        <form action="{{ route('banking.banks.store') }}" method="POST">
            @csrf
            
            <div class="mb-4">
                <label for="name" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Bank Name', __('Bank Name')) }} <span class="text-red-600">*</span></label>
                <input type="text" name="name" id="name" value="{{ old('name') }}" required
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('name') border-red-500 @enderror">
                @error('name')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="code" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Bank Code', __('Bank Code')) }}</label>
                <input type="text" name="code" id="code" value="{{ old('code') }}"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('code') border-red-500 @enderror">
                @error('code')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="swift_code" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('SWIFT Code', __('SWIFT Code')) }}</label>
                <input type="text" name="swift_code" id="swift_code" value="{{ old('swift_code') }}"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('swift_code') border-red-500 @enderror">
                @error('swift_code')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="address" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Address', __('Address')) }}</label>
                <input type="text" name="address" id="address" value="{{ old('address') }}"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('address') border-red-500 @enderror">
                @error('address')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="phone" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Phone Number', __('Phone Number')) }}</label>
                <input type="text" name="phone" id="phone" value="{{ old('phone') }}"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('phone') border-red-500 @enderror">
                @error('phone')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="contact_person" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Contact Person', __('Contact Person')) }}</label>
                <input type="text" name="contact_person" id="contact_person" value="{{ old('contact_person') }}"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('contact_person') border-red-500 @enderror">
                @error('contact_person')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-4">
                <label for="notes" class="block text-gray-700 text-sm font-bold mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Notes', __('Notes')) }}</label>
                <textarea name="notes" id="notes" rows="3"
                    class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('notes') border-red-500 @enderror">{{ old('notes') }}</textarea>
                @error('notes')
                <p class="text-red-500 text-sm mt-1">{{ $message }}</p>
                @enderror
            </div>

            <div class="mb-6">
                <div class="flex items-center">
                    <input type="checkbox" name="is_active" id="is_active" value="1" {{ old('is_active', '1') == '1' ? 'checked' : '' }}
                        class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500">
                    <label for="is_active" class="mr-2 text-sm font-medium text-gray-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Active', __('Active')) }}</label>
                </div>
            </div>

            <div class="flex items-center justify-between">
                <button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
                    {{ \App\Helpers\TranslationHelper::transFromDatabase('Save Bank', __('Save Bank')) }}
                </button>
            </div>
        </form>
    </div>
</div>
@endsection
