|
|
@@ -1,4 +1,27 @@
|
|
|
(() => {
|
|
|
+ var __accessCheck = (obj, member, msg) => {
|
|
|
+ if (!member.has(obj))
|
|
|
+ throw TypeError("Cannot " + msg);
|
|
|
+ };
|
|
|
+ var __privateGet = (obj, member, getter) => {
|
|
|
+ __accessCheck(obj, member, "read from private field");
|
|
|
+ return getter ? getter.call(obj) : member.get(obj);
|
|
|
+ };
|
|
|
+ var __privateAdd = (obj, member, value) => {
|
|
|
+ if (member.has(obj))
|
|
|
+ throw TypeError("Cannot add the same private member more than once");
|
|
|
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
|
+ };
|
|
|
+ var __privateSet = (obj, member, value, setter) => {
|
|
|
+ __accessCheck(obj, member, "write to private field");
|
|
|
+ setter ? setter.call(obj, value) : member.set(obj, value);
|
|
|
+ return value;
|
|
|
+ };
|
|
|
+ var __privateMethod = (obj, member, method) => {
|
|
|
+ __accessCheck(obj, member, "access private method");
|
|
|
+ return method;
|
|
|
+ };
|
|
|
+
|
|
|
// application/scripts/height_equaler.js
|
|
|
var height_equaler = class {
|
|
|
#to;
|
|
|
@@ -27,7 +50,7 @@
|
|
|
};
|
|
|
|
|
|
// application/scripts/product.js
|
|
|
- var product = class _product {
|
|
|
+ var product = class {
|
|
|
name;
|
|
|
description;
|
|
|
author;
|
|
|
@@ -45,14 +68,22 @@
|
|
|
this.barcode = null;
|
|
|
this.thumbnail = null;
|
|
|
this.on_stock = null;
|
|
|
- if ("name" in target) this.name = target["name"];
|
|
|
- if ("description" in target) this.description = target["description"];
|
|
|
- if ("author" in target) this.author = target["author"];
|
|
|
- if ("image" in target) this.image = target["image"];
|
|
|
- if ("stock_count" in target) this.stock_count = target["stock_count"];
|
|
|
- if ("barcode" in target) this.barcode = target["barcode"];
|
|
|
- if ("thumbnail" in target) this.thumbnail = target["thumbnail"];
|
|
|
- if ("on_stock" in target) this.on_stock = target["on_stock"];
|
|
|
+ if ("name" in target)
|
|
|
+ this.name = target["name"];
|
|
|
+ if ("description" in target)
|
|
|
+ this.description = target["description"];
|
|
|
+ if ("author" in target)
|
|
|
+ this.author = target["author"];
|
|
|
+ if ("image" in target)
|
|
|
+ this.image = target["image"];
|
|
|
+ if ("stock_count" in target)
|
|
|
+ this.stock_count = target["stock_count"];
|
|
|
+ if ("barcode" in target)
|
|
|
+ this.barcode = target["barcode"];
|
|
|
+ if ("thumbnail" in target)
|
|
|
+ this.thumbnail = target["thumbnail"];
|
|
|
+ if ("on_stock" in target)
|
|
|
+ this.on_stock = target["on_stock"];
|
|
|
try {
|
|
|
this.stock_count = Number(this.stock_count);
|
|
|
} catch {
|
|
|
@@ -80,53 +111,80 @@
|
|
|
return dumped;
|
|
|
}
|
|
|
get ready() {
|
|
|
- if (this.name === null || this.description === null) return false;
|
|
|
- if (this.author === null || this.image === null) return false;
|
|
|
- if (this.stock_count === null || this.barcode === null) return false;
|
|
|
- if (this.thumbnail === null) return false;
|
|
|
+ if (this.name === null || this.description === null)
|
|
|
+ return false;
|
|
|
+ if (this.author === null || this.image === null)
|
|
|
+ return false;
|
|
|
+ if (this.stock_count === null || this.barcode === null)
|
|
|
+ return false;
|
|
|
+ if (this.thumbnail === null)
|
|
|
+ return false;
|
|
|
return true;
|
|
|
}
|
|
|
copy() {
|
|
|
- return new _product(this.dump);
|
|
|
+ return new product(this.dump);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// application/scripts/products_loader.js
|
|
|
- var products_loader = class _products_loader {
|
|
|
+ var _response_to_collection, response_to_collection_fn, _single_response_to_collection, single_response_to_collection_fn, _list_response_to_collection, list_response_to_collection_fn, _search, search_fn;
|
|
|
+ var _products_loader = class {
|
|
|
static async all() {
|
|
|
+ var _a;
|
|
|
const request2 = await fetch("/products/");
|
|
|
const response = await request2.json();
|
|
|
- return _products_loader.#response_to_collection(response);
|
|
|
- }
|
|
|
- static #response_to_collection(response) {
|
|
|
- const result = new Array();
|
|
|
- if (response.result !== "success") {
|
|
|
- return result;
|
|
|
- }
|
|
|
- response.collection.forEach((serialized) => {
|
|
|
- result.push(new product(serialized));
|
|
|
- });
|
|
|
- return result;
|
|
|
+ return __privateMethod(_a = _products_loader, _response_to_collection, response_to_collection_fn).call(_a, response);
|
|
|
}
|
|
|
static async search_name(name) {
|
|
|
- return await _products_loader.#search(
|
|
|
- "/product/search/name",
|
|
|
- name
|
|
|
- );
|
|
|
+ var _a;
|
|
|
+ return await __privateMethod(_a = _products_loader, _search, search_fn).call(_a, "/product/search/name", name);
|
|
|
}
|
|
|
static async search_author(author) {
|
|
|
- return await _products_loader.#search(
|
|
|
- "/product/search/author",
|
|
|
- author
|
|
|
- );
|
|
|
+ var _a;
|
|
|
+ return await __privateMethod(_a = _products_loader, _search, search_fn).call(_a, "/product/search/author", author);
|
|
|
}
|
|
|
- static async #search(path, parameter) {
|
|
|
- const coded = encodeURI(parameter);
|
|
|
- const request2 = await fetch(path + "/" + coded);
|
|
|
- const response = await request2.json();
|
|
|
- return _products_loader.#response_to_collection(response);
|
|
|
+ static async search_barcode(barcode) {
|
|
|
+ var _a;
|
|
|
+ return await __privateMethod(_a = _products_loader, _search, search_fn).call(_a, "/product/get/barcode", barcode);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var products_loader = _products_loader;
|
|
|
+ _response_to_collection = new WeakSet();
|
|
|
+ response_to_collection_fn = function(response) {
|
|
|
+ if (response.result !== "success") {
|
|
|
+ return new Array();
|
|
|
}
|
|
|
+ if ("collection" in response) {
|
|
|
+ return __privateMethod(this, _list_response_to_collection, list_response_to_collection_fn).call(this, response);
|
|
|
+ }
|
|
|
+ return __privateMethod(this, _single_response_to_collection, single_response_to_collection_fn).call(this, response);
|
|
|
+ };
|
|
|
+ _single_response_to_collection = new WeakSet();
|
|
|
+ single_response_to_collection_fn = function(response) {
|
|
|
+ const result = new Array();
|
|
|
+ result.push(new product(response.product));
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ _list_response_to_collection = new WeakSet();
|
|
|
+ list_response_to_collection_fn = function(response) {
|
|
|
+ const result = new Array();
|
|
|
+ response.collection.forEach((serialized) => {
|
|
|
+ result.push(new product(serialized));
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ _search = new WeakSet();
|
|
|
+ search_fn = async function(path, parameter) {
|
|
|
+ var _a;
|
|
|
+ const coded = encodeURI(parameter);
|
|
|
+ const request2 = await fetch(path + "/" + coded);
|
|
|
+ const response = await request2.json();
|
|
|
+ return __privateMethod(_a = _products_loader, _response_to_collection, response_to_collection_fn).call(_a, response);
|
|
|
};
|
|
|
+ __privateAdd(products_loader, _response_to_collection);
|
|
|
+ __privateAdd(products_loader, _single_response_to_collection);
|
|
|
+ __privateAdd(products_loader, _list_response_to_collection);
|
|
|
+ __privateAdd(products_loader, _search);
|
|
|
|
|
|
// application/scripts/fullscreen.js
|
|
|
var fullscreen = class {
|
|
|
@@ -396,7 +454,7 @@
|
|
|
const cancel_button = document.createElement("button");
|
|
|
cancel_button.classList.add("cancel");
|
|
|
cancel_button.classList.add("material-icons");
|
|
|
- cancel_button.innerText = _("clear");
|
|
|
+ cancel_button.innerText = "close";
|
|
|
buttons.appendChild(cancel_button);
|
|
|
cancel_button.addEventListener("click", () => {
|
|
|
this.hide();
|
|
|
@@ -405,7 +463,7 @@
|
|
|
const confirm_button = document.createElement("button");
|
|
|
confirm_button.classList.add("confirm");
|
|
|
confirm_button.classList.add("material-icons");
|
|
|
- confirm_button.innerText = _("send");
|
|
|
+ confirm_button.innerText = "send";
|
|
|
buttons.appendChild(confirm_button);
|
|
|
confirm_button.addEventListener("click", () => {
|
|
|
if (this.#action === false) {
|
|
|
@@ -580,91 +638,111 @@
|
|
|
};
|
|
|
|
|
|
// application/scripts/searcher.js
|
|
|
- var searcher = class _searcher {
|
|
|
- #input;
|
|
|
- #category;
|
|
|
- #manager;
|
|
|
- #result;
|
|
|
- static #instances;
|
|
|
- static #add(instance) {
|
|
|
- if (typeof _searcher.#instances !== "object") {
|
|
|
- _searcher.#instances = new Array();
|
|
|
- }
|
|
|
- _searcher.#instances.push(instance);
|
|
|
+ var _input, _category, _manager, _result, _instances, _add, add_fn, _selector_complete, selector_complete_fn, _loader, loader_get, _result_title, result_title_get, result_title_set, _insert, insert_fn;
|
|
|
+ var _searcher = class {
|
|
|
+ constructor(search_form, manager, result) {
|
|
|
+ __privateAdd(this, _selector_complete);
|
|
|
+ __privateAdd(this, _loader);
|
|
|
+ __privateAdd(this, _result_title);
|
|
|
+ __privateAdd(this, _insert);
|
|
|
+ __privateAdd(this, _input, void 0);
|
|
|
+ __privateAdd(this, _category, void 0);
|
|
|
+ __privateAdd(this, _manager, void 0);
|
|
|
+ __privateAdd(this, _result, void 0);
|
|
|
+ var _a;
|
|
|
+ __privateSet(this, _input, search_form.querySelector('input[type="text"]'));
|
|
|
+ __privateSet(this, _category, search_form.querySelector("select"));
|
|
|
+ __privateSet(this, _manager, manager);
|
|
|
+ __privateSet(this, _result, result);
|
|
|
+ __privateMethod(this, _selector_complete, selector_complete_fn).call(this);
|
|
|
+ search_form.addEventListener("submit", (target) => {
|
|
|
+ target.preventDefault();
|
|
|
+ this.update();
|
|
|
+ });
|
|
|
+ __privateMethod(_a = _searcher, _add, add_fn).call(_a, this);
|
|
|
}
|
|
|
static reload() {
|
|
|
- if (typeof _searcher.#instances !== "object") {
|
|
|
+ if (typeof __privateGet(_searcher, _instances) !== "object") {
|
|
|
return;
|
|
|
}
|
|
|
- _searcher.#instances.forEach((instance) => {
|
|
|
+ __privateGet(_searcher, _instances).forEach((instance) => {
|
|
|
instance.update();
|
|
|
});
|
|
|
}
|
|
|
- constructor(search_form, manager, result) {
|
|
|
- this.#input = search_form.querySelector('input[type="text"]');
|
|
|
- this.#category = search_form.querySelector("select");
|
|
|
- this.#manager = manager;
|
|
|
- this.#result = result;
|
|
|
- this.#selector_complete();
|
|
|
- search_form.addEventListener("submit", (target) => {
|
|
|
- target.preventDefault();
|
|
|
- this.update();
|
|
|
- });
|
|
|
- _searcher.#add(this);
|
|
|
- }
|
|
|
get categories() {
|
|
|
return {
|
|
|
"name": _("name-category"),
|
|
|
- "author": _("author-category")
|
|
|
+ "author": _("author-category"),
|
|
|
+ "barcode": _("barcode-category")
|
|
|
};
|
|
|
}
|
|
|
- #selector_complete() {
|
|
|
- const category = this.#category;
|
|
|
- const categories = this.categories;
|
|
|
- Object.keys(categories).forEach((name) => {
|
|
|
- const option = document.createElement("option");
|
|
|
- option.value = name;
|
|
|
- option.innerText = categories[name];
|
|
|
- category.appendChild(option);
|
|
|
- });
|
|
|
- }
|
|
|
- get #loader() {
|
|
|
- return {
|
|
|
- "name": products_loader.search_name,
|
|
|
- "author": products_loader.search_author
|
|
|
- }[this.category];
|
|
|
- }
|
|
|
get category() {
|
|
|
- return this.#category.value;
|
|
|
+ return __privateGet(this, _category).value;
|
|
|
}
|
|
|
get phrase() {
|
|
|
- return this.#input.value.trim();
|
|
|
- }
|
|
|
- get #result_title() {
|
|
|
- return this.#result.innerText;
|
|
|
- }
|
|
|
- set #result_title(target) {
|
|
|
- this.#result.innerText = target;
|
|
|
+ return __privateGet(this, _input).value.trim();
|
|
|
}
|
|
|
async update() {
|
|
|
if (this.phrase.length === 0) {
|
|
|
this.show_all();
|
|
|
return;
|
|
|
}
|
|
|
- this.#insert(await this.#loader(this.phrase));
|
|
|
- }
|
|
|
- #insert(list) {
|
|
|
- if (list.length === 0) {
|
|
|
- this.#result_title = _("not-found-anything");
|
|
|
- } else {
|
|
|
- this.#result_title = _("browse-our-products");
|
|
|
- }
|
|
|
- this.#manager.clean().add_list(list).update();
|
|
|
+ __privateMethod(this, _insert, insert_fn).call(this, await __privateGet(this, _loader, loader_get).call(this, this.phrase));
|
|
|
}
|
|
|
async show_all() {
|
|
|
- this.#insert(await products_loader.all());
|
|
|
+ __privateMethod(this, _insert, insert_fn).call(this, await products_loader.all());
|
|
|
}
|
|
|
};
|
|
|
+ var searcher = _searcher;
|
|
|
+ _input = new WeakMap();
|
|
|
+ _category = new WeakMap();
|
|
|
+ _manager = new WeakMap();
|
|
|
+ _result = new WeakMap();
|
|
|
+ _instances = new WeakMap();
|
|
|
+ _add = new WeakSet();
|
|
|
+ add_fn = function(instance) {
|
|
|
+ if (typeof __privateGet(_searcher, _instances) !== "object") {
|
|
|
+ __privateSet(_searcher, _instances, new Array());
|
|
|
+ }
|
|
|
+ __privateGet(_searcher, _instances).push(instance);
|
|
|
+ };
|
|
|
+ _selector_complete = new WeakSet();
|
|
|
+ selector_complete_fn = function() {
|
|
|
+ const category = __privateGet(this, _category);
|
|
|
+ const categories = this.categories;
|
|
|
+ Object.keys(categories).forEach((name) => {
|
|
|
+ const option = document.createElement("option");
|
|
|
+ option.value = name;
|
|
|
+ option.innerText = categories[name];
|
|
|
+ category.appendChild(option);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ _loader = new WeakSet();
|
|
|
+ loader_get = function() {
|
|
|
+ return {
|
|
|
+ "name": products_loader.search_name,
|
|
|
+ "author": products_loader.search_author,
|
|
|
+ "barcode": products_loader.search_barcode
|
|
|
+ }[this.category];
|
|
|
+ };
|
|
|
+ _result_title = new WeakSet();
|
|
|
+ result_title_get = function() {
|
|
|
+ return __privateGet(this, _result).innerText;
|
|
|
+ };
|
|
|
+ result_title_set = function(target) {
|
|
|
+ __privateGet(this, _result).innerText = target;
|
|
|
+ };
|
|
|
+ _insert = new WeakSet();
|
|
|
+ insert_fn = function(list) {
|
|
|
+ if (list.length === 0) {
|
|
|
+ __privateSet(this, _result_title, _("not-found-anything"), result_title_set);
|
|
|
+ } else {
|
|
|
+ __privateSet(this, _result_title, _("browse-our-products"), result_title_set);
|
|
|
+ }
|
|
|
+ __privateGet(this, _manager).clean().add_list(list).update();
|
|
|
+ };
|
|
|
+ __privateAdd(searcher, _add);
|
|
|
+ __privateAdd(searcher, _instances, void 0);
|
|
|
|
|
|
// application/scripts/delete_product_window.js
|
|
|
var delete_product_window = class extends confirm_action {
|
|
|
@@ -1128,7 +1206,7 @@
|
|
|
};
|
|
|
|
|
|
// application/scripts/reservation.js
|
|
|
- var reservation = class _reservation {
|
|
|
+ var reservation = class {
|
|
|
email;
|
|
|
phone_number;
|
|
|
product_barcode;
|
|
|
@@ -1162,12 +1240,14 @@
|
|
|
return dumped;
|
|
|
}
|
|
|
get ready() {
|
|
|
- if (this.product_barcode === null) return false;
|
|
|
- if (this.email === null && this.phone_number === null) return false;
|
|
|
+ if (this.product_barcode === null)
|
|
|
+ return false;
|
|
|
+ if (this.email === null && this.phone_number === null)
|
|
|
+ return false;
|
|
|
return true;
|
|
|
}
|
|
|
copy() {
|
|
|
- return new _reservation(this.dump);
|
|
|
+ return new reservation(this.dump);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -1565,6 +1645,9 @@
|
|
|
return container;
|
|
|
}
|
|
|
get #cache_bypass() {
|
|
|
+ if (!this.#login) {
|
|
|
+ return "?cache=1";
|
|
|
+ }
|
|
|
return "?cache=" + new String(Math.floor(Math.random() * 100));
|
|
|
}
|
|
|
get #image() {
|