Merged PR 272: #274 - Artikel Scan Fehler

#274 - Artikel Scan Fehler

Related work items: #274
This commit is contained in:
Lorenz Hilpert
2020-09-08 15:07:56 +00:00
committed by Sebastian Neumair
3 changed files with 32 additions and 5 deletions

View File

@@ -4,5 +4,7 @@
Halten Sie den Artikel an den externen Barcodescanner oder nutzen Sie die Scanfunktion des iPads.
</caption>
<lib-barcode-scanner #scanner (scan)="triggerSearch($event)"></lib-barcode-scanner>
</div>
<button class="btn-active medium" type="button" (click)="openScanner()">
Artikel scannen
</button>
</div>

View File

@@ -38,3 +38,15 @@ lib-barcode-scanner-scandit {
.btn {
margin-top: 15px;
}
button {
background-color: #f70400;
border: none;
border-radius: 25px;
color: #fff;
text-align: center;
padding: 12px 25px;
font-family: 'Open Sans';
font-size: 18px;
font-weight: bold;
}

View File

@@ -14,6 +14,7 @@ import { AddBreadcrumb } from '../../../../core/store/actions/breadcrumb.actions
import { takeUntil } from 'rxjs/operators';
import { ProcessSelectors } from '../../../../core/store/selectors/process.selectors';
import { ItemDTO } from '@swagger/cat';
import { NativeContainerService } from 'native-container';
@Component({
selector: 'app-barcode-search',
@@ -27,7 +28,12 @@ export class BarcodeSearchComponent implements OnInit, OnDestroy {
scanningVisible = false;
destroy$ = new Subject();
constructor(private store: Store, private router: Router, protected productService: ProductService) { }
constructor(
private store: Store,
private router: Router,
protected productService: ProductService,
private nativeContainer: NativeContainerService
) {}
ngOnInit() {
this.processes$.pipe(takeUntil(this.destroy$)).subscribe((p: Process[]) => (this.processes = p));
@@ -80,8 +86,15 @@ export class BarcodeSearchComponent implements OnInit, OnDestroy {
);
}
toggleScan() {
this.scanningVisible = !this.scanningVisible;
openScanner() {
if (this.nativeContainer.isUiWebview()) {
this.nativeContainer
.openScanner('scanBook')
.pipe(takeUntil(this.destroy$))
.subscribe((message) => {
this.triggerSearch(message.data);
});
}
}
ngOnDestroy() {