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 15:23:23 +10:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row" id="catalogContainer">
|
|
|
|
<div class="col-xs-12" data-bind="template:{name:'header'}"></div>
|
|
|
|
<div class="col-xs-6" data-bind="template:{name:'catalog'}"></div>
|
|
|
|
<div
|
|
|
|
id="cartContainer"
|
|
|
|
class="col-xs-6 well hidden"
|
|
|
|
data-bind="template:{name:'cart'}"
|
|
|
|
></div>
|
2021-05-27 14:24:43 +10:00
|
|
|
</div>
|
2021-05-27 15:23:23 +10:00
|
|
|
<div
|
|
|
|
class="row hidden"
|
|
|
|
id="orderContainer"
|
|
|
|
data-bind="template:{name:'order'}"
|
|
|
|
></div>
|
|
|
|
<div data-bind="template: {name:'add-to-catalog-modal'}"></div>
|
|
|
|
<div data-bind="template: {name:'finish-order-modal'}"></div>
|
2021-05-27 14:36:59 +10:00
|
|
|
</div>
|
|
|
|
|
2021-05-27 15:31:01 +10:00
|
|
|
<!-- templates -->
|
2021-05-27 15:43:48 +10:00
|
|
|
<script type="text/html" id="header">
|
|
|
|
<h1>Catalog</h1>
|
|
|
|
|
|
|
|
<button
|
|
|
|
class="btn btn-primary btn-sm"
|
|
|
|
data-toggle="modal"
|
|
|
|
data-target="#addToCatalogModal"
|
|
|
|
>
|
|
|
|
Add New Product
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="btn btn-primary btn-sm"
|
|
|
|
data-bind="click: showCartDetails, css:{ disabled: cart().length < 1}"
|
|
|
|
>
|
|
|
|
Show Cart Details
|
|
|
|
</button>
|
|
|
|
<hr />
|
|
|
|
</script>
|
2022-04-19 22:39:27 +10:00
|
|
|
<script type="text/html" id="catalog">
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-addon">
|
|
|
|
<i class="glyphicon glyphicon-search"></i> Search
|
|
|
|
</span>
|
|
|
|
<input type="text" class="form-control" data-bind="textInput:searchTerm">
|
|
|
|
</div>
|
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Price</th>
|
|
|
|
<th>Stock</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody data-bind="foreach:catalog">
|
2022-04-19 22:55:51 +10:00
|
|
|
<tr data-bind="style:lineColor">
|
2022-04-19 22:39:27 +10:00
|
|
|
<td data-bind="text:name"></td>
|
|
|
|
<td data-bind="text:price"></td>
|
|
|
|
<td data-bind="text:stock"></td>
|
|
|
|
<td>
|
|
|
|
<button class="btn btn-primary" data-bind="click:$parent.addToCart">
|
|
|
|
<i class="glyphicon glyphicon-plus-sign"></i> Add
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td colspan="3">
|
|
|
|
<strong>Items:</strong><span data-bind="text:catalog().length"></span>
|
|
|
|
</td>
|
|
|
|
<td colspan="1">
|
|
|
|
<span data-bind="template:{name: 'cart-widget'}"></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
</table>
|
|
|
|
</script>
|
2021-05-27 15:31:01 +10:00
|
|
|
<script type="text/html" id="add-to-catalog-modal"></script>
|
|
|
|
<script type="text/html" id="cart-widget"></script>
|
|
|
|
<script type="text/html" id="cart-item"></script>
|
|
|
|
<script type="text/html" id="cart"></script>
|
|
|
|
<script type="text/html" id="order"></script>
|
|
|
|
<script type="text/html" id="finish-order-modal"></script>
|
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>
|