-
Notifications
You must be signed in to change notification settings - Fork 34
Description
On the src/main/webapp/WEB-INF/views/series/info.html
page we should add another form to add a catalog price. It should have inputs with price and a catalog name. Also there should be a submit button. Here are the examples that can be helpful:
-
List of catalogs:
mystamps/src/main/webapp/WEB-INF/views/site/index.html
Lines 174 to 184 in 366f099
<div class="form-group"> <label for="catalogName" th:text="|#{t_catalog}:|">Catalog:</label> <select id="catalogName" name="catalogName" class="form-control"> <option value="michel" th:text="#{t_michel}">Michel</option> <option value="scott" th:text="#{t_scott}">Scott</option> <option value="yvert" th:text="#{t_yvert}">Yvert</option> <option value="gibbons" th:text="#{t_sg}">Gibbons</option> <option value="solovyov" th:text="#{t_solovyov}">Solovyov</option> <option value="zagorski" th:text="#{t_zagorski}">Zagorski</option> </select> </div> -
Price:
mystamps/src/main/webapp/WEB-INF/views/series/info.html
Lines 408 to 438 in 366f099
<input id="paid-price" type="text" size="5" placeholder="price" th:placeholder="${#strings.unCapitalize(price_msg)}" th:field="*{price}" th:disabled="${paidUser ? null : 'disabled'}" /> <select id="paid-currency" th:field="*{currency}" th:disabled="${paidUser ? null : 'disabled'}"> <option value=""></option> <option value="USD">USD</option> <option value="EUR">EUR</option> <option value="RUB">RUB</option> <option value="CZK">CZK</option> <option value="BYN">BYN</option> <option value="UAH">UAH</option> </select> </p> <!--/*/ <p th:if="${#fields.hasErrors('price') or #fields.hasErrors('currency')}" th:classappend="has-error"> <span id="paid-price.errors" class="help-block" th:each="error : ${#fields.errors('price')}" th:text="${error}"></span> <span id="paid-currency.errors" class="help-block" th:each="error : ${#fields.errors('currency')}" th:text="${error}"></span> </p>
When we submit a form, it should send a PATCH request to API /series/{id}
with
[
{ "op": "add", "path": "/michel_price", "value": <price> }
]
and reload a page on success. The value of path
depends on a value of catalog name -- for Michel catalog, we use "/michel_price" but for Scott it should be "/scott_price" and so on.
It should show an error when server returns an error. Note that there can be 2 type of errors -- general (for a whole form) and validation error (for a particular field).
Part of #1340