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,15 +177,11 @@
|
|||
/>
|
||||
</p:commandButton>
|
||||
</h:panelGroup>
|
||||
<h:panelGrid columns="1"
|
||||
id="ingredientsDiv"
|
||||
style="height: 420px;"
|
||||
columnClasses="alignTop"
|
||||
>
|
||||
<p:dataTable id="ingredientTable"
|
||||
style="width: 100%"
|
||||
style="width: 100%; height: 420px; margin-top: 8px"
|
||||
value="#{recipeDetailBean.ingredients}"
|
||||
var="item"
|
||||
scrollable="true"
|
||||
scrollHeight="380" var="item"
|
||||
>
|
||||
<p:column label="Sel."
|
||||
align="center"
|
||||
|
@ -195,20 +191,17 @@
|
|||
id="selected"
|
||||
value="#{item.selected}"
|
||||
>
|
||||
<f:ajax
|
||||
immediate="true"
|
||||
<f:ajax immediate="true"
|
||||
render="pnlIngredients"
|
||||
/>
|
||||
</p:selectBooleanCheckbox>
|
||||
</p:column>
|
||||
<p:column
|
||||
style="width: 4.4em"
|
||||
>
|
||||
<p:column style="width: 3.6em">
|
||||
<f:facet name="header">
|
||||
Amt.
|
||||
</f:facet>
|
||||
<p:inputText id="ingAmt"
|
||||
size="5"
|
||||
size="3"
|
||||
value="#{item.displayAmount}"
|
||||
style="text-align: right"
|
||||
rendered="#{not item.ingGroup}"
|
||||
|
@ -257,20 +250,23 @@
|
|||
value="#{item.ingkey}"
|
||||
size="20"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
<f:ajax event="change"
|
||||
listener="#{recipeDetailBean.ajaxUpdateShopcat(item)}"
|
||||
render="shopCat"
|
||||
/>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column>
|
||||
<f:facet name="header">
|
||||
Shop. Cat.
|
||||
</f:facet>
|
||||
<h:outputText
|
||||
id="shopCat"
|
||||
<h:outputText id="shopCat"
|
||||
value="#{item.shopCat}"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
</p:dataTable>
|
||||
</h:panelGrid>
|
||||
<h:panelGroup id="pnlIng">
|
||||
<p:remoteCommand name="ingButton"
|
||||
action="#{recipeDetailBean.doAddIngredient}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user