From 6f54177cad2e126f1b1df8f29e2da53f74e27b5a Mon Sep 17 00:00:00 2001 From: Akash Shah Date: Tue, 16 Jul 2019 23:12:22 -0400 Subject: [PATCH] i cant even keep track anymore --- .../empty-error-editor.component.spec.ts | 25 + .../empty-error-editor.component.ts | 46 + .../numeric-editor.component.spec.ts | 25 + .../numeric-editor.component.ts | 51 + .../phone-editor/phone-editor.component.ts | 2 +- AstuteClient2/src/app/app.module.ts | 10 +- .../src/app/customer/customer.component.css | 8 + .../src/app/customer/customer.component.html | 499 ++++--- .../src/app/customer/customer.component.ts | 36 +- .../invoice-payment.component.html | 379 ++--- .../invoice-payment.component.ts | 11 +- .../src/app/invoice/invoice.component.html | 1293 +++++++++-------- .../src/app/invoice/invoice.component.ts | 175 ++- .../src/app/login/login.component.html | 20 +- .../src/app/login/login.component.ts | 2 +- .../src/app/nav-bar/nav-bar.component.html | 5 +- .../src/app/nav-bar/nav-bar.component.ts | 6 + .../sales-order/sales-order.component.html | 714 ++++----- .../app/sales-order/sales-order.component.ts | 90 +- 19 files changed, 1849 insertions(+), 1548 deletions(-) create mode 100644 AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.spec.ts create mode 100644 AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.ts create mode 100644 AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.spec.ts create mode 100644 AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.ts diff --git a/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.spec.ts b/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.spec.ts new file mode 100644 index 0000000..f557fcb --- /dev/null +++ b/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EmptyErrorEditorComponent } from './empty-error-editor.component'; + +describe('EmptyErrorEditorComponent', () => { + let component: EmptyErrorEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ EmptyErrorEditorComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EmptyErrorEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.ts b/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.ts new file mode 100644 index 0000000..0d934b1 --- /dev/null +++ b/AstuteClient2/src/app/ag-grid-components/empty-error-editor/empty-error-editor.component.ts @@ -0,0 +1,46 @@ +import {AfterViewInit, Component, ViewChild} from '@angular/core'; +import {ToastManagerService} from '../../services/toast-manager/toast-service.service'; + +@Component({ + selector: 'app-empty-error-editor', + template: ` + + ` +}) +export class EmptyErrorEditorComponent implements AfterViewInit { + @ViewChild('i', {'static': false}) textInput; + params; + + constructor(protected toastService: ToastManagerService) { } + + ngAfterViewInit() { + setTimeout(() => { + this.textInput.nativeElement.focus(); + }); + } + + agInit(params: any): void { + this.params = params; + } + + getValue() { + return this.textInput.nativeElement.value; + } + + onKeyDown(event) { + if (event.keyCode === 9 || event.keyCode === 13) { + if (!this.textInput.nativeElement.value) { + event.stopPropagation(); + this.notif('Value should not be empty'); + setTimeout(() => { + this.textInput.nativeElement.focus(); + }); + } + } + } + + // ** toast notification method + notif(text: string) { + this.toastService.show(text, {classname: 'bg-warning'}); + } +} diff --git a/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.spec.ts b/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.spec.ts new file mode 100644 index 0000000..39f44a6 --- /dev/null +++ b/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NumericEditorComponent } from './numeric-editor.component'; + +describe('NumericEditorComponent', () => { + let component: NumericEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NumericEditorComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NumericEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.ts b/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.ts new file mode 100644 index 0000000..b9aa550 --- /dev/null +++ b/AstuteClient2/src/app/ag-grid-components/numeric-editor/numeric-editor.component.ts @@ -0,0 +1,51 @@ +import {AfterViewInit, Component, ViewChild} from '@angular/core'; +import {ToastManagerService} from '../../services/toast-manager/toast-service.service'; + +@Component({ + selector: 'app-numeric-editor', + template: ` + + ` +}) +export class NumericEditorComponent implements AfterViewInit { + @ViewChild('i', {'static': false}) numberInput; + params; + canBeEmpty: boolean; + + constructor(protected toastService: ToastManagerService) { } + + ngAfterViewInit() { + setTimeout(() => { + this.numberInput.nativeElement.focus(); + }); + } + + agInit(params: any): void { + this.params = params; + this.canBeEmpty = params.canBeEmpty; + } + + getValue() { + return this.numberInput.nativeElement.value; + } + + onKeyDown(event) { + if (this.canBeEmpty) { + if (event.keyCode === 9 || event.keyCode === 13) { + if (!this.numberInput.nativeElement.value) { + event.stopPropagation(); + this.notif('Value should not be empty'); + setTimeout(() => { + this.numberInput.nativeElement.focus(); + }); + } + } + } + } + + // ** toast notification method + notif(text: string) { + this.toastService.show(text, {classname: 'bg-warning'}); + } +} + diff --git a/AstuteClient2/src/app/ag-grid-components/phone-editor/phone-editor.component.ts b/AstuteClient2/src/app/ag-grid-components/phone-editor/phone-editor.component.ts index 1c213ab..e971fb3 100644 --- a/AstuteClient2/src/app/ag-grid-components/phone-editor/phone-editor.component.ts +++ b/AstuteClient2/src/app/ag-grid-components/phone-editor/phone-editor.component.ts @@ -4,7 +4,7 @@ import {ToastManagerService} from '../../services/toast-manager/toast-service.se @Component({ selector: 'app-phone-editor-cell', template: ` - + ` }) export class PhoneEditorComponent implements AfterViewInit { diff --git a/AstuteClient2/src/app/app.module.ts b/AstuteClient2/src/app/app.module.ts index e109b3c..2480b58 100644 --- a/AstuteClient2/src/app/app.module.ts +++ b/AstuteClient2/src/app/app.module.ts @@ -26,6 +26,8 @@ import { ToastsContainerComponent } from './services/toast-manager/toasts-contai import { NumberFormatterComponent } from './ag-grid-components/number-formatter/number-formatter.component'; import { PhoneFormatterComponent } from './ag-grid-components/phone-formatter/phone-formatter.component'; import { PhoneEditorComponent } from './ag-grid-components/phone-editor/phone-editor.component'; +import { EmptyErrorEditorComponent } from './ag-grid-components/empty-error-editor/empty-error-editor.component'; +import { NumericEditorComponent } from './ag-grid-components/numeric-editor/numeric-editor.component'; // import { ServiceTypeComponent } from './service-type/service-type.component'; @NgModule({ @@ -45,7 +47,9 @@ import { PhoneEditorComponent } from './ag-grid-components/phone-editor/phone-ed ToastsContainerComponent, NumberFormatterComponent, PhoneFormatterComponent, - PhoneEditorComponent// , + PhoneEditorComponent, + EmptyErrorEditorComponent, + NumericEditorComponent// , // ServiceTypeComponent ], imports: [ @@ -53,7 +57,9 @@ import { PhoneEditorComponent } from './ag-grid-components/phone-editor/phone-ed AgGridModule.withComponents([ NumberFormatterComponent, PhoneFormatterComponent, - PhoneEditorComponent + PhoneEditorComponent, + EmptyErrorEditorComponent, + NumericEditorComponent ]), NgbModule, HttpClientModule, diff --git a/AstuteClient2/src/app/customer/customer.component.css b/AstuteClient2/src/app/customer/customer.component.css index b3aaa87..8f1db15 100644 --- a/AstuteClient2/src/app/customer/customer.component.css +++ b/AstuteClient2/src/app/customer/customer.component.css @@ -8,4 +8,12 @@ ::-ms-input-placeholder { /* Microsoft Edge */ color: lightblue; +} + +.disabled { + position: absolute; + width: 100%; + height: 100%; + z-index: 10; + background-color: rgba(0,0,0,0.5) !important; } \ No newline at end of file diff --git a/AstuteClient2/src/app/customer/customer.component.html b/AstuteClient2/src/app/customer/customer.component.html index bcb2e17..a1e7cc1 100644 --- a/AstuteClient2/src/app/customer/customer.component.html +++ b/AstuteClient2/src/app/customer/customer.component.html @@ -1,180 +1,60 @@ -

Customers

+
+

Customers

-
-
-
- +
+
+
+ +
-
-
-
-
- - - - +
+
+
+ + + + +
-
- - - - - - - - - -
+ + -
-
-
- -
- - + + +
+
+ + +
+ + + + +
+
+
+
+ +
+
+
+
+
+ +
+ + +
-
- - - -
-
- - + +
+
+
+
+
+

Please Log In First!

+

Once you do, you will be able to create new customers and edit existing ones to your hearts content!

+

+ Log In +

+
+
- \ No newline at end of file +
+ diff --git a/AstuteClient2/src/app/customer/customer.component.ts b/AstuteClient2/src/app/customer/customer.component.ts index c051f94..a0c0fd5 100644 --- a/AstuteClient2/src/app/customer/customer.component.ts +++ b/AstuteClient2/src/app/customer/customer.component.ts @@ -3,6 +3,8 @@ import {AstuteClientService} from '../services/astute-client-service'; import {ToastManagerService} from '../services/toast-manager/toast-service.service'; import {PhoneFormatterComponent} from '../ag-grid-components/phone-formatter/phone-formatter.component'; import {PhoneEditorComponent} from '../ag-grid-components/phone-editor/phone-editor.component'; +import {EmptyErrorEditorComponent} from '../ag-grid-components/empty-error-editor/empty-error-editor.component'; +import {NumericEditorComponent} from "../ag-grid-components/numeric-editor/numeric-editor.component"; @Component({ selector: 'app-customer', @@ -11,6 +13,7 @@ import {PhoneEditorComponent} from '../ag-grid-components/phone-editor/phone-edi }) export class CustomerComponent implements OnInit { // @ViewChild('agGrid') agGrid; + loggedIn: boolean; gridApi; gridColumnApi; contactGridApi; @@ -19,22 +22,24 @@ export class CustomerComponent implements OnInit { customers; columnDefs = [ {headerName: 'ID', field: 'customerId'}, - {headerName: 'Name ✎', field: 'customerName', editable: true}, - {headerName: 'Bill To ✎', field: 'billToDept', editable: true}, - {headerName: 'Address 1 ✎', field: 'add1', editable: true}, - {headerName: 'Address 2 ✎', field: 'add2', editable: true}, - {headerName: 'City ✎', field: 'city', editable: true}, - {headerName: 'Email ✎', field: 'email', editable: true}, + {headerName: 'Name ✎', field: 'customerName', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'Bill To ✎', field: 'billToDept', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'Email ✎', field: 'email', editable: true, cellEditor: 'emptyErrorEditorComponent'}, {headerName: 'Fax ✎', field: 'fax', editable: true, cellEditor: 'phoneEditorComponent'}, {headerName: 'Phone ✎', field: 'phone', editable: true, cellEditor: 'phoneEditorComponent'}, - {headerName: 'Ext. ✎', field: 'phExt', editable: true}, - {headerName: 'State ✎', field: 'state', editable: true}, - {headerName: 'ZIP ✎', field: 'zip', editable: true}, - {headerName: 'ZIP-4 ✎', field: 'ziplast4', editable: true} + {headerName: 'Ext. ✎', field: 'phExt', editable: true, cellEditor: 'numericEditorComponent'}, + {headerName: 'Address 1 ✎', field: 'add1', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'Address 2 ✎', field: 'add2', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'City ✎', field: 'city', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'State ✎', field: 'state', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'ZIP ✎', field: 'zip', editable: true, cellEditor: 'emptyErrorEditorComponent'}, + {headerName: 'ZIP-4 ✎', field: 'ziplast4', editable: true, cellEditor: 'numericEditorComponent'} ]; frameworkComponents = { phoneFormatterComponent: PhoneFormatterComponent, - phoneEditorComponent: PhoneEditorComponent + phoneEditorComponent: PhoneEditorComponent, + emptyErrorEditorComponent: EmptyErrorEditorComponent, + numericEditorComponent: NumericEditorComponent }; rowData: any; states = [ @@ -94,7 +99,7 @@ export class CustomerComponent implements OnInit { contactsData: any; contactsColDef = [ - {headerName: 'Name ✎', field: 'name', editable: true}, + {headerName: 'Name ✎', field: 'name', editable: true, cellEditor: 'emptyErrorEditorComponent'}, {headerName: 'Title ✎', field: 'title', editable: true}, {headerName: 'Email ✎', field: 'email', editable: true}, {headerName: 'Work ✎', field: 'workPhone', editable: true, cellEditor: 'phoneEditorComponent'}, @@ -119,7 +124,12 @@ export class CustomerComponent implements OnInit { } ngOnInit() { - this.refreshData(); + if (localStorage.getItem('SESSION_ID') && localStorage.getItem('SESSION_USER')) { + this.loggedIn = true; + this.refreshData(); + } else { + this.loggedIn = false; + } } // callback for grid selection diff --git a/AstuteClient2/src/app/invoice-payment/invoice-payment.component.html b/AstuteClient2/src/app/invoice-payment/invoice-payment.component.html index 230c8e3..074ba19 100644 --- a/AstuteClient2/src/app/invoice-payment/invoice-payment.component.html +++ b/AstuteClient2/src/app/invoice-payment/invoice-payment.component.html @@ -1,206 +1,225 @@ -

Invoice Payments

-
-
-
- +
+

Invoice Payments

+ +
+
+
+ +
+
+
+
+ +
+
+ +
-
-
- -
-
- -
-
-
- - -
- + + +
- - - + + + - - -
- +
- + +
+
+
+
+
+

Please Log In First!

+

Once you do, you will be able to log payments to your hearts content!

+

+ Log In +

+
+
-
- - -
- +
\ No newline at end of file diff --git a/AstuteClient2/src/app/invoice-payment/invoice-payment.component.ts b/AstuteClient2/src/app/invoice-payment/invoice-payment.component.ts index 13f322a..05b5534 100644 --- a/AstuteClient2/src/app/invoice-payment/invoice-payment.component.ts +++ b/AstuteClient2/src/app/invoice-payment/invoice-payment.component.ts @@ -10,6 +10,8 @@ import {ToastManagerService} from "../services/toast-manager/toast-service.servi }) export class InvoicePaymentComponent implements OnInit { @ViewChild('agGrid', {'static': false}) agGrid; + + loggedIn: boolean; selected = null; chosenInv: any = 0; chosenPaymentType: any = 0; @@ -25,14 +27,17 @@ export class InvoicePaymentComponent implements OnInit { {headerName: 'Payment Type', field: 'paymentType'}, {headerName: 'Check / ACH #', field: 'checkNo'}, {headerName: 'Transaction #', field: 'transactionNo'} - - ]; constructor(protected astuteClientService: AstuteClientService, protected toastService: ToastManagerService) { } ngOnInit() { - this.refreshData(); + if (localStorage.getItem('SESSION_ID') && localStorage.getItem('SESSION_USER')) { + this.loggedIn = true; + this.refreshData(); + } else { + this.loggedIn = false; + } } invoiceDropdownChange(index) { diff --git a/AstuteClient2/src/app/invoice/invoice.component.html b/AstuteClient2/src/app/invoice/invoice.component.html index 520bb1f..ef76648 100644 --- a/AstuteClient2/src/app/invoice/invoice.component.html +++ b/AstuteClient2/src/app/invoice/invoice.component.html @@ -1,6 +1,8 @@ -

Invoices

-
+
+

Invoices

+ +
@@ -59,667 +61,684 @@
- - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -