Ledger now working with response_model

get_edit_url workaround found with transform clientside
This commit is contained in:
tanshu
2020-05-12 23:21:12 +05:30
parent 9c9f0dfdd6
commit 708a60baf7
18 changed files with 206 additions and 24 deletions

View File

@ -26,7 +26,7 @@
<!-- Date Column -->
<ng-container matColumnDef="date">
<mat-header-cell *matHeaderCellDef mat-sort-header>Date</mat-header-cell>
<mat-cell *matCellDef="let row"><a [href]="row.url">{{row.date}}</a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.date}}</a></mat-cell>
</ng-container>
<!-- Type Column -->

View File

@ -7,6 +7,7 @@ import * as moment from 'moment';
import {DaybookDataSource} from './daybook-datasource';
import {Daybook} from './daybook';
import {DaybookService} from './daybook.service';
import {map} from 'rxjs/operators';
@Component({
selector: 'app-daybook',
@ -33,8 +34,12 @@ export class DaybookComponent implements OnInit {
}
ngOnInit() {
this.route.data
.subscribe((data: { info: Daybook }) => {
this.route.data.pipe(map(
(data: { info: Daybook }) => {
data.info.body = data.info.body.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: Daybook }) => {
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),

View File

@ -47,7 +47,7 @@
<!-- Particulars Column -->
<ng-container matColumnDef="particulars">
<mat-header-cell *matHeaderCellDef mat-sort-header>Particulars</mat-header-cell>
<mat-cell *matCellDef="let row"><a [href]="row.url">{{row.name}}</a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.name}}</a></mat-cell>
<mat-footer-cell *matFooterCellDef>Closing Balance</mat-footer-cell>
</ng-container>

View File

@ -56,8 +56,12 @@ export class LedgerComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.route.data
.subscribe((data: { info: Ledger }) => {
this.route.data.pipe(map(
(data: { info: Ledger }) => {
data.info.body = data.info.body.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: Ledger }) => {
this.info = data.info;
this.calculateTotals();
this.form.setValue({

View File

@ -44,7 +44,7 @@
<!-- Particulars Column -->
<ng-container matColumnDef="particulars">
<mat-header-cell *matHeaderCellDef mat-sort-header>Particulars</mat-header-cell>
<mat-cell *matCellDef="let row"><a [href]="row.url">{{row.name}}</a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.name}}</a></mat-cell>
<mat-footer-cell *matFooterCellDef>Closing Balance</mat-footer-cell>
</ng-container>

View File

@ -61,8 +61,12 @@ export class ProductLedgerComponent implements OnInit {
}
ngOnInit() {
this.route.data
.subscribe((data: { info: ProductLedger }) => {
this.route.data.pipe(map(
(data: { info: ProductLedger }) => {
data.info.body = data.info.body.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: ProductLedger }) => {
this.info = data.info;
this.calculateTotals();
this.form.setValue({

View File

@ -32,7 +32,7 @@
<!-- Supplier Column -->
<ng-container matColumnDef="supplier">
<mat-header-cell *matHeaderCellDef mat-sort-header>Supplier</mat-header-cell>
<mat-cell *matCellDef="let row"><a [href]="row.url">{{row.supplier}}</a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.supplier}}</a></mat-cell>
</ng-container>
<!-- Product Column -->

View File

@ -6,6 +6,7 @@ import {ActivatedRoute, Router} from '@angular/router';
import * as moment from 'moment';
import {PurchaseEntriesDataSource} from './purchase-entries-datasource';
import {PurchaseEntries} from './purchase-entries';
import {map} from 'rxjs/operators';
@Component({
selector: 'app-purchase-entries',
@ -31,8 +32,12 @@ export class PurchaseEntriesComponent implements OnInit {
}
ngOnInit() {
this.route.data
.subscribe((data: { info: PurchaseEntries }) => {
this.route.data.pipe(map(
(data: { info: PurchaseEntries }) => {
data.info.body = data.info.body.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: PurchaseEntries }) => {
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),

View File

@ -12,7 +12,7 @@
<!-- Date Column -->
<ng-container matColumnDef="date">
<mat-header-cell *matHeaderCellDef mat-sort-header>Date</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.date}}</mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.date}}</a></mat-cell>
</ng-container>
<!-- Type Column -->

View File

@ -5,6 +5,7 @@ import {UnpostedDataSource} from './unposted-datasource';
import {Unposted} from './unposted';
import {ActivatedRoute, Router} from '@angular/router';
import {UnpostedService} from './unposted.service';
import {map} from 'rxjs/operators';
@Component({
selector: 'app-unposted',
@ -23,8 +24,12 @@ export class UnpostedComponent implements OnInit {
}
ngOnInit() {
this.route.data
.subscribe((data: { info: Unposted[] }) => {
this.route.data.pipe(map(
(data: { info: Unposted[] }) => {
data.info = data.info.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: Unposted[] }) => {
this.info = data.info;
});
this.dataSource = new UnpostedDataSource(this.paginator, this.sort, this.info);