show supplier name at offered article page

This commit is contained in:
Hendrik Schutter 2020-05-30 11:52:30 +02:00
parent 1a1502b38c
commit 286edb33ed
3 changed files with 10 additions and 19 deletions

View File

@ -30,7 +30,8 @@ public class SupplierOfferController {
for (ArticleOffer article : offersRepository.findAll()) {
UImodelOfferedArticle tmp = new UImodelOfferedArticle();
tmp.addData(article, "supplierName01", 4884, articleRepository.findArticleIDByRelatedID(article.id)); //TODO display supplier name with link
tmp.addData(article, articleRepository.findArticleIDByRelatedID(article.id)); // TODO display supplier name
// with link
totals.add(tmp);
}
@ -40,16 +41,15 @@ public class SupplierOfferController {
public class UImodelOfferedArticle {
long offer_id;
long offer_id;
String title;
String manufacturer;
String articlenumber;
String supplierName;
int supplierId;
String price;
String ads;
int listedArticleId;
boolean offerIsListed; //true --> offered article is listed
boolean offerIsListed; // true --> offered article is listed
public long getOffer_id() {
return offer_id;
@ -58,7 +58,7 @@ public class SupplierOfferController {
public void setOffer_id(long offer_id) {
this.offer_id = offer_id;
}
public boolean isOfferIsListed() {
return offerIsListed;
}
@ -99,14 +99,6 @@ public class SupplierOfferController {
this.supplierName = supplierName;
}
public int getSupplierId() {
return supplierId;
}
public void setSupplierId(int supplierId) {
this.supplierId = supplierId;
}
public String getPrice() {
return price;
}
@ -131,15 +123,13 @@ public class SupplierOfferController {
this.listedArticleId = listedArticleId;
}
public void addData(ArticleOffer article, String supplierName, int supplierId,
Optional<Integer> listedArticleId) {
public void addData(ArticleOffer article, Optional<Integer> listedArticleId) {
this.offer_id = article.id;
this.title = article.title;
this.manufacturer = article.manufacturer;
this.articlenumber = article.articleNumber;
this.supplierName = supplierName;
this.supplierId = supplierId;
this.supplierName = article.cheapestSupplier.name;
this.price = String.format("%.2f", ((float) article.pricePerUnitNet / 100));
this.ads = (article.shouldBeAdvertised) ? "Ja" : "Nein";

View File

@ -28,5 +28,6 @@ public class ArticleOffer {
public boolean shouldBeAdvertised;
@ManyToOne(optional = false)
public Supplier cheapestSupplier;
}

View File

@ -44,7 +44,7 @@
<td><span th:text="${article.title}"></span></td>
<td><span th:text="${article.manufacturer}"></span></td>
<td><span th:text="${article.articlenumber}"></span></td>
<td><a th:href="@{/intern/suppliers/{id}(id = ${article.supplierId})}" th:text="${article.supplierName}"></a></td>
<td><a th:href="${'/intern/suppliers/#q=' + article.supplierName}" th:text="${article.supplierName}"></a></td>
<td><span th:text="${article.price}"></span></td>
<td><span th:text="${article.ads}"></span></td>
<td>