From dce4e644d5e5d9c97ff5ac337448b52f2a2a64fd Mon Sep 17 00:00:00 2001 From: TAMARA JERINIC Date: Wed, 2 Mar 2022 23:38:27 +0100 Subject: Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into Tamara # Conflicts: # .gitignore --- .../frontend/src/app/app-routing.module.ts | 22 ++++++++ .../frontend/src/app/app.component.css | 14 +++++ .../frontend/src/app/app.component.html | 6 ++ .../frontend/src/app/app.component.spec.ts | 35 ++++++++++++ .../frontend/src/app/app.component.ts | 10 ++++ .../frontend/src/app/app.module.ts | 35 ++++++++++++ .../src/app/homepage/homepage.component.css | 18 ++++++ .../src/app/homepage/homepage.component.html | 29 ++++++++++ .../src/app/homepage/homepage.component.spec.ts | 25 +++++++++ .../src/app/homepage/homepage.component.ts | 42 ++++++++++++++ .../app/izmeni-laptop/izmeni-laptop.component.css | 10 ++++ .../app/izmeni-laptop/izmeni-laptop.component.html | 25 +++++++++ .../izmeni-laptop/izmeni-laptop.component.spec.ts | 25 +++++++++ .../app/izmeni-laptop/izmeni-laptop.component.ts | 43 +++++++++++++++ .../frontend/src/app/laptop/laptop.component.css | 22 ++++++++ .../frontend/src/app/laptop/laptop.component.html | 41 ++++++++++++++ .../src/app/laptop/laptop.component.spec.ts | 25 +++++++++ .../frontend/src/app/laptop/laptop.component.ts | 30 ++++++++++ .../frontend/src/app/models/laptop.ts | 11 ++++ .../frontend/src/app/navbar/navbar.component.css | 17 ++++++ .../frontend/src/app/navbar/navbar.component.html | 4 ++ .../src/app/navbar/navbar.component.spec.ts | 25 +++++++++ .../frontend/src/app/navbar/navbar.component.ts | 27 +++++++++ .../src/app/new-laptop/new-laptop.component.css | 10 ++++ .../src/app/new-laptop/new-laptop.component.html | 24 ++++++++ .../app/new-laptop/new-laptop.component.spec.ts | 25 +++++++++ .../src/app/new-laptop/new-laptop.component.ts | 35 ++++++++++++ .../page-not-found/page-not-found.component.css | 4 ++ .../page-not-found/page-not-found.component.html | 3 + .../page-not-found.component.spec.ts | 25 +++++++++ .../app/page-not-found/page-not-found.component.ts | 15 +++++ .../src/app/services/library.service.spec.ts | 16 ++++++ .../frontend/src/app/services/library.service.ts | 61 +++++++++++++++++++++ .../frontend/src/assets/.gitkeep | 0 .../frontend/src/environments/environment.prod.ts | 3 + .../frontend/src/environments/environment.ts | 16 ++++++ .../frontend/src/favicon.ico | Bin 0 -> 948 bytes .../TestIvanLjubisavljevic/frontend/src/index.html | 13 +++++ .../TestIvanLjubisavljevic/frontend/src/main.ts | 12 ++++ .../frontend/src/polyfills.ts | 53 ++++++++++++++++++ .../TestIvanLjubisavljevic/frontend/src/styles.css | 1 + .../TestIvanLjubisavljevic/frontend/src/test.ts | 26 +++++++++ 42 files changed, 883 insertions(+) create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app-routing.module.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/app.module.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/models/laptop.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.spec.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/assets/.gitkeep create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.prod.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/favicon.ico create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/index.html create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/main.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/polyfills.ts create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/styles.css create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/test.ts (limited to 'sandbox/TestIvanLjubisavljevic/frontend/src') diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app-routing.module.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app-routing.module.ts new file mode 100755 index 00000000..6991b1d0 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app-routing.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { HomepageComponent } from './homepage/homepage.component'; +import { IzmeniLaptopComponent } from './izmeni-laptop/izmeni-laptop.component'; +import { LaptopComponent } from './laptop/laptop.component'; +import { NewLaptopComponent } from './new-laptop/new-laptop.component'; +import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; + +const routes: Routes = [ + {path:"", component:HomepageComponent}, + {path:"homepage", component:HomepageComponent}, + {path:"newLaptop", component:NewLaptopComponent}, + {path:"izmeniLaptop/:id", component:IzmeniLaptopComponent}, + {path:"laptop/:id", component:LaptopComponent}, + {path:"**", component:PageNotFoundComponent} +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.css new file mode 100755 index 00000000..56ebd4a2 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.css @@ -0,0 +1,14 @@ +h1{ + padding: 30px; + text-align: center; + color:rgb(42, 71, 165); +} +div{ + width: 100%; + background-color:rgb(134, 186, 235); + color: blueviolet; +} + +html{ + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.html new file mode 100755 index 00000000..39dcd1dd --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.html @@ -0,0 +1,6 @@ + +
+

