From 2d37eb1fb1b8293ec96e1c8cc469a2e4f9771b18 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Wed, 13 Dec 2017 16:43:49 +0100
Subject: [PATCH] Add button to clear register item form

---
 app/static/js/items.js                   | 5 +++++
 app/templates/inventory/create_item.html | 1 +
 2 files changed, 6 insertions(+)

diff --git a/app/static/js/items.js b/app/static/js/items.js
index 70c310f..6c29a67 100644
--- a/app/static/js/items.js
+++ b/app/static/js/items.js
@@ -1,5 +1,10 @@
 $(document).ready(function() {
 
+  $("#clear").click(function() {
+    // clear all select fields
+    $("select").val('');
+  });
+
   var items_table =  $("#items_table").DataTable({
     "ajax": function(data, callback, settings) {
       $.getJSON(
diff --git a/app/templates/inventory/create_item.html b/app/templates/inventory/create_item.html
index fca4dcd..5242386 100644
--- a/app/templates/inventory/create_item.html
+++ b/app/templates/inventory/create_item.html
@@ -28,6 +28,7 @@
     <div class="form-group row">
       <div class="col-sm-10">
         <button type="submit" class="btn btn-primary">Submit</button>
+        <button type="button" class="btn btn-primary" id="clear">Clear</button>
       </div>
     </div>
   </form>
-- 
GitLab