Disable Fixed Asset.

This commit is contained in:
Artur 2024-11-05 09:04:28 +01:00
parent fb175d66ff
commit 7f683639c6
4 changed files with 13 additions and 11 deletions

View File

@ -2,7 +2,7 @@
<div class="container">
| <a class="navbar-brand" href="/about-me">O mnie</a>
| <a class="navbar-brand" href="/asset-calculator">Kalkulator amortyzacyjny</a>
| <a class="navbar-brand" href="/fixed-asset">Środki trwałe</a>
<!-- | <a class="navbar-brand" href="/fixed-asset">Środki trwałe</a> -->
| <a class="navbar-brand" href="/quotes">Kursy</a>
<!-- <a class="navbar-brand" href="/jobfinder">Oferty</a> -->
</div>

View File

@ -29,14 +29,16 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
lifeFormArray = new FormArray<FormGroup>([]);
assetsDepreciationFormGroup = new FormGroup( {
initialValueAsset : new FormControl( 5000, [ Validators.required, this.currencyValidator ]),
rate : new FormControl( 20 ) ,
year_month : new FormControl( "2024-10" ),
typeDepreciation : new FormControl( TypeDepreciation.linear ),
factor : new FormControl( 2/*, [Validators.required,Validators.max(2)]*/ ),
assetsDepreciationFormGroup = new FormGroup({
initialValueAsset : new FormControl<number>( 5000, [ Validators.required, this.currencyValidator ]),
rate : new FormControl<number>( 20 ) ,
year_month : new FormControl<string>( "2024-10" ),
typeDepreciation : new FormControl<TypeDepreciation>( TypeDepreciation.linear ),
factor : new FormControl<number>( 2/*, [Validators.required,Validators.max(2)]*/ ),
} );
} as {
[key in keyof FormValues]: FormControl<FormValues[key]>
});
constructor(private assetService : AssetService ){
this.assetsDepreciationFormGroup.valueChanges.subscribe( (value) => this.calculate() );
@ -79,7 +81,7 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
private controlsToAsset() : Asset {
const formValues = this.assetsDepreciationFormGroup.value as FormValues;
const formValues = this.assetsDepreciationFormGroup.getRawValue();
const when = new YearMonth( formValues.year_month );
const asset = new Asset( when );

View File

@ -22,7 +22,7 @@ export class YearMonthUtil{
return ym.year + '-' + ym.month ;
}
static toToday( ):YearMonth{
static today( ):YearMonth{
const today = new Date();
return new YearMonth( today.getFullYear() + '-' +today.getMonth()+1 );
}

View File

@ -96,7 +96,7 @@ export class FixedAssetComponent {
const nrInv = control.get('nrInv')?.value;
const initialValue = control.get('initialValue')?.value;
const yearMonth = YearMonthUtil.toToday();
const yearMonth = YearMonthUtil.today();
const asset = new Asset( yearMonth );
const assetLifeChange = new AssetLifeChange( yearMonth, initialValue, 0, 0 );
asset.addChange( assetLifeChange );