V0.1h Automatische Bestimmung des image und der Kategorie anhand des Einkaufsortes
This commit is contained in:
parent
fe1c381571
commit
4279edffe4
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<app-header></app-header>
|
||||
<app-blog-create></app-blog-create>
|
||||
<app-footer></app-footer>
|
||||
|
@ -11,21 +11,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div><label for="image">Bild-URL* </label></div>
|
||||
|
||||
<div>
|
||||
<input type="text" class="form-control" name="title" id="image" #image ngModel required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div><label>Kategorie* </label></div>
|
||||
<div>
|
||||
<input type="text" class="form-control" id="kategorie" #kategorie ngModel required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div><label for="menge">Menge* </label></div>
|
||||
<div>
|
||||
@ -40,7 +25,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button (click)="createBlogEntry(einkaufsort.value, image.value, kategorie.value,menge.value, kommentar.value)">
|
||||
<button (click)="createBlogEntry(einkaufsort.value,menge.value, kommentar.value)">
|
||||
Eintrag anlegen
|
||||
</button>
|
||||
</div>
|
||||
|
@ -32,17 +32,59 @@ export class BlogCreateComponent implements OnInit {
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
createBlogEntry(title: string, image: string, kategorie: string, menge: string, kommentar: string, ) {
|
||||
if (title && image && kommentar && kategorie) {
|
||||
createBlogEntry(einkaufsort: string, menge: string, kommentar: string, ) {
|
||||
if (einkaufsort && kommentar) {
|
||||
const entry = new BlogEntry();
|
||||
entry.einkaufsort = title;
|
||||
entry.image = image;
|
||||
entry.kategorie = kategorie;
|
||||
entry.einkaufsort = einkaufsort;
|
||||
entry.menge = menge;
|
||||
entry.kommentar = kommentar;
|
||||
|
||||
if(einkaufsort === 'Aldi Süd'){
|
||||
entry.image = 'https://www.horizont.net/news/media/20/Logo-Aldi-Sd-2017-198042-detailnp.jpeg';
|
||||
entry.kategorie = 'Lebensmittel';
|
||||
}
|
||||
else if (einkaufsort === 'Edeka') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Logo_Edeka.svg/1200px-Logo_Edeka.svg.png';
|
||||
entry.kategorie = 'Lebensmittel';}
|
||||
else if (einkaufsort == 'Lidl') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Lidl-Logo.svg/1200px-Lidl-Logo.svg.png';
|
||||
entry.kategorie = 'Lebensmittel';}
|
||||
else if (einkaufsort == 'Rewe') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Logo_REWE.svg/1200px-Logo_REWE.svg.png';
|
||||
entry.kategorie = 'Lebensmittel';}
|
||||
else if (einkaufsort == 'Netto') {
|
||||
entry.image = 'https://www.netto-online.de/images/favicons/logo_netto.png';
|
||||
entry.kategorie = 'Lebensmittel';}
|
||||
else if (einkaufsort == 'Penny') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Penny-Markt.svg/1200px-Penny-Markt.svg.png';
|
||||
entry.kategorie = 'Lebensmittel';}
|
||||
else if (einkaufsort == 'DM') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Dm_Logo.svg/1200px-Dm_Logo.svg.png';
|
||||
entry.kategorie = 'Drogerie';}
|
||||
else if (einkaufsort == 'Rossmann') {
|
||||
entry.image = 'https://www.einkaufsbahnhof.de/wp-content/uploads/2018/03/rossmann_logo_schreibschrift.png';
|
||||
entry.kategorie = 'Drogerie';}
|
||||
else if (einkaufsort == 'Müller') {
|
||||
entry.image = 'https://www.e-einz.de/wp-content/uploads/2017/02/Mueller.png';
|
||||
entry.kategorie = 'Drogerie';}
|
||||
else if (einkaufsort == 'OBI') {
|
||||
entry.image = 'https://media.aubi-plus.com/files/premiumprofil/logo/35d8961-obi.jpg';
|
||||
entry.kategorie = 'Baumarkt';}
|
||||
else if (einkaufsort == 'Dehner') {
|
||||
entry.image = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Dehner.svg/1200px-Dehner.svg.png';
|
||||
entry.kategorie = 'Garten-Center';}
|
||||
else if (einkaufsort == 'Hornbach') {
|
||||
entry.image = 'https://www.luvshopping.de/-/media/images/b2c/germany/lubeck/logo-stores/hornbach.jpg?h=442&la=de-DE&mw=650&w=650&hash=C6C36C2C1536745108FF620D3B9CD7E4864A9308';
|
||||
entry.kategorie = 'Baumarkt';}
|
||||
else if (einkaufsort == 'Anderer') {
|
||||
entry.image = 'https://previews.123rf.com/images/krisdog/krisdog1312/krisdog131200065/24639132-ein-beispiel-f%C3%BCr-ein-einkaufswagen-oder-einkaufswagen-symbol.jpg';
|
||||
entry.kategorie = 'Unbekannt';};
|
||||
|
||||
this.entries.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
deleteAllEntries() {
|
||||
console.log(this.entries.length);
|
||||
const index: number = this.entries.length;
|
||||
|
@ -5,6 +5,7 @@
|
||||
<div class="blog-summary">
|
||||
<span class="einkaufsort">{{entry.einkaufsort}}</span>
|
||||
<p> {{entry.kategorie}}</p>
|
||||
<p> {{entry.menge}}</p>
|
||||
<p> {{entry.kommentar}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,5 +4,4 @@ export class BlogEntry {
|
||||
kategorie: string;
|
||||
menge: string;
|
||||
kommentar: string;
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
export const initialEntries = [
|
||||
{
|
||||
einkaufsort: 'Edeka',
|
||||
image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Logo_Edeka.svg/1200px-Logo_Edeka.svg.png',
|
||||
kategorie: 'Lebensmittel',
|
||||
menge: '1',
|
||||
kommentar: 'Hier könnten ihre benötigten Einkäufe stehen'
|
||||
},
|
||||
{
|
||||
einkaufsort: 'Aldi Süd',
|
||||
image: 'https://www.horizont.net/news/media/20/Logo-Aldi-Sd-2017-198042-detailnp.jpeg',
|
||||
@ -13,6 +6,14 @@ export const initialEntries = [
|
||||
menge: '1',
|
||||
kommentar: 'Hier könnten ihre benötigten Einkäufe stehen'
|
||||
},
|
||||
{
|
||||
einkaufsort: 'Edeka',
|
||||
image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Logo_Edeka.svg/1200px-Logo_Edeka.svg.png',
|
||||
kategorie: 'Lebensmittel',
|
||||
menge: '1',
|
||||
kommentar: 'Hier könnten ihre benötigten Einkäufe stehen'
|
||||
},
|
||||
|
||||
{
|
||||
einkaufsort: 'Lidl',
|
||||
image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Lidl-Logo.svg/1200px-Lidl-Logo.svg.png',
|
||||
|
Loading…
x
Reference in New Issue
Block a user