Skip to content

Commit

Permalink
Order create issues fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed Jun 18, 2024
1 parent d45960a commit 4472abc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 30 deletions.
22 changes: 19 additions & 3 deletions resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,25 @@
<!-- <i class="fas fa-bell"></i> -->
<!-- <span class="custom-badge"> auth->notifications->unread() </span> -->
</div>
<a href="#" class="h-8 w-8 ml-2 avatar rounded-full p-[2px] ring-1">
<img class="h-8 w-8 ring-1 ring-white rounded-full"
<div class="h-8 w-8 ml-2 avatar rounded-full p-[2px] ring-1 dropdown dropdown-end">
<img tabindex="0" role="button" class="h-8 w-8 ring-1 ring-white rounded-full"
src="{{ auth()->user()->profile_photo }}" alt="{{ auth()->user()->name }}"/>
</a>

<ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow bg-white rounded-lg ring ring-blue-500 ring-opacity-40 w-52">
<li>
<a href="{{ route('profile.edit') }}" class="flex gap-2">
<i class="fas fa-user text-gray-500"></i>
<span>Profile</span>
</a>
</li>
<li>
<a href="{{ route('orders.index') }}" class="flex gap-2">
<i class="fas fa-shopping-bag text-gray-500"></i>
<span>Orders</span>
</a>
</li>
</ul>

</div>
</div>
</div>
52 changes: 29 additions & 23 deletions resources/views/orders/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,41 @@ class="text-black/80 text-[14px] cursor-pointer"
<th class="text-black/80 text-[14px]">Payment</th>
</tr>
</thead>
<tbody>
</table>

<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach($orders as $order)
<tr class="border-b border-gray-100">
<td class="">{{ $order->title }}</td>
<td class="">{{ $order->description }}</td>
<td class="">$ {{ $order->total_price }}</td>
<td class="">
<span
class="rounded-md grid place-items-center px-2 py-1 {{ $order->getStatusClass() }} text-white">
<div class="bg-white flex flex-col justify-between rounded-lg shadow-sm p-4">
<div>
<h3 class="text-lg font-semibold text-gray-800">{{ $order->title }}</h3>
<p class="text-gray-600 mt-2">{{ Str::limit($order->description, 100) }}</p>
</div>
<div class="mt-4 flex gap-2 flex-col">
<div class="flex gap-2">
<div class="w-1/2 bg-green-500 rounded-md p-2">
<p class="text-gray-800 font-semibold">Total Price</p>
<div>
$ {{ $order->total_price }}
</div>
</div>
<span class="inline-block w-1/2 center px-2 py-1 rounded-md {{ $order->getStatusClass() }} text-white">
{{ $order->status }}
</span>
</td>
<td class="flex">
<span
class="rounded-md place-items-center px-2 py-1 {{ $order->isPaid() ? $order->payment->getStatusClass() : 'bg-red-500' }} text-white">
</div>
<div class="flex justify-between items-center">
<span class="inline-block px-2 py-2 rounded-md {{ $order->isPaid() ? $order->payment->getStatusClass() : 'bg-red-500' }} text-white">
{{ $order->isPaid() ? $order->payment->status : 'Not Paid' }}
</span>
<!-- Show payment button if order is not paid -->
@if(!$order->isPaid())
<button wire:click="payOrder({{ $order->id }})"
class="p-2 mx-4 px-4 bg-blue-500 text-white font-semibold rounded-md">
Pay
</button>
@endif
</td>
</tr>
@if(!$order->isPaid())
<a href="{{ route('orders.pay', $order->id) }}" class="ml-2 inline-block bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Pay
</a>
@endif
</div>
</div>
</div>
@endforeach
</tbody>
</table>
</div>

<!-- Pagination -->
<div class="mt-4">
Expand Down
6 changes: 2 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
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');
Route::get('/orders/create/new', OrderCreate::class)->name('orders.create');
Route::get('/orders/pay/{orderId}', OrderPayment::class)->name('orders.pay');
// 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');
Expand All @@ -41,14 +43,10 @@
//Redirect referrals to coming soon page
Route::view('/referrals', 'static.coming-soon')->name('referrals');

Route::get('/orders/create', OrderCreate::class)->name('orders.create');
Route::get('/orders/pay/{orderId}', OrderPayment::class)->name('orders.pay');

Route::get('/payments', VerifyPayments::class)->name('payments.index');
Route::get('/users', ManageUsers::class)->name('users.index');
Route::get('/users/{user}', [ManageUsers::class, 'show'])->name('users.show');

Route::get('/orders/create/new/', AutoOrderCreate::class)->name('orders.create.new');
Route::get('/payments/{paymentId}', VerifyOrderPayment::class)->name('payments.show');
});

Expand Down

0 comments on commit 4472abc

Please sign in to comment.