create-basicjs 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/create-basicjs.js +2 -2
- package/bin/verify-package.js +16 -0
- package/package.json +4 -1
- package/payload/starter/AGENTS.md +84 -0
- package/payload/starter/CLAUDE.md +1 -0
- package/payload/starter/README.md +45 -0
- package/payload/starter/_basic/VERSION +1 -0
- package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
- package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
- package/payload/starter/_basic/assets/categories/coffee-cup.png +0 -0
- package/payload/starter/_basic/assets/categories/coffee.png +0 -0
- package/payload/starter/_basic/assets/categories/frappe.png +0 -0
- package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
- package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
- package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
- package/payload/starter/_basic/assets/categories/tea.png +0 -0
- package/payload/starter/_basic/assets/data-table/palette.svg +2 -0
- package/payload/starter/_basic/assets/data-table/people.js +104 -0
- package/payload/starter/_basic/assets/data-table/trash.svg +2 -0
- package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
- package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
- package/payload/starter/_basic/assets/fruids/domates.png +0 -0
- package/payload/starter/_basic/assets/fruids/elma.png +0 -0
- package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
- package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
- package/payload/starter/_basic/assets/fruids/limon.png +0 -0
- package/payload/starter/_basic/assets/fruids/muz.png +0 -0
- package/payload/starter/_basic/assets/fruids/nar.png +0 -0
- package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
- package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
- package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
- package/payload/starter/_basic/assets/icons/alert-black.png +0 -0
- package/payload/starter/_basic/assets/icons/alert.png +0 -0
- package/payload/starter/_basic/assets/icons/arrow-drop.svg +3 -0
- package/payload/starter/_basic/assets/icons/arrow-rise.svg +3 -0
- package/payload/starter/_basic/assets/icons/close.svg +1 -0
- package/payload/starter/_basic/assets/icons/lamp-on.png +0 -0
- package/payload/starter/_basic/assets/icons/lamp.png +0 -0
- package/payload/starter/_basic/assets/icons/lock.png +0 -0
- package/payload/starter/_basic/assets/icons/panel.png +0 -0
- package/payload/starter/_basic/assets/icons/plant.png +0 -0
- package/payload/starter/_basic/assets/icons/trash.png +0 -0
- package/payload/starter/_basic/assets/icons/trash.svg +2 -0
- package/payload/starter/_basic/assets/tab-bar/settings.png +0 -0
- package/payload/starter/_basic/assets/tab-bar/status.png +0 -0
- package/payload/starter/_basic/assets/tab-bar/transactions.png +0 -0
- package/payload/starter/_basic/assets/tutorial/blueberries.png +0 -0
- package/payload/starter/_basic/assets/tutorial/carrot.png +0 -0
- package/payload/starter/_basic/assets/tutorial/olives.png +0 -0
- package/payload/starter/_basic/assets/tutorial/strawberry.png +0 -0
- package/payload/starter/_basic/assets/ui-bottom-bar/setting.svg +11 -0
- package/payload/starter/_basic/basic/LICENSE +14 -0
- package/payload/starter/_basic/basic/basic.css +277 -0
- package/payload/starter/_basic/basic/basic.js +3767 -0
- package/payload/starter/_basic/basic/basic.min.css +1 -0
- package/payload/starter/_basic/basic/basic.min.js +65 -0
- package/payload/starter/_basic/basic/font/open-sans/LICENSE.txt +206 -0
- package/payload/starter/_basic/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- package/payload/starter/_basic/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- package/payload/starter/_basic/basic/scroll-bar.js +536 -0
- package/payload/starter/_basic/basic/scroll-bar.min.js +2 -0
- package/payload/starter/_basic/comp/action-button/add.png +0 -0
- package/payload/starter/_basic/comp/action-button.js +522 -0
- package/payload/starter/_basic/comp/action-tab-bar.js +383 -0
- package/payload/starter/_basic/comp/app-bar.js +236 -0
- package/payload/starter/_basic/comp/badge-v2.js +246 -0
- package/payload/starter/_basic/comp/bottom-bar.js +547 -0
- package/payload/starter/_basic/comp/breadcrumbs.js +522 -0
- package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +13 -0
- package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +9 -0
- package/payload/starter/_basic/comp/chart-box.js +868 -0
- package/payload/starter/_basic/comp/check-box.js +374 -0
- package/payload/starter/_basic/comp/context-menu.js +634 -0
- package/payload/starter/_basic/comp/currency-input-b.js +190 -0
- package/payload/starter/_basic/comp/data-table/arrow.svg +2 -0
- package/payload/starter/_basic/comp/data-table.js +865 -0
- package/payload/starter/_basic/comp/dialog.js +854 -0
- package/payload/starter/_basic/comp/email-input-b.js +57 -0
- package/payload/starter/_basic/comp/filters.js +493 -0
- package/payload/starter/_basic/comp/form.js +590 -0
- package/payload/starter/_basic/comp/full-screen-select/arrow.svg +2 -0
- package/payload/starter/_basic/comp/full-screen-select/cancel.svg +2 -0
- package/payload/starter/_basic/comp/full-screen-select.js +611 -0
- package/payload/starter/_basic/comp/gauge.js +435 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button/trash-red.png +0 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button/trash.png +0 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button.js +280 -0
- package/payload/starter/_basic/comp/input-b.js +759 -0
- package/payload/starter/_basic/comp/item-list.js +1396 -0
- package/payload/starter/_basic/comp/label-editor.js +1137 -0
- package/payload/starter/_basic/comp/left-menu/_Material Symbols & Icons - Google Fonts.webloc +8 -0
- package/payload/starter/_basic/comp/left-menu/data-table.png +0 -0
- package/payload/starter/_basic/comp/left-menu/home.png +0 -0
- package/payload/starter/_basic/comp/left-menu/reports.png +0 -0
- package/payload/starter/_basic/comp/left-menu/setting.png +0 -0
- package/payload/starter/_basic/comp/left-menu.js +476 -0
- package/payload/starter/_basic/comp/line-progress-bar.js +192 -0
- package/payload/starter/_basic/comp/loading-screen.js +382 -0
- package/payload/starter/_basic/comp/login-page-v2.js +586 -0
- package/payload/starter/_basic/comp/mini-graph-box.js +483 -0
- package/payload/starter/_basic/comp/notice.js +227 -0
- package/payload/starter/_basic/comp/number-input-b.js +121 -0
- package/payload/starter/_basic/comp/numeric-keyboard.js +296 -0
- package/payload/starter/_basic/comp/page-control.js +745 -0
- package/payload/starter/_basic/comp/page-header.js +190 -0
- package/payload/starter/_basic/comp/password-input-b/hide-btn.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/hide-btn2.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/show-btn.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/show-btn2.png +0 -0
- package/payload/starter/_basic/comp/password-input-b.js +164 -0
- package/payload/starter/_basic/comp/period-bar.js +435 -0
- package/payload/starter/_basic/comp/phone-input-b.js +287 -0
- package/payload/starter/_basic/comp/progress-bar.js +676 -0
- package/payload/starter/_basic/comp/property-panel.js +2740 -0
- package/payload/starter/_basic/comp/radio-button.js +467 -0
- package/payload/starter/_basic/comp/rich-text-editor.js +1061 -0
- package/payload/starter/_basic/comp/scrolling-text.js +296 -0
- package/payload/starter/_basic/comp/search-input-v2/clear-round.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/clear.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/filter.png +0 -0
- package/payload/starter/_basic/comp/search-input-v2/filter.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/search.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2.js +427 -0
- package/payload/starter/_basic/comp/search-results.js +560 -0
- package/payload/starter/_basic/comp/select-box.js +1740 -0
- package/payload/starter/_basic/comp/select-color.js +603 -0
- package/payload/starter/_basic/comp/select-date.js +1003 -0
- package/payload/starter/_basic/comp/select-file.js +732 -0
- package/payload/starter/_basic/comp/select-time.js +979 -0
- package/payload/starter/_basic/comp/settings-row.js +298 -0
- package/payload/starter/_basic/comp/side-panel.js +573 -0
- package/payload/starter/_basic/comp/slider-field.js +776 -0
- package/payload/starter/_basic/comp/slider.js +368 -0
- package/payload/starter/_basic/comp/smart-button/alert-black.png +0 -0
- package/payload/starter/_basic/comp/smart-button/clock.png +0 -0
- package/payload/starter/_basic/comp/smart-button.js +896 -0
- package/payload/starter/_basic/comp/smart-table/clock.png +0 -0
- package/payload/starter/_basic/comp/smart-table/down.png +0 -0
- package/payload/starter/_basic/comp/smart-table/scroll.png +0 -0
- package/payload/starter/_basic/comp/smart-table/sort.png +0 -0
- package/payload/starter/_basic/comp/smart-table/up.png +0 -0
- package/payload/starter/_basic/comp/smart-table.js +1321 -0
- package/payload/starter/_basic/comp/sortable-list.js +1172 -0
- package/payload/starter/_basic/comp/spark-line-box.js +729 -0
- package/payload/starter/_basic/comp/stepper.js +699 -0
- package/payload/starter/_basic/comp/tabs.js +1317 -0
- package/payload/starter/_basic/comp/tag-input.js +1067 -0
- package/payload/starter/_basic/comp/tap-effect.js +168 -0
- package/payload/starter/_basic/comp/textarea-b.js +184 -0
- package/payload/starter/_basic/comp/time-line.js +324 -0
- package/payload/starter/_basic/comp/tiny-select/arrow.svg +1 -0
- package/payload/starter/_basic/comp/tiny-select.js +282 -0
- package/payload/starter/_basic/comp/tiny-table.js +279 -0
- package/payload/starter/_basic/comp/toast.js +838 -0
- package/payload/starter/_basic/comp/toggle.js +636 -0
- package/payload/starter/_basic/comp/tooltip.js +471 -0
- package/payload/starter/_basic/comp/tree-view.js +1096 -0
- package/payload/starter/_basic/comp/ui-effects.js +1091 -0
- package/payload/starter/_basic/comp/ui-standards.js +402 -0
- package/payload/starter/_basic/comp/url-input-b.js +145 -0
- package/payload/starter/_basic/comp/web-view.js +534 -0
- package/payload/starter/_basic/docs/basic-js-animated-rules.md +90 -0
- package/payload/starter/_basic/docs/basic-js-code-rules.md +91 -0
- package/payload/starter/_basic/docs/basic-js-components.md +134 -0
- package/payload/starter/_basic/docs/basic-js-core.md +131 -0
- package/payload/starter/_basic/docs/component-index.md +522 -0
- package/payload/starter/_basic/docs/component-template.js +416 -0
- package/payload/starter/_basic/docs/handbook/00-introduction.md +125 -0
- package/payload/starter/_basic/docs/handbook/00-what-is-new.md +96 -0
- package/payload/starter/_basic/docs/handbook/01-label.md +104 -0
- package/payload/starter/_basic/docs/handbook/02-box.md +166 -0
- package/payload/starter/_basic/docs/handbook/03-image.md +81 -0
- package/payload/starter/_basic/docs/handbook/04-common-properties.md +159 -0
- package/payload/starter/_basic/docs/handbook/05-autolayout.md +332 -0
- package/payload/starter/_basic/docs/handbook/06-button.md +103 -0
- package/payload/starter/_basic/docs/handbook/07-input.md +78 -0
- package/payload/starter/_basic/docs/handbook/08-page.md +120 -0
- package/payload/starter/_basic/docs/handbook/09-useful-examples.md +309 -0
- package/payload/starter/_basic/docs/handbook/10-motion.md +132 -0
- package/payload/starter/_basic/docs/handbook/11-other-functions.md +92 -0
- package/payload/starter/_basic/docs/handbook/12-utilities.md +123 -0
- package/payload/starter/_basic/docs/handbook/13-sound.md +88 -0
- package/payload/starter/_basic/docs/what-is-new.md +402 -0
- package/payload/starter/_basic/examples/action-button.htm +81 -0
- package/payload/starter/_basic/examples/action-tab-bar.htm +97 -0
- package/payload/starter/_basic/examples/app-bar.htm +140 -0
- package/payload/starter/_basic/examples/badgeV2.htm +68 -0
- package/payload/starter/_basic/examples/bottom-bar/grid.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/grids.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/home.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/homes.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon1.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon1s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon2.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon2s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon3.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon3s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon4.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon4s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/search.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/searchs.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/settings.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/settingss.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/tasks.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/taskss.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar-2.htm +187 -0
- package/payload/starter/_basic/examples/bottom-bar.htm +46 -0
- package/payload/starter/_basic/examples/breadcrumbs.htm +284 -0
- package/payload/starter/_basic/examples/chart-box.htm +287 -0
- package/payload/starter/_basic/examples/check-box-1.htm +220 -0
- package/payload/starter/_basic/examples/check-box-2.htm +212 -0
- package/payload/starter/_basic/examples/check-box-3.htm +179 -0
- package/payload/starter/_basic/examples/context-menu.htm +269 -0
- package/payload/starter/_basic/examples/currency-input-b.htm +71 -0
- package/payload/starter/_basic/examples/data-table-2.htm +67 -0
- package/payload/starter/_basic/examples/data-table-3.htm +72 -0
- package/payload/starter/_basic/examples/data-table-4.htm +144 -0
- package/payload/starter/_basic/examples/data-table-5.htm +152 -0
- package/payload/starter/_basic/examples/data-table.htm +178 -0
- package/payload/starter/_basic/examples/dialog-centered.htm +130 -0
- package/payload/starter/_basic/examples/dialog.htm +209 -0
- package/payload/starter/_basic/examples/email-input-b.htm +67 -0
- package/payload/starter/_basic/examples/filters.htm +115 -0
- package/payload/starter/_basic/examples/form-1.htm +123 -0
- package/payload/starter/_basic/examples/full-screen-select.htm +114 -0
- package/payload/starter/_basic/examples/gauge.htm +133 -0
- package/payload/starter/_basic/examples/hold-to-confirm-button.htm +144 -0
- package/payload/starter/_basic/examples/input-b-ex1.htm +132 -0
- package/payload/starter/_basic/examples/input-b-ex2.htm +136 -0
- package/payload/starter/_basic/examples/input-b-ex3-style.htm +113 -0
- package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +112 -0
- package/payload/starter/_basic/examples/input-b-ex5-warning-icon.htm +80 -0
- package/payload/starter/_basic/examples/input-b-ex6-dark.htm +108 -0
- package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +153 -0
- package/payload/starter/_basic/examples/item-list-2.htm +253 -0
- package/payload/starter/_basic/examples/item-list.htm +176 -0
- package/payload/starter/_basic/examples/label-editor.htm +196 -0
- package/payload/starter/_basic/examples/left-menu.htm +81 -0
- package/payload/starter/_basic/examples/line-progress-bar.htm +145 -0
- package/payload/starter/_basic/examples/loading-screen.htm +217 -0
- package/payload/starter/_basic/examples/login-page-dark-v2.htm +269 -0
- package/payload/starter/_basic/examples/login-page-v2.htm +269 -0
- package/payload/starter/_basic/examples/mini-graph-box.htm +229 -0
- package/payload/starter/_basic/examples/notice.htm +79 -0
- package/payload/starter/_basic/examples/number-input-b.htm +68 -0
- package/payload/starter/_basic/examples/numeric-keyboard.htm +100 -0
- package/payload/starter/_basic/examples/page-control.htm +262 -0
- package/payload/starter/_basic/examples/page-header.htm +117 -0
- package/payload/starter/_basic/examples/password-input-b.htm +70 -0
- package/payload/starter/_basic/examples/period-bar.htm +94 -0
- package/payload/starter/_basic/examples/phone-input-b-select-country.htm +298 -0
- package/payload/starter/_basic/examples/phone-input-b.htm +72 -0
- package/payload/starter/_basic/examples/progress-bar-ozden.htm +168 -0
- package/payload/starter/_basic/examples/progress-bar.htm +296 -0
- package/payload/starter/_basic/examples/property-panel.htm +216 -0
- package/payload/starter/_basic/examples/radio-button-1.htm +264 -0
- package/payload/starter/_basic/examples/radio-button-2.htm +256 -0
- package/payload/starter/_basic/examples/radio-button-3.htm +168 -0
- package/payload/starter/_basic/examples/rich-text-editor.htm +228 -0
- package/payload/starter/_basic/examples/scrolling-text.htm +75 -0
- package/payload/starter/_basic/examples/search-input-v2-ozden.htm +128 -0
- package/payload/starter/_basic/examples/search-input-v2-place.htm +80 -0
- package/payload/starter/_basic/examples/search-input-v2.htm +65 -0
- package/payload/starter/_basic/examples/search-results.htm +193 -0
- package/payload/starter/_basic/examples/select-box-ozden-item.htm +114 -0
- package/payload/starter/_basic/examples/select-box-ozden-text.htm +64 -0
- package/payload/starter/_basic/examples/select-box.htm +254 -0
- package/payload/starter/_basic/examples/select-color.htm +215 -0
- package/payload/starter/_basic/examples/select-date.htm +244 -0
- package/payload/starter/_basic/examples/select-file.htm +268 -0
- package/payload/starter/_basic/examples/select-time.htm +249 -0
- package/payload/starter/_basic/examples/settings-row.htm +193 -0
- package/payload/starter/_basic/examples/side-panel-2.htm +270 -0
- package/payload/starter/_basic/examples/side-panel.htm +219 -0
- package/payload/starter/_basic/examples/slider-field.htm +223 -0
- package/payload/starter/_basic/examples/slider.htm +180 -0
- package/payload/starter/_basic/examples/smart-button-2.htm +220 -0
- package/payload/starter/_basic/examples/smart-button-3-ozden.htm +320 -0
- package/payload/starter/_basic/examples/smart-button-4-dark.htm +102 -0
- package/payload/starter/_basic/examples/smart-button-5-features.htm +205 -0
- package/payload/starter/_basic/examples/smart-button.htm +252 -0
- package/payload/starter/_basic/examples/smart-table-1.htm +142 -0
- package/payload/starter/_basic/examples/smart-table-2.htm +191 -0
- package/payload/starter/_basic/examples/smart-table-3.htm +359 -0
- package/payload/starter/_basic/examples/smart-table-4.htm +158 -0
- package/payload/starter/_basic/examples/sortable-list.htm +250 -0
- package/payload/starter/_basic/examples/spark-line-box.htm +285 -0
- package/payload/starter/_basic/examples/stepper-2.htm +172 -0
- package/payload/starter/_basic/examples/stepper.htm +255 -0
- package/payload/starter/_basic/examples/tabs-2/coffee.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i1-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i1.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i2-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i2.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i3-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i3.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i4-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i4.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i5-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i5.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/lamp-on.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/lamp.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/search.svg +2 -0
- package/payload/starter/_basic/examples/tabs-2.htm +188 -0
- package/payload/starter/_basic/examples/tabs.htm +300 -0
- package/payload/starter/_basic/examples/tag-input.htm +242 -0
- package/payload/starter/_basic/examples/tap-effect.htm +100 -0
- package/payload/starter/_basic/examples/textarea-b.htm +76 -0
- package/payload/starter/_basic/examples/time-line.htm +226 -0
- package/payload/starter/_basic/examples/tiny-select.htm +86 -0
- package/payload/starter/_basic/examples/tiny-table.htm +109 -0
- package/payload/starter/_basic/examples/toast.htm +262 -0
- package/payload/starter/_basic/examples/toggle-2.htm +163 -0
- package/payload/starter/_basic/examples/toggle-3.htm +218 -0
- package/payload/starter/_basic/examples/toggle.htm +93 -0
- package/payload/starter/_basic/examples/tooltip-2.htm +177 -0
- package/payload/starter/_basic/examples/tooltip-3.htm +212 -0
- package/payload/starter/_basic/examples/tooltip.htm +124 -0
- package/payload/starter/_basic/examples/tree-view.htm +285 -0
- package/payload/starter/_basic/examples/ui-effects.htm +463 -0
- package/payload/starter/_basic/examples/ui-standards.htm +261 -0
- package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +221 -0
- package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +221 -0
- package/payload/starter/_basic/examples/url-input-b.htm +85 -0
- package/payload/starter/_basic/examples/web-view.htm +241 -0
- package/payload/starter/_basic/min/action-button.min.js +2 -0
- package/payload/starter/_basic/min/action-tab-bar.min.js +2 -0
- package/payload/starter/_basic/min/app-bar.min.js +2 -0
- package/payload/starter/_basic/min/badge-v2.min.js +2 -0
- package/payload/starter/_basic/min/bottom-bar.min.js +2 -0
- package/payload/starter/_basic/min/breadcrumbs.min.js +2 -0
- package/payload/starter/_basic/min/chart-box.min.js +2 -0
- package/payload/starter/_basic/min/check-box.min.js +2 -0
- package/payload/starter/_basic/min/context-menu.min.js +2 -0
- package/payload/starter/_basic/min/currency-input-b.min.js +2 -0
- package/payload/starter/_basic/min/data-table.min.js +2 -0
- package/payload/starter/_basic/min/dialog.min.js +2 -0
- package/payload/starter/_basic/min/email-input-b.min.js +2 -0
- package/payload/starter/_basic/min/filters.min.js +2 -0
- package/payload/starter/_basic/min/form.min.js +2 -0
- package/payload/starter/_basic/min/full-screen-select.min.js +2 -0
- package/payload/starter/_basic/min/gauge.min.js +2 -0
- package/payload/starter/_basic/min/hold-to-confirm-button.min.js +2 -0
- package/payload/starter/_basic/min/input-b.min.js +2 -0
- package/payload/starter/_basic/min/item-list.min.js +2 -0
- package/payload/starter/_basic/min/label-editor.min.js +2 -0
- package/payload/starter/_basic/min/left-menu.min.js +2 -0
- package/payload/starter/_basic/min/line-progress-bar.min.js +2 -0
- package/payload/starter/_basic/min/loading-screen.min.js +2 -0
- package/payload/starter/_basic/min/login-page-v2.min.js +2 -0
- package/payload/starter/_basic/min/mini-graph-box.min.js +2 -0
- package/payload/starter/_basic/min/notice.min.js +2 -0
- package/payload/starter/_basic/min/number-input-b.min.js +2 -0
- package/payload/starter/_basic/min/numeric-keyboard.min.js +2 -0
- package/payload/starter/_basic/min/page-control.min.js +2 -0
- package/payload/starter/_basic/min/page-header.min.js +2 -0
- package/payload/starter/_basic/min/password-input-b.min.js +2 -0
- package/payload/starter/_basic/min/period-bar.min.js +2 -0
- package/payload/starter/_basic/min/phone-input-b.min.js +2 -0
- package/payload/starter/_basic/min/progress-bar.min.js +2 -0
- package/payload/starter/_basic/min/property-panel.min.js +2 -0
- package/payload/starter/_basic/min/radio-button.min.js +2 -0
- package/payload/starter/_basic/min/rich-text-editor.min.js +2 -0
- package/payload/starter/_basic/min/scrolling-text.min.js +2 -0
- package/payload/starter/_basic/min/search-input-v2.min.js +2 -0
- package/payload/starter/_basic/min/search-results.min.js +2 -0
- package/payload/starter/_basic/min/select-box.min.js +2 -0
- package/payload/starter/_basic/min/select-color.min.js +2 -0
- package/payload/starter/_basic/min/select-date.min.js +2 -0
- package/payload/starter/_basic/min/select-file.min.js +2 -0
- package/payload/starter/_basic/min/select-time.min.js +2 -0
- package/payload/starter/_basic/min/settings-row.min.js +2 -0
- package/payload/starter/_basic/min/side-panel.min.js +2 -0
- package/payload/starter/_basic/min/slider-field.min.js +2 -0
- package/payload/starter/_basic/min/slider.min.js +2 -0
- package/payload/starter/_basic/min/smart-button.min.js +2 -0
- package/payload/starter/_basic/min/smart-table.min.js +2 -0
- package/payload/starter/_basic/min/sortable-list.min.js +2 -0
- package/payload/starter/_basic/min/spark-line-box.min.js +2 -0
- package/payload/starter/_basic/min/stepper.min.js +2 -0
- package/payload/starter/_basic/min/tabs.min.js +2 -0
- package/payload/starter/_basic/min/tag-input.min.js +2 -0
- package/payload/starter/_basic/min/tap-effect.min.js +2 -0
- package/payload/starter/_basic/min/textarea-b.min.js +2 -0
- package/payload/starter/_basic/min/time-line.min.js +2 -0
- package/payload/starter/_basic/min/tiny-select.min.js +2 -0
- package/payload/starter/_basic/min/tiny-table.min.js +2 -0
- package/payload/starter/_basic/min/toast.min.js +2 -0
- package/payload/starter/_basic/min/toggle.min.js +2 -0
- package/payload/starter/_basic/min/tooltip.min.js +2 -0
- package/payload/starter/_basic/min/tree-view.min.js +2 -0
- package/payload/starter/_basic/min/ui-effects.min.js +2 -0
- package/payload/starter/_basic/min/ui-standards.min.js +2 -0
- package/payload/starter/_basic/min/url-input-b.min.js +2 -0
- package/payload/starter/_basic/min/web-view.min.js +2 -0
- package/payload/starter/_basic/tools/build.js +175 -0
- package/payload/starter/_basic/tools/check.js +336 -0
- package/payload/starter/app/app.js +27 -0
- package/payload/starter/assets/.gitkeep +0 -0
- package/payload/starter/gitignore +3 -0
- package/payload/starter/index.htm +23 -0
- package/payload/templates/booking/TEMPLATE.md +77 -0
- package/payload/templates/booking/app/app.js +722 -0
- package/payload/templates/booking/app/settings.js +52 -0
- package/payload/templates/booking/app/store.js +265 -0
- package/payload/templates/booking/app/texts.js +148 -0
- package/payload/templates/booking/assets/app-icon.svg +1 -0
- package/payload/templates/booking/assets/tabs/account.svg +1 -0
- package/payload/templates/booking/assets/tabs/appointments.svg +1 -0
- package/payload/templates/booking/assets/tabs/home.svg +1 -0
- package/payload/templates/booking/assets/tabs/services.svg +1 -0
- package/payload/templates/booking/components/booking-ui.js +252 -0
- package/payload/templates/booking/index.htm +53 -0
- package/payload/templates/booking/pages/account.js +124 -0
- package/payload/templates/booking/pages/appointments.js +141 -0
- package/payload/templates/booking/pages/book.js +231 -0
- package/payload/templates/booking/pages/home.js +99 -0
- package/payload/templates/booking/pages/services.js +79 -0
- package/payload/templates/classic/TEMPLATE.md +104 -0
- package/payload/templates/classic/app/app.js +779 -0
- package/payload/templates/classic/app/settings.js +77 -0
- package/payload/templates/classic/assets/_attribute.txt +37 -0
- package/payload/templates/classic/assets/cards/dill.png +0 -0
- package/payload/templates/classic/assets/cards/fennel.png +0 -0
- package/payload/templates/classic/assets/cards/juniper.png +0 -0
- package/payload/templates/classic/assets/cards/olives.png +0 -0
- package/payload/templates/classic/assets/cards/oregano.png +0 -0
- package/payload/templates/classic/assets/cards/pepper.png +0 -0
- package/payload/templates/classic/assets/cards/rosehip.png +0 -0
- package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
- package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
- package/payload/templates/classic/assets/categories/coffee-cup.png +0 -0
- package/payload/templates/classic/assets/categories/coffee.png +0 -0
- package/payload/templates/classic/assets/categories/frappe.png +0 -0
- package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
- package/payload/templates/classic/assets/categories/milkshake.png +0 -0
- package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
- package/payload/templates/classic/assets/categories/tea.png +0 -0
- package/payload/templates/classic/assets/example-tabs/coffee.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i1-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i1.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i2-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i2.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i3-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i3.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i4-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i4.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i5-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i5.png +0 -0
- package/payload/templates/classic/assets/example-tabs/lamp-on.png +0 -0
- package/payload/templates/classic/assets/example-tabs/lamp.png +0 -0
- package/payload/templates/classic/assets/example-tabs/search.svg +2 -0
- package/payload/templates/classic/assets/files/ai.png +0 -0
- package/payload/templates/classic/assets/files/doc.png +0 -0
- package/payload/templates/classic/assets/files/folder.png +0 -0
- package/payload/templates/classic/assets/files/js.png +0 -0
- package/payload/templates/classic/assets/files/pdf.png +0 -0
- package/payload/templates/classic/assets/files/txt.png +0 -0
- package/payload/templates/classic/assets/files/xls.png +0 -0
- package/payload/templates/classic/assets/icons/arrow-drop.svg +3 -0
- package/payload/templates/classic/assets/icons/arrow-rise.svg +3 -0
- package/payload/templates/classic/assets/icons/download.svg +18 -0
- package/payload/templates/classic/assets/icons/lamp-on.png +0 -0
- package/payload/templates/classic/assets/icons/lamp.png +0 -0
- package/payload/templates/classic/assets/icons/lock-small.png +0 -0
- package/payload/templates/classic/assets/icons/lock.png +0 -0
- package/payload/templates/classic/assets/icons/logo.png +0 -0
- package/payload/templates/classic/assets/icons/trash-red.svg +2 -0
- package/payload/templates/classic/assets/icons/trash.svg +2 -0
- package/payload/templates/classic/assets/menu/t1.png +0 -0
- package/payload/templates/classic/assets/menu/t10.png +0 -0
- package/payload/templates/classic/assets/menu/t11.png +0 -0
- package/payload/templates/classic/assets/menu/t2.png +0 -0
- package/payload/templates/classic/assets/menu/t3.png +0 -0
- package/payload/templates/classic/assets/menu/t4.png +0 -0
- package/payload/templates/classic/assets/menu/t5.png +0 -0
- package/payload/templates/classic/assets/menu/t6.png +0 -0
- package/payload/templates/classic/assets/menu/t7.png +0 -0
- package/payload/templates/classic/assets/menu/t8.png +0 -0
- package/payload/templates/classic/assets/menu/t9.png +0 -0
- package/payload/templates/classic/assets/products/brokoli.png +0 -0
- package/payload/templates/classic/assets/products/cilek.png +0 -0
- package/payload/templates/classic/assets/products/domates.png +0 -0
- package/payload/templates/classic/assets/products/elma.png +0 -0
- package/payload/templates/classic/assets/products/havuc.png +0 -0
- package/payload/templates/classic/assets/products/karpuz.png +0 -0
- package/payload/templates/classic/assets/products/limon.png +0 -0
- package/payload/templates/classic/assets/products/muz.png +0 -0
- package/payload/templates/classic/assets/products/nar.png +0 -0
- package/payload/templates/classic/assets/products/patlican.png +0 -0
- package/payload/templates/classic/assets/products/yabanmersini.png +0 -0
- package/payload/templates/classic/assets/products/yesilbiber.png +0 -0
- package/payload/templates/classic/assets/tab-bar/settings.png +0 -0
- package/payload/templates/classic/assets/tab-bar/status.png +0 -0
- package/payload/templates/classic/assets/tab-bar/transactions.png +0 -0
- package/payload/templates/classic/assets/tabs/grid.png +0 -0
- package/payload/templates/classic/assets/tabs/grids.png +0 -0
- package/payload/templates/classic/assets/tabs/home.png +0 -0
- package/payload/templates/classic/assets/tabs/homes.png +0 -0
- package/payload/templates/classic/assets/tabs/search.png +0 -0
- package/payload/templates/classic/assets/tabs/searchs.png +0 -0
- package/payload/templates/classic/assets/tabs/settings.png +0 -0
- package/payload/templates/classic/assets/tabs/settingss.png +0 -0
- package/payload/templates/classic/assets/tabs/tasks.png +0 -0
- package/payload/templates/classic/assets/tabs/taskss.png +0 -0
- package/payload/templates/classic/html/privacy.htm +58 -0
- package/payload/templates/classic/index.htm +70 -0
- package/payload/templates/classic/pages/dialogs.js +205 -0
- package/payload/templates/classic/pages/example.js +296 -0
- package/payload/templates/classic/pages/examples.js +148 -0
- package/payload/templates/classic/pages/home.js +268 -0
- package/payload/templates/classic/pages/info-pages.js +95 -0
- package/payload/templates/classic/pages/lock.js +70 -0
- package/payload/templates/classic/pages/search.js +153 -0
- package/payload/templates/classic/pages/settings.js +184 -0
- package/payload/templates/classic/pages/tasks.js +221 -0
- package/payload/templates/classic/pages/template-pages.js +240 -0
- package/payload/templates/coffee-shop/TEMPLATE.md +63 -0
- package/payload/templates/coffee-shop/app/app.js +713 -0
- package/payload/templates/coffee-shop/app/settings.js +20 -0
- package/payload/templates/coffee-shop/app/store.js +52 -0
- package/payload/templates/coffee-shop/assets/cappuccino.png +0 -0
- package/payload/templates/coffee-shop/assets/chocolate-milk.png +0 -0
- package/payload/templates/coffee-shop/assets/coffee-art/cocoa.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/filter.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/frappe.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/iced.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/latte.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/tea.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee.png +0 -0
- package/payload/templates/coffee-shop/assets/credits.txt +41 -0
- package/payload/templates/coffee-shop/assets/fonts/OFL.txt +93 -0
- package/payload/templates/coffee-shop/assets/fonts/gelasio-OFL.txt +93 -0
- package/payload/templates/coffee-shop/assets/fonts/gelasio.ttf +0 -0
- package/payload/templates/coffee-shop/assets/frappe.png +0 -0
- package/payload/templates/coffee-shop/assets/iced-caffee.png +0 -0
- package/payload/templates/coffee-shop/assets/tabs/cart.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/home.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/menu.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/rewards.svg +1 -0
- package/payload/templates/coffee-shop/assets/tea.png +0 -0
- package/payload/templates/coffee-shop/components/coffee-ui.js +246 -0
- package/payload/templates/coffee-shop/index.htm +55 -0
- package/payload/templates/coffee-shop/pages/cart.js +82 -0
- package/payload/templates/coffee-shop/pages/drink.js +74 -0
- package/payload/templates/coffee-shop/pages/home.js +54 -0
- package/payload/templates/coffee-shop/pages/menu.js +53 -0
- package/payload/templates/coffee-shop/pages/rewards.js +38 -0
- package/payload/templates/forms/TEMPLATE.md +12 -0
- package/payload/templates/forms/app/app.js +30 -0
- package/payload/templates/forms/appointment-form.htm +969 -0
- package/payload/templates/forms/assets/error.png +0 -0
- package/payload/templates/forms/assets/logo.png +0 -0
- package/payload/templates/forms/assets/logo2.png +0 -0
- package/payload/templates/forms/assets/mail.png +0 -0
- package/payload/templates/forms/assets/success.png +0 -0
- package/payload/templates/forms/contact-form-iframe.htm +24 -0
- package/payload/templates/forms/contact-form-table.sql +11 -0
- package/payload/templates/forms/contact-form-to-mail.htm +358 -0
- package/payload/templates/forms/contact-form-to-supabase.htm +396 -0
- package/payload/templates/forms/dark-contact-form.htm +623 -0
- package/payload/templates/forms/event-registration-form.htm +1056 -0
- package/payload/templates/forms/feedback-form.htm +813 -0
- package/payload/templates/forms/order-form.htm +1187 -0
- package/payload/templates/forms/recruitment-form.htm +698 -0
- package/payload/templates/forms/service/PHPMailer/Exception.php +40 -0
- package/payload/templates/forms/service/PHPMailer/LICENSE +502 -0
- package/payload/templates/forms/service/PHPMailer/PHPMailer.php +5586 -0
- package/payload/templates/forms/service/PHPMailer/SMTP.php +1617 -0
- package/payload/templates/forms/service/readme.md +162 -0
- package/payload/templates/forms/service/send-form-mail.php +941 -0
- package/payload/templates/forms/support-ticket-form.htm +908 -0
- package/payload/templates/panel/TEMPLATE.md +16 -0
- package/payload/templates/panel/assets/_Material Symbols & Icons - Google Fonts.webloc +8 -0
- package/payload/templates/panel/assets/arrow_down.png +0 -0
- package/payload/templates/panel/assets/close.png +0 -0
- package/payload/templates/panel/assets/left-menu/bolt.png +0 -0
- package/payload/templates/panel/assets/left-menu/brick.png +0 -0
- package/payload/templates/panel/assets/left-menu/code.png +0 -0
- package/payload/templates/panel/assets/left-menu/dashboard.png +0 -0
- package/payload/templates/panel/assets/left-menu/data-table.png +0 -0
- package/payload/templates/panel/assets/left-menu/extension.png +0 -0
- package/payload/templates/panel/assets/left-menu/home.png +0 -0
- package/payload/templates/panel/assets/left-menu/reports.png +0 -0
- package/payload/templates/panel/assets/left-menu/setting.png +0 -0
- package/payload/templates/panel/assets/left-menu/url.png +0 -0
- package/payload/templates/panel/assets/light.png +0 -0
- package/payload/templates/panel/assets/maybe.png +0 -0
- package/payload/templates/panel/assets/panel-icon.png +0 -0
- package/payload/templates/panel/assets/top-bar/add.png +0 -0
- package/payload/templates/panel/assets/top-bar/add.svg +1 -0
- package/payload/templates/panel/assets/top-bar/apps.png +0 -0
- package/payload/templates/panel/assets/top-bar/apps.svg +1 -0
- package/payload/templates/panel/assets/top-bar/arrow-down.svg +1 -0
- package/payload/templates/panel/assets/top-bar/bell.svg +1 -0
- package/payload/templates/panel/assets/top-bar/bookmark.png +0 -0
- package/payload/templates/panel/assets/top-bar/bookmark.svg +1 -0
- package/payload/templates/panel/assets/top-bar/cancel.png +0 -0
- package/payload/templates/panel/assets/top-bar/close.svg +1 -0
- package/payload/templates/panel/assets/top-bar/comment.png +0 -0
- package/payload/templates/panel/assets/top-bar/filter.png +0 -0
- package/payload/templates/panel/assets/top-bar/keyboard.svg +1 -0
- package/payload/templates/panel/assets/top-bar/notification.png +0 -0
- package/payload/templates/panel/assets/top-bar/search.png +0 -0
- package/payload/templates/panel/assets/top-bar/search.svg +1 -0
- package/payload/templates/panel/assets/top-bar/user.png +0 -0
- package/payload/templates/panel/assets/top-bar/user.svg +1 -0
- package/payload/templates/panel/assets/warning.png +0 -0
- package/payload/templates/panel/common/bridge.js +1 -0
- package/payload/templates/panel/common/bridge.min.js +0 -0
- package/payload/templates/panel/common/components.js +12 -0
- package/payload/templates/panel/common/full-view.js +107 -0
- package/payload/templates/panel/common/full-view.min.js +1 -0
- package/payload/templates/panel/common/main-view.js +53 -0
- package/payload/templates/panel/common/main-view.min.js +1 -0
- package/payload/templates/panel/common/module-page.js +46 -0
- package/payload/templates/panel/common/module-page.min.js +1 -0
- package/payload/templates/panel/common/right-view.js +77 -0
- package/payload/templates/panel/common/right-view.min.js +1 -0
- package/payload/templates/panel/common/start-page.js +31 -0
- package/payload/templates/panel/common/start-page.min.js +1 -0
- package/payload/templates/panel/common/theme.js +491 -0
- package/payload/templates/panel/common/top-bar-v25-07-29-1.js +330 -0
- package/payload/templates/panel/common/top-bar-v25-07-29-2.js +265 -0
- package/payload/templates/panel/common/top-bar.js +855 -0
- package/payload/templates/panel/common/top-bar.min.js +1 -0
- package/payload/templates/panel/common/ui-standards.css +77 -0
- package/payload/templates/panel/common/ui-standards.js +133 -0
- package/payload/templates/panel/common/ui-standards.min.css +1 -0
- package/payload/templates/panel/common/ui-standards.min.js +1 -0
- package/payload/templates/panel/index.htm +642 -0
- package/payload/templates/panel/managers/database.js +1 -0
- package/payload/templates/panel/managers/database.min.js +1 -0
- package/payload/templates/panel/managers/login.js +2 -0
- package/payload/templates/panel/managers/login.min.js +1 -0
- package/payload/templates/panel/module1/empty-main.htm +27 -0
- package/payload/templates/panel/module10/greenhouse.htm +1362 -0
- package/payload/templates/panel/module11/arduino-projects.htm +1125 -0
- package/payload/templates/panel/module2/empty-full.htm +27 -0
- package/payload/templates/panel/module3/empty-right.htm +27 -0
- package/payload/templates/panel/module4/empty-main-topbar.htm +27 -0
- package/payload/templates/panel/module5/empty-right-topbar.htm +27 -0
- package/payload/templates/panel/module6/energy-hub.htm +1508 -0
- package/payload/templates/panel/module7/3d-printers.htm +1259 -0
- package/payload/templates/panel/module8/cold-rooms.htm +1251 -0
- package/payload/templates/panel/module9/elevator-fleet.htm +1489 -0
- package/payload/templates/panel/pages/_page-template.js +36 -0
- package/payload/templates/panel/pages/_page-template.min.js +1 -0
- package/payload/templates/panel/pages/activity.js +1072 -0
- package/payload/templates/panel/pages/contents.js +1555 -0
- package/payload/templates/panel/pages/contents.min.js +1 -0
- package/payload/templates/panel/pages/customers.js +1171 -0
- package/payload/templates/panel/pages/edit-user.js +381 -0
- package/payload/templates/panel/pages/edit-user.min.js +1 -0
- package/payload/templates/panel/pages/edit-users-table.min.js +1 -0
- package/payload/templates/panel/pages/home.js +637 -0
- package/payload/templates/panel/pages/home.min.js +1 -0
- package/payload/templates/panel/pages/media.js +1538 -0
- package/payload/templates/panel/pages/notifications.js +542 -0
- package/payload/templates/panel/pages/notifications.min.js +1 -0
- package/payload/templates/panel/pages/orders.js +1147 -0
- package/payload/templates/panel/pages/products.js +1281 -0
- package/payload/templates/panel/pages/reports.js +1138 -0
- package/payload/templates/panel/pages/reports.min.js +1 -0
- package/payload/templates/panel/pages/roles.js +1096 -0
- package/payload/templates/panel/pages/settings.js +1462 -0
- package/payload/templates/panel/pages/settings.min.js +1 -0
- package/payload/templates/panel/pages/user-actions.js +456 -0
- package/payload/templates/panel/pages/user-actions.min.js +2 -0
- package/payload/templates/panel/pages/user-list.js +1113 -0
- package/payload/templates/panel/pages/users.js +334 -0
- package/payload/templates/panel/pages/users.min.js +1 -0
- package/payload/templates/shop/TEMPLATE.md +69 -0
- package/payload/templates/shop/app/app.js +727 -0
- package/payload/templates/shop/app/art.js +89 -0
- package/payload/templates/shop/app/settings.js +45 -0
- package/payload/templates/shop/app/store.js +239 -0
- package/payload/templates/shop/app/texts.js +232 -0
- package/payload/templates/shop/assets/app-icon.svg +1 -0
- package/payload/templates/shop/assets/tabs/account.svg +1 -0
- package/payload/templates/shop/assets/tabs/cart.svg +1 -0
- package/payload/templates/shop/assets/tabs/home.svg +1 -0
- package/payload/templates/shop/assets/tabs/shop.svg +1 -0
- package/payload/templates/shop/components/shop-ui.js +343 -0
- package/payload/templates/shop/index.htm +57 -0
- package/payload/templates/shop/pages/account.js +190 -0
- package/payload/templates/shop/pages/cart.js +116 -0
- package/payload/templates/shop/pages/checkout.js +134 -0
- package/payload/templates/shop/pages/favorites.js +37 -0
- package/payload/templates/shop/pages/home.js +86 -0
- package/payload/templates/shop/pages/orders.js +132 -0
- package/payload/templates/shop/pages/product.js +168 -0
- package/payload/templates/shop/pages/shop.js +113 -0
- package/payload/templates/starter/TEMPLATE.md +107 -0
- package/payload/templates/starter/app/app.js +660 -0
- package/payload/templates/starter/app/settings.js +57 -0
- package/payload/templates/starter/assets/app-icon.svg +5 -0
- package/payload/templates/starter/assets/products/brokoli.png +0 -0
- package/payload/templates/starter/assets/products/cilek.png +0 -0
- package/payload/templates/starter/assets/products/domates.png +0 -0
- package/payload/templates/starter/assets/products/elma.png +0 -0
- package/payload/templates/starter/assets/products/havuc.png +0 -0
- package/payload/templates/starter/assets/products/karpuz.png +0 -0
- package/payload/templates/starter/assets/products/limon.png +0 -0
- package/payload/templates/starter/assets/products/muz.png +0 -0
- package/payload/templates/starter/assets/products/nar.png +0 -0
- package/payload/templates/starter/assets/products/patlican.png +0 -0
- package/payload/templates/starter/assets/products/yabanmersini.png +0 -0
- package/payload/templates/starter/assets/products/yesilbiber.png +0 -0
- package/payload/templates/starter/assets/tabs/grid.png +0 -0
- package/payload/templates/starter/assets/tabs/grids.png +0 -0
- package/payload/templates/starter/assets/tabs/home.png +0 -0
- package/payload/templates/starter/assets/tabs/homes.png +0 -0
- package/payload/templates/starter/assets/tabs/settings.png +0 -0
- package/payload/templates/starter/assets/tabs/settingss.png +0 -0
- package/payload/templates/starter/assets/tabs/tasks.png +0 -0
- package/payload/templates/starter/assets/tabs/taskss.png +0 -0
- package/payload/templates/starter/html/about.htm +54 -0
- package/payload/templates/starter/index.htm +57 -0
- package/payload/templates/starter/pages/about.js +23 -0
- package/payload/templates/starter/pages/home.js +81 -0
- package/payload/templates/starter/pages/product.js +45 -0
- package/payload/templates/starter/pages/products.js +61 -0
- package/payload/templates/starter/pages/settings.js +103 -0
- package/payload/templates/starter/pages/tasks.js +187 -0
- package/payload/templates/starter/pages/website.js +29 -0
|
@@ -0,0 +1,1281 @@
|
|
|
1
|
+
/* Bismillah */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
Products Page (Template) - v26.09
|
|
6
|
+
|
|
7
|
+
- Product catalog and inventory: summary, low stock alert, filters, a product table with
|
|
8
|
+
thumbnails and stock states, and a product editor (right view).
|
|
9
|
+
- Editor: name, SKU (unique), category, status, short description, price, compare-at price, cost
|
|
10
|
+
(discount and margin preview), stock with quick restock, low stock limit, images.
|
|
11
|
+
- New product, duplicate (as a draft) and delete (hold to confirm).
|
|
12
|
+
- Test data: About 60 products, created one time with a fixed seed. Thumbnails are drawn with SVG.
|
|
13
|
+
Changes are kept while the panel is open. Replace the "PRODUCT SERVICE" functions with your service.
|
|
14
|
+
|
|
15
|
+
COMPONENTS:
|
|
16
|
+
- MiniGraphBox (comp-m4): Summary (bars: one value per category, not a time series)
|
|
17
|
+
- Tabs (comp-m4), SearchInput, TinySelect (comp-m2): Filters
|
|
18
|
+
- SmartTable (comp-m3): Product list (custom thumbnail cell)
|
|
19
|
+
- InputB, NumberInputB (comp-m2): Editor fields
|
|
20
|
+
- RadioButton, CheckBox (comp-m3): Status, stock settings
|
|
21
|
+
- SelectFile (comp-m4): Images
|
|
22
|
+
- SmartButton (comp-m4), HoldToConfirmButton (comp-m3): Actions
|
|
23
|
+
- LoadingScreen (comp-m4; waiting): Saving
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
ProductsPageDefaults = {
|
|
28
|
+
color: "transparent",
|
|
29
|
+
openProductId: null, // Opens the editor of this product. "new": New product (Ex: from the top bar)
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const ProductsPage = function(params = {}) {
|
|
33
|
+
|
|
34
|
+
// BOX: Page container
|
|
35
|
+
let box = startPage(params, ProductsPageDefaults, mainView);
|
|
36
|
+
|
|
37
|
+
mainView.setKey(ProductsPage.KEY);
|
|
38
|
+
|
|
39
|
+
// *** PRIVATE VARIABLES:
|
|
40
|
+
|
|
41
|
+
const ASSETS = "assets/";
|
|
42
|
+
const LIB_PATH = "_basic/";
|
|
43
|
+
const S = ProductsPage.STYLE;
|
|
44
|
+
|
|
45
|
+
const STATUS_TABS = ["", "active", "draft", "archived"]; // "": All
|
|
46
|
+
|
|
47
|
+
const STOCK_FILTERS = [
|
|
48
|
+
{ id: "", label: "All stock" },
|
|
49
|
+
{ id: "in", label: "In stock" },
|
|
50
|
+
{ id: "low", label: "Low stock" },
|
|
51
|
+
{ id: "out", label: "Out of stock" },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const filter = {
|
|
55
|
+
status: "",
|
|
56
|
+
search: "",
|
|
57
|
+
category: "",
|
|
58
|
+
stock: "",
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
let searchTimer = null;
|
|
62
|
+
|
|
63
|
+
// Components
|
|
64
|
+
let statusTabs, stockSelect;
|
|
65
|
+
let kpiBoxList = [];
|
|
66
|
+
let alertBox, lblAlert;
|
|
67
|
+
let lblResultCount, smartTable;
|
|
68
|
+
|
|
69
|
+
// *** PRIVATE FUNCTIONS:
|
|
70
|
+
|
|
71
|
+
const getProducts = function() {
|
|
72
|
+
return ProductsPage.getProducts();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// All filters except the status (used for the tab counts too)
|
|
76
|
+
const matchesFilters = function(product) {
|
|
77
|
+
if (filter.category && product.category != filter.category) return false;
|
|
78
|
+
if (filter.stock && ProductsPage.getStockState(product) != filter.stock) return false;
|
|
79
|
+
const search = filter.search.trim().toLowerCase();
|
|
80
|
+
if (search && !(product.name + " " + product.sku).toLowerCase().includes(search)) return false;
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const render = function() {
|
|
85
|
+
|
|
86
|
+
const list = getProducts().filter(matchesFilters);
|
|
87
|
+
|
|
88
|
+
STATUS_TABS.forEach(function(status, index) {
|
|
89
|
+
const count = (status) ? list.filter(function(product) { return product.status == status; }).length : list.length;
|
|
90
|
+
statusTabs.setCount(index, count);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const shown = (filter.status) ? list.filter(function(product) { return product.status == filter.status; }) : list;
|
|
94
|
+
|
|
95
|
+
smartTable.setItemDataList(shown.map(function(product) {
|
|
96
|
+
return {
|
|
97
|
+
id: product.id,
|
|
98
|
+
image: product.images[0] || "",
|
|
99
|
+
name: product.name,
|
|
100
|
+
sku: product.sku,
|
|
101
|
+
category: product.category,
|
|
102
|
+
price: product.price,
|
|
103
|
+
stock: product.stock,
|
|
104
|
+
lowStockLimit: product.lowStockLimit, // Not a column. Used for the stock state.
|
|
105
|
+
status: ProductsPage.STATUSES[product.status].label,
|
|
106
|
+
};
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
lblResultCount.text = shown.length + " products";
|
|
110
|
+
|
|
111
|
+
renderSummary();
|
|
112
|
+
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const renderSummary = function() {
|
|
116
|
+
|
|
117
|
+
const products = getProducts().filter(function(product) { return product.status != "archived"; });
|
|
118
|
+
const low = products.filter(function(product) { return ProductsPage.getStockState(product) == "low"; });
|
|
119
|
+
const out = products.filter(function(product) { return ProductsPage.getStockState(product) == "out"; });
|
|
120
|
+
const value = products.reduce(function(sum, product) { return sum + product.stock * product.cost; }, 0);
|
|
121
|
+
|
|
122
|
+
// Bars: one for each category
|
|
123
|
+
const byCategory = function(getValue) {
|
|
124
|
+
return ProductsPage.CATEGORIES.map(function(category) {
|
|
125
|
+
return products.filter(function(product) { return product.category == category.name; }).reduce(function(sum, product) { return sum + getValue(product); }, 0);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const values = [
|
|
130
|
+
{ text: String(products.length), bars: byCategory(function() { return 1; }) },
|
|
131
|
+
{ text: ProductsPage.formatMoney(value, 0), bars: byCategory(function(product) { return product.stock * product.cost; }).map(Math.round) },
|
|
132
|
+
{ text: String(low.length), bars: byCategory(function(product) { return (ProductsPage.getStockState(product) == "low") ? 1 : 0; }) },
|
|
133
|
+
{ text: String(out.length), bars: byCategory(function(product) { return (ProductsPage.getStockState(product) == "out") ? 1 : 0; }) },
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
kpiBoxList.forEach(function(kpiBox, index) {
|
|
137
|
+
kpiBox.setValueText(values[index].text);
|
|
138
|
+
kpiBox.setValues(values[index].bars);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Alert
|
|
142
|
+
const needAction = low.length + out.length;
|
|
143
|
+
alertBox.visible = (needAction > 0) ? 1 : 0;
|
|
144
|
+
lblAlert.text = "<b>" + needAction + " products need stock:</b> " + out.length + " out of stock, " + low.length + " low. " +
|
|
145
|
+
"<span style='color:" + Ink(0.55) + "'>Customers can not buy products that are out of stock.</span>";
|
|
146
|
+
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const setStockFilter = function(id) {
|
|
150
|
+
const index = stockSelect.getIndexById(id);
|
|
151
|
+
if (index >= 0) stockSelect.setSelectedIndex(index); // onSelect renders
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const exportCSV = function() {
|
|
155
|
+
|
|
156
|
+
const rows = smartTable.visibleItemDataList;
|
|
157
|
+
const quote = function(value) { return "\"" + String(value).replace(/"/g, "\"\"") + "\""; };
|
|
158
|
+
const lines = ["sku,name,category,price,stock,status"].concat(rows.map(function(row) {
|
|
159
|
+
return [row.sku, row.name, row.category, row.price, row.stock, row.status].map(quote).join(",");
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
const link = document.createElement("a");
|
|
163
|
+
link.href = URL.createObjectURL(new Blob([lines.join("\n")], { type: "text/csv" }));
|
|
164
|
+
link.download = "products.csv";
|
|
165
|
+
link.click();
|
|
166
|
+
URL.revokeObjectURL(link.href);
|
|
167
|
+
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const openEditor = function(product) {
|
|
171
|
+
ProductEditor({
|
|
172
|
+
product: product, // null: New product
|
|
173
|
+
onChange: function() {
|
|
174
|
+
if (box) render();
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const closeEditor = function() {
|
|
180
|
+
if (rightView.isShown(ProductEditor.KEY)) {
|
|
181
|
+
rightView.hide();
|
|
182
|
+
rightView.clean();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// *** VIEW HELPERS:
|
|
187
|
+
|
|
188
|
+
const setFlex = function(obj, flex) {
|
|
189
|
+
obj.elem.style.flex = flex;
|
|
190
|
+
obj.elem.style.minWidth = "0";
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// *** PUBLIC FUNCTIONS:
|
|
194
|
+
|
|
195
|
+
box.destroy = function() {
|
|
196
|
+
|
|
197
|
+
clearTimeout(searchTimer);
|
|
198
|
+
closeEditor();
|
|
199
|
+
|
|
200
|
+
// WHY: SmartTable has window events and a menu on the page. box.remove() does not remove them.
|
|
201
|
+
if (smartTable) smartTable.remove();
|
|
202
|
+
|
|
203
|
+
box.remove();
|
|
204
|
+
box = null;
|
|
205
|
+
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// *** PAGE VIEW:
|
|
209
|
+
|
|
210
|
+
const initHeader = function() {
|
|
211
|
+
|
|
212
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 16 });
|
|
213
|
+
that.elem.style.flexWrap = "wrap";
|
|
214
|
+
that.elem.style.justifyContent = "space-between";
|
|
215
|
+
|
|
216
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
|
|
217
|
+
|
|
218
|
+
Label({ text: "Products", fontSize: 26, textColor: Ink(0.95) });
|
|
219
|
+
that.elem.style.fontFamily = "opensans-bold";
|
|
220
|
+
|
|
221
|
+
Label({ text: "Manage your catalog, prices and stock", fontSize: 14, textColor: Ink(0.5) });
|
|
222
|
+
|
|
223
|
+
endGroup();
|
|
224
|
+
|
|
225
|
+
HGroup({ width: "auto", height: "auto", align: "right center", gap: 10 });
|
|
226
|
+
|
|
227
|
+
ProductsPage.createButton("Export CSV", ASSETS + "arrow_down.png", exportCSV);
|
|
228
|
+
|
|
229
|
+
ProductsPage.createButton("Add Product", ASSETS + "top-bar/add.png", function() {
|
|
230
|
+
openEditor(null);
|
|
231
|
+
}, { primary: 1 });
|
|
232
|
+
|
|
233
|
+
endGroup();
|
|
234
|
+
|
|
235
|
+
endGroup();
|
|
236
|
+
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const initSummary = function() {
|
|
240
|
+
|
|
241
|
+
const KPI_LIST = [
|
|
242
|
+
{ title: "Products (not archived)", barColor: S.ACCENT_COLOR },
|
|
243
|
+
{ title: "Inventory value (cost)", barColor: T.info },
|
|
244
|
+
{ title: "Low stock", barColor: T.warning },
|
|
245
|
+
{ title: "Out of stock", barColor: S.ERROR_COLOR },
|
|
246
|
+
];
|
|
247
|
+
|
|
248
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 16 });
|
|
249
|
+
that.elem.style.flexWrap = "wrap";
|
|
250
|
+
|
|
251
|
+
KPI_LIST.forEach(function(kpi) {
|
|
252
|
+
|
|
253
|
+
// WHY: MiniGraphBox (bars), not SparkLineBox: every bar is a category, not a point in time.
|
|
254
|
+
const kpiBox = MiniGraphBox({
|
|
255
|
+
height: 96,
|
|
256
|
+
title: kpi.title,
|
|
257
|
+
valueText: "",
|
|
258
|
+
iconFile: "",
|
|
259
|
+
barColor: kpi.barColor,
|
|
260
|
+
style: {
|
|
261
|
+
box: { color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 12 },
|
|
262
|
+
text: { padding: 14 },
|
|
263
|
+
title: { fontSize: 13, textColor: Ink(0.5) },
|
|
264
|
+
valueText: { fontSize: 24, textColor: Ink(0.95) },
|
|
265
|
+
trend: { flatColor: Ink(0.45) }, // WHY: The default flat color is made for light cards.
|
|
266
|
+
bars: { height: 30, barWidth: 10, gap: 4, padding: 14, round: 2 },
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
kpiBox.elem.title = "Bars: " + ProductsPage.CATEGORIES.map(function(category) { return category.name; }).join(", ");
|
|
270
|
+
setFlex(kpiBox, "1 1 220px");
|
|
271
|
+
kpiBoxList.push(kpiBox);
|
|
272
|
+
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
endGroup();
|
|
276
|
+
|
|
277
|
+
// WHY: Bar count was calculated with the default width (before flex).
|
|
278
|
+
kpiBoxList.forEach(function(kpiBox) { kpiBox.refresh(); });
|
|
279
|
+
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const initAlert = function() {
|
|
283
|
+
|
|
284
|
+
alertBox = HGroup({
|
|
285
|
+
width: "100%",
|
|
286
|
+
height: "auto",
|
|
287
|
+
align: "left center",
|
|
288
|
+
gap: 12,
|
|
289
|
+
padding: [16, 12],
|
|
290
|
+
color: "rgba(201, 133, 0, 0.10)",
|
|
291
|
+
border: 1,
|
|
292
|
+
borderColor: "rgba(201, 133, 0, 0.45)",
|
|
293
|
+
round: 12,
|
|
294
|
+
});
|
|
295
|
+
that.elem.style.flexWrap = "wrap";
|
|
296
|
+
|
|
297
|
+
lblAlert = Label({ text: "", fontSize: 14, textColor: Ink(0.9) });
|
|
298
|
+
setFlex(lblAlert, "1 1 300px");
|
|
299
|
+
|
|
300
|
+
ProductsPage.createButton("Show Low Stock", "", function() { setStockFilter("low"); });
|
|
301
|
+
ProductsPage.createButton("Show Out of Stock", "", function() { setStockFilter("out"); });
|
|
302
|
+
|
|
303
|
+
endGroup();
|
|
304
|
+
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const initToolbar = function() {
|
|
308
|
+
|
|
309
|
+
VGroup({ width: "100%", height: "auto", align: "left top", gap: 12, padding: 16, color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 12 });
|
|
310
|
+
|
|
311
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
|
|
312
|
+
that.elem.style.flexWrap = "wrap";
|
|
313
|
+
|
|
314
|
+
statusTabs = Tabs({
|
|
315
|
+
variant: "pill",
|
|
316
|
+
styleName: T.compStyle,
|
|
317
|
+
tabs: Theme.indexTabs(STATUS_TABS.map(function(status) { return (status) ? ProductsPage.STATUSES[status].label : "All"; })), // (the key of a tab is its index: self.value)
|
|
318
|
+
onChange: function(self) {
|
|
319
|
+
filter.status = STATUS_TABS[self.value];
|
|
320
|
+
render();
|
|
321
|
+
},
|
|
322
|
+
style: Theme.tabsStyle({ height: 40, barColor: S.FIELD_COLOR, borderColor: S.CARD_BORDER_COLOR, padding: [12, 6], activeColor: S.PRIMARY_COLOR }),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
SearchInput({
|
|
326
|
+
width: 240,
|
|
327
|
+
height: 40,
|
|
328
|
+
border: 1,
|
|
329
|
+
borderColor: S.CARD_BORDER_COLOR,
|
|
330
|
+
borderBottomStyle: "1px solid " + S.CARD_BORDER_COLOR,
|
|
331
|
+
round: 8,
|
|
332
|
+
color: S.FIELD_COLOR,
|
|
333
|
+
textColor: Ink(0.9),
|
|
334
|
+
fontSize: 14,
|
|
335
|
+
searchIconSize: 16,
|
|
336
|
+
placeholderText: "Name or SKU",
|
|
337
|
+
invertIconColor: T.invertIcon,
|
|
338
|
+
searchIconFile: LIB_PATH + "comp/search-input-v2/search.svg",
|
|
339
|
+
clearIconFile: LIB_PATH + "comp/search-input-v2/clear.svg",
|
|
340
|
+
onSearch: function(text) {
|
|
341
|
+
filter.search = text;
|
|
342
|
+
searchTimer = waitAndRun(searchTimer, render, 150);
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
that.position = "relative";
|
|
346
|
+
|
|
347
|
+
ProductsPage.createTinySelect(
|
|
348
|
+
[{ id: "", label: "All categories" }].concat(ProductsPage.CATEGORIES.map(function(category) { return { id: category.name, label: category.name }; })),
|
|
349
|
+
function(id) { filter.category = id; render(); }
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
stockSelect = ProductsPage.createTinySelect(STOCK_FILTERS, function(id) { filter.stock = id; render(); });
|
|
353
|
+
|
|
354
|
+
// Space
|
|
355
|
+
HGroup({ width: "auto", height: 1 });
|
|
356
|
+
that.elem.style.flex = "1 1 auto";
|
|
357
|
+
endGroup();
|
|
358
|
+
|
|
359
|
+
lblResultCount = Label({ text: "", fontSize: 13, textColor: Ink(0.55) });
|
|
360
|
+
|
|
361
|
+
endGroup();
|
|
362
|
+
|
|
363
|
+
endGroup();
|
|
364
|
+
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const initTable = function() {
|
|
368
|
+
|
|
369
|
+
HGroup({ width: "100%", height: 660, align: "left top" });
|
|
370
|
+
|
|
371
|
+
smartTable = SmartTable({
|
|
372
|
+
titleDataList: [
|
|
373
|
+
{ name: "", dataTitle: "image", dataType: "string", width: 64, shortable: 0 },
|
|
374
|
+
{ name: "PRODUCT", dataTitle: "name", dataType: "string", width: 280, shortable: 1 },
|
|
375
|
+
{ name: "SKU", dataTitle: "sku", dataType: "string", width: 140, shortable: 1 },
|
|
376
|
+
{ name: "CATEGORY", dataTitle: "category", dataType: "string", width: 140, shortable: 1 },
|
|
377
|
+
{ name: "PRICE", dataTitle: "price", dataType: "float", width: 120, shortable: 1 },
|
|
378
|
+
{ name: "STOCK", dataTitle: "stock", dataType: "integer", width: 150, shortable: 1 },
|
|
379
|
+
{ name: "STATUS", dataTitle: "status", dataType: "string", width: 120, shortable: 1 },
|
|
380
|
+
],
|
|
381
|
+
itemDataList: [],
|
|
382
|
+
titleHeight: 44,
|
|
383
|
+
itemHeight: 52,
|
|
384
|
+
infoHeight: 56,
|
|
385
|
+
itemLineCount: 10,
|
|
386
|
+
sortByTitleIndex: 1,
|
|
387
|
+
sortDirection: "A-Z",
|
|
388
|
+
onSelect: function(itemData) {
|
|
389
|
+
const product = getProducts().find(function(p) { return p.id == itemData.id; });
|
|
390
|
+
if (product) openEditor(product);
|
|
391
|
+
},
|
|
392
|
+
// Thumbnail cell (created one time for each visible row)
|
|
393
|
+
createCustomItemCell: function(cell, titleDataIndex) {
|
|
394
|
+
if (titleDataIndex != 0) return cell;
|
|
395
|
+
cell.label.visible = 0;
|
|
396
|
+
// WHY: The group is created in the current container and moved into the cell (like pages/users.js).
|
|
397
|
+
cell.thumbGroup = HGroup({ width: "100%", height: "100%", align: "center center" });
|
|
398
|
+
cell.add(cell.thumbGroup);
|
|
399
|
+
cell.thumb = Icon({ width: 36, height: 36, round: 6 });
|
|
400
|
+
cell.thumb.elem.style.objectFit = "cover";
|
|
401
|
+
cell.thumb.elem.alt = "";
|
|
402
|
+
endGroup();
|
|
403
|
+
return cell;
|
|
404
|
+
},
|
|
405
|
+
// WHY: SmartTable writes the raw value (numbers sort right). Texts and colors are written here.
|
|
406
|
+
updateCustomItemCell: function(cell, titleDataIndex, data) {
|
|
407
|
+
if (titleDataIndex == 0) {
|
|
408
|
+
cell.label.text = "";
|
|
409
|
+
if (cell.thumbUrl != data) {
|
|
410
|
+
cell.thumbUrl = data;
|
|
411
|
+
if (data) cell.thumb.load(data);
|
|
412
|
+
}
|
|
413
|
+
cell.thumb.visible = (data) ? 1 : 0;
|
|
414
|
+
}
|
|
415
|
+
if (titleDataIndex == 4 && data !== "") {
|
|
416
|
+
cell.label.text = ProductsPage.formatMoney(data);
|
|
417
|
+
}
|
|
418
|
+
if (titleDataIndex == 5 && data !== "") {
|
|
419
|
+
// WHY: The cell gets only its own value. The row data (itemData of the line) has the low stock limit.
|
|
420
|
+
const itemData = cell.containerBox.itemData;
|
|
421
|
+
const state = ProductsPage.getStockState(itemData);
|
|
422
|
+
const info = ProductsPage.STOCK_STATES[state];
|
|
423
|
+
cell.label.text = (state == "out") ? "Out of stock" : data + " · " + info.label;
|
|
424
|
+
cell.label.textColor = info.color;
|
|
425
|
+
}
|
|
426
|
+
if (titleDataIndex == 6) {
|
|
427
|
+
const status = ProductsPage.getStatusByLabel(data);
|
|
428
|
+
cell.label.textColor = (status) ? status.color : Ink(0.75);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
...ProductsPage.getSmartTableStyle(LIB_PATH),
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
endGroup();
|
|
435
|
+
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// *** PAGE INIT CODE:
|
|
439
|
+
|
|
440
|
+
// BOX: Scrollable container
|
|
441
|
+
// WHY: page does not scroll. Scrollable content must be inside a Box with scrollY: 1.
|
|
442
|
+
startBox(0, 0, "100%", "100%", {
|
|
443
|
+
color: "transparent",
|
|
444
|
+
scrollY: 1,
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
VGroup({
|
|
448
|
+
width: "100%",
|
|
449
|
+
height: "auto", // Grows with content, so the Box can scroll.
|
|
450
|
+
align: "left top",
|
|
451
|
+
gap: 16,
|
|
452
|
+
padding: 24,
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
initHeader();
|
|
456
|
+
initSummary();
|
|
457
|
+
initAlert();
|
|
458
|
+
initToolbar();
|
|
459
|
+
initTable();
|
|
460
|
+
|
|
461
|
+
endGroup();
|
|
462
|
+
|
|
463
|
+
endBox();
|
|
464
|
+
|
|
465
|
+
render();
|
|
466
|
+
|
|
467
|
+
box.endPage();
|
|
468
|
+
|
|
469
|
+
if (box.openProductId === "new") {
|
|
470
|
+
openEditor(null);
|
|
471
|
+
} else if (box.openProductId !== null) {
|
|
472
|
+
const product = ProductsPage.getProducts().find(function(p) { return p.id == box.openProductId; });
|
|
473
|
+
if (product) openEditor(product);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return box;
|
|
477
|
+
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
ProductsPage.KEY = "Products";
|
|
481
|
+
|
|
482
|
+
// *** PRODUCT EDITOR (RIGHT VIEW):
|
|
483
|
+
|
|
484
|
+
const ProductEditorDefaults = {
|
|
485
|
+
product: null, // null: New product
|
|
486
|
+
onChange: function() {},
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
const ProductEditor = function(params = {}) {
|
|
490
|
+
|
|
491
|
+
// Merge params:
|
|
492
|
+
mergeIntoIfMissing(params, ProductEditorDefaults);
|
|
493
|
+
|
|
494
|
+
params.left = 0;
|
|
495
|
+
params.top = 0;
|
|
496
|
+
params.width = "100%";
|
|
497
|
+
params.height = "100%";
|
|
498
|
+
params.color = T.surfaceDeep;
|
|
499
|
+
|
|
500
|
+
// WHY: product is a live object of the list. startObject() would copy it.
|
|
501
|
+
const product = params.product;
|
|
502
|
+
delete params.product;
|
|
503
|
+
|
|
504
|
+
// BOX: Component container
|
|
505
|
+
let box = startObject(params);
|
|
506
|
+
|
|
507
|
+
const S = ProductsPage.STYLE;
|
|
508
|
+
const isNew = !product;
|
|
509
|
+
const draft = (isNew) ? ProductsPage.createEmptyProduct() : JSON.parse(JSON.stringify(product));
|
|
510
|
+
const radioList = [];
|
|
511
|
+
let saveTimer = null;
|
|
512
|
+
|
|
513
|
+
// Components
|
|
514
|
+
let inputName, inputSku, inputDescription, categorySelect;
|
|
515
|
+
let inputPrice, inputCompare, inputCost, lblPriceInfo;
|
|
516
|
+
let inputStock, inputLowLimit, chkContinueSelling, lblStockInfo;
|
|
517
|
+
let imageFile, lblError, btnSave;
|
|
518
|
+
|
|
519
|
+
// *** PRODUCT SERVICE (TEST):
|
|
520
|
+
|
|
521
|
+
const saveProduct = function() {
|
|
522
|
+
|
|
523
|
+
const error = validate();
|
|
524
|
+
lblError.text = error;
|
|
525
|
+
if (error) return;
|
|
526
|
+
|
|
527
|
+
btnSave.elem.inert = true;
|
|
528
|
+
if (typeof waiting !== "undefined") waiting.open();
|
|
529
|
+
|
|
530
|
+
saveTimer = setTimeout(function() {
|
|
531
|
+
|
|
532
|
+
// TODO: Save with your service. Upload the new image files (imageFile.getFiles()) first.
|
|
533
|
+
const newImages = imageFile.getFiles().filter(function(info) { return info.type.startsWith("image/"); }).map(function(info) {
|
|
534
|
+
return URL.createObjectURL(info.file); // TEST: Local address of the file
|
|
535
|
+
});
|
|
536
|
+
draft.images = newImages.concat(draft.images);
|
|
537
|
+
draft.updatedAt = Date.now();
|
|
538
|
+
|
|
539
|
+
if (isNew) {
|
|
540
|
+
draft.id = ProductsPage.nextId++;
|
|
541
|
+
ProductsPage.getProducts().push(draft);
|
|
542
|
+
} else {
|
|
543
|
+
Object.assign(product, draft);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (typeof waiting !== "undefined") waiting.close();
|
|
547
|
+
|
|
548
|
+
box.onChange();
|
|
549
|
+
rightView.hide();
|
|
550
|
+
rightView.clean();
|
|
551
|
+
|
|
552
|
+
}, 400);
|
|
553
|
+
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
const deleteProduct = function() {
|
|
557
|
+
// TODO: Delete with your service.
|
|
558
|
+
const list = ProductsPage.getProducts();
|
|
559
|
+
const index = list.indexOf(product);
|
|
560
|
+
if (index >= 0) list.splice(index, 1);
|
|
561
|
+
box.onChange();
|
|
562
|
+
rightView.hide();
|
|
563
|
+
rightView.clean();
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
const duplicateProduct = function() {
|
|
567
|
+
// TODO: Create with your service.
|
|
568
|
+
const copy = JSON.parse(JSON.stringify(product));
|
|
569
|
+
copy.id = ProductsPage.nextId++;
|
|
570
|
+
copy.name = product.name + " (copy)";
|
|
571
|
+
copy.sku = ProductsPage.getUniqueSku(product.sku + "-COPY");
|
|
572
|
+
copy.status = "draft";
|
|
573
|
+
copy.updatedAt = Date.now();
|
|
574
|
+
ProductsPage.getProducts().push(copy);
|
|
575
|
+
box.onChange();
|
|
576
|
+
ProductEditor({ product: copy, onChange: box.onChange }); // Open the copy
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
// *** PRIVATE FUNCTIONS:
|
|
580
|
+
|
|
581
|
+
const toNumber = function(input) {
|
|
582
|
+
const text = input.getInputValue().trim();
|
|
583
|
+
return (text === "") ? null : Number(text);
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// Returns an error text, or "".
|
|
587
|
+
const validate = function() {
|
|
588
|
+
const sku = draft.sku;
|
|
589
|
+
if (!draft.name.trim()) return "Product name is required.";
|
|
590
|
+
if (!/^[A-Z0-9-]{3,30}$/.test(sku)) return "SKU: 3-30 capital letters, numbers or \"-\".";
|
|
591
|
+
if (ProductsPage.getProducts().some(function(p) { return p !== product && p.sku == sku; })) return "SKU " + sku + " is used by another product.";
|
|
592
|
+
if (!(draft.price > 0)) return "Price must be more than 0.";
|
|
593
|
+
if (draft.compareAtPrice !== null && draft.compareAtPrice <= draft.price) return "Compare-at price must be more than the price.";
|
|
594
|
+
if (!Number.isInteger(draft.stock) || draft.stock < 0) return "Stock must be a whole number (0 or more).";
|
|
595
|
+
return "";
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
const updatePriceInfo = function() {
|
|
599
|
+
const parts = [];
|
|
600
|
+
if (draft.compareAtPrice && draft.price > 0 && draft.compareAtPrice > draft.price) {
|
|
601
|
+
parts.push("<span style='color:" + S.ACCENT_COLOR + "'>" + Math.round((1 - draft.price / draft.compareAtPrice) * 100) + "% discount</span>");
|
|
602
|
+
}
|
|
603
|
+
if (draft.cost !== null && draft.price > 0) {
|
|
604
|
+
const profit = draft.price - draft.cost;
|
|
605
|
+
const color = (profit >= 0) ? Ink(0.8) : S.ERROR_COLOR;
|
|
606
|
+
parts.push("<span style='color:" + color + "'>Margin " + Math.round(profit / draft.price * 100) + "% (" + ProductsPage.formatMoney(profit) + " profit)</span>");
|
|
607
|
+
}
|
|
608
|
+
lblPriceInfo.text = parts.join(" · ") || "Add a cost to see the margin.";
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
const updateStockInfo = function() {
|
|
612
|
+
const state = ProductsPage.getStockState(draft);
|
|
613
|
+
const info = ProductsPage.STOCK_STATES[state];
|
|
614
|
+
lblStockInfo.text = "<span style='color:" + info.color + "'>● " + ((state == "out") ? "Out of stock" : info.label) + "</span>" +
|
|
615
|
+
((state == "out" && draft.continueSelling) ? " · Customers can still order (backorder)" : "");
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const setStock = function(value) {
|
|
619
|
+
inputStock.setInputValue(String(Math.max(0, value)));
|
|
620
|
+
draft.stock = Math.max(0, value);
|
|
621
|
+
updateStockInfo();
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
// *** VIEW HELPERS:
|
|
625
|
+
|
|
626
|
+
const startSection = function(title) {
|
|
627
|
+
const group = VGroup({ width: "100%", height: "auto", align: "left top", gap: 10, padding: [16, 14], color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 10 });
|
|
628
|
+
Label({ text: title.toUpperCase(), fontSize: 11, textColor: Ink(0.45) });
|
|
629
|
+
that.elem.style.letterSpacing = "1px";
|
|
630
|
+
return group;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// Dark style for InputB and NumberInputB
|
|
634
|
+
const createInput = function(Component, params) {
|
|
635
|
+
const input = Component({
|
|
636
|
+
width: "100%",
|
|
637
|
+
leftPadding: 14,
|
|
638
|
+
rightPadding: 36,
|
|
639
|
+
backgroundColor: S.FIELD_COLOR,
|
|
640
|
+
selectedBackgroundColor: T.surface3,
|
|
641
|
+
lineColor: "transparent",
|
|
642
|
+
selectedLineColor: "transparent",
|
|
643
|
+
backBorderColor: S.CARD_BORDER_COLOR,
|
|
644
|
+
selectedBackBorderColor: S.ACCENT_COLOR,
|
|
645
|
+
backBorderTopRound: 8,
|
|
646
|
+
backBorderBottomRound: 8,
|
|
647
|
+
requiredColor: S.ERROR_COLOR,
|
|
648
|
+
warningColor: S.ERROR_COLOR,
|
|
649
|
+
isRequired: 0,
|
|
650
|
+
...params,
|
|
651
|
+
});
|
|
652
|
+
// WHY: InputB has fixed text colors for light backgrounds.
|
|
653
|
+
input.title.textColor = Ink(0.45);
|
|
654
|
+
input.title.fontSize = 11;
|
|
655
|
+
input.title.elem.style.letterSpacing = "1px";
|
|
656
|
+
input.input.textColor = Ink(0.9);
|
|
657
|
+
input.input.fontSize = 15;
|
|
658
|
+
input.input.height = 32;
|
|
659
|
+
input.warningBall.borderColor = S.CARD_COLOR;
|
|
660
|
+
return input;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
const startRow = function() {
|
|
664
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 10 });
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
const flex = function(obj) {
|
|
668
|
+
obj.elem.style.flex = "1 1 0";
|
|
669
|
+
obj.elem.style.minWidth = "0";
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
box.destroy = function() {
|
|
673
|
+
clearTimeout(saveTimer);
|
|
674
|
+
radioList.forEach(function(radio) { radio.remove(); }); // WHY: Radio groups are static lists.
|
|
675
|
+
if (imageFile) imageFile.remove();
|
|
676
|
+
box.remove();
|
|
677
|
+
box = null;
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
// *** VIEW:
|
|
681
|
+
|
|
682
|
+
// Left line
|
|
683
|
+
Box(0, 0, 1, "100%", { color: Ink(0.12) });
|
|
684
|
+
|
|
685
|
+
// GROUP: Scrollable content
|
|
686
|
+
startBox(0, 0, "100%", "calc(100% - 76px)", { color: "transparent", scrollY: 1 });
|
|
687
|
+
|
|
688
|
+
VGroup({ width: "100%", height: "auto", align: "left top", gap: 14, padding: 20 });
|
|
689
|
+
|
|
690
|
+
// TITLE
|
|
691
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
|
|
692
|
+
that.elem.style.justifyContent = "space-between";
|
|
693
|
+
|
|
694
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
|
|
695
|
+
Label({ text: (isNew) ? "New Product" : "Edit Product", fontSize: 20, textColor: Ink(0.95) });
|
|
696
|
+
that.elem.style.fontFamily = "opensans-bold";
|
|
697
|
+
if (!isNew) {
|
|
698
|
+
Label({ text: "Last change: " + new Date(product.updatedAt).toLocaleString("en-GB", { dateStyle: "medium", timeStyle: "short" }), fontSize: 12, textColor: Ink(0.45) });
|
|
699
|
+
}
|
|
700
|
+
endGroup();
|
|
701
|
+
|
|
702
|
+
Icon({ width: 28, height: 28, clickable: 1 });
|
|
703
|
+
that.load("assets/close.png");
|
|
704
|
+
that.elem.style.filter = T.iconFilter;
|
|
705
|
+
that.elem.style.cursor = "pointer";
|
|
706
|
+
that.opacity = 0.6;
|
|
707
|
+
that.on("click", function() {
|
|
708
|
+
rightView.hide();
|
|
709
|
+
rightView.clean();
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
endGroup();
|
|
713
|
+
|
|
714
|
+
// PRODUCT
|
|
715
|
+
startSection("Product");
|
|
716
|
+
|
|
717
|
+
inputName = createInput(InputB, {
|
|
718
|
+
titleText: "NAME",
|
|
719
|
+
inputValue: draft.name, // WHY: Created with the value, so a required warning ball is not left on the screen.
|
|
720
|
+
placeholder: "Ex: Wireless Headphones",
|
|
721
|
+
maxChar: 80,
|
|
722
|
+
onEdit: function() { draft.name = inputName.getInputValue(); },
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
startRow();
|
|
726
|
+
|
|
727
|
+
inputSku = createInput(InputB, {
|
|
728
|
+
titleText: "SKU",
|
|
729
|
+
inputValue: draft.sku,
|
|
730
|
+
placeholder: "HP-BLK-01",
|
|
731
|
+
maxChar: 30,
|
|
732
|
+
onEdit: function() {
|
|
733
|
+
// Capital letters, numbers and "-"
|
|
734
|
+
const value = inputSku.getInputValue().toUpperCase().replace(/[^A-Z0-9-]/g, "");
|
|
735
|
+
if (value != inputSku.getInputValue()) inputSku.setInputValue(value);
|
|
736
|
+
draft.sku = value;
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
flex(inputSku);
|
|
740
|
+
|
|
741
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 6 });
|
|
742
|
+
flex(that);
|
|
743
|
+
Label({ text: "CATEGORY", fontSize: 11, textColor: Ink(0.45) });
|
|
744
|
+
that.elem.style.letterSpacing = "1px";
|
|
745
|
+
that.elem.style.marginTop = "4px";
|
|
746
|
+
categorySelect = ProductsPage.createTinySelect(
|
|
747
|
+
ProductsPage.CATEGORIES.map(function(category) { return { id: category.name, label: category.name }; }),
|
|
748
|
+
function(id) { draft.category = id; },
|
|
749
|
+
Math.max(0, ProductsPage.CATEGORIES.findIndex(function(category) { return category.name == draft.category; }))
|
|
750
|
+
);
|
|
751
|
+
endGroup();
|
|
752
|
+
|
|
753
|
+
endGroup();
|
|
754
|
+
|
|
755
|
+
inputDescription = createInput(InputB, {
|
|
756
|
+
titleText: "SHORT DESCRIPTION",
|
|
757
|
+
inputValue: draft.description,
|
|
758
|
+
placeholder: "One line for the product list (optional)",
|
|
759
|
+
maxChar: 120,
|
|
760
|
+
onEdit: function() { draft.description = inputDescription.getInputValue(); },
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
Label({ text: "STATUS", fontSize: 11, textColor: Ink(0.45) });
|
|
764
|
+
that.elem.style.letterSpacing = "1px";
|
|
765
|
+
|
|
766
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 20 });
|
|
767
|
+
that.elem.style.flexWrap = "wrap";
|
|
768
|
+
|
|
769
|
+
Object.keys(ProductsPage.STATUSES).forEach(function(status) {
|
|
770
|
+
const radio = RadioButton({
|
|
771
|
+
group: "productStatus",
|
|
772
|
+
value: status,
|
|
773
|
+
checked: (draft.status == status) ? 1 : 0,
|
|
774
|
+
labelText: ProductsPage.STATUSES[status].label + " <span style='font-size:12px; color:" + Ink(0.4) + "'>" + ProductsPage.STATUSES[status].desc + "</span>",
|
|
775
|
+
style: {
|
|
776
|
+
mark: { width: 20, height: 20, color: "transparent", borderColor: Ink(0.35) },
|
|
777
|
+
checkedMark: { color: "transparent", borderColor: S.ACCENT_COLOR },
|
|
778
|
+
hoverMark: { borderColor: Ink(0.7) },
|
|
779
|
+
dot: { color: S.ACCENT_COLOR },
|
|
780
|
+
label: { fontSize: 14, textColor: Ink(0.9) },
|
|
781
|
+
},
|
|
782
|
+
onChange: function(self) { draft.status = self.value; },
|
|
783
|
+
});
|
|
784
|
+
radioList.push(radio);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
endGroup();
|
|
788
|
+
|
|
789
|
+
endGroup();
|
|
790
|
+
|
|
791
|
+
// PRICING
|
|
792
|
+
startSection("Pricing");
|
|
793
|
+
|
|
794
|
+
startRow();
|
|
795
|
+
|
|
796
|
+
inputPrice = createInput(NumberInputB, {
|
|
797
|
+
titleText: "PRICE ($)",
|
|
798
|
+
inputValue: (draft.price) ? String(draft.price) : "",
|
|
799
|
+
placeholder: "0.00",
|
|
800
|
+
allowNegative: 0,
|
|
801
|
+
onEdit: function() { draft.price = toNumber(inputPrice) || 0; updatePriceInfo(); },
|
|
802
|
+
});
|
|
803
|
+
flex(inputPrice);
|
|
804
|
+
|
|
805
|
+
inputCompare = createInput(NumberInputB, {
|
|
806
|
+
titleText: "COMPARE-AT ($)",
|
|
807
|
+
inputValue: (draft.compareAtPrice !== null) ? String(draft.compareAtPrice) : "",
|
|
808
|
+
placeholder: "Old price",
|
|
809
|
+
allowNegative: 0,
|
|
810
|
+
onEdit: function() { draft.compareAtPrice = toNumber(inputCompare); updatePriceInfo(); },
|
|
811
|
+
});
|
|
812
|
+
flex(inputCompare);
|
|
813
|
+
|
|
814
|
+
inputCost = createInput(NumberInputB, {
|
|
815
|
+
titleText: "COST ($)",
|
|
816
|
+
inputValue: (draft.cost !== null) ? String(draft.cost) : "",
|
|
817
|
+
placeholder: "Not shown",
|
|
818
|
+
allowNegative: 0,
|
|
819
|
+
onEdit: function() { draft.cost = toNumber(inputCost); updatePriceInfo(); },
|
|
820
|
+
});
|
|
821
|
+
flex(inputCost);
|
|
822
|
+
|
|
823
|
+
endGroup();
|
|
824
|
+
|
|
825
|
+
lblPriceInfo = Label({ text: "", fontSize: 13, textColor: Ink(0.6), width: "100%" });
|
|
826
|
+
|
|
827
|
+
endGroup();
|
|
828
|
+
|
|
829
|
+
// INVENTORY
|
|
830
|
+
startSection("Inventory");
|
|
831
|
+
|
|
832
|
+
startRow();
|
|
833
|
+
|
|
834
|
+
inputStock = createInput(NumberInputB, {
|
|
835
|
+
titleText: "IN STOCK",
|
|
836
|
+
inputValue: String(draft.stock),
|
|
837
|
+
placeholder: "0",
|
|
838
|
+
allowNegative: 0,
|
|
839
|
+
allowDecimal: 0,
|
|
840
|
+
onEdit: function() { draft.stock = toNumber(inputStock) || 0; updateStockInfo(); },
|
|
841
|
+
});
|
|
842
|
+
flex(inputStock);
|
|
843
|
+
|
|
844
|
+
inputLowLimit = createInput(NumberInputB, {
|
|
845
|
+
titleText: "LOW STOCK AT",
|
|
846
|
+
inputValue: String(draft.lowStockLimit),
|
|
847
|
+
placeholder: "5",
|
|
848
|
+
allowNegative: 0,
|
|
849
|
+
allowDecimal: 0,
|
|
850
|
+
onEdit: function() { draft.lowStockLimit = toNumber(inputLowLimit) || 0; updateStockInfo(); },
|
|
851
|
+
});
|
|
852
|
+
flex(inputLowLimit);
|
|
853
|
+
|
|
854
|
+
endGroup();
|
|
855
|
+
|
|
856
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 8 });
|
|
857
|
+
that.elem.style.flexWrap = "wrap";
|
|
858
|
+
|
|
859
|
+
Label({ text: "Restock:", fontSize: 13, textColor: Ink(0.55) });
|
|
860
|
+
[10, 25, 50].forEach(function(amount) {
|
|
861
|
+
ProductsPage.createButton("+" + amount, "", function() { setStock(draft.stock + amount); });
|
|
862
|
+
});
|
|
863
|
+
ProductsPage.createButton("Set to 0", "", function() { setStock(0); });
|
|
864
|
+
|
|
865
|
+
endGroup();
|
|
866
|
+
|
|
867
|
+
chkContinueSelling = CheckBox({
|
|
868
|
+
labelText: "Continue selling when out of stock",
|
|
869
|
+
checked: (draft.continueSelling) ? 1 : 0,
|
|
870
|
+
style: {
|
|
871
|
+
layout: { padding: [0, 2] },
|
|
872
|
+
mark: { width: 20, height: 20, color: "transparent", borderColor: Ink(0.35) },
|
|
873
|
+
checkedMark: { color: S.PRIMARY_COLOR, borderColor: S.PRIMARY_COLOR },
|
|
874
|
+
hoverMark: { borderColor: Ink(0.7) },
|
|
875
|
+
tick: { color: Ink(1) },
|
|
876
|
+
label: { fontSize: 14, textColor: Ink(0.9) },
|
|
877
|
+
},
|
|
878
|
+
onChange: function(self) { draft.continueSelling = self.checked; updateStockInfo(); },
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
lblStockInfo = Label({ text: "", fontSize: 13, textColor: Ink(0.6), width: "100%" });
|
|
882
|
+
|
|
883
|
+
endGroup();
|
|
884
|
+
|
|
885
|
+
// IMAGES
|
|
886
|
+
startSection("Images");
|
|
887
|
+
|
|
888
|
+
if (draft.images.length) {
|
|
889
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 8 });
|
|
890
|
+
that.elem.style.flexWrap = "wrap";
|
|
891
|
+
draft.images.forEach(function(url, index) {
|
|
892
|
+
Icon({ width: 72, height: 72, round: 8, border: 1, borderColor: S.CARD_BORDER_COLOR });
|
|
893
|
+
that.load(url);
|
|
894
|
+
that.elem.style.objectFit = "cover";
|
|
895
|
+
that.elem.alt = "Image " + (index + 1);
|
|
896
|
+
});
|
|
897
|
+
endGroup();
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
imageFile = SelectFile({
|
|
901
|
+
width: "100%",
|
|
902
|
+
multiple: 1,
|
|
903
|
+
maxFiles: 6,
|
|
904
|
+
accept: "image/*",
|
|
905
|
+
maxSize: 5 * 1024 * 1024,
|
|
906
|
+
zoneHeight: 100,
|
|
907
|
+
showIcon: 0,
|
|
908
|
+
titleText: "Drop new images here",
|
|
909
|
+
descText: "or click to select (the first image is the main image)",
|
|
910
|
+
style: {
|
|
911
|
+
zone: { color: S.FIELD_COLOR, border: 2, borderColor: Ink(0.12), round: 10 },
|
|
912
|
+
zoneHover: { color: T.surface3, borderColor: Ink(0.3) },
|
|
913
|
+
zoneDragOver: { color: T.tableHighlight, borderColor: S.ACCENT_COLOR },
|
|
914
|
+
title: { fontSize: 14, textColor: Ink(0.9) },
|
|
915
|
+
desc: { fontSize: 13, textColor: Ink(0.5) },
|
|
916
|
+
hint: { textColor: Ink(0.4) },
|
|
917
|
+
item: { color: S.FIELD_COLOR, borderColor: Ink(0.1) },
|
|
918
|
+
itemName: { textColor: Ink(0.85) },
|
|
919
|
+
itemSize: { textColor: Ink(0.45) },
|
|
920
|
+
badge: { color: Ink(0.08), textColor: Ink(0.6) },
|
|
921
|
+
removeButton: { textColor: Ink(0.45), hoverColor: S.ERROR_COLOR },
|
|
922
|
+
},
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
endGroup();
|
|
926
|
+
|
|
927
|
+
endGroup();
|
|
928
|
+
|
|
929
|
+
endBox();
|
|
930
|
+
|
|
931
|
+
// GROUP: Buttons (bottom)
|
|
932
|
+
HGroup({ left: 0, bottom: 0, width: "100%", height: 76, align: "left center", gap: 8, padding: [20, 0] });
|
|
933
|
+
that.elem.style.borderTop = "1px solid " + Ink(0.08);
|
|
934
|
+
|
|
935
|
+
if (!isNew) {
|
|
936
|
+
|
|
937
|
+
const btnDelete = HoldToConfirmButton({
|
|
938
|
+
height: 40,
|
|
939
|
+
labelText: "Hold to Delete",
|
|
940
|
+
completedText: "DELETED",
|
|
941
|
+
iconFile: "_basic/comp/hold-to-confirm-button/trash.png",
|
|
942
|
+
holdingIconFile: "_basic/comp/hold-to-confirm-button/trash-red.png",
|
|
943
|
+
holdDuration: 1200,
|
|
944
|
+
resetDelay: 600,
|
|
945
|
+
style: {
|
|
946
|
+
layout: { gap: 6, padding: [14, 0] },
|
|
947
|
+
icon: { width: 20, height: 20 },
|
|
948
|
+
label: { fontSize: 14, textColor: Ink(0.9) },
|
|
949
|
+
holdingLabel: { fontSize: 14, textColor: "#B03A2E" },
|
|
950
|
+
completedLabel: { fontSize: 14, textColor: T.primaryActive },
|
|
951
|
+
box: { color: S.FIELD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 8 },
|
|
952
|
+
holdingBox: { color: "#FFD1CB", borderColor: S.ERROR_COLOR, round: 8 },
|
|
953
|
+
completedBox: { color: "#DFEFE6", borderColor: S.ACCENT_COLOR, round: 8 },
|
|
954
|
+
},
|
|
955
|
+
onConfirm: deleteProduct,
|
|
956
|
+
});
|
|
957
|
+
btnDelete.icon.elem.style.filter = T.iconFilter; // WHY: Only the normal icon is on a dark background.
|
|
958
|
+
|
|
959
|
+
ProductsPage.createButton("Duplicate", "", duplicateProduct);
|
|
960
|
+
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
lblError = Label({ text: "", fontSize: 13, textColor: S.ERROR_COLOR, textAlign: "right" });
|
|
964
|
+
lblError.elem.style.flex = "1 1 auto";
|
|
965
|
+
lblError.elem.style.minWidth = "0";
|
|
966
|
+
|
|
967
|
+
btnSave = ProductsPage.createButton((isNew) ? "Create Product" : "Save", "", saveProduct, { primary: 1 });
|
|
968
|
+
|
|
969
|
+
endGroup();
|
|
970
|
+
|
|
971
|
+
// *** INIT CODE:
|
|
972
|
+
|
|
973
|
+
updatePriceInfo();
|
|
974
|
+
updateStockInfo();
|
|
975
|
+
|
|
976
|
+
rightView.clean();
|
|
977
|
+
rightView.setKey(ProductEditor.KEY);
|
|
978
|
+
rightView.setWidth(580);
|
|
979
|
+
rightView.add(box);
|
|
980
|
+
rightView.show();
|
|
981
|
+
rightView.destroyPage = box.destroy;
|
|
982
|
+
|
|
983
|
+
if (isNew) inputName.input.inputElement.focus();
|
|
984
|
+
|
|
985
|
+
return endObject(box);
|
|
986
|
+
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
ProductEditor.KEY = "ProductEditor";
|
|
990
|
+
|
|
991
|
+
// *** STATIC: STYLE AND HELPERS
|
|
992
|
+
|
|
993
|
+
ProductsPage.STYLE = {
|
|
994
|
+
CARD_COLOR: T.surface,
|
|
995
|
+
CARD_BORDER_COLOR: Ink(0.1),
|
|
996
|
+
FIELD_COLOR: T.surface2,
|
|
997
|
+
PRIMARY_COLOR: T.primary,
|
|
998
|
+
ACCENT_COLOR: T.accent,
|
|
999
|
+
ERROR_COLOR: T.danger,
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
ProductsPage.STATUSES = {
|
|
1003
|
+
active: { label: "Active", desc: "On sale", color: T.accent },
|
|
1004
|
+
draft: { label: "Draft", desc: "Not visible", color: T.warning },
|
|
1005
|
+
archived: { label: "Archived", desc: "Old product", color: Theme.readable("#A9A79F") },
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
ProductsPage.STOCK_STATES = {
|
|
1009
|
+
in: { label: "In stock", color: Ink(0.8) },
|
|
1010
|
+
low: { label: "Low", color: Theme.readable("#E0A03C") },
|
|
1011
|
+
out: { label: "Out of stock", color: T.danger },
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
ProductsPage.CATEGORIES = [
|
|
1015
|
+
{ name: "Audio", color: T.info },
|
|
1016
|
+
{ name: "Wearables", color: "#9085E9" },
|
|
1017
|
+
{ name: "Shoes", color: "#D55181" },
|
|
1018
|
+
{ name: "Home", color: T.warning },
|
|
1019
|
+
{ name: "Bags", color: T.accent },
|
|
1020
|
+
{ name: "Books", color: T.danger },
|
|
1021
|
+
{ name: "Accessories", color: "#199E70" },
|
|
1022
|
+
];
|
|
1023
|
+
|
|
1024
|
+
// "in", "low" or "out"
|
|
1025
|
+
ProductsPage.getStockState = function(product) {
|
|
1026
|
+
if (product.stock <= 0) return "out";
|
|
1027
|
+
if (product.stock <= product.lowStockLimit) return "low";
|
|
1028
|
+
return "in";
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
ProductsPage.getStatusByLabel = function(label) {
|
|
1032
|
+
const id = Object.keys(ProductsPage.STATUSES).find(function(key) { return ProductsPage.STATUSES[key].label == label; });
|
|
1033
|
+
return (id) ? ProductsPage.STATUSES[id] : null;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
ProductsPage.formatMoney = function(value, digits = 2) {
|
|
1037
|
+
return ((value < 0) ? "-$" : "$") + Math.abs(value).toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
ProductsPage.getUniqueSku = function(sku) {
|
|
1041
|
+
let result = sku;
|
|
1042
|
+
let index = 2;
|
|
1043
|
+
while (ProductsPage.getProducts().some(function(p) { return p.sku == result; })) result = sku + "-" + index++;
|
|
1044
|
+
return result;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
ProductsPage.createEmptyProduct = function() {
|
|
1048
|
+
return {
|
|
1049
|
+
id: null,
|
|
1050
|
+
name: "",
|
|
1051
|
+
sku: "",
|
|
1052
|
+
category: ProductsPage.CATEGORIES[0].name,
|
|
1053
|
+
description: "",
|
|
1054
|
+
status: "draft",
|
|
1055
|
+
price: 0,
|
|
1056
|
+
compareAtPrice: null,
|
|
1057
|
+
cost: null,
|
|
1058
|
+
stock: 0,
|
|
1059
|
+
lowStockLimit: 5,
|
|
1060
|
+
continueSelling: 0,
|
|
1061
|
+
images: [],
|
|
1062
|
+
updatedAt: Date.now(),
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
// params: { primary: 1, width }
|
|
1067
|
+
ProductsPage.createButton = function(text, iconFile, onClick, params = {}) {
|
|
1068
|
+
const S = ProductsPage.STYLE;
|
|
1069
|
+
const btn = SmartButton({
|
|
1070
|
+
styleName: "classic",
|
|
1071
|
+
width: params.width || "auto",
|
|
1072
|
+
labelText: text,
|
|
1073
|
+
iconFile: iconFile || "",
|
|
1074
|
+
onClick: onClick,
|
|
1075
|
+
style: {
|
|
1076
|
+
layout: { gap: 8, padding: [14, 8] },
|
|
1077
|
+
icon: { width: 18, height: 18 },
|
|
1078
|
+
label: { fontSize: 14, textColor: Ink(0.92) },
|
|
1079
|
+
box: { color: (params.primary) ? S.PRIMARY_COLOR : S.FIELD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 8 },
|
|
1080
|
+
hover: { color: (params.primary) ? T.primaryHover : T.surface3 },
|
|
1081
|
+
active: { color: (params.primary) ? T.primaryActive : T.surface4 },
|
|
1082
|
+
},
|
|
1083
|
+
});
|
|
1084
|
+
if (btn.icon) btn.icon.elem.style.filter = T.iconFilter; // WHY: Panel icons are black.
|
|
1085
|
+
return btn;
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// selectedIndex: The first selected item
|
|
1089
|
+
ProductsPage.createTinySelect = function(list, onSelect, selectedIndex = 0) {
|
|
1090
|
+
const S = ProductsPage.STYLE;
|
|
1091
|
+
let isReady = 0; // WHY: TinySelect calls onSelect when it is created.
|
|
1092
|
+
const select = TinySelect({
|
|
1093
|
+
list: list,
|
|
1094
|
+
selectedIndex: selectedIndex,
|
|
1095
|
+
height: 40,
|
|
1096
|
+
fontSize: 14,
|
|
1097
|
+
color: S.FIELD_COLOR,
|
|
1098
|
+
border: 1,
|
|
1099
|
+
borderColor: S.CARD_BORDER_COLOR,
|
|
1100
|
+
round: 8,
|
|
1101
|
+
labelBoldFont: 0,
|
|
1102
|
+
labelTextColor: Ink(0.9),
|
|
1103
|
+
arrowIcon: "_basic/comp/tiny-select/arrow.svg",
|
|
1104
|
+
arrowSize: 18,
|
|
1105
|
+
invertIconColor: T.invertIcon,
|
|
1106
|
+
listFontSize: 14,
|
|
1107
|
+
listTextColor: Ink(0.85),
|
|
1108
|
+
listOverTextColor: S.ACCENT_COLOR,
|
|
1109
|
+
listBackgroundColor: S.FIELD_COLOR,
|
|
1110
|
+
listBorderColor: Ink(0.15),
|
|
1111
|
+
onSelect: function(index, id) {
|
|
1112
|
+
if (isReady) onSelect(id);
|
|
1113
|
+
},
|
|
1114
|
+
});
|
|
1115
|
+
isReady = 1;
|
|
1116
|
+
return select;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
ProductsPage.getSmartTableStyle = function(libPath) {
|
|
1120
|
+
const S = ProductsPage.STYLE;
|
|
1121
|
+
return {
|
|
1122
|
+
scrollBarParams: {
|
|
1123
|
+
bar_border: 0, bar_round: 3, bar_borderColor: Ink(0.15), bar_width: 4, bar_mouseOverWidth: 4,
|
|
1124
|
+
bar_mouseOverColor: T.scrollBar, bar_opacity: 0.4, bar_mouseOverOpacity: 0.9, bar_padding: 2, bar_color: T.scrollBar,
|
|
1125
|
+
neverHide: 0, showDots: 0,
|
|
1126
|
+
},
|
|
1127
|
+
// WHY: Filtre kutusu ile alt bar aynı renkti, kutu görünmüyordu. Bar kart rengine, kutu ise alan rengine (FIELD_COLOR) alındı.
|
|
1128
|
+
searchInputParams: {
|
|
1129
|
+
width: "50%", height: 34, border: 1, round: 8, color: S.FIELD_COLOR, borderColor: S.CARD_BORDER_COLOR,
|
|
1130
|
+
borderBottomStyle: "1px solid " + S.CARD_BORDER_COLOR,
|
|
1131
|
+
textColor: Ink(0.9), placeholderColor: Ink(0.4), fontSize: 14,
|
|
1132
|
+
placeholderText: "Filter the table",
|
|
1133
|
+
searchIconSize: 15, searchIconOpacity: 0.55, invertIconColor: T.invertIcon,
|
|
1134
|
+
searchIconFile: libPath + "comp/search-input-v2/filter.png",
|
|
1135
|
+
clearIconFile: libPath + "comp/search-input-v2/clear.svg",
|
|
1136
|
+
},
|
|
1137
|
+
// Filtre kutusundaki sütun seçim listesi (ALL) de koyu tema ile açılsın.
|
|
1138
|
+
searchTitleMenuParams: {
|
|
1139
|
+
minWidth: 170,
|
|
1140
|
+
style: {
|
|
1141
|
+
menu: { color: S.FIELD_COLOR, border: 1, borderColor: Ink(0.12), round: 8, padding: 4, shadow: "0 8px 24px " + Black(0.5) },
|
|
1142
|
+
item: { height: 30, fontSize: 13, textColor: Ink(0.75), color: "transparent", round: 6, padding: 10, gap: 10 },
|
|
1143
|
+
itemHover: { textColor: "white", color: Ink(0.08) },
|
|
1144
|
+
disabled: { textColor: Ink(0.3), opacity: 0.4 },
|
|
1145
|
+
icon: { width: 14, height: 14 },
|
|
1146
|
+
separator: { color: Ink(0.1), space: 4 },
|
|
1147
|
+
},
|
|
1148
|
+
},
|
|
1149
|
+
style: {
|
|
1150
|
+
width: "100%",
|
|
1151
|
+
height: "100%",
|
|
1152
|
+
round: 8,
|
|
1153
|
+
line1Color: S.CARD_COLOR,
|
|
1154
|
+
line2Color: T.tableRow2,
|
|
1155
|
+
highlightItemCellColor: T.tableHighlight,
|
|
1156
|
+
highlightTitleCellColor: Ink(0.08),
|
|
1157
|
+
verticalScrollWidth: 20,
|
|
1158
|
+
verticalScrollMargin: 2,
|
|
1159
|
+
btnScrollDownIconFile: libPath + "comp/smart-table/down.png",
|
|
1160
|
+
btnScrollUpIconFile: libPath + "comp/smart-table/up.png",
|
|
1161
|
+
btnScrollCenterIconFile: libPath + "comp/smart-table/scroll.png",
|
|
1162
|
+
sortIconFile: libPath + "comp/smart-table/sort.png",
|
|
1163
|
+
// WHY: Varsayılan tik ikonu koyu renkli; koyu menüde görünmüyordu.
|
|
1164
|
+
searchTitleCheckIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="' + S.ACCENT_COLOR + '" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),
|
|
1165
|
+
loadingIconFile: libPath + "comp/smart-table/clock.png",
|
|
1166
|
+
invertIconColor: T.invertIcon,
|
|
1167
|
+
box: { color: S.CARD_COLOR },
|
|
1168
|
+
boxBorder: { border: 1, borderColor: S.CARD_BORDER_COLOR },
|
|
1169
|
+
boxTitleLine: { color: S.FIELD_COLOR },
|
|
1170
|
+
boxTitleCell: { padding: [10, 0], borderRight: "1px solid " + Ink(0.06), borderBottom: "1px solid " + Ink(0.12) },
|
|
1171
|
+
lblTitleCell: { fontSize: 13, fontFamily: "opensans", textColor: Ink(0.6) },
|
|
1172
|
+
boxItemCell: { borderBottom: "1px solid " + Ink(0.05), borderRight: "1px solid " + Ink(0.03), padding: [10, 0] },
|
|
1173
|
+
lblItemCell: { fontSize: 14, textColor: Ink(0.75), fontFamily: "opensans" },
|
|
1174
|
+
boxInfoLine: { color: S.CARD_COLOR, borderTop: "1px solid " + Ink(0.08) },
|
|
1175
|
+
lblBoxInfoLine: { fontSize: 13, textColor: Ink(0.55) },
|
|
1176
|
+
lblNoDataFound: { color: T.surface3, textColor: Ink(0.6), padding: [8, 2], fontSize: 13, round: 8, border: 1, borderColor: Ink(0.15) },
|
|
1177
|
+
// Filtre kutusunun içindeki sütun etiketi: Kutunun içinde durduğu için daha hafif bir chip.
|
|
1178
|
+
lblSearchTitle: { color: Ink(0.08), textColor: Ink(0.6), padding: [8, 1], fontSize: 12, round: 6, border: 1, borderColor: Ink(0.14) },
|
|
1179
|
+
btnScrollCenter: { color: T.surface3, round: 100, borderColor: Ink(0.2), border: 1 },
|
|
1180
|
+
btnScrollUp: { color: T.surface4, round: 100, border: 1, borderColor: Ink(0.3) },
|
|
1181
|
+
btnScrollDown: { color: T.surface4, round: 100, border: 1, borderColor: Ink(0.3) },
|
|
1182
|
+
boxSort: { color: S.PRIMARY_COLOR },
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
// *** STATIC: TEST DATA
|
|
1188
|
+
|
|
1189
|
+
ProductsPage._products = null;
|
|
1190
|
+
ProductsPage.nextId = 1;
|
|
1191
|
+
|
|
1192
|
+
// Product thumbnail: category color and the first letters (SVG data URL)
|
|
1193
|
+
ProductsPage.createThumbnail = function(name, color) {
|
|
1194
|
+
const letters = name.split(" ").map(function(word) { return word[0]; }).join("").slice(0, 2).toUpperCase();
|
|
1195
|
+
const svg = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'>" +
|
|
1196
|
+
"<rect width='72' height='72' fill='" + color + "'/>" +
|
|
1197
|
+
"<circle cx='58' cy='14' r='22' fill='rgba(255,255,255,0.15)'/>" +
|
|
1198
|
+
"<text x='36' y='45' font-family='sans-serif' font-size='26' font-weight='bold' fill='white' text-anchor='middle'>" + letters + "</text>" +
|
|
1199
|
+
"</svg>";
|
|
1200
|
+
return "data:image/svg+xml," + encodeURIComponent(svg);
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// Products. Created one time and kept while the panel is open.
|
|
1204
|
+
// TODO: Load the products from your service.
|
|
1205
|
+
ProductsPage.getProducts = function() {
|
|
1206
|
+
|
|
1207
|
+
if (ProductsPage._products) return ProductsPage._products;
|
|
1208
|
+
|
|
1209
|
+
// Random numbers with a seed: the same test data every time. (mulberry32)
|
|
1210
|
+
let seed = 7031;
|
|
1211
|
+
const rnd = function() {
|
|
1212
|
+
seed = (seed + 0x6D2B79F5) | 0;
|
|
1213
|
+
let t = seed;
|
|
1214
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
1215
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
1216
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
// [category, base names, price range]
|
|
1220
|
+
const CATALOG = [
|
|
1221
|
+
["Audio", ["Wireless Headphones", "Bluetooth Speaker", "Earbuds Pro", "Studio Monitor", "Soundbar Mini"], [39, 249]],
|
|
1222
|
+
["Wearables", ["Smart Watch Fit", "Fitness Band", "Sport Watch GPS", "Smart Ring"], [49, 299]],
|
|
1223
|
+
["Shoes", ["Running Shoes", "Trail Shoes", "Canvas Sneakers", "Walking Shoes"], [45, 140]],
|
|
1224
|
+
["Home", ["Ceramic Coffee Mug", "Desk Lamp", "Wall Clock", "Plant Pot", "Throw Blanket"], [9, 79]],
|
|
1225
|
+
["Bags", ["Backpack 20L", "Laptop Sleeve", "Travel Duffel", "Tote Bag"], [19, 129]],
|
|
1226
|
+
["Books", ["Modern JavaScript", "Clean Design", "The Web Book", "Learning SQL"], [15, 45]],
|
|
1227
|
+
["Accessories", ["USB-C Cable", "Phone Stand", "Wireless Charger", "Screen Cleaner", "Cable Organizer"], [6, 49]],
|
|
1228
|
+
];
|
|
1229
|
+
|
|
1230
|
+
const VARIANTS = ["Black", "White", "Grey", "Blue", "Green"];
|
|
1231
|
+
const list = [];
|
|
1232
|
+
|
|
1233
|
+
CATALOG.forEach(function(entry) {
|
|
1234
|
+
|
|
1235
|
+
const category = ProductsPage.CATEGORIES.find(function(c) { return c.name == entry[0]; });
|
|
1236
|
+
|
|
1237
|
+
entry[1].forEach(function(baseName, baseIndex) {
|
|
1238
|
+
|
|
1239
|
+
const variantCount = 1 + Math.floor(rnd() * 3);
|
|
1240
|
+
|
|
1241
|
+
for (let v = 0; v < variantCount; v++) {
|
|
1242
|
+
|
|
1243
|
+
const variant = VARIANTS[(baseIndex + v) % VARIANTS.length];
|
|
1244
|
+
const name = baseName + " (" + variant + ")";
|
|
1245
|
+
const price = Math.round((entry[2][0] + rnd() * (entry[2][1] - entry[2][0]))) - 0.01;
|
|
1246
|
+
const stockRoll = rnd();
|
|
1247
|
+
const stock = (stockRoll < 0.1) ? 0 : (stockRoll < 0.25) ? 1 + Math.floor(rnd() * 5) : 6 + Math.floor(rnd() * 180);
|
|
1248
|
+
const statusRoll = rnd();
|
|
1249
|
+
|
|
1250
|
+
// WHY: Short SKUs of different names can be the same ("Smart Watch", "Smart Ring").
|
|
1251
|
+
let sku = (entry[0].slice(0, 2) + "-" + baseName.replace(/[^A-Za-z]/g, "").slice(0, 3) + "-" + variant.slice(0, 3)).toUpperCase();
|
|
1252
|
+
const baseSku = sku;
|
|
1253
|
+
for (let n = 2; list.some(function(p) { return p.sku == sku; }); n++) sku = baseSku + "-" + n;
|
|
1254
|
+
|
|
1255
|
+
list.push({
|
|
1256
|
+
id: ProductsPage.nextId++,
|
|
1257
|
+
name: name,
|
|
1258
|
+
sku: sku,
|
|
1259
|
+
category: entry[0],
|
|
1260
|
+
description: "",
|
|
1261
|
+
status: (statusRoll < 0.8) ? "active" : (statusRoll < 0.92) ? "draft" : "archived",
|
|
1262
|
+
price: price,
|
|
1263
|
+
compareAtPrice: (rnd() < 0.2) ? Math.round(price * 1.25) - 0.01 : null,
|
|
1264
|
+
cost: Math.round(price * (0.4 + rnd() * 0.25) * 100) / 100,
|
|
1265
|
+
stock: stock,
|
|
1266
|
+
lowStockLimit: 5,
|
|
1267
|
+
continueSelling: 0,
|
|
1268
|
+
images: [ProductsPage.createThumbnail(baseName, category.color)],
|
|
1269
|
+
updatedAt: Date.now() - Math.floor(rnd() * 60) * 86400000,
|
|
1270
|
+
});
|
|
1271
|
+
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
ProductsPage._products = list;
|
|
1279
|
+
return list;
|
|
1280
|
+
|
|
1281
|
+
};
|