Skip to content

Commit

Permalink
barcode manuell [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
hmt committed Feb 25, 2020
1 parent 5b2ed93 commit 175c644
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/components/Scanner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
const prefix_length = $configData.scan_prefix.length;
let buffer = [],
barcode,
barcode_manuell,
barcode_input,
registrieren,
lastKeyTime = Date.now(),
medium,
Expand All @@ -22,6 +24,10 @@
(event.key === 'Escape') && (registrieren = false)
return
}
if (event.key === 'Escape') {
barcode_manuell = !barcode_manuell
barcode_input = ''
}
if (
event.key === "Enter" &&
buffer.slice(0, prefix_length).join("") === $configData.scan_prefix
Expand Down Expand Up @@ -112,7 +118,26 @@
</script>

<svelte:window on:keydown={handle_keydown} />

{#if barcode_manuell}
<div class="modal is-active">
<div class="modal-background" on:click={()=>barcode_manuell=false}/>
<button class="modal-close is-large" aria-label="close" on:click={()=>barcode_manuell=false}></button>
<div class="modal-content">
<div class="box">
<div class="field">
<label class="label">Barcode eingeben</label>
<div class="control">
<input
class="input"
type="text"
bind:value={barcode}
on:keydown={e => {if (e.key === 'Enter') { barcode_manuell=false; scan()}}} />
</div>
</div>
</div>
</div>
</div>
{/if}
{#if registrieren}
<div class="modal is-active">
<div class="modal-background" on:click={()=>registrieren=false}/>
Expand Down

0 comments on commit 175c644

Please sign in to comment.