@php($account = $account ?? null)
@extends('layouts.app')
@section('title', __('nav.sub_accounts'))
@section('content')
<form method="post" action="{{ $account ? route('sub-accounts.update',$account) : route('sub-accounts.store') }}" class="card card-body">
@csrf @if($account)@method('PUT')@endif
<div class="row g-3">
<div class="col-md-6"><label class="form-label">{{ __('messages.main_account') }}</label><select class="form-select" name="main_account_id" required>@foreach($mains as $m)<option value="{{ $m->id }}" @selected((string) old('main_account_id', $account?->main_account_id) === (string) $m->id)>{{ $m->name }}</option>@endforeach</select></div>
<div class="col-md-6"><label class="form-label">{{ __('messages.name') }}</label><input class="form-control" name="name" value="{{ old('name', $account?->name) }}" required></div>
<div class="col-md-6"><label class="form-label">{{ __('messages.code') }}</label><input class="form-control" name="code" value="{{ old('code', $account?->code) }}" required></div>
<div class="col-md-6"><label class="form-label">{{ __('messages.phone') }}</label><input class="form-control" name="phone" value="{{ old('phone', $account?->phone) }}"></div>
<div class="col-md-6"><label class="form-label">{{ __('messages.email') }}</label><input class="form-control" name="email" value="{{ old('email', $account?->email) }}"></div>
<div class="col-md-6"><label class="form-label">{{ __('messages.status') }}</label><select class="form-select" name="status"><option value="active">{{ __('status.active') }}</option><option value="inactive">{{ __('status.inactive') }}</option></select></div>
<div class="col-12"><textarea class="form-control" name="notes">{{ old('notes', $account?->notes) }}</textarea></div>
</div>
<button class="btn btn-success mt-3">{{ __('messages.save') }}</button>
</form>
@endsection
