Skip to content

Commit

Permalink
Order edit create page and list as coming soon
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed Jun 17, 2024
1 parent 63e4d22 commit d45960a
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/Livewire/OrderCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function removeAttachment($name): void

// Confirm that the attachment was removed
if (count($this->attachments) === $initialCount) {
dd('Attachment not found');
session()->flash('error', 'Attachment not found.');
}

//Convert the collection back to an array
Expand Down
13 changes: 13 additions & 0 deletions app/Livewire/OrderEdit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire;

use Livewire\Component;

class OrderEdit extends Component
{
public function render()
{
return view('livewire.order-edit');
}
}
3 changes: 3 additions & 0 deletions resources/views/livewire/order-edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
{{-- If you look to others for fulfillment, you will never truly be fulfilled. --}}
</div>
2 changes: 1 addition & 1 deletion resources/views/messages.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class="btn h-12 w-12 rounded-md text-white btn-primary drawer-button md:hidden">
<label for="my-drawer-clients" aria-label="close sidebar"
class="drawer-overlay"></label>
<!-- Search -->
<div class="bg-white w-72 p-2 pt-4 md:pt-2 flex flex-col gap-3">
<div class="bg-white w-[300px] pt-4 md:pt-4 flex flex-col gap-3">
<div class="flex md:sticky flex-col rounded-lg">
<div class="flex w-full relative gap-3 bg-gray-100 rounded-lg">
<input name="search" id="searchInput" type="text" wire:model.live="search"
Expand Down
92 changes: 70 additions & 22 deletions resources/views/orders/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,32 @@
<div class="rounded-lg relative p-4 w-full bg-white">
<h2 class="text-2xl font-semibold mb-6">Order Details</h2>

<div class="mb-4">
<h3 class="text-lg font-semibold">Order Information</h3>
<p><strong>Title:</strong> {{ $order->title }}</p>
<p><strong>Description:</strong> {{ $order->description }}</p>
<p><strong>Status:</strong> <span
class="{{ $order->getStatusClass() }}">{{ ucfirst($order->status) }}</span></p>
<p><strong>Total Price:</strong> ${{ number_format($order->total_price, 2) }}</p>
<div class="bg-white p-6 grid grid-cols-2 rounded-lg shadow-sm mb-6">
<div class="flex items-center mb-4">
<i class="fas fa-info-circle text-blue-500 text-xl mr-2"></i>
<h3 class="text-lg font-semibold">Order Information</h3>
</div>
<div class="mb-4">
<i class="fas fa-tag text-gray-500 mr-2"></i>
<span class="font-bold">Title:</span> {{ $order->title }}
</div>
<div class="mb-4">
<i class="fas fa-align-left text-gray-500 mr-2"></i>
<span class="font-bold">Description:</span> {{ $order->description }}
</div>
<div class="mb-4">
<i class="fas fa-tasks text-gray-500 mr-2"></i>
<span class="font-bold">Status:</span>
<span class="{{ $order->getStatusClass() }} px-2 py-1 rounded">{{ ucfirst($order->status) }}</span>
</div>
<div class="mb-4">
<i class="fas fa-dollar-sign text-gray-500 mr-2"></i>
<span class="font-bold">Total Price:</span> ${{ number_format($order->total_price, 2) }}
</div>
</div>

<div class="mb-4">
<h3 class="text-lg font-semibold">Attachments</h3>
<div class="bg-white p-6 rounded-lg shadow-sm mb-6">
<h3 class="text-lg md:text-xl mb-4 font-semibold">Attachments</h3>
@if ($order->attachments->isNotEmpty())
<ul>
<div class="flex w-full flex-wrap gap-3">
Expand Down Expand Up @@ -77,31 +92,64 @@ class="absolute top-0 btn btn-xs btn-circle btn-ghost bg-blue-500 right-0 mt-1 m
@endif
</div>

<div class="mb-4">
<h3 class="text-lg font-semibold">Payment Information</h3>
<div class="bg-white p-6 rounded-lg shadow-sm mb-6">
<div class="flex items-center mb-4">
<i class="fas fa-credit-card text-blue-500 text-xl mr-2"></i>
<h3 class="text-lg font-semibold">Payment Information</h3>
</div>
@if ($order->isPaid())
<p><strong>Amount Paid:</strong> ${{ number_format($order->payment->amount, 2) }}</p>
<p><strong>Payment Method:</strong> {{ ucfirst($order->payment->payment_method) }}</p>
<p><strong>Payment Status:</strong> <span
class="{{ $order->payment->getStatusClass() }}">{{ ucfirst($order->payment->status) }}</span>
</p>
<div class="mb-2">
<i class="fas fa-dollar-sign text-gray-500 mr-2"></i>
<span class="font-bold">Amount Paid:</span> ${{ number_format($order->payment->amount, 2) }}
</div>
<div class="mb-2">
<i class="fas fa-money-check-alt text-gray-500 mr-2"></i>
<span class="font-bold">Payment Method:</span> {{ ucfirst($order->payment->payment_method) }}
</div>
<div class="mb-2">
<i class="fas fa-info-circle text-gray-500 mr-2"></i>
<span class="font-bold">Payment Status:</span>
<span class="{{ $order->payment->getStatusClass() }} px-2 py-1 rounded">{{ ucfirst($order->payment->status) }}</span>
</div>
@else
<p>Payment not yet made.</p>
<div class="mb-2">
<i class="fas fa-exclamation-triangle text-red-500 mr-2"></i>
<span class="font-bold">Payment not yet made.</span>
</div>
@endif
</div>

<div class="mb-4">
<h3 class="text-lg font-semibold">Delivery Information</h3>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<i class="fas fa-truck text-green-500 text-xl mr-2"></i>
<h3 class="text-lg font-semibold">Delivery Information</h3>
</div>
@if ($order->delivery->isNotEmpty())
<ul>
<ul class="list-disc pl-6">
@foreach ($order->delivery as $delivery)
<li>{{ $delivery->details }}</li>
<li class="mb-2">{{ $delivery->details }}</li>
@endforeach
</ul>
@else
<p>Not yet delivered.</p>
<div class="mb-2">
<i class="fas fa-times-circle text-red-500 mr-2"></i>
<span class="font-bold">Not yet delivered.</span>
</div>
@endif
</div>

<div class="links mt-2 gap-4 flex items-center justify-end">
<a href="{{ route('orders.edit', $order) }}"
class="btn btn-md btn-ghost ring ring-gray-200 mt-6">
<i class="fas fa-edit"></i>
<span>Edit Order</span>
</a>
<a href="{{ route('orders.index') }}"
class="btn btn-md btn-ghost ring ring-blue-500 mt-6">
<i class="fas fa-arrow-left"></i>
<span>Back to Orders</span>
</a>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Livewire\OrderCreate;
use App\Livewire\Dashboard;
use App\Livewire\Messages;
use App\Livewire\OrderEdit;
use App\Livewire\OrderPayment;
use App\Livewire\Orders;
use App\Livewire\OrderShow;
Expand All @@ -30,6 +31,10 @@
Route::get('/messages', Messages::class)->name('messages');
Route::get('/orders', OrderShow::class)->name('orders.index');
Route::get('/orders/{order}', [PagesController::class, 'show_order'])->name('orders.show');
// TODO: Fix the order edit function
//Route::get('/orders/{order}/edit', OrderEdit::class)->name('orders.edit');
Route::view('/orders/{order}/edit', 'static.coming-soon')->name('orders.edit');

// TODO: Fix the referral function system
//Route::get('/referrals', Referrals::class)->name('referrals');

Expand Down

0 comments on commit d45960a

Please sign in to comment.