diff --git a/db.json b/db.json
index baf7af9..d803860 100644
--- a/db.json
+++ b/db.json
@@ -4,19 +4,19 @@
"id": 1,
"name": "Sprite",
"cost": 0.5,
- "remaining": 10
+ "remaining": 8
},
{
"id": 2,
"name": "Coke",
"cost": 0.5,
- "remaining": 10
+ "remaining": 8
},
{
"id": 3,
"name": "Dr. Pepper",
"cost": 0.75,
- "remaining": 10
+ "remaining": 8
},
{
"id": 4,
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 20f9499..9a6aadd 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -2,3 +2,4 @@
{{title}}
+
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index b290358..1764d2e 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -8,11 +8,13 @@ import { InsertCoinComponent } from './insert-coin/insert-coin.component';
import { ItemService } from './item/item.service';
import { BalanceService } from './balance/balance.service';
+import { SelectItemComponent } from './select-item/select-item.component';
@NgModule({
declarations: [
AppComponent,
- InsertCoinComponent
+ InsertCoinComponent,
+ SelectItemComponent
],
imports: [
BrowserModule,
diff --git a/src/app/insert-coin/insert-coin.component.html b/src/app/insert-coin/insert-coin.component.html
index 0513897..632d584 100644
--- a/src/app/insert-coin/insert-coin.component.html
+++ b/src/app/insert-coin/insert-coin.component.html
@@ -1,4 +1,5 @@
-{{ coinBalance? (coinBalance | currency:'USD':true): 'INSERT COIN' }}
+{{ coinBalance? (coinBalance | currency:'USD':true): myMassage }}
+
diff --git a/src/app/insert-coin/insert-coin.component.ts b/src/app/insert-coin/insert-coin.component.ts
index 7c16031..c6e2999 100644
--- a/src/app/insert-coin/insert-coin.component.ts
+++ b/src/app/insert-coin/insert-coin.component.ts
@@ -11,6 +11,8 @@ export class InsertCoinComponent implements OnInit {
coinBalance = 0;
constructor(public balanceService: BalanceService) { }
+ myMassage = "Insert Coin"
+
ngOnInit() {
this.balanceService.onBalanceUpdated((balance) => {
this.coinBalance = balance;
@@ -20,5 +22,9 @@ export class InsertCoinComponent implements OnInit {
addBalance(amount) {
this.balanceService.addBalance(amount);
}
+ returnCoins() {
+ this.balanceService.setBalance(0);
+ alert('Coins returned')
+ }
}
diff --git a/src/app/select-item/select-item.component.css b/src/app/select-item/select-item.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/select-item/select-item.component.html b/src/app/select-item/select-item.component.html
new file mode 100644
index 0000000..c0e4fec
--- /dev/null
+++ b/src/app/select-item/select-item.component.html
@@ -0,0 +1,14 @@
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
diff --git a/src/app/select-item/select-item.component.spec.ts b/src/app/select-item/select-item.component.spec.ts
new file mode 100644
index 0000000..217a5ae
--- /dev/null
+++ b/src/app/select-item/select-item.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SelectItemComponent } from './select-item.component';
+
+describe('SelectItemComponent', () => {
+ let component: SelectItemComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SelectItemComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SelectItemComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/select-item/select-item.component.ts b/src/app/select-item/select-item.component.ts
new file mode 100644
index 0000000..ad97e19
--- /dev/null
+++ b/src/app/select-item/select-item.component.ts
@@ -0,0 +1,35 @@
+import { Component, OnInit } from '@angular/core';
+import { ItemService } from '../item/item.service';
+import { BalanceService } from '../balance/balance.service';
+
+@Component({
+ selector: 'app-select-item',
+ templateUrl: './select-item.component.html',
+ styleUrls: ['./select-item.component.css']
+})
+export class SelectItemComponent implements OnInit {
+ public items;
+ constructor(public itemService: ItemService, public balanceService: BalanceService) { }
+
+ ngOnInit() {
+ this.itemService.onItemsRetrieved((items)=>{
+ this.items = items;
+ })
+ }
+ onItemSelected(item){
+ this.itemService.setSelectedItem(item)
+ }
+
+ onChangeItem(item){
+ this.itemService.setSelectedItem(item)
+ if(this.itemService.hasSufficientBalance(this.balanceService.getBalance())){
+ console.log("fatih")
+ this.itemService.dispenseItem(console.log("yeah"))
+ this.balanceService.deductBalance(this.itemService.getSelectedItem().cost);
+ }
+ else{
+ let item = '.display -sm-width';
+ console.log("item")
+ }
+ }
+}
diff --git a/src/styles.css b/src/styles.css
index 24edf86..8b420f6 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -1,7 +1,5 @@
/* You can add global styles to this file, and also import other style files */
-
body { background-color: #B33323; }
-
h1 { color: #FFF; font-family: 'Helvetica Neue', sans-serif; font-size: 75px; font-weight: bold; letter-spacing: -1px; line-height: 1; }
h2 { color: #FFF; font-family: 'Open Sans', sans-serif; font-size: 30px; font-weight: 300; line-height: 32px; margin: 0 0 72px; }