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,1171 @@
|
|
|
1
|
+
/* Bismillah */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
Customers Page (Template) - v26.09
|
|
6
|
+
|
|
7
|
+
- The customers of the store (CRM): summary cards, segment tabs with counts, search, sort and a customer table.
|
|
8
|
+
- Customer panel (right view): lifetime stats, contact details (edit), tags, marketing consent, notes with a
|
|
9
|
+
timeline, order history (opens the order on the Orders page), e-mail, block / unblock, delete (hold to confirm).
|
|
10
|
+
- Segments (automatic): Lead (registered, no order yet), At risk (last order more than 45 days ago), New (first
|
|
11
|
+
order in the last 30 days), VIP (top 30% of the spending), Regular (the rest).
|
|
12
|
+
- Data: The customers with orders come from the Orders page (OrdersPage.getOrders()), so the totals match the
|
|
13
|
+
orders. Some registered customers without orders are added as test data. CRM fields (tags, notes, consent,
|
|
14
|
+
blocked) are kept while the panel is open. Replace CustomersPage.getCustomers() and the "CUSTOMER SERVICE"
|
|
15
|
+
functions with your service.
|
|
16
|
+
|
|
17
|
+
COMPONENTS:
|
|
18
|
+
- Tabs (comp-m4), SearchInput, TinySelect (comp-m2): Filters
|
|
19
|
+
- SmartTable (comp-m3): Customer list
|
|
20
|
+
- InputB (comp-m2): Contact details, tag and note inputs
|
|
21
|
+
- Toggle (comp-m2): Marketing consent
|
|
22
|
+
- TinyTable (comp-m4): Order history
|
|
23
|
+
- SmartButton (comp-m4), HoldToConfirmButton (comp-m3): Actions
|
|
24
|
+
- Dialog, LoadingScreen (comp-m4; Theme.confirm, waiting): Confirm, saving
|
|
25
|
+
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
CustomersPageDefaults = {
|
|
29
|
+
color: "transparent",
|
|
30
|
+
openCustomerId: null, // Opens the panel of this customer. (Ex: from the search on the top bar)
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const CustomersPage = function(params = {}) {
|
|
34
|
+
|
|
35
|
+
// BOX: Page container
|
|
36
|
+
let box = startPage(params, CustomersPageDefaults, mainView);
|
|
37
|
+
|
|
38
|
+
mainView.setKey(CustomersPage.KEY);
|
|
39
|
+
|
|
40
|
+
// *** PRIVATE VARIABLES:
|
|
41
|
+
|
|
42
|
+
const ASSETS = "assets/";
|
|
43
|
+
const LIB_PATH = "_basic/";
|
|
44
|
+
const S = CustomersPage.STYLE;
|
|
45
|
+
const SEGMENTS = CustomersPage.SEGMENTS;
|
|
46
|
+
|
|
47
|
+
const TABS = ["", "vip", "regular", "new", "risk", "lead"]; // "": All
|
|
48
|
+
|
|
49
|
+
const SORTS = [
|
|
50
|
+
{ id: "spent", label: "Highest spending" },
|
|
51
|
+
{ id: "recent", label: "Most recent order" },
|
|
52
|
+
{ id: "orders", label: "Most orders" },
|
|
53
|
+
{ id: "name", label: "Name A-Z" },
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const filter = {
|
|
57
|
+
segment: "",
|
|
58
|
+
search: "",
|
|
59
|
+
consent: "",
|
|
60
|
+
sortId: "spent",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
let searchTimer = null;
|
|
64
|
+
|
|
65
|
+
// Components
|
|
66
|
+
let segmentTabs;
|
|
67
|
+
let statCards = [];
|
|
68
|
+
let lblResultCount, smartTable;
|
|
69
|
+
|
|
70
|
+
// *** PRIVATE FUNCTIONS:
|
|
71
|
+
|
|
72
|
+
// All filters except the segment (used for the tab counts too)
|
|
73
|
+
const matchesFilters = function(customer) {
|
|
74
|
+
if (filter.consent == "yes" && !customer.consent) return false;
|
|
75
|
+
if (filter.consent == "no" && customer.consent) return false;
|
|
76
|
+
if (filter.consent == "blocked" && !customer.blocked) return false;
|
|
77
|
+
const search = filter.search.trim().toLowerCase();
|
|
78
|
+
if (search) {
|
|
79
|
+
const text = (customer.name + " " + customer.email + " " + customer.city + " " + customer.tags.join(" ")).toLowerCase();
|
|
80
|
+
if (!text.includes(search)) return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const sortList = function(list) {
|
|
86
|
+
const sorted = list.slice();
|
|
87
|
+
if (filter.sortId == "spent") sorted.sort(function(a, b) { return b.totalSpent - a.totalSpent; });
|
|
88
|
+
if (filter.sortId == "recent") sorted.sort(function(a, b) { return b.lastOrderAt - a.lastOrderAt; });
|
|
89
|
+
if (filter.sortId == "orders") sorted.sort(function(a, b) { return b.orderCount - a.orderCount; });
|
|
90
|
+
if (filter.sortId == "name") sorted.sort(function(a, b) { return a.name.localeCompare(b.name); });
|
|
91
|
+
return sorted;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const render = function() {
|
|
95
|
+
|
|
96
|
+
const all = CustomersPage.getCustomers();
|
|
97
|
+
all.forEach(CustomersPage.recompute);
|
|
98
|
+
all.forEach(function(c) { c.segment = CustomersPage.getSegment(c); });
|
|
99
|
+
const list = all.filter(matchesFilters);
|
|
100
|
+
|
|
101
|
+
TABS.forEach(function(segment, index) {
|
|
102
|
+
const count = (segment) ? list.filter(function(c) { return c.segment == segment; }).length : list.length;
|
|
103
|
+
segmentTabs.setCount(index, count);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const shown = sortList((filter.segment) ? list.filter(function(c) { return c.segment == filter.segment; }) : list);
|
|
107
|
+
|
|
108
|
+
// WHY: SmartTable sorts by the column, so the toolbar sort is applied by the "order" number.
|
|
109
|
+
smartTable.setItemDataList(shown.map(function(c, index) {
|
|
110
|
+
return {
|
|
111
|
+
order: index + 1,
|
|
112
|
+
id: c.id,
|
|
113
|
+
name: c.name + ((c.blocked) ? " (blocked)" : ""),
|
|
114
|
+
email: c.email,
|
|
115
|
+
city: c.city,
|
|
116
|
+
orders: c.orderCount,
|
|
117
|
+
spent: c.totalSpent,
|
|
118
|
+
lastOrder: (c.lastOrderAt) ? OrdersPage.formatDateTime(c.lastOrderAt).slice(0, 10) : "—",
|
|
119
|
+
segment: SEGMENTS[c.segment].label,
|
|
120
|
+
};
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
lblResultCount.text = shown.length + " of " + all.length + " customers";
|
|
124
|
+
|
|
125
|
+
renderSummary(all);
|
|
126
|
+
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const renderSummary = function(all) {
|
|
130
|
+
|
|
131
|
+
const withOrders = all.filter(function(c) { return c.orderCount > 0; });
|
|
132
|
+
const revenue = withOrders.reduce(function(sum, c) { return sum + c.totalSpent; }, 0);
|
|
133
|
+
const count = function(segment) { return all.filter(function(c) { return c.segment == segment; }).length; };
|
|
134
|
+
const monthAgo = Date.now() - 30 * CustomersPage.DAY;
|
|
135
|
+
|
|
136
|
+
const values = [
|
|
137
|
+
{ value: all.length, desc: all.filter(function(c) { return c.registeredAt > monthAgo; }).length + " registered this month" },
|
|
138
|
+
{ value: count("vip"), desc: count("new") + " new · " + count("lead") + " leads" },
|
|
139
|
+
{ value: count("risk"), desc: "No order in the last 45 days" },
|
|
140
|
+
{ value: (withOrders.length) ? OrdersPage.formatMoney(revenue / withOrders.length) : "—", desc: "Average lifetime value" },
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
statCards.forEach(function(card, index) {
|
|
144
|
+
card.lblValue.text = String(values[index].value);
|
|
145
|
+
card.lblDesc.text = values[index].desc;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const exportCSV = function() {
|
|
151
|
+
|
|
152
|
+
const rows = smartTable.visibleItemDataList;
|
|
153
|
+
const quote = function(value) { return "\"" + String(value).replace(/"/g, "\"\"") + "\""; };
|
|
154
|
+
const lines = ["id,name,email,city,orders,spent,last_order,segment"].concat(rows.map(function(row) {
|
|
155
|
+
return [row.id, row.name, row.email, row.city, row.orders, row.spent, row.lastOrder, row.segment].map(quote).join(",");
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
const link = document.createElement("a");
|
|
159
|
+
link.href = URL.createObjectURL(new Blob([lines.join("\n")], { type: "text/csv" }));
|
|
160
|
+
link.download = "customers-" + OrdersPage.formatDateTime(Date.now()).slice(0, 10) + ".csv";
|
|
161
|
+
link.click();
|
|
162
|
+
URL.revokeObjectURL(link.href);
|
|
163
|
+
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const openDetails = function(customerId) {
|
|
167
|
+
CustomerDetails({
|
|
168
|
+
customerId: customerId,
|
|
169
|
+
onChange: function() {
|
|
170
|
+
if (box) render();
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const closeDetails = function() {
|
|
176
|
+
if (rightView.isShown(CustomerDetails.KEY)) {
|
|
177
|
+
rightView.hide();
|
|
178
|
+
rightView.clean();
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// *** VIEW HELPERS:
|
|
183
|
+
|
|
184
|
+
const setFlex = function(obj, flex) {
|
|
185
|
+
obj.elem.style.flex = flex;
|
|
186
|
+
obj.elem.style.minWidth = "0";
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// *** PUBLIC FUNCTIONS:
|
|
190
|
+
|
|
191
|
+
box.destroy = function() {
|
|
192
|
+
|
|
193
|
+
clearTimeout(searchTimer);
|
|
194
|
+
closeDetails();
|
|
195
|
+
|
|
196
|
+
// WHY: SmartTable has window events and a menu on the page. box.remove() does not remove them.
|
|
197
|
+
if (smartTable) smartTable.remove();
|
|
198
|
+
|
|
199
|
+
box.remove();
|
|
200
|
+
box = null;
|
|
201
|
+
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// *** PAGE VIEW:
|
|
205
|
+
|
|
206
|
+
const initHeader = function() {
|
|
207
|
+
|
|
208
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 16 });
|
|
209
|
+
that.elem.style.flexWrap = "wrap";
|
|
210
|
+
that.elem.style.justifyContent = "space-between";
|
|
211
|
+
|
|
212
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
|
|
213
|
+
|
|
214
|
+
Label({ text: "Customers", fontSize: 26, textColor: Ink(0.95) });
|
|
215
|
+
that.elem.style.fontFamily = "opensans-bold";
|
|
216
|
+
|
|
217
|
+
Label({ text: "Who buys from your store, what they spend and how to reach them", fontSize: 14, textColor: Ink(0.5) });
|
|
218
|
+
|
|
219
|
+
endGroup();
|
|
220
|
+
|
|
221
|
+
HGroup({ width: "auto", height: "auto", align: "left center", gap: 8 });
|
|
222
|
+
CustomersPage.createButton("Export CSV", ASSETS + "arrow_down.png", exportCSV);
|
|
223
|
+
CustomersPage.createButton("E-mail Segment", ASSETS + "top-bar/comment.png", function() {
|
|
224
|
+
const emails = smartTable.visibleItemDataList.map(function(row) { return row.email; });
|
|
225
|
+
if (!emails.length) return;
|
|
226
|
+
// WHY: BCC, so the customers do not see each other. Long lists must go through your e-mail service.
|
|
227
|
+
window.location.href = "mailto:?bcc=" + encodeURIComponent(emails.slice(0, 50).join(","));
|
|
228
|
+
});
|
|
229
|
+
endGroup();
|
|
230
|
+
|
|
231
|
+
endGroup();
|
|
232
|
+
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const initSummary = function() {
|
|
236
|
+
|
|
237
|
+
const CARD_LIST = [
|
|
238
|
+
{ title: "Customers", color: Ink(0.95) },
|
|
239
|
+
{ title: "VIP customers", color: CustomersPage.SEGMENTS.vip.color },
|
|
240
|
+
{ title: "At risk", color: CustomersPage.SEGMENTS.risk.color },
|
|
241
|
+
{ title: "Lifetime value", color: S.ACCENT_COLOR },
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 16 });
|
|
245
|
+
that.elem.style.flexWrap = "wrap";
|
|
246
|
+
|
|
247
|
+
CARD_LIST.forEach(function(item) {
|
|
248
|
+
|
|
249
|
+
const card = VGroup({ width: "auto", height: "auto", align: "left top", gap: 2, padding: 14, color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 12 });
|
|
250
|
+
setFlex(card, "1 1 200px");
|
|
251
|
+
|
|
252
|
+
Label({ text: item.title, fontSize: 13, textColor: Ink(0.5) });
|
|
253
|
+
card.lblValue = Label({ text: "", fontSize: 26, textColor: item.color });
|
|
254
|
+
card.lblDesc = Label({ text: "", fontSize: 12, textColor: Ink(0.45) });
|
|
255
|
+
|
|
256
|
+
endGroup();
|
|
257
|
+
|
|
258
|
+
statCards.push(card);
|
|
259
|
+
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
endGroup();
|
|
263
|
+
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const initToolbar = function() {
|
|
267
|
+
|
|
268
|
+
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 });
|
|
269
|
+
|
|
270
|
+
HGroup({ width: "100%", height: "auto", align: "left top" });
|
|
271
|
+
that.elem.style.overflowX = "auto";
|
|
272
|
+
|
|
273
|
+
segmentTabs = Tabs({
|
|
274
|
+
variant: "pill",
|
|
275
|
+
styleName: T.compStyle,
|
|
276
|
+
tabs: Theme.indexTabs(TABS.map(function(segment) { return (segment) ? SEGMENTS[segment].label : "All"; })), // (the key of a tab is its index: self.value)
|
|
277
|
+
onChange: function(self) {
|
|
278
|
+
filter.segment = TABS[self.value];
|
|
279
|
+
render();
|
|
280
|
+
},
|
|
281
|
+
style: Theme.tabsStyle({ height: 40, barColor: S.FIELD_COLOR, borderColor: S.CARD_BORDER_COLOR, padding: [12, 6], activeColor: S.PRIMARY_COLOR }),
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
endGroup();
|
|
285
|
+
|
|
286
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
|
|
287
|
+
that.elem.style.flexWrap = "wrap";
|
|
288
|
+
|
|
289
|
+
SearchInput({
|
|
290
|
+
width: 260,
|
|
291
|
+
height: 40,
|
|
292
|
+
border: 1,
|
|
293
|
+
borderColor: S.CARD_BORDER_COLOR,
|
|
294
|
+
borderBottomStyle: "1px solid " + S.CARD_BORDER_COLOR,
|
|
295
|
+
round: 8,
|
|
296
|
+
color: S.FIELD_COLOR,
|
|
297
|
+
textColor: Ink(0.9),
|
|
298
|
+
fontSize: 14,
|
|
299
|
+
searchIconSize: 16,
|
|
300
|
+
placeholderText: "Name, e-mail, city or tag",
|
|
301
|
+
invertIconColor: T.invertIcon,
|
|
302
|
+
searchIconFile: LIB_PATH + "comp/search-input-v2/search.svg",
|
|
303
|
+
clearIconFile: LIB_PATH + "comp/search-input-v2/clear.svg",
|
|
304
|
+
onSearch: function(text) {
|
|
305
|
+
filter.search = text;
|
|
306
|
+
searchTimer = waitAndRun(searchTimer, render, 200);
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
that.position = "relative";
|
|
310
|
+
|
|
311
|
+
CustomersPage.createTinySelect(SORTS, function(id) {
|
|
312
|
+
filter.sortId = id;
|
|
313
|
+
// WHY: the toolbar sort works through the "order" column; after a click on another title it did nothing
|
|
314
|
+
smartTable.resetSortIcons(smartTable.titleCellList[0]);
|
|
315
|
+
smartTable.sortByTitleIndex = 0;
|
|
316
|
+
smartTable.sortDirection = "A-Z";
|
|
317
|
+
smartTable.updateSortIcon();
|
|
318
|
+
render();
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
CustomersPage.createTinySelect(
|
|
322
|
+
[{ id: "", label: "Everyone" }, { id: "yes", label: "Marketing: opted in" }, { id: "no", label: "Marketing: opted out" }, { id: "blocked", label: "Blocked" }],
|
|
323
|
+
function(id) { filter.consent = id; render(); }
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
// Space
|
|
327
|
+
HGroup({ width: "auto", height: 1 });
|
|
328
|
+
that.elem.style.flex = "1 1 auto";
|
|
329
|
+
endGroup();
|
|
330
|
+
|
|
331
|
+
lblResultCount = Label({ text: "", fontSize: 13, textColor: Ink(0.55) });
|
|
332
|
+
|
|
333
|
+
endGroup();
|
|
334
|
+
|
|
335
|
+
endGroup();
|
|
336
|
+
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const initTable = function() {
|
|
340
|
+
|
|
341
|
+
HGroup({ width: "100%", height: 640, align: "left top" });
|
|
342
|
+
|
|
343
|
+
smartTable = SmartTable({
|
|
344
|
+
titleDataList: [
|
|
345
|
+
{ name: "#", dataTitle: "order", dataType: "integer", width: 60, shortable: 1 },
|
|
346
|
+
{ name: "CUSTOMER", dataTitle: "name", dataType: "string", width: 200, shortable: 1 },
|
|
347
|
+
{ name: "E-MAIL", dataTitle: "email", dataType: "string", width: 230, shortable: 1 },
|
|
348
|
+
{ name: "CITY", dataTitle: "city", dataType: "string", width: 120, shortable: 1 },
|
|
349
|
+
{ name: "ORDERS", dataTitle: "orders", dataType: "integer", width: 90, shortable: 1 },
|
|
350
|
+
{ name: "SPENT", dataTitle: "spent", dataType: "float", width: 120, shortable: 1 },
|
|
351
|
+
{ name: "LAST ORDER", dataTitle: "lastOrder", dataType: "string", width: 120, shortable: 1 },
|
|
352
|
+
{ name: "SEGMENT", dataTitle: "segment", dataType: "string", width: 110, shortable: 1 },
|
|
353
|
+
],
|
|
354
|
+
itemDataList: [],
|
|
355
|
+
titleHeight: 44,
|
|
356
|
+
itemHeight: 40,
|
|
357
|
+
infoHeight: 56,
|
|
358
|
+
itemLineCount: 13,
|
|
359
|
+
sortByTitleIndex: 0,
|
|
360
|
+
sortDirection: "A-Z",
|
|
361
|
+
onSelect: function(itemData) {
|
|
362
|
+
openDetails(itemData.id);
|
|
363
|
+
},
|
|
364
|
+
// WHY: SmartTable writes the raw value (money sorts as a number). Texts and colors are written here.
|
|
365
|
+
updateCustomItemCell: function(cell, titleDataIndex, data) {
|
|
366
|
+
if (titleDataIndex == 5 && data !== "") cell.label.text = OrdersPage.formatMoney(data);
|
|
367
|
+
if (titleDataIndex == 7) {
|
|
368
|
+
const segment = CustomersPage.getSegmentByLabel(data);
|
|
369
|
+
cell.label.textColor = (segment) ? segment.color : Ink(0.75);
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
...CustomersPage.getSmartTableStyle(LIB_PATH),
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
endGroup();
|
|
376
|
+
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// *** PAGE INIT CODE:
|
|
380
|
+
|
|
381
|
+
// BOX: Scrollable container
|
|
382
|
+
// WHY: page does not scroll. Scrollable content must be inside a Box with scrollY: 1.
|
|
383
|
+
startBox(0, 0, "100%", "100%", {
|
|
384
|
+
color: "transparent",
|
|
385
|
+
scrollY: 1,
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
VGroup({
|
|
389
|
+
width: "100%",
|
|
390
|
+
height: "auto", // Grows with content, so the Box can scroll.
|
|
391
|
+
align: "left top",
|
|
392
|
+
gap: 16,
|
|
393
|
+
padding: 24,
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
initHeader();
|
|
397
|
+
initSummary();
|
|
398
|
+
initToolbar();
|
|
399
|
+
initTable();
|
|
400
|
+
|
|
401
|
+
endGroup();
|
|
402
|
+
|
|
403
|
+
endBox();
|
|
404
|
+
|
|
405
|
+
render();
|
|
406
|
+
|
|
407
|
+
box.endPage();
|
|
408
|
+
|
|
409
|
+
if (box.openCustomerId !== null) openDetails(box.openCustomerId);
|
|
410
|
+
|
|
411
|
+
return box;
|
|
412
|
+
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
CustomersPage.KEY = "Customers";
|
|
416
|
+
|
|
417
|
+
// *** DETAILS PANEL (RIGHT VIEW):
|
|
418
|
+
|
|
419
|
+
const CustomerDetailsDefaults = {
|
|
420
|
+
customerId: null,
|
|
421
|
+
notice: "", // A message on the top. (Ex: "Note added")
|
|
422
|
+
onChange: function() {},
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const CustomerDetails = function(params = {}) {
|
|
426
|
+
|
|
427
|
+
// Merge params:
|
|
428
|
+
mergeIntoIfMissing(params, CustomerDetailsDefaults);
|
|
429
|
+
|
|
430
|
+
params.left = 0;
|
|
431
|
+
params.top = 0;
|
|
432
|
+
params.width = "100%";
|
|
433
|
+
params.height = "100%";
|
|
434
|
+
params.color = T.surfaceDeep;
|
|
435
|
+
|
|
436
|
+
// BOX: Component container
|
|
437
|
+
let box = startObject(params);
|
|
438
|
+
|
|
439
|
+
const S = CustomersPage.STYLE;
|
|
440
|
+
const escape = OrdersPage.escapeHtml;
|
|
441
|
+
|
|
442
|
+
const customer = CustomersPage.getCustomers().find(function(c) { return c.id == box.customerId; });
|
|
443
|
+
if (!customer) {
|
|
444
|
+
endObject(box); // WHY: the start of the object must be closed (a stale search result opens a removed customer)
|
|
445
|
+
box.remove();
|
|
446
|
+
return box;
|
|
447
|
+
}
|
|
448
|
+
CustomersPage.recompute(customer);
|
|
449
|
+
customer.segment = CustomersPage.getSegment(customer);
|
|
450
|
+
const segment = CustomersPage.SEGMENTS[customer.segment];
|
|
451
|
+
|
|
452
|
+
let saveTimer = null;
|
|
453
|
+
|
|
454
|
+
// *** CUSTOMER SERVICE (TEST):
|
|
455
|
+
|
|
456
|
+
// Changes the customer like a server request, then opens the panel again with the new data.
|
|
457
|
+
const saveChange = function(change, notice, closeAfter) {
|
|
458
|
+
|
|
459
|
+
if (typeof waiting !== "undefined") waiting.open();
|
|
460
|
+
|
|
461
|
+
saveTimer = setTimeout(function() {
|
|
462
|
+
|
|
463
|
+
// TODO: Send the change to your service.
|
|
464
|
+
const error = change(customer);
|
|
465
|
+
|
|
466
|
+
if (typeof waiting !== "undefined") waiting.close();
|
|
467
|
+
|
|
468
|
+
if (error) { showNotice(error, true); return; }
|
|
469
|
+
|
|
470
|
+
box.onChange();
|
|
471
|
+
|
|
472
|
+
if (closeAfter) {
|
|
473
|
+
rightView.hide();
|
|
474
|
+
rightView.clean();
|
|
475
|
+
} else {
|
|
476
|
+
CustomerDetails({ customerId: customer.id, notice: notice, onChange: box.onChange }); // Render again
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
}, 300);
|
|
480
|
+
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// *** VIEW HELPERS:
|
|
484
|
+
|
|
485
|
+
const startSection = function(title) {
|
|
486
|
+
const group = VGroup({ width: "100%", height: "auto", align: "left top", gap: 8, padding: [16, 14], color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 10 });
|
|
487
|
+
if (title) {
|
|
488
|
+
Label({ text: title.toUpperCase(), fontSize: 11, textColor: Ink(0.45) });
|
|
489
|
+
that.elem.style.letterSpacing = "1px";
|
|
490
|
+
}
|
|
491
|
+
return group;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
const createInfoLine = function(left, right, rightStyle = {}) {
|
|
495
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 16 });
|
|
496
|
+
that.elem.style.justifyContent = "space-between";
|
|
497
|
+
Label({ text: left, fontSize: 14, textColor: Ink(0.55) });
|
|
498
|
+
that.elem.style.flexShrink = "0";
|
|
499
|
+
Label({ text: right, fontSize: 14, textColor: Ink(0.9), textAlign: "right", ...rightStyle });
|
|
500
|
+
endGroup();
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
const createDarkInput = function(params) {
|
|
504
|
+
const input = InputB({
|
|
505
|
+
width: "100%",
|
|
506
|
+
leftPadding: 14,
|
|
507
|
+
rightPadding: 36,
|
|
508
|
+
backgroundColor: S.FIELD_COLOR,
|
|
509
|
+
selectedBackgroundColor: T.surface3,
|
|
510
|
+
lineColor: "transparent",
|
|
511
|
+
selectedLineColor: "transparent",
|
|
512
|
+
backBorderColor: S.CARD_BORDER_COLOR,
|
|
513
|
+
selectedBackBorderColor: S.ACCENT_COLOR,
|
|
514
|
+
backBorderTopRound: 8,
|
|
515
|
+
backBorderBottomRound: 8,
|
|
516
|
+
requiredColor: S.ERROR_COLOR,
|
|
517
|
+
warningColor: S.ERROR_COLOR,
|
|
518
|
+
isRequired: 0,
|
|
519
|
+
...params,
|
|
520
|
+
});
|
|
521
|
+
// WHY: InputB has fixed text colors for light backgrounds.
|
|
522
|
+
input.title.textColor = Ink(0.45);
|
|
523
|
+
input.title.fontSize = 11;
|
|
524
|
+
input.title.elem.style.letterSpacing = "1px";
|
|
525
|
+
input.input.textColor = Ink(0.9);
|
|
526
|
+
input.input.fontSize = 15;
|
|
527
|
+
input.input.height = 32;
|
|
528
|
+
input.warningBall.borderColor = S.CARD_COLOR;
|
|
529
|
+
return input;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// WHY: Some components have no enabled setting. "inert" blocks the mouse and keyboard for all the children.
|
|
533
|
+
const setInteractive = function(obj, enabled) {
|
|
534
|
+
obj.elem.inert = !enabled;
|
|
535
|
+
obj.opacity = (enabled) ? 1 : 0.4;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
let grpNotice, lblNotice;
|
|
539
|
+
const showNotice = function(text, isError = false) {
|
|
540
|
+
const color = (isError) ? S.ERROR_COLOR : S.ACCENT_COLOR;
|
|
541
|
+
lblNotice.text = escape(text);
|
|
542
|
+
lblNotice.textColor = color;
|
|
543
|
+
grpNotice.color = OrdersPage.alpha(color, 0.12);
|
|
544
|
+
grpNotice.borderColor = OrdersPage.alpha(color, 0.35);
|
|
545
|
+
grpNotice.visible = (text) ? 1 : 0;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
box.destroy = function() {
|
|
549
|
+
clearTimeout(saveTimer);
|
|
550
|
+
box.remove();
|
|
551
|
+
box = null;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// *** VIEW:
|
|
555
|
+
|
|
556
|
+
// Left line
|
|
557
|
+
Box(0, 0, 1, "100%", { color: Ink(0.12) });
|
|
558
|
+
|
|
559
|
+
// GROUP: Scrollable content
|
|
560
|
+
startBox(0, 0, "100%", "calc(100% - 76px)", { color: "transparent", scrollY: 1 });
|
|
561
|
+
|
|
562
|
+
VGroup({ width: "100%", height: "auto", align: "left top", gap: 14, padding: 20 });
|
|
563
|
+
|
|
564
|
+
// TITLE
|
|
565
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 12 });
|
|
566
|
+
|
|
567
|
+
HGroup({ width: 48, height: 48, align: "center center", round: 100, color: CustomersPage.getAvatarColor(customer.id) });
|
|
568
|
+
that.elem.style.flexShrink = "0";
|
|
569
|
+
Label({ text: CustomersPage.getInitials(customer.name), fontSize: 17, textColor: Theme.textOn(CustomersPage.getAvatarColor(customer.id)) });
|
|
570
|
+
endGroup();
|
|
571
|
+
|
|
572
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 2 });
|
|
573
|
+
that.elem.style.flex = "1 1 auto";
|
|
574
|
+
that.elem.style.minWidth = "0";
|
|
575
|
+
HGroup({ width: "auto", height: "auto", align: "left center", gap: 10 });
|
|
576
|
+
Label({ text: escape(customer.name), fontSize: 20, textColor: Ink(0.95) });
|
|
577
|
+
that.elem.style.fontFamily = "opensans-bold";
|
|
578
|
+
Label({ text: segment.label.toUpperCase(), fontSize: 11, textColor: segment.color, color: OrdersPage.alpha(segment.color, 0.15), round: 6, padding: [8, 3] });
|
|
579
|
+
that.elem.style.letterSpacing = "1px";
|
|
580
|
+
if (customer.blocked) {
|
|
581
|
+
Label({ text: "BLOCKED", fontSize: 11, textColor: S.ERROR_COLOR, color: OrdersPage.alpha(S.ERROR_COLOR, 0.15), round: 6, padding: [8, 3] });
|
|
582
|
+
that.elem.style.letterSpacing = "1px";
|
|
583
|
+
}
|
|
584
|
+
endGroup();
|
|
585
|
+
Label({ text: "Customer since " + new Date(customer.registeredAt).toLocaleDateString("en-GB", { dateStyle: "medium" }) + " · " + escape(customer.city), fontSize: 13, textColor: Ink(0.5) });
|
|
586
|
+
endGroup();
|
|
587
|
+
|
|
588
|
+
Icon({ width: 28, height: 28, clickable: 1 });
|
|
589
|
+
that.load("assets/close.png");
|
|
590
|
+
that.elem.style.filter = T.iconFilter;
|
|
591
|
+
that.elem.style.cursor = "pointer";
|
|
592
|
+
that.opacity = 0.6;
|
|
593
|
+
that.on("click", function() {
|
|
594
|
+
rightView.hide();
|
|
595
|
+
rightView.clean();
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
endGroup();
|
|
599
|
+
|
|
600
|
+
// NOTICE
|
|
601
|
+
grpNotice = HGroup({ width: "100%", height: "auto", align: "left center", padding: [12, 10], round: 8, border: 1 });
|
|
602
|
+
lblNotice = Label({ text: "", fontSize: 14, width: "100%" });
|
|
603
|
+
endGroup();
|
|
604
|
+
showNotice(box.notice);
|
|
605
|
+
|
|
606
|
+
// STATS
|
|
607
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 10 });
|
|
608
|
+
that.elem.style.flexWrap = "wrap";
|
|
609
|
+
[
|
|
610
|
+
["Spent", OrdersPage.formatMoney(customer.totalSpent)],
|
|
611
|
+
["Orders", String(customer.orderCount)],
|
|
612
|
+
["Avg. order", (customer.orderCount) ? OrdersPage.formatMoney(customer.totalSpent / customer.orderCount) : "—"],
|
|
613
|
+
["Last order", (customer.lastOrderAt) ? CustomersPage.formatRelative(customer.lastOrderAt) : "Never"],
|
|
614
|
+
].forEach(function(item) {
|
|
615
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 2, padding: [12, 10], color: S.CARD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 10 });
|
|
616
|
+
that.elem.style.flex = "1 1 100px";
|
|
617
|
+
that.elem.style.minWidth = "0";
|
|
618
|
+
Label({ text: item[0], fontSize: 12, textColor: Ink(0.5) });
|
|
619
|
+
Label({ text: item[1], fontSize: 17, textColor: Ink(0.95) });
|
|
620
|
+
that.elem.style.whiteSpace = "nowrap";
|
|
621
|
+
endGroup();
|
|
622
|
+
});
|
|
623
|
+
endGroup();
|
|
624
|
+
|
|
625
|
+
// CONTACT
|
|
626
|
+
startSection("Contact");
|
|
627
|
+
|
|
628
|
+
let updateContactButton = function() {};
|
|
629
|
+
|
|
630
|
+
const inputName = createDarkInput({ titleText: "NAME", inputValue: customer.name, maxChar: 60, onEdit: function() { updateContactButton(); } });
|
|
631
|
+
const inputEmail = createDarkInput({ titleText: "E-MAIL", inputValue: customer.email, maxChar: 120, warningText: "E-mail is not valid", onEdit: function() { updateContactButton(); } });
|
|
632
|
+
|
|
633
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 10 });
|
|
634
|
+
const inputPhone = createDarkInput({ titleText: "PHONE", inputValue: customer.phone, maxChar: 30, onEdit: function() { updateContactButton(); } });
|
|
635
|
+
inputPhone.elem.style.flex = "1 1 0";
|
|
636
|
+
const inputCity = createDarkInput({ titleText: "CITY", inputValue: customer.city, maxChar: 40, onEdit: function() { updateContactButton(); } });
|
|
637
|
+
inputCity.elem.style.flex = "1 1 0";
|
|
638
|
+
endGroup();
|
|
639
|
+
|
|
640
|
+
const inputAddress = createDarkInput({ titleText: "ADDRESS", inputValue: customer.address, maxChar: 160, onEdit: function() { updateContactButton(); } });
|
|
641
|
+
|
|
642
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 8 });
|
|
643
|
+
that.elem.style.flexWrap = "wrap";
|
|
644
|
+
|
|
645
|
+
const btnSave = CustomersPage.createButton("Save Changes", "", function() {
|
|
646
|
+
const name = inputName.getInputValue().trim(), email = inputEmail.getInputValue().trim();
|
|
647
|
+
if (name.length < 2) { showNotice("Name must be at least 2 letters.", true); return; }
|
|
648
|
+
if (!CustomersPage.isEmail(email)) { showNotice("E-mail is not valid.", true); return; }
|
|
649
|
+
const used = CustomersPage.getCustomers().some(function(c) { return c.id != customer.id && c.email.toLowerCase() == email.toLowerCase(); });
|
|
650
|
+
if (used) { showNotice("This e-mail belongs to another customer.", true); return; }
|
|
651
|
+
saveChange(function(c) {
|
|
652
|
+
c.name = name; c.email = email; c.phone = inputPhone.getInputValue().trim();
|
|
653
|
+
c.city = inputCity.getInputValue().trim(); c.address = inputAddress.getInputValue().trim();
|
|
654
|
+
return "";
|
|
655
|
+
}, "Contact details are saved.");
|
|
656
|
+
}, { primary: 1 });
|
|
657
|
+
|
|
658
|
+
CustomersPage.createButton("E-mail Customer", "", function() {
|
|
659
|
+
window.location.href = "mailto:" + encodeURIComponent(customer.email);
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
endGroup();
|
|
663
|
+
|
|
664
|
+
updateContactButton = function() {
|
|
665
|
+
const changed = inputName.getInputValue().trim() != customer.name || inputEmail.getInputValue().trim() != customer.email ||
|
|
666
|
+
inputPhone.getInputValue().trim() != customer.phone || inputCity.getInputValue().trim() != customer.city || inputAddress.getInputValue().trim() != customer.address;
|
|
667
|
+
inputEmail.showWarningIfNotValid(CustomersPage.isEmail(inputEmail.getInputValue().trim()));
|
|
668
|
+
setInteractive(btnSave, changed);
|
|
669
|
+
};
|
|
670
|
+
updateContactButton();
|
|
671
|
+
|
|
672
|
+
endGroup();
|
|
673
|
+
|
|
674
|
+
// TAGS & MARKETING
|
|
675
|
+
startSection("Tags & marketing");
|
|
676
|
+
|
|
677
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 6 });
|
|
678
|
+
that.elem.style.flexWrap = "wrap";
|
|
679
|
+
|
|
680
|
+
customer.tags.forEach(function(tag) {
|
|
681
|
+
HGroup({ width: "auto", height: 28, align: "left center", gap: 6, padding: [10, 0], round: 100, color: S.FIELD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR });
|
|
682
|
+
Label({ text: escape(tag), fontSize: 13, textColor: Ink(0.85) });
|
|
683
|
+
const btnRemove = Label({ text: "✕", fontSize: 12, textColor: Ink(0.45), clickable: 1 });
|
|
684
|
+
btnRemove.elem.style.cursor = "pointer";
|
|
685
|
+
btnRemove.elem.title = "Remove the tag";
|
|
686
|
+
btnRemove.on("click", function() {
|
|
687
|
+
saveChange(function(c) { c.tags = c.tags.filter(function(t) { return t != tag; }); return ""; }, "Tag removed.");
|
|
688
|
+
});
|
|
689
|
+
endGroup();
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
if (!customer.tags.length) Label({ text: "No tags yet.", fontSize: 13, textColor: Ink(0.45) });
|
|
693
|
+
|
|
694
|
+
endGroup();
|
|
695
|
+
|
|
696
|
+
HGroup({ width: "100%", height: "auto", align: "left bottom", gap: 8 });
|
|
697
|
+
const inputTag = createDarkInput({ titleText: "ADD A TAG", placeholder: "wholesale, newsletter, complaint...", maxChar: 24 });
|
|
698
|
+
inputTag.elem.style.flex = "1 1 0";
|
|
699
|
+
inputTag.elem.style.minWidth = "0";
|
|
700
|
+
CustomersPage.createButton("Add", "", function() {
|
|
701
|
+
const tag = inputTag.getInputValue().trim().toLowerCase();
|
|
702
|
+
if (!tag) return;
|
|
703
|
+
if (customer.tags.includes(tag)) { showNotice("This tag is already on the customer.", true); return; }
|
|
704
|
+
saveChange(function(c) { c.tags.push(tag); return ""; }, "Tag \"" + tag + "\" added.");
|
|
705
|
+
});
|
|
706
|
+
that.elem.style.flexShrink = "0"; // WHY: The input takes the rest, the button keeps its width.
|
|
707
|
+
endGroup();
|
|
708
|
+
|
|
709
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 12 });
|
|
710
|
+
that.elem.style.justifyContent = "space-between";
|
|
711
|
+
that.elem.style.marginTop = "6px";
|
|
712
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
|
|
713
|
+
Label({ text: "Marketing e-mails", fontSize: 14, textColor: Ink(0.9) });
|
|
714
|
+
Label({ text: (customer.consent) ? "Opted in on " + new Date(customer.consentAt).toLocaleDateString("en-GB", { dateStyle: "medium" }) : "Not opted in. Do not send campaigns.", fontSize: 12, textColor: Ink(0.45) });
|
|
715
|
+
endGroup();
|
|
716
|
+
Toggle({
|
|
717
|
+
width: 52, height: 30, spacing: 3, value: (customer.consent) ? 1 : 0,
|
|
718
|
+
backgroundStyle: { color: T.surface3, selectedColor: S.PRIMARY_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR },
|
|
719
|
+
buttonStyle: { color: Ink(0.35), selectedColor: Ink(0.95) },
|
|
720
|
+
onChange: function(self) {
|
|
721
|
+
if (self.value == ((customer.consent) ? 1 : 0)) return;
|
|
722
|
+
saveChange(function(c) { c.consent = self.value; c.consentAt = Date.now(); return ""; }, (self.value) ? "Marketing consent is on." : "Marketing consent is off.");
|
|
723
|
+
},
|
|
724
|
+
});
|
|
725
|
+
endGroup();
|
|
726
|
+
|
|
727
|
+
endGroup();
|
|
728
|
+
|
|
729
|
+
// ORDERS
|
|
730
|
+
const orders = customer.orders.slice(0, 8);
|
|
731
|
+
startSection("Orders" + ((customer.orderCount > orders.length) ? " · last " + orders.length + " of " + customer.orderCount : ""));
|
|
732
|
+
|
|
733
|
+
if (!orders.length) {
|
|
734
|
+
Label({ text: "No orders yet. This customer registered but did not buy anything.", fontSize: 13, textColor: Ink(0.5), width: "100%" });
|
|
735
|
+
} else {
|
|
736
|
+
const table = TinyTable({
|
|
737
|
+
columns: Theme.tableColumns(["ORDER", "DATE", "TOTAL", "STATUS"], ["30%", "30%", "18%", "20%"], ["left", "left", "right", "left"]),
|
|
738
|
+
rows: orders.map(function(order) {
|
|
739
|
+
return [escape(order.id), OrdersPage.formatDateTime(order.time).slice(0, 10), OrdersPage.formatMoney(order.total), OrdersPage.STATUSES[order.status].label];
|
|
740
|
+
}),
|
|
741
|
+
allowHtml: 1, // (the texts are made by the panel, user texts are escaped)
|
|
742
|
+
style: Theme.tableStyle({ headerColor: S.FIELD_COLOR, bodyColor: S.CARD_COLOR, borderColor: S.CARD_BORDER_COLOR, textColor: Ink(0.85) }),
|
|
743
|
+
onCellCreate: function(cell) {
|
|
744
|
+
const order = orders[cell.rowIndex];
|
|
745
|
+
if (cell.columnIndex == 3) cell.label.textColor = OrdersPage.STATUSES[order.status].color;
|
|
746
|
+
if (cell.columnIndex == 0) cell.label.textColor = S.ACCENT_COLOR;
|
|
747
|
+
},
|
|
748
|
+
// Open the order on the Orders page
|
|
749
|
+
onRowClick: function(self, rowIndex) {
|
|
750
|
+
rightView.hide();
|
|
751
|
+
rightView.clean();
|
|
752
|
+
leftMenu.setSelectedItem(OrdersPage.KEY);
|
|
753
|
+
OrdersPage({ openOrderId: orders[rowIndex].id });
|
|
754
|
+
},
|
|
755
|
+
});
|
|
756
|
+
Theme.fillTableWidth(table);
|
|
757
|
+
Label({ text: "Click an order to open it on the Orders page.", fontSize: 12, textColor: Ink(0.4) });
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
endGroup();
|
|
761
|
+
|
|
762
|
+
// NOTES
|
|
763
|
+
startSection("Notes");
|
|
764
|
+
|
|
765
|
+
customer.notes.slice().reverse().forEach(function(note, index, list) {
|
|
766
|
+
HGroup({ width: "100%", height: "auto", align: "left top", gap: 12 });
|
|
767
|
+
VGroup({ width: 12, height: "auto", align: "center top", gap: 0 });
|
|
768
|
+
that.elem.style.alignSelf = "stretch";
|
|
769
|
+
Box({ width: 10, height: 10, round: 100, color: S.ACCENT_COLOR });
|
|
770
|
+
that.elem.style.marginTop = "5px";
|
|
771
|
+
if (index < list.length - 1) {
|
|
772
|
+
Box({ width: 2, height: "auto", color: Ink(0.1) });
|
|
773
|
+
that.elem.style.flex = "1 1 auto";
|
|
774
|
+
that.elem.style.minHeight = "16px";
|
|
775
|
+
}
|
|
776
|
+
endGroup();
|
|
777
|
+
VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
|
|
778
|
+
that.elem.style.flex = "1 1 auto";
|
|
779
|
+
that.elem.style.minWidth = "0";
|
|
780
|
+
that.elem.style.paddingBottom = "10px";
|
|
781
|
+
Label({ text: escape(note.text), fontSize: 14, textColor: Ink(0.9), width: "100%" });
|
|
782
|
+
Label({ text: new Date(note.time).toLocaleString("en-GB", { dateStyle: "medium", timeStyle: "short" }) + " · " + escape(note.by), fontSize: 12, textColor: Ink(0.45) });
|
|
783
|
+
endGroup();
|
|
784
|
+
endGroup();
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
if (!customer.notes.length) Label({ text: "No notes yet.", fontSize: 13, textColor: Ink(0.45) });
|
|
788
|
+
|
|
789
|
+
HGroup({ width: "100%", height: "auto", align: "left bottom", gap: 8 });
|
|
790
|
+
const inputNote = createDarkInput({ titleText: "ADD A NOTE", placeholder: "Only the team can see it", maxChar: 200 });
|
|
791
|
+
inputNote.elem.style.flex = "1 1 0";
|
|
792
|
+
inputNote.elem.style.minWidth = "0";
|
|
793
|
+
CustomersPage.createButton("Add", "", function() {
|
|
794
|
+
const text = inputNote.getInputValue().trim();
|
|
795
|
+
if (!text) return;
|
|
796
|
+
saveChange(function(c) { c.notes.push({ time: Date.now(), text: text, by: CustomersPage.getCurrentUserName() }); return ""; }, "Note added.");
|
|
797
|
+
});
|
|
798
|
+
that.elem.style.flexShrink = "0";
|
|
799
|
+
endGroup();
|
|
800
|
+
|
|
801
|
+
endGroup();
|
|
802
|
+
|
|
803
|
+
endGroup();
|
|
804
|
+
|
|
805
|
+
endBox();
|
|
806
|
+
|
|
807
|
+
// GROUP: Buttons (bottom)
|
|
808
|
+
HGroup({ left: 0, bottom: 0, width: "100%", height: 76, align: "left center", gap: 8, padding: [20, 0] });
|
|
809
|
+
that.elem.style.borderTop = "1px solid " + Ink(0.08);
|
|
810
|
+
|
|
811
|
+
CustomersPage.createButton((customer.blocked) ? "Unblock" : "Block Customer", "", function() {
|
|
812
|
+
if (customer.blocked) {
|
|
813
|
+
saveChange(function(c) { c.blocked = 0; return ""; }, "Customer is unblocked.");
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
Theme.confirm({
|
|
817
|
+
titleText: "Block Customer",
|
|
818
|
+
messageText: "<b>" + escape(customer.name) + "</b> will not be able to sign in or place orders. Open orders are not changed.",
|
|
819
|
+
confirmText: "Block",
|
|
820
|
+
cancelText: "Cancel",
|
|
821
|
+
onAnswer: function(isConfirmed) {
|
|
822
|
+
if (isConfirmed && box) saveChange(function(c) { c.blocked = 1; return ""; }, "Customer is blocked.");
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
// WHY: Hold to confirm, so a customer is not deleted by mistake.
|
|
828
|
+
const btnDelete = HoldToConfirmButton({
|
|
829
|
+
height: 40,
|
|
830
|
+
labelText: "Hold to Delete",
|
|
831
|
+
completedText: "DELETED",
|
|
832
|
+
iconFile: "_basic/comp/hold-to-confirm-button/trash.png",
|
|
833
|
+
holdingIconFile: "_basic/comp/hold-to-confirm-button/trash-red.png",
|
|
834
|
+
holdDuration: 1500,
|
|
835
|
+
resetDelay: 600,
|
|
836
|
+
style: {
|
|
837
|
+
layout: { gap: 6, padding: [14, 0] },
|
|
838
|
+
icon: { width: 18, height: 18 },
|
|
839
|
+
label: { fontSize: 14, textColor: Ink(0.9) },
|
|
840
|
+
holdingLabel: { fontSize: 14, textColor: "#B03A2E" },
|
|
841
|
+
completedLabel: { fontSize: 14, textColor: T.primaryActive },
|
|
842
|
+
box: { color: S.FIELD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 8 },
|
|
843
|
+
holdingBox: { color: "#FFD1CB", borderColor: S.ERROR_COLOR, round: 8 },
|
|
844
|
+
completedBox: { color: "#DFEFE6", borderColor: S.ACCENT_COLOR, round: 8 },
|
|
845
|
+
},
|
|
846
|
+
onConfirm: function() {
|
|
847
|
+
saveChange(function(c) {
|
|
848
|
+
if (c.orderCount > 0) return "A customer with orders can not be deleted. Block the customer instead.";
|
|
849
|
+
const list = CustomersPage.getCustomers();
|
|
850
|
+
list.splice(list.indexOf(c), 1);
|
|
851
|
+
return "";
|
|
852
|
+
}, "", 1);
|
|
853
|
+
},
|
|
854
|
+
});
|
|
855
|
+
btnDelete.icon.elem.style.filter = T.iconFilter; // WHY: Only the normal icon is on a dark background.
|
|
856
|
+
if (customer.orderCount > 0) btnDelete.elem.title = "Customers with orders can not be deleted";
|
|
857
|
+
|
|
858
|
+
Label({ text: (customer.orderCount > 0) ? "Has orders: can be blocked, not deleted." : "", fontSize: 12, textColor: Ink(0.4) });
|
|
859
|
+
|
|
860
|
+
endGroup();
|
|
861
|
+
|
|
862
|
+
// *** INIT CODE:
|
|
863
|
+
|
|
864
|
+
rightView.clean();
|
|
865
|
+
rightView.setKey(CustomerDetails.KEY);
|
|
866
|
+
rightView.setWidth(560);
|
|
867
|
+
rightView.add(box);
|
|
868
|
+
rightView.show();
|
|
869
|
+
rightView.destroyPage = box.destroy;
|
|
870
|
+
|
|
871
|
+
return endObject(box);
|
|
872
|
+
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
CustomerDetails.KEY = "CustomerDetails";
|
|
876
|
+
|
|
877
|
+
// *** STATIC: STYLE AND HELPERS
|
|
878
|
+
|
|
879
|
+
CustomersPage.DAY = 24 * 60 * 60 * 1000;
|
|
880
|
+
|
|
881
|
+
CustomersPage.STYLE = {
|
|
882
|
+
CARD_COLOR: T.surface,
|
|
883
|
+
CARD_BORDER_COLOR: Ink(0.1),
|
|
884
|
+
FIELD_COLOR: T.surface2,
|
|
885
|
+
PRIMARY_COLOR: T.primary,
|
|
886
|
+
ACCENT_COLOR: T.accent,
|
|
887
|
+
ERROR_COLOR: T.danger,
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
CustomersPage.SEGMENTS = {
|
|
891
|
+
vip: { label: "VIP", color: Theme.readable("#E8B04A") },
|
|
892
|
+
regular: { label: "Regular", color: T.accent },
|
|
893
|
+
new: { label: "New", color: T.info },
|
|
894
|
+
risk: { label: "At risk", color: T.danger },
|
|
895
|
+
lead: { label: "Lead", color: Theme.readable("#A9A79F") },
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// The order matters: a customer that stopped buying is "At risk" even if the spending is high.
|
|
899
|
+
CustomersPage.getSegment = function(c) {
|
|
900
|
+
const now = Date.now();
|
|
901
|
+
if (!c.orderCount) return "lead";
|
|
902
|
+
if (now - c.lastOrderAt > 45 * CustomersPage.DAY) return "risk";
|
|
903
|
+
if (now - c.firstOrderAt < 30 * CustomersPage.DAY) return "new";
|
|
904
|
+
if (c.totalSpent >= CustomersPage.vipThreshold) return "vip";
|
|
905
|
+
return "regular";
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
// VIP: top 30% of the customers with orders. (Set by getCustomers(), from the data.)
|
|
909
|
+
CustomersPage.vipThreshold = Infinity;
|
|
910
|
+
|
|
911
|
+
CustomersPage.getSegmentByLabel = function(label) {
|
|
912
|
+
const id = Object.keys(CustomersPage.SEGMENTS).find(function(key) { return CustomersPage.SEGMENTS[key].label == label; });
|
|
913
|
+
return (id) ? CustomersPage.SEGMENTS[id] : null;
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
CustomersPage.getInitials = function(name) {
|
|
917
|
+
return String(name).trim().split(/\s+/).slice(0, 2).map(function(part) { return part.charAt(0).toUpperCase(); }).join("");
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
CustomersPage.AVATAR_COLORS = ["#3D7A6B", "#344F6C", "#583432", "#6B5B2E", "#4A3F6B", "#2E5E6B"];
|
|
921
|
+
CustomersPage.getAvatarColor = function(id) {
|
|
922
|
+
return CustomersPage.AVATAR_COLORS[id % CustomersPage.AVATAR_COLORS.length];
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
CustomersPage.isEmail = function(text) {
|
|
926
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(text);
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
// "5 days ago"
|
|
930
|
+
CustomersPage.formatRelative = function(time) {
|
|
931
|
+
const seconds = Math.round((Date.now() - time) / 1000);
|
|
932
|
+
const units = [["year", 31536000], ["month", 2592000], ["day", 86400], ["hour", 3600], ["minute", 60]];
|
|
933
|
+
for (const unit of units) {
|
|
934
|
+
const value = Math.floor(seconds / unit[1]);
|
|
935
|
+
if (value >= 1) return value + " " + unit[0] + ((value > 1) ? "s" : "") + " ago";
|
|
936
|
+
}
|
|
937
|
+
return "Just now";
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
CustomersPage.getCurrentUserName = function() {
|
|
941
|
+
return (typeof UserActionsPage !== "undefined") ? UserActionsPage.getCurrentUser().name : "You";
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// params: { primary: 1, width }
|
|
945
|
+
CustomersPage.createButton = function(text, iconFile, onClick, params = {}) {
|
|
946
|
+
const S = CustomersPage.STYLE;
|
|
947
|
+
const btn = SmartButton({
|
|
948
|
+
styleName: "classic",
|
|
949
|
+
width: params.width || "auto",
|
|
950
|
+
labelText: text,
|
|
951
|
+
iconFile: iconFile || "",
|
|
952
|
+
onClick: onClick,
|
|
953
|
+
style: {
|
|
954
|
+
layout: { gap: 8, padding: [14, 8] },
|
|
955
|
+
icon: { width: 18, height: 18 },
|
|
956
|
+
label: { fontSize: 14, textColor: Ink(0.92) },
|
|
957
|
+
box: { color: (params.primary) ? S.PRIMARY_COLOR : S.FIELD_COLOR, border: 1, borderColor: S.CARD_BORDER_COLOR, round: 8 },
|
|
958
|
+
hover: { color: (params.primary) ? T.primaryHover : T.surface3 },
|
|
959
|
+
active: { color: (params.primary) ? T.primaryActive : T.surface4 },
|
|
960
|
+
},
|
|
961
|
+
});
|
|
962
|
+
if (btn.icon) btn.icon.elem.style.filter = T.iconFilter; // WHY: Panel icons are black.
|
|
963
|
+
return btn;
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
// selectedIndex: The first selected item
|
|
967
|
+
CustomersPage.createTinySelect = function(list, onSelect, selectedIndex = 0) {
|
|
968
|
+
const S = CustomersPage.STYLE;
|
|
969
|
+
let isReady = 0; // WHY: TinySelect calls onSelect when it is created.
|
|
970
|
+
const select = TinySelect({
|
|
971
|
+
list: list,
|
|
972
|
+
selectedIndex: selectedIndex,
|
|
973
|
+
height: 40,
|
|
974
|
+
fontSize: 14,
|
|
975
|
+
color: S.FIELD_COLOR,
|
|
976
|
+
border: 1,
|
|
977
|
+
borderColor: S.CARD_BORDER_COLOR,
|
|
978
|
+
round: 8,
|
|
979
|
+
labelBoldFont: 0,
|
|
980
|
+
labelTextColor: Ink(0.9),
|
|
981
|
+
arrowIcon: "_basic/comp/tiny-select/arrow.svg",
|
|
982
|
+
arrowSize: 18,
|
|
983
|
+
invertIconColor: T.invertIcon,
|
|
984
|
+
listFontSize: 14,
|
|
985
|
+
listTextColor: Ink(0.85),
|
|
986
|
+
listOverTextColor: S.ACCENT_COLOR,
|
|
987
|
+
listBackgroundColor: S.FIELD_COLOR,
|
|
988
|
+
listBorderColor: Ink(0.15),
|
|
989
|
+
onSelect: function(index, id) {
|
|
990
|
+
if (isReady) onSelect(id);
|
|
991
|
+
},
|
|
992
|
+
});
|
|
993
|
+
isReady = 1;
|
|
994
|
+
return select;
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
CustomersPage.getSmartTableStyle = function(libPath) {
|
|
998
|
+
const S = CustomersPage.STYLE;
|
|
999
|
+
return {
|
|
1000
|
+
scrollBarParams: {
|
|
1001
|
+
bar_border: 0, bar_round: 3, bar_borderColor: Ink(0.15), bar_width: 4, bar_mouseOverWidth: 4,
|
|
1002
|
+
bar_mouseOverColor: T.scrollBar, bar_opacity: 0.4, bar_mouseOverOpacity: 0.9, bar_padding: 2, bar_color: T.scrollBar,
|
|
1003
|
+
neverHide: 0, showDots: 0,
|
|
1004
|
+
},
|
|
1005
|
+
// WHY: Filtre kutusu ile alt bar aynı renkti, kutu görünmüyordu. Bar kart rengine, kutu ise alan rengine (FIELD_COLOR) alındı.
|
|
1006
|
+
searchInputParams: {
|
|
1007
|
+
width: "50%", height: 34, border: 1, round: 8, color: S.FIELD_COLOR, borderColor: S.CARD_BORDER_COLOR,
|
|
1008
|
+
borderBottomStyle: "1px solid " + S.CARD_BORDER_COLOR,
|
|
1009
|
+
textColor: Ink(0.9), placeholderColor: Ink(0.4), fontSize: 14,
|
|
1010
|
+
placeholderText: "Filter the table",
|
|
1011
|
+
searchIconSize: 15, searchIconOpacity: 0.55, invertIconColor: T.invertIcon,
|
|
1012
|
+
searchIconFile: libPath + "comp/search-input-v2/filter.png",
|
|
1013
|
+
clearIconFile: libPath + "comp/search-input-v2/clear.svg",
|
|
1014
|
+
},
|
|
1015
|
+
// Filtre kutusundaki sütun seçim listesi (ALL) de koyu tema ile açılsın.
|
|
1016
|
+
searchTitleMenuParams: {
|
|
1017
|
+
minWidth: 170,
|
|
1018
|
+
style: {
|
|
1019
|
+
menu: { color: S.FIELD_COLOR, border: 1, borderColor: Ink(0.12), round: 8, padding: 4, shadow: "0 8px 24px " + Black(0.5) },
|
|
1020
|
+
item: { height: 30, fontSize: 13, textColor: Ink(0.75), color: "transparent", round: 6, padding: 10, gap: 10 },
|
|
1021
|
+
itemHover: { textColor: "white", color: Ink(0.08) },
|
|
1022
|
+
disabled: { textColor: Ink(0.3), opacity: 0.4 },
|
|
1023
|
+
icon: { width: 14, height: 14 },
|
|
1024
|
+
separator: { color: Ink(0.1), space: 4 },
|
|
1025
|
+
},
|
|
1026
|
+
},
|
|
1027
|
+
style: {
|
|
1028
|
+
width: "100%",
|
|
1029
|
+
height: "100%",
|
|
1030
|
+
round: 8,
|
|
1031
|
+
line1Color: S.CARD_COLOR,
|
|
1032
|
+
line2Color: T.tableRow2,
|
|
1033
|
+
highlightItemCellColor: T.tableHighlight,
|
|
1034
|
+
highlightTitleCellColor: Ink(0.08),
|
|
1035
|
+
verticalScrollWidth: 20,
|
|
1036
|
+
verticalScrollMargin: 2,
|
|
1037
|
+
btnScrollDownIconFile: libPath + "comp/smart-table/down.png",
|
|
1038
|
+
btnScrollUpIconFile: libPath + "comp/smart-table/up.png",
|
|
1039
|
+
btnScrollCenterIconFile: libPath + "comp/smart-table/scroll.png",
|
|
1040
|
+
sortIconFile: libPath + "comp/smart-table/sort.png",
|
|
1041
|
+
// WHY: Varsayılan tik ikonu koyu renkli; koyu menüde görünmüyordu.
|
|
1042
|
+
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>'),
|
|
1043
|
+
loadingIconFile: libPath + "comp/smart-table/clock.png",
|
|
1044
|
+
invertIconColor: T.invertIcon,
|
|
1045
|
+
box: { color: S.CARD_COLOR },
|
|
1046
|
+
boxBorder: { border: 1, borderColor: S.CARD_BORDER_COLOR },
|
|
1047
|
+
boxTitleLine: { color: S.FIELD_COLOR },
|
|
1048
|
+
boxTitleCell: { padding: [10, 0], borderRight: "1px solid " + Ink(0.06), borderBottom: "1px solid " + Ink(0.12) },
|
|
1049
|
+
lblTitleCell: { fontSize: 13, fontFamily: "opensans", textColor: Ink(0.6) },
|
|
1050
|
+
boxItemCell: { borderBottom: "1px solid " + Ink(0.05), borderRight: "1px solid " + Ink(0.03), padding: [10, 0] },
|
|
1051
|
+
lblItemCell: { fontSize: 14, textColor: Ink(0.75), fontFamily: "opensans" },
|
|
1052
|
+
boxInfoLine: { color: S.CARD_COLOR, borderTop: "1px solid " + Ink(0.08) },
|
|
1053
|
+
lblBoxInfoLine: { fontSize: 13, textColor: Ink(0.55) },
|
|
1054
|
+
lblNoDataFound: { color: T.surface3, textColor: Ink(0.6), padding: [8, 2], fontSize: 13, round: 8, border: 1, borderColor: Ink(0.15) },
|
|
1055
|
+
// Filtre kutusunun içindeki sütun etiketi: Kutunun içinde durduğu için daha hafif bir chip.
|
|
1056
|
+
lblSearchTitle: { color: Ink(0.08), textColor: Ink(0.6), padding: [8, 1], fontSize: 12, round: 6, border: 1, borderColor: Ink(0.14) },
|
|
1057
|
+
btnScrollCenter: { color: T.surface3, round: 100, borderColor: Ink(0.2), border: 1 },
|
|
1058
|
+
btnScrollUp: { color: T.surface4, round: 100, border: 1, borderColor: Ink(0.3) },
|
|
1059
|
+
btnScrollDown: { color: T.surface4, round: 100, border: 1, borderColor: Ink(0.3) },
|
|
1060
|
+
boxSort: { color: S.PRIMARY_COLOR },
|
|
1061
|
+
},
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
// *** STATIC: CUSTOMER DATA (TEST)
|
|
1066
|
+
|
|
1067
|
+
CustomersPage._customers = null;
|
|
1068
|
+
|
|
1069
|
+
// The totals of a customer from its orders (the same order objects as the Orders page)
|
|
1070
|
+
// WHY at every render too: an order cancelled or refunded on the Orders page changes the spent total
|
|
1071
|
+
CustomersPage.recompute = function(c) {
|
|
1072
|
+
c.orders.sort(function(a, b) { return b.time - a.time; }); // Newest first
|
|
1073
|
+
c.orderCount = c.orders.length;
|
|
1074
|
+
c.totalSpent = Math.round(c.orders.filter(function(o) { return !["cancelled", "refunded"].includes(o.status); }).reduce(function(sum, o) { return sum + o.total; }, 0) * 100) / 100;
|
|
1075
|
+
c.firstOrderAt = (c.orders.length) ? c.orders[c.orders.length - 1].time : 0;
|
|
1076
|
+
c.lastOrderAt = (c.orders.length) ? c.orders[0].time : 0;
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
// Customers of the store. The ones with orders are built from the Orders page, so the totals match the orders.
|
|
1080
|
+
// Created one time and kept while the panel is open.
|
|
1081
|
+
// TODO: Load the customers from your service (with paging and filters).
|
|
1082
|
+
CustomersPage.getCustomers = function() {
|
|
1083
|
+
|
|
1084
|
+
if (CustomersPage._customers) return CustomersPage._customers;
|
|
1085
|
+
|
|
1086
|
+
const DAY = CustomersPage.DAY;
|
|
1087
|
+
const now = Date.now();
|
|
1088
|
+
let seed = 90211;
|
|
1089
|
+
const rnd = function() {
|
|
1090
|
+
seed = (seed + 0x6D2B79F5) | 0;
|
|
1091
|
+
let t = seed;
|
|
1092
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
1093
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
1094
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
1095
|
+
};
|
|
1096
|
+
const pick = function(list) { return list[Math.floor(rnd() * list.length)]; };
|
|
1097
|
+
const cityOf = function(address) { const parts = address.split(",").map(function(p) { return p.trim(); }); return parts[parts.length - 1].replace(/^\d+\s*/, ""); };
|
|
1098
|
+
|
|
1099
|
+
const list = [];
|
|
1100
|
+
let nextId = 1;
|
|
1101
|
+
|
|
1102
|
+
// 1. From the orders
|
|
1103
|
+
const byEmail = {};
|
|
1104
|
+
OrdersPage.getOrders().forEach(function(order) {
|
|
1105
|
+
const key = order.customer.email.toLowerCase();
|
|
1106
|
+
if (!byEmail[key]) {
|
|
1107
|
+
byEmail[key] = {
|
|
1108
|
+
id: nextId++, name: order.customer.name, email: order.customer.email, phone: order.customer.phone,
|
|
1109
|
+
address: order.address, city: cityOf(order.address),
|
|
1110
|
+
orders: [], orderCount: 0, totalSpent: 0, firstOrderAt: order.time, lastOrderAt: order.time,
|
|
1111
|
+
tags: [], notes: [], consent: (rnd() < 0.7) ? 1 : 0, consentAt: 0, blocked: 0, registeredAt: 0,
|
|
1112
|
+
};
|
|
1113
|
+
list.push(byEmail[key]);
|
|
1114
|
+
}
|
|
1115
|
+
const c = byEmail[key];
|
|
1116
|
+
c.orders.push(order);
|
|
1117
|
+
c.orderCount++;
|
|
1118
|
+
if (!["cancelled", "refunded"].includes(order.status)) c.totalSpent += order.total;
|
|
1119
|
+
if (order.time < c.firstOrderAt) c.firstOrderAt = order.time;
|
|
1120
|
+
if (order.time > c.lastOrderAt) c.lastOrderAt = order.time;
|
|
1121
|
+
});
|
|
1122
|
+
const recompute = CustomersPage.recompute;
|
|
1123
|
+
list.forEach(recompute);
|
|
1124
|
+
|
|
1125
|
+
// WHY: The test orders are only from the last 60 days and every customer has many. For the segments to be
|
|
1126
|
+
// visible, two customers keep only their old orders ("At risk") and two only their recent ones ("New").
|
|
1127
|
+
list.slice(0, 2).forEach(function(c) { c.orders = c.orders.filter(function(o) { return o.time < now - 50 * DAY; }); recompute(c); });
|
|
1128
|
+
list.slice(2, 4).forEach(function(c) { c.orders = c.orders.filter(function(o) { return o.time > now - 12 * DAY; }); recompute(c); });
|
|
1129
|
+
|
|
1130
|
+
list.forEach(function(c) {
|
|
1131
|
+
c.registeredAt = c.firstOrderAt - Math.round(rnd() * 10) * DAY;
|
|
1132
|
+
c.consentAt = c.registeredAt;
|
|
1133
|
+
if (rnd() < 0.3) c.tags.push("newsletter");
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
// VIP threshold: top 30% of the spending
|
|
1137
|
+
const spends = list.map(function(c) { return c.totalSpent; }).sort(function(a, b) { return a - b; });
|
|
1138
|
+
CustomersPage.vipThreshold = spends[Math.floor(spends.length * 0.7)] || Infinity;
|
|
1139
|
+
list.forEach(function(c) { if (c.totalSpent >= CustomersPage.vipThreshold) c.tags.push("vip"); });
|
|
1140
|
+
|
|
1141
|
+
// 2. Registered customers without an order (leads)
|
|
1142
|
+
const LEADS = [
|
|
1143
|
+
["Burak Sahin", "burak.sahin@mail.com", "Istanbul"], ["Elif Kaya", "elif.kaya@mail.com", "Ankara"], ["Lukas Meyer", "lukas.meyer@mail.de", "Munich"],
|
|
1144
|
+
["Zeynep Acar", "zeynep.acar@mail.com", "Izmir"], ["Omer Tas", "omer.tas@mail.com", "Bursa"], ["Sofia Rossi", "sofia.rossi@mail.it", "Milan"],
|
|
1145
|
+
["Kerem Ulu", "kerem.ulu@mail.com", "Antalya"], ["Nil Aydin", "nil.aydin@mail.com", "Istanbul"], ["Jan de Vries", "jan.devries@mail.nl", "Utrecht"],
|
|
1146
|
+
["Melis Er", "melis.er@mail.com", "Eskisehir"], ["Cem Polat", "cem.polat@mail.com", "Mersin"], ["Ayse Demir", "ayse.demir@mail.com", "Konya"],
|
|
1147
|
+
["Marta Nowak", "marta.nowak@mail.pl", "Krakow"], ["Baris Koc", "baris.koc@mail.com", "Samsun"], ["Ipek Yildiz", "ipek.yildiz@mail.com", "Istanbul"],
|
|
1148
|
+
["Tom Becker", "tom.becker@mail.de", "Hamburg"], ["Gizem Ak", "gizem.ak@mail.com", "Adana"], ["Ahmet Kilic", "ahmet.kilic@mail.com", "Gaziantep"],
|
|
1149
|
+
["Laura Bianchi", "laura.bianchi@mail.it", "Rome"], ["Emir Cetin", "emir.cetin@mail.com", "Trabzon"], ["Derya Sen", "derya.sen@mail.com", "Ankara"],
|
|
1150
|
+
["Pieter Bakker", "pieter.bakker@mail.nl", "Rotterdam"], ["Sude Arslan", "sude.arslan@mail.com", "Izmir"], ["Yusuf Kara", "yusuf.kara@mail.com", "Kayseri"],
|
|
1151
|
+
];
|
|
1152
|
+
LEADS.forEach(function(item) {
|
|
1153
|
+
const registeredAt = now - Math.round(rnd() * 90) * DAY - Math.round(rnd() * 20) * 3600000;
|
|
1154
|
+
list.push({
|
|
1155
|
+
id: nextId++, name: item[0], email: item[1], phone: "+90 5" + String(Math.floor(rnd() * 1e9)).padStart(9, "0"),
|
|
1156
|
+
address: "", city: item[2],
|
|
1157
|
+
orders: [], orderCount: 0, totalSpent: 0, firstOrderAt: 0, lastOrderAt: 0,
|
|
1158
|
+
tags: (rnd() < 0.25) ? ["newsletter"] : [], notes: [], consent: (rnd() < 0.5) ? 1 : 0, consentAt: registeredAt, blocked: (rnd() < 0.08) ? 1 : 0, registeredAt: registeredAt,
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
|
|
1162
|
+
// A few notes, so the panel is not empty
|
|
1163
|
+
list[0].notes.push({ time: now - 12 * DAY, text: "Asked for an invoice with the company name. Sent by e-mail.", by: "Deniz Arslan" });
|
|
1164
|
+
list[0].notes.push({ time: now - 3 * DAY, text: "Called about the late delivery of ORD-100012. Coupon given.", by: "Ceren Aktas" });
|
|
1165
|
+
list[3].notes.push({ time: now - 20 * DAY, text: "Wholesale customer candidate. Wants a price list.", by: "Zeynep Karaca" });
|
|
1166
|
+
list[3].tags.push("wholesale");
|
|
1167
|
+
|
|
1168
|
+
CustomersPage._customers = list;
|
|
1169
|
+
return list;
|
|
1170
|
+
|
|
1171
|
+
};
|