|
|
|
@ -45,6 +45,21 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
|
@WireVariable
|
|
|
|
|
private RequirementService requirementService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Seznam obsahující kód a název skupiny materálu/služby
|
|
|
|
|
*/
|
|
|
|
|
private List<RequirementSubject> requirementGroups;
|
|
|
|
|
|
|
|
|
|
public List<RequirementSubject> getRequirementGroups()
|
|
|
|
|
{
|
|
|
|
|
return requirementGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setRequirementGroups(List<RequirementSubject> requirementGroups)
|
|
|
|
|
{
|
|
|
|
|
this.requirementGroups = requirementGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private RequirementItem selectedItem;
|
|
|
|
|
|
|
|
|
|
private int selItemIndex;
|
|
|
|
@ -103,7 +118,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Init(superclass = true)
|
|
|
|
|
public void init()
|
|
|
|
|
public void initRequirementForm()
|
|
|
|
|
{
|
|
|
|
|
this.setSelItemIndex(-1);
|
|
|
|
|
this.setBigDecimalConverter(new BigDecimalConverter());
|
|
|
|
@ -123,14 +138,6 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
|
this.syncItems = syncItems;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
public void addSelectedItem()
|
|
|
|
|
{
|
|
|
|
|
// Window window = (Window)
|
|
|
|
|
// Executions.createComponents("/main/selectItems.zul", null, null);
|
|
|
|
|
// window.doModal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl)
|
|
|
|
|
{
|
|
|
|
@ -230,4 +237,47 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
|
BindUtils.postNotifyChange(null, null, form, "*");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
@NotifyChange({ "selectedItem", "syncItems" })
|
|
|
|
|
public void onChangeGroup()
|
|
|
|
|
{
|
|
|
|
|
// Někdo změnil skupinu materiálu nebo služby
|
|
|
|
|
if (this.selectedItem == null)
|
|
|
|
|
{
|
|
|
|
|
log.warn("Zavolat z formuláře onFocus pro nastavení vybrané položky!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Zjistit, zda je propojená skupina materiálu nebo služeb
|
|
|
|
|
RequirementSubject subject = this.selectedItem.getReqSubject();
|
|
|
|
|
|
|
|
|
|
if (subject != null)
|
|
|
|
|
{
|
|
|
|
|
// Skupina materiálu nebo služeb je propojená, nastavit k zadanému
|
|
|
|
|
// kódu i správný název skupiny materiálu nebo služby
|
|
|
|
|
this.selectedItem.setName(subject.getName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
@NotifyChange({ "selectedItem", "syncItems" })
|
|
|
|
|
public void addNewItem()
|
|
|
|
|
{
|
|
|
|
|
RequirementItem item = new RequirementItem();
|
|
|
|
|
|
|
|
|
|
item.setReqSubject(null);
|
|
|
|
|
|
|
|
|
|
item.setCode("");
|
|
|
|
|
item.setName("");
|
|
|
|
|
item.setQuantity(BigDecimal.valueOf(1));
|
|
|
|
|
item.setUnitPrice(BigDecimal.valueOf(0));
|
|
|
|
|
item.setTotal(BigDecimal.valueOf(0));
|
|
|
|
|
item.setDescription("");
|
|
|
|
|
item.setMunit(null);
|
|
|
|
|
|
|
|
|
|
this.setSelectedItem(item);
|
|
|
|
|
this.getDataBean().getItems().add(item);
|
|
|
|
|
this.setSelItemIndex(this.getDataBean().getItems().indexOf(item));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|