Add files via upload

This commit is contained in:
gopi17701 2018-09-29 21:21:20 -04:00 committed by GitHub
parent c02f0192eb
commit 5cf4f930bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 173 additions and 145 deletions

View File

@ -1,13 +1,13 @@
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
describe('AppRoutingModule', () => { describe('AppRoutingModule', () => {
let appRoutingModule: AppRoutingModule; let appRoutingModule: AppRoutingModule;
beforeEach(() => { beforeEach(() => {
appRoutingModule = new AppRoutingModule(); appRoutingModule = new AppRoutingModule();
}); });
it('should create an instance', () => { it('should create an instance', () => {
expect(appRoutingModule).toBeTruthy(); expect(appRoutingModule).toBeTruthy();
}); });
}); });

View File

@ -1,27 +1,31 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import {RouterModule, Routes} from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import {CustomerComponent} from './customer/customer.component'; import {CustomerComponent} from './customer/customer.component';
import {SalesOrderComponent} from './sales-order/sales-order.component'; import {SalesOrderComponent} from './sales-order/sales-order.component';
import {InvoiceComponent} from './invoice/invoice.component'; import {InvoiceComponent} from './invoice/invoice.component';
import {HomepageComponent} from './homepage/homepage.component'; import {HomepageComponent} from './homepage/homepage.component';
import {InvoiceGenComponent} from './invoice-gen/invoice-gen.component'; import {InvoiceGenComponent} from './invoice-gen/invoice-gen.component';
import {InvoicePaymentComponent} from './invoice-payment/invoice-payment.component';
const routes: Routes = [ import {LoginComponent} from './login/login.component';
{ path: '', redirectTo: 'homepage', pathMatch: 'full'},
{ path: 'homepage', component: HomepageComponent }, const routes: Routes = [
{ path: 'customer', component: CustomerComponent }, { path: '', redirectTo: 'login', pathMatch: 'full'},
{ path: 'sales-order', component: SalesOrderComponent }, { path: 'homepage', component: HomepageComponent },
{ path: 'invoice', component: InvoiceComponent }, { path: 'customer', component: CustomerComponent },
{ path: 'invoice-gen', component: InvoiceGenComponent } { path: 'sales-order', component: SalesOrderComponent },
]; { path: 'invoice', component: InvoiceComponent },
{ path: 'invoice-gen', component: InvoiceGenComponent },
@NgModule({ { path: 'invoice-payment', component: InvoicePaymentComponent },
exports: [RouterModule], { path: 'login', component: LoginComponent }
imports: [ ];
CommonModule,
RouterModule.forRoot(routes) @NgModule({
], exports: [RouterModule],
declarations: [] imports: [
}) CommonModule,
export class AppRoutingModule { } RouterModule.forRoot(routes)
],
declarations: []
})
export class AppRoutingModule { }

View File

@ -1 +1 @@

View File

@ -1,27 +1,27 @@
import { TestBed, async } from '@angular/core/testing'; import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ declarations: [
AppComponent AppComponent
], ],
}).compileComponents(); }).compileComponents();
})); }));
it('should create the app', async(() => { it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy(); expect(app).toBeTruthy();
})); }));
it(`should have as title 'app'`, async(() => { it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app'); expect(app.title).toEqual('app');
})); }));
it('should render title in a h1 tag', async(() => { it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement; const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to AstuteClient2!'); expect(compiled.querySelector('h1').textContent).toContain('Welcome to AstuteClient2!');
})); }));
}); });

View File

@ -1,10 +1,10 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'] styleUrls: ['./app.component.css']
}) })
export class AppComponent { export class AppComponent {
title = 'app'; title = 'app';
} }

View File

