Skip to content

Commit

Permalink
Merge pull request #133 from nongrata081/feature/shipment-form
Browse files Browse the repository at this point in the history
feat(shipment-form): add shipment form
  • Loading branch information
nongrata081 authored Jul 2, 2019
2 parents 5cc5ce0 + d8cf31c commit 659af09
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 317 deletions.
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
{
"type": "all",
"baseline": "750kb",
"maximumWarning": "200kb",
"maximumError": "400kb"
"maximumWarning": "4mb",
"maximumError": "6mb"
}
]
},
Expand Down
290 changes: 0 additions & 290 deletions fake-rest-api/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,296 +23,6 @@
"value": 12.12
}
]
},
{
"packages": [
{
"name": "adfadf",
"weight": 3.123,
"value": 10.64
},
{
"name": "fadfag",
"weight": 3.231,
"value": 47.91
}
],
"id": "UiYl4c4"
},
{
"packages": [
{
"name": "Some Piro",
"weight": 3.123,
"value": 5.9
},
{
"name": "fadf",
"weight": 3.123,
"value": 36.17
}
],
"id": "dv-A5NI"
},
{
"packages": [
{
"name": "adfadf",
"weight": 3.123,
"value": 4.49
}
],
"id": "06Le_ZV"
},
{
"packages": [
{
"name": "adfaf",
"weight": 2.123,
"value": 28.18
}
],
"id": "yDEyJZr"
},
{
"packages": [
{
"name": "adfaf",
"weight": 2.123,
"value": 28.18
}
],
"id": "sCW_SoJ"
},
{
"packages": [
{
"name": "adfaf",
"weight": 2.123,
"value": 28.18
}
],
"id": "NdX8N75"
},
{
"packages": [
{
"name": "adfadf",
"weight": 2.123,
"value": 3.61
}
],
"id": "tCKvdGt"
},
{
"packages": [
{
"name": "adfadf",
"weight": 2.123,
"value": 3.61
}
],
"id": "j5HF1R1"
},
{
"packages": [
{
"name": "adfa",
"weight": 3.123,
"value": 28.18
}
],
"id": "ipp6qtc"
},
{
"packages": [
{
"name": "adf",
"weight": 3.123,
"value": 20.28
}
],
"id": "GZmi38V"
},
{
"packages": [
{
"name": "adf",
"weight": 3.23,
"value": 1.86
}
],
"id": "cw1tEGO"
},
{
"packages": [
{
"name": "adf",
"weight": 1.23,
"value": 20.38
}
],
"id": "MAsKCx2"
},
{
"packages": [
{
"name": "adf",
"weight": 2.12,
"value": 2.74
}
],
"id": "uoWSFUK"
},
{
"packages": [
{
"name": "adfaf",
"weight": 2.12,
"value": 1.86
}
],
"id": "w4ES0ld"
},
{
"packages": [
{
"name": "adfaf",
"weight": 2.12,
"value": 2.36
}
],
"id": "cfzzK15"
},
{
"packages": [
{
"name": "adf",
"weight": 2.123,
"value": 32.12
}
],
"id": "U-0rFqc"
},
{
"packages": [
{
"name": "adf",
"weight": 2.123,
"value": 28.18
}
],
"id": "0XKdK-J"
},
{
"packages": [
{
"name": "adf",
"weight": 3.12,
"value": 3.12
}
],
"id": "1LbceN-"
},
{
"packages": [
{
"name": "adf",
"weight": 3.12,
"value": 2.74
}
],
"id": "ZOgGs1_"
},
{
"packages": [
{
"name": "adf",
"weight": 3.12,
"value": 3.47
}
],
"id": "LAfdN44"
},
{
"packages": [
{
"name": "adf",
"weight": 3.12,
"value": 23.12
}
],
"id": "nsDbkQI"
},
{
"packages": [
{
"name": "adf",
"weight": 1,
"value": 25.56
}
],
"id": "IPy0uew"
},
{
"packages": [
{
"name": "dadf",
"weight": 2.1,
"value": 0.88
}
],
"id": "S9sNOAP"
},
{
"packages": [
{
"name": "adfadf",
"weight": 1,
"value": 20.28
}
],
"id": "TIklosU"
},
{
"packages": [
{
"name": "adf",
"weight": 2.1,
"value": 136.8
}
],
"id": "k2wTxjs"
},
{
"packages": [
{
"name": "adf",
"weight": 2.12,
"value": 20.28
}
],
"id": "EqELFUC"
},
{
"packages": [
{
"name": "adf",
"weight": 1.23,
"value": 20.28
}
],
"id": "6Tdb86O"
},
{
"packages": [
{
"name": "adf",
"weight": 2.12,
"value": 3.61
}
],
"id": "UoXbpwz"
}
]
}
1 change: 1 addition & 0 deletions libs/data/src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Package {
name: string;
weight: number | string;
value: number | Value;
currency?: Currency;
}

export interface CurrencyRates {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div [formGroup]="shipment">
<div
formArrayName="packages"
*ngFor="let packageItem of shipment.get('packages').controls; index as i"
*ngFor="let packageItem of packageItemsForms.controls; index as i"
>
<div
[formGroupName]="i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export class PackageFormComponent implements OnInit, OnDestroy {
this.packageDataSubscription = this.shipment.valueChanges.subscribe(val => {
this.packagesData.emit(val);
this.isPackageFormValid.emit(this.shipment.valid);
console.log(
'this.shipment.valueChanges, this.shipment.valid:',
this.shipment.valid
);
});
}

Expand Down Expand Up @@ -57,7 +53,11 @@ export class PackageFormComponent implements OnInit, OnDestroy {

disableRemovingPackage(): boolean {
this.packages = this.shipment.get('packages') as FormArray;
return this.packages.length === 1;
return this.packages.length <= 1;
}

get packageItemsForms() {
return <FormArray>this.shipment.get('packages');
}

ngOnDestroy() {
Expand Down
Loading

0 comments on commit 659af09

Please sign in to comment.