Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect new be #4

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
774a40b
add firebase setup
vinothentrayn Dec 14, 2018
1e6fffd
update all packages and add collection list page
vinothentrayn Dec 14, 2018
f101ba6
add route for collectionlist
vinothentrayn Dec 14, 2018
38d777b
update month amount is complement
vinothMcc Dec 17, 2018
196619f
add component and service
vinothMcc Dec 18, 2018
e0f27df
add config service
vinothMcc Dec 19, 2018
0de35fc
add config and try to use mobv
vinothMcc Dec 20, 2018
187b0eb
set values of edit invoice complete
vinothMcc Dec 21, 2018
995a533
edit http call only is pending
vinothMcc Dec 21, 2018
2583a8a
work on edit html part
vinothMcc Dec 26, 2018
babb6ea
addd new components
vinothMcc Dec 27, 2018
a4c7359
working on supplier name
vinothMcc Dec 27, 2018
bb18285
work on supplier and line number
vinothMcc Dec 29, 2018
32fd81e
complete invoice page
vinothMcc Jan 9, 2019
acd8249
use map pipe for getting invoice array
vinothMcc Jan 13, 2019
8eec30a
add disable for dropdown
vinothMcc Feb 2, 2019
450fb95
add config file
vinothMcc Apr 20, 2019
1ea268d
complete invoice list
vinothMcc Apr 23, 2019
c52c3e4
add firebase prod json
vinothMcc Apr 23, 2019
98b4ee2
fixed header
vinothMcc Apr 23, 2019
3363b5e
adding bootstrap
vinothMcc Apr 23, 2019
e0ad8bd
working on update invoice
vinothMcc Apr 24, 2019
d8223a1
fix header issue
vinothentrayn Apr 24, 2019
614e4e6
package json update
vinothMcc Apr 24, 2019
b3a3861
fix update invoice issue
vinothMcc Apr 24, 2019
149462f
create getInvoice function invoice list
vinothMcc Apr 24, 2019
703d688
complete invoice update
vinothMcc Apr 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
work on edit html part
vinothMcc committed Dec 26, 2018
commit 2583a8ac93b80de448661fd19f592b2dbe0a3969
3 changes: 2 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<main>
<router-outlet></router-outlet>
<app-header></app-header>
<router-outlet></router-outlet>
</main>
9 changes: 8 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -36,9 +36,13 @@ import {
MatSortModule,
MatTableModule
} from '@angular/material';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatButtonModule } from '@angular/material/button';

import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatIconModule } from '@angular/material/icon';
import { EditVoiceComponent } from './shared/edit-voice/edit-voice.component';
import { HeaderComponent } from './shared/header/header.component';

@NgModule({
declarations: [
@@ -47,7 +51,8 @@ import { EditVoiceComponent } from './shared/edit-voice/edit-voice.component';
UserComponent,
RegisterComponent,
InvoiceListComponent,
EditVoiceComponent
EditVoiceComponent,
HeaderComponent
],
imports: [
BrowserModule,
@@ -64,6 +69,8 @@ import { EditVoiceComponent } from './shared/edit-voice/edit-voice.component';
MatPaginatorModule,
MatSortModule,
MatProgressSpinnerModule,
MatToolbarModule,
MatButtonModule,
MatIconModule,
MobxAngularModule
],
6 changes: 4 additions & 2 deletions src/app/pages/invoice-list/invoice-list.component.ts
Original file line number Diff line number Diff line change
@@ -51,18 +51,20 @@ export class InvoiceListComponent implements OnInit {
);
}
ngOnInit() {
this._http.apiGet(this.sheetParams).subscribe(data => {
this.isLoading = true;
this._invoiceService.getInvoiceList().subscribe(data => {
// Object.keys(data['records'])
const invoiceArray = [];
for (const key in data['records']) {
if (key) {
invoiceArray.push(data['records'][key]);
}
}
this._invoiceService._invoiceList = data['records'];
this._invoiceService.saveLocalStroage(data['records']);
this.dataSource.data = invoiceArray;
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
this.isLoading = false;
});

console.log(this.dataSource);
23 changes: 9 additions & 14 deletions src/app/services/invoice.service.ts
Original file line number Diff line number Diff line change
@@ -15,23 +15,18 @@ export class InvoiceService {
this.getInvoiceList();
}

_invoiceList;
get invoiceList(): boolean {
return this._invoiceList;
_invoiceList = [];
get invoiceList() {
console.log(JSON.parse(localStorage.invoiceList));
return JSON.parse(localStorage.invoiceList) || this._invoiceList;
}

getInvoiceList() {
return this._http.apiGet(this.sheetParams).subscribe(data => {
// Object.keys(data['records'])
const invoiceArray = [];
for (const key in data['records']) {
if (key) {
invoiceArray.push(data['records'][key]);
}
}
console.log('Data : ', invoiceArray);
this._invoiceList = invoiceArray;
});
return this._http.apiGet(this.sheetParams);
}
saveLocalStroage(data) {
this._invoiceList = data;
localStorage.invoiceList = JSON.stringify(this._invoiceList);
}
editInvoice(updateData) {
this.sheetParams['action'] = 'update';
126 changes: 72 additions & 54 deletions src/app/shared/edit-voice/edit-voice.component.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,73 @@
<form [formGroup]="editInvoiceForm" novalidate>
<mat-form-field>
<input
matInput
placeholder="Grand Total"
type="text"
formControlName="grand_total"
[ngModel]="invoiceData.grand_total"
/>
</mat-form-field>
<mat-form-field>
<input
matInput
placeholder="Paid Amount"
type="text"
formControlName="paid_amount"
[ngModel]="invoiceData.paid_amount"
/>
</mat-form-field>
<mat-form-field>
<input
matInput
placeholder="Due"
type="text"
formControlName="due"
[ngModel]="invoiceData.due"
/>
</mat-form-field>
<mat-form-field>
<input
matInput
placeholder="Extra"
type="text"
formControlName="extra"
[ngModel]="invoiceData.extra"
/>
</mat-form-field>
<mat-form-field>
<input
matInput
placeholder="Comments"
type="text"
formControlName="comments"
[ngModel]="invoiceData.comments"
/>
</mat-form-field>
<div class="container edit-container">
<div class="row">
<form [formGroup]="editInvoiceForm" class="example-form" novalidate>
<div class="col">
<mat-form-field class="example-full-width">
<input
matInput
placeholder="Grand Total"
type="text"
formControlName="grand_total"
[ngModel]="invoiceData.grand_total"
/>
</mat-form-field>
</div>

<button
mat-raised-button
[disabled]="editInvoiceForm.invalid"
(click)="updateInvoice()"
>
Update
</button>
</form>
<div class="col">
<mat-form-field class="example-full-width">
<input
matInput
placeholder="Paid Amount"
type="text"
formControlName="paid_amount"
[ngModel]="invoiceData.paid_amount"
/>
</mat-form-field>
</div>

<div class="col">
<mat-form-field class="example-full-width">
<input
matInput
placeholder="Due"
type="text"
formControlName="due"
[ngModel]="invoiceData.due"
/>
</mat-form-field>
</div>

<div class="col">
<mat-form-field class="example-full-width">
<input
matInput
placeholder="Extra"
type="text"
formControlName="extra"
[ngModel]="invoiceData.extra"
/>
</mat-form-field>
</div>
<div class="col">
<mat-form-field class="example-full-width">
<input
matInput
placeholder="Comments"
type="text"
formControlName="comments"
[ngModel]="invoiceData.comments"
/>
</mat-form-field>
</div>
<div class="col">
<button
mat-raised-button
[disabled]="editInvoiceForm.invalid"
(click)="updateInvoice()"
>
Update
</button>
</div>
</form>
</div>
</div>
7 changes: 7 additions & 0 deletions src/app/shared/edit-voice/edit-voice.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.example-full-width {
width: 100%;
}
.edit-container {
padding-left: 15px;
padding-right: 15px;
}
5 changes: 5 additions & 0 deletions src/app/shared/header/header.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<mat-toolbar class="bg-primary">
<mat-toolbar-row>
<span>MMS</span> <span class="example-spacer"></span>
</mat-toolbar-row>
</mat-toolbar>
7 changes: 7 additions & 0 deletions src/app/shared/header/header.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.example-icon {
padding: 0 14px;
}

.example-spacer {
flex: 1 1 auto;
}
25 changes: 25 additions & 0 deletions src/app/shared/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { HeaderComponent } from './header.component';

describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HeaderComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/shared/header/header.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}