139 lines
8.9 KiB
PHP
139 lines
8.9 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="max-w-3xl mx-auto space-y-6">
|
|
<!-- Page Header -->
|
|
<div class="flex items-center gap-4">
|
|
<a href="{{ isset($employee) ? route('employees.show', $employee) : route('employees.index') }}" class="p-2 text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
|
|
</a>
|
|
<h1 class="text-2xl font-bold text-gray-900">
|
|
{{ isset($employee) ? __('employee.edit_employee') : __('employee.create_employee') }}
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- Form -->
|
|
<form method="POST" action="{{ isset($employee) ? route('employees.update', $employee) : route('employees.store') }}" class="bg-white rounded-xl border border-gray-200 p-6 space-y-5">
|
|
@csrf
|
|
@if(isset($employee))
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<!-- First Name -->
|
|
<div>
|
|
<label for="first_name" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.first_name') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="first_name" name="first_name" value="{{ old('first_name', $employee->first_name ?? '') }}"
|
|
class="w-full px-3 py-2 border {{ $errors->has('first_name') ? 'border-red-500' : 'border-gray-300' }} rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500" required>
|
|
@error('first_name')<p class="mt-1 text-xs text-red-500">{{ $message }}</p>@enderror
|
|
</div>
|
|
|
|
<!-- Last Name -->
|
|
<div>
|
|
<label for="last_name" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.last_name') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="last_name" name="last_name" value="{{ old('last_name', $employee->last_name ?? '') }}"
|
|
class="w-full px-3 py-2 border {{ $errors->has('last_name') ? 'border-red-500' : 'border-gray-300' }} rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500" required>
|
|
@error('last_name')<p class="mt-1 text-xs text-red-500">{{ $message }}</p>@enderror
|
|
</div>
|
|
|
|
<!-- Contract Type -->
|
|
<div>
|
|
<label for="contract_type" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.contract_type') }} <span class="text-red-500">*</span></label>
|
|
<select id="contract_type" name="contract_type" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500" required>
|
|
@foreach($contractTypes as $type)
|
|
<option value="{{ $type }}" {{ old('contract_type', $employee->contract_type ?? '') === $type ? 'selected' : '' }}>{{ __('employee.contract_' . $type) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Hire Date -->
|
|
<div>
|
|
<label for="hire_date" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.hire_date') }} <span class="text-red-500">*</span></label>
|
|
<x-date-input name="hire_date" :value="old('hire_date', isset($employee) && $employee->hire_date ? $employee->hire_date->format('Y-m-d') : '')" required="true" />
|
|
</div>
|
|
|
|
<!-- Position -->
|
|
<div>
|
|
<label for="position" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.position') }}</label>
|
|
<input type="text" id="position" name="position" value="{{ old('position', $employee->position ?? '') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- Department -->
|
|
<div>
|
|
<label for="department" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.department') }}</label>
|
|
<input type="text" id="department" name="department" value="{{ old('department', $employee->department ?? '') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- Project -->
|
|
<div>
|
|
<label for="project_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.project') }}</label>
|
|
<select id="project_id" name="project_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
<option value="">{{ __('common.select') }}</option>
|
|
@foreach($projects as $project)
|
|
<option value="{{ $project->id }}" {{ old('project_id', $employee->project_id ?? '') == $project->id ? 'selected' : '' }}>{{ $project->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Base Salary -->
|
|
<div>
|
|
<label for="base_salary" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.base_salary') }}</label>
|
|
<input type="number" id="base_salary" name="base_salary" value="{{ old('base_salary', $employee->base_salary ?? '') }}" step="0.01" min="0"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- Currency -->
|
|
<div>
|
|
<label for="currency_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.salary_currency') }}</label>
|
|
<select id="currency_id" name="currency_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
<option value="">{{ __('common.select') }}</option>
|
|
@foreach($currencies as $currency)
|
|
<option value="{{ $currency->id }}" {{ old('currency_id', $employee->currency_id ?? '') == $currency->id ? 'selected' : '' }}>{{ $currency->code }} - {{ $currency->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Phone -->
|
|
<div>
|
|
<label for="phone" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.phone') }}</label>
|
|
<input type="text" id="phone" name="phone" value="{{ old('phone', $employee->phone ?? '') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- Email -->
|
|
<div>
|
|
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.email') }}</label>
|
|
<input type="email" id="email" name="email" value="{{ old('email', $employee->email ?? '') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- National Code -->
|
|
<div>
|
|
<label for="national_code" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.national_code') }}</label>
|
|
<input type="text" id="national_code" name="national_code" value="{{ old('national_code', $employee->national_code ?? '') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
|
|
</div>
|
|
|
|
<!-- Notes -->
|
|
<div class="md:col-span-2">
|
|
<label for="notes" class="block text-sm font-medium text-gray-700 mb-1">{{ __('employee.notes') }}</label>
|
|
<textarea id="notes" name="notes" rows="3"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">{{ old('notes', $employee->notes ?? '') }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
|
<a href="{{ isset($employee) ? route('employees.show', $employee) : route('employees.index') }}" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">
|
|
{{ __('common.cancel') }}
|
|
</a>
|
|
<button type="submit" class="px-6 py-2 text-sm font-medium text-white bg-teal-600 rounded-lg hover:bg-teal-700 transition-colors">
|
|
{{ isset($employee) ? __('common.save_changes') : __('common.create') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection
|