Skip to content
GitLab
Menu
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vasko Mitevski
Playground Admin Panel
Commits
6aeaacdf
Commit
6aeaacdf
authored
11 months ago
by
Vasko Mitevski
Browse files
Options
Download
Plain Diff
Merge branch 'product_handle_finishing' into 'dev'
Product handle finishing See merge request
!7
parents
4b1721f7
8e035bb3
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/views/products/edit.blade.php
+24
-11
resources/views/products/edit.blade.php
resources/views/products/index.blade.php
+46
-22
resources/views/products/index.blade.php
routes/web.php
+9
-4
routes/web.php
with
79 additions
and
37 deletions
+79
-37
resources/views/products/edit.blade.php
+
24
-
11
View file @
6aeaacdf
...
...
@@ -69,25 +69,27 @@
<
div
class
=
"mb-3"
>
<
label
for
=
"size"
class
=
"form-label"
>
Величина
</
label
><
br
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input"
type
=
"checkbox"
id
=
"size_xs"
name
=
"sizes[]"
value
=
"xs"
{{
in_array
(
'xs'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
input
class
=
"form-check-input
size-checkbox-input
"
type
=
"checkbox"
id
=
"size_xs"
name
=
"sizes[]"
value
=
"xs"
{{
in_array
(
'xs'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
label
class
=
"form-check-label"
for
=
"size_xs"
>
XS
</
label
>
</
div
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input"
type
=
"checkbox"
id
=
"size_s"
name
=
"sizes[]"
value
=
"s"
{{
in_array
(
's'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
input
class
=
"form-check-input
size-checkbox-input
"
type
=
"checkbox"
id
=
"size_s"
name
=
"sizes[]"
value
=
"s"
{{
in_array
(
's'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
label
class
=
"form-check-label"
for
=
"size_s"
>
S
</
label
>
</
div
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input"
type
=
"checkbox"
id
=
"size_m"
name
=
"sizes[]"
value
=
"m"
{{
in_array
(
'm'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
input
class
=
"form-check-input
size-checkbox-input
"
type
=
"checkbox"
id
=
"size_m"
name
=
"sizes[]"
value
=
"m"
{{
in_array
(
'm'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
label
class
=
"form-check-label"
for
=
"size_m"
>
M
</
label
>
</
div
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input"
type
=
"checkbox"
id
=
"size_l"
name
=
"sizes[]"
value
=
"l"
{{
in_array
(
'l'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
input
class
=
"form-check-input
size-checkbox-input
"
type
=
"checkbox"
id
=
"size_l"
name
=
"sizes[]"
value
=
"l"
{{
in_array
(
'l'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
label
class
=
"form-check-label"
for
=
"size_l"
>
L
</
label
>
</
div
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input"
type
=
"checkbox"
id
=
"size_xl"
name
=
"sizes[]"
value
=
"xl"
{{
in_array
(
'xl'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
input
class
=
"form-check-input
size-checkbox-input
"
type
=
"checkbox"
id
=
"size_xl"
name
=
"sizes[]"
value
=
"xl"
{{
in_array
(
'xl'
,
json_decode
(
$product
->
size
))
?
'checked'
:
''
}}
>
<
label
class
=
"form-check-label"
for
=
"size_xl"
>
XL
</
label
>
</
div
>
<
span
class
=
"text-danger stock_quantity_exceeded_for_sizes"
></
span
>
@
error
(
'sizes'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
...
...
@@ -102,12 +104,19 @@
</
div
>
<
div
class
=
"mb-3"
>
@
php
$colors
=
[
'black'
,
'white'
,
'yellow'
,
'blue'
,
'green'
,
'red'
,
'pink'
];
@
endphp
<
label
class
=
"form-label"
>
Боја
</
label
><
br
>
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input color-checkbox-input"
type
=
"checkbox"
id
=
"color_black"
name
=
"colors[]"
value
=
"black"
{{
!
is_null
(
$product
->
colors
)
&&
in_array
(
'black'
,
explode
(
','
,
$product
->
colors
))
?
'checked'
:
''
}}
>
<
label
class
=
"black color-checkbox"
for
=
"color_black"
></
label
>
@
foreach
(
$colors
as
$color
)
<
input
class
=
"form-check-input color-checkbox-input mr-2"
type
=
"checkbox"
id
=
"color_{{
$color
}}"
name
=
"colors[]"
value
=
"{{
$color
}}"
{{
!
is_null
(
$product
->
colors
)
&&
in_array
(
$color
,
explode
(
','
,
$product
->
colors
))
?
'checked'
:
''
}}
>
<
label
class
=
"{{
$color
}} color-checkbox"
for
=
"color_{{
$color
}}"
></
label
>
@
endforeach
<
div
id
=
"color-message"
class
=
"text-danger"
></
div
>
</
div
>
<
div
class
=
"form-check form-check-inline"
>
{{
--
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input color-checkbox-input"
type
=
"checkbox"
id
=
"color_white"
name
=
"colors[]"
value
=
"white"
{{
!
is_null
(
$product
->
colors
)
&&
in_array
(
'white'
,
explode
(
','
,
$product
->
colors
))
?
'checked'
:
''
}}
>
<
label
class
=
"white color-checkbox"
for
=
"color_white"
></
label
>
</
div
>
...
...
@@ -130,8 +139,10 @@
<
div
class
=
"form-check form-check-inline"
>
<
input
class
=
"form-check-input color-checkbox-input"
type
=
"checkbox"
id
=
"color_pink"
name
=
"colors[]"
value
=
"pink"
{{
!
is_null
(
$product
->
colors
)
&&
in_array
(
'pink'
,
explode
(
','
,
$product
->
colors
))
?
'checked'
:
''
}}
>
<
label
class
=
"pink color-checkbox"
for
=
"color_pink"
></
label
>
</
div
>
</
div
>
--
}}
</
div
>
<
span
class
=
"text-danger stock_quantity_exceeded_for_colors"
></
span
>
@
error
(
'colors'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
...
...
@@ -167,11 +178,13 @@
@
for
(
$i
=
count
(
$product
->
images
);
$i
<
4
;
$i
++
)
<
div
class
=
"image-upload-box"
>
<
input
type
=
"file"
class
=
"form-control"
accept
=
"image/*"
name
=
"images[]"
>
<
div
class
=
"image-container"
></
div
>
<
div
class
=
"image-container"
>
<
img
class
=
"uploaded-image"
src
=
""
>
</
div
>
<
i
class
=
"fas fa-plus"
></
i
>
</
div
>
@
endfor
</
div
>
</
div
>
</
div
>
@
error
(
'images.*'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
...
...
This diff is collapsed.
Click to expand it.
resources/views/products/index.blade.php
+
46
-
22
View file @
6aeaacdf
...
...
@@ -5,7 +5,7 @@
<
div
class
=
"row"
>
<
div
class
=
"col-12 text-right mt-5"
>
@
if
(
session
(
'success'
))
<
div
class
=
"alert alert-success"
role
=
"alert"
>
<
div
class
=
"alert alert-success
text-center
"
role
=
"alert"
>
{{
session
(
'success'
)
}}
</
div
>
@
endif
...
...
@@ -22,9 +22,14 @@
</
div
>
<
div
class
=
"row"
id
=
"tableView"
>
@
foreach
(
$products
as
$product
)
<
div
class
=
"col-12 col-md-6 col-xl-3 mb-4"
>
<
div
class
=
"card p-4"
>
<
span
class
=
"text-left"
>
{{
$product
->
stock_quantity
}}
</
span
>
<
div
class
=
"col-12 col-md-6 col-xl-4 mb-4"
>
<
div
class
=
"card px-1 py-4"
>
@
if
(
$product
->
stock_quantity
===
1
)
<
div
class
=
"badge badge-warning"
style
=
"position: absolute; top: 0; left: 0;"
>*
само
1
парче
</
div
>
@
endif
@
if
(
$product
->
stock_quantity
===
0
)
<
div
class
=
"badge badge-danger"
style
=
"position: absolute; top: 0; right: 0;"
>
Already
Sold
</
div
>
@
endif
<
div
class
=
"carousel slide"
data
-
ride
=
"carousel"
id
=
"carousel-{{
$product->id
}}"
>
<
div
class
=
"carousel-inner"
>
@
if
(
$product
->
images
->
isEmpty
())
...
...
@@ -33,9 +38,9 @@
</
div
>
@
else
@
foreach
(
$product
->
images
as
$index
=>
$image
)
<
div
class
=
"carousel-item {{
$index
=== 0 ? 'active' : '' }}"
style
=
"
height: 300px;display: flex; justify-content: center; align-items: center
;"
>
<
img
src
=
"{{ Storage::url(
$image->image
) }}"
class
=
"d-block img-fluid rounded"
alt
=
"Product Image"
>
</
div
>
<
div
class
=
"carousel-item {{
$index
=== 0 ? 'active' : '' }}"
style
=
"
position: relative; height: 300px
;"
>
<
img
src
=
"{{ Storage::url(
$image->image
) }}"
class
=
"d-block img-fluid rounded
mx-auto"
style
=
"position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-height: 100%; max-width: 100%; object-fit: contain;
"
alt
=
"Product Image"
>
</
div
>
@
endforeach
@
endif
</
div
>
...
...
@@ -49,21 +54,34 @@
</
a
>
</
div
>
<
div
class
=
"card-body"
>
<
h5
class
=
"card-title text-right"
>
{{
$product
->
name
}}
</
h5
>
<
p
class
=
"card-text text-right"
>
<
strong
>
Available
Colors
:</
strong
>
<
span
class
=
"text-left h2"
>
{{
$product
->
name
}}
</
span
>
<
p
class
=
"card-text mt-3 h5"
>
Боја
:
@
foreach
(
$product
->
productColors
as
$color
)
<
span
class
=
"badge badge-primary"
>
{{
$color
->
color_name
}}
</
span
>
@
endforeach
</
p
>
<
p
class
=
"card-text"
>
<
strong
>
Available
Sizes
:</
strong
>
@
foreach
(
json_decode
(
$product
->
size
)
as
$size
)
<
span
class
=
"badge badge-secondary"
>
{{
strtoupper
(
$size
)
}}
</
span
>
<
span
class
=
""
style
=
"background-color: {{
$color->color_name
}}; margin-right: 5px; padding:8px; display:inline-block;"
></
span
>
@
endforeach
</
p
>
<
p
class
=
"card-text text-right"
><
strong
>
Price
:</
strong
>
{{
$product
->
price
}}
</
p
>
<
a
href
=
"#"
class
=
"btn btn-primary"
>
View
Details
</
a
>
<
div
class
=
"row"
>
<
div
class
=
"col"
>
<
p
class
=
"card-text h5 mt-2"
>
Величина
:
@
foreach
(
json_decode
(
$product
->
size
)
as
$size
)
<
span
class
=
"badge badge-secondary"
>
{{
strtoupper
(
$size
)
}}
</
span
>
@
endforeach
</
p
>
</
div
>
<
div
class
=
"col text-right"
>
<
p
class
=
"card-text h5 mt-3"
>
@
if
(
$product
->
discount_id
&&
$product
->
discount
->
status
===
'active'
)
<
strong
>
Цена
:</
strong
>
<
span
class
=
"original-price text-danger small"
style
=
"text-decoration: line-through;"
>
{{
$product
->
price
}}
ден
.
</
span
>
<
p
class
=
"discounted-price text-success h4"
>
{{
$product
->
price
-
(
$product
->
price
*
(
$product
->
discount
->
percentage
/
100
))
}}
ден
.
</
p
>
@
else
<
strong
>
Цена
:</
strong
>
{{
$product
->
price
}}
ден
.
@
endif
</
p
>
</
div
>
</
div
>
{{
--
<
a
href
=
"#"
class
=
"btn btn-primary"
>
Детален
преглед
</
a
>
--
}}
</
div
>
</
div
>
</
div
>
...
...
@@ -85,8 +103,14 @@
@
endforeach
</
div
>
</
div
>
{{
--
<
div
class
=
"row"
>
<
div
class
=
"col-12"
>
<
nav
aria
-
label
=
"Page navigation"
>
<
ul
class
=
"pagination justify-content-center"
>
{{
$products
->
links
()
}}
</
ul
>
</
nav
>
</
div
>
</
div
>
--
}}
@
endsection
{{
--
original
code
for
retrieving
photos
for
product
--
}}
This diff is collapsed.
Click to expand it.
routes/web.php
+
9
-
4
View file @
6aeaacdf
...
...
@@ -2,6 +2,7 @@
use
Illuminate\Support\Facades\Route
;
use
App\Http\Controllers\ProductController
;
use
App\Http\Controllers\DiscountController
;
use
App\Http\Controllers\Auth\LoginController
;
/*
...
...
@@ -31,13 +32,17 @@
Route
::
put
(
'products/{product}'
,
[
ProductController
::
class
,
'update'
])
->
name
(
'products.update'
);
// discount handling
Route
::
get
(
'/discounts'
,
[
DiscountController
::
class
,
'index'
])
->
name
(
'discounts.index'
);
Route
::
get
(
'/discounts/create'
,
[
DiscountController
::
class
,
'create'
])
->
name
(
'discounts.create'
);
Route
::
post
(
'/discounts'
,
[
DiscountController
::
class
,
'store'
])
->
name
(
'discounts.store'
);
Route
::
get
(
'discounts/{discount}/edit'
,
[
DiscountController
::
class
,
'edit'
])
->
name
(
'discounts.edit'
);
Route
::
put
(
'discounts/{discount}'
,
[
DiscountController
::
class
,
'update'
])
->
name
(
'discounts.update'
);
Route
::
group
([
'middleware'
=>
[
'admin'
,
'super_admin'
]],
function
()
{
});
Route
::
group
([
'middleware'
=>
'super_admin'
],
function
()
{
});
\ No newline at end of file
});
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Projects
Groups
Snippets