add payment method field

This commit is contained in:
2024-11-15 11:05:52 +01:00
parent 033c5d5c76
commit 119650d518
12 changed files with 401 additions and 349 deletions
+2 -2
View File
@@ -14,7 +14,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<querydsl.version>5.1.0</querydsl.version> <querydsl.version>5.1.0</querydsl.version>
<revision>0.5.1</revision> <revision>0.6.0</revision>
</properties> </properties>
<parent> <parent>
@@ -102,7 +102,7 @@
<dependency> <dependency>
<groupId>org.passay</groupId> <groupId>org.passay</groupId>
<artifactId>passay</artifactId> <artifactId>passay</artifactId>
<version>1.6.5</version> <version>1.6.6</version>
</dependency> </dependency>
<!-- Datbase --> <!-- Datbase -->
@@ -35,6 +35,13 @@ public class TurnoverValidator implements Validator {
errors.rejectValue("price", "MIN"); errors.rejectValue("price", "MIN");
} }
if (turnover.getPaymentMethod() == null) {
errors.rejectValue("paymentMethod", "REQUIRED");
} else if (!turnover.getPaymentMethod().equals("card")
&& !turnover.getPaymentMethod().equals("cash")) {
errors.rejectValue("paymentMethod", "INVALID");
}
if (turnover.getGiftcardPrice() != null && turnover.getGiftcardPrice() < 0) { if (turnover.getGiftcardPrice() != null && turnover.getGiftcardPrice() < 0) {
errors.rejectValue("giftcardPrice", "MIN"); errors.rejectValue("giftcardPrice", "MIN");
} else if (turnover.getGiftcardPrice() != null && turnover.getGiftcardPrice() > turnover.getPrice()) { } else if (turnover.getGiftcardPrice() != null && turnover.getGiftcardPrice() > turnover.getPrice()) {
@@ -40,6 +40,9 @@ public class Turnover {
@Column(name = "price", nullable = false) @Column(name = "price", nullable = false)
private float price; private float price;
@Column(name = "payment_method", nullable = true)
private String paymentMethod;
@Column(name = "time_investment", nullable = true) @Column(name = "time_investment", nullable = true)
private float timeInvestment; private float timeInvestment;
@@ -121,6 +124,14 @@ public class Turnover {
this.price = price; this.price = price;
} }
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public float getTimeInvestment() { public float getTimeInvestment() {
return timeInvestment; return timeInvestment;
} }
@@ -184,6 +195,9 @@ public class Turnover {
equals &= price == turnover.getPrice(); equals &= price == turnover.getPrice();
equals &= paymentMethod == null && turnover.getPaymentMethod() == null
|| paymentMethod != null && paymentMethod.equals(turnover.getPaymentMethod());
equals &= timeInvestment == turnover.getTimeInvestment(); equals &= timeInvestment == turnover.getTimeInvestment();
equals &= remark == null && turnover.getRemark() == null equals &= remark == null && turnover.getRemark() == null
+299 -315
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -1,6 +1,6 @@
{ {
"name": "buntspecht-web", "name": "buntspecht-web",
"version": "0.5.0", "version": "0.6.0",
"license": "AGPL3", "license": "AGPL3",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
@@ -12,28 +12,28 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^18.2.9", "@angular/animations": "^18.2.12",
"@angular/cdk": "^18.2.10", "@angular/cdk": "^18.2.13",
"@angular/common": "^18.2.9", "@angular/common": "^18.2.12",
"@angular/compiler": "^18.2.9", "@angular/compiler": "^18.2.12",
"@angular/core": "^18.2.9", "@angular/core": "^18.2.12",
"@angular/forms": "^18.2.9", "@angular/forms": "^18.2.12",
"@angular/material": "^18.2.10", "@angular/material": "^18.2.13",
"@angular/material-moment-adapter": "^18.2.10", "@angular/material-moment-adapter": "^18.2.13",
"@angular/platform-browser": "^18.2.9", "@angular/platform-browser": "^18.2.12",
"@angular/platform-browser-dynamic": "^18.2.9", "@angular/platform-browser-dynamic": "^18.2.12",
"@angular/router": "^18.2.9", "@angular/router": "^18.2.12",
"@angular/service-worker": "^18.2.9", "@angular/service-worker": "^18.2.12",
"moment": "^2.30.1", "moment": "^2.30.1",
"rxjs": "~7.8.1", "rxjs": "~7.8.1",
"tslib": "^2.8.0", "tslib": "^2.8.1",
"zone.js": "~0.14.10" "zone.js": "~0.14.10"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^18.2.10", "@angular-devkit/build-angular": "^18.2.12",
"@angular/cli": "^18.2.10", "@angular/cli": "^18.2.12",
"@angular/compiler-cli": "^18.2.9", "@angular/compiler-cli": "^18.2.12",
"@angular/localize": "^18.2.9", "@angular/localize": "^18.2.12",
"@types/jasmine": "^5.1.4", "@types/jasmine": "^5.1.4",
"jasmine-core": "~5.4.0", "jasmine-core": "~5.4.0",
"karma": "^6.4.4", "karma": "^6.4.4",
@@ -46,6 +46,23 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<div class="form-field margin horizontal">
<mat-radio-group formControlName="paymentMethod" [required]="true">
<mat-radio-button value="card">
<span class="flex middle">
<mat-icon>credit_card</mat-icon>&nbsp;{{'turnover.paymentMethod.card' | i18n}}
</span>
</mat-radio-button>
<mat-radio-button value="cash">
<span class="flex middle">
<mat-icon>payments</mat-icon>&nbsp;{{'turnover.paymentMethod.cash' | i18n}}
</span></mat-radio-button>
</mat-radio-group>
<mat-error *ngFor="let error of form.get('paymentMethod').errors | keyvalue">
{{'turnover.paymentMethod.error.' + (error.key | errorCode) | i18n:error.value}}
</mat-error>
</div>
<mat-slide-toggle class="margin" [checked]="hasGiftcard" (change)="hasGiftcard=$event.checked"> <mat-slide-toggle class="margin" [checked]="hasGiftcard" (change)="hasGiftcard=$event.checked">
{{'turnover.giftcard' | i18n}} {{'turnover.giftcard' | i18n}}
</mat-slide-toggle> </mat-slide-toggle>
@@ -44,6 +44,7 @@ export class PageTurnover implements OnInit {
customer: ['', Validators.required], customer: ['', Validators.required],
motif: ['', Validators.required], motif: ['', Validators.required],
price: ['', Validators.required], price: ['', Validators.required],
paymentMethod: ['', Validators.required],
giftcardNumber: ['', Validators.nullValidator], giftcardNumber: ['', Validators.nullValidator],
giftcardPrice: ['', Validators.nullValidator], giftcardPrice: ['', Validators.nullValidator],
timeInvestment: ['', Validators.nullValidator], timeInvestment: ['', Validators.nullValidator],
@@ -77,6 +78,7 @@ export class PageTurnover implements OnInit {
this.form.get("customer").setValue(this.turnover.customer); this.form.get("customer").setValue(this.turnover.customer);
this.form.get("motif").setValue(this.turnover.motif); this.form.get("motif").setValue(this.turnover.motif);
this.form.get("price").setValue(this.turnover.price); this.form.get("price").setValue(this.turnover.price);
this.form.get("paymentMethod").setValue(this.turnover.paymentMethod || 'card');
this.form.get("giftcardNumber").setValue(this.turnover.giftcardNumber); this.form.get("giftcardNumber").setValue(this.turnover.giftcardNumber);
this.form.get("giftcardPrice").setValue(this.turnover.giftcardPrice); this.form.get("giftcardPrice").setValue(this.turnover.giftcardPrice);
this.form.get("timeInvestment").setValue(this.turnover.timeInvestment); this.form.get("timeInvestment").setValue(this.turnover.timeInvestment);
@@ -118,6 +120,7 @@ export class PageTurnover implements OnInit {
this.turnover.customer = this.form.get("customer").value; this.turnover.customer = this.form.get("customer").value;
this.turnover.motif = this.form.get("motif").value; this.turnover.motif = this.form.get("motif").value;
this.turnover.price = this.form.get("price").value; this.turnover.price = this.form.get("price").value;
this.turnover.paymentMethod = this.form.get("paymentMethod").value;
this.turnover.timeInvestment = this.form.get("timeInvestment").value; this.turnover.timeInvestment = this.form.get("timeInvestment").value;
this.turnover.remark = this.form.get("remark").value; this.turnover.remark = this.form.get("remark").value;
this.turnover.materialConsumption = this.form.get("materialConsumption").value; this.turnover.materialConsumption = this.form.get("materialConsumption").value;
@@ -161,6 +164,8 @@ export class PageTurnover implements OnInit {
this.turnover.customer = this.form.get("customer").value; this.turnover.customer = this.form.get("customer").value;
this.turnover.motif = this.form.get("motif").value; this.turnover.motif = this.form.get("motif").value;
this.turnover.price = this.form.get("price").value; this.turnover.price = this.form.get("price").value;
console.log(this.form.get("paymentMethod"));
this.turnover.paymentMethod = this.form.get("paymentMethod").value;
this.turnover.timeInvestment = this.form.get("timeInvestment").value; this.turnover.timeInvestment = this.form.get("timeInvestment").value;
this.turnover.remark = this.form.get("remark").value; this.turnover.remark = this.form.get("remark").value;
this.turnover.materialConsumption = this.form.get("materialConsumption").value; this.turnover.materialConsumption = this.form.get("materialConsumption").value;
+1 -1
View File
@@ -65,7 +65,7 @@
<ng-container matColumnDef="about"> <ng-container matColumnDef="about">
<th mat-header-cell *matHeaderCellDef>{{'profile.about' | i18n}}</th> <th mat-header-cell *matHeaderCellDef>{{'profile.about' | i18n}}</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let user">
<span class="ellipsis" matTooltip="{{user.about}}">{{user.about}}</span> <span class="ellipsis" [matTooltip]="user.about">{{user.about}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -40,7 +40,7 @@
<th mat-header-cell *matHeaderCellDef mat-sort-header [disableClear]="false">{{'turnover.dueDate' | <th mat-header-cell *matHeaderCellDef mat-sort-header [disableClear]="false">{{'turnover.dueDate' |
i18n}} i18n}}
</th> </th>
<td mat-cell *matCellDef="let turnover" matTooltip="{{turnover.dueDate | datef:'LL'}}"> <td mat-cell *matCellDef="let turnover" [matTooltip]="turnover.dueDate | datef:'LL'">
<span class="nowrap">{{turnover.dueDate | datef:'L'}}</span> <span class="nowrap">{{turnover.dueDate | datef:'L'}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -53,7 +53,7 @@
<ng-container matColumnDef="motif"> <ng-container matColumnDef="motif">
<th mat-header-cell *matHeaderCellDef>{{'turnover.motif' | i18n}}</th> <th mat-header-cell *matHeaderCellDef>{{'turnover.motif' | i18n}}</th>
<td mat-cell *matCellDef="let turnover"> <td mat-cell *matCellDef="let turnover">
<span class="ellipsis" matTooltip="{{turnover.motif}}">{{turnover.motif}}</span> <span class="ellipsis" [matTooltip]="turnover.motif">{{turnover.motif}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -63,8 +63,14 @@
<span>{{'turnover.price' | i18n}}</span> <span>{{'turnover.price' | i18n}}</span>
</th> </th>
<td mat-cell *matCellDef="let turnover"> <td mat-cell *matCellDef="let turnover">
<div class="flex"> <div class="flex middle">
<span class="spacer"></span> @if (turnover.paymentMethod == 'card'){
<mat-icon [matTooltip]="'turnover.paymentMethod.card' | i18n">credit_card</mat-icon>
}
@if (turnover.paymentMethod == 'cash'){
<mat-icon [matTooltip]="'turnover.paymentMethod.cash' | i18n">payments</mat-icon>
}
<span class="spacer with-margin"></span>
<span>{{turnover.price | number: '1.2-2'}}</span> <span>{{turnover.price | number: '1.2-2'}}</span>
<span>&nbsp;{{'turnover.price.suffix' | i18n}}</span> <span>&nbsp;{{'turnover.price.suffix' | i18n}}</span>
</div> </div>
@@ -77,7 +83,7 @@
<span>{{'turnover.giftcard.price' | i18n}}</span> <span>{{'turnover.giftcard.price' | i18n}}</span>
</th> </th>
<td mat-cell *matCellDef="let turnover"> <td mat-cell *matCellDef="let turnover">
<div class="flex"> <div class="flex middle">
<span class="spacer"></span> <span class="spacer"></span>
<span>{{turnover.giftcardPrice | number: '1.2-2'}}</span> <span>{{turnover.giftcardPrice | number: '1.2-2'}}</span>
@if (turnover.giftcardPrice) { @if (turnover.giftcardPrice) {
@@ -106,7 +112,7 @@
<ng-container matColumnDef="remark"> <ng-container matColumnDef="remark">
<th mat-header-cell *matHeaderCellDef>{{'turnover.remark' | i18n}}</th> <th mat-header-cell *matHeaderCellDef>{{'turnover.remark' | i18n}}</th>
<td mat-cell *matCellDef="let turnover"> <td mat-cell *matCellDef="let turnover">
<span class="ellipsis" matTooltip="{{turnover.remark}}">{{turnover.remark}}</span> <span class="ellipsis" [matTooltip]="turnover.remark">{{turnover.remark}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -114,7 +120,7 @@
<th mat-header-cell *matHeaderCellDef>{{'turnover.materialConsumption' | i18n}}</th> <th mat-header-cell *matHeaderCellDef>{{'turnover.materialConsumption' | i18n}}</th>
<td mat-cell *matCellDef="let turnover"> <td mat-cell *matCellDef="let turnover">
<span class="ellipsis" <span class="ellipsis"
matTooltip="{{turnover.materialConsumption}}">{{turnover.materialConsumption}}</span> [matTooltip]="turnover.materialConsumption">{{turnover.materialConsumption}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -122,7 +128,7 @@
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{'turnover.created' | <th mat-header-cell *matHeaderCellDef mat-sort-header>{{'turnover.created' |
i18n}} i18n}}
</th> </th>
<td mat-cell *matCellDef="let turnover" matTooltip="{{turnover.created | datef:'LLLL'}}"> <td mat-cell *matCellDef="let turnover" [matTooltip]="turnover.created | datef:'LLLL'">
<span class="nowrap">{{turnover.created | datef}}</span> <span class="nowrap">{{turnover.created | datef}}</span>
</td> </td>
</ng-container> </ng-container>
@@ -132,7 +138,7 @@
<span class="spacer"></span> <span class="spacer"></span>
<span>{{'turnover.updated' | i18n}}</span> <span>{{'turnover.updated' | i18n}}</span>
</th> </th>
<td mat-cell *matCellDef="let turnover" matTooltip="{{turnover.updated | datef:'LLLL'}}"> <td mat-cell *matCellDef="let turnover" [matTooltip]="turnover.updated | datef:'LLLL'">
<div class="flex"> <div class="flex">
<span class="spacer"></span> <span class="spacer"></span>
@if(turnover.created != turnover.updated) { @if(turnover.created != turnover.updated) {
@@ -62,6 +62,7 @@ export class UiTurnovers implements OnInit {
this.i18n.get('turnover.customer'), this.i18n.get('turnover.customer'),
this.i18n.get('turnover.motif'), this.i18n.get('turnover.motif'),
this.i18n.get('turnover.price'), this.i18n.get('turnover.price'),
this.i18n.get('turnover.paymentMethod'),
this.i18n.get('turnover.giftcard.number'), this.i18n.get('turnover.giftcard.number'),
this.i18n.get('turnover.giftcard.price'), this.i18n.get('turnover.giftcard.price'),
this.i18n.get('turnover.timeInvestment'), this.i18n.get('turnover.timeInvestment'),
@@ -81,8 +82,9 @@ export class UiTurnovers implements OnInit {
turnover.customer, turnover.customer,
turnover.motif, turnover.motif,
turnover.price.toFixed(2), turnover.price.toFixed(2),
turnover.paymentMethod ? this.i18n.get('turnover.paymentMethod.' + turnover.paymentMethod) : '',
turnover.giftcardNumber, turnover.giftcardNumber,
turnover.giftcardPrice && turnover.giftcardPrice.toFixed(2) || '', turnover.giftcardPrice ? turnover.giftcardPrice.toFixed(2) : '',
turnover.timeInvestment.toFixed(1), turnover.timeInvestment.toFixed(1),
turnover.remark, turnover.remark,
turnover.materialConsumption, turnover.materialConsumption,
@@ -141,6 +141,15 @@
"REQUIRED": "Angabe von Motiv erforderlich" "REQUIRED": "Angabe von Motiv erforderlich"
} }
}, },
"paymentMethod": {
".": "Zahlungsmethode",
"card":"Kartenzahlung",
"cash": "Barzahlung",
"error": {
"INVALID": "Üngültiger Wert",
"REQUIRED": "Angabe einer Zahlungsmethode erforderlich"
}
},
"price": { "price": {
".": "Preis", ".": "Preis",
"error": { "error": {
+8
View File
@@ -210,10 +210,18 @@ qrcode canvas {
.spacer { .spacer {
flex: 1 1 auto; flex: 1 1 auto;
&.with-margin {
margin: 5px;
}
} }
.margin { .margin {
margin: 0 15px; margin: 0 15px;
&.horizontal {
margin: 15px 0;
}
} }
.hint { .hint {