95 lines
4.4 KiB
PHP
95 lines
4.4 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', isset($warehouse) ? __('warehouse.edit_warehouse') : __('warehouse.add_warehouse'))
|
|
|
|
@section('content')
|
|
<div class="p-6">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div class="flex items-center gap-3">
|
|
<a href="{{ route('warehouses.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-800">
|
|
{{ isset($warehouse) ? __('warehouse.edit_warehouse') : __('warehouse.add_warehouse') }}
|
|
</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<form action="{{ isset($warehouse) ? route('warehouses.update', $warehouse) : route('warehouses.store') }}"
|
|
method="POST"
|
|
class="bg-white rounded-lg shadow p-6 space-y-6">
|
|
|
|
@csrf
|
|
@if(isset($warehouse))
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<!-- نام و مکان -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('warehouse.name') }} *
|
|
</label>
|
|
<input type="text" name="name" id="name"
|
|
value="{{ old('name', isset($warehouse) ? $warehouse->name : '') }}"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
@error('name')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label for="location" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('warehouse.location') }}
|
|
</label>
|
|
<input type="text" name="location" id="location"
|
|
value="{{ old('location', isset($warehouse) ? $warehouse->location : '') }}"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500">
|
|
@error('location')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<!-- پروژه -->
|
|
<div>
|
|
<label for="project_id" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('expense.project') }}
|
|
</label>
|
|
<select name="project_id" id="project_id"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500">
|
|
<option value="">{{ __('common.select') }}</option>
|
|
@foreach($projects as $project)
|
|
<option value="{{ $project->id }}" {{ old('project_id', isset($warehouse) ? $warehouse->project_id : '') == $project->id ? 'selected' : '' }}>
|
|
{{ $project->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('project_id')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- فعال -->
|
|
<div class="flex items-center gap-2">
|
|
<input type="checkbox" name="is_active" id="is_active" value="1"
|
|
{{ old('is_active', isset($warehouse) ? $warehouse->is_active : true) ? 'checked' : '' }}
|
|
class="rounded border-gray-300 text-teal-600 focus:ring-teal-500">
|
|
<label for="is_active" class="text-sm font-medium text-gray-700">{{ __('common.active') }}</label>
|
|
</div>
|
|
|
|
<!-- دکمهها -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t">
|
|
<a href="{{ route('warehouses.index') }}"
|
|
class="px-4 py-2 text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 transition">
|
|
{{ __('common.cancel') }}
|
|
</a>
|
|
<button type="submit"
|
|
class="px-6 py-2 bg-teal-600 text-white rounded-md hover:bg-teal-700 transition">
|
|
{{ isset($warehouse) ? __('common.save') : __('common.create') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection |