<x-app-layout>
    <x-slot name="header">{{ __('Add Employee') }}</x-slot>

    <div class="card shadow-sm" style="max-width:800px">
        <div class="card-body">
            <form action="{{ route('employees.store') }}" method="POST">
                @csrf
                <div class="row g-3">
                    <div class="col-md-6">
                        <label class="form-label fw-semibold">{{ __('Name') }} *</label>
                        <input type="text" name="name" class="form-control @error('name') is-invalid @enderror" value="{{ old('name') }}" required>
                        @error('name')<div class="invalid-feedback">{{ $message }}</div>@enderror
                    </div>
                    <div class="col-md-6">
                        <label class="form-label fw-semibold">{{ __('Designation') }}</label>
                        <input type="text" name="designation" class="form-control" value="{{ old('designation') }}">
                    </div>
                    <div class="col-md-6">
                        <label class="form-label fw-semibold">{{ __('Phone') }}</label>
                        <input type="text" name="phone" class="form-control" value="{{ old('phone') }}">
                    </div>
                    <div class="col-md-6">
                        <label class="form-label fw-semibold">{{ __('Email') }}</label>
                        <input type="email" name="email" class="form-control" value="{{ old('email') }}">
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Salary Type') }} *</label>
                        <select name="salary_type" class="form-select" required>
                            <option value="monthly" {{ old('salary_type') == 'monthly' ? 'selected' : '' }}>{{ __('Monthly') }}</option>
                            <option value="weekly" {{ old('salary_type') == 'weekly' ? 'selected' : '' }}>{{ __('Weekly') }}</option>
                            <option value="daily" {{ old('salary_type') == 'daily' ? 'selected' : '' }}>{{ __('Daily') }}</option>
                        </select>
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Salary Amount') }} *</label>
                        <input type="number" step="0.01" name="salary_amount" class="form-control @error('salary_amount') is-invalid @enderror" value="{{ old('salary_amount') }}" required>
                        @error('salary_amount')<div class="invalid-feedback">{{ $message }}</div>@enderror
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Advance Amount') }}</label>
                        <input type="number" step="0.01" name="advance_amount" class="form-control" value="{{ old('advance_amount', 0) }}">
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Joining Date') }}</label>
                        <input type="date" name="joining_date" class="form-control" value="{{ old('joining_date') }}">
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Resign Date') }}</label>
                        <input type="date" name="resign_date" class="form-control" value="{{ old('resign_date') }}">
                    </div>
                    <div class="col-md-4">
                        <label class="form-label fw-semibold">{{ __('Status') }} *</label>
                        <select name="status" class="form-select" required>
                            <option value="active" {{ old('status', 'active') == 'active' ? 'selected' : '' }}>{{ __('Active') }}</option>
                            <option value="inactive" {{ old('status') == 'inactive' ? 'selected' : '' }}>{{ __('Inactive') }}</option>
                        </select>
                    </div>
                    <div class="col-12">
                        <label class="form-label fw-semibold">{{ __('Notes') }}</label>
                        <textarea name="notes" class="form-control" rows="2">{{ old('notes') }}</textarea>
                    </div>
                </div>
                <div class="mt-3 d-flex gap-2">
                    <button type="submit" class="btn btn-primary">{{ __('Save Employee') }}</button>
                    <a href="{{ route('employees.index') }}" class="btn btn-secondary">{{ __('Cancel') }}</a>
                </div>
            </form>
        </div>
    </div>
</x-app-layout>

