199 lines
9.3 KiB
PHP
199 lines
9.3 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('inventory.new_transaction'))
|
|
|
|
@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('inventory-transactions.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">{{ __('inventory.new_transaction') }}</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<form action="{{ route('inventory-transactions.store') }}"
|
|
method="POST"
|
|
class="bg-white rounded-lg shadow p-6 space-y-6">
|
|
|
|
@csrf
|
|
|
|
<!-- نوع تراکنش و تاریخ -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="type" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.transaction_type') }} *
|
|
</label>
|
|
<select name="type" id="type"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
@foreach($types as $key => $type)
|
|
@php
|
|
$tk = 'inventory.type_' . $type;
|
|
$tl = __($tk);
|
|
if ($tl === $tk) $tl = $type;
|
|
@endphp
|
|
<option value="{{ $type }}" {{ old('type') === $type ? 'selected' : '' }}>{{ $tl }}</option>
|
|
@endforeach
|
|
</select>
|
|
@error('type')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label for="date" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.date') }} *
|
|
</label>
|
|
<x-date-input name="date" :value="old('date', $transaction?->date?->format('Y-m-d'))" />
|
|
value="{{ old('date', date('Y-m-d')) }}"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
@error('date')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<!-- قلم و انبار -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="item_id" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.name') }} *
|
|
</label>
|
|
<select name="item_id" id="item_id"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
<option value="">{{ __('common.select') }}</option>
|
|
@foreach($items as $item)
|
|
<option value="{{ $item->id }}" {{ old('item_id') == $item->id ? 'selected' : '' }}>{{ $item->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
@error('item_id')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label for="warehouse_id" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('warehouse.warehouses') }} *
|
|
</label>
|
|
<select name="warehouse_id" id="warehouse_id"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
<option value="">{{ __('common.select') }}</option>
|
|
@foreach($warehouses as $wh)
|
|
<option value="{{ $wh->id }}" {{ old('warehouse_id') == $wh->id ? 'selected' : '' }}>{{ $wh->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
@error('warehouse_id')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<!-- تعداد و پروژه -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="quantity" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.quantity') }} *
|
|
</label>
|
|
<input type="number" name="quantity" id="quantity"
|
|
value="{{ old('quantity') }}"
|
|
step="0.01" min="0.01"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500"
|
|
required>
|
|
@error('quantity')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</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') == $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>
|
|
|
|
<!-- قیمت واحد و ارز -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="unit_price" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.unit_price') }}
|
|
</label>
|
|
<input type="number" name="unit_price" id="unit_price"
|
|
value="{{ old('unit_price') }}"
|
|
step="0.01" min="0"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500">
|
|
@error('unit_price')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label for="currency_id" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('expense.currency') }}
|
|
</label>
|
|
<select name="currency_id" id="currency_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($currencies as $currency)
|
|
<option value="{{ $currency->id }}" {{ old('currency_id') == $currency->id ? 'selected' : '' }}>{{ $currency->name }} ({{ $currency->code }})</option>
|
|
@endforeach
|
|
</select>
|
|
@error('currency_id')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<!-- شماره مرجع -->
|
|
<div>
|
|
<label for="reference" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('inventory.reference') }}
|
|
</label>
|
|
<input type="text" name="reference" id="reference"
|
|
value="{{ old('reference') }}"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500">
|
|
@error('reference')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- توضیحات -->
|
|
<div>
|
|
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">
|
|
{{ __('common.description') }}
|
|
</label>
|
|
<textarea name="description" id="description" rows="3"
|
|
class="w-full rounded-md border-gray-300 shadow-sm focus:border-teal-500 focus:ring-teal-500">{{ old('description') }}</textarea>
|
|
@error('description')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- دکمهها -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t">
|
|
<a href="{{ route('inventory-transactions.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">
|
|
{{ __('common.create') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection |