aboutsummaryrefslogtreecommitdiff
path: root/sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop')
-rwxr-xr-xsandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.css10
-rwxr-xr-xsandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.html24
-rwxr-xr-xsandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.spec.ts25
-rwxr-xr-xsandbox/TestIvanLjubisavljevic/frontend/src/app/new-laptop/new-laptop.component.ts35
4 files changed, 94 insertions, 0 deletions
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 @@
+<div id="forma">
+ <h2>DODAJ LAPTOP</h2>
+ <label>Brand:</label>
+ <input type="text" placeholder=" Lenovo" [(ngModel)]="laptop.brand"><br>
+ <label>Model:</label>
+ <input type="text" placeholder=" Ideapad" [(ngModel)]="laptop.model"><br>
+ <label>Ram:</label> &nbsp;
+ <input type="number" placeholder=" 8" [(ngModel)]="laptop.ram"> <br>
+ <label>Memorija:</label>&nbsp;
+ <input type="number" placeholder=" 1000" [(ngModel)]="laptop.hdd"> <br>
+ <label>Grafika:</label> &nbsp; &nbsp;
+ <input type="text" placeholder=" nVidia GeForce 1080" [(ngModel)]="laptop.graphics"> <br>
+ <label>Ekran:</label>
+ <input type="text" placeholder=" 15.6" [(ngModel)]="laptop.display"> <br>
+ <label>Procesor:</label>
+ <input type="text" placeholder=" Intel i7 dualCore " [(ngModel)]="laptop.processor"><br>
+ <label>Cena:</label> &nbsp; &nbsp; &nbsp; &nbsp;
+ <input type="number" placeholder=" 760 " [(ngModel)]="laptop.price"><br>
+
+ <button (click)="dodaj(laptop)">Dodaj laptop</button>
+
+ <button (click)="back()">Nazad na početnu</button>
+</div>
+
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<NewLaptopComponent>;
+
+ 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])
+ })
+ }
+
+
+}