Jelajahi Sumber

Kamera gespeichert, Tasche als Button

robert 2 tahun lalu
induk
melakukan
d470c02b5a
3 mengubah file dengan 24 tambahan dan 2 penghapusan
  1. 5 1
      mobile/css/example.css
  2. 5 1
      mobile/index.php
  3. 14 0
      mobile/js/live_w_locator.js

+ 5 - 1
mobile/css/example.css

@@ -193,7 +193,11 @@ canvas.drawing, canvas.drawingBuffer {
 
 #result_strip .price input {
   width: 100px;
-  font-size: 14pt;
+  font-size: 16pt;
+}
+
+#submit_button, #manual_code, #bag {
+  font-size: 16pt;
 }
 
 @media (max-width: 603px) {

+ 5 - 1
mobile/index.php

@@ -32,7 +32,7 @@
           <fieldset class="reader-config-group">
             <label>
                 <span>Camera</span>
-                <select name="input-stream_constraints" id="deviceSelection">
+                <select name="input-stream_constraints" id="deviceSelection" tabindex="-1">
                 </select>
             </label>
            </fieldset>
@@ -50,6 +50,10 @@
                     </button>
                 </div>
                 <br/><br/>
+                <button id="bag" tabindex="-1" >
+                        <i class="glyphicon glyphicon-gift"></i> Tasche
+                    </button>
+                <br/><br/>
                 Rechnung abschlie&szlig;en &nbsp;
                 <input type="submit" id="submit_button" value="senden" />
             </form>

+ 14 - 0
mobile/js/live_w_locator.js

@@ -1,6 +1,9 @@
 $(function() {
     var App = {
         init : function() {
+            if (localStorage.getItem('deviceId') !== null) {
+                this.state.inputStream.constraints.deviceId = localStorage.getItem('deviceId');
+            }
             Quagga.init(this.state, function(err) {
                 if (err) {
                     console.log(err);
@@ -92,6 +95,7 @@ $(function() {
                     name = $target.attr("name"),
                     state = self._convertNameToState(name);
 
+                localStorage.setItem('deviceId', value);
                 console.log("Value of "+ state + " changed to " + value);
                 self.setState(state, value);
             });
@@ -104,6 +108,14 @@ $(function() {
                 }
             });
 
+            $("#bag").on("click", function(e) {
+                e.preventDefault();
+                var code = "123-456";
+                if (self.addCode(code)) {
+                    $("input[name='123-456']").val("1");
+                }
+            });
+
             $("#submit_button").on("click", function(e) {
                 $(".price input").each(function() {
                     if ($(this).val() <= 0 || $(this).val() == "") {
@@ -190,6 +202,8 @@ $(function() {
                 $(".btn-close").on("click", function(e) {
                     e.preventDefault();
                     e.target.parentNode.parentNode.parentNode.remove();
+                    App.results = $(".price input").map(function () { return this.name; }).get();
+                    console.log(App.results);
                 });
                 return true;
             }