diff --git a/js/dist/admin.js b/js/dist/admin.js index 06bb6d3..109ed68 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,3 +1,3 @@ /*! For license information please see admin.js.LICENSE.txt */ -(()=>{var t={535:t=>{"use strict";var s=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(s).map((function(t){return s[t]})).join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach((function(t){a[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var e,n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l{"use strict";var a=o(535),i="function"==typeof Symbol&&Symbol.for;i&&Symbol.for("react.element"),i&&Symbol.for("react.portal"),i&&Symbol.for("react.fragment"),i&&Symbol.for("react.strict_mode"),i&&Symbol.for("react.profiler"),i&&Symbol.for("react.provider"),i&&Symbol.for("react.context"),i&&Symbol.for("react.forward_ref"),i&&Symbol.for("react.suspense"),i&&Symbol.for("react.memo"),i&&Symbol.for("react.lazy"),"function"==typeof Symbol&&Symbol.iterator;function e(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o{"use strict";o(488)}},s={};function o(a){var i=s[a];if(void 0!==i)return i.exports;var e=s[a]={exports:{}};return t[a](e,e.exports,o),e.exports}o.n=t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return o.d(s,{a:s}),s},o.d=(t,s)=>{for(var a in s)o.o(s,a)&&!o.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})},o.o=(t,s)=>Object.prototype.hasOwnProperty.call(t,s),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};(()=>{"use strict";o.r(a);const t=flarum.core.compat["admin/app"];var s=o.n(t);function i(t,s){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},i(t,s)}function e(t,s){t.prototype=Object.create(s.prototype),t.prototype.constructor=t,i(t,s)}const n=flarum.core.compat["admin/components/ExtensionPage"];var r=o.n(n);const l=flarum.core.compat["common/components/Button"];var d=o.n(l);const c=flarum.core.compat["common/components/Modal"];var u=o.n(c);o(684);const p=flarum.core.compat["components/Modal"];var h=o.n(p);const g=flarum.core.compat["components/Button"];var y=o.n(g);const f=flarum.core.compat["common/utils/Stream"];var b=o.n(f);const v=flarum.core.compat["common/components/Switch"];var x=o.n(v);const N=flarum.core.compat["common/components/Select"];var k=o.n(N),D=function(t){function o(){for(var s,o=arguments.length,a=new Array(o),i=0;i').appendTo("body").hide().trigger("click").on("change",(function(t){var a=new FormData;a.append("file",t.target.files[0]),s().request({url:s().forum.attribute("apiUrl")+"/store/upload/icon",method:"POST",body:a}).then((function(t){o.params.icon=b()(t.data.attributes.path),o.loading=!1,m.redraw()}))}))},a.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,s().request({method:this.method,url:s().forum.attribute("apiUrl")+"/store/goods",body:this.params}).then((function(){return location.reload()}),(function(t){o.loading=!1,o.handleErrors(t)}))},o}(h()),w=function(t){function o(){for(var s,o=arguments.length,a=new Array(o),i=0;i{var t={535:t=>{"use strict";var s=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(s).map((function(t){return s[t]})).join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach((function(t){a[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var e,n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l{"use strict";var a=o(535),i="function"==typeof Symbol&&Symbol.for;i&&Symbol.for("react.element"),i&&Symbol.for("react.portal"),i&&Symbol.for("react.fragment"),i&&Symbol.for("react.strict_mode"),i&&Symbol.for("react.profiler"),i&&Symbol.for("react.provider"),i&&Symbol.for("react.context"),i&&Symbol.for("react.forward_ref"),i&&Symbol.for("react.suspense"),i&&Symbol.for("react.memo"),i&&Symbol.for("react.lazy"),"function"==typeof Symbol&&Symbol.iterator;function e(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o{"use strict";o(488)}},s={};function o(a){var i=s[a];if(void 0!==i)return i.exports;var e=s[a]={exports:{}};return t[a](e,e.exports,o),e.exports}o.n=t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return o.d(s,{a:s}),s},o.d=(t,s)=>{for(var a in s)o.o(s,a)&&!o.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})},o.o=(t,s)=>Object.prototype.hasOwnProperty.call(t,s),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};(()=>{"use strict";o.r(a);const t=flarum.core.compat["admin/app"];var s=o.n(t);function i(t,s){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},i(t,s)}function e(t,s){t.prototype=Object.create(s.prototype),t.prototype.constructor=t,i(t,s)}const n=flarum.core.compat["admin/components/ExtensionPage"];var r=o.n(n);const l=flarum.core.compat["common/components/Button"];var d=o.n(l);const c=flarum.core.compat["common/components/Modal"];var u=o.n(c);o(684);const p=flarum.core.compat["components/Modal"];var h=o.n(p);const g=flarum.core.compat["components/Button"];var y=o.n(g);const f=flarum.core.compat["common/utils/Stream"];var b=o.n(f);const v=flarum.core.compat["common/components/Switch"];var x=o.n(v);const N=flarum.core.compat["common/components/Select"];var k=o.n(N),D=function(t){function o(){for(var s,o=arguments.length,a=new Array(o),i=0;i').appendTo("body").hide().trigger("click").on("change",(function(t){var a=new FormData;a.append("file",t.target.files[0]),s().request({url:s().forum.attribute("apiUrl")+"/store/upload/icon",method:"POST",body:a}).then((function(t){o.params.icon=b()(t.data.attributes.path),o.loading=!1,m.redraw()}))}))},a.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,s().request({method:this.method,url:s().forum.attribute("apiUrl")+"/store/goods",body:this.params}).then((function(){return location.reload()}),(function(t){o.loading=!1,o.handleErrors(t)}))},o}(h()),w=function(t){function o(){for(var s,o=arguments.length,a=new Array(o),i=0;iQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","import app from 'flarum/admin/app';\nimport Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from \"flarum/common/utils/Stream\";\nimport Switch from \"flarum/common/components/Switch\";\nimport Select from \"flarum/common/components/Select\";\n\nexport default class StoreGoodsDetailModal extends Modal {\n\n private moreResults: boolean = false\n private iconList: Array = [];\n private method: string = 'POST';\n private params: object = {\n status: Stream(1),\n code: Stream(),\n title: Stream(),\n desc: Stream(),\n price: Stream(0),\n stock: Stream(0),\n discount: Stream(0),\n discountLimit: Stream(0),\n discountLimitUnit: Stream('days'),\n type: Stream('permanent'),\n outtime: Stream(0),\n icon: Stream(),\n hide: Stream(0),\n repeat: Stream(1),\n autoDeduction: Stream(0),\n };\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.method = 'POST';\n this.moreResults = false;\n this.params.code = Stream(this.attrs.code || '');\n this.params.title = Stream(this.attrs.title || '');\n\n if (this.attrs.storeData) {\n this.method = 'PUT'\n this.params.id = Stream(this.attrs.storeData.id);\n this.params.status = Stream(this.attrs.storeData.status);\n this.params.code = Stream(this.attrs.storeData.code);\n this.params.title = Stream(this.attrs.storeData.title);\n this.params.desc = Stream(this.attrs.storeData.desc);\n this.params.price = Stream(this.attrs.storeData.price);\n this.params.stock = Stream(this.attrs.storeData.stock == -99 ? 0 : this.attrs.storeData.stock);\n this.params.discount = Stream(this.attrs.storeData.discount);\n this.params.discountLimit = Stream(this.attrs.storeData.discountLimit);\n this.params.discountLimitUnit = Stream(this.attrs.storeData.discountLimitUnit);\n this.params.type = Stream(this.attrs.storeData.type);\n this.params.outtime = Stream(this.attrs.storeData.outtime);\n this.params.icon = Stream(this.attrs.storeData.icon);\n this.params.hide = Stream(this.attrs.storeData.hide);\n this.params.repeat = Stream(this.attrs.storeData.repeat);\n this.params.autoDeduction = Stream(this.attrs.storeData.autoDeduction);\n }\n }\n\n className() {\n return '';\n }\n\n title() {\n return this.params.title();\n }\n\n onModalReady() {\n const _this = this;\n const closeButton = $(\".Modal-close .Button\");\n $(closeButton).prop('id', 'storeCloseButton');\n\n const closeButtonClone = closeButton.clone();\n $(closeButtonClone).prop('id', 'storeCloseIconButton');\n $(closeButtonClone).css('display', 'none');\n $(\".Modal-close\").append(closeButtonClone);\n\n $(closeButtonClone).on(\"click\", function(){\n _this.closeIcon();\n });\n }\n\n content() {\n return (\n
\n
\n
\n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-status\")}\n \n {\n this.params.status = Stream(Number(val))\n }}\n > \n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-code\")}\n {this.params.code()} \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-title\")}\n
\n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-desc\")}\n
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-price\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-stock\")}
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount-limit\")}\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount-limit-unit\")}\n {Select.component({\n options: {\n 'days': app.translator.trans(\"mattoid-store.lib.item-limit-unit-days\"),\n 'hour': app.translator.trans(\"mattoid-store.lib.item-limit-unit-hour\"),\n 'minute': app.translator.trans(\"mattoid-store.lib.item-limit-unit-minute\"),\n 'second': app.translator.trans(\"mattoid-store.lib.item-limit-unit-second\")\n },\n value: this.params.discountLimitUnit(),\n onchange: (val) => {\n this.params.discountLimitUnit = Stream(val)\n },\n })}\n \n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-type\")}
\n {Select.component({\n options: {\n 'permanent': app.translator.trans(\"mattoid-store.lib.item-type-permanent\"),\n 'limit': app.translator.trans(\"mattoid-store.lib.item-type-limit\")\n },\n value: this.params.type(),\n onchange: (val) => {\n this.params.type = Stream(val)\n },\n })}\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-outtime\")}
\n \n {app.translator.trans(\"mattoid-store.admin.settings.days\")}\n \n\n \n\n
\n
\n {\n this.params.autoDeduction = Stream(Number(val))\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.goods-auto-deduction\"\n )}\n \n
\n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-icon\")}\n
\n
\n
\n \n
\n
\n {\n this.uploadIcon(e)\n }}>\n {app.translator.trans('mattoid-store.admin.settings.goods-upload-button')}\n \n
\n
\n {\n this.showIcon(e);\n }}>\n {app.translator.trans('mattoid-store.admin.settings.show-icon-button')}\n \n
\n
\n \n\n
\n \n
\n\n
\n
\n {\n this.params.repeat = Stream(Number(val))\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.goods-repeat\"\n )}\n \n
\n
\n {\n this.params.hide = Stream(Number(val))\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.goods-hide\"\n )}\n \n
\n
\n \n\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n type: 'submit',\n loading: this.loading,\n },\n this.params.id ? app.translator.trans('mattoid-store.admin.settings.edit-store-goods') : app.translator.trans('mattoid-store.admin.settings.add-store-goods')\n )}\n
\n \n\n
\n
\n {\n this.iconList.map((item) => {\n return (\n
this.selectIconItem(item.attributes.url)}>\n \n
\n )\n })\n }\n
\n {!this.loading && this.iconList.length===0 && (\n
\n
{app.translator.trans(\"mattoid-store.lib.list-empty\")}
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n {this.loading &&
{this.loading}
}\n
\n \n \n );\n }\n\n loadIconList(offset = 0) {\n this.loading = true;\n\n return app.store\n .find(\"/store/icon/list\", {\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.iconList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadMore() {\n this.loading = true;\n this.loadIconList(this.iconList.length);\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n\n closeIcon() {\n $(\"#StoreGoods\").css(\"display\",\"block\");\n $(\"#storeCloseButton\").css(\"display\",\"block\");\n $(\"#StoreIcon\").css(\"display\",\"none\");\n $(\"#storeCloseIconButton\").css(\"display\",\"none\");\n }\n\n selectIconItem(url){\n $(\"#StoreGoods\").css(\"display\",\"block\");\n $(\"#storeCloseButton\").css(\"display\",\"block\");\n $(\"#StoreIcon\").css(\"display\",\"none\");\n $(\"#storeCloseIconButton\").css(\"display\",\"none\");\n this.params.icon(url);\n }\n\n showIcon(event) {\n $(\"#StoreGoods\").css(\"display\",\"none\");\n $(\"#storeCloseButton\").css(\"display\",\"none\");\n $(\"#StoreIcon\").css(\"display\",\"block\");\n $(\"#storeCloseIconButton\").css(\"display\",\"block\");\n this.params.title = Stream(app.translator.trans('mattoid-store.admin.settings.show-icon-button'));\n this.iconList = [];\n this.loadIconList();\n }\n\n uploadIcon(event) {\n event.preventDefault();\n\n const $input = $('');\n\n $input.appendTo('body').hide().trigger('click').on('change', event => {\n const body = new FormData();\n body.append('file', event.target.files[0])\n\n app.request({\n url: `${app.forum.attribute('apiUrl')}/store/upload/icon`,\n method: 'POST',\n body,\n }).then((result) => {\n this.params.icon = Stream(result.data.attributes.path)\n this.loading = false;\n m.redraw();\n });\n })\n\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app.request({\n method: this.method,\n url: app.forum.attribute('apiUrl') + '/store/goods',\n body: this.params\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport React from \"react\";\nimport StoreGoodsDetailModal from \"./StoreGoodsDetailModal\";\n\nexport default class AddStoreGoods extends Modal {\n private goodsList: any = []\n private moreResults: boolean = false\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadResults()\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.add-store-goods');\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n return (\n
\n {this.goodsList.map((item: object, index: number) => (\n
\n
\n
\n
\n {item.attributes.name}\n {\n app.modal.show(StoreGoodsDetailModal, {\n code: item.attributes.code,\n title: item.attributes.name\n });\n }}\n >\n {app.translator.trans('mattoid-store.admin.settings.add-store-goods')}\n \n
\n
\n
\n
\n ))}\n\n {!this.loading && this.goodsList.length === 0 && (\n
\n {app.translator.trans(\"mattoid-store.lib.list-empty\")}
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n \n )\n }\n\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.goodsList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.goodsList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n };\n\n return app.store\n .find(\"/store/goods\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","import app from 'flarum/admin/app';\nimport Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\n\nexport default class StoreModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n this.type = this.attrs.title;\n this.storeData = this.attrs.storeData;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.goods-item-' + this.type);\n }\n\n content() {\n //\n return (\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('mattoid-store.lib.confirm')\n )} \n {Button.component(\n {\n className: 'Button storeButton--gray',\n loading: this.loading,\n onclick: () => {\n this.hide();\n }\n },\n app.translator.trans('mattoid-store.lib.cancel')\n )}\n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n const status = this.storeData.status;\n this.storeData.status = Number(!this.storeData.status)\n\n const method = this.type === 'delete' ? 'DELETE' : 'PUT';\n app.request({\n method: method,\n url: app.forum.attribute('apiUrl') + '/store/goods',\n body: this.storeData\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n this.storeData.status = status;\n this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport Component from \"flarum/Component\";\nimport Button from 'flarum/components/Button';\nimport StoreModal from \"./StoreModal\";\nimport StoreGoodsDetailModal from \"./StoreGoodsDetailModal\";\n\nexport default class StoreListItem extends Component {\n private storeData: object = {}\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.item.attributes\n }\n\n view() {\n const moneyName = app.forum.attribute('antoinefr-money.moneyname') || '[money]';\n const price = moneyName.replace('[money]', this.storeData.price);\n const data = this.storeData;\n\n const LimitUnit = {'days': '天', 'hour': '小时', 'minute': '分钟', 'second': '秒'};\n\n return (\n
\n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n {app.translator.trans('mattoid-store.lib.item-id')}: {this.storeData.id} |  \n {app.translator.trans('mattoid-store.lib.item-title')}: {this.storeData.title}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-desc')}: {this.storeData.desc}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-status')}: { app.translator.trans('mattoid-store.lib.item-status-' + this.storeData.status) } | \n {app.translator.trans('mattoid-store.lib.item-price')}: {price} | \n {app.translator.trans('mattoid-store.lib.item-stock')}: { this.storeData.stock == -99 ? '无限' : this.storeData.stock } | \n {app.translator.trans('mattoid-store.lib.item-discount')}: {this.storeData.discount ? this.storeData.discount + ' %' : '无'} | \n {app.translator.trans('mattoid-store.lib.item-discount_limit')}: {this.storeData.discountLimit || 0} { LimitUnit[this.storeData.discountLimitUnit] }\n
\n
\n {app.translator.trans('mattoid-store.lib.item-type')}: {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} | \n {app.translator.trans('mattoid-store.lib.item-created-at')}: {this.storeData.createdAt}\n
\n
\n
\n \n
\n
\n )\n }\n\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Button from 'flarum/common/components/Button';\nimport Mithril from 'mithril';\nimport AddStoreGoods from \"./AddStoreGoods\";\nimport Select from \"flarum/common/components/Select\";\nimport Stream from 'flarum/common/utils/Stream';\nimport StoreListItem from \"./StoreListItem\";\n\nexport default class StoreListPage extends ExtensionPage {\n\n private storeList: any = []\n private moreResults: boolean = false\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.status = Stream('-1');\n this.type = Stream('-1');\n\n this.loadResults();\n }\n\n content() {\n return (\n
\n
\n
\n
\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeName',\n label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n placeholder: app.translator.trans('mattoid-store.admin.settings.store-name'),\n help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n })}\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeTimezone',\n label: app.translator.trans('mattoid-store.admin.settings.store-timezone'),\n placeholder: 'Asia/Shanghai',\n help: app.translator.trans('mattoid-store.admin.settings.store-timezone-requirement'),\n })}\n {this.submitButton()}\n
\n
\n {this.buildSettingComponent(function () {\n return m('.Form-group', Button.component({\n className: 'Button',\n onclick() {\n app.modal.show(AddStoreGoods);\n },\n }, app.translator.trans('mattoid-store.admin.settings.add-store-goods')));\n })}\n
\n
\n
\n
\n {\n this.status(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n {\n this.type(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n
    \n {\n this.storeList.map((item) => {\n return (\n
  • \n {StoreListItem.component({ item })}\n
  • \n );\n })\n }\n
\n\n {!this.loading && this.storeList.length === 0 && (\n
\n
\n {app.translator.trans('mattoid-store.lib.list-empty')}\n
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n
\n
\n
\n )\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.storeList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.storeList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n type: this.type(),\n status: this.status()\n };\n\n return app.store\n .find(\"/store/list\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n}\n","import app from 'flarum/admin/app';\nimport StoreListPage from './components/StoreListPage';\nimport StorePage from \"./components/StorePage\";\n\napp.initializers.add('mattoid-store', () => {\n app.extensionData.for(\"mattoid-store\")\n // .registerSetting({\n // setting: 'mattoid-store.storeName',\n // help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n // type: 'string',\n // })\n // .registerSetting({\n // setting: 'mattoid-store.decorationStoreTimezone',\n // help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'),\n // type: 'string',\n // })\n .registerPage(StoreListPage)\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-view',\n allowGuest: true\n }, 'view')\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-moderate',\n allowGuest: true\n }, 'moderate')\n});\n"],"names":["getOwnPropertySymbols","Object","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","module","exports","assign","test1","String","getOwnPropertyNames","test2","i","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","val","TypeError","toObject","s","arguments","length","key","call","l","require","Symbol","iterator","C","a","b","c","encodeURIComponent","D","isMounted","enqueueForceUpdate","enqueueReplaceState","enqueueSetState","E","F","this","props","context","refs","updater","G","H","isReactComponent","setState","Error","forceUpdate","I","constructor","isPureReactComponent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","__esModule","d","definition","o","defineProperty","enumerable","get","obj","prop","r","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","StoreGoodsDetailModal","_Modal","_this2","_len","args","Array","_key","apply","concat","moreResults","iconList","method","params","status","Stream","code","title","desc","price","stock","discount","discountLimit","discountLimitUnit","type","outtime","icon","hide","repeat","autoDeduction","_proto","oninit","vnode","attrs","storeData","id","className","onModalReady","_this","closeButton","$","closeButtonClone","clone","css","append","on","closeIcon","content","_this3","m","oncreate","style","class","app","trans","Switch","state","onchange","Number","required","bidi","step","min","Select","options","Button","onclick","e","uploadIcon","showIcon","src","loading","item","selectIconItem","attributes","url","hasMoreResults","disabled","loadMore","loadIconList","offset","find","page","then","parseResults","results","payload","links","next","push","data","redraw","event","_this4","preventDefault","appendTo","trigger","body","FormData","files","attribute","result","path","onsubmit","_this5","location","reload","handleErrors","Modal","AddStoreGoods","goodsList","loadResults","index","name","show","filter","StoreModal","StoreListItem","_Component","view","replace","createdAt","Component","StoreListPage","_ExtensionPage","storeList","buildSettingComponent","setting","label","placeholder","help","submitButton","buttonClassName","component","filters","ExtensionPage","add","registerPage","registerPermission","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":";kCAQA,IAAIA,EAAwBC,OAAOD,sBAC/BE,EAAiBD,OAAOE,UAAUD,eAClCE,EAAmBH,OAAOE,UAAUE,qBAsDxCC,EAAOC,QA5CP,WACC,IACC,IAAKN,OAAOO,OACX,OAAO,EAMR,IAAIC,EAAQ,IAAIC,OAAO,OAEvB,GADAD,EAAM,GAAK,KACkC,MAAzCR,OAAOU,oBAAoBF,GAAO,GACrC,OAAO,EAKR,IADA,IAAIG,EAAQ,CAAC,EACJC,EAAI,EAAGA,EAAI,GAAIA,IACvBD,EAAM,IAAMF,OAAOI,aAAaD,IAAMA,EAKvC,GAAwB,eAHXZ,OAAOU,oBAAoBC,GAAOG,KAAI,SAAUC,GAC5D,OAAOJ,EAAMI,EACd,IACWC,KAAK,IACf,OAAO,EAIR,IAAIC,EAAQ,CAAC,EAIb,MAHA,uBAAuBC,MAAM,IAAIC,SAAQ,SAAUC,GAClDH,EAAMG,GAAUA,CACjB,IAEE,yBADEpB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CAK1BlG,KAAKmH,SAAWnH,KAAKwH,kBACrB3B,EAAA,OAAKE,MAAM,kCACTF,EAACgB,IAAM,CAAC7B,UAAW,yBAA0ByC,SAAUzH,KAAKmH,QAASA,QAASnH,KAAKmH,QAASL,QAAS,kBAAM/D,EAAK2E,UAAU,GACvHzB,IAAAA,WAAeC,MAAM,wCAStC,EAACxB,EAED8C,eAAA,WACE,OAAOxH,KAAKsD,WACd,EAACoB,EAEDgD,SAAA,WACE1H,KAAKmH,SAAU,EACfnH,KAAK2J,YAAY3J,KAAKyK,UAAU5L,OAClC,EAAC6F,EAEDsD,aAAA,SAAaC,GAMX,OALAjI,KAAKsD,cAAgB2E,EAAQC,QAAQC,SAAWF,EAAQC,QAAQC,MAAMC,KACtE,GAAGC,KAAKjF,MAAMpD,KAAKyK,UAAWxC,EAAQC,QAAQI,MAC9CtI,KAAKmH,SAAU,EACftB,EAAE0C,SAEKN,CACT,EAACvD,EAEDiF,YAAA,SAAY/B,QAAM,IAANA,IAAAA,EAAS,GACnB,IAAMsD,EAAU,CACd9G,KAAMpE,KAAKoE,OACXV,OAAQ1D,KAAK0D,UAGf,OAAOuC,IAAAA,MACJ4B,KAAK,cAAe,CACnBkC,OAAOmB,EACPpD,KAAM,CACJF,OAAAA,KAEF,OACK,WAAO,IACbG,KAAK/H,KAAKgI,aAAazF,KAAKvC,MACjC,EAACuK,CAAA,CAtJ+B,CAASY,KCL3ClF,IAAAA,aAAiBmF,IAAI,iBAAiB,WACpCnF,IAAAA,cAAiB,IAAK,iBAanBoF,aAAad,GACbe,mBACC,CACEhH,KAAM,iBACNsG,MAAO3E,IAAAA,WAAeC,MAAM,2CAC5BqF,WAAY,2BACZC,YAAY,GACX,QACJF,mBACC,CACEhH,KAAM,iBACNsG,MAAO3E,IAAAA,WAAeC,MAAM,2CAC5BqF,WAAY,+BACZC,YAAY,GACX,WACT","sources":["webpack://@mattoid/store/./node_modules/object-assign/index.js","webpack://@mattoid/store/./node_modules/react/cjs/react.production.min.js","webpack://@mattoid/store/./node_modules/react/index.js","webpack://@mattoid/store/webpack/bootstrap","webpack://@mattoid/store/webpack/runtime/compat get default export","webpack://@mattoid/store/webpack/runtime/define property getters","webpack://@mattoid/store/webpack/runtime/hasOwnProperty shorthand","webpack://@mattoid/store/webpack/runtime/make namespace object","webpack://@mattoid/store/external root \"flarum.core.compat['admin/app']\"","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@mattoid/store/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Button']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@mattoid/store/external root \"flarum.core.compat['components/Modal']\"","webpack://@mattoid/store/external root \"flarum.core.compat['components/Button']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Select']\"","webpack://@mattoid/store/./src/admin/components/StoreGoodsDetailModal.tsx","webpack://@mattoid/store/./src/admin/components/AddStoreGoods.tsx","webpack://@mattoid/store/external root \"flarum.core.compat['Component']\"","webpack://@mattoid/store/./src/admin/components/StoreModal.tsx","webpack://@mattoid/store/./src/admin/components/StoreListItem.tsx","webpack://@mattoid/store/./src/admin/components/StoreListPage.tsx","webpack://@mattoid/store/./src/admin/index.tsx"],"sourcesContent":["/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/** @license React v16.14.0\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var l=require(\"object-assign\"),n=\"function\"===typeof Symbol&&Symbol.for,p=n?Symbol.for(\"react.element\"):60103,q=n?Symbol.for(\"react.portal\"):60106,r=n?Symbol.for(\"react.fragment\"):60107,t=n?Symbol.for(\"react.strict_mode\"):60108,u=n?Symbol.for(\"react.profiler\"):60114,v=n?Symbol.for(\"react.provider\"):60109,w=n?Symbol.for(\"react.context\"):60110,x=n?Symbol.for(\"react.forward_ref\"):60112,y=n?Symbol.for(\"react.suspense\"):60113,z=n?Symbol.for(\"react.memo\"):60115,A=n?Symbol.for(\"react.lazy\"):\n60116,B=\"function\"===typeof Symbol&&Symbol.iterator;function C(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","import app from 'flarum/admin/app';\nimport Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from \"flarum/common/utils/Stream\";\nimport Switch from \"flarum/common/components/Switch\";\nimport Select from \"flarum/common/components/Select\";\n\nexport default class StoreGoodsDetailModal extends Modal {\n\n private moreResults: boolean = false\n private iconList: Array = [];\n private method: string = 'POST';\n private params: object = {\n status: Stream(1),\n code: Stream(),\n title: Stream(),\n desc: Stream(),\n price: Stream(0),\n stock: Stream(0),\n discount: Stream(0),\n discountLimit: Stream(0),\n discountLimitUnit: Stream('days'),\n type: Stream('permanent'),\n outtime: Stream(0),\n icon: Stream(),\n hide: Stream(0),\n repeat: Stream(1),\n autoDeduction: Stream(0),\n };\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.method = 'POST';\n this.moreResults = false;\n this.params.code = Stream(this.attrs.code || '');\n this.params.title = Stream(this.attrs.title || '');\n\n if (this.attrs.storeData) {\n this.method = 'PUT'\n this.params.id = Stream(this.attrs.storeData.id);\n this.params.status = Stream(this.attrs.storeData.status);\n this.params.code = Stream(this.attrs.storeData.code);\n this.params.title = Stream(this.attrs.storeData.title);\n this.params.desc = Stream(this.attrs.storeData.desc);\n this.params.price = Stream(this.attrs.storeData.price);\n this.params.stock = Stream(this.attrs.storeData.stock == -99 ? 0 : this.attrs.storeData.stock);\n this.params.discount = Stream(this.attrs.storeData.discount);\n this.params.discountLimit = Stream(this.attrs.storeData.discountLimit);\n this.params.discountLimitUnit = Stream(this.attrs.storeData.discountLimitUnit);\n this.params.type = Stream(this.attrs.storeData.type);\n this.params.outtime = Stream(this.attrs.storeData.outtime);\n this.params.icon = Stream(this.attrs.storeData.icon);\n this.params.hide = Stream(this.attrs.storeData.hide);\n this.params.repeat = Stream(this.attrs.storeData.repeat);\n this.params.autoDeduction = Stream(this.attrs.storeData.autoDeduction);\n }\n }\n\n className() {\n return '';\n }\n\n title() {\n return this.params.title();\n }\n\n onModalReady() {\n const _this = this;\n const closeButton = $(\".Modal-close .Button\");\n $(closeButton).prop('id', 'storeCloseButton');\n\n const closeButtonClone = closeButton.clone();\n $(closeButtonClone).prop('id', 'storeCloseIconButton');\n $(closeButtonClone).css('display', 'none');\n $(\".Modal-close\").append(closeButtonClone);\n\n $(closeButtonClone).on(\"click\", function(){\n _this.closeIcon();\n });\n }\n\n content() {\n return (\n
\n
\n
\n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-status\")}\n \n {\n this.params.status = Stream(Number(val))\n }}\n > \n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-code\")}\n {this.params.code()} \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-title\")}\n
\n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-desc\")}\n
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-price\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-stock\")}
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount-limit\")}\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.goods-discount-limit-unit\")}\n {Select.component({\n options: {\n 'days': app.translator.trans(\"mattoid-store.lib.item-limit-unit-days\"),\n 'hour': app.translator.trans(\"mattoid-store.lib.item-limit-unit-hour\"),\n 'minute': app.translator.trans(\"mattoid-store.lib.item-limit-unit-minute\"),\n 'second': app.translator.trans(\"mattoid-store.lib.item-limit-unit-second\")\n },\n value: this.params.discountLimitUnit(),\n onchange: (val) => {\n this.params.discountLimitUnit = Stream(val)\n },\n })}\n \n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-type\")}
\n {Select.component({\n options: {\n 'permanent': app.translator.trans(\"mattoid-store.lib.item-type-permanent\"),\n 'limit': app.translator.trans(\"mattoid-store.lib.item-type-limit\")\n },\n value: this.params.type(),\n onchange: (val) => {\n this.params.type = Stream(val)\n },\n })}\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-outtime\")}
\n \n {app.translator.trans(\"mattoid-store.admin.settings.days\")}\n \n\n \n\n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-auto-deduction\")}\n \n {\n this.params.autoDeduction = Stream(Number(val))\n }}\n >\n \n \n
\n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.goods-icon\")}\n
\n
\n
\n \n
\n
\n {\n this.uploadIcon(e)\n }}>\n {app.translator.trans('mattoid-store.admin.settings.goods-upload-button')}\n \n
\n
\n {\n this.showIcon(e);\n }}>\n {app.translator.trans('mattoid-store.admin.settings.show-icon-button')}\n \n
\n
\n \n\n
\n \n
\n\n
\n
\n {\n this.params.repeat = Stream(Number(val))\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.goods-repeat\"\n )}\n \n
\n
\n {\n this.params.hide = Stream(Number(val))\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.goods-hide\"\n )}\n \n
\n
\n \n\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n type: 'submit',\n loading: this.loading,\n },\n this.params.id ? app.translator.trans('mattoid-store.admin.settings.edit-store-goods') : app.translator.trans('mattoid-store.admin.settings.add-store-goods')\n )}\n
\n \n\n
\n
\n {\n this.iconList.map((item) => {\n return (\n
this.selectIconItem(item.attributes.url)}>\n \n
\n )\n })\n }\n
\n {!this.loading && this.iconList.length===0 && (\n
\n
{app.translator.trans(\"mattoid-store.lib.list-empty\")}
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n {this.loading &&
{this.loading}
}\n
\n \n \n );\n }\n\n loadIconList(offset = 0) {\n this.loading = true;\n\n return app.store\n .find(\"/store/icon/list\", {\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.iconList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadMore() {\n this.loading = true;\n this.loadIconList(this.iconList.length);\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n\n closeIcon() {\n $(\"#StoreGoods\").css(\"display\",\"block\");\n $(\"#storeCloseButton\").css(\"display\",\"block\");\n $(\"#StoreIcon\").css(\"display\",\"none\");\n $(\"#storeCloseIconButton\").css(\"display\",\"none\");\n }\n\n selectIconItem(url){\n $(\"#StoreGoods\").css(\"display\",\"block\");\n $(\"#storeCloseButton\").css(\"display\",\"block\");\n $(\"#StoreIcon\").css(\"display\",\"none\");\n $(\"#storeCloseIconButton\").css(\"display\",\"none\");\n this.params.icon(url);\n }\n\n showIcon(event) {\n $(\"#StoreGoods\").css(\"display\",\"none\");\n $(\"#storeCloseButton\").css(\"display\",\"none\");\n $(\"#StoreIcon\").css(\"display\",\"block\");\n $(\"#storeCloseIconButton\").css(\"display\",\"block\");\n this.params.title = Stream(app.translator.trans('mattoid-store.admin.settings.show-icon-button'));\n this.iconList = [];\n this.loadIconList();\n }\n\n uploadIcon(event) {\n event.preventDefault();\n\n const $input = $('');\n\n $input.appendTo('body').hide().trigger('click').on('change', event => {\n const body = new FormData();\n body.append('file', event.target.files[0])\n\n app.request({\n url: `${app.forum.attribute('apiUrl')}/store/upload/icon`,\n method: 'POST',\n body,\n }).then((result) => {\n this.params.icon = Stream(result.data.attributes.path)\n this.loading = false;\n m.redraw();\n });\n })\n\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app.request({\n method: this.method,\n url: app.forum.attribute('apiUrl') + '/store/goods',\n body: this.params\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport React from \"react\";\nimport StoreGoodsDetailModal from \"./StoreGoodsDetailModal\";\n\nexport default class AddStoreGoods extends Modal {\n private goodsList: any = []\n private moreResults: boolean = false\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadResults()\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.add-store-goods');\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n return (\n
\n {this.goodsList.map((item: object, index: number) => (\n
\n
\n
\n
\n {item.attributes.name}\n {\n app.modal.show(StoreGoodsDetailModal, {\n code: item.attributes.code,\n title: item.attributes.name\n });\n }}\n >\n {app.translator.trans('mattoid-store.admin.settings.add-store-goods')}\n \n
\n
\n
\n
\n ))}\n\n {!this.loading && this.goodsList.length === 0 && (\n
\n {app.translator.trans(\"mattoid-store.lib.list-empty\")}
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n \n )\n }\n\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.goodsList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.goodsList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n };\n\n return app.store\n .find(\"/store/goods\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","import app from 'flarum/admin/app';\nimport Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\n\nexport default class StoreModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n this.type = this.attrs.title;\n this.storeData = this.attrs.storeData;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.goods-item-' + this.type);\n }\n\n content() {\n //\n return (\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('mattoid-store.lib.confirm')\n )} \n {Button.component(\n {\n className: 'Button storeButton--gray',\n loading: this.loading,\n onclick: () => {\n this.hide();\n }\n },\n app.translator.trans('mattoid-store.lib.cancel')\n )}\n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n const status = this.storeData.status;\n this.storeData.status = Number(!this.storeData.status)\n\n const method = this.type === 'delete' ? 'DELETE' : 'PUT';\n app.request({\n method: method,\n url: app.forum.attribute('apiUrl') + '/store/goods',\n body: this.storeData\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n this.storeData.status = status;\n this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport Component from \"flarum/Component\";\nimport Button from 'flarum/components/Button';\nimport StoreModal from \"./StoreModal\";\nimport StoreGoodsDetailModal from \"./StoreGoodsDetailModal\";\n\nexport default class StoreListItem extends Component {\n private storeData: object = {}\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.item.attributes\n }\n\n view() {\n const moneyName = app.forum.attribute('antoinefr-money.moneyname') || '[money]';\n const price = moneyName.replace('[money]', this.storeData.price);\n const data = this.storeData;\n\n const LimitUnit = {'days': '天', 'hour': '小时', 'minute': '分钟', 'second': '秒'};\n\n return (\n
\n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n {app.translator.trans('mattoid-store.lib.item-id')}: {this.storeData.id} |  \n {app.translator.trans('mattoid-store.lib.item-title')}: {this.storeData.title}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-desc')}: {this.storeData.desc}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-status')}: { app.translator.trans('mattoid-store.lib.item-status-' + this.storeData.status) } | \n {app.translator.trans('mattoid-store.lib.item-price')}: {price} | \n {app.translator.trans('mattoid-store.lib.item-stock')}: { this.storeData.stock == -99 ? '无限' : this.storeData.stock } | \n {app.translator.trans('mattoid-store.lib.item-discount')}: {this.storeData.discount ? this.storeData.discount + ' %' : '无'} | \n {app.translator.trans('mattoid-store.lib.item-discount_limit')}: {this.storeData.discountLimit || 0} { LimitUnit[this.storeData.discountLimitUnit] }\n
\n
\n {app.translator.trans('mattoid-store.lib.item-type')}: {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} | \n {app.translator.trans('mattoid-store.lib.item-created-at')}: {this.storeData.createdAt}\n
\n
\n
\n \n
\n
\n )\n }\n\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Button from 'flarum/common/components/Button';\nimport Mithril from 'mithril';\nimport AddStoreGoods from \"./AddStoreGoods\";\nimport Select from \"flarum/common/components/Select\";\nimport Stream from 'flarum/common/utils/Stream';\nimport StoreListItem from \"./StoreListItem\";\n\nexport default class StoreListPage extends ExtensionPage {\n\n private storeList: any = []\n private moreResults: boolean = false\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.status = Stream('-1');\n this.type = Stream('-1');\n\n this.loadResults();\n }\n\n content() {\n return (\n
\n
\n
\n
\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeName',\n label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n placeholder: app.translator.trans('mattoid-store.admin.settings.store-name'),\n help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n })}\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeTimezone',\n label: app.translator.trans('mattoid-store.admin.settings.store-timezone'),\n placeholder: 'Asia/Shanghai',\n help: app.translator.trans('mattoid-store.admin.settings.store-timezone-requirement'),\n })}\n {this.submitButton()}\n
\n
\n {this.buildSettingComponent(function () {\n return m('.Form-group', Button.component({\n className: 'Button',\n onclick() {\n app.modal.show(AddStoreGoods);\n },\n }, app.translator.trans('mattoid-store.admin.settings.add-store-goods')));\n })}\n
\n
\n
\n
\n {\n this.status(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n {\n this.type(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n
    \n {\n this.storeList.map((item) => {\n return (\n
  • \n {StoreListItem.component({ item })}\n
  • \n );\n })\n }\n
\n\n {!this.loading && this.storeList.length === 0 && (\n
\n
\n {app.translator.trans('mattoid-store.lib.list-empty')}\n
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n
\n
\n
\n )\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.storeList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.storeList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n type: this.type(),\n status: this.status()\n };\n\n return app.store\n .find(\"/store/list\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n}\n","import app from 'flarum/admin/app';\nimport StoreListPage from './components/StoreListPage';\nimport StorePage from \"./components/StorePage\";\n\napp.initializers.add('mattoid-store', () => {\n app.extensionData.for(\"mattoid-store\")\n // .registerSetting({\n // setting: 'mattoid-store.storeName',\n // help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n // type: 'string',\n // })\n // .registerSetting({\n // setting: 'mattoid-store.decorationStoreTimezone',\n // help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'),\n // type: 'string',\n // })\n .registerPage(StoreListPage)\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-view',\n allowGuest: true\n }, 'view')\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-moderate',\n allowGuest: true\n }, 'moderate')\n});\n"],"names":["getOwnPropertySymbols","Object","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","module","exports","assign","test1","String","getOwnPropertyNames","test2","i","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","val","TypeError","toObject","s","arguments","length","key","call","l","require","Symbol","iterator","C","a","b","c","encodeURIComponent","D","isMounted","enqueueForceUpdate","enqueueReplaceState","enqueueSetState","E","F","this","props","context","refs","updater","G","H","isReactComponent","setState","Error","forceUpdate","I","constructor","isPureReactComponent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","__esModule","d","definition","o","defineProperty","enumerable","get","obj","prop","r","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","StoreGoodsDetailModal","_Modal","_this2","_len","args","Array","_key","apply","concat","moreResults","iconList","method","params","status","Stream","code","title","desc","price","stock","discount","discountLimit","discountLimitUnit","type","outtime","icon","hide","repeat","autoDeduction","_proto","oninit","vnode","attrs","storeData","id","className","onModalReady","_this","closeButton","$","closeButtonClone","clone","css","append","on","closeIcon","content","_this3","m","oncreate","style","class","app","trans","Switch","state","onchange","Number","required","bidi","step","min","Select","options","Button","onclick","e","uploadIcon","showIcon","src","loading","item","selectIconItem","attributes","url","hasMoreResults","disabled","loadMore","loadIconList","offset","find","page","then","parseResults","results","payload","links","next","push","data","redraw","event","_this4","preventDefault","appendTo","trigger","body","FormData","files","attribute","result","path","onsubmit","_this5","location","reload","handleErrors","Modal","AddStoreGoods","goodsList","loadResults","index","name","show","filter","StoreModal","StoreListItem","_Component","view","replace","createdAt","Component","StoreListPage","_ExtensionPage","storeList","buildSettingComponent","setting","label","placeholder","help","submitButton","buttonClassName","component","filters","ExtensionPage","add","registerPage","registerPermission","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index a6a67f7..2e15022 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:a=>{var e=a&&a.__esModule?()=>a.default:()=>a;return t.d(e,{a:e}),e},d:(a,e)=>{for(var o in e)t.o(e,o)&&!t.o(a,o)&&Object.defineProperty(a,o,{enumerable:!0,get:e[o]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a);const e=flarum.core.compat["forum/app"];var o=t.n(e);const s=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/components/IndexPage"];var n=t.n(r);const i=flarum.core.compat["common/components/LinkButton"];var l=t.n(i);function c(t,a){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},c(t,a)}function p(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,c(t,a)}const u=flarum.core.compat["common/helpers/listItems"];var d=t.n(u);const h=flarum.core.compat["common/components/Button"];var f=t.n(h);const v=flarum.core.compat["common/utils/Stream"];var y=t.n(v);const g=flarum.core.compat.Component;var b=t.n(g);const D=flarum.core.compat["common/components/Modal"];var N=t.n(D);const x=flarum.core.compat["common/components/Switch"];var w=t.n(x);const T=flarum.core.compat["common/components/Select"];var O=t.n(T),k=function(t){function a(){for(var a,e=arguments.length,o=new Array(e),s=0;s0?a.replace("[money]",this.storeData.price):o().translator.trans("mattoid-store.forum.free"),s=a.replace("[money]",this.storeData.discountPrice);return m("div",{id:this.storeData.id,onclick:function(){return t.showDetails(t.storeData)}},m("div",{className:"itemTitle"},this.storeData.title),m("div",{className:"price spacing"},this.storeData.discountPrice>0?m("div",null,m("span",{className:"price"},s)," ",m("span",{className:"discount"},e)):m("span",{className:"price"},e)),m("div",{className:"spacing"},o().translator.trans("mattoid-store.lib.item-stock"),": ",-99==this.storeData.stock?o().translator.trans("mattoid-store.forum.infinite"):this.storeData.stock," | ",o().translator.trans("mattoid-store.lib.item-type-"+this.storeData.type)," ",m("span",{style:"limit"===this.storeData.type?"display:inline-block":"display: none"},"(",this.storeData.outtime,o().translator.trans("mattoid-store.forum.days"),")")),m("div",{className:"spacing",style:"limit"===this.storeData.type&&this.storeData.autoDeduction?"display:inline-block":"display: none"},o().translator.trans("mattoid-store.lib.item-invalid",{day:this.storeData.outtime})),m("div",{className:"spacing"},m("div",{id:"box"},this.storeData.desc)),m("div",{className:"spacing center"},m("img",{className:"icon-size",src:this.storeData.icon})))},e.showDetails=function(t){o().session.user&&o().modal.show(k,{storeData:t})},a}(b()),S=function(t){function a(){for(var a,e=arguments.length,o=new Array(e),s=0;s{var t={n:a=>{var e=a&&a.__esModule?()=>a.default:()=>a;return t.d(e,{a:e}),e},d:(a,e)=>{for(var o in e)t.o(e,o)&&!t.o(a,o)&&Object.defineProperty(a,o,{enumerable:!0,get:e[o]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a);const e=flarum.core.compat["forum/app"];var o=t.n(e);const s=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/components/IndexPage"];var n=t.n(r);const i=flarum.core.compat["common/components/LinkButton"];var l=t.n(i);function c(t,a){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},c(t,a)}function p(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,c(t,a)}const u=flarum.core.compat["common/helpers/listItems"];var d=t.n(u);const h=flarum.core.compat["common/components/Button"];var f=t.n(h);const v=flarum.core.compat["common/utils/Stream"];var y=t.n(v);const g=flarum.core.compat.Component;var b=t.n(g);const D=flarum.core.compat["common/components/Modal"];var N=t.n(D);const x=flarum.core.compat["common/components/Switch"];var w=t.n(x);const T=flarum.core.compat["common/components/Select"];var O=t.n(T),k=function(t){function a(){for(var a,e=arguments.length,o=new Array(e),s=0;s0?a.replace("[money]",this.storeData.price):o().translator.trans("mattoid-store.forum.free"),s=a.replace("[money]",this.storeData.discountPrice);return m("div",{id:this.storeData.id,onclick:function(){return t.showDetails(t.storeData)}},m("div",{className:"itemTitle"},this.storeData.title),m("div",{className:"price spacing"},this.storeData.discountPrice>0?m("div",null,m("span",{className:"price"},s)," ",m("span",{className:"discount"},e)):m("span",{className:"price"},e)),m("div",{className:"spacing"},o().translator.trans("mattoid-store.lib.item-stock"),": ",-99==this.storeData.stock?o().translator.trans("mattoid-store.forum.infinite"):this.storeData.stock," | ",o().translator.trans("mattoid-store.lib.item-type-"+this.storeData.type)," ",m("span",{style:"limit"===this.storeData.type?"display:inline-block":"display: none"},"(",this.storeData.outtime,o().translator.trans("mattoid-store.forum.days"),")"),m("span",{style:"limit"===this.storeData.type&&this.storeData.autoDeduction?"display:inline-block":"display: none"}," | ",o().translator.trans("mattoid-store.lib.item-invalid",{day:this.storeData.outtime}))),m("div",{className:"spacing"},m("div",{id:"box"},this.storeData.desc)),m("div",{className:"spacing center"},m("img",{className:"icon-size",src:this.storeData.icon})))},e.showDetails=function(t){o().session.user&&o().modal.show(k,{storeData:t})},a}(b()),S=function(t){function a(){for(var a,e=arguments.length,o=new Array(e),s=0;s {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","import Modal, {IInternalModalAttrs} from \"flarum/common/components/Modal\";\nimport type Mithril from \"mithril\";\nimport Stream from \"flarum/common/utils/Stream\";\nimport Button from 'flarum/common/components/Button';\nimport Switch from 'flarum/common/components/Switch';\nimport Select from \"flarum/common/components/Select\";\nimport TextEditor from 'flarum/common/components/TextEditor'\n\ninterface IStoreModalAttrs extends IInternalModalAttrs {\n storeData: object\n}\n\nexport default class StoreBox extends Modal {\n private storeData: object = {}\n private params: object = {}\n private range: boolean = false\n\n static initAttrs(attrs: IStoreModalAttrs) {\n super.initAttrs(attrs);\n }\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.storeData;\n this.params.id = this.attrs.storeData.id;\n }\n\n title() {\n return this.storeData.title;\n }\n\n className(): string {\n return this.storeData.className;\n }\n\n content() {\n return m('.Modal-body', [\n this.getHtml(JSON.parse(this.storeData.popUp)),\n m('.Form-group .center', [\n Button.component({\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n // disabled: parseFloat(this.amount || '0') <= 0,\n }, app.translator.trans('mattoid-store.forum.button'))\n ])\n ])\n }\n\n getHtml(popUp) {\n return popUp.map((item) => {\n return this.getInput(item);\n })\n }\n\n getInput(column) {\n let input;\n\n switch (column.prop) {\n case 'input':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n m('input.FormControl', {\n type: column.type || 'text',\n value: this.params[column.value],\n onchange: (event: InputEvent) => {\n this.params[column.value] = (event.target as HTMLInputElement).value;\n },\n min: 0,\n step: 0.1,\n disabled: this.loading,\n })\n ])\n )\n break;\n case 'switch':\n input = (\n m('.Form-group', [\n Switch.component({\n state: this.range,\n onchange: (value: boolean) => {\n this.range = value;\n this.params[column.value] = value\n },\n disabled: this.loading,\n }, app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText))\n ])\n )\n break;\n case 'select':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n Select.component({\n value: this.params[column.value],\n disabled: this.loading,\n options: column.options,\n buttonClassName: \"Button\",\n onchange: (val) => {\n this.params[column.value] = val\n }\n })\n ])\n )\n break;\n case 'textarea':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n m('textarea.FormControl', {\n value: this.params[column.value],\n onchange: (event: InputEvent) => {\n this.params[column.value] = (event.target as HTMLInputElement).value;\n },\n })\n ])\n )\n break\n }\n\n return input;\n }\n\n onsubmit(event: Event) {\n event.preventDefault();\n this.loading = true;\n\n app.request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/store/buy/goods',\n body: this.params\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n // this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/forum/app';\nimport Component from \"flarum/Component\";\nimport StoreBox from \"./StoreBox\";\n\nexport default class StoreItem extends Component {\n private storeData: object = {}\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.item.attributes\n this.storeData.id = this.attrs.item.id\n }\n\n view() {\n const moneyName = app.forum.attribute('antoinefr-money.moneyname') || '[money]';\n const price = this.storeData.price > 0 ? moneyName.replace('[money]', this.storeData.price) : app.translator.trans('mattoid-store.forum.free');\n const discountPrice = moneyName.replace('[money]', this.storeData.discountPrice);\n\n return (\n
this.showDetails(this.storeData)}>\n
\n {this.storeData.title}\n
\n
\n {this.storeData.discountPrice > 0 ?\n (\n
\n {discountPrice} \n {price}\n
\n ) :\n ({price})}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-stock')}: {this.storeData.stock == -99 ? app.translator.trans('mattoid-store.forum.infinite') : this.storeData.stock } | \n {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} \n ({this.storeData.outtime}{app.translator.trans('mattoid-store.forum.days')})\n
\n
\n {app.translator.trans('mattoid-store.lib.item-invalid', {'day' : this.storeData.outtime})}\n
\n
\n
\n {this.storeData.desc}\n
\n
\n
\n \n
\n
\n )\n }\n\n showDetails(storeData) {\n if(app.session.user){\n app.modal.show(StoreBox, {storeData});\n }\n }\n}\n","import IndexPage from \"flarum/forum/components/IndexPage\";\nimport { IPageAttrs } from 'flarum/common/components/Page';\nimport listItems from 'flarum/common/helpers/listItems';\nimport Mithril from 'mithril';\nimport Button from \"flarum/common/components/Button\";\nimport Stream from \"flarum/common/utils/Stream\";\nimport StoreItem from \"./StoreItem\";\nimport StoreListItem from \"../../admin/components/StoreListItem\";\n\nexport interface IIndexPageAttrs extends IPageAttrs {}\n\nexport default class StorePage extends IndexPage {\n\n private storeList: any = []\n private moreResults: boolean = false\n\n oncreate(vnode: Mithril.VnodeDOM) {\n super.oncreate(vnode);\n\n app.setTitle(app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital'));\n app.setTitleCount(0);\n\n this.status = Stream('1');\n this.type = Stream('-1');\n\n this.loadResults();\n }\n\n view() {\n return (\n
\n
\n
\n \n
\n

{app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital')}

\n
\n {\n this.storeList.map((item) => {\n if (!item.attributes.hide || app.session.user.attribute('can'+item.attributes.code.slice(0, 1).toUpperCase()+item.attributes.code.slice(1)+'View')) {\n return (\n
\n {StoreItem.component({ item })}\n
\n );\n }\n })\n }\n
\n\n {!this.loading && this.storeList.length === 0 && (\n
\n
\n {app.translator.trans('mattoid-store.lib.list-empty')}\n
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n
\n
\n
\n
\n )\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.storeList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.storeList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n type: this.type(),\n status: this.status()\n };\n\n return app.store\n .find(\"/store/list\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n}\n","import app from 'flarum/forum/app';\nimport {extend} from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport StorePage from \"./components/StorePage\";\n\napp.initializers.add('mattoid/store', () => {\n app.routes.store = {\n path: '/store',\n component: StorePage,\n };\n\n extend(IndexPage.prototype, 'navItems', function (items) {\n if (!app.session.user.attribute('canStoreView')) {\n return false;\n }\n\n items.add('store', LinkButton.component({\n href: app.route('store'),\n icon: 'fas fa-store',\n }, app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital')));\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","StoreBox","_Modal","_this","_len","arguments","length","args","Array","_key","apply","concat","storeData","params","range","initAttrs","attrs","_proto","oninit","vnode","this","id","title","className","content","m","getHtml","JSON","parse","popUp","Button","type","loading","app","translator","trans","_this2","map","item","getInput","column","input","_this3","label","helpText","onchange","event","target","min","step","disabled","Switch","state","Select","options","buttonClassName","val","onsubmit","_this4","preventDefault","request","method","url","forum","attribute","body","then","location","reload","result","Modal","StoreItem","_Component","attributes","view","moneyName","price","replace","discountPrice","onclick","showDetails","stock","style","outtime","autoDeduction","desc","src","icon","user","show","Component","StorePage","_IndexPage","storeList","moreResults","oncreate","setTitle","setTitleCount","status","Stream","loadResults","listItems","sidebarItems","toArray","class","hide","session","code","slice","toUpperCase","component","hasMoreResults","loadMore","parseResults","results","payload","links","next","push","data","redraw","offset","filters","store","find","filter","page","IndexPage","add","path","extend","items","LinkButton","href"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,8B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC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IAAI0F,MACRC,KAAK,cAAe,CACnBC,OAAOH,EACPI,KAAM,CACJL,OAAAA,KAEF,OACK,WAAO,IACbvD,KAAK9C,KAAK6F,aAAavH,KAAK0B,MACjC,EAACuE,CAAA,CAjG2B,CAAgEoC,KCL9F9F,IAAAA,aAAiB+F,IAAI,iBAAiB,WACpC/F,IAAAA,OAAW0F,MAAQ,CACjBM,KAAM,SACNnB,UAAWnB,IAGbuC,EAAAA,EAAAA,QAAOH,IAAAA,UAAqB,YAAY,SAAUI,GAChD,IAAKlG,IAAAA,QAAYuD,KAAKxB,UAAU,gBAC9B,OAAO,EAGTmE,EAAMH,IAAI,QAASI,IAAAA,UAAqB,CACtCC,KAAMpG,IAAAA,MAAU,SAChBsD,KAAM,gBACLtD,IAAAA,MAAU+B,UAAU,cAAgB/B,IAAAA,WAAeE,MAAM,8BAC9D,GACF,G","sources":["webpack://@mattoid/store/webpack/bootstrap","webpack://@mattoid/store/webpack/runtime/compat get default export","webpack://@mattoid/store/webpack/runtime/define property getters","webpack://@mattoid/store/webpack/runtime/hasOwnProperty shorthand","webpack://@mattoid/store/webpack/runtime/make namespace object","webpack://@mattoid/store/external root \"flarum.core.compat['forum/app']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/extend']\"","webpack://@mattoid/store/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@mattoid/store/external root \"flarum.core.compat['common/helpers/listItems']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Button']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@mattoid/store/external root \"flarum.core.compat['Component']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Select']\"","webpack://@mattoid/store/./src/forum/components/StoreBox.tsx","webpack://@mattoid/store/./src/forum/components/StoreItem.tsx","webpack://@mattoid/store/./src/forum/components/StorePage.tsx","webpack://@mattoid/store/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","import Modal, {IInternalModalAttrs} from \"flarum/common/components/Modal\";\nimport type Mithril from \"mithril\";\nimport Stream from \"flarum/common/utils/Stream\";\nimport Button from 'flarum/common/components/Button';\nimport Switch from 'flarum/common/components/Switch';\nimport Select from \"flarum/common/components/Select\";\nimport TextEditor from 'flarum/common/components/TextEditor'\n\ninterface IStoreModalAttrs extends IInternalModalAttrs {\n storeData: object\n}\n\nexport default class StoreBox extends Modal {\n private storeData: object = {}\n private params: object = {}\n private range: boolean = false\n\n static initAttrs(attrs: IStoreModalAttrs) {\n super.initAttrs(attrs);\n }\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.storeData;\n this.params.id = this.attrs.storeData.id;\n }\n\n title() {\n return this.storeData.title;\n }\n\n className(): string {\n return this.storeData.className;\n }\n\n content() {\n return m('.Modal-body', [\n this.getHtml(JSON.parse(this.storeData.popUp)),\n m('.Form-group .center', [\n Button.component({\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n // disabled: parseFloat(this.amount || '0') <= 0,\n }, app.translator.trans('mattoid-store.forum.button'))\n ])\n ])\n }\n\n getHtml(popUp) {\n return popUp.map((item) => {\n return this.getInput(item);\n })\n }\n\n getInput(column) {\n let input;\n\n switch (column.prop) {\n case 'input':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n m('input.FormControl', {\n type: column.type || 'text',\n value: this.params[column.value],\n onchange: (event: InputEvent) => {\n this.params[column.value] = (event.target as HTMLInputElement).value;\n },\n min: 0,\n step: 0.1,\n disabled: this.loading,\n })\n ])\n )\n break;\n case 'switch':\n input = (\n m('.Form-group', [\n Switch.component({\n state: this.range,\n onchange: (value: boolean) => {\n this.range = value;\n this.params[column.value] = value\n },\n disabled: this.loading,\n }, app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText))\n ])\n )\n break;\n case 'select':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n Select.component({\n value: this.params[column.value],\n disabled: this.loading,\n options: column.options,\n buttonClassName: \"Button\",\n onchange: (val) => {\n this.params[column.value] = val\n }\n })\n ])\n )\n break;\n case 'textarea':\n input = (\n m('.Form-group', [\n m('label', app.translator.trans(column.label)),\n m('.helpText', app.translator.trans(column.helpText)),\n m('textarea.FormControl', {\n value: this.params[column.value],\n onchange: (event: InputEvent) => {\n this.params[column.value] = (event.target as HTMLInputElement).value;\n },\n })\n ])\n )\n break\n }\n\n return input;\n }\n\n onsubmit(event: Event) {\n event.preventDefault();\n this.loading = true;\n\n app.request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/store/buy/goods',\n body: this.params\n }).then(\n () => location.reload(),\n (result) => {\n this.loading = false;\n // this.handleErrors(result);\n });\n }\n}\n","import app from 'flarum/forum/app';\nimport Component from \"flarum/Component\";\nimport StoreBox from \"./StoreBox\";\n\nexport default class StoreItem extends Component {\n private storeData: object = {}\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.item.attributes\n this.storeData.id = this.attrs.item.id\n }\n\n view() {\n const moneyName = app.forum.attribute('antoinefr-money.moneyname') || '[money]';\n const price = this.storeData.price > 0 ? moneyName.replace('[money]', this.storeData.price) : app.translator.trans('mattoid-store.forum.free');\n const discountPrice = moneyName.replace('[money]', this.storeData.discountPrice);\n\n return (\n
this.showDetails(this.storeData)}>\n
\n {this.storeData.title}\n
\n
\n {this.storeData.discountPrice > 0 ?\n (\n
\n {discountPrice} \n {price}\n
\n ) :\n ({price})}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-stock')}: {this.storeData.stock == -99 ? app.translator.trans('mattoid-store.forum.infinite') : this.storeData.stock } | \n {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} \n ({this.storeData.outtime}{app.translator.trans('mattoid-store.forum.days')})\n  | {app.translator.trans('mattoid-store.lib.item-invalid', {'day' : this.storeData.outtime})}\n
\n
\n
\n {this.storeData.desc}\n
\n
\n
\n \n
\n
\n )\n }\n\n showDetails(storeData) {\n if(app.session.user){\n app.modal.show(StoreBox, {storeData});\n }\n }\n}\n","import IndexPage from \"flarum/forum/components/IndexPage\";\nimport { IPageAttrs } from 'flarum/common/components/Page';\nimport listItems from 'flarum/common/helpers/listItems';\nimport Mithril from 'mithril';\nimport Button from \"flarum/common/components/Button\";\nimport Stream from \"flarum/common/utils/Stream\";\nimport StoreItem from \"./StoreItem\";\nimport StoreListItem from \"../../admin/components/StoreListItem\";\n\nexport interface IIndexPageAttrs extends IPageAttrs {}\n\nexport default class StorePage extends IndexPage {\n\n private storeList: any = []\n private moreResults: boolean = false\n\n oncreate(vnode: Mithril.VnodeDOM) {\n super.oncreate(vnode);\n\n app.setTitle(app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital'));\n app.setTitleCount(0);\n\n this.status = Stream('1');\n this.type = Stream('-1');\n\n this.loadResults();\n }\n\n view() {\n return (\n
\n
\n
\n \n
\n

{app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital')}

\n
\n {\n this.storeList.map((item) => {\n if (!item.attributes.hide || app.session.user.attribute('can'+item.attributes.code.slice(0, 1).toUpperCase()+item.attributes.code.slice(1)+'View')) {\n return (\n
\n {StoreItem.component({ item })}\n
\n );\n }\n })\n }\n
\n\n {!this.loading && this.storeList.length === 0 && (\n
\n
\n {app.translator.trans('mattoid-store.lib.list-empty')}\n
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n
\n
\n
\n
\n )\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.storeList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.storeList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n type: this.type(),\n status: this.status()\n };\n\n return app.store\n .find(\"/store/list\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n}\n","import app from 'flarum/forum/app';\nimport {extend} from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport StorePage from \"./components/StorePage\";\n\napp.initializers.add('mattoid/store', () => {\n app.routes.store = {\n path: '/store',\n component: StorePage,\n };\n\n extend(IndexPage.prototype, 'navItems', function (items) {\n if (!app.session.user.attribute('canStoreView')) {\n return false;\n }\n\n items.add('store', LinkButton.component({\n href: app.route('store'),\n icon: 'fas fa-store',\n }, app.forum.attribute(\"storeName\") || app.translator.trans('mattoid-store.forum.tital')));\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","StoreBox","_Modal","_this","_len","arguments","length","args","Array","_key","apply","concat","storeData","params","range","initAttrs","attrs","_proto","oninit","vnode","this","id","title","className","content","m","getHtml","JSON","parse","popUp","Button","type","loading","app","translator","trans","_this2","map","item","getInput","column","input","_this3","label","helpText","onchange","event","target","min","step","disabled","Switch","state","Select","options","buttonClassName","val","onsubmit","_this4","preventDefault","request","method","url","forum","attribute","body","then","location","reload","result","Modal","StoreItem","_Component","attributes","view","moneyName","price","replace","discountPrice","onclick","showDetails","stock","style","outtime","autoDeduction","desc","src","icon","user","show","Component","StorePage","_IndexPage","storeList","moreResults","oncreate","setTitle","setTitleCount","status","Stream","loadResults","listItems","sidebarItems","toArray","class","hide","session","code","slice","toUpperCase","component","hasMoreResults","loadMore","parseResults","results","payload","links","next","push","data","redraw","offset","filters","store","find","filter","page","IndexPage","add","path","extend","items","LinkButton","href"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/StoreGoodsDetailModal.tsx b/js/src/admin/components/StoreGoodsDetailModal.tsx index 1040f49..5a48efc 100644 --- a/js/src/admin/components/StoreGoodsDetailModal.tsx +++ b/js/src/admin/components/StoreGoodsDetailModal.tsx @@ -94,7 +94,7 @@ export default class StoreGoodsDetailModal extends Modal { this.params.status = Stream(Number(val)) }} > - +
{app.translator.trans("mattoid-store.admin.settings.goods-code")} @@ -179,16 +179,16 @@ export default class StoreGoodsDetailModal extends Modal {
- { - this.params.autoDeduction = Stream(Number(val)) - }} - > - {app.translator.trans( - "mattoid-store.admin.settings.goods-auto-deduction" - )} - + {app.translator.trans("mattoid-store.admin.settings.goods-auto-deduction")} + + { + this.params.autoDeduction = Stream(Number(val)) + }} + > + +
diff --git a/js/src/forum/components/StoreItem.tsx b/js/src/forum/components/StoreItem.tsx index 5278c31..58fac68 100644 --- a/js/src/forum/components/StoreItem.tsx +++ b/js/src/forum/components/StoreItem.tsx @@ -36,9 +36,7 @@ export default class StoreItem extends Component { {app.translator.trans('mattoid-store.lib.item-stock')}: {this.storeData.stock == -99 ? app.translator.trans('mattoid-store.forum.infinite') : this.storeData.stock } |  {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)}  ({this.storeData.outtime}{app.translator.trans('mattoid-store.forum.days')}) -
-
- {app.translator.trans('mattoid-store.lib.item-invalid', {'day' : this.storeData.outtime})} +  | {app.translator.trans('mattoid-store.lib.item-invalid', {'day' : this.storeData.outtime})}
diff --git a/locale/en.yml b/locale/en.yml index c70d209..9d1fe6b 100644 --- a/locale/en.yml +++ b/locale/en.yml @@ -85,6 +85,6 @@ mattoid-store: item-limit-unit-hour: hour item-limit-unit-minute: minute item-limit-unit-second: second - item-invalid: Deduction of fees every {day} day + item-invalid: Automatic renewal cancel: Cancel confirm: Ok diff --git a/locale/zh-Hans.yml b/locale/zh-Hans.yml index a22890e..8b9ae59 100644 --- a/locale/zh-Hans.yml +++ b/locale/zh-Hans.yml @@ -83,7 +83,7 @@ mattoid-store: list-empty: 这里空空如也 list-load-more: 更多 - item-invalid: 每{day}天扣费一次 + item-invalid: 自动续费 cancel: 取消 confirm: 确定 diff --git a/src/Console/Command/GoodsInvalidCommand.php b/src/Console/Command/GoodsInvalidCommand.php index 080c3f5..9adb34c 100644 --- a/src/Console/Command/GoodsInvalidCommand.php +++ b/src/Console/Command/GoodsInvalidCommand.php @@ -56,9 +56,7 @@ protected function fire() $store = $storeMap[$cart->store_id]; try { // 自动扣费,扣费成功 - if ($cart->auto_deduction) { - $this->autoDeduction($store, $cart); - } + $this->autoDeduction($store, $cart); } catch (\Exception $e) { $buyStatus = false; $this->error("[{$cart->code}]-{$cart->id}-{$cart->store_id}: 自动扣费失败【{$e->getMessage()}】"); @@ -86,6 +84,16 @@ protected function fire() private function autoDeduction(StoreModel $store, StoreCartModel $cart) { + // 商品未开启自动扣费 + if ($cart->auto_deduction) { + + } + + // 商品下架不支持续费 + if ($store->status != 1) { + throw new ValidationException(['message' => $this->translator->trans('mattoid-store.forum.error.invalid-product')]); + } + $key = md5("{$store->store_id}-{$cart->user_id}"); if (!$this->cache->add($key, time(), 5)) { throw new ValidationException(['message' => $this->translator->trans('mattoid-store.forum.error.validate-fail')]);