163 lines
11 KiB
PHP
163 lines
11 KiB
PHP
<?php $__env->startSection('content'); ?>
|
|
<div class="max-w-4xl mx-auto space-y-6">
|
|
<!-- Page Header -->
|
|
<div class="flex items-center gap-4">
|
|
<a href="<?php echo e(route('letters.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">
|
|
<?php echo e(isset($letter) && $letter ? __('letters.edit_letter') : __('letters.create_letter')); ?>
|
|
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- Parent Letter Reference -->
|
|
<?php if(isset($parentLetter) && $parentLetter): ?>
|
|
<div class="bg-purple-50 rounded-xl border border-purple-200 p-4">
|
|
<div class="flex items-center gap-2">
|
|
<svg class="w-4 h-4 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"/></svg>
|
|
<span class="text-sm font-medium text-purple-700"><?php echo e(__('letters.reply_to')); ?>:</span>
|
|
<span class="text-sm text-purple-900"><?php echo e($parentLetter->subject); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Form -->
|
|
<form method="POST" action="<?php echo e(isset($letter) && $letter ? route('letters.update', $letter) : route('letters.store')); ?>"
|
|
enctype="multipart/form-data"
|
|
class="bg-white rounded-xl border border-gray-200 p-6 space-y-5">
|
|
<?php echo csrf_field(); ?>
|
|
<?php if(isset($letter) && $letter): ?>
|
|
<?php echo method_field('PUT'); ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<!-- Type -->
|
|
<div>
|
|
<label for="type" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.type')); ?> <span class="text-red-500">*</span></label>
|
|
<select id="type" name="type" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
<option value="incoming" <?php echo e(old('type', isset($letter) ? $letter->type : ($prefillType ?? '')) === 'incoming' ? 'selected' : ''); ?>><?php echo e(__('letters.type_incoming')); ?></option>
|
|
<option value="outgoing" <?php echo e(old('type', isset($letter) ? $letter->type : ($prefillType ?? '')) === 'outgoing' ? 'selected' : ''); ?>><?php echo e(__('letters.type_outgoing')); ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div>
|
|
<label for="status" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('common.status')); ?> <span class="text-red-500">*</span></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" required>
|
|
<?php $__currentLoopData = ['draft', 'sent', 'received']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
<option value="<?php echo e($s); ?>" <?php echo e(old('status', isset($letter) ? $letter->status : 'draft') === $s ? 'selected' : ''); ?>><?php echo e(__('letters.status_' . $s)); ?></option>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
<?php if(isset($letter) && $letter): ?>
|
|
<option value="archived" <?php echo e(old('status', $letter->status) === 'archived' ? 'selected' : ''); ?>><?php echo e(__('letters.status_archived')); ?></option>
|
|
<?php endif; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Letter Date -->
|
|
<div>
|
|
<?php if (isset($component)) { $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $component; } ?>
|
|
<?php if (isset($attributes)) { $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $attributes; } ?>
|
|
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.date-input','data' => ['name' => 'letter_date','value' => old('letter_date', $letter?->letter_date?->format('Y-m-d')),'required' => 'true']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
|
|
<?php $component->withName('date-input'); ?>
|
|
<?php if ($component->shouldRender()): ?>
|
|
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
|
|
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
|
|
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
|
|
<?php endif; ?>
|
|
<?php $component->withAttributes(['name' => 'letter_date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('letter_date', $letter?->letter_date?->format('Y-m-d'))),'required' => 'true']); ?>
|
|
<?php echo $__env->renderComponent(); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
|
|
<?php $attributes = $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
|
|
<?php unset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
|
|
<?php $component = $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
|
|
<?php unset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Reference Number -->
|
|
<div>
|
|
<label for="reference_number" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.reference_number')); ?></label>
|
|
<input type="text" id="reference_number" name="reference_number"
|
|
value="<?php echo e(old('reference_number', isset($letter) ? $letter->reference_number : '')); ?>"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" dir="ltr">
|
|
</div>
|
|
|
|
<!-- Sender -->
|
|
<div>
|
|
<label for="sender" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.sender')); ?> <span class="text-red-500">*</span></label>
|
|
<input type="text" id="sender" name="sender"
|
|
value="<?php echo e(old('sender', isset($letter) ? $letter->sender : '')); ?>"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Recipient -->
|
|
<div>
|
|
<label for="recipient" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.recipient')); ?> <span class="text-red-500">*</span></label>
|
|
<input type="text" id="recipient" name="recipient"
|
|
value="<?php echo e(old('recipient', isset($letter) ? $letter->recipient : '')); ?>"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Project -->
|
|
<div>
|
|
<label for="project_id" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.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">
|
|
<option value=""><?php echo e(__('common.select')); ?></option>
|
|
<?php $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
<option value="<?php echo e($project->id); ?>" <?php echo e(old('project_id', isset($letter) ? $letter->project_id : '') == $project->id ? 'selected' : ''); ?>><?php echo e($project->name); ?></option>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Subject -->
|
|
<div class="md:col-span-2">
|
|
<label for="subject" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.subject')); ?> <span class="text-red-500">*</span></label>
|
|
<input type="text" id="subject" name="subject"
|
|
value="<?php echo e(old('subject', isset($letter) ? $letter->subject : '')); ?>"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Content -->
|
|
<div class="md:col-span-2">
|
|
<label for="content" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.content')); ?></label>
|
|
<textarea id="content" name="content" rows="6"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500"><?php echo e(old('content', isset($letter) ? $letter->content : '')); ?></textarea>
|
|
</div>
|
|
|
|
<!-- Attachments (only for new letters) -->
|
|
<?php if(!isset($letter) || !$letter): ?>
|
|
<div class="md:col-span-2">
|
|
<label for="attachments" class="block text-sm font-medium text-gray-700 mb-1"><?php echo e(__('letters.attachments')); ?></label>
|
|
<input type="file" id="attachments" name="attachments[]" multiple
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
|
|
<p class="mt-1 text-xs text-gray-400"><?php echo e(__('letters.attachments_help')); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Parent Letter ID (hidden) -->
|
|
<?php if(isset($parentLetter) && $parentLetter): ?>
|
|
<input type="hidden" name="parent_letter_id" value="<?php echo e($parentLetter->id); ?>">
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
|
<a href="<?php echo e(route('letters.index')); ?>" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">
|
|
<?php echo e(__('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">
|
|
<?php echo e(isset($letter) && $letter ? __('common.save_changes') : __('common.create')); ?>
|
|
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<?php $__env->stopSection(); ?>
|
|
|
|
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\projectra\resources\views/letters/form.blade.php ENDPATH**/ ?>
|