Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
T
test-webshop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem
test-webshop
Commits
702d3ace
Commit
702d3ace
authored
May 14, 2020
by
Artem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update orders page and change timezone to Kiev
parent
6cc1b92e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
7 deletions
+26
-7
ProfileController.php
app/Http/Controllers/ProfileController.php
+1
-1
OrderDetail.php
app/OrderDetail.php
+5
-0
Product.php
app/Product.php
+0
-1
app.php
config/app.php
+1
-1
orders.css
public/css/profile/orders.css
+5
-0
profile-nav.blade.php
resources/views/partials/profile-nav.blade.php
+1
-1
orders.blade.php
resources/views/profile/orders.blade.php
+12
-2
web.php
routes/web.php
+1
-1
No files found.
app/Http/Controllers/ProfileController.php
View file @
702d3ace
...
...
@@ -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'
));
}
}
app/OrderDetail.php
View file @
702d3ace
...
...
@@ -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
);
}
}
app/Product.php
View file @
702d3ace
...
...
@@ -20,5 +20,4 @@ class Product extends Model
{
return
route
(
'product.edit'
,
$this
);
}
}
config/app.php
View file @
702d3ace
...
...
@@ -67,7 +67,7 @@ return [
|
*/
'timezone'
=>
'
UTC
'
,
'timezone'
=>
'
Europe/Kiev
'
,
/*
|--------------------------------------------------------------------------
...
...
public/css/profile/orders.css
View file @
702d3ace
...
...
@@ -5,3 +5,8 @@
.order-card-header
:hover
{
cursor
:
pointer
;
}
.subtotal-price
{
width
:
200px
;
text-align
:
right
;
}
resources/views/partials/profile-nav.blade.php
View file @
702d3ace
<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>
...
...
resources/views/profile/orders.blade.php
View file @
702d3ace
...
...
@@ -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>
...
...
routes/web.php
View file @
702d3ace
...
...
@@ -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'
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment