🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:quotations.blade.php
<x-app-layout> <x-slot name="header"> <div class="flex items-center justify-between"> <h2 class="text-xl font-semibold leading-tight text-white"> {{ __('Quotations') }} </h2> <button onclick="document.getElementById('create-quotation-modal').classList.remove('hidden')" class="inline-flex items-center gap-2 rounded-lg bg-orange px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-orange-dark"> <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg> New Quotation </button> </div> </x-slot> <div class="py-8"> <div class="mx-auto max-w-7xl sm:px-6 lg:px-8 space-y-8"> @if (session('success')) <div class="rounded-lg border border-green-200 bg-green-50 p-4"> <div class="flex items-center"> <svg class="h-5 w-5 text-green-500 mr-2" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg> <p class="text-sm font-medium text-green-800">{{ session('success') }}</p> </div> </div> @endif <div class="overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-gray-900/5"> <div class="border-b border-gray-100 bg-gray-50/50 px-6 py-4"> <h3 class="text-base font-semibold text-navy">All Quotations</h3> </div> <div class="overflow-x-auto"> @if($quotations->count() > 0) <table class="min-w-full divide-y divide-gray-200"> <thead> <tr class="bg-gray-50"> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Number</th> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Client</th> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Project</th> <th class="px-6 py-3 text-right text-xs font-semibold uppercase tracking-wider text-gray-500">Amount</th> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Status</th> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Date</th> <th class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Actions</th> </tr> </thead> <tbody class="divide-y divide-gray-100"> @foreach($quotations as $quotation) <tr class="transition hover:bg-gray-50/50"> <td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-navy">{{ $quotation->quotation_number }}</td> <td class="whitespace-nowrap px-6 py-4 text-sm text-gray-600">{{ $quotation->client_name }}</td> <td class="whitespace-nowrap px-6 py-4 text-sm text-gray-600">{{ $quotation->project->name ?? '—' }}</td> <td class="whitespace-nowrap px-6 py-4 text-right text-sm font-semibold text-navy">Rs{{ number_format($quotation->final_amount, 2) }}</td> <td class="whitespace-nowrap px-6 py-4"> @php $statusColors = [ 'draft' => 'bg-gray-100 text-gray-800', 'sent' => 'bg-blue-100 text-blue-800', 'accepted' => 'bg-green-100 text-green-800', 'rejected' => 'bg-red-100 text-red-800', ]; $color = $statusColors[$quotation->status] ?? 'bg-gray-100 text-gray-800'; @endphp <span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold {{ $color }}"> {{ ucfirst($quotation->status) }} </span> </td> <td class="whitespace-nowrap px-6 py-4 text-sm text-gray-600">{{ $quotation->created_at->format('M d, Y') }}</td> <td class="whitespace-nowrap px-6 py-4"> <a href="{{ route('admin.quotation.show', $quotation) }}" class="text-sm font-medium text-orange hover:text-orange-dark">View</a> @if($quotation->status === 'draft') <form action="{{ route('admin.quotation.send', $quotation) }}" method="POST" class="inline ml-2"> @csrf <button type="submit" class="text-sm font-medium text-green-600 hover:text-green-800">Send</button> </form> @endif </td> </tr> @endforeach </tbody> </table> @else <div class="flex flex-col items-center justify-center py-16 text-center"> <svg class="h-16 w-16 text-gray-300 mb-4" fill="none" stroke="currentColor" stroke-width="1" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"/></svg> <h3 class="text-sm font-semibold text-gray-900 mb-1">No quotations yet</h3> <p class="text-sm text-gray-500">Click "New Quotation" to create your first quotation.</p> </div> @endif </div> </div> </div> </div> {{-- Create Quotation Modal --}} <div id="create-quotation-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50"> <div class="relative top-10 mx-auto p-5 border w-full max-w-3xl shadow-lg rounded-md bg-white"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-semibold text-navy">Create New Quotation</h3> <button onclick="document.getElementById('create-quotation-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600"> <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> </button> </div> <form action="{{ route('admin.quotation.store') }}" method="POST" class="space-y-4"> @csrf <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm font-medium text-gray-700">Client</label> <select name="client_id" id="quotation-client" required class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange" onchange="updateClientName()"> <option value="">Select Client</option> @foreach($clients as $client) <option value="{{ $client->id }}" data-name="{{ $client->name }}">{{ $client->name }}</option> @endforeach </select> </div> <div> <label class="block text-sm font-medium text-gray-700">Client Name</label> <input type="text" name="client_name" id="quotation-client-name" required class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange"> </div> <div> <label class="block text-sm font-medium text-gray-700">Company Name</label> <input type="text" name="company_name" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange"> </div> <div> <label class="block text-sm font-medium text-gray-700">Project (Optional)</label> <select name="project_id" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange"> <option value="">Select Project</option> @foreach($projects as $project) <option value="{{ $project->id }}">{{ $project->name }}</option> @endforeach </select> </div> </div> {{-- Quotation Items --}} <div> <label class="block text-sm font-medium text-gray-700 mb-2">Items</label> <div id="quotation-items" class="space-y-3"> <div class="flex gap-3 items-end"> <div class="flex-1"> <input type="text" name="items[0][description]" placeholder="Description" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <div class="w-20"> <input type="number" name="items[0][quantity]" placeholder="Qty" value="1" min="1" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <div class="w-32"> <input type="number" name="items[0][unit_price]" placeholder="Unit Price" step="0.01" min="0" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <button type="button" onclick="this.parentElement.remove()" class="text-red-500 hover:text-red-700 p-2"> <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg> </button> </div> </div> <button type="button" onclick="addQuotationItem()" class="mt-2 text-sm text-orange hover:text-orange-dark font-medium">+ Add Item</button> </div> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm font-medium text-gray-700">Discount (Rs)</label> <input type="number" name="discount" value="0" step="0.01" min="0" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange"> </div> </div> <div> <label class="block text-sm font-medium text-gray-700">Notes</label> <textarea name="notes" rows="2" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange"></textarea> </div> <div> <label class="block text-sm font-medium text-gray-700">Terms & Conditions</label> <textarea name="terms" rows="3" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange" placeholder="Payment terms, validity, etc."></textarea> </div> <div class="flex justify-end gap-3 pt-4 border-t"> <button type="button" onclick="document.getElementById('create-quotation-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">Cancel</button> <button type="submit" class="px-4 py-2 bg-orange text-white rounded-md text-sm font-medium hover:bg-orange-dark">Create Quotation</button> </div> </form> </div> </div> <script> function updateClientName() { const select = document.getElementById('quotation-client'); const nameInput = document.getElementById('quotation-client-name'); const option = select.options[select.selectedIndex]; if (option.value) { nameInput.value = option.dataset.name; } } let itemIndex = 1; function addQuotationItem() { const container = document.getElementById('quotation-items'); const html = ` <div class="flex gap-3 items-end"> <div class="flex-1"> <input type="text" name="items[${itemIndex}][description]" placeholder="Description" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <div class="w-20"> <input type="number" name="items[${itemIndex}][quantity]" placeholder="Qty" value="1" min="1" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <div class="w-32"> <input type="number" name="items[${itemIndex}][unit_price]" placeholder="Unit Price" step="0.01" min="0" required class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-orange focus:border-orange text-sm"> </div> <button type="button" onclick="this.parentElement.remove()" class="text-red-500 hover:text-red-700 p-2"> <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg> </button> </div> `; container.insertAdjacentHTML('beforeend', html); itemIndex++; } </script> </x-app-layout>
Save Changes
Cancel
Create New File
Create New Folder