package controllers;

import java.util.List;

import models.Item;
import models.Pricelist;
import models.PricelistItem;
import play.mvc.Controller;

public class PricelistItems extends Controller{
	
	public static void show(String mode) {
		List<PricelistItem> pricelistitems = PricelistItem.findAll();
		List<Item> items = Item.findAll();		
		List<Pricelist> pricelists =Pricelist.findAll();
		if (mode == null || mode.equals(""))
			mode = "edit";
		render(pricelistitems, items, pricelists, mode);
	}
//
//	<td>${pricelistitem.pricelist.validationDate}</td>
//<td style = "visibility: hidden; max-width: 0px" class="pricelist_id">${pricelistitem.pricelist.id}</td>
	
	public static void create(PricelistItem pricelistitem) {	
		System.out.println("pricelist id " + pricelistitem.pricelist.id);
		pricelistitem.save();
		show("add");
	}

	public static void edit(PricelistItem pricelistitem) {
		pricelistitem.save();
		show("edit");
	}
	
	public static void filter(PricelistItem pricelistitem) {
		List<PricelistItem> pricelistitems = PricelistItem.find("price = ?", 
				pricelistitem.price).fetch();
		renderTemplate("PricelistItems/show.html", "edit", pricelistitems);
	}

	public static void delete(Long id) {
		if (id != null) {
			PricelistItem pricelistitem = PricelistItem.findById(id);
			pricelistitem.delete();
		}
		show("edit");
	}

}

@@ -501,172 +501,8 @@
 %0A%09%7D%0A
-//%0A//%09%3Ctd%3E$%7Bpricelistitem.pricelist.validationDate%7D%3C/td%3E%0A//%3Ctd style = %22visibility: hidden; max-width: 0px%22 class=%22pricelist_id%22%3E$%7Bpricelistitem.pricelist.id%7D%3C/td%3E%0A
 %09%0A%09p

Delete unsued code