diff --git a/src/main/frontend/src/components/AddCatalogNumbersForm.js b/src/main/frontend/src/components/AddCatalogNumbersForm.js
new file mode 100644
index 0000000000..12c02caba2
--- /dev/null
+++ b/src/main/frontend/src/components/AddCatalogNumbersForm.js
@@ -0,0 +1,160 @@
+//
+// IMPORTANT:
+// You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
+//
+
+class AddCatalogNumbersForm extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ numbers: null,
+ catalog: 'michel',
+ hasServerError: false,
+ validationErrors: [],
+ isDisabled: false
+ };
+ this.handleSubmit = this.handleSubmit.bind(this);
+ this.handleChangeNumbers = this.handleChangeNumbers.bind(this);
+ this.handleChangeCatalog = this.handleChangeCatalog.bind(this);
+ }
+
+ handleChangeNumbers(event) {
+ event.preventDefault();
+ this.setState({
+ numbers: event.target.value
+ });
+ }
+
+ handleChangeCatalog(event) {
+ event.preventDefault();
+ this.setState({
+ catalog: event.target.value
+ });
+ }
+
+ handleSubmit(event) {
+ event.preventDefault();
+
+ this.setState({
+ isDisabled: true,
+ hasServerError: false,
+ validationErrors: []
+ });
+
+ axios.patch(
+ this.props.url,
+ [
+ {
+ op: 'add',
+ path: `/${this.state.catalog}_numbers`,
+ value: this.state.numbers.split(',')
+ }
+ ],
+ {
+ headers: {
+ [this.props.csrfHeaderName]: this.props.csrfTokenValue,
+ 'Cache-Control': 'no-store'
+ },
+ validateStatus: status => {
+ return status == 204 || status == 400;
+ }
+ }
+ )
+ .then(response => {
+ const data = response.data;
+ if (data.hasOwnProperty('fieldErrors')) {
+ const fieldErrors = [];
+ if (data.fieldErrors.numbers) {
+ fieldErrors.push(...data.fieldErrors.numbers);
+ }
+
+ this.setState({
+ isDisabled: false,
+ validationErrors: fieldErrors
+ });
+ return;
+ }
+
+ // no need to reset the state as page will be reloaded
+ window.location.reload();
+ })
+ .catch(error => {
+ console.error(error);
+ this.setState({ isDisabled: false, hasServerError: true });
+ });
+ }
+ render() {
+ const hasValidationErrors = this.state.validationErrors.length > 0;
+ return (
+
+ );
+ }
+}
diff --git a/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java b/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java
index da78ac043a..73a2cd4c01 100644
--- a/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java
+++ b/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java
@@ -32,9 +32,9 @@ public final class ResourceUrl {
public static final String STATIC_RESOURCES_URL = "https://stamps.filezz.ru";
// MUST be updated when any of our resources were modified
- public static final String RESOURCES_VERSION = "v0.4.3.3";
+ public static final String RESOURCES_VERSION = "v0.4.3.4";
- // CheckStyle: ignore LineLength for next 14 lines
+ // CheckStyle: ignore LineLength for next 15 lines
private static final String CATALOG_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/CatalogUtils.min.js";
private static final String COLLECTION_INFO_JS = "/public/js/" + RESOURCES_VERSION + "/collection/info.min.js";
private static final String DATE_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/DateUtils.min.js";
@@ -47,6 +47,7 @@ public final class ResourceUrl {
private static final String SIMILAR_SERIES_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/SimilarSeriesForm.js";
private static final String ADD_COMMENT_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/AddCommentForm.js";
private static final String CATALOG_PRICE_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/AddCatalogPriceForm.js";
+ private static final String CATALOG_NUMBERS_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/AddCatalogNumbersForm.js";
private static final String RELEASE_YEAR_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/AddReleaseYearForm.js";
private static final String BOOTSTRAP_LANGUAGE = "https://cdn.jsdelivr.net/gh/usrz/bootstrap-languages@3ac2a3d2b27ac43a471cd99e79d378a03b2c6b5f/languages.min.css";
private static final String FAVICON_ICO = "/favicon.ico";
@@ -85,6 +86,7 @@ public static void exposeResourcesToView(Map resources, String h
put(resources, host, "SIMILAR_SERIES_FORM_JS", SIMILAR_SERIES_FORM_JS);
put(resources, host, "ADD_COMMENT_FORM_JS", ADD_COMMENT_FORM_JS);
put(resources, host, "CATALOG_PRICE_FORM_JS", CATALOG_PRICE_FORM_JS);
+ put(resources, host, "CATALOG_NUMBERS_FORM_JS", CATALOG_NUMBERS_FORM_JS);
put(resources, host, "RELEASE_YEAR_FORM_JS", RELEASE_YEAR_FORM_JS);
}
diff --git a/src/main/webapp/WEB-INF/views/series/info.html b/src/main/webapp/WEB-INF/views/series/info.html
index 30296d257e..e83c989a7e 100644
--- a/src/main/webapp/WEB-INF/views/series/info.html
+++ b/src/main/webapp/WEB-INF/views/series/info.html
@@ -395,6 +395,8 @@ Hidden images
+
+
@@ -931,7 +933,8 @@ Add info about selling/buying thi
'fieldErrors': {
'comment': ['Comment error'],
'year': ['Year error'],
- 'price': ['Price error']
+ 'price': ['Price error'],
+ 'numbers': ['Numbers error']
}
}
},
@@ -977,6 +980,8 @@ Add info about selling/buying thi
/*/-->
+
+