Dobrodošli u prvi online info servis laptopova

+ +
+ diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.spec.ts new file mode 100755 index 00000000..74b5b3eb --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.spec.ts @@ -0,0 +1,35 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + RouterTestingModule + ], + declarations: [ + AppComponent + ], + }).compileComponents(); + }); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'frontend'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('frontend'); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('.content span')?.textContent).toContain('frontend app is running!'); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.ts new file mode 100755 index 00000000..9d6b2f11 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] +}) +export class AppComponent { + title = 'frontend'; +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.module.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.module.ts new file mode 100755 index 00000000..98295d39 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/app.module.ts @@ -0,0 +1,35 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; + +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; +import { HomepageComponent } from './homepage/homepage.component'; +import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; +import { LaptopComponent } from './laptop/laptop.component'; +import { FormsModule } from '@angular/forms'; + +import { HttpClientModule } from '@angular/common/http'; +import { IzmeniLaptopComponent } from './izmeni-laptop/izmeni-laptop.component'; +import { NewLaptopComponent } from './new-laptop/new-laptop.component'; +import { NavbarComponent } from './navbar/navbar.component'; + +@NgModule({ + declarations: [ + AppComponent, + HomepageComponent, + PageNotFoundComponent, + LaptopComponent, + IzmeniLaptopComponent, + NewLaptopComponent, + NavbarComponent + ], + imports: [ + BrowserModule, + AppRoutingModule, + FormsModule, + HttpClientModule + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.css new file mode 100755 index 00000000..5f298325 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.css @@ -0,0 +1,18 @@ +table { + border-collapse: collapse; + width: 100%; + border: 1px solid green; + margin-top:15px; + } + +th{ + border:1px solid rgb(19, 0, 128); + height: 30px; + background-color:rgb(134, 186, 235); +} + +td{ + border:1px solid rgb(19, 0, 128); + height: 30px; + text-align: center; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.html new file mode 100755 index 00000000..406ff0ea --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SPISAK DOSTUPNIH LAPTOPOVA
BRENDMODELRAMMEMORIJAGRAFIKAEKRANPROCESORCENAUREDIOBRIŠI
{{laptop.brand}}{{laptop.model}}{{laptop.ram}} gb{{laptop.hdd}} gb{{laptop.graphics}}{{laptop.display}}"{{laptop.processor}}{{laptop.price}} €
diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.spec.ts new file mode 100755 index 00000000..116588cc --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomepageComponent } from './homepage.component'; + +describe('HomepageComponent', () => { + let component: HomepageComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ HomepageComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(HomepageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts new file mode 100755 index 00000000..4ebea54d --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts @@ -0,0 +1,42 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { Laptop } from '../models/laptop'; +import { LibraryServiceService } from '../services/library.service'; + +@Component({ + selector: 'app-homepage', + templateUrl: './homepage.component.html', + styleUrls: ['./homepage.component.css'] +}) +export class HomepageComponent implements OnInit { + laptops?:Laptop[] + constructor(private library : LibraryServiceService, private router:Router) { } + + ngOnInit(): void { + + this.library.dajLaptopove().subscribe(laptopovi =>{ + this.laptops = laptopovi + }) + } + + pogledaj(id:String) + { + this.router.navigate(["/laptop/"+id]) + } + + izmeni(laptop:Laptop) + { + this.router.navigate(['/izmeniLaptop/'+laptop.id]) + } + + obrisi(laptop:Laptop) + { + this.library.obrisiLaptop(laptop.id).subscribe(req=>{ + + this.library.dajLaptopove().subscribe(laptopovi =>{ + this.laptops = laptopovi + }) + }) + } + +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.css new file mode 100755 index 00000000..ab085673 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.css @@ -0,0 +1,10 @@ +input{ + margin:5px; +} +button{ + margin:5px; +} +#forma{ + width: 250px; + margin: auto; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.html new file mode 100755 index 00000000..c49a700d --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.html @@ -0,0 +1,25 @@ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+

Uspešno izmenjeni podaci!

+
\ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.spec.ts new file mode 100755 index 00000000..cd33375a --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IzmeniLaptopComponent } from './izmeni-laptop.component'; + +describe('IzmeniLaptopComponent', () => { + let component: IzmeniLaptopComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ IzmeniLaptopComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(IzmeniLaptopComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.ts new file mode 100755 index 00000000..7a4f44b4 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/izmeni-laptop/izmeni-laptop.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Laptop } from '../models/laptop'; +import { LibraryServiceService } from '../services/library.service'; + +@Component({ + selector: 'app-izmeni-laptop', + templateUrl: './izmeni-laptop.component.html', + styleUrls: ['./izmeni-laptop.component.css'] +}) +export class IzmeniLaptopComponent implements OnInit { + laptop?:Laptop + izmenio?:boolean + constructor(private router:Router,private library:LibraryServiceService, private route:ActivatedRoute) { } + + ngOnInit(): void { + this.route.params.subscribe(url=>{ + this.library.dajLaptop(url["id"]).subscribe(laptop =>{ + this.laptop = laptop + }) + }) + } + + izmeni(laptop?:Laptop) + { + this.library.izmeniLaptop(laptop).subscribe(laptop=>{ + this.route.params.subscribe(url=>{ + this.library.dajLaptop(url["id"]).subscribe(laptop =>{ + this.laptop = laptop + this.izmenio = true; + }) + }) + }) + } + + back() + { + this.router.navigate(["/homepage"]) + } + + + +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css new file mode 100755 index 00000000..6d5e47ba --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css @@ -0,0 +1,22 @@ +table { + border-collapse: collapse; + width: 100%; + border: 1px solid green; + margin-top:15px; + } + +th{ + border:1px solid green; + height: 30px; + background-color:springgreen; +} + +td{ + border:1px solid salmon; + height: 30px; + text-align: center; +} +#forma{ + width: 250px; + margin: auto; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html new file mode 100755 index 00000000..e1f90df3 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html @@ -0,0 +1,41 @@ +
+

Karakteristike laptopa:

+ Brend: {{laptop.brand}}
+ Model: {{laptop.model}}
+ RAM: {{laptop.ram}} GB
+ HDD: {{laptop.hdd}} GB
+ Grafika: {{laptop.graphics}} (GB)
+ Dijagonala ekrana: {{laptop.display}} "
+ Procesor: {{laptop.processor}}
+ Cena: {{laptop.price}} €

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LAPTOPOVI MARKE {{laptop.brand}}
BrendMODELRAMHDDGrafikaDijagonala ekranaProcesorCena
{{laptop.brand}}{{laptop.model}}{{laptop.ram}}{{laptop.hdd}}{{laptop.graphics}}{{laptop.display}}{{laptop.processor}}{{laptop.price}} €
+
+ \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts new file mode 100755 index 00000000..a9ef8a05 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LaptopComponent } from './laptop.component'; + +describe('LaptopComponent', () => { + let component: LaptopComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ LaptopComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(LaptopComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts new file mode 100755 index 00000000..94d711bb --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts @@ -0,0 +1,30 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Laptop } from '../models/laptop'; +import { LibraryServiceService } from '../services/library.service'; + +@Component({ + selector: 'app-laptop', + templateUrl: './laptop.component.html', + styleUrls: ['./laptop.component.css'] +}) +export class LaptopComponent implements OnInit { + laptop?:Laptop + laptopoviM?:Laptop[] + constructor(private library: LibraryServiceService, private route:ActivatedRoute, private router:Router) { } + + ngOnInit(): void { + + this.route.params.subscribe(url =>{ + this.library.dajLaptop(url["id"]).subscribe(laptop=>{ + this.laptop = laptop; + }) + }) + } + + + pogledaj(id:String) + { + this.router.navigate(["/laptop/"+id]) + } +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/models/laptop.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/models/laptop.ts new file mode 100755 index 00000000..d5747358 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/models/laptop.ts @@ -0,0 +1,11 @@ +export interface Laptop{ + brand: String; + model: String; + ram: Number; + hdd:Number; + graphics: String; + price: Number; + display : String; + processor: String; + id: String; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.css new file mode 100755 index 00000000..48a0e297 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.css @@ -0,0 +1,17 @@ +button{ + margin:5px; + padding:5px; + width: 150px; + color: rgb(19, 0, 128); + font-weight: bold; +} + +button:hover{ + background-color: rgb(170, 165, 190); + color:black; +} + +div{ + margin: auto; + width: 26%; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.html new file mode 100755 index 00000000..928fc01e --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.html @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.spec.ts new file mode 100755 index 00000000..f8ccd6f4 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NavbarComponent } from './navbar.component'; + +describe('NavbarComponent', () => { + let component: NavbarComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ NavbarComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(NavbarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.ts new file mode 100755 index 00000000..2cdf7ae3 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/navbar/navbar.component.ts @@ -0,0 +1,27 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { CookieService } from 'ngx-cookie-service'; + +@Component({ + selector: 'app-navbar', + templateUrl: './navbar.component.html', + styleUrls: ['./navbar.component.css'] +}) +export class NavbarComponent implements OnInit { + + constructor(private router:Router, private cookie:CookieService) { } + + ngOnInit(): void { + } + + pocetna() + { + this.router.navigate(["/homepage"]) + } + + dodaj() + { + this.router.navigate(["/newLaptop"]) + } + +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.css new file mode 100755 index 00000000..ab085673 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.css @@ -0,0 +1,10 @@ +input{ + margin:5px; +} +button{ + margin:5px; +} +#forma{ + width: 250px; + margin: auto; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.html new file mode 100755 index 00000000..0669929b --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.html @@ -0,0 +1,24 @@ +
+

DODAJ LAPTOP

+ +
+ +
+   +
+   +
+     +
+ +
+ +
+         +
+ + + + +
+ diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.spec.ts new file mode 100755 index 00000000..a2218fc7 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NewLaptopComponent } from './new-laptop.component'; + +describe('NewLaptopComponent', () => { + let component: NewLaptopComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ NewLaptopComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(NewLaptopComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.ts new file mode 100755 index 00000000..5211c4d3 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { LaptopComponent } from '../laptop/laptop.component'; +import { Laptop } from '../models/laptop'; +import { LibraryServiceService } from '../services/library.service'; + +@Component({ + selector: 'app-new-laptop', + templateUrl: './new-laptop.component.html', + styleUrls: ['./new-laptop.component.css'] +}) +export class NewLaptopComponent implements OnInit { + + laptop:Laptop= {} as Laptop + constructor(private router:Router, private library: LibraryServiceService) { } + + ngOnInit(): void { + + } + + + back() + { + this.router.navigate(["/homepage"]) + } + + dodaj(laptop:Laptop) + { + this.library.unesiLaptop(laptop).subscribe(laptop=>{ + this.router.navigate(["/laptop/"+laptop.id]) + }) + } + + +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.css new file mode 100755 index 00000000..f918ef97 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.css @@ -0,0 +1,4 @@ +div{ + width: 500px; + margin:auto; +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.html new file mode 100755 index 00000000..d1e18002 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.html @@ -0,0 +1,3 @@ +
+

PAGE NOT FOUND ERROR 404

+
\ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.spec.ts new file mode 100755 index 00000000..aa242a97 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PageNotFoundComponent } from './page-not-found.component'; + +describe('PageNotFoundComponent', () => { + let component: PageNotFoundComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PageNotFoundComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PageNotFoundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.ts new file mode 100755 index 00000000..8aeb7485 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/page-not-found/page-not-found.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-page-not-found', + templateUrl: './page-not-found.component.html', + styleUrls: ['./page-not-found.component.css'] +}) +export class PageNotFoundComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.spec.ts new file mode 100755 index 00000000..c64a4343 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { LibraryServiceService } from './library.service'; + +describe('LibraryService', () => { + let service: LibraryServiceService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(LibraryServiceService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.ts new file mode 100755 index 00000000..e16759d9 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/services/library.service.ts @@ -0,0 +1,61 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { HttpClient, HttpClientModule, HttpHeaders } from '@angular/common/http'; +import { Laptop } from '../models/laptop'; + +@Injectable({ + providedIn: 'root' +}) + +export class LibraryServiceService { + + constructor(private http:HttpClient) { } + + //DAJ SVE LAPTOPOVE + dajLaptopove(): Observable + { + return this.http.get("http://localhost:5000/api/sviLaptopovi"); + } + + //DAJ ODREDJENI LAPTOP + dajLaptop(id:String): Observable + { + return this.http.get("http://localhost:5000/api/laptop/"+id); + } + + //UNESI NOVI LAPTOP + unesiLaptop(reqBody:Laptop): Observable + { + return this.http.post("http://localhost:5000/api/add", + {"brand": reqBody.brand, + "model": reqBody.model, + "ram": reqBody.ram, + "hdd": reqBody.hdd, + "graphics": reqBody.graphics, + "price":reqBody.price, + "display" : reqBody.display, + "id": "a873b90f-5fca-4c41-a00e-8ea497cce542", + "processor": reqBody.processor}); + } + + //IZMENI LAPTOP + izmeniLaptop(reqBody?:Laptop): Observable + { + return this.http.put("http://localhost:5000/api/update", + {"brand": reqBody?.brand, + "model": reqBody?.model, + "ram": reqBody?.ram, + "hdd": reqBody?.hdd, + "graphics": reqBody?.graphics, + "price":reqBody?.price, + "display" : reqBody?.display, + "processor": reqBody?.processor, + "id":reqBody?.id}); + } + + //OBRISI LAPTOP + obrisiLaptop(id:String): Observable + { + return this.http.delete("http://localhost:5000/api/brisanje/"+id); + } +} \ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/assets/.gitkeep b/sandbox/TestIvanLjubisavljevic/frontend/src/assets/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.prod.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.prod.ts new file mode 100755 index 00000000..3612073b --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.ts new file mode 100755 index 00000000..f56ff470 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/favicon.ico b/sandbox/TestIvanLjubisavljevic/frontend/src/favicon.ico new file mode 100755 index 00000000..997406ad Binary files /dev/null and b/sandbox/TestIvanLjubisavljevic/frontend/src/favicon.ico differ diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/index.html b/sandbox/TestIvanLjubisavljevic/frontend/src/index.html new file mode 100755 index 00000000..2c8fd5f4 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/index.html @@ -0,0 +1,13 @@ + + + + + Prodavnica laptopova + + + + + + + + diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/main.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/main.ts new file mode 100755 index 00000000..c7b673cf --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/polyfills.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/polyfills.ts new file mode 100755 index 00000000..429bb9ef --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/polyfills.ts @@ -0,0 +1,53 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes recent versions of Safari, Chrome (including + * Opera), Edge on the desktop, and iOS and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/styles.css b/sandbox/TestIvanLjubisavljevic/frontend/src/styles.css new file mode 100755 index 00000000..90d4ee00 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/test.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/test.ts new file mode 100755 index 00000000..00025daf --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/test.ts @@ -0,0 +1,26 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + (id: string): T; + keys(): string[]; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), +); + +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); -- cgit v1.2.3