Skip to content

Instantly share code, notes, and snippets.

@oops-wrong
Created September 12, 2018 11:44
Show Gist options
  • Save oops-wrong/d8d1f9c5d6a9c276f3fe34b130873844 to your computer and use it in GitHub Desktop.
Save oops-wrong/d8d1f9c5d6a9c276f3fe34b130873844 to your computer and use it in GitHub Desktop.
refunds mock data
import { Component, OnInit } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { AppState } from '~/core/reducers';
import {
Potential,
PotentialType,
sortedPotentialTypes,
sortedPotentialTypesForProject,
} from '../models/potential.model';
import { Refunds } from '../models/refund.model';
import { RefundEntity } from '../models/refund-entity.model';
import { MultiSelectOption } from '~/shared/models/multy-select.model';
import * as fromAccountSelectForm from '../store/account-select-form/account-select-form.reducer';
import { ResetRange } from '../store/refund-filter-form/refund-filter-form.actions';
import * as fromRefundFilterForm from '../store/refund-filter-form/refund-filter-form.reducer';
import {
selectAccountSelectFormState,
selectRefundFilterFormState,
State,
} from '../store/reducers';
@Component({
selector: 'app-dvr',
templateUrl: './dvr.component.html',
styleUrls: ['./dvr.component.scss'],
})
export class DvrComponent implements OnInit {
public accountOptions: MultiSelectOption[] = [
{ display: 'Amco Industries', value: '1' },
{ display: 'Amazon', value: '2' },
];
public countryOptions: MultiSelectOption[] = [
{ display: 'France', value: 'fr' },
{ display: 'Great Britain', value: 'bg' },
];
public groupDetailsForm$: Observable<fromAccountSelectForm.State>;
public potential: Potential = {
order: sortedPotentialTypes,
values: {
[PotentialType.Disqualified]: 1528753,
[PotentialType.InProgress]: 98753,
[PotentialType.NewQualified]: 74652,
[PotentialType.Qualified]: 1019168,
},
};
public projectPotential: Potential = {
order: sortedPotentialTypesForProject,
values: {
[PotentialType.Disqualified]: 5028753,
[PotentialType.InProgress]: 2048753,
[PotentialType.NewQualified]: 7204652,
[PotentialType.Qualified]: 200168,
},
};
public refundEntities: RefundEntity[] = [
{ isUpdated: false, name: 'Amco (Austria) Handeles GmbH' },
{ isUpdated: true, name: 'Amco Automative Rooflights Fr' },
{ isUpdated: true, name: 'Amco Automatine Supplies UK LLP' },
{ isUpdated: false, name: 'Amco Chemicals B.V.' },
{ isUpdated: true, name: 'Amco Finance B.V.' },
{ isUpdated: true, name: 'Amco Insdutrial Part Netherlands' },
{ isUpdated: false, name: 'Amco Holdings AG' },
];
public refundFilterForm$: Observable<fromRefundFilterForm.State>;
public refunds: Refunds = {
'No company name on invoice': {
amount: 807667,
count: 2557,
images: [],
},
'Other company name on the invoice': {
'Amco (Austria) Handeles': {
amount: 100212,
count: 18577,
images: [],
},
'Amco Handeles': {
amount: 35917,
count: 6654,
images: [],
},
'Amco Austria HQ': {
amount: 27577,
count: 5106,
images: [],
},
'Amco Austria HQ GmbH': {
amount: 24924,
count: 4498,
images: [],
},
'Amco HQ GmbH': {
amount: 2917,
count: 540,
images: [],
},
},
"Missing client's VAT ID": {
amount: 807667,
},
'Other sestination on the invoice': {
Ireland: {
amount: 35112,
count: 18577,
images: [],
},
Germany: {
amount: 25100,
count: 6654,
images: [],
},
Hungary: {
amount: 14400,
count: 4560,
images: [],
},
},
};
public activeRefundEntityName: string = this.refundEntities[2].name;
constructor(private store: Store<AppState & State>) {}
public ngOnInit() {
this.groupDetailsForm$ = this.store.pipe(select(selectAccountSelectFormState));
this.refundFilterForm$ = this.store.pipe(select(selectRefundFilterFormState));
}
public onRefundEntitySelect(refundEntity: RefundEntity): void {
this.activeRefundEntityName = refundEntity.name;
}
public onResetRange(): void {
this.store.dispatch(new ResetRange());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment