Removed Recipe Template as it was not needed.
Moved host listeners to the component declaration. Form submit on Return fixed.
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
import { CurrencyPipe, DecimalPipe } from '@angular/common';
|
||||
import {
|
||||
afterNextRender,
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
HostListener,
|
||||
inject,
|
||||
input,
|
||||
linkedSignal,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { afterNextRender, Component, computed, effect, inject, input, linkedSignal, signal } from '@angular/core';
|
||||
import { form, FormField, FormRoot } from '@angular/forms/signals';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@@ -76,6 +66,12 @@ export interface IssueFormModel {
|
||||
selector: 'app-issue',
|
||||
templateUrl: './issue.component.html',
|
||||
styleUrls: ['./issue.component.css'],
|
||||
host: {
|
||||
'(window:keydown.f2)': 'focusDate($event)',
|
||||
'(window:keydown.f3)': 'focusBatchHost($event)',
|
||||
'(window:keydown.control.s)': 'saveListner($event)',
|
||||
'(window:keydown.control.p)': 'postListner($event)',
|
||||
},
|
||||
imports: [
|
||||
FormField,
|
||||
FormRoot,
|
||||
@@ -174,19 +170,16 @@ export class IssueComponent {
|
||||
issueGridResource = this.issueGridSer.issueGrid(this.balanceDate);
|
||||
gridData = computed(() => this.issueGridResource.value() ?? []);
|
||||
|
||||
@HostListener('window:keydown.f2', ['$event'])
|
||||
focusDate(event: Event) {
|
||||
event.preventDefault();
|
||||
this.form().focusBoundControl();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f3', ['$event'])
|
||||
focusBatchHost(event: Event) {
|
||||
event.preventDefault();
|
||||
this.form.addRow.batch().focusBoundControl();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.s', ['$event'])
|
||||
saveListner(event: Event) {
|
||||
event.preventDefault();
|
||||
if (this.canSave()) {
|
||||
@@ -194,7 +187,6 @@ export class IssueComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.p', ['$event'])
|
||||
postListner(event: Event) {
|
||||
event.preventDefault();
|
||||
if (this.id() && !this.form.posted().controlValue() && this.auth.allowed('post-vouchers')) {
|
||||
|
||||
Reference in New Issue
Block a user