2021-05-27 11:29:14 +10:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
2021-05-27 11:49:42 +10:00
|
|
|
<head>
|
|
|
|
<title>KO Shopping Cart</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
2021-05-27 13:57:20 +10:00
|
|
|
<h1>Catalog</h1>
|
2021-05-27 14:22:28 +10:00
|
|
|
|
|
|
|
<form class="form-horizontal" role="form" data-bind="with:newProduct">
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-12">
|
2021-05-27 14:24:43 +10:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
class="form-control"
|
|
|
|
placeholder="Name"
|
|
|
|
data-bind="textInput:name"
|
|
|
|
/>
|
2021-05-27 14:22:28 +10:00
|
|
|
</div>
|
2021-05-27 14:24:43 +10:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<input
|
|
|
|
type="password"
|
|
|
|
class="form-control"
|
|
|
|
placeholder="Price"
|
|
|
|
data-bind="textInput:price"
|
|
|
|
/>
|
2021-05-27 14:22:28 +10:00
|
|
|
</div>
|
2021-05-27 14:24:43 +10:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<input
|
|
|
|
type="password"
|
|
|
|
class="form-control"
|
|
|
|
placeholder="Stock"
|
|
|
|
data-bind="textInput:stock"
|
|
|
|
/>
|
2021-05-27 14:22:28 +10:00
|
|
|
</div>
|
2021-05-27 14:24:43 +10:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
class="btn btn-default"
|
|
|
|
data-bind="{click:$parent.addProduct}"
|
|
|
|
>
|
|
|
|
<i class="glyphicon glyphicon-plus-sign"> </i> Add Product
|
2021-05-27 14:22:28 +10:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
2021-05-27 13:57:20 +10:00
|
|
|
<strong>Items:</strong>
|
2021-05-27 14:22:28 +10:00
|
|
|
<span data-bind="text:catalog().length"></span>
|
2021-05-27 13:57:20 +10:00
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Price</th>
|
|
|
|
<th>Stock</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody data-bind="foreach:catalog">
|
|
|
|
<tr>
|
|
|
|
<td data-bind="text:name"></td>
|
|
|
|
<td data-bind="text:price"></td>
|
|
|
|
<td data-bind="text:stock"></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-05-27 12:03:06 +10:00
|
|
|
|
|
|
|
<!-- vendor library -->
|
2021-05-27 11:49:42 +10:00
|
|
|
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
|
|
|
|
<script type="text/javascript" src="js/bootstrap.js"></script>
|
|
|
|
<script type="text/javascript" src="js/knockout-3.2.0.js"></script>
|
2021-05-27 12:03:06 +10:00
|
|
|
<!-- app -->
|
2021-05-27 12:46:22 +10:00
|
|
|
<script type="text/javascript" src="js/models/product.js"></script>
|
2021-05-27 12:03:06 +10:00
|
|
|
<script type="text/javascript" src="js/viewmodel.js"></script>
|
2021-05-27 11:49:42 +10:00
|
|
|
</body>
|
|
|
|
</html>
|