Commit 702d3ace authored by Artem's avatar Artem

update orders page and change timezone to Kiev

parent 6cc1b92e
......@@ -14,7 +14,7 @@ class ProfileController extends Controller
public function showOrders()
{
$orders = Auth::user()->orders;
$orders = Auth::user()->orders->reverse() ; // ->take(10)
return view('profile.orders', compact('orders'));
}
}
......@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class OrderDetail extends Model
{
protected $fillable = ['order_id', 'product_id', 'ordered_reference', 'ordered_price', 'ordered_qty', 'subtotal_price'];
public function product()
{
return $this->belongsTo(Product::class);
}
}
......@@ -20,5 +20,4 @@ class Product extends Model
{
return route('product.edit', $this);
}
}
......@@ -67,7 +67,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'Europe/Kiev',
/*
|--------------------------------------------------------------------------
......
......@@ -5,3 +5,8 @@
.order-card-header:hover {
cursor: pointer;
}
.subtotal-price {
width: 200px;
text-align: right;
}
<ul class="nav flex-column nav-pills">
<li class="nav-item">
<a class="nav-link {{ Request::url() === route('profile.index') ? 'active' : '' }}"
<a class="nav-link {{ (Request::url() === route('profile.index') || Request::url() === route('profile') ) ? 'active' : '' }}"
href="{{ route('profile.index') }}"
>Personal information</a>
</li>
......
......@@ -17,10 +17,20 @@
<div class="mr-5">Order# {{ $order->id }}</div>
<div>{{ $order->created_at->format('jS F Y G:i') }}</div>
<div class="ml-auto">{{ $order->total_qty }} {{ ($order->total_qty === 1) ? 'item' : 'items' }}, total price {{ $order->total_price }} EUR</div>
</div>
<div class="collapse" id="{{ 'order_' . $order->id }}">
<div class="card-body">Ololo</div>
@foreach($order->products as $product)
<ul class="list-group list-group-flush">
<li class="list-group-item">
<a href="{{ $product->product->path() }}">{{ $product->ordered_reference }}</a>
<div class="d-flex">
<div>{{ $product->ordered_price }} EUR</div>
<div class="ml-auto">{{ $product->ordered_qty }} {{ ($order->ordered_qty === 1) ? 'pc' : 'pcs' }}</div>
<div class="subtotal-price">{{ $product->subtotal_price }} EUR</div>
</div>
</li>
</ul>
@endforeach
</div>
</div>
......
......@@ -38,7 +38,7 @@ Route::prefix('cart')->group(function() {
});
Route::middleware('auth')->prefix('profile')->group(function() {
Route::get('/', 'ProfileController@index')->name('profile.index');
Route::get('/', 'ProfileController@index')->name('profile');
Route::get('/personal', 'ProfileController@index')->name('profile.index');
Route::get('/orders', 'ProfileController@showOrders')->name('profile.orders');
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment