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) {
|
for (IngredientUI iui : saveIng) {
|
||||||
Ingredient ing = iui.getIngredient();
|
Ingredient ing = iui.getIngredient();
|
||||||
ing.setRecipe(recipe);
|
ing.setRecipe(recipe);
|
||||||
if ( ! updateShopcat(ing) ) {
|
if ( ! updateShopcat(iui) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
iList.add(ing);
|
iList.add(ing);
|
||||||
|
@ -630,7 +630,8 @@ public class RecipeDetailBean implements Serializable {
|
||||||
* @param ing Ingredient to update
|
* @param ing Ingredient to update
|
||||||
* @return true if update succeeded.
|
* @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();
|
final String ingKey = ing.getIngkey();
|
||||||
if ( (ingKey == null) || (ingKey.isBlank())) {
|
if ( (ingKey == null) || (ingKey.isBlank())) {
|
||||||
ing.setIngkey(null);
|
ing.setIngkey(null);
|
||||||
|
@ -805,10 +806,9 @@ public class RecipeDetailBean implements Serializable {
|
||||||
return shopcatList;
|
return shopcatList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ajaxUpdateShopcat(AjaxBehaviorEvent event) {
|
public void ajaxUpdateShopcat(IngredientUI item) {
|
||||||
log.warn("SHOPCAT ");
|
log.warn("SHOPCAT2 ");
|
||||||
// Shopcat scat = recipeService.findShopcatForIngredientKey(ssss);
|
updateShopcat(item);;
|
||||||
// ing.setShopcat(scat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
|
@ -177,15 +177,11 @@
|
||||||
/>
|
/>
|
||||||
</p:commandButton>
|
</p:commandButton>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
<h:panelGrid columns="1"
|
|
||||||
id="ingredientsDiv"
|
|
||||||
style="height: 420px;"
|
|
||||||
columnClasses="alignTop"
|
|
||||||
>
|
|
||||||
<p:dataTable id="ingredientTable"
|
<p:dataTable id="ingredientTable"
|
||||||
style="width: 100%"
|
style="width: 100%; height: 420px; margin-top: 8px"
|
||||||
value="#{recipeDetailBean.ingredients}"
|
value="#{recipeDetailBean.ingredients}"
|
||||||
var="item"
|
scrollable="true"
|
||||||
|
scrollHeight="380" var="item"
|
||||||
>
|
>
|
||||||
<p:column label="Sel."
|
<p:column label="Sel."
|
||||||
align="center"
|
align="center"
|
||||||
|
@ -195,20 +191,17 @@
|
||||||
id="selected"
|
id="selected"
|
||||||
value="#{item.selected}"
|
value="#{item.selected}"
|
||||||
>
|
>
|
||||||
<f:ajax
|
<f:ajax immediate="true"
|
||||||
immediate="true"
|
|
||||||
render="pnlIngredients"
|
render="pnlIngredients"
|
||||||
/>
|
/>
|
||||||
</p:selectBooleanCheckbox>
|
</p:selectBooleanCheckbox>
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column
|
<p:column style="width: 3.6em">
|
||||||
style="width: 4.4em"
|
|
||||||
>
|
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
Amt.
|
Amt.
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:inputText id="ingAmt"
|
<p:inputText id="ingAmt"
|
||||||
size="5"
|
size="3"
|
||||||
value="#{item.displayAmount}"
|
value="#{item.displayAmount}"
|
||||||
style="text-align: right"
|
style="text-align: right"
|
||||||
rendered="#{not item.ingGroup}"
|
rendered="#{not item.ingGroup}"
|
||||||
|
@ -257,20 +250,23 @@
|
||||||
value="#{item.ingkey}"
|
value="#{item.ingkey}"
|
||||||
size="20"
|
size="20"
|
||||||
rendered="#{not item.ingGroup}"
|
rendered="#{not item.ingGroup}"
|
||||||
|
>
|
||||||
|
<f:ajax event="change"
|
||||||
|
listener="#{recipeDetailBean.ajaxUpdateShopcat(item)}"
|
||||||
|
render="shopCat"
|
||||||
/>
|
/>
|
||||||
|
</p:inputText>
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column>
|
<p:column>
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
Shop. Cat.
|
Shop. Cat.
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText
|
<h:outputText id="shopCat"
|
||||||
id="shopCat"
|
|
||||||
value="#{item.shopCat}"
|
value="#{item.shopCat}"
|
||||||
rendered="#{not item.ingGroup}"
|
rendered="#{not item.ingGroup}"
|
||||||
/>
|
/>
|
||||||
</p:column>
|
</p:column>
|
||||||
</p:dataTable>
|
</p:dataTable>
|
||||||
</h:panelGrid>
|
|
||||||
<h:panelGroup id="pnlIng">
|
<h:panelGroup id="pnlIng">
|
||||||
<p:remoteCommand name="ingButton"
|
<p:remoteCommand name="ingButton"
|
||||||
action="#{recipeDetailBean.doAddIngredient}"
|
action="#{recipeDetailBean.doAddIngredient}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user