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,12 +806,11 @@ 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
public String editDescription() {
|
public String editDescription() {
|
||||||
|
|
|
@ -177,100 +177,96 @@
|
||||||
/>
|
/>
|
||||||
</p:commandButton>
|
</p:commandButton>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
<h:panelGrid columns="1"
|
<p:dataTable id="ingredientTable"
|
||||||
id="ingredientsDiv"
|
style="width: 100%; height: 420px; margin-top: 8px"
|
||||||
style="height: 420px;"
|
value="#{recipeDetailBean.ingredients}"
|
||||||
columnClasses="alignTop"
|
scrollable="true"
|
||||||
|
scrollHeight="380" var="item"
|
||||||
>
|
>
|
||||||
<p:dataTable id="ingredientTable"
|
<p:column label="Sel."
|
||||||
style="width: 100%"
|
align="center"
|
||||||
value="#{recipeDetailBean.ingredients}"
|
style="width: 2em"
|
||||||
var="item"
|
|
||||||
>
|
>
|
||||||
<p:column label="Sel."
|
<p:selectBooleanCheckbox
|
||||||
align="center"
|
id="selected"
|
||||||
style="width: 2em"
|
value="#{item.selected}"
|
||||||
>
|
>
|
||||||
<p:selectBooleanCheckbox
|
<f:ajax immediate="true"
|
||||||
id="selected"
|
render="pnlIngredients"
|
||||||
value="#{item.selected}"
|
/>
|
||||||
>
|
</p:selectBooleanCheckbox>
|
||||||
<f:ajax
|
</p:column>
|
||||||
immediate="true"
|
<p:column style="width: 3.6em">
|
||||||
render="pnlIngredients"
|
<f:facet name="header">
|
||||||
/>
|
|
||||||
</p:selectBooleanCheckbox>
|
|
||||||
</p:column>
|
|
||||||
<p:column
|
|
||||||
style="width: 4.4em"
|
|
||||||
>
|
|
||||||
<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}"
|
||||||
>
|
>
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column style="width: 7em">
|
<p:column style="width: 7em">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
Units
|
Units
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:inputText id="ingUnit"
|
<p:inputText id="ingUnit"
|
||||||
value="#{item.unit}"
|
value="#{item.unit}"
|
||||||
size="10"
|
size="10"
|
||||||
rendered="#{not item.ingGroup}"
|
rendered="#{not item.ingGroup}"
|
||||||
>
|
>
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column style="width: 26em">
|
<p:column style="width: 26em">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
Item
|
Item
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:inputText id="ingItem"
|
<p:inputText id="ingItem"
|
||||||
size="42"
|
size="42"
|
||||||
value="#{item.item}"
|
value="#{item.item}"
|
||||||
>
|
|
||||||
</p:inputText>
|
|
||||||
</p:column>
|
|
||||||
<p:column label="Optional"
|
|
||||||
align="center"
|
|
||||||
styleClass="ingSel"
|
|
||||||
>
|
>
|
||||||
<f:facet name="header">
|
</p:inputText>
|
||||||
|
</p:column>
|
||||||
|
<p:column label="Optional"
|
||||||
|
align="center"
|
||||||
|
styleClass="ingSel"
|
||||||
|
>
|
||||||
|
<f:facet name="header">
|
||||||
Opt.
|
Opt.
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:selectBooleanCheckbox
|
<p:selectBooleanCheckbox
|
||||||
id="ingOpt"
|
id="ingOpt"
|
||||||
value="#{item.optionalCB}"
|
value="#{item.optionalCB}"
|
||||||
rendered="#{not item.ingGroup}"
|
rendered="#{not item.ingGroup}"
|
||||||
/>
|
/>
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column style="width: 13em">
|
<p:column style="width: 13em">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
Ing. Key
|
Ing. Key
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:inputText id="ingKey"
|
<p:inputText id="ingKey"
|
||||||
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:column>
|
</p:inputText>
|
||||||
<p:column>
|
</p:column>
|
||||||
<f:facet name="header">
|
<p:column>
|
||||||
|
<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