From 52e73d2ff1a97f673bbda2e8595dc0aa29641f07 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 31 Oct 2024 22:40:32 +0100 Subject: [PATCH] Changing from job-finder to MT --- src/app/app.component.html | 17 ++--- src/app/app.routes.ts | 46 +++++++++---- .../asset-calculator.component.html | 8 +-- .../asset-calculator.component.ts | 5 +- src/app/asset-calculator/assets/asset.ts | 40 ++++++++++- src/app/fixed-asset/fixed-asset.component.css | 0 .../fixed-asset/fixed-asset.component.html | 54 +++++++++++++++ .../fixed-asset/fixed-asset.component.spec.ts | 23 +++++++ src/app/fixed-asset/fixed-asset.component.ts | 66 +++++++++++++++++++ src/app/jobfinder/jobfinder.component.ts | 2 +- 10 files changed, 228 insertions(+), 33 deletions(-) create mode 100644 src/app/fixed-asset/fixed-asset.component.css create mode 100644 src/app/fixed-asset/fixed-asset.component.html create mode 100644 src/app/fixed-asset/fixed-asset.component.spec.ts create mode 100644 src/app/fixed-asset/fixed-asset.component.ts diff --git a/src/app/app.component.html b/src/app/app.component.html index 17c9580..0c7ec51 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,14 +1,11 @@ - -
-
- - ` \ No newline at end of file diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 5c554ce..91409e0 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -3,22 +3,40 @@ import { DashboardComponent } from './components/dashboard/dashboard.component'; import { AssetCalculatorComponent } from './asset-calculator/asset-calculator.component'; import { AboutMeComponent } from './about-me/about-me.component'; import { ChatGPTComponent } from './chat-gpt/chat-gpt.component'; -import {JobfinderComponent } from './jobfinder/jobfinder.component' +import {JobfinderComponent } from './jobfinder/jobfinder.component'; +import { FixedAssetComponent } from './fixed-asset/fixed-asset.component'; + export const routes: Routes = [ - { path: "", - title: "Wyszukiwacz pracy", - component:AssetCalculatorComponent }, - { path: "about-me", + { + path: "", + title: "Środki trwałe", + component:FixedAssetComponent + }, + { + path: "about-me", title:"O mnie", - component: AboutMeComponent }, - { path: "asset-calculator", + component: AboutMeComponent + }, + { + path: "asset-calculator", title: "Kalkulator amortyzacyjny", - component:AssetCalculatorComponent }, - { path: "quotes", + component:AssetCalculatorComponent + }, + { + path: "quotes", title:"Kursy podstawowych walut i złota", - component: DashboardComponent }, - { path: "jobfinder", - title:"Wyszukiwacz pracy i serwis do jej rejestracji", - component: JobfinderComponent } - ]; + component: DashboardComponent + }, + { + path: "jobfinder", + title:"Wyszukiwacz pracy i serwis do jej rejestracji", + component: JobfinderComponent + }, + { + path: "fixed-asset", + title:"Środki trwałe", + component: FixedAssetComponent + } + ] +; diff --git a/src/app/asset-calculator/asset-calculator.component.html b/src/app/asset-calculator/asset-calculator.component.html index 30dc2ac..0d05ca5 100644 --- a/src/app/asset-calculator/asset-calculator.component.html +++ b/src/app/asset-calculator/asset-calculator.component.html @@ -83,10 +83,10 @@ -
- -
+
+ +
@if( lifeFormArray.controls.length > 0 ){
diff --git a/src/app/asset-calculator/asset-calculator.component.ts b/src/app/asset-calculator/asset-calculator.component.ts index df0e53d..322416f 100644 --- a/src/app/asset-calculator/asset-calculator.component.ts +++ b/src/app/asset-calculator/asset-calculator.component.ts @@ -1,14 +1,15 @@ import {Component, effect, computed, OnInit, signal } from '@angular/core'; import {ReactiveFormsModule, FormGroup, Validators, FormControl, FormArray} from '@angular/forms'; import {CurrencyPipe,DecimalPipe,PercentPipe, NgFor} from '@angular/common'; -import {AssetsModule} from './assets/assets.module' + + import {Asset, Positions, AssetPlanPosition, TypeDepreciation, YearMonth, AssetLifeChange } from './assets/asset'; import {AssetService} from './assets/service/asset.service' @Component({ selector: 'app-asset-calculator', standalone: true, - imports: [ CurrencyPipe, DecimalPipe, PercentPipe, AssetsModule, ReactiveFormsModule, NgFor ] , + imports: [ CurrencyPipe, DecimalPipe, PercentPipe, ReactiveFormsModule, NgFor ] , templateUrl: "asset-calculator.component.html", styleUrl: 'asset-calculator.component.css' }) diff --git a/src/app/asset-calculator/assets/asset.ts b/src/app/asset-calculator/assets/asset.ts index 43be609..f18f261 100644 --- a/src/app/asset-calculator/assets/asset.ts +++ b/src/app/asset-calculator/assets/asset.ts @@ -34,7 +34,9 @@ export class AssetLifeChange{ } + export class Asset { + start : YearMonth ; depreciationRate : number ; type : TypeDepreciation; @@ -47,8 +49,8 @@ export class Asset { } constructor( depreciationRate : number, - start : YearMonth, - type : TypeDepreciation, + start : YearMonth, + type : TypeDepreciation, factorValue : number ){ this.depreciationRate = depreciationRate; this.start = start; @@ -58,6 +60,40 @@ export class Asset { } +export class AssetsContainer{ + + assets: Map = new Map(); + + constructor(){ + this.initDefault(); + } + + initDefault(){ + const yearMonth = new YearMonth('2024-11'); + this.assets.set('Inv01', new Asset( 1000, yearMonth, TypeDepreciation.linear, 20 ) ); + this.assets.set('Inv02', new Asset( 3000, yearMonth, TypeDepreciation.linear, 20 ) ); + this.assets.set('Inv03', new Asset( 5000, yearMonth, TypeDepreciation.linear, 15 ) ); + + } + + delete( nrInv: string ){ + this.assets.delete(nrInv); + } + + put( invNumber:string, asset: Asset ){ + this.assets.set( invNumber, asset ); + } + + get( invNumber:string ){ + return this.assets.get( invNumber ); + } + + getNrAssets( ){ + return Array.from( this.assets.entries() ); + } + + +} export class AssetPlanPosition{ when : YearMonth = new YearMonth('0-0'); diff --git a/src/app/fixed-asset/fixed-asset.component.css b/src/app/fixed-asset/fixed-asset.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/fixed-asset/fixed-asset.component.html b/src/app/fixed-asset/fixed-asset.component.html new file mode 100644 index 0000000..5729245 --- /dev/null +++ b/src/app/fixed-asset/fixed-asset.component.html @@ -0,0 +1,54 @@ +
+ +

Lista środków trwałych

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ + + + + + + + + + +
Numer inwentarzowyKŚTZmiany wartościMetoda amortyzacjiPlan
Inv1001 + 1 zmian + 1 metodWylicz planUsuń Składnik
Inv2002 + 2 zmian + 1 metodWylicz planUsuń Składnik
+ + Dodaj środek trwały + Zainicjuj domyślną listę +
diff --git a/src/app/fixed-asset/fixed-asset.component.spec.ts b/src/app/fixed-asset/fixed-asset.component.spec.ts new file mode 100644 index 0000000..94dc10e --- /dev/null +++ b/src/app/fixed-asset/fixed-asset.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FixedAssetComponent } from './fixed-asset.component'; + +describe('FixedAssetComponent', () => { + let component: FixedAssetComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [FixedAssetComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FixedAssetComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/fixed-asset/fixed-asset.component.ts b/src/app/fixed-asset/fixed-asset.component.ts new file mode 100644 index 0000000..23d4a6f --- /dev/null +++ b/src/app/fixed-asset/fixed-asset.component.ts @@ -0,0 +1,66 @@ +import { Component } from '@angular/core'; +import { AssetsContainer, Asset } from '../asset-calculator/assets/asset'; + +@Component({ + selector: 'app-fixed-asset', + standalone: true, + imports: [], + template:` + +
+ +

Lista środków trwałych( w toku )

+
+ + + + + + + + + + + + @for( asset of assetsContainer.getNrAssets(); track asset[0] ) { + + + + + + + + + + } + +
Numer inwentarzowyZmiany wartościMetoda amortyzacjiPlan
{{asset[0]}} + 1 zmian + 1 metodWylicz plan + +
+
+ + +
+`, + styleUrl: './fixed-asset.component.css' +}) +export class FixedAssetComponent { + assetsContainer : AssetsContainer; + + + constructor(){ + this.assetsContainer = new AssetsContainer (); + + } + initDefault(){ + this.assetsContainer.initDefault(); + } + + delete( nrInv : string){ + this.assetsContainer.delete( nrInv ); + } + + +} diff --git a/src/app/jobfinder/jobfinder.component.ts b/src/app/jobfinder/jobfinder.component.ts index ad0c062..b4a1ca1 100644 --- a/src/app/jobfinder/jobfinder.component.ts +++ b/src/app/jobfinder/jobfinder.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ReactiveFormsModule, FormsModule, FormBuilder, FormGroup } from '@angular/forms'; +import { ReactiveFormsModule, FormBuilder, FormGroup } from '@angular/forms'; @Component({ selector: 'app-jobfinder', standalone: true,