|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
|
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
|
|
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
|
|
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
|
|
|
xmlns:p="http://primefaces.org/ui"
|
|
|
|
xmlns:c="http://xmlns.jcp.org/jstl"
|
|
|
|
>
|
|
|
|
<head></head>
|
|
|
|
<body>
|
|
|
|
<ui:composition template="/WEB-INF/layout/layout.xhtml">
|
|
|
|
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
|
|
|
<ui:define name="content">
|
|
|
|
<style>
|
|
|
|
.ingSel {
|
|
|
|
width: 3em;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.ingAmt {
|
|
|
|
width: 4em;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
|
|
|
.ingItem {
|
|
|
|
width: 20em;
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<h:messages id="messages" />
|
|
|
|
<p:panel id="editorPanel"
|
|
|
|
header="#{recipeDetailBean.recipe.title}"
|
|
|
|
>
|
|
|
|
<h:form id="form1" enctype="multipart/form-data">
|
|
|
|
<p:tabView id="tabGroupClient"
|
|
|
|
orientation="left"
|
|
|
|
activeIndex="#{userSession.detailTab}"
|
|
|
|
>
|
|
|
|
<p:tab id="overviewTab"
|
|
|
|
title="Description"
|
|
|
|
>
|
|
|
|
<p:panelGrid columns="2">
|
|
|
|
<f:facet name="header">Description</f:facet>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Title"
|
|
|
|
/>
|
|
|
|
<p:inputText id="rtitle"
|
|
|
|
size="45" required="true"
|
|
|
|
focus="true"
|
|
|
|
placeholder="A recipe title is required."
|
|
|
|
value="#{recipeDetailBean.recipe.title}"
|
|
|
|
>
|
|
|
|
<f:ajax execute="rtitle"
|
|
|
|
render="editorPanel"
|
|
|
|
/>
|
|
|
|
</p:inputText>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Category"
|
|
|
|
/>
|
|
|
|
<p:inputText id="rcategory"
|
|
|
|
label="Category"
|
|
|
|
value="#{recipeDetailBean.category}"
|
|
|
|
tip="One or more categories, separated by commas (ex: Entree, Soup)"
|
|
|
|
/>
|
|
|
|
<p:commandButton
|
|
|
|
value="<- Suggest"
|
|
|
|
>
|
|
|
|
<f:ajax
|
|
|
|
execute="rcategory bxCat"
|
|
|
|
listener="#{recipeDetailBean.ajaxSuggestCategory}"
|
|
|
|
render="rcategory"
|
|
|
|
/>
|
|
|
|
</p:commandButton>
|
|
|
|
<p:selectOneMenu id="bxCat"
|
|
|
|
value="#{recipeDetailBean.catToAdd}"
|
|
|
|
tip="Recipe category suggestions, based on previous selections"
|
|
|
|
>
|
|
|
|
<f:selectItems
|
|
|
|
value="#{recipeDetailBean.suggestCategory}"
|
|
|
|
/>
|
|
|
|
</p:selectOneMenu>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Cuisine"
|
|
|
|
/>
|
|
|
|
<p:autoComplete id="rcuisine"
|
|
|
|
value="#{recipeDetailBean.recipe.cuisine}"
|
|
|
|
completeMethod="#{recipeDetailBean.cuisineSuggestions}"
|
|
|
|
/>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Rating"
|
|
|
|
/>
|
|
|
|
<p:rating id="rrating" max="10"
|
|
|
|
value="#{recipeDetailBean.recipe.rating}"
|
|
|
|
/>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Source"
|
|
|
|
/>
|
|
|
|
<p:inputText id="rsource"
|
|
|
|
size="45"
|
|
|
|
value="#{recipeDetailBean.recipe.source}"
|
|
|
|
/>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="URL"
|
|
|
|
/>
|
|
|
|
<p:inputText id="rurl" size="45"
|
|
|
|
value="#{recipeDetailBean.recipe.link}"
|
|
|
|
/>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Description"
|
|
|
|
/>
|
|
|
|
<p:inputTextarea id="description"
|
|
|
|
rows="10" cols="45"
|
|
|
|
value="#{recipeDetailBean.recipe.description}"
|
|
|
|
/>
|
|
|
|
<p:panel id="picPanel">
|
|
|
|
<img id="bigPix"
|
|
|
|
src="/img/picture/?dt=#{recipeDetailBean.currentTime}"
|
|
|
|
/>
|
|
|
|
</p:panel>
|
|
|
|
<p:fileUpload id="ctlUpload"
|
|
|
|
label="Upload Image"
|
|
|
|
fileUploadListener="#{recipeDetailBean.ajaxUploadImage}"
|
|
|
|
global="true" mode="advanced"
|
|
|
|
multiple="false"
|
|
|
|
update=":messages picPanel"
|
|
|
|
auto="true"
|
|
|
|
sizeLimit="1000000"
|
|
|
|
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
|
|
|
|
/>
|
|
|
|
<p:commandButton id="ctlDelImg"
|
|
|
|
value="Delete Image"
|
|
|
|
>
|
|
|
|
<f:ajax
|
|
|
|
listener="#{recipeDetailBean.ajaxDeleteImage}"
|
|
|
|
render="picPanel"
|
|
|
|
immediate="true"
|
|
|
|
/>
|
|
|
|
</p:commandButton>
|
|
|
|
</p:panelGrid>
|
|
|
|
</p:tab>
|
|
|
|
<p:tab id="ingredientsTab"
|
|
|
|
title="Ingredients"
|
|
|
|
>
|
|
|
|
<p:panel id="pnlIngredients">
|
|
|
|
<f:facet name="header">Ingredients</f:facet>
|
|
|
|
<h:panelGroup id="ingButtons">
|
|
|
|
<p:commandButton value="Up"
|
|
|
|
disabled="#{not recipeDetailBean.moveUpAble}"
|
|
|
|
id="ctlUp"
|
|
|
|
>
|
|
|
|
<f:ajax
|
|
|
|
listener="#{recipeDetailBean.ajaxMoveUp}"
|
|
|
|
execute="ingredientTable"
|
|
|
|
render="ingredientTable"
|
|
|
|
/>
|
|
|
|
</p:commandButton>
|
|
|
|
<p:commandButton value="Down"
|
|
|
|
disabled="#{not recipeDetailBean.moveDownAble}"
|
|
|
|
id="ctlDown"
|
|
|
|
>
|
|
|
|
<f:ajax
|
|
|
|
listener="#{recipeDetailBean.ajaxMoveDown}"
|
|
|
|
execute="ingredientTable"
|
|
|
|
render="ingredientTable"
|
|
|
|
/>
|
|
|
|
</p:commandButton>
|
|
|
|
<p:button value="Add Group"
|
|
|
|
disabled="true"
|
|
|
|
/>
|
|
|
|
<p:button
|
|
|
|
value="Add Recipe As Ingredient"
|
|
|
|
disabled="true"
|
|
|
|
/>
|
|
|
|
<p:button
|
|
|
|
value="Import Ingredients"
|
|
|
|
disabled="true"
|
|
|
|
/>
|
|
|
|
<p:button value="Paste" />
|
|
|
|
<p:commandButton
|
|
|
|
value="Delete"
|
|
|
|
id="ctlDelete"
|
|
|
|
disabled="not #{recipeDetailBean.selectionActive}"
|
|
|
|
>
|
|
|
|
<f:ajax
|
|
|
|
listener="#{recipeDetailBean.ajaxDeleteItems}"
|
|
|
|
immediate="true"
|
|
|
|
render="ingredientTable"
|
|
|
|
/>
|
|
|
|
</p:commandButton>
|
|
|
|
</h:panelGroup>
|
|
|
|
<p:dataTable id="ingredientTable"
|
|
|
|
style="width: 100%; height: 420px; margin-top: 8px"
|
|
|
|
value="#{recipeDetailBean.ingredients}"
|
|
|
|
scrollable="true"
|
|
|
|
scrollHeight="380" var="item"
|
|
|
|
>
|
|
|
|
<p:column label="Sel."
|
|
|
|
align="center"
|
|
|
|
style="width: 2em"
|
|
|
|
>
|
|
|
|
<p:selectBooleanCheckbox
|
|
|
|
id="selected"
|
|
|
|
value="#{item.selected}"
|
|
|
|
>
|
|
|
|
<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="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">
|
|
|
|
Item
|
|
|
|
</f:facet>
|
|
|
|
<p:inputText id="ingItem"
|
|
|
|
size="42"
|
|
|
|
value="#{item.item}"
|
|
|
|
>
|
|
|
|
</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">
|
|
|
|
Ing. Key
|
|
|
|
</f:facet>
|
|
|
|
<p:inputText id="ingKey"
|
|
|
|
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"
|
|
|
|
value="#{item.shopCat}"
|
|
|
|
rendered="#{not item.ingGroup}"
|
|
|
|
/>
|
|
|
|
<p:commandButton
|
|
|
|
id="eShopcat"
|
|
|
|
value="E"
|
|
|
|
action="#{recipeDetailBean.ajaxEditShopcat(item)}"
|
|
|
|
update="editShopcatDlg"
|
|
|
|
oncomplete="PF('editShopcatDlg').show()"
|
|
|
|
>
|
|
|
|
</p:commandButton>
|
|
|
|
</p:column>
|
|
|
|
</p:dataTable>
|
|
|
|
<h:panelGroup id="pnlIng">
|
|
|
|
<p:remoteCommand
|
|
|
|
name="ingButton"
|
|
|
|
action="#{recipeDetailBean.doAddIngredient}"
|
|
|
|
process="@this ctlAddIngTxt"
|
|
|
|
update="pnlIngredients"
|
|
|
|
/>
|
|
|
|
<p:outputLabel for="@next"
|
|
|
|
value="Add Ingredient: "
|
|
|
|
/>
|
|
|
|
<p:inputTextarea
|
|
|
|
id="ctlAddIngTxt"
|
|
|
|
focus="true" rows="1"
|
|
|
|
cols="65"
|
|
|
|
value="#{recipeDetailBean.ingredientText}"
|
|
|
|
title="You can paste in multiple ingredients here!"
|
|
|
|
onkeydown="if (event.keyCode === 13) { ingButton(); this.focus(); return false; }"
|
|
|
|
/>
|
|
|
|
<p:commandButton
|
|
|
|
id="ctlAddIng"
|
|
|
|
value="+ Add"
|
|
|
|
onclick="ingButton(); return false;"
|
|
|
|
>
|
|
|
|
</p:commandButton>
|
|
|
|
</h:panelGroup>
|
|
|
|
</p:panel>
|
|
|
|
</p:tab>
|
|
|
|
<p:tab id="instructionsTab"
|
|
|
|
title="Instructions"
|
|
|
|
>
|
|
|
|
<p:panel header="Instructions">
|
|
|
|
<div id="insection">
|
|
|
|
<p:textEditor
|
|
|
|
id="ctlInstructions"
|
|
|
|
height="320"
|
|
|
|
escape="false"
|
|
|
|
value="#{recipeDetailBean.recipe.instructions}"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</p:panel>
|
|
|
|
</p:tab>
|
|
|
|
<p:tab id="notesTab" title="Notes">
|
|
|
|
<p:panel header="Notes">
|
|
|
|
<p:textEditor id="ctlNotes"
|
|
|
|
height="320" escape="false"
|
|
|
|
value="#{recipeDetailBean.recipe.modifications}"
|
|
|
|
/>
|
|
|
|
</p:panel>
|
|
|
|
</p:tab>
|
|
|
|
</p:tabView>
|
|
|
|
<p:commandButton id="doSave" value="Save"
|
|
|
|
disabled="{not recipeDetailBean.dirty}"
|
|
|
|
action="#{recipeDetailBean.doSave}"
|
|
|
|
/>
|
|
|
|
<p:commandButton id="doCancel" value="Cancel"
|
|
|
|
immediate="true" action="/main.jsf"
|
|
|
|
/>
|
|
|
|
</h:form>
|
|
|
|
</p:panel>
|
|
|
|
<p:dialog id="editShopcatDlg" widgetVar="editShopcatDlg">
|
|
|
|
<ui:include src="editShopcat.xhtml" />
|
|
|
|
</p:dialog>
|
|
|
|
</ui:define>
|
|
|
|
</ui:composition>
|
|
|
|
</body>
|
|
|
|
</html>
|