Cleanup on shopping category
This commit is contained in:
parent
a01cf6ffa7
commit
e4da9a6a71
|
@ -597,7 +597,7 @@ public class RecipeDetailBean implements Serializable {
|
|||
for (IngredientUI iui : saveIng) {
|
||||
Ingredient ing = iui.getIngredient();
|
||||
ing.setRecipe(recipe);
|
||||
if ( ! updateShopcat(ing) ) {
|
||||
if ( ! updateShopcat(iui) ) {
|
||||
return false;
|
||||
}
|
||||
iList.add(ing);
|
||||
|
@ -630,7 +630,8 @@ public class RecipeDetailBean implements Serializable {
|
|||
* @param ing Ingredient to update
|
||||
* @return true if update succeeded.
|
||||
*/
|
||||
private boolean updateShopcat(Ingredient ing) {
|
||||
private boolean updateShopcat(IngredientUI ingUI) {
|
||||
final Ingredient ing = ingUI.getIngredient();
|
||||
final String ingKey = ing.getIngkey();
|
||||
if ( (ingKey == null) || (ingKey.isBlank())) {
|
||||
ing.setIngkey(null);
|
||||
|
@ -805,10 +806,9 @@ public class RecipeDetailBean implements Serializable {
|
|||
return shopcatList;
|
||||
}
|
||||
|
||||
public void ajaxUpdateShopcat(AjaxBehaviorEvent event) {
|
||||
log.warn("SHOPCAT ");
|
||||
// Shopcat scat = recipeService.findShopcatForIngredientKey(ssss);
|
||||
// ing.setShopcat(scat);
|
||||
public void ajaxUpdateShopcat(IngredientUI item) {
|
||||
log.warn("SHOPCAT2 ");
|
||||
updateShopcat(item);;
|
||||
}
|
||||
|
||||
// ***
|
||||
|
|
|
@ -177,100 +177,96 @@
|
|||
/>
|
||||
</p:commandButton>
|
||||
</h:panelGroup>
|
||||
<h:panelGrid columns="1"
|
||||
id="ingredientsDiv"
|
||||
style="height: 420px;"
|
||||
columnClasses="alignTop"
|
||||
<p:dataTable id="ingredientTable"
|
||||
style="width: 100%; height: 420px; margin-top: 8px"
|
||||
value="#{recipeDetailBean.ingredients}"
|
||||
scrollable="true"
|
||||
scrollHeight="380" var="item"
|
||||
>
|
||||
<p:dataTable id="ingredientTable"
|
||||
style="width: 100%"
|
||||
value="#{recipeDetailBean.ingredients}"
|
||||
var="item"
|
||||
<p:column label="Sel."
|
||||
align="center"
|
||||
style="width: 2em"
|
||||
>
|
||||
<p:column label="Sel."
|
||||
align="center"
|
||||
style="width: 2em"
|
||||
<p:selectBooleanCheckbox
|
||||
id="selected"
|
||||
value="#{item.selected}"
|
||||
>
|
||||
<p:selectBooleanCheckbox
|
||||
id="selected"
|
||||
value="#{item.selected}"
|
||||
>
|
||||
<f:ajax
|
||||
immediate="true"
|
||||
render="pnlIngredients"
|
||||
/>
|
||||
</p:selectBooleanCheckbox>
|
||||
</p:column>
|
||||
<p:column
|
||||
style="width: 4.4em"
|
||||
>
|
||||
<f:facet name="header">
|
||||
<f:ajax immediate="true"
|
||||
render="pnlIngredients"
|
||||
/>
|
||||
</p:selectBooleanCheckbox>
|
||||
</p:column>
|
||||
<p:column style="width: 3.6em">
|
||||
<f:facet name="header">
|
||||
Amt.
|
||||
</f:facet>
|
||||
<p:inputText id="ingAmt"
|
||||
size="5"
|
||||
value="#{item.displayAmount}"
|
||||
style="text-align: right"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column style="width: 7em">
|
||||
<f:facet name="header">
|
||||
<p:inputText id="ingAmt"
|
||||
size="3"
|
||||
value="#{item.displayAmount}"
|
||||
style="text-align: right"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column style="width: 7em">
|
||||
<f:facet name="header">
|
||||
Units
|
||||
</f:facet>
|
||||
<p:inputText id="ingUnit"
|
||||
value="#{item.unit}"
|
||||
size="10"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column style="width: 26em">
|
||||
<f:facet name="header">
|
||||
<p:inputText id="ingUnit"
|
||||
value="#{item.unit}"
|
||||
size="10"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column style="width: 26em">
|
||||
<f:facet name="header">
|
||||
Item
|
||||
</f:facet>
|
||||
<p:inputText id="ingItem"
|
||||
size="42"
|
||||
value="#{item.item}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column label="Optional"
|
||||
align="center"
|
||||
styleClass="ingSel"
|
||||
<p:inputText id="ingItem"
|
||||
size="42"
|
||||
value="#{item.item}"
|
||||
>
|
||||
<f:facet name="header">
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column label="Optional"
|
||||
align="center"
|
||||
styleClass="ingSel"
|
||||
>
|
||||
<f:facet name="header">
|
||||
Opt.
|
||||
</f:facet>
|
||||
<p:selectBooleanCheckbox
|
||||
id="ingOpt"
|
||||
value="#{item.optionalCB}"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
<p:column style="width: 13em">
|
||||
<f:facet name="header">
|
||||
<p:selectBooleanCheckbox
|
||||
id="ingOpt"
|
||||
value="#{item.optionalCB}"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
<p:column style="width: 13em">
|
||||
<f:facet name="header">
|
||||
Ing. Key
|
||||
</f:facet>
|
||||
<p:inputText id="ingKey"
|
||||
value="#{item.ingkey}"
|
||||
size="20"
|
||||
rendered="#{not item.ingGroup}"
|
||||
<p:inputText id="ingKey"
|
||||
value="#{item.ingkey}"
|
||||
size="20"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
<f:ajax event="change"
|
||||
listener="#{recipeDetailBean.ajaxUpdateShopcat(item)}"
|
||||
render="shopCat"
|
||||
/>
|
||||
</p:column>
|
||||
<p:column>
|
||||
<f:facet name="header">
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column>
|
||||
<f:facet name="header">
|
||||
Shop. Cat.
|
||||
</f:facet>
|
||||
<h:outputText
|
||||
id="shopCat"
|
||||
value="#{item.shopCat}"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
</p:dataTable>
|
||||
</h:panelGrid>
|
||||
<h:outputText id="shopCat"
|
||||
value="#{item.shopCat}"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
</p:dataTable>
|
||||
<h:panelGroup id="pnlIng">
|
||||
<p:remoteCommand name="ingButton"
|
||||
action="#{recipeDetailBean.doAddIngredient}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user