@ -1,43 +1,53 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CustomerComponent } from './customer/customer.component'; import { CustomerComponent } from './customer/customer.component';
import { AstuteClientService } from './services/astute-client-service'; import { AstuteClientService } from './services/astute-client-service';
import { AgGridModule } from 'ag-grid-angular'; import { AgGridModule } from 'ag-grid-angular';
import { ModalFormComponent } from './modal-form/modal-form.component'; import { ModalFormComponent } from './modal-form/modal-form.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {HttpClientModule} from '@angular/common/http'; import {HttpClientModule} from '@angular/common/http';
import { AppRoutingModule } from './/app-routing.module'; import { AppRoutingModule } from './/app-routing.module';
import { NavBarComponent } from './nav-bar/nav-bar.component'; import { NavBarComponent } from './nav-bar/nav-bar.component';
import { SalesOrderComponent } from './sales-order/sales-order.component'; import { SalesOrderComponent } from './sales-order/sales-order.component';
import { InvoiceComponent } from './invoice/invoice.component'; import { InvoiceComponent } from './invoice/invoice.component';
import { HomepageComponent } from './homepage/homepage.component'; import { HomepageComponent } from './homepage/homepage.component';
import { AppBoxComponent } from './app-box/app-box.component'; import { AppBoxComponent } from './app-box/app-box.component';
import { InvoiceGenComponent } from './invoice-gen/invoice-gen.component'; import { InvoiceGenComponent } from './invoice-gen/invoice-gen.component';
import { TextMaskModule } from 'angular2-text-mask'; import { TextMaskModule } from 'angular2-text-mask';
import { LoginComponent } from './login/login.component';
@NgModule({ import { InvoicePaymentComponent } from './invoice-payment/invoice-payment.component';
declarations: [ import { CommonModule } from '@angular/common';
AppComponent, import { FormsModule } from '@angular/forms';
CustomerComponent, import { ReactiveFormsModule } from '@angular/forms';
ModalFormComponent,
NavBarComponent, @NgModule({
SalesOrderComponent, declarations: [
InvoiceComponent, AppComponent,
HomepageComponent, CustomerComponent,
AppBoxComponent, ModalFormComponent,
InvoiceGenComponent NavBarComponent,
], SalesOrderComponent,
imports: [ InvoiceComponent,
BrowserModule, HomepageComponent,
AgGridModule.withComponents([]), AppBoxComponent,
NgbModule.forRoot(), InvoiceGenComponent,
HttpClientModule, LoginComponent,
AppRoutingModule, InvoicePaymentComponent
TextMaskModule ],
], imports: [
providers: [AstuteClientService], BrowserModule,
bootstrap: [AppComponent] AgGridModule.withComponents([]),
}) NgbModule.forRoot(),
export class AppModule { } HttpClientModule,
AppRoutingModule,
TextMaskModule,
CommonModule,
FormsModule,
ReactiveFormsModule
],
providers: [AstuteClientService],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -8,16 +8,6 @@
Welcome to the Astute Internal System, {{currentUser}}! Welcome to the Astute Internal System, {{currentUser}}!
</h1> </h1>
</div> </div>
<div class="col-lg-4">
<div class="input-group mb-3 float-right">
<input type="text" class="form-control" placeholder="Search...">
<div class="input-group-prepend">
<button class="btn btn-sm btn-info btn-round">
<i class="material-icons">search</i>
</button>
</div>
</div>
</div>
</div> </div>
<!--applications--> <!--applications-->

View File

@ -73,7 +73,7 @@
<span class="input-group-text">Payment Date*</span> <span class="input-group-text">Payment Date*</span>
</td> </td>
<td colspan="7"> <td colspan="7">
<input type="text" class="form-control" #inDateReceived> <input type="date" class="form-control" #inDateReceived>
</td> </td>
</tr> </tr>
@ -120,7 +120,7 @@
<span class="input-group-text">Date Received*</span> <span class="input-group-text">Date Received*</span>
</td> </td>
<td colspan="7"> <td colspan="7">
<input type="text" class="form-control" #inDateReceived [value]="selected.paymentDate"> <input type="date" class="form-control" #inDateReceived [value]="selected.paymentDate">
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -1,6 +1,11 @@
<div class="page" style="width: 35%; margin: 20px auto auto;"> <div class="page" style="width: 35%; margin: 20px auto auto;">
<form class="form-signin" (ngSubmit)="login(f)" #f="ngForm" style="margin-bottom: 10px"> <form class="form-signin" (ngSubmit)="login(f)" #f="ngForm" style="margin-bottom: 10px">
<h2 class="form-signin-heading">Login</h2> <div class="row">
<div class="col-12">
<img src="assets/img/AstuteLogo.gif" height="100" width="230">
<h1 class="form-signin-heading text-right">Login</h1>
</div>
</div>
<label for="username" class="sr-only">Username</label> <label for="username" class="sr-only">Username</label>
<input class="form-control" type="text" id="username" name="username" ngModel placeholder="Username"> <input class="form-control" type="text" id="username" name="username" ngModel placeholder="Username">

View File

@ -25,7 +25,7 @@ export class LoginComponent implements OnInit {
this.astuteClientService.login(username, password).then((data) => { this.astuteClientService.login(username, password).then((data) => {
if (data) { if (data) {
this.router.navigate(['/home']); this.router.navigate(['/homepage']);
} else { } else {
alert('login failed, checked credentials'); alert('login failed, checked credentials');
} }

View File

@ -59,7 +59,7 @@
<td style="width: 20%"><span class="input-group-text">Contract Number</span></td> <td style="width: 20%"><span class="input-group-text">Contract Number</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="External Contract Number" #contractnum></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="External Contract Number" #contractnum></td>
<td style="width: 20%"><span class="input-group-text">Contract Amount</span></td> <td style="width: 20%"><span class="input-group-text">Contract Amount</span></td>
<td style="width: 30%"><input type="number" class="form-control" placeholder="Derived From Details" [value]="newContractAmount" #contractamt disabled></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="Derived From Details" [value]="newContractAmount | currency" #contractamt disabled></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -15,7 +15,8 @@ export class AstuteClientService {
private invoiceDetailUrl = 'http://localhost:8080/astutesystem/invoice/detail'; private invoiceDetailUrl = 'http://localhost:8080/astutesystem/invoice/detail';
private invoiceGenUrl = 'http://localhost:8080/astutesystem/invoice/generatedInvoice'; private invoiceGenUrl = 'http://localhost:8080/astutesystem/invoice/generatedInvoice';
private invoicePaymentUrl = 'http://localhost:8080/astutesystem/invoicePayment'; private invoicePaymentUrl = 'http://localhost:8080/astutesystem/invoicePayment';
private sessionId; private sessionId=localStorage.getItem('');
private sessionString = `?sessionId=${this.sessionId}`;
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
@ -28,13 +29,15 @@ export class AstuteClientService {
}; };
return this.http return this.http
.post(this.authUrl, data, this.headers) .post(this.authUrl, data)
.toPromise() .toPromise()
.then(response => { .then(response => {
console.log(response['entity']); console.log(response['entity']);
const sessionId = response['entity']; const name = response['entity'].name;
const sessionId = response['entity'].sessionId;
if (sessionId != null) { if (sessionId != null) {
localStorage.setItem('SESSION_ID', sessionId); localStorage.setItem('SESSION_ID', sessionId);
localStorage.setItem('SESSION_USER', name);
return sessionId; return sessionId;
} else { } else {
return null; return null;
@ -42,22 +45,37 @@ export class AstuteClientService {
}); });
} }
private getSessionId(): string { public logout() {
console.log(localStorage.getItem('SESSION_ID')); localStorage.removeItem('SESSION_ID');
return localStorage.getItem('SESSION_ID'); localStorage.removeItem('SESSION_USER');
} console.log(localStorage.getItem('SESSION_ID'));
}
public getSessionId(): string {
console.log(localStorage.getItem('SESSION_ID'));
return localStorage.getItem('SESSION_ID');
}
public getSessionUser(): string {
console.log(localStorage.getItem('SESSION_USER'));
return localStorage.getItem('SESSION_USER');
}
// **************************************** Customer Service methods // **************************************** Customer Service methods
public getCustomers(): Promise<any> { public getCustomers(): Promise<any> {
console.log("*** In getCustomers()"); console.log("*** In getCustomers()");
const url = `${this.customerUrl}`; const url = `${this.customerUrl}${this.sessionString}`;
return this.http.get(url) return this.http.get(url)
.toPromise() .toPromise()
.then(response => { .then(response => {
console.log(response['entity']); console.log(response['entity']);
return response['entity']; return response['entity'];
}); })
.catch( error => {
alert(error);
});
} }
public updateCustomer(customerId: number, data: any): Promise<any> { public updateCustomer(customerId: number, data: any): Promise<any> {
@ -137,6 +155,7 @@ export class AstuteClientService {
// Date deliverBy; // Date deliverBy;
public updatePODetail(ponum, lineItemNo, data) { public updatePODetail(ponum, lineItemNo, data) {
console.log("*** In updatePODetail()"); console.log("*** In updatePODetail()");
const sessionId = localStorage.getItem('sessionId');
const url = `${this.POUrl}/detail/${ponum}/${lineItemNo}`; //TODO send sessionId const url = `${this.POUrl}/detail/${ponum}/${lineItemNo}`; //TODO send sessionId
return this.http.put(url, data) return this.http.put(url, data)
.toPromise() .toPromise()