119 lines
7.2 KiB
PHP
119 lines
7.2 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($project) ? route('projects.show', $project) : route('projects.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($project) ? __('project.edit_project') : __('project.create_project') }}
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- Form -->
|
|
<form method="POST" action="{{ isset($project) ? route('projects.update', $project) : route('projects.store') }}" class="bg-white rounded-xl border border-gray-200 p-6 space-y-5">
|
|
@csrf
|
|
@if(isset($project))
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<!-- Name -->
|
|
<div>
|
|
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.name') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="name" name="name" value="{{ old('name', $project->name ?? '') }}"
|
|
class="w-full px-3 py-2 border {{ $errors->has('name') ? 'border-red-500' : 'border-gray-300' }} rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500"
|
|
required>
|
|
@error('name')<p class="mt-1 text-xs text-red-500">{{ $message }}</p>@enderror
|
|
</div>
|
|
|
|
<!-- Code -->
|
|
<div>
|
|
<label for="code" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.code') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="code" name="code" value="{{ old('code', $project->code ?? '') }}"
|
|
class="w-full px-3 py-2 border {{ $errors->has('code') ? 'border-red-500' : 'border-gray-300' }} rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500"
|
|
required>
|
|
@error('code')<p class="mt-1 text-xs text-red-500">{{ $message }}</p>@enderror
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div>
|
|
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.status') }}</label>
|
|
<select id="status" name="status" 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">
|
|
@foreach($statuses as $status)
|
|
<option value="{{ $status }}" {{ old('status', $project->status ?? 'planning') === $status ? 'selected' : '' }}>{{ __('project.status_' . $status) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Manager -->
|
|
<div>
|
|
<label for="manager_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.manager') }}</label>
|
|
<select id="manager_id" name="manager_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($managers as $manager)
|
|
<option value="{{ $manager->id }}" {{ old('manager_id', $project->manager_id ?? '') == $manager->id ? 'selected' : '' }}>{{ $manager->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Budget -->
|
|
<div>
|
|
<label for="budget" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.budget') }}</label>
|
|
<input type="number" id="budget" name="budget" value="{{ old('budget', $project->budget ?? '') }}" 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>
|
|
|
|
<!-- Default Currency -->
|
|
<div>
|
|
<label for="default_currency_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.currency') }}</label>
|
|
<select id="default_currency_id" name="default_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('default_currency_id', $project->default_currency_id ?? '') == $currency->id ? 'selected' : '' }}>{{ $currency->code }} - {{ $currency->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Start Date -->
|
|
<div>
|
|
<label for="start_date" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.start_date') }}</label>
|
|
<x-date-input name="start_date" :value="old('start_date', $project?->start_date?->format('Y-m-d'))" />
|
|
</div>
|
|
|
|
<!-- End Date -->
|
|
<div>
|
|
<label for="end_date" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.end_date') }}</label>
|
|
<x-date-input name="end_date" :value="old('end_date', $project?->end_date?->format('Y-m-d'))" />
|
|
</div>
|
|
|
|
<!-- Location -->
|
|
<div class="md:col-span-2">
|
|
<label for="location" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.location') }}</label>
|
|
<input type="text" id="location" name="location" value="{{ old('location', $project->location ?? '') }}"
|
|
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>
|
|
|
|
<!-- Description -->
|
|
<div class="md:col-span-2">
|
|
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">{{ __('project.description') }}</label>
|
|
<textarea id="description" name="description" 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('description', $project->description ?? '') }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
|
<a href="{{ isset($project) ? route('projects.show', $project) : route('projects.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($project) ? __('common.save_changes') : __('common.create') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection
|