Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mujahid Rofiq
sistempos_finaltask
Commits
7000c83f
Commit
7000c83f
authored
9 months ago
by
arneyva
Browse files
Options
Download
Email Patches
Plain Diff
fixing revisi qrcode after sidang
parent
bedb31d8
main
dev-eth
dev-ropiq
1 merge request
!331
fixing revisi qrcode after sidang
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Http/Controllers/Product/ProductController.php
+16
-0
app/Http/Controllers/Product/ProductController.php
resources/views/templates/product/show.blade.php
+12
-29
resources/views/templates/product/show.blade.php
with
28 additions
and
29 deletions
+28
-29
app/Http/Controllers/Product/ProductController.php
View file @
7000c83f
...
...
@@ -533,6 +533,14 @@ public function show(string $id)
$item
[
'type'
]
=
$product
->
type
;
$item
[
'image'
]
=
$product
->
image
??
'no-image.png'
;
$item
[
'code'
]
=
$product
->
code
;
// buat QR Code
$qrCode
=
QrCode
::
create
(
$product
->
code
)
->
setEncoding
(
new
Encoding
(
'ISO-8859-1'
))
->
setErrorCorrectionLevel
(
ErrorCorrectionLevel
::
Low
)
->
setSize
(
125
)
->
setMargin
(
10
);
// Simpan data URI QR Code dalam item array
$item
[
'qrCode'
]
=
(
new
PngWriter
())
->
write
(
$qrCode
)
->
getDataUri
();
$item
[
'Type_barcode'
]
=
$product
->
Type_barcode
;
$item
[
'name'
]
=
$product
->
name
;
$item
[
'cost'
]
=
'Rp '
.
number_format
(
$product
->
cost
,
2
,
','
,
'.'
);
...
...
@@ -555,6 +563,14 @@ public function show(string $id)
$productVariants
=
ProductVariant
::
where
(
'product_id'
,
$product
->
id
)
->
where
(
'deleted_at'
,
'='
,
null
)
->
get
();
foreach
(
$productVariants
as
$variant
)
{
$ProductVariant
[
'code'
]
=
$variant
->
code
;
// buat QR Code
$qrCodeVariant
=
QrCode
::
create
(
$variant
->
code
)
->
setEncoding
(
new
Encoding
(
'ISO-8859-1'
))
->
setErrorCorrectionLevel
(
ErrorCorrectionLevel
::
Low
)
->
setSize
(
75
)
->
setMargin
(
10
);
// Simpan data URI QR Code dalam item array
$ProductVariant
[
'qrCodeVariant'
]
=
(
new
PngWriter
())
->
write
(
$qrCodeVariant
)
->
getDataUri
();
$ProductVariant
[
'name'
]
=
$variant
->
name
;
$ProductVariant
[
'cost'
]
=
'Rp '
.
number_format
(
$variant
->
cost
,
2
,
','
,
'.'
);
$ProductVariant
[
'price'
]
=
'Rp '
.
number_format
(
$variant
->
price
,
2
,
','
,
'.'
);
...
...
This diff is collapsed.
Click to expand it.
resources/views/templates/product/show.blade.php
View file @
7000c83f
...
...
@@ -59,7 +59,8 @@ class="form-control"
id
=
"discount_percentagevariant{{
$variant['variant-id']
}}_{{
$variant['mag']
}}"
class
=
"form-control"
style
=
"padding: 7px; border-radius: 7px; background-color: #eff3ff; color: #3b39d0;"
value
=
"{{
$variant['discount_percentage']
?? 0 }}"
min
=
"0"
max
=
"100"
>
value
=
"{{
$variant['discount_percentage']
?? 0 }}"
min
=
"0"
max
=
"100"
>
</
div
>
<
div
class
=
"form-group input-group"
>
<
span
class
=
"input-group-text"
id
=
"basic-addon1"
><
svg
...
...
@@ -105,7 +106,8 @@ class="form-control"
<
input
type
=
"number"
name
=
"discount_percentage[{{
$qty['mag']
}}]"
id
=
"discount_percentage{{
$qty['mag']
}}"
class
=
"form-control"
style
=
"padding: 7px; border-radius: 7px; background-color: #eff3ff; color: #3b39d0;"
value
=
"{{
$qty['discount_percentage']
?? 0 }}"
min
=
"0"
max
=
"100"
>
value
=
"{{
$qty['discount_percentage']
?? 0 }}"
min
=
"0"
max
=
"100"
>
</
div
>
<
div
class
=
"form-group input-group"
>
<
span
class
=
"input-group-text"
id
=
"basic-addon1"
><
svg
...
...
@@ -144,20 +146,6 @@ class="form-control"
<
div
class
=
"header-title"
>
<
h4
class
=
"card-title"
>
{{
__
(
'Product Information'
)
}}
</
h4
>
</
div
>
<
span
style
=
"text-align: center; vertical-align: middle;margin-top: 30px"
>
@
php
$generatorPNG
=
new
Picqer\Barcode\BarcodeGeneratorPNG
();
$barcodeData
=
base64_encode
(
$generatorPNG
->
getBarcode
(
$data
[
0
][
'code'
],
$generatorPNG
::
TYPE_CODE_128
),
);
$barcodeUrl
=
'data:image/png;base64,'
.
$barcodeData
;
@
endphp
<
div
style
=
"display: flex; flex-direction: column; align-items: center;"
>
<
img
src
=
"{{
$barcodeUrl
}}"
alt
=
"Barcode"
style
=
"margin-bottom: 5px;"
>
<
span
>
{{
$data
[
0
][
'code'
]
}}
</
span
>
</
div
>
</
span
>
<
a
href
=
"#"
><
button
type
=
"button"
class
=
"btn btn-soft-primary"
>
Print
</
button
></
a
>
</
div
>
<
div
class
=
"card-body"
>
<
div
class
=
"table-responsive mt-4"
>
...
...
@@ -177,7 +165,13 @@ class="form-control"
@
else
<
td
>
{{
__
(
'Code Base Product'
)
}}
</
td
>
@
endif
<
th
>
{{
$data
[
0
][
'code'
]
}}
</
th
>
<
th
>
<
div
style
=
"display: flex; flex-direction: column; align-items: center;"
>
<
img
src
=
"{{
$data[0]['qrCode']
}}"
alt
=
"QR Code"
style
=
"margin-bottom: 5px;"
>
<
span
>
{{
$data
[
0
][
'code'
]
}}
</
span
>
</
div
>
</
th
>
</
tr
>
<
tr
>
<
td
>
{{
__
(
'Category'
)
}}
</
td
>
...
...
@@ -237,20 +231,9 @@ class="form-control"
@
foreach
(
$data
[
0
][
'products_variants_data'
]
as
$variant
)
<
tr
>
<
td
>
{{
$variant
[
'name'
]
}}
</
td
>
{{
--
<
td
>
{{
$variant
[
'code'
]
}}
</
td
>
--
}}
<
td
style
=
"text-align: center; vertical-align: middle;"
>
@
php
$generatorPNG
=
new
Picqer\Barcode\BarcodeGeneratorPNG
();
$barcodeData
=
base64_encode
(
$generatorPNG
->
getBarcode
(
$variant
[
'code'
],
$generatorPNG
::
TYPE_CODE_128
,
),
);
$barcodeUrl
=
'data:image/png;base64,'
.
$barcodeData
;
@
endphp
<
div
style
=
"display: flex; flex-direction: column; align-items: center;"
>
<
img
src
=
"{{
$
b
ar
codeUrl
}}"
alt
=
"
Barc
ode"
<
img
src
=
"{{
$
v
ar
iant['qrCodeVariant']
}}"
alt
=
"
QR C
ode"
style
=
"margin-bottom: 5px;"
>
<
span
>
{{
$variant
[
'code'
]
}}
</
span
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help