FE-942: Details module. Invoice module. (#108)

This commit is contained in:
Alexandra Usacheva 2019-11-08 17:40:12 +03:00 committed by GitHub
parent 635c1b9cee
commit 1196972983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 62 additions and 6 deletions

View File

@ -0,0 +1,2 @@
export * from './invoice-details.module';
export * from './invoice-details.component';

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { InvoiceDetailsComponent } from './invoice-details.component';
const invoiceDetailsRoutes: Routes = [
{
path: ':invoiceID',
component: InvoiceDetailsComponent
}
];
@NgModule({
imports: [RouterModule.forChild(invoiceDetailsRoutes)],
exports: [RouterModule]
})
export class InvoiceDetailsRoutingModule {}

View File

@ -0,0 +1,3 @@
<div>
InvoiceDetailsComponent
</div>

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
templateUrl: 'invoice-details.component.html'
})
export class InvoiceDetailsComponent {
constructor(private route: ActivatedRoute) {
this.route.params.subscribe(p => console.log('InvoiceDetailsComponent route params:', p));
}
}

View File

@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { InvoiceDetailsComponent } from './invoice-details.component';
import { InvoiceDetailsRoutingModule } from './invoice-details-routing.module';
@NgModule({
imports: [InvoiceDetailsRoutingModule],
declarations: [InvoiceDetailsComponent]
})
export class InvoiceDetailsModule {}

View File

@ -2,11 +2,11 @@
<ng-container *transloco="let t; scope: 'payment-details'; read: 'paymentDetails.invoiceDetails'">
<dsh-card-title>
<div class="mat-title" fxLayout fxLayoutGap="10px" fxLayoutAlign="start center">
<!-- <mat-icon class="dsh-forward-icon" routerLink="/" svgIcon="arrow_back"></mat-icon> -->
<div>
{{ t?.title }}
<span dshSecondaryTitle>#{{ invoice?.id }}</span>
</div>
<mat-icon class="dsh-forward-icon" (click)="goToInvoiceDetails(invoice)">arrow_forward</mat-icon>
</div>
</dsh-card-title>
<dsh-card-content fxLayout="column" [fxLayoutGap]="layoutGap">

View File

@ -1,5 +1,6 @@
import { Component, Inject, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Router } from '@angular/router';
import { Invoice, InvoiceStatus } from '../../../api-codegen/capi/swagger-codegen';
import { StatusColor as Color } from '../../../theme-manager';
@ -18,7 +19,11 @@ export class InvoiceDetailsComponent implements OnInit {
invoice$: Observable<Invoice>;
constructor(@Inject(LAYOUT_GAP) public layoutGap: string, private invoiceDetailsService: InvoiceDetailsService) {}
constructor(
@Inject(LAYOUT_GAP) public layoutGap: string,
private invoiceDetailsService: InvoiceDetailsService,
private router: Router
) {}
ngOnInit() {
this.invoice$ = this.invoiceDetailsService.getInvoiceByID(this.invoiceID);
@ -37,4 +42,8 @@ export class InvoiceDetailsComponent implements OnInit {
return { color: Color.pending, text: 'unpaid' };
}
}
goToInvoiceDetails({ id }: Invoice) {
this.router.navigate(['invoice', id]);
}
}

View File

@ -5,7 +5,7 @@ import { PaymentDetailsComponent } from './payment-details.component';
const paymentDetailsRoutes: Routes = [
{
path: ':invoiceID/payment/:paymentID',
path: ':paymentID',
component: PaymentDetailsComponent
}
];

View File

@ -12,7 +12,7 @@ import { InvoicesTableData } from './invoices-table-data';
export class TableComponent {
@Input() data: MatTableDataSource<InvoicesTableData>;
displayedColumns: string[] = ['invoiceID', 'amount', 'status', 'createdAt', 'shop'];
displayedColumns: string[] = ['invoiceID', 'amount', 'status', 'createdAt', 'shop', 'actions'];
constructor(private router: Router) {}

View File

@ -17,12 +17,16 @@ const routes: Routes = [
loadChildren: () => import('./payment-section').then(m => m.PaymentSectionModule)
},
{
path: 'invoice',
path: 'invoice/:invoiceID/payment',
loadChildren: () => import('./payment-details').then(m => m.PaymentDetailsModule)
},
{
path: 'invoice',
loadChildren: () => import('./invoice-details').then(m => m.InvoiceDetailsModule)
},
{
path: 'report',
loadChildren: () => import('./report').then(m => m.ReportModule)
loadChildren: () => import('./report-details').then(m => m.ReportModule)
},
{
path: 'onboarding',