|
|
@ -38,13 +38,28 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
@WireVariable
|
|
|
|
private WorkgroupService workgroupService;
|
|
|
|
private WorkgroupService workgroupService;
|
|
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
@WireVariable
|
|
|
|
private RequirementTypeService reqTypeService;
|
|
|
|
private RequirementTypeService reqTypeService;
|
|
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
@WireVariable
|
|
|
|
private RequirementService requirementService;
|
|
|
|
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 RequirementItem selectedItem;
|
|
|
|
|
|
|
|
|
|
|
|
private int selItemIndex;
|
|
|
|
private int selItemIndex;
|
|
|
@ -54,7 +69,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
private RequirementFormValidator requirementFormValidator;
|
|
|
|
private RequirementFormValidator requirementFormValidator;
|
|
|
|
|
|
|
|
|
|
|
|
private List<RequirementItem> syncItems;
|
|
|
|
private List<RequirementItem> syncItems;
|
|
|
|
|
|
|
|
|
|
|
|
private List<Workgroup> centres;
|
|
|
|
private List<Workgroup> centres;
|
|
|
|
|
|
|
|
|
|
|
|
public List<Workgroup> getCentres()
|
|
|
|
public List<Workgroup> getCentres()
|
|
|
@ -101,16 +116,16 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.requirementFormValidator = requirementFormValidator;
|
|
|
|
this.requirementFormValidator = requirementFormValidator;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Init(superclass = true)
|
|
|
|
@Init(superclass = true)
|
|
|
|
public void init()
|
|
|
|
public void initRequirementForm()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.setSelItemIndex(-1);
|
|
|
|
this.setSelItemIndex(-1);
|
|
|
|
this.setBigDecimalConverter(new BigDecimalConverter());
|
|
|
|
this.setBigDecimalConverter(new BigDecimalConverter());
|
|
|
|
this.setRequirementFormValidator(new RequirementFormValidator());
|
|
|
|
this.setRequirementFormValidator(new RequirementFormValidator());
|
|
|
|
this.setSyncItems(this.getDataBean().getItems());
|
|
|
|
this.setSyncItems(this.getDataBean().getItems());
|
|
|
|
requirementService.loadType(getDataBean());
|
|
|
|
requirementService.loadType(getDataBean());
|
|
|
|
this.centres = reqTypeService.filterCentres(getDataBean().getType(), workgroupService.getUserCentres(userService.getCurrent()));
|
|
|
|
this.centres = reqTypeService.filterCentres(getDataBean().getType(), workgroupService.getUserCentres(userService.getCurrent()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<RequirementItem> getSyncItems()
|
|
|
|
public List<RequirementItem> getSyncItems()
|
|
|
@ -123,14 +138,6 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|
|
|
this.syncItems = syncItems;
|
|
|
|
this.syncItems = syncItems;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
|
|
|
public void addSelectedItem()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Window window = (Window)
|
|
|
|
|
|
|
|
// Executions.createComponents("/main/selectItems.zul", null, null);
|
|
|
|
|
|
|
|
// window.doModal();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
@Command
|
|
|
|
public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl)
|
|
|
|
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, "*");
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|