Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
WebKuliner2021
Project
Overview
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
Tiarro Elprida Tamba
WebKuliner2021
Commits
a58f21eb
Commit
a58f21eb
authored
Feb 27, 2021
by
Tiarro Elprida Tamba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
55bcdf5c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
FoodDetail.vue
WebKuliner/src/views/FoodDetail.vue
+118
-0
No files found.
WebKuliner/src/views/FoodDetail.vue
0 → 100644
View file @
a58f21eb
<
template
>
<div
class=
"food-detail"
>
<Navbar
/>
<div
class=
"container"
>
<!--Breadcrumb-->
<div
class=
"row mt-4"
>
<div
class=
"col"
>
<nav
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
>
<router-link
to=
"/"
class=
"text-dark"
>
Home
</router-link>
</li>
<li
class=
"breadcrumb-item"
>
<router-link
to=
"/foods"
class=
"text-dark"
>
Foods
</router-link>
</li>
<li
class=
"breadcrumb-item active"
aria-current=
"page"
>
Food Order
</li>
</ol>
</nav>
</div>
</div>
<div
class=
"row mt-3"
>
<div
class=
"col-md-6"
>
<img
:src=
"'../assests/images/' + product.gambar"
class=
"img-fluid shadow"
/>
</div>
<div
class=
"col-md-6"
>
<h2>
<strong>
{{
product
.
nama
}}
</strong>
</h2>
<hr
/>
<h4>
Harga :
<strong>
Rp.
{{
product
.
harga
}}
</strong>
</h4>
<form
class=
"mt-4"
v-on:submit
.
prevent
>
<div
class=
"form-group"
>
<label
for=
"jumlah_pemesanan"
>
Jumlah Pesan
</label>
<input
type=
"number"
class=
"form-control"
v-model=
"pesan.jumlah_pemesanan"
/>
</div>
<div
class=
"form-group"
>
<label
for=
"keterangan"
>
Keterangan
</label>
<textarea
v-model=
"pesan.keterangan"
class=
"form-control"
placeholder=
"keterangan seperti : Pedas, Nasi Setengah.."
></textarea>
</div>
<button
type=
"submit"
class=
"btn btn-success"
@
click=
"pemesanan"
>
<b-icon-cart></b-icon-cart>
Pesan
</button>
</form>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
Navbar
from
"../components/Navbar.vue"
;
import
axios
from
"axios"
;
export
default
{
name
:
"FoodDetail"
,
components
:
{
Navbar
,
},
data
()
{
return
{
product
:
{},
pesan
:
{},
};
},
methods
:
{
setProduct
(
data
)
{
this
.
product
=
data
;
},
pemesanan
()
{
if
(
this
.
pesan
.
jumlah_pemesanan
)
{
this
.
$router
.
push
({
path
:
"/keranjang"
})
this
.
pesan
.
products
=
this
.
product
;
axios
.
post
(
"http://localhost:3000/keranjangs"
,
this
.
pesan
)
.
then
(()
=>
{
this
.
$toast
.
success
(
"Sukses Masuk Keranjang."
,
{
type
:
"success"
,
position
:
"top-right"
,
duration
:
3000
,
dismissible
:
true
,
});
})
.
catch
((
err
)
=>
console
.
log
(
err
));
}
else
{
this
.
$toast
.
error
(
"Jumlah Pesanan Harus diisi ."
,
{
type
:
"error"
,
position
:
"top-right"
,
duration
:
3000
,
dismissible
:
true
,
});
}
},
},
mounted
()
{
axios
.
get
(
"http://localhost:3000/products/"
+
this
.
$route
.
params
.
id
)
.
then
((
response
)
=>
this
.
setProduct
(
response
.
data
))
.
catch
((
error
)
=>
console
.
log
(
error
));
},
};
</
script
>
<
style
></
style
>
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