show supplier name at offered article page
This commit is contained in:
		| @ -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); | ||||
| 		} | ||||
|  | ||||
| @ -45,7 +46,6 @@ public class SupplierOfferController { | ||||
| 		String manufacturer; | ||||
| 		String articlenumber; | ||||
| 		String supplierName; | ||||
| 		int supplierId; | ||||
| 		String price; | ||||
| 		String ads; | ||||
| 		int listedArticleId; | ||||
| @ -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"; | ||||
|  | ||||
|  | ||||
| @ -28,5 +28,6 @@ public class ArticleOffer { | ||||
|  | ||||
|     public boolean shouldBeAdvertised; | ||||
|      | ||||
|      | ||||
|     @ManyToOne(optional = false) | ||||
|     public Supplier cheapestSupplier; | ||||
| } | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user