|
@@ -0,0 +1,58 @@
|
|
|
+import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
+import { UserData } from '../../providers/user-data';
|
|
|
+import { Keyboard } from '@ionic-native/keyboard/ngx';
|
|
|
+import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-sample-count-zero',
|
|
|
+ templateUrl: './sample-count-zero.page.html',
|
|
|
+ styleUrls: ['./sample-count-zero.page.scss'],
|
|
|
+})
|
|
|
+export class SampleCountZeroPage implements OnInit {
|
|
|
+
|
|
|
+ constructor(private keyboard: Keyboard,private barcodeScanner: BarcodeScanner,public userData: UserData) { }
|
|
|
+
|
|
|
+ public pCode:string = ""
|
|
|
+ public currentCode: string
|
|
|
+
|
|
|
+ @ViewChild('pCodeInput') pCodeInput;
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ }
|
|
|
+
|
|
|
+ codechange() {
|
|
|
+ if (this.pCode) {
|
|
|
+ this.pCodeInput.value = ""
|
|
|
+ this.currentCode = this.pCode
|
|
|
+ this.clearSampleCount()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ionViewDidEnter() {
|
|
|
+ this.inputFocus()
|
|
|
+ }
|
|
|
+
|
|
|
+ inputFocus() {
|
|
|
+ this.pCodeInput.setFocus();
|
|
|
+ window['keyboardVisible'] = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.keyboard.hide()
|
|
|
+ }, 300)
|
|
|
+ }
|
|
|
+ doClick() {
|
|
|
+ this.inputFocus()
|
|
|
+ }
|
|
|
+
|
|
|
+ clearSampleCount() {
|
|
|
+ this.userData.sampleCountZero(this.currentCode)
|
|
|
+ }
|
|
|
+
|
|
|
+ qrscan() {
|
|
|
+ this.barcodeScanner.scan().then(barcodeData => {
|
|
|
+ this.pCode = barcodeData.text
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('Error', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+}
|