From e8406638b2d36ce42612f68f3b08385bad99ba49 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Tue, 6 Feb 2018 20:49:34 +0100
Subject: [PATCH] Add codes to configure the scanner

---
 app/inventory/views.py                        |   7 ++
 app/static/img/activate-custom-defaults.png   | Bin 0 -> 326 bytes
 app/static/img/daytime-mode.png               | Bin 0 -> 673 bytes
 .../img/silent-mode-with-flashing-led.png     | Bin 0 -> 514 bytes
 app/static/img/usb-keyboard-mac.png           | Bin 0 -> 343 bytes
 app/static/img/usb-keyboard-pc.png            | Bin 0 -> 339 bytes
 app/static/img/usb-serial.png                 | Bin 0 -> 356 bytes
 app/templates/base-fluid.html                 |   2 +
 app/templates/inventory/scanner.html          |  66 ++++++++++++++++++
 9 files changed, 75 insertions(+)
 create mode 100644 app/static/img/activate-custom-defaults.png
 create mode 100644 app/static/img/daytime-mode.png
 create mode 100644 app/static/img/silent-mode-with-flashing-led.png
 create mode 100644 app/static/img/usb-keyboard-mac.png
 create mode 100644 app/static/img/usb-keyboard-pc.png
 create mode 100644 app/static/img/usb-serial.png
 create mode 100644 app/templates/inventory/scanner.html

diff --git a/app/inventory/views.py b/app/inventory/views.py
index 5c84360..77ec12e 100644
--- a/app/inventory/views.py
+++ b/app/inventory/views.py
@@ -245,3 +245,10 @@ def retrieve_attributes_name(kind):
     items = db.session.query(model).order_by(model.name)
     data = [(item.name, item.description) for item in items]
     return jsonify(data=data)
+
+
+@bp.route('/scanner')
+@login_required
+def scanner():
+    """Render the scanner setup codes"""
+    return render_template('inventory/scanner.html')
diff --git a/app/static/img/activate-custom-defaults.png b/app/static/img/activate-custom-defaults.png
new file mode 100644
index 0000000000000000000000000000000000000000..7966ad23efad7dd678ef1fdaaeede754c6855f84
GIT binary patch
literal 326
zcmeAS@N?(olHy`uVBq!ia0vp^vw+x;5lAp_#rIAJQY`6?zK#qG8~eHcB(eheOiAAE
zE)0x!yM&hjd7K3vk;M!Q+(IDCc<FB4AD|$6iKnkC`y(bceio6vl3o{qLaClEjv*GO
zlYi9js#<t|_l@G$r>5Rf-ktJyUiTmS0|r_aS{~7kJ`TGcH1i96+A9AfkoErb|Npjs
zm!Ea&`|VD#I|_-_;@zkA-(ac#kR<r$ubA_OKi|Kvf6>Hm=TZOv(D%79`-4LT7?KaH
zKat}<`8Ci&)e_f;l9a@fRIB8oR3OD*WMF8aYha{nU>0I%W@TVvWn!#tU}$AvaF^jX
mCyIvL{FKbJN)!zyAPq(a5DnICPoDraFnGH9xvX<aXaWGm+ix-e

literal 0
HcmV?d00001

diff --git a/app/static/img/daytime-mode.png b/app/static/img/daytime-mode.png
new file mode 100644
index 0000000000000000000000000000000000000000..18ded2d087cbf0b707aabc07bbe380e1063cb7fa
GIT binary patch
literal 673
zcmV;S0$%-zP)<h;3K|Lk000e1NJLTq002q=002q|0ssI2ld@GN00009a7bBm000XT
z000XT0n*)m`~Uy~Q%OWYRCwC$n@f(vFbqTELGOR%bT<fKh<%i@3gcDbwoYrB67}&q
zigBLjaU5%{|JT=Xo#(H~%GdSv@2S?j&ioyZ9_#vFcVsH8G!E6?S14&@^g8+!JRH3b
z*-OIA{qs8xJ;v&F^zVN<_sD79`8Khlnt`qr)n_V|d)3Yn`=+_Kp8^+ceU5@G=i<tM
z@0shVDpU!En*UGd9#<!NN4bLGHj}SYJw26sdZywYv4MJhGEcNi271JU>7gwfj{}Gb
z;WjfVVjwn3pK{_M36nL>Ra{d2iwyL%mvf^mqWy`#b+uGpuBGRlCW?`t0$0cE-%ZMt
z5govF;Jw4uD|yj+wL@Ilkl3sjxoJ<B>i4)d=Mi_0lRS?`Y;^|r+#IHx$>w|`h`9(S
zaZe-JvyE;Zt@6V>OOWLExQg#(AW5u9@?X~(UNcIH)(IwVC4j^VZk~qMq>`d_H)G{y
z*<7pZ#)NNuuhu9%>o<=K-OSpX=j>*(?ur0)K9jtggr4?Gq|4-9zHxTxXQlSF5Zopz
z)Kw~)W1-wbc}{)G=M_StT1eEAT4Uhqo<#I+<iY)|Td_!r)`?E%2=uZnn&JCXH2yF5
zW)^jV%)~2ZYtBiIjB7%EB1m2F?WJaVzo#d9N|JXO#&K`;@X?s`Itz&^;vFp++~amh
zqdMu^b35t@Gm~zBx!DdK%lG`=gvr&KNuBUq-Br8Ad#T;(Jii~9RAad7&fcUp*t<hU
z>VEIt*<Y%H-%D_Pplg}q`Z+)MD#jm21>ivX)Ohaa;plw<>Jamw(Vh5k00000NkvXX
Hu0mjfLiAJ+

literal 0
HcmV?d00001

diff --git a/app/static/img/silent-mode-with-flashing-led.png b/app/static/img/silent-mode-with-flashing-led.png
new file mode 100644
index 0000000000000000000000000000000000000000..dd81eafc436de1ec46ab7eeeb040932445816f11
GIT binary patch
literal 514
zcmV+d0{#7oP)<h;3K|Lk000e1NJLTq002G!002G+0ssI2{G&e;00009a7bBm000XT
z000XT0n*)m`~Uy}v`IukRA}Dan!ygkFbG4NssI1W-C>tVDb|B@m2gf~8l{^7V@Sra
zjO)6NyD`SNUHO}zpVxinHPKl2S)b?eIogh)5sDDiR*JCa*3&Edqpm$W!Yqp=pW)W<
zMV)g6K`t91de8n0!+BbBj*g95W{B+H81*ya(a6uDk@bFJllAR9<LK)IW1=)Py4f$f
zXc!&E#CN&fbbcVpao)Kz!w^2Mv5JlXtq{p?@bdMnhJJQL-*WWzS~aQPBBNuDUsrZU
zom8LNziZx4G^WllUcO$_kKFGyoAG*}zh0mJE6J?2s34ZndDn|!xN@jzYaTO1&-7;)
z!sxvJnAM)y`pcv?J+nQNoqSot+mY9GRZ0}azN#Vm(Tibf{i^pByf4FO{WvR}$QPfg
zN9UR7*|87vW`)YX<<;rU^7p^HF@)K?PVh+Amvj8SE^@ykkUiTcIic2vA$E2-!Q*~L
z&?P5F*%NA)n;BWJ<-9?9h_(9FvHP{7%X#mh)|v6Gk|KQ^p;bHc=d5DL>!Zf&**l3l
zm1q=8j(R<Nvct1MHUmVF(4S$Ry_J<!kwh=8D;uN!1#^H~l-Bd)jQ{`u07*qoM6N<$
Ef{A<uivR!s

literal 0
HcmV?d00001

diff --git a/app/static/img/usb-keyboard-mac.png b/app/static/img/usb-keyboard-mac.png
new file mode 100644
index 0000000000000000000000000000000000000000..7c0e592d8ad6da50831feab11ca5d7a1796b142f
GIT binary patch
literal 343
zcmeAS@N?(olHy`uVBq!ia0vp^vw+x;5lAp_#rIAJQY`6?zK#qG8~eHcB(eheOiAAE
zE)0x!yM&hjd7K3vk;M!Q+(IDCc<FB4AD|$6iKnkC`y(bceio6vl3o{qLS>#Vjv*GO
zlYi9js#>_<o6Pjy$xH9#m7Nq@)&0l*fPt2UmPfRskHfA9?7yY{*@}Hz(RBa)+rN3W
zzwO%|Z2ud<vj6@5KD~<X@4o*Pe|1r3)851T>wnjoOtr80|9-u@_@BSu{_p$$qUrwr
zf9z4Mnme2q&579`94f#N^10=D`!ao1pbJz>Tq8<S5=&C8l8aJ-6oZk0p@pu2k*<MR
zh@qL4fw7gbnYMwUm4QLJ;<0lm8glbfGSeziG?-W!m{=JZKr~plJ$(Yyz~JfX=d#Wz
Gp$P!+mU{~T

literal 0
HcmV?d00001

diff --git a/app/static/img/usb-keyboard-pc.png b/app/static/img/usb-keyboard-pc.png
new file mode 100644
index 0000000000000000000000000000000000000000..0b07645cfadd09b51db53a2a1e2bfe89ff83a9d9
GIT binary patch
literal 339
zcmeAS@N?(olHy`uVBq!ia0vp^vw+x;5lAp_#rIAJQY`6?zK#qG8~eHcB(eheOiAAE
zE)0x!yM&hjd7K3vk;M!Q+(IDCc<FB4AD|$6iKnkC`y(bceio6vl3o{qLPee~jv*GO
zlYi9js#>_<o6Pjy$xDlrcBibJ*Zs%-fPt2UmPfRskHfA9?7yY{*?#-FqUrwow}10$
z`GY^)uG49{|NXwJ_?~L<;1A7jW&i!%eKGXkgTMRtOT~Wpe*6D#yBmu+>;C_$fB(PA
z=b-GTr%!&(UDd?kKCAsF_pb0}pzW$9t`Q|Ei6yC4$wjF^iowXh&_dV1NY}tD#L&#j
zz}U*zOxwWF%D^C9@z^;O4Y~O#nQ4_M8ceJVOstFyAR4UOo<0F;VDNPHb6Mw<&;$Tm
CpnBK<

literal 0
HcmV?d00001

diff --git a/app/static/img/usb-serial.png b/app/static/img/usb-serial.png
new file mode 100644
index 0000000000000000000000000000000000000000..5cb1ffa7bb2ba96bb987e9c15b95e126ef077727
GIT binary patch
literal 356
zcmeAS@N?(olHy`uVBq!ia0vp^yMfq{5lAqsI`Fg-NU@|l`Z_W&Z0zU$lgJ9>GbMSu
zyD%``?Gj!B<Z%{wL>4nJa0`Jj<E6WGe}IDQC7!;n?2nk(_*q2uN_t%c3N?GWIEGl9
zPX1B9t7_q=qVR{EPF4E(b7JO9DV~!5=-Iko>^zHw77HErXR=m^f5hMZ=6)@|+!Z^U
zo^^|VojqUs{d4)f+ugBAukC$0w=ezuZvXx6*he3mZ}m$EiEhgN{`cUj<oCB~|9{@-
zc_)^8i_GdHcXvB*>YS^s{%&}q`L`yo_AD<31}h0&))@wZRzT;dmbgZgq$HN4S|t~y
z0x1R~149d410!7nvk*fwD+6OIV>4|7Ln{M=bj4%mP&DM`r(~v8qG&L&GBB|+GJt5X
TZhQI!sDZ)L)z4*}Q$iB}{jYr%

literal 0
HcmV?d00001

diff --git a/app/templates/base-fluid.html b/app/templates/base-fluid.html
index 5817266..733a509 100644
--- a/app/templates/base-fluid.html
+++ b/app/templates/base-fluid.html
@@ -16,6 +16,8 @@
           href="{{ url_for('inventory.attributes', kind='Manufacturer') }}">Attributes</a>
         <a class="list-group-item list-group-item-action {{ is_active(path.startswith("/inventory/qrcodes")) }}"
           href="{{ url_for('inventory.qrcodes', kind='Action') }}">QR Codes</a>
+        <a class="list-group-item list-group-item-action {{ is_active(path.startswith("/inventory/scanner")) }}"
+          href="{{ url_for('inventory.scanner') }}">Scanner setup</a>
         {% elif path.startswith("/network") %}
         <a class="list-group-item list-group-item-action {{ is_active(path.startswith(("/network/hosts", "/network/interfaces"))) }}"
           href="{{ url_for('network.list_hosts') }}">Hosts</a>
diff --git a/app/templates/inventory/scanner.html b/app/templates/inventory/scanner.html
new file mode 100644
index 0000000..d98f700
--- /dev/null
+++ b/app/templates/inventory/scanner.html
@@ -0,0 +1,66 @@
+{% extends "base-fluid.html" %}
+
+{% block title %}Scanner - CSEntry{% endblock %}
+
+{% block main %}
+  <div class="col-md-8">
+  <h4 class="text-center">Scan the following codes to change the Xenon 1900 scanner settings</h4>
+    <div class="card">
+      <h5 class="card-header">Restore default settings</h5>
+      <div class="card-body">
+        <div class="list-group">
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/activate-custom-defaults.png') }}" class="img-fluid mx-auto d-block" alt="Activate Custom Defaults">
+            <figcaption class="figure-caption text-center">Activate Custom Defaults</figcaption>
+          </figure>
+        </div>
+      </div>
+    </div>
+    </br>
+    <div class="card">
+      <h5 class="card-header">Lower or disable the sound</h5>
+      <div class="card-body">
+        <div class="list-group">
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/daytime-mode.png') }}" class="img-fluid mx-auto d-block" alt="Activate Custom Defaults">
+            <figcaption class="figure-caption text-center">Daytime Mode (all sounds to on, but at a low volume)</figcaption>
+          </figure>
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/silent-mode-with-flashing-led.png') }}" class="img-fluid mx-auto d-block" alt="Silent Mode With Flashing LED">
+            <figcaption class="figure-caption text-center">Silent Mode With Flashing LED (all sounds are silenced)</figcaption>
+          </figure>
+        </div>
+      </div>
+    </div>
+    </br>
+    <div class="card">
+      <h5 class="card-header">Use csentry-scanner application</h5>
+      <div class="card-body">
+        <p class="card-text">Configure the scanner to emulate a regular RS232-based COM port</p>
+        <div class="list-group">
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/usb-serial.png') }}" class="img-fluid mx-auto d-block" alt="USB Serial">
+            <figcaption class="figure-caption text-center">USB Serial</figcaption>
+          </figure>
+        </div>
+      </div>
+    </div>
+    </br>
+    <div class="card">
+      <h5 class="card-header">Scan directly in the web UI</h5>
+      <div class="card-body">
+        <p class="card-text">Configure the scanner as a keyboard to scan ICS id and serial numbers in the web UI</p>
+        <div class="list-group">
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/usb-keyboard-pc.png') }}" class="img-fluid mx-auto d-block" alt="USB Keyboard (PC)">
+            <figcaption class="figure-caption text-center">USB Keyboard (PC)</figcaption>
+          </figure>
+          <figure class="figure">
+            <img src="{{ url_for('static', filename='img/usb-keyboard-mac.png') }}" class="img-fluid mx-auto d-block" alt="USB Keyboard (Mac)">
+            <figcaption class="figure-caption text-center">USB Keyboard (Mac)</figcaption>
+          </figure>
+        </div>
+      </div>
+    </div>
+  </div>
+{%- endblock %}
-- 
GitLab