The Coffeshop shop pos system is developed using Spring boot. The project is built to manage sales and transactions. To make a new transaction, fields such as:items type and Drink type, qty needs to be selected. If you like to learn point of sales systems step by step, this is the right place to learn from the beginning. In this tutorial useful for making a point of sales system for a small shops.
First Step Create the Spring boot you have to go the website start.spring.io
above the image shown how to add the dependencies and create project.
after created the project you have to import in to the eclipse.
First step have to create the view page. go to the src/main/resources Folder
expand it you wil have a folder named templates inside the folder you will have to create the index.html.
after created the page you have to paste the code inside the page. you can download images folder and component folder here files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | <html> <head> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> </head> <body> <nav class="navbar navbar-dark bg-dark"> <span class="navbar-brand md-0 h1">Coffee Shop Pos</span> </nav> <div class="row"> <div class="col-sm-3"> <div class="container"> <div class="list-group-item list-group-tem-action active">Item</div> <div class="panel-body bg-dark" style="color: white"> <form id="tbl-project"> <table class="table table-bordered" style="color: white"> <tr> <td> <input type="checkbox" name="pos" value="Nuggets Fries"> <label>Nuggets Fries</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td> <input type="checkbox" name="pos" value="Village Fries"> <label>Village Fries</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td> <input type="checkbox" name="pos" value="Fries"> <label>Fries</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> </table> </form> </div> </div> </div> <div class="col-sm-3"> <div class="container"> <div class="list-group-item list-group-tem-action active">Drinks</div> <div class="panel-body bg-dark" style="color: white"> <form id="tbl-project"> <table class="table table-bordered" style="color: white"> <tr> <td> <input type="checkbox" name="pos" value="Tea"> <label>Tea</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td> <input type="checkbox" name="pos" value="Coffee"> <label>Coffee</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td> <input type="checkbox" name="pos" value="Apple Juice"> <label>Apple Juice</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td> <input type="checkbox" name="pos" value="Orange Juice"> <label>Orange Juice</label> </td> <td> <input type="number" name="qty" id="qty"></td> </tr> <tr> <td colspan="3" align="right"> <input type="button" class="btn btn-info" value="Add" onclick="add()"> </td> </tr> </table> </form> </div> </div> </div> <div class="col-sm-4"> <div class="container"> <div class="list-group-item list-group-tem-action active">Add Products</div> <table id="tbl-item" class="table table-dark table-bordered" cellspacing="0" cellpadding="0" width="100%" align="center"> <thead> <tr> <th>Delete</th> <th>Item</th> <th>Price</th> <th>Qty</th> <th>Total</th> </tr> <tbody> </tbody> </table> </div> </div> <div class="col-sm-2"> <div class="list-group-item list-group-tem-action active">Total</div> <div> <input type="text" style="color: yellow; background: black; font-size: 30px;" id="total" name="total"> </div> <div> <input type="button" class="btn btn-warning" id="reset" name="reset" value="Reset"> </div> </div> </div> <script src="component/jquery/jquery.js"></script> <script src="component/jquery/jquery.min.js"></script> <script> var tot = 0; var total = 0; function add() { $("input[name='pos']:checked").each(function() { let check = $(this).val(); var price = null; if(check == "Nuggets Fries") { price = 12; } else if(check == "Village Fries") { price = 15; } else if(check == "Fries") { price = 20; } else if(check == "Tea") { price = 25; } else if(check == "Coffee") { price = 35; } else if(check == "Apple Juice") { price = 45; } else if(check == "Orange Juice") { price = 50; } var qty = $(this).closest("tr").find('[name="qty"]').val() || 0; tot = qty * price; var table1 = "<tr>"+ "<td><button type='button' name='record' class='btn btn-warning' onclick='deleterow(this)'>Delete</td> " + "<td>" + check + "</td>" + "<td>" + price + "</td>" + "<td>" + qty + "</td>" + "<td>" + tot + "</td>" + "</tr>"; total += Number(tot); $('#total').val(total); $("#tbl-item tbody").append(table1); } ); } function deleterow(e) { total_cost = parseInt($(e).parent().parent().find('td:last').text(),10); total -= total_cost; $('#total').val(total); $(e).parent().parent().remove(); } $('#reset').click(function() { location.reload(); } ); </script> </body> </html> |
After done the view part let moving to Controller part.
Controller
lets select the project folder and right click new->package->com.example.IceCreamInventory. IceController and type package name like this. after created the package inside the package have create controller CoffeeeController.java
Inside the page you have add it
1 2 3 4 5 6 7 8 9 | @Controller public class CoffeeeController { @RequestMapping(value = "/index", method = RequestMethod.GET) public String index() { return "index"; } } |
above code shown when you run the page it will be calling the index action method.
After go to the src/main/resources Folder expand it you will have file application.properties
paste the below code
1 2 3 4 | spring.jpa.hibernate.ddl-auto=none spring.datasource.driver-class-name=com.mysql.jdbc.Driver server.port=9020 |
above code shown only set the port of Spring boot Application.
After go to main page of Spring boot Application above @SpringBootApplication Annotation paste the @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
1 2 3 4 5 6 7 8 9 | @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) @SpringBootApplication public class CoffeeShopApplication { public static void main(String[] args) { SpringApplication.run(CoffeeShopApplication.class, args); } } |
i have attached the video link below. which will do this tutorials step by step.