-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creating pages for every topic; doing: articlePage
- Loading branch information
Showing
17 changed files
with
197 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
<!--<app-home-page></app-home-page>--> | ||
<mat-toolbar> | ||
<button mat-button routerLink="/home">Home page</button> | ||
<button mat-button routerLink="/clients">Client page</button> | ||
<button mat-button routerLink="/articles">Article page</button> | ||
<button mat-button>Bill page</button> | ||
</mat-toolbar> | ||
<router-outlet></router-outlet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.bill-expansion{ | ||
margin: 4em; | ||
margin-left: 8em; | ||
margin-right: 8em; | ||
} | ||
|
||
mat-expansion-panel{ | ||
margin: 2em 0 2em 0 | ||
} | ||
|
||
.client-list{ | ||
height: 400px; | ||
background-color: lightblue; | ||
} |
66 changes: 55 additions & 11 deletions
66
src/app/components/bill-creation/bill-creation.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,55 @@ | ||
<mat-expansion-panel hideToggle> | ||
<mat-expansion-panel-header> | ||
<mat-panel-title> | ||
This is the expansion title | ||
</mat-panel-title> | ||
<mat-panel-description> | ||
This is a summary of the content | ||
</mat-panel-description> | ||
</mat-expansion-panel-header> | ||
<p>This is the primary content of the panel.</p> | ||
</mat-expansion-panel> | ||
<div class="bill-expansion"> | ||
|
||
<mat-expansion-panel [expanded]="step === 0" (opened)="setStep(0)" hideToggle> | ||
<mat-expansion-panel-header> | ||
<mat-panel-title> | ||
Select a Client | ||
</mat-panel-title> | ||
</mat-expansion-panel-header> | ||
<div class="client-list"> | ||
<app-client-list [clients]="clients" [selectionMode]="true" (selectedClient)="setBillClient($event)"></app-client-list> | ||
</div> | ||
<mat-action-row> | ||
<button mat-button color="primary" (click)="nextStep()">Next</button> | ||
</mat-action-row> | ||
</mat-expansion-panel> | ||
|
||
<mat-expansion-panel [expanded]="step === 1" (opened)="setStep(1)" hideToggle> | ||
<mat-expansion-panel-header> | ||
<mat-panel-title> | ||
Select Articles | ||
</mat-panel-title> | ||
</mat-expansion-panel-header> | ||
<div class="client-list"> | ||
<app-articles-list [articles]="articles" [selectionMode]="true" (selUnselectArticle)="addRemoveArticleToBill($event)"></app-articles-list> | ||
</div> | ||
<mat-action-row> | ||
<button mat-button color="warn" (click)="prevStep()">Previous</button> | ||
<button mat-button color="primary" (click)="nextStep()">Next</button> | ||
</mat-action-row> | ||
</mat-expansion-panel> | ||
|
||
<mat-expansion-panel [expanded]="step === 2" (opened)="setStep(2)" hideToggle> | ||
<mat-expansion-panel-header> | ||
<mat-panel-title> | ||
Confirm | ||
</mat-panel-title> | ||
</mat-expansion-panel-header> | ||
<div class="confirm-bill"> | ||
<app-articles-list [articles]="bill.articles"></app-articles-list> | ||
<app-client-list [clients]="[bill.client]"></app-client-list> | ||
</div> | ||
<mat-action-row> | ||
<button mat-button color="warn" (click)="prevStep()">Previous</button> | ||
<button mat-button color="primary" (click)="nextStep()">Next</button> | ||
<div> | ||
<mat-form-field appearance="fill"> | ||
<mat-label>Choose a date</mat-label> | ||
<input matInput [matDatepicker]="picker"> | ||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> | ||
<mat-datepicker #picker></mat-datepicker> | ||
</mat-form-field> | ||
</div> | ||
</mat-action-row> | ||
</mat-expansion-panel> | ||
</div> |
40 changes: 39 additions & 1 deletion
40
src/app/components/bill-creation/bill-creation.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,53 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {Component, Input, OnInit} from '@angular/core'; | ||
import {Client} from "../../shared/models/client"; | ||
import {Bill} from "../../shared/models/bill"; | ||
import {Article} from "../../shared/models/article"; | ||
import {auditTime} from "rxjs/operators"; | ||
|
||
@Component({ | ||
selector: 'app-bill-creation', | ||
templateUrl: './bill-creation.component.html', | ||
styleUrls: ['./bill-creation.component.css'] | ||
}) | ||
export class BillCreationComponent implements OnInit { | ||
@Input() clients:any; | ||
@Input() articles:any; | ||
|
||
bill:Bill = new Bill(); | ||
|
||
step = 0; | ||
|
||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
setBillClient(client:Client){ | ||
this.bill.client = client; | ||
this.nextStep(); | ||
} | ||
|
||
addRemoveArticleToBill(article:Article){ | ||
let index = this.bill.articles.indexOf(article); | ||
if (index > -1){ | ||
this.bill.articles.splice(index, 1); | ||
} | ||
else { | ||
this.bill.articles.push(article) | ||
} | ||
} | ||
|
||
|
||
setStep(index: number) { | ||
this.step = index; | ||
} | ||
|
||
nextStep() { | ||
this.step++; | ||
} | ||
|
||
prevStep() { | ||
this.step--; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Injectable } from '@angular/core'; | ||
import {Article} from "../shared/models/article"; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ArticlesServiceService { | ||
|
||
backendURL: string = "https://localhost:44335/api"; | ||
|
||
constructor() { } | ||
|
||
getArticles(){ | ||
let articles:any[] = []; | ||
fetch(this.backendURL + "/article/", {method: 'GET'}).then(response => response.json()).then((data)=>{ | ||
for (let article of data){ | ||
articles.push(new Article(article["Name"], article["Price"], article["Photo"], article["Description"], article["Id"])); | ||
} | ||
// return data; | ||
}); | ||
return articles; | ||
//return articles; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters