diff --git a/angular.json b/angular.json
index ab2c8ef..3f9050a 100644
--- a/angular.json
+++ b/angular.json
@@ -24,9 +24,14 @@
"src/assets"
],
"styles": [
- "src/styles.css"
+ "src/styles.css",
+ "node_modules/bootstrap/dist/css/bootstrap.css"
],
- "scripts": []
+ "scripts": [
+ "node_modules/jquery/dist/jquery.min.js",
+ "node_modules/bootstrap/dist/js/bootstrap.js",
+ "node_modules/bootstrap/dist/js/bootstrap.js"
+ ]
},
"configurations": {
"production": {
diff --git a/package-lock.json b/package-lock.json
index 0e5b056..488ea5e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2684,6 +2684,11 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true
},
+ "bootstrap": {
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.5.2.tgz",
+ "integrity": "sha512-vlGn0bcySYl/iV+BGA544JkkZP5LB3jsmkeKLFQakCOwCM3AOk7VkldBz4jrzSe+Z0Ezn99NVXa1o45cQY4R6A=="
+ },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -6638,6 +6643,11 @@
}
}
},
+ "jquery": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
+ "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
+ },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
diff --git a/package.json b/package.json
index a89b392..b80e9dc 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,8 @@
"@angular/platform-browser": "~10.1.1",
"@angular/platform-browser-dynamic": "~10.1.1",
"@angular/router": "~10.1.1",
+ "bootstrap": "^4.5.2",
+ "jquery": "^3.5.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
diff --git a/src/app/app.component.html b/src/app/app.component.html
index e48d8c1..4fd95a3 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,534 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ title }} app is running!
-
-
-
-
-
-
-
Resources
-
Here are some links to help you get started:
-
-
-
-
-
Next Steps
-
What do you want to do next with your app?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Run and Watch Tests
-
-
-
-
-
-
Build for Production
-
-
-
-
-
-
ng generate component xyz
-
ng add @angular/material
-
ng add @angular/pwa
-
ng add _____
-
ng test
-
ng build --prod
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 2c3ba29..e61097a 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -3,14 +3,24 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
+import { RestaurantComponent } from './restaurant/restaurant.component';
+import { MenuComponent } from './menu/menu.component';
+import { MealComponent } from './meal/meal.component';
+import { RestaurantsComponent } from './restaurants/restaurants.component';
+import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
- AppComponent
+ AppComponent,
+ RestaurantComponent,
+ MenuComponent,
+ MealComponent,
+ RestaurantsComponent
],
imports: [
BrowserModule,
- AppRoutingModule
+ AppRoutingModule,
+ HttpClientModule,
],
providers: [],
bootstrap: [AppComponent]
diff --git a/src/app/meal/meal.component.css b/src/app/meal/meal.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/meal/meal.component.html b/src/app/meal/meal.component.html
new file mode 100644
index 0000000..21ae7d2
--- /dev/null
+++ b/src/app/meal/meal.component.html
@@ -0,0 +1,15 @@
+
+
+
+
+ {{ meal.name }}
+
+
+ {{ meal.description }}
+
+
+
0">
+ {{ meal.price }} czk
+
+
+
diff --git a/src/app/meal/meal.component.spec.ts b/src/app/meal/meal.component.spec.ts
new file mode 100644
index 0000000..fcfd743
--- /dev/null
+++ b/src/app/meal/meal.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { MealComponent } from './meal.component';
+
+describe('MealComponent', () => {
+ let component: MealComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ MealComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MealComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/meal/meal.component.ts b/src/app/meal/meal.component.ts
new file mode 100644
index 0000000..7d1e5d0
--- /dev/null
+++ b/src/app/meal/meal.component.ts
@@ -0,0 +1,17 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { Meal } from '../models/meal/Meal';
+
+@Component({
+ selector: 'app-meal',
+ templateUrl: './meal.component.html',
+ styleUrls: ['./meal.component.css']
+})
+export class MealComponent implements OnInit {
+ @Input() meal: Meal;
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/src/app/menu/menu.component.css b/src/app/menu/menu.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/menu/menu.component.html b/src/app/menu/menu.component.html
new file mode 100644
index 0000000..52ab48a
--- /dev/null
+++ b/src/app/menu/menu.component.html
@@ -0,0 +1,6 @@
+
diff --git a/src/app/menu/menu.component.spec.ts b/src/app/menu/menu.component.spec.ts
new file mode 100644
index 0000000..b6ba4e5
--- /dev/null
+++ b/src/app/menu/menu.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { MenuComponent } from './menu.component';
+
+describe('MenuComponent', () => {
+ let component: MenuComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ MenuComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MenuComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/menu/menu.component.ts b/src/app/menu/menu.component.ts
new file mode 100644
index 0000000..f826a4d
--- /dev/null
+++ b/src/app/menu/menu.component.ts
@@ -0,0 +1,17 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { Menu } from '../models/menu/Menu';
+
+@Component({
+ selector: 'app-menu',
+ templateUrl: './menu.component.html',
+ styleUrls: ['./menu.component.css']
+})
+export class MenuComponent implements OnInit {
+ @Input() menu: Menu;
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/src/app/models/meal/Meal.ts b/src/app/models/meal/Meal.ts
new file mode 100644
index 0000000..15c46a4
--- /dev/null
+++ b/src/app/models/meal/Meal.ts
@@ -0,0 +1,44 @@
+import { Injectable } from '@angular/core';
+
+export interface Adapter {
+ adapt(item: any): T;
+}
+
+export class Meal {
+ name: string;
+ description: string;
+ price: number;
+ isSoup: boolean;
+
+ constructor(
+ name: string,
+ description: string,
+ price: number,
+ isSoup: boolean,
+ ) {
+ this.name = name;
+ this.description = description;
+ this.price = price;
+ this.isSoup = isSoup;
+ }
+}
+
+@Injectable({
+ providedIn: 'root'
+})
+export class MealAdapter implements Adapter {
+ adapt(item: any): Meal {
+ if (item) {
+ return new Meal(item.name, item.description, item.price, item.isSoup);
+ }
+ return item;
+ }
+ adaptMultiple(items: any[]): Meal[] {
+ const ret = new Array();
+ items.forEach(item => {
+ const correctItem = this.adapt(item);
+ ret.push(correctItem);
+ });
+ return ret;
+ }
+}
diff --git a/src/app/models/menu/Menu.ts b/src/app/models/menu/Menu.ts
new file mode 100644
index 0000000..ce194c1
--- /dev/null
+++ b/src/app/models/menu/Menu.ts
@@ -0,0 +1,43 @@
+import { Injectable } from '@angular/core';
+import { Meal } from '../meal/Meal';
+
+export interface Adapter {
+ adapt(item: any): T;
+}
+
+export class Menu {
+ day: string;
+ meals: Meal[];
+
+ constructor(
+ day: string,
+ meals: Meal[],
+ ) {
+ this.day = day;
+ this.meals = meals;
+ }
+
+ addMeal(meal: Meal): void {
+ this.meals.push(meal);
+ }
+}
+
+@Injectable({
+ providedIn: 'root'
+})
+export class MenuAdapter implements Adapter