@bendyline/gilde 0.3.6 → 0.3.8
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/authoring/chat-models/lfm3-1.7b-q4.json +3 -3
- package/authoring/chat-models/minicpm-v4.7-35b-a3b-q4.json +10 -4
- package/authoring/chat-models/muse-glimmer-30b-q4.json +39 -3
- package/authoring/chat-models/nemotron3.5-bolt-74b-iq2.json +19 -3
- package/authoring/chat-models/nemotron3.5-bolt-e4b-q4.json +29 -3
- package/authoring/chat-models/qwen3.8-27b-q2.json +21 -5
- package/authoring/chat-models/qwen3.8-27b-q3.json +21 -5
- package/authoring/chat-models/qwen3.8-27b-q4.json +27 -5
- package/authoring/chat-models/qwen3.8-27b-q6.json +26 -6
- package/authoring/chat-models/qwen3.8-27b-q8.json +27 -6
- package/authoring/chat-models/qwen3.8-flash-next-q2.json +6 -3
- package/authoring/page-demo-bootstrap.js +96 -23
- package/data/chat-models/index.json +1 -1
- package/data/chat-models/lf/lfm3-1.7b-q4/manifest.json +3 -3
- package/data/chat-models/lf/lfm3-1.7b-q4/versions/1.0.1/manifest.json +15 -0
- package/data/chat-models/mi/minicpm-v4.7-35b-a3b-q4/manifest.json +3 -3
- package/data/chat-models/mi/minicpm-v4.7-35b-a3b-q4/versions/1.0.1/manifest.json +94 -0
- package/data/chat-models/mu/muse-glimmer-30b-q4/manifest.json +35 -2
- package/data/chat-models/mu/muse-glimmer-30b-q4/versions/1.0.3/manifest.json +31 -0
- package/data/chat-models/mu/muse-glimmer-30b-q4/versions/1.0.4/manifest.json +33 -0
- package/data/chat-models/ne/nemotron3.5-bolt-74b-iq2/manifest.json +10 -4
- package/data/chat-models/ne/nemotron3.5-bolt-74b-iq2/versions/1.0.1/manifest.json +31 -0
- package/data/chat-models/ne/nemotron3.5-bolt-e4b-q4/manifest.json +21 -4
- package/data/chat-models/ne/nemotron3.5-bolt-e4b-q4/versions/1.0.2/manifest.json +26 -0
- package/data/chat-models/qw/qwen3.8-27b-q2/manifest.json +20 -3
- package/data/chat-models/qw/qwen3.8-27b-q2/versions/1.0.1/manifest.json +31 -0
- package/data/chat-models/qw/qwen3.8-27b-q3/manifest.json +23 -6
- package/data/chat-models/qw/qwen3.8-27b-q3/versions/1.0.2/manifest.json +31 -0
- package/data/chat-models/qw/qwen3.8-27b-q4/manifest.json +26 -3
- package/data/chat-models/qw/qwen3.8-27b-q4/versions/1.0.6/manifest.json +128 -0
- package/data/chat-models/qw/qwen3.8-27b-q4/versions/1.0.7/manifest.json +128 -0
- package/data/chat-models/qw/qwen3.8-27b-q6/manifest.json +25 -9
- package/data/chat-models/qw/qwen3.8-27b-q6/versions/1.0.4/manifest.json +138 -0
- package/data/chat-models/qw/qwen3.8-27b-q8/manifest.json +20 -3
- package/data/chat-models/qw/qwen3.8-27b-q8/versions/1.0.3/manifest.json +148 -0
- package/data/chat-models/qw/qwen3.8-flash-next-q2/manifest.json +5 -2
- package/data/chat-models/qw/qwen3.8-flash-next-q2/versions/1.0.4/manifest.json +47 -0
- package/data/chat-models/raw-index.json +1 -1
- package/data/craftbook-templates/index.json +1 -1
- package/data/craftbook-templates/raw-index.json +1 -1
- package/data/craftbook-templates/su/summarize-long/versions/1.0.6/craftbook.json +251 -0
- package/data/craftbook-templates/su/summarize-long/versions/1.0.6/test.json +76 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/about.md +16 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/close.json +8 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/ledger.json +5 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/manifest.json +496 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/mission.md +5 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/pages/books/application.js +417 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/pages/books/demo-chat.js +515 -0
- package/data/project-types/bo/books-and-close/versions/1.1.0/pages/books/index.html +880 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/about.md +13 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/assets.json +11 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/campaign.json +13 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/manifest.json +610 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/mission.md +6 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/pages/campaign/application.js +439 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/pages/campaign/demo-chat.js +290 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/pages/campaign/index.html +624 -0
- package/data/project-types/ca/campaign-room/versions/1.1.0/results.json +4 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/about.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/care.json +4 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/manifest.json +232 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/meds.json +8 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/mission.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/pages/dashboard/application.js +186 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/pages/dashboard/demo-chat.js +224 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.0/pages/dashboard/index.html +365 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/about.md +15 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/cashflow.json +11 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/manifest.json +443 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/mission.md +6 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/pages/forecast/application.js +441 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/pages/forecast/demo-chat.js +517 -0
- package/data/project-types/ca/cash-flow-planner/versions/1.1.0/pages/forecast/index.html +848 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/about.md +13 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/manifest.json +376 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/milestones.json +10 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/mission.md +5 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/pages/delivery/application.js +272 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/pages/delivery/demo-chat.js +185 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/pages/delivery/index.html +593 -0
- package/data/project-types/cl/client-delivery/versions/1.1.0/projects.json +10 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/about.md +12 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/evidence.json +4 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/manifest.json +361 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/mission.md +5 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/obligations.json +9 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/pages/register/application.js +292 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/pages/register/demo-chat.js +156 -0
- package/data/project-types/co/compliance-register/versions/1.1.0/pages/register/index.html +406 -0
- package/data/project-types/co/content-studio/versions/1.1.0/about.md +12 -0
- package/data/project-types/co/content-studio/versions/1.1.0/calendar.json +10 -0
- package/data/project-types/co/content-studio/versions/1.1.0/manifest.json +541 -0
- package/data/project-types/co/content-studio/versions/1.1.0/mission.md +6 -0
- package/data/project-types/co/content-studio/versions/1.1.0/pages/studio/application.js +413 -0
- package/data/project-types/co/content-studio/versions/1.1.0/pages/studio/demo-chat.js +247 -0
- package/data/project-types/co/content-studio/versions/1.1.0/pages/studio/index.html +486 -0
- package/data/project-types/co/content-studio/versions/1.1.0/pieces.json +12 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/about.md +15 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/actions.json +9 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/feedback.json +4 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/manifest.json +512 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/mission.md +6 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/pages/voice/application.js +303 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/pages/voice/demo-chat.js +276 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/pages/voice/index.html +832 -0
- package/data/project-types/cu/customer-voice/versions/1.1.0/themes.json +8 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/about.md +20 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/manifest.json +70 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/mission.md +4 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/analytics.js +63 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/application.js +118 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/dashboard.css +94 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/dashboard.js +177 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/datasets.js +44 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/demo-chat.js +181 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/demo.js +27 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/index.html +142 -0
- package/data/project-types/da/data-analysis/versions/1.1.0/pages/insights.js +136 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/about.md +6 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/manifest.json +95 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/mission.md +3 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/pages/gallery/application.js +124 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/pages/gallery/demo-chat.js +236 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/pages/gallery/index.html +238 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/schemes/index.json +9 -0
- package/data/project-types/de/design-scheme/versions/1.1.0/schemes/warm-dusk.json +4 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/about.md +14 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/budget.json +5 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/event.json +12 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/guests.json +9 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/manifest.json +785 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/mission.md +7 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/pages/desk/application.js +1114 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/pages/desk/demo-chat.js +229 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/pages/desk/index.html +864 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/vendors.json +10 -0
- package/data/project-types/ev/event-desk/versions/1.1.0/venues.json +11 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/about.md +7 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/budget.json +5 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/guests.json +10 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/manifest.json +260 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/mission.md +6 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/pages/dashboard/application.js +234 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/pages/dashboard/demo-chat.js +231 -0
- package/data/project-types/ev/event-planner/versions/1.1.0/pages/dashboard/index.html +322 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/about.md +8 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/craftbooks/training-recap.json +34 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/manifest.json +249 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/mission.md +7 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/pages/dashboard/application.js +148 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/pages/dashboard/demo-chat.js +253 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/pages/dashboard/index.html +419 -0
- package/data/project-types/fi/fitness-coach/versions/1.2.0/training.json +6 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/about.md +8 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/deck.json +7 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/manifest.json +243 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/mission.md +6 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/pages/review/application.js +147 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/pages/review/demo-chat.js +331 -0
- package/data/project-types/fl/flashcards/versions/1.3.0/pages/review/index.html +635 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/about.md +6 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/invoices.json +9 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/manifest.json +215 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/mission.md +6 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/pages/dashboard/application.js +194 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/pages/dashboard/demo-chat.js +244 -0
- package/data/project-types/fr/freelance-office/versions/1.1.0/pages/dashboard/index.html +275 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/about.md +7 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/donations.json +7 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/manifest.json +175 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/mission.md +6 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/pages/dashboard/application.js +158 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/pages/dashboard/demo-chat.js +171 -0
- package/data/project-types/fu/fundraiser-hq/versions/1.1.0/pages/dashboard/index.html +247 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/about.md +14 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/manifest.json +549 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/mission.md +6 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/opportunities.json +12 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/pages/grants/application.js +370 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/pages/grants/demo-chat.js +197 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/pages/grants/index.html +501 -0
- package/data/project-types/gr/grants-and-proposals/versions/1.1.0/requirements.json +8 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/about.md +20 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/candidates.json +12 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/feedback.json +4 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/manifest.json +428 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/mission.md +5 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/pages/desk/application.js +345 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/pages/desk/demo-chat.js +231 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/pages/desk/index.html +523 -0
- package/data/project-types/hi/hiring-desk/versions/1.1.0/roles.json +10 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/about.md +6 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/ledger.json +5 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/manifest.json +191 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/mission.md +5 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/pages/dashboard/application.js +176 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/pages/dashboard/demo-chat.js +207 -0
- package/data/project-types/ho/household-budget/versions/1.1.0/pages/dashboard/index.html +291 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/about.md +7 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/manifest.json +236 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/mission.md +8 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/pages/dashboard/application.js +196 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/pages/dashboard/demo-chat.js +178 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/pages/dashboard/index.html +327 -0
- package/data/project-types/ho/household-manual/versions/1.1.0/systems.json +8 -0
- package/data/project-types/im/image-feed/versions/1.1.0/about.md +21 -0
- package/data/project-types/im/image-feed/versions/1.1.0/manifest.json +330 -0
- package/data/project-types/im/image-feed/versions/1.1.0/mission.md +10 -0
- package/data/project-types/im/image-feed/versions/1.1.0/pages/gallery/application.js +111 -0
- package/data/project-types/im/image-feed/versions/1.1.0/pages/gallery/demo-chat.js +269 -0
- package/data/project-types/im/image-feed/versions/1.1.0/pages/gallery/index.html +899 -0
- package/data/project-types/im/image-feed/versions/1.1.0/posts/index.json +4 -0
- package/data/project-types/im/image-feed/versions/1.1.0/style-guide.md +24 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/about.md +12 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/items.json +9 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/manifest.json +381 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/mission.md +6 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/orders.json +10 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/pages/stock/application.js +320 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/pages/stock/demo-chat.js +200 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/pages/stock/index.html +398 -0
- package/data/project-types/in/inventory-reorder/versions/1.1.0/pages/stock/rules.js +665 -0
- package/data/project-types/index.json +1 -1
- package/data/project-types/jo/job-hunt/versions/1.1.0/about.md +10 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/activity.json +4 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/manifest.json +296 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/mission.md +9 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/pages/dashboard/application.js +240 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/pages/dashboard/demo-chat.js +176 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/pages/dashboard/index.html +424 -0
- package/data/project-types/jo/job-hunt/versions/1.1.0/pipeline.json +6 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/about.md +8 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/manifest.json +245 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/mission.md +4 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/pages/dashboard/application.js +118 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/pages/dashboard/demo-chat.js +439 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/pages/dashboard/index.html +503 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/progress.json +10 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/reviews.json +3 -0
- package/data/project-types/la/language-trainer/versions/1.2.0/scenarios.json +84 -0
- package/data/project-types/li/life-binder/versions/1.1.0/about.md +7 -0
- package/data/project-types/li/life-binder/versions/1.1.0/documents.json +145 -0
- package/data/project-types/li/life-binder/versions/1.1.0/manifest.json +206 -0
- package/data/project-types/li/life-binder/versions/1.1.0/mission.md +6 -0
- package/data/project-types/li/life-binder/versions/1.1.0/pages/dashboard/application.js +172 -0
- package/data/project-types/li/life-binder/versions/1.1.0/pages/dashboard/demo-chat.js +184 -0
- package/data/project-types/li/life-binder/versions/1.1.0/pages/dashboard/index.html +287 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/about.md +10 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/manifest.json +245 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/menu.json +5 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/mission.md +5 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/pages/dashboard/application.js +243 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/pages/dashboard/demo-chat.js +139 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/pages/dashboard/index.html +253 -0
- package/data/project-types/me/meal-planner/versions/1.1.0/pantry.json +9 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/about.md +14 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/hires.json +8 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/manifest.json +325 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/mission.md +5 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/pages/plans/application.js +248 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/pages/plans/demo-chat.js +188 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/pages/plans/index.html +439 -0
- package/data/project-types/ne/new-hire-onboarding/versions/1.1.0/tasks.json +8 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/about.md +7 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/chapters.json +10 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/manifest.json +233 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/mission.md +7 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/pages/dashboard/application.js +225 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/pages/dashboard/demo-chat.js +283 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/pages/dashboard/index.html +342 -0
- package/data/project-types/no/novel-writing-room/versions/1.1.0/sessions.json +6 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/about.md +15 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/manifest.json +614 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/mission.md +3 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/pages/quotes/application.js +386 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/pages/quotes/demo-chat.js +263 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/pages/quotes/index.html +941 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/quotes.json +10 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.0/rates.json +8 -0
- package/data/project-types/raw-index.json +1 -1
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/about.md +10 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/activity.json +4 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/deals.json +12 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/manifest.json +450 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/mission.md +3 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/pages/pipeline/application.js +270 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/pages/pipeline/demo-chat.js +219 -0
- package/data/project-types/sa/sales-pipeline/versions/1.1.0/pages/pipeline/index.html +710 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/about.md +13 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/availability.json +8 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/manifest.json +544 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/mission.md +5 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/pages/roster/application.js +418 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/pages/roster/demo-chat.js +218 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/pages/roster/index.html +466 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/pages/roster/rules.js +878 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/rules.json +4 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/shifts.json +8 -0
- package/data/project-types/sh/shift-roster/versions/1.1.0/staff.json +8 -0
- package/data/project-types/so/social-feed/versions/1.1.0/about.md +19 -0
- package/data/project-types/so/social-feed/versions/1.1.0/manifest.json +348 -0
- package/data/project-types/so/social-feed/versions/1.1.0/mission.md +10 -0
- package/data/project-types/so/social-feed/versions/1.1.0/pages/dashboard/application.js +119 -0
- package/data/project-types/so/social-feed/versions/1.1.0/pages/dashboard/demo-chat.js +321 -0
- package/data/project-types/so/social-feed/versions/1.1.0/pages/dashboard/index.html +837 -0
- package/data/project-types/so/social-feed/versions/1.1.0/posts/index.json +4 -0
- package/data/project-types/so/social-feed/versions/1.1.0/voice-guide.md +22 -0
- package/data/project-types/so/sop-library/versions/1.1.0/about.md +15 -0
- package/data/project-types/so/sop-library/versions/1.1.0/manifest.json +347 -0
- package/data/project-types/so/sop-library/versions/1.1.0/mission.md +4 -0
- package/data/project-types/so/sop-library/versions/1.1.0/pages/library/application.js +235 -0
- package/data/project-types/so/sop-library/versions/1.1.0/pages/library/demo-chat.js +184 -0
- package/data/project-types/so/sop-library/versions/1.1.0/pages/library/index.html +529 -0
- package/data/project-types/so/sop-library/versions/1.1.0/sops/index.json +10 -0
- package/data/project-types/su/support-desk/versions/1.1.0/about.md +15 -0
- package/data/project-types/su/support-desk/versions/1.1.0/manifest.json +395 -0
- package/data/project-types/su/support-desk/versions/1.1.0/mission.md +5 -0
- package/data/project-types/su/support-desk/versions/1.1.0/pages/desk/application.js +274 -0
- package/data/project-types/su/support-desk/versions/1.1.0/pages/desk/demo-chat.js +206 -0
- package/data/project-types/su/support-desk/versions/1.1.0/pages/desk/index.html +588 -0
- package/data/project-types/su/support-desk/versions/1.1.0/tickets.json +10 -0
- package/data/project-types/te/team-goals/versions/1.1.0/about.md +12 -0
- package/data/project-types/te/team-goals/versions/1.1.0/actions.json +8 -0
- package/data/project-types/te/team-goals/versions/1.1.0/checkins.json +4 -0
- package/data/project-types/te/team-goals/versions/1.1.0/goals.json +9 -0
- package/data/project-types/te/team-goals/versions/1.1.0/keyresults.json +8 -0
- package/data/project-types/te/team-goals/versions/1.1.0/manifest.json +528 -0
- package/data/project-types/te/team-goals/versions/1.1.0/mission.md +5 -0
- package/data/project-types/te/team-goals/versions/1.1.0/pages/goals/application.js +347 -0
- package/data/project-types/te/team-goals/versions/1.1.0/pages/goals/demo-chat.js +206 -0
- package/data/project-types/te/team-goals/versions/1.1.0/pages/goals/index.html +547 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/about.md +15 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/completions.json +4 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/courses.json +8 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/manifest.json +428 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/mission.md +5 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/pages/tracker/application.js +299 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/pages/tracker/demo-chat.js +225 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/pages/tracker/index.html +555 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/people.json +8 -0
- package/data/project-types/tr/training-tracker/versions/1.1.0/quizzes.json +8 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/about.md +7 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/journal.json +4 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/manifest.json +296 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/mission.md +4 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/packing.json +8 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/pages/dashboard/application.js +176 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/pages/dashboard/demo-chat.js +264 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/pages/dashboard/index.html +373 -0
- package/data/project-types/tr/trip-planner/versions/1.1.0/trip.json +8 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/about.md +15 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/contracts.json +10 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/manifest.json +545 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/mission.md +5 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/pages/desk/application.js +323 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/pages/desk/demo-chat.js +236 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/pages/desk/index.html +540 -0
- package/data/project-types/ve/vendor-contracts/versions/1.1.0/vendors.json +8 -0
- package/package.json +1 -1
- package/schemas/chat-model-identity.schema.json +184 -0
- package/schemas/chat-model-version.schema.json +19 -0
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="gezel-demo" content="standalone" />
|
|
7
|
+
<title>Quotes and bids</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root {
|
|
10
|
+
color-scheme: light dark;
|
|
11
|
+
--bg: #f4f3ef; --card: #fffdf9; --ink: #25262a; --muted: #66625a; --line: #dcd6ca;
|
|
12
|
+
--accent: #3a5a8c; --accent-bg: #e3e9f3; --late: #a3341f; --late-bg: #f7e1da; --soon: #8a5a12; --soon-bg: #f6ead2;
|
|
13
|
+
--ok: #3f6b4a; --ok-bg: #e2eedf; --chip: #ece7dd; --stripe: #f8f6f1;
|
|
14
|
+
}
|
|
15
|
+
:root[data-theme='dark'] {
|
|
16
|
+
--bg: #16171a; --card: #202125; --ink: #ebe8e1; --muted: #a29d93; --line: #383a3f;
|
|
17
|
+
--accent: #9db8e6; --accent-bg: #222b3a; --late: #f0927a; --late-bg: #3c231c; --soon: #e6bd72; --soon-bg: #3a2f1c;
|
|
18
|
+
--ok: #8fc29b; --ok-bg: #22301f; --chip: #2c2d31; --stripe: #1c1d21;
|
|
19
|
+
}
|
|
20
|
+
@media (prefers-color-scheme: dark) {
|
|
21
|
+
:root:not([data-theme='light']) {
|
|
22
|
+
--bg: #16171a; --card: #202125; --ink: #ebe8e1; --muted: #a29d93; --line: #383a3f;
|
|
23
|
+
--accent: #9db8e6; --accent-bg: #222b3a; --late: #f0927a; --late-bg: #3c231c; --soon: #e6bd72; --soon-bg: #3a2f1c;
|
|
24
|
+
--ok: #8fc29b; --ok-bg: #22301f; --chip: #2c2d31; --stripe: #1c1d21;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
* { box-sizing: border-box; }
|
|
28
|
+
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body, system-ui, sans-serif); font-size: 15px; line-height: 1.5; padding: 1.5rem 1.25rem; }
|
|
29
|
+
main { max-width: 900px; margin: 0 auto; }
|
|
30
|
+
h1 { font-family: var(--font-heading, Georgia, serif); font-size: 1.5rem; font-weight: 400; margin: 0 0 0.2rem; }
|
|
31
|
+
h2 { font-family: var(--font-heading, Georgia, serif); font-size: 1.1rem; font-weight: 400; margin: 0 0 0.6rem; }
|
|
32
|
+
h3 { font-size: 1rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
|
|
33
|
+
.sub { color: var(--muted); margin: 0 0 1rem; }
|
|
34
|
+
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 1.2rem; }
|
|
35
|
+
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.9rem; min-width: 0; }
|
|
36
|
+
.tile b { display: block; font-size: 1.35rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
|
|
37
|
+
.tile span { color: var(--muted); font-size: 0.85rem; }
|
|
38
|
+
.tile.late b { color: var(--late); }
|
|
39
|
+
section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin: 0 0 1rem; }
|
|
40
|
+
.due { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
|
|
41
|
+
.due li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; }
|
|
42
|
+
.due li.empty { display: block; }
|
|
43
|
+
.when { justify-self: start; font-family: var(--font-ui, system-ui, sans-serif); font-size: 0.8rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 4px; text-align: center; background: var(--chip); color: var(--muted); }
|
|
44
|
+
.when.late { background: var(--late-bg); color: var(--late); }
|
|
45
|
+
.when.soon { background: var(--soon-bg); color: var(--soon); }
|
|
46
|
+
.what b { font-weight: 600; }
|
|
47
|
+
.what small, .meta { display: block; color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
|
|
48
|
+
.empty { color: var(--muted); font-style: italic; margin: 0; }
|
|
49
|
+
.builder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 0.75rem; }
|
|
50
|
+
.builder-head .meta { margin-top: 0.15rem; }
|
|
51
|
+
.builder-keys { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
|
|
52
|
+
.builder-keys:empty { display: none; }
|
|
53
|
+
.key { min-height: 32px; padding: 0.25rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit; font-size: 0.85rem; white-space: nowrap; }
|
|
54
|
+
.key:hover { background: var(--stripe); border-color: var(--muted); }
|
|
55
|
+
.quote-link { display: inline; min-height: 28px; padding: 0.15rem 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; }
|
|
56
|
+
.quote-link:hover { text-decoration-color: currentColor; }
|
|
57
|
+
.pick { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); min-width: 0; max-width: 100%; }
|
|
58
|
+
.pick select { min-height: 40px; max-width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); font: inherit; font-size: 0.9rem; }
|
|
59
|
+
.table-wrap { overflow-x: auto; }
|
|
60
|
+
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
|
|
61
|
+
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.5rem 0.4rem; border-bottom: 1px solid var(--line); }
|
|
62
|
+
td { padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
63
|
+
td.num, th.num { text-align: right; white-space: nowrap; }
|
|
64
|
+
.lines tfoot td { border-bottom: 0; padding: 0.25rem 0.5rem; text-align: right; }
|
|
65
|
+
.lines tfoot tr:first-child td { padding-top: 0.6rem; }
|
|
66
|
+
.lines tfoot tr.total td { font-weight: 600; font-size: 1rem; padding-top: 0.45rem; border-top: 1px solid var(--line); }
|
|
67
|
+
.status { display: inline-block; font-size: 0.78rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--chip); }
|
|
68
|
+
.status.sent { background: var(--accent-bg); color: var(--accent); }
|
|
69
|
+
.status.won { background: var(--ok-bg); color: var(--ok); }
|
|
70
|
+
.status.lost { background: var(--late-bg); color: var(--late); }
|
|
71
|
+
.chip { display: inline-block; font-size: 0.75rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--chip); color: var(--muted); }
|
|
72
|
+
.chip.late { background: var(--late-bg); color: var(--late); }
|
|
73
|
+
.chip.soon { background: var(--soon-bg); color: var(--soon); }
|
|
74
|
+
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
|
|
75
|
+
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; align-content: start; font-size: 0.9rem; }
|
|
76
|
+
.log time { color: var(--muted); font-size: 0.8rem; margin-right: 0.35rem; }
|
|
77
|
+
.bar { height: 10px; border-radius: 4px; background: var(--late-bg); overflow: hidden; margin: 0.4rem 0 0.75rem; }
|
|
78
|
+
.bar span { display: block; height: 100%; background: var(--ok); }
|
|
79
|
+
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 1rem; padding: 0.5rem 0.65rem; border: 1px solid var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--card) 88%, var(--accent)); font-size: 0.85rem; }
|
|
80
|
+
.demo-banner[hidden] { display: none; }
|
|
81
|
+
.demo-reset { flex: none; min-height: 36px; padding: 0.3rem 0.7rem; border: 1px solid var(--accent); border-radius: 6px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
|
|
82
|
+
.note { color: var(--muted); font-size: 0.85rem; margin: 0.75rem 0 0; }
|
|
83
|
+
@media (max-width: 640px) {
|
|
84
|
+
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
85
|
+
.tile b { font-size: 1.15rem; }
|
|
86
|
+
.split { grid-template-columns: minmax(0, 1fr); }
|
|
87
|
+
.due li { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
|
|
88
|
+
.due li > .key { justify-self: start; }
|
|
89
|
+
table { font-size: 0.82rem; }
|
|
90
|
+
th { font-size: 0.7rem; letter-spacing: 0; padding: 0 0.3rem 0.4rem; }
|
|
91
|
+
td { padding: 0.45rem 0.3rem; }
|
|
92
|
+
.lines tfoot td { padding: 0.25rem 0.3rem; }
|
|
93
|
+
.lines td.qty { white-space: normal; }
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
96
|
+
<style>
|
|
97
|
+
[hidden]{display:none!important}body{font-family:var(--font-body,system-ui,sans-serif);line-height:1.5}h1,h2,h3{font-family:var(--font-heading,Georgia,serif)}button,input,select,textarea{font-family:var(--font-ui,system-ui,sans-serif)}:focus-visible{outline:3px solid var(--accent,#a65334);outline-offset:3px}main{min-width:0}.app-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:12px;margin:24px 0;align-items:start}.app-search{margin:0 0 12px;max-width:540px}.app-problem{padding:12px;border:1px solid currentColor;border-radius:6px;overflow-wrap:anywhere}.app-section-nav{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}.app-section-nav a{padding:8px 12px;border:1px solid var(--line,#92816a);border-radius:6px;color:inherit;text-decoration:none;font-size:14px}.app-section-nav a:hover{background:color-mix(in srgb,currentColor 8%,transparent)}html[data-gezel-fullscreen=true] main>h1{font-size:clamp(28px,3vw,40px);margin-top:0}main section{scroll-margin-top:16px}@media(max-width:620px){main{padding:16px!important}h1{overflow-wrap:anywhere}button{min-height:40px}}</style>
|
|
98
|
+
<style data-app-shell="2">
|
|
99
|
+
/* Shared app furniture from the Gezel app UX guide. The page owns everything else. */
|
|
100
|
+
:root{--app-action:var(--gezel-component-accent,#805128);--app-on-action:#fffaf3;--app-banner-bg:#f3eddf;--app-banner-line:#d6cbb8}
|
|
101
|
+
:root[data-theme=dark]{--app-action:var(--gezel-component-accent,#e0b78b);--app-on-action:#1f1a16;--app-banner-bg:#25221f;--app-banner-line:#4a4238}
|
|
102
|
+
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--app-action:var(--gezel-component-accent,#e0b78b);--app-on-action:#1f1a16;--app-banner-bg:#25221f;--app-banner-line:#4a4238}}
|
|
103
|
+
main h1{font-weight:400}
|
|
104
|
+
html[data-gezel-fullscreen=true] main h1{font-size:clamp(28px,3vw,40px);margin-top:0}
|
|
105
|
+
.app-tabs{margin:20px 0 24px}
|
|
106
|
+
.app-actionbar{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;margin:16px 0 24px}
|
|
107
|
+
.app-panel>.app-actionbar:first-child{margin-top:0}
|
|
108
|
+
.app-settings{display:grid;gap:16px;max-width:760px;margin:0 0 24px}
|
|
109
|
+
.app-search{margin:0}
|
|
110
|
+
.app-search gezel-collection-filter{margin:0 0 12px;max-width:540px}
|
|
111
|
+
.app-primary{min-height:44px;padding:8px 16px;border:1px solid var(--app-action);border-radius:6px;background:var(--app-action);color:var(--app-on-action);font-weight:600}
|
|
112
|
+
.app-primary:disabled{display:none}
|
|
113
|
+
main li.empty{display:block;grid-column:1/-1}
|
|
114
|
+
html[data-app-legacy] [data-app-action]{display:none!important}
|
|
115
|
+
[data-gezel-demo-banner]:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;margin:0 0 16px;padding:8px 8px 8px 14px;border:1px solid var(--app-banner-line);border-radius:10px;background:var(--app-banner-bg);color:inherit;font-size:14px;line-height:1.4}
|
|
116
|
+
[data-gezel-demo-banner] button{min-height:32px;padding:4px 12px;border:1px solid var(--app-banner-line);border-radius:6px;background:transparent;color:inherit;font-size:13px}
|
|
117
|
+
@media(max-width:620px){.tiles,.stats,.summary{grid-template-columns:repeat(2,minmax(0,1fr))!important}:is(.tiles,.stats,.summary):has(>:nth-child(3):last-child){grid-template-columns:repeat(3,minmax(0,1fr))!important}:is(.tiles,.stats,.summary):has(>:only-child){grid-template-columns:minmax(0,1fr)!important}}
|
|
118
|
+
</style>
|
|
119
|
+
<script>
|
|
120
|
+
var appDisposed=false,appLoadRevision=0,appSubscriptions=[];
|
|
121
|
+
function reportAppError(error){var output=document.getElementById('app-load-error');if(output){output.hidden=!error;output.textContent=error?'Could not refresh this view. '+(error.message||'Try again.'):'';}}
|
|
122
|
+
window.addEventListener('pagehide',function(){appDisposed=true;appLoadRevision++;appSubscriptions.forEach(function(stop){stop();});},{once:true});
|
|
123
|
+
</script>
|
|
124
|
+
</head>
|
|
125
|
+
<body>
|
|
126
|
+
<main>
|
|
127
|
+
<p class="app-problem" id="app-load-error" role="status" hidden></p>
|
|
128
|
+
<div class="demo-banner" data-gezel-demo-banner hidden>
|
|
129
|
+
<span><strong>Demo mode</strong>: Brightline Electric’s sample quotes. Changes stay in this page.</span>
|
|
130
|
+
<button type="button" class="demo-reset" onclick="location.reload()">Reset demo</button>
|
|
131
|
+
</div>
|
|
132
|
+
<h1>Quotes and bids</h1>
|
|
133
|
+
<p class="sub" id="sub">Loading the quotes…</p>
|
|
134
|
+
<div class="tiles">
|
|
135
|
+
<div class="tile"><b id="t-drafts">$0</b><span id="t-drafts-label">Drafts</span></div>
|
|
136
|
+
<div class="tile"><b id="t-waiting">$0</b><span id="t-waiting-label">Sent and waiting</span></div>
|
|
137
|
+
<div class="tile"><b id="t-due">0</b><span>Follow-ups due now</span></div>
|
|
138
|
+
<div class="tile"><b id="t-rate">–</b><span id="t-rate-label">Win rate</span></div>
|
|
139
|
+
</div>
|
|
140
|
+
<section id="follow-section">
|
|
141
|
+
<h2>Follow-ups</h2>
|
|
142
|
+
<ul class="due" id="follow"></ul>
|
|
143
|
+
<p class="meta" id="expiring" hidden></p>
|
|
144
|
+
</section>
|
|
145
|
+
<section id="builder-section">
|
|
146
|
+
<h2>Quote builder</h2>
|
|
147
|
+
<div class="builder-head">
|
|
148
|
+
<div>
|
|
149
|
+
<h3 id="b-title">No quote yet</h3>
|
|
150
|
+
<span class="meta" id="b-meta"></span>
|
|
151
|
+
<div class="builder-keys" id="b-keys"></div>
|
|
152
|
+
</div>
|
|
153
|
+
<label class="pick" id="b-pick-wrap" hidden>Showing
|
|
154
|
+
<select id="b-pick" aria-label="Quote shown in the builder"></select>
|
|
155
|
+
</label>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="table-wrap">
|
|
158
|
+
<table class="lines">
|
|
159
|
+
<thead><tr><th class="num">#</th><th>Item</th><th class="num">Qty</th><th class="num">Rate</th><th class="num">Amount</th></tr></thead>
|
|
160
|
+
<tbody id="b-lines"></tbody>
|
|
161
|
+
<tfoot id="b-totals"></tfoot>
|
|
162
|
+
</table>
|
|
163
|
+
</div>
|
|
164
|
+
<p class="note">Every amount and total is worked out from the lines and the tax rate you set, exact to the cent. Which work is taxable is a question for your accountant or the state revenue department; this is not tax advice.</p>
|
|
165
|
+
</section>
|
|
166
|
+
<section id="quotes-section">
|
|
167
|
+
<h2>All quotes</h2>
|
|
168
|
+
<div class="table-wrap">
|
|
169
|
+
<table>
|
|
170
|
+
<thead><tr><th>Quote</th><th>Status</th><th class="num">Total</th><th>Next</th></tr></thead>
|
|
171
|
+
<tbody id="quotes-body"></tbody>
|
|
172
|
+
</table>
|
|
173
|
+
</div>
|
|
174
|
+
</section>
|
|
175
|
+
<section id="results-section">
|
|
176
|
+
<h2>Won and lost</h2>
|
|
177
|
+
<p id="win-line" class="meta"></p>
|
|
178
|
+
<div class="bar" id="win-bar" hidden><span id="win-fill"></span></div>
|
|
179
|
+
<ul class="log" id="results"></ul>
|
|
180
|
+
</section>
|
|
181
|
+
<section id="rates-section">
|
|
182
|
+
<h2>Rates and terms</h2>
|
|
183
|
+
<div class="split">
|
|
184
|
+
<div class="table-wrap">
|
|
185
|
+
<table>
|
|
186
|
+
<thead><tr><th>Rate</th><th>Kind</th><th class="num">Price</th></tr></thead>
|
|
187
|
+
<tbody id="rates-body"></tbody>
|
|
188
|
+
</table>
|
|
189
|
+
</div>
|
|
190
|
+
<ul class="log" id="terms"></ul>
|
|
191
|
+
</div>
|
|
192
|
+
</section>
|
|
193
|
+
</main>
|
|
194
|
+
<script src="demo-chat.js"></script>
|
|
195
|
+
<script>
|
|
196
|
+
(function () {
|
|
197
|
+
'use strict';
|
|
198
|
+
// ── quote-rules-start ──
|
|
199
|
+
// Pure derivations: money in integer cents, line amounts and quote totals that
|
|
200
|
+
// are exact to the cent (quantities to a thousandth, tax rates in basis
|
|
201
|
+
// points, both rounded half up), local calendar days for follow-ups, finding a
|
|
202
|
+
// quote or a line by name, and the quotes picture the crew reads. Kept
|
|
203
|
+
// self-contained between these sentinels so unit tests execute the shipped
|
|
204
|
+
// bytes.
|
|
205
|
+
var DAY_MS = 86400000;
|
|
206
|
+
var STAGES = ['draft', 'sent', 'won', 'lost'];
|
|
207
|
+
var KINDS = ['labor', 'materials', 'other'];
|
|
208
|
+
var NAME_STOP = ['the', 'and', 'for', 'with', 'our', 'quote', 'bid', 'job', 'estimate'];
|
|
209
|
+
|
|
210
|
+
function pad(n) {
|
|
211
|
+
return n < 10 ? '0' + n : String(n);
|
|
212
|
+
}
|
|
213
|
+
function localDay(ms) {
|
|
214
|
+
var d = new Date(ms);
|
|
215
|
+
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());
|
|
216
|
+
}
|
|
217
|
+
function normalizeDate(text) {
|
|
218
|
+
var raw = String(text || '').trim();
|
|
219
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(raw)) return raw.slice(0, 10);
|
|
220
|
+
var parsed = Date.parse(raw);
|
|
221
|
+
return isFinite(parsed) ? localDay(parsed) : null;
|
|
222
|
+
}
|
|
223
|
+
function daysLeft(day, nowMs) {
|
|
224
|
+
var due = Date.parse(String(day).slice(0, 10) + 'T00:00:00');
|
|
225
|
+
var today = Date.parse(localDay(nowMs) + 'T00:00:00');
|
|
226
|
+
return Math.round((due - today) / DAY_MS);
|
|
227
|
+
}
|
|
228
|
+
function addDays(day, n) {
|
|
229
|
+
var d = new Date(String(day).slice(0, 10) + 'T12:00:00');
|
|
230
|
+
d.setDate(d.getDate() + n);
|
|
231
|
+
return localDay(d.getTime());
|
|
232
|
+
}
|
|
233
|
+
function when(days) {
|
|
234
|
+
if (days < 0) return -days + (days === -1 ? ' day late' : ' days late');
|
|
235
|
+
if (days === 0) return 'today';
|
|
236
|
+
if (days === 1) return 'tomorrow';
|
|
237
|
+
return 'in ' + days + ' days';
|
|
238
|
+
}
|
|
239
|
+
function cap(text) {
|
|
240
|
+
return String(text).charAt(0).toUpperCase() + String(text).slice(1);
|
|
241
|
+
}
|
|
242
|
+
function ago(days) {
|
|
243
|
+
return days <= 0 ? 'today' : days === 1 ? 'yesterday' : days + ' days ago';
|
|
244
|
+
}
|
|
245
|
+
// Dollars as a number or text ('$1,850', '95.50') to integer cents; null when it is not money.
|
|
246
|
+
function toCents(value) {
|
|
247
|
+
if (typeof value === 'string') value = Number(value.replace(/[$,\s]/g, ''));
|
|
248
|
+
if (typeof value !== 'number' || !isFinite(value)) return null;
|
|
249
|
+
return (value < 0 ? -1 : 1) * Math.round(Math.abs(value) * 100);
|
|
250
|
+
}
|
|
251
|
+
// A quantity in thousandths, so 6.5 hours or 12.25 feet multiply exactly.
|
|
252
|
+
function toMilli(qty) {
|
|
253
|
+
if (typeof qty === 'string') qty = Number(qty.replace(/[,\s]/g, ''));
|
|
254
|
+
return typeof qty === 'number' && isFinite(qty) && qty > 0 ? Math.round(qty * 1000) : null;
|
|
255
|
+
}
|
|
256
|
+
function money(cents) {
|
|
257
|
+
var n = Math.round(Number(cents) || 0);
|
|
258
|
+
var abs = Math.abs(n);
|
|
259
|
+
var whole = String(Math.floor(abs / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
260
|
+
return (n < 0 ? '-$' : '$') + whole + '.' + pad(abs % 100);
|
|
261
|
+
}
|
|
262
|
+
function percent(bp) {
|
|
263
|
+
return (bp / 100).toFixed(2).replace(/\.?0+$/, '') + '%';
|
|
264
|
+
}
|
|
265
|
+
function fold(text) {
|
|
266
|
+
return String(text || '')
|
|
267
|
+
.normalize('NFD')
|
|
268
|
+
.replace(/[̀-ͯ]/g, '')
|
|
269
|
+
.replace(/[‘’]/g, "'")
|
|
270
|
+
.toLowerCase()
|
|
271
|
+
.trim();
|
|
272
|
+
}
|
|
273
|
+
// Quantity times rate, rounded half away from zero to the cent.
|
|
274
|
+
function lineAmount(qtyMilli, rateCents) {
|
|
275
|
+
var x = qtyMilli * rateCents;
|
|
276
|
+
return (x < 0 ? -1 : 1) * Math.floor((Math.abs(x) + 500) / 1000);
|
|
277
|
+
}
|
|
278
|
+
function qtyText(qty, unit) {
|
|
279
|
+
var n = Math.round(Number(qty) * 1000) / 1000;
|
|
280
|
+
var u = String(unit || 'each');
|
|
281
|
+
if (n === 1 || u === 'each' || u === 'lot' || /s$/.test(u)) return n + ' ' + u;
|
|
282
|
+
return n + ' ' + (u === 'foot' ? 'feet' : /(x|ch|sh)$/.test(u) ? u + 'es' : u + 's');
|
|
283
|
+
}
|
|
284
|
+
function totals(lines, taxBp, taxOn) {
|
|
285
|
+
var t = { labor: 0, materials: 0, other: 0, subtotal: 0, taxable: 0, tax: 0, total: 0 };
|
|
286
|
+
(lines || []).forEach(function (l) {
|
|
287
|
+
var a = Number(l.amountCents) || 0;
|
|
288
|
+
t[KINDS.indexOf(l.kind) >= 0 ? l.kind : 'other'] += a;
|
|
289
|
+
t.subtotal += a;
|
|
290
|
+
});
|
|
291
|
+
t.taxable = Math.max(0, taxOn === 'all' ? t.subtotal : t.materials);
|
|
292
|
+
t.tax = Math.floor((t.taxable * (taxBp || 0) + 5000) / 10000);
|
|
293
|
+
t.total = t.subtotal + t.tax;
|
|
294
|
+
return t;
|
|
295
|
+
}
|
|
296
|
+
function quoteTotals(record) {
|
|
297
|
+
var f = record.fields || {};
|
|
298
|
+
return totals(f.lines, f.taxBp, f.taxOn);
|
|
299
|
+
}
|
|
300
|
+
// The fields a quote stores beside its lines, so a reader never re-adds them.
|
|
301
|
+
function totalFields(lines, taxBp, taxOn) {
|
|
302
|
+
var t = totals(lines, taxBp, taxOn);
|
|
303
|
+
return { laborCents: t.labor, materialsCents: t.materials, otherCents: t.other, subtotalCents: t.subtotal, taxCents: t.tax, totalCents: t.total };
|
|
304
|
+
}
|
|
305
|
+
function normalizeTerms(doc) {
|
|
306
|
+
var d = doc && typeof doc === 'object' ? doc : {};
|
|
307
|
+
var whole = function (v, fallback) {
|
|
308
|
+
return typeof v === 'number' && Number.isInteger(v) && v > 0 ? v : fallback;
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
version: 1,
|
|
312
|
+
taxBp: typeof d.taxBp === 'number' && Number.isInteger(d.taxBp) && d.taxBp >= 0 ? d.taxBp : 0,
|
|
313
|
+
taxOn: d.taxOn === 'all' ? 'all' : 'materials',
|
|
314
|
+
validDays: whole(d.validDays, 30),
|
|
315
|
+
followUpDays: whole(d.followUpDays, 5),
|
|
316
|
+
rates: (Array.isArray(d.rates) ? d.rates : []).filter(function (r) {
|
|
317
|
+
return r && typeof r.name === 'string' && typeof r.rateCents === 'number' && Number.isInteger(r.rateCents);
|
|
318
|
+
}),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function rateText(r) {
|
|
322
|
+
return r.name + ' ' + money(r.rateCents) + '/' + r.unit + ' (' + r.kind + ')';
|
|
323
|
+
}
|
|
324
|
+
function findRate(rates, name) {
|
|
325
|
+
var wanted = fold(name);
|
|
326
|
+
if (!wanted) return null;
|
|
327
|
+
var exact = rates.filter(function (r) { return fold(r.name) === wanted; });
|
|
328
|
+
if (exact.length) return exact[0];
|
|
329
|
+
var partial = rates.filter(function (r) { return fold(r.name).indexOf(wanted) >= 0 || wanted.indexOf(fold(r.name)) >= 0; });
|
|
330
|
+
return partial.length === 1 ? partial[0] : null;
|
|
331
|
+
}
|
|
332
|
+
function lineText(l) {
|
|
333
|
+
return '#' + l.n + ' ' + l.description + ', ' + qtyText(l.qty, l.unit) + ' x ' + money(l.rateCents) + ' = ' + money(l.amountCents) + ' (' + l.kind + ')';
|
|
334
|
+
}
|
|
335
|
+
// Add a line, or change the one with the same description. Returns the new
|
|
336
|
+
// list and what changed; the caller re-totals.
|
|
337
|
+
function upsertLine(lines, input, terms) {
|
|
338
|
+
var list = (lines || []).map(function (l) { return Object.assign({}, l); });
|
|
339
|
+
var saved = input.rateName ? findRate(terms.rates, input.rateName) : null;
|
|
340
|
+
if (input.rateName && !saved) {
|
|
341
|
+
throw new Error(
|
|
342
|
+
"No saved rate named '" + input.rateName + "'. Saved rates: " +
|
|
343
|
+
(terms.rates.map(rateText).join(', ') || 'none yet; pass rate in dollars') + '.',
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
var description = String(input.description || (saved && saved.name) || '').trim();
|
|
347
|
+
if (!description) throw new Error("add_line needs 'description', e.g. 'Electrician labor' or '200A panel'.");
|
|
348
|
+
var existing = list.filter(function (l) { return fold(l.description) === fold(description); })[0] || null;
|
|
349
|
+
if (!existing && !saved && (input.rate === undefined || input.rate === null || input.rate === '')) saved = findRate(terms.rates, description);
|
|
350
|
+
var rateCents =
|
|
351
|
+
input.rate !== undefined && input.rate !== null && input.rate !== ''
|
|
352
|
+
? toCents(input.rate)
|
|
353
|
+
: saved ? saved.rateCents : existing ? existing.rateCents : null;
|
|
354
|
+
if (rateCents === null) {
|
|
355
|
+
throw new Error(
|
|
356
|
+
"'" + description + "' needs 'rate' (dollars per unit) or 'rateName'" +
|
|
357
|
+
(terms.rates.length ? ' from the saved rates: ' + terms.rates.map(rateText).join(', ') : '') + '.',
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
var kind = KINDS.indexOf(input.kind) >= 0 ? input.kind : saved ? saved.kind : existing ? existing.kind : 'other';
|
|
361
|
+
if (rateCents < 0 && kind !== 'other') throw new Error('Only an "other" line can be a credit with a negative rate.');
|
|
362
|
+
var unit = input.unit ? String(input.unit).trim() : saved ? saved.unit : existing ? existing.unit : 'each';
|
|
363
|
+
var add = input.addQty !== undefined && input.addQty !== null && input.addQty !== '' ? toMilli(input.addQty) : null;
|
|
364
|
+
var set = input.qty !== undefined && input.qty !== null && input.qty !== '' ? toMilli(input.qty) : null;
|
|
365
|
+
if (add === null && input.addQty !== undefined && input.addQty !== null && input.addQty !== '') throw new Error('addQty must be a positive number.');
|
|
366
|
+
if (set === null && input.qty !== undefined && input.qty !== null && input.qty !== '') throw new Error('qty must be a positive number.');
|
|
367
|
+
var before = existing ? Math.round(existing.qty * 1000) : 0;
|
|
368
|
+
var qtyMilli = add !== null ? before + add : set !== null ? set : existing ? before : 1000;
|
|
369
|
+
var line = { description: existing ? existing.description : description, kind: kind, qty: qtyMilli / 1000, unit: unit, rateCents: rateCents, amountCents: lineAmount(qtyMilli, rateCents) };
|
|
370
|
+
if (existing) Object.assign(existing, line);
|
|
371
|
+
else list.push(line);
|
|
372
|
+
list.forEach(function (l, i) { l.n = i + 1; });
|
|
373
|
+
var placed = existing || list[list.length - 1];
|
|
374
|
+
return {
|
|
375
|
+
lines: list,
|
|
376
|
+
note:
|
|
377
|
+
(existing ? 'Updated line ' : 'Added line ') + lineText(placed) +
|
|
378
|
+
(existing && add !== null ? ' (' + before / 1000 + ' + ' + add / 1000 + ')' : '') + '.',
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function removeLine(lines, input) {
|
|
382
|
+
var list = (lines || []).map(function (l) { return Object.assign({}, l); });
|
|
383
|
+
var hit = null;
|
|
384
|
+
if (input.line !== undefined && input.line !== null && input.line !== '') {
|
|
385
|
+
hit = list.filter(function (l) { return l.n === Number(input.line); })[0] || null;
|
|
386
|
+
} else if (input.description) {
|
|
387
|
+
var wanted = fold(input.description);
|
|
388
|
+
var exact = list.filter(function (l) { return fold(l.description) === wanted; });
|
|
389
|
+
var partial = list.filter(function (l) { return fold(l.description).indexOf(wanted) >= 0; });
|
|
390
|
+
hit = exact[0] || (partial.length === 1 ? partial[0] : null);
|
|
391
|
+
}
|
|
392
|
+
if (!hit) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
"Name the line by 'line' number or 'description'. Lines: " + (list.map(lineText).join('; ') || 'none') + '.',
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
var rest = list.filter(function (l) { return l !== hit; });
|
|
398
|
+
rest.forEach(function (l, i) { l.n = i + 1; });
|
|
399
|
+
return { lines: rest, note: 'Removed ' + hit.description + ' (' + money(hit.amountCents) + ').' };
|
|
400
|
+
}
|
|
401
|
+
function isOpen(record) {
|
|
402
|
+
return record.status === 'draft' || record.status === 'sent';
|
|
403
|
+
}
|
|
404
|
+
// The quote a person means: its id, its exact title, a title or client that
|
|
405
|
+
// contains what they wrote, or one whose name holds every word they used.
|
|
406
|
+
// Several matches prefer the open quotes; a tie is an error that names them.
|
|
407
|
+
function findQuote(records, input) {
|
|
408
|
+
if (input.id) {
|
|
409
|
+
var byId = records.filter(function (r) { return r.id === String(input.id).trim(); });
|
|
410
|
+
if (byId.length) return byId[0];
|
|
411
|
+
if (!input.title && !input.client) throw new Error("No quote '" + input.id + "'. " + roll(records));
|
|
412
|
+
}
|
|
413
|
+
var wanted = fold(input.title || input.client);
|
|
414
|
+
if (!wanted) throw new Error("Pass 'id' (e.g. 'q-3') or the quote's 'title'. " + roll(records));
|
|
415
|
+
var name = function (r) { return fold(r.fields.title); };
|
|
416
|
+
var both = function (r) { return name(r) + ' ' + fold(r.fields.client); };
|
|
417
|
+
var words = wanted.split(/[^a-z0-9']+/).filter(function (w) { return w.length > 2 && NAME_STOP.indexOf(w) < 0; });
|
|
418
|
+
var tiers = [
|
|
419
|
+
function (r) { return name(r) === wanted; },
|
|
420
|
+
function (r) { return name(r).indexOf(wanted) >= 0 || fold(r.fields.client) === wanted; },
|
|
421
|
+
function (r) {
|
|
422
|
+
return words.length > 0 && words.every(function (w) { return both(r).indexOf(w) >= 0 || both(r).indexOf(w.replace(/s$/, '')) >= 0; });
|
|
423
|
+
},
|
|
424
|
+
];
|
|
425
|
+
for (var i = 0; i < tiers.length; i++) {
|
|
426
|
+
var hits = records.filter(tiers[i]);
|
|
427
|
+
if (hits.length > 1) {
|
|
428
|
+
var open = hits.filter(isOpen);
|
|
429
|
+
if (open.length) hits = open;
|
|
430
|
+
}
|
|
431
|
+
if (hits.length === 1) return hits[0];
|
|
432
|
+
if (hits.length > 1) {
|
|
433
|
+
throw new Error(
|
|
434
|
+
"More than one quote matches '" + (input.title || input.client) + "': " +
|
|
435
|
+
hits.map(function (r) { return r.id + ' ' + r.fields.title; }).join(', ') + '. Pass id.',
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
throw new Error("No quote matches '" + (input.title || input.client) + "'. " + roll(records));
|
|
440
|
+
}
|
|
441
|
+
function roll(records) {
|
|
442
|
+
return records.length
|
|
443
|
+
? 'Quotes: ' + records.map(function (r) { return r.id + ' ' + r.fields.title + ' (' + r.status + ')'; }).join(', ') + '.'
|
|
444
|
+
: 'There are no quotes yet.';
|
|
445
|
+
}
|
|
446
|
+
function lastNote(record) {
|
|
447
|
+
var notes = (record.history || []).filter(function (h) { return h.note; });
|
|
448
|
+
return notes.length ? notes[notes.length - 1].note : '';
|
|
449
|
+
}
|
|
450
|
+
function quoteLine(record, nowMs) {
|
|
451
|
+
var f = record.fields || {};
|
|
452
|
+
var t = quoteTotals(record);
|
|
453
|
+
var lines = (f.lines || []).length;
|
|
454
|
+
var head =
|
|
455
|
+
record.id + (f.client && fold(f.title).indexOf(fold(f.client)) < 0 ? ', ' + f.client : '') + ', ' + record.status + ', ' +
|
|
456
|
+
lines + (lines === 1 ? ' line' : ' lines') + ', total ' + money(t.total) + (t.tax ? ' with ' + money(t.tax) + ' tax' : '');
|
|
457
|
+
var parts = [head];
|
|
458
|
+
if (record.status === 'sent') {
|
|
459
|
+
if (f.sentAt) parts.push('sent ' + ago(-daysLeft(f.sentAt, nowMs)));
|
|
460
|
+
if (f.followUpAt) parts.push('follow up ' + when(daysLeft(f.followUpAt, nowMs)) + ' (' + f.followUpAt + ')');
|
|
461
|
+
if (f.validUntil) parts.push((daysLeft(f.validUntil, nowMs) < 0 ? 'expired ' : 'valid until ') + f.validUntil);
|
|
462
|
+
}
|
|
463
|
+
if (!isOpen(record) && f.closedAt) parts.push(record.status + ' ' + f.closedAt + (f.reason ? ': ' + f.reason : ''));
|
|
464
|
+
return f.title + ' (' + parts.join('; ') + ')';
|
|
465
|
+
}
|
|
466
|
+
function followLine(record, nowMs) {
|
|
467
|
+
var f = record.fields;
|
|
468
|
+
var note = lastNote(record).replace(/[.\s]+$/, '');
|
|
469
|
+
return (
|
|
470
|
+
f.title + ' (' + record.id + (f.contact ? ', ' + f.contact : '') + ', ' + money(quoteTotals(record).total) +
|
|
471
|
+
(f.sentAt ? ', sent ' + ago(-daysLeft(f.sentAt, nowMs)) : '') + ') ' + when(daysLeft(f.followUpAt, nowMs)) +
|
|
472
|
+
(note && note !== 'Sent to the client' ? '; last note: ' + note : '')
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
function picture(records, terms, nowMs, withinDays) {
|
|
476
|
+
var byStatus = function (s) { return records.filter(function (r) { return r.status === s; }); };
|
|
477
|
+
var drafts = byStatus('draft');
|
|
478
|
+
var sent = byStatus('sent');
|
|
479
|
+
var won = byStatus('won');
|
|
480
|
+
var lost = byStatus('lost');
|
|
481
|
+
var total = function (list) { return list.reduce(function (t, r) { return t + quoteTotals(r).total; }, 0); };
|
|
482
|
+
var due = sent
|
|
483
|
+
.filter(function (r) { return r.fields.followUpAt && daysLeft(r.fields.followUpAt, nowMs) <= withinDays; })
|
|
484
|
+
.sort(function (a, b) { return String(a.fields.followUpAt).localeCompare(String(b.fields.followUpAt)); });
|
|
485
|
+
var dueNow = due.filter(function (r) { return daysLeft(r.fields.followUpAt, nowMs) <= 0; });
|
|
486
|
+
var recentFirst = function (list) {
|
|
487
|
+
return list.slice().sort(function (a, b) { return String(b.fields.closedAt || '').localeCompare(String(a.fields.closedAt || '')); });
|
|
488
|
+
};
|
|
489
|
+
var parts = [
|
|
490
|
+
records.length + (records.length === 1 ? ' quote: ' : ' quotes: ') + drafts.length + ' draft, ' + sent.length +
|
|
491
|
+
' sent and waiting (' + money(total(sent)) + '), ' + won.length + ' won, ' + lost.length + ' lost.',
|
|
492
|
+
];
|
|
493
|
+
// One list, overdue first: a model asked what needs chasing reads a separate late list as out of scope.
|
|
494
|
+
parts.push(
|
|
495
|
+
due.length
|
|
496
|
+
? 'Follow-ups within ' + withinDays + ' days, overdue first: ' + due.map(function (r) { return followLine(r, nowMs); }).join(' | ') + '.'
|
|
497
|
+
: 'No follow-ups due in the next ' + withinDays + ' days.',
|
|
498
|
+
);
|
|
499
|
+
if (drafts.length) parts.push('Drafts: ' + drafts.map(function (r) { var ls = r.fields.lines || []; return quoteLine(r, nowMs) + (ls.length ? ': ' + ls.map(lineText).join('; ') : ''); }).join(' | ') + '.');
|
|
500
|
+
if (sent.length) parts.push('Sent and waiting: ' + sent.map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');
|
|
501
|
+
if (won.length) parts.push('Won (latest first): ' + recentFirst(won).slice(0, 5).map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');
|
|
502
|
+
if (lost.length) parts.push('Lost (latest first): ' + recentFirst(lost).slice(0, 5).map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');
|
|
503
|
+
if (won.length + lost.length) {
|
|
504
|
+
var decided = total(won) + total(lost);
|
|
505
|
+
parts.push(
|
|
506
|
+
'Win rate: ' + won.length + ' of ' + (won.length + lost.length) + ' decided quotes (' + Math.round((won.length / (won.length + lost.length)) * 100) + '%), ' +
|
|
507
|
+
money(total(won)) + ' of ' + money(decided) + ' by value.',
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
parts.push(
|
|
511
|
+
'Tax: ' + (terms.taxBp ? percent(terms.taxBp) + ' on ' + (terms.taxOn === 'all' ? 'the whole quote' : 'materials') : 'none set') +
|
|
512
|
+
'. Quotes stay valid ' + terms.validDays + ' days; follow up ' + terms.followUpDays + ' days after sending. Saved rates: ' +
|
|
513
|
+
(terms.rates.map(rateText).join(', ') || 'none yet') + '.',
|
|
514
|
+
);
|
|
515
|
+
return {
|
|
516
|
+
drafts: drafts.length,
|
|
517
|
+
waiting: sent.length,
|
|
518
|
+
followUpsDue: dueNow.length,
|
|
519
|
+
summary: parts.join(' '),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
// One quote line by line, for the person to read or the crew to quote exactly.
|
|
523
|
+
function detail(record, nowMs) {
|
|
524
|
+
var f = record.fields || {};
|
|
525
|
+
var t = quoteTotals(record);
|
|
526
|
+
var rows = (f.lines || []).map(lineText);
|
|
527
|
+
return [
|
|
528
|
+
f.title + ' (' + record.id + ', ' + record.status + (f.client ? ', for ' + f.client : '') + (f.site ? ' at ' + f.site : '') + ').',
|
|
529
|
+
rows.length ? 'Lines: ' + rows.join('; ') + '.' : 'No lines yet.',
|
|
530
|
+
'Labor ' + money(t.labor) + ', materials ' + money(t.materials) + (t.other ? ', other ' + money(t.other) : '') +
|
|
531
|
+
'. Subtotal ' + money(t.subtotal) + '. Tax ' + money(t.tax) +
|
|
532
|
+
(f.taxBp ? ' (' + percent(f.taxBp) + ' on ' + (f.taxOn === 'all' ? 'the whole quote' : 'materials ' + money(t.materials)) + ')' : ' (no tax set)') +
|
|
533
|
+
'. Total ' + money(t.total) + '.',
|
|
534
|
+
record.status === 'sent'
|
|
535
|
+
? 'Sent ' + f.sentAt + (f.followUpAt ? '; follow up ' + when(daysLeft(f.followUpAt, nowMs)) + ' (' + f.followUpAt + ')' : '') +
|
|
536
|
+
(f.validUntil ? '; valid until ' + f.validUntil : '') + '.'
|
|
537
|
+
: !isOpen(record) && f.closedAt
|
|
538
|
+
? cap(record.status) + ' ' + f.closedAt + (f.reason ? ': ' + f.reason : '') + '.'
|
|
539
|
+
: '',
|
|
540
|
+
]
|
|
541
|
+
.filter(Boolean)
|
|
542
|
+
.join(' ');
|
|
543
|
+
}
|
|
544
|
+
// ── quote-rules-end ──
|
|
545
|
+
|
|
546
|
+
function daysFromNow(n) { return localDay(Date.now() + n * DAY_MS); }
|
|
547
|
+
function stampFromNow(n, hour) { var d = new Date(Date.now() + n * DAY_MS); d.setHours(hour || 10, 0, 0, 0); return d.toISOString(); }
|
|
548
|
+
function line(description, kind, qty, unit, rateCents) { return { description: description, kind: kind, qty: qty, unit: unit, rateCents: rateCents, amountCents: lineAmount(Math.round(qty * 1000), rateCents) }; }
|
|
549
|
+
function quote(id, status, fields, lines, notes, updatedDaysAgo) {
|
|
550
|
+
lines.forEach(function (l, i) { l.n = i + 1; });
|
|
551
|
+
var f = Object.assign({ lines: lines, taxBp: 825, taxOn: 'materials' }, fields, totalFields(lines, 825, 'materials'));
|
|
552
|
+
return { id: id, status: status, fields: f, createdAt: stampFromNow(-updatedDaysAgo - 3), updatedAt: stampFromNow(-updatedDaysAgo), history: notes.map(function (n) { return { at: stampFromNow(-n[0]), from: status, to: status, note: n[1] }; }) };
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// ── demo quotes (used only when the page opens outside Gezel); dates are relative so it never goes stale ──
|
|
556
|
+
var demoTerms = { version: 1, taxBp: 825, taxOn: 'materials', validDays: 30, followUpDays: 5, rates: [
|
|
557
|
+
{ name: 'Electrician', kind: 'labor', unit: 'hour', rateCents: 9500 },
|
|
558
|
+
{ name: 'Apprentice', kind: 'labor', unit: 'hour', rateCents: 5500 },
|
|
559
|
+
{ name: 'Service call', kind: 'other', unit: 'each', rateCents: 12500 },
|
|
560
|
+
{ name: 'Permit and inspection', kind: 'other', unit: 'each', rateCents: 18500 },
|
|
561
|
+
] };
|
|
562
|
+
var demoQuotes = { version: 1, stages: STAGES.slice(), records: [
|
|
563
|
+
quote('q-1', 'sent', { title: 'Harbor Street Café kitchen rewire', client: 'Harbor Street Café', contact: 'Dana', site: '418 Harbor Street', sentAt: daysFromNow(-5), validUntil: daysFromNow(25), followUpAt: daysFromNow(0) }, [
|
|
564
|
+
line('Electrician labor', 'labor', 24, 'hour', 9500),
|
|
565
|
+
line('Apprentice labor', 'labor', 24, 'hour', 5500),
|
|
566
|
+
line('Kitchen circuits: wire, breakers and boxes', 'materials', 1, 'lot', 164000),
|
|
567
|
+
line('GFCI receptacles', 'materials', 12, 'each', 3850),
|
|
568
|
+
line('Permit and inspection', 'other', 1, 'each', 18500),
|
|
569
|
+
], [[5, 'Sent to the client.']], 5),
|
|
570
|
+
quote('q-2', 'sent', { title: 'Fernwood Studio office lighting retrofit', client: 'Fernwood Studio', contact: 'Mei', site: '22 Fernwood Lane, second floor', sentAt: daysFromNow(-9), validUntil: daysFromNow(21), followUpAt: daysFromNow(-2), lastFollowUpAt: daysFromNow(-4) }, [
|
|
571
|
+
line('Electrician labor', 'labor', 40, 'hour', 9500),
|
|
572
|
+
line('Apprentice labor', 'labor', 40, 'hour', 5500),
|
|
573
|
+
line('LED troffers', 'materials', 48, 'each', 14200),
|
|
574
|
+
line('Occupancy sensors', 'materials', 12, 'each', 6400),
|
|
575
|
+
line('Haul away old fixtures', 'other', 1, 'lot', 24000),
|
|
576
|
+
], [[9, 'Sent to the client.'], [4, 'Left a voicemail with Mei.']], 4),
|
|
577
|
+
quote('q-3', 'draft', { title: 'Juniper Press warehouse EV chargers', client: 'Juniper Press', contact: 'Owen', site: 'Juniper Press warehouse, loading dock' }, [
|
|
578
|
+
line('Electrician labor', 'labor', 18, 'hour', 9500),
|
|
579
|
+
line('Level 2 EV chargers', 'materials', 4, 'each', 68900),
|
|
580
|
+
line('60A breakers and wire', 'materials', 1, 'lot', 94000),
|
|
581
|
+
], [], 1),
|
|
582
|
+
quote('q-4', 'won', { title: 'Bayside Bakery oven circuit', client: 'Bayside Bakery', contact: 'Rosa', sentAt: daysFromNow(-18), validUntil: daysFromNow(12), closedAt: daysFromNow(-12), reason: 'Signed; start Monday' }, [
|
|
583
|
+
line('Electrician labor', 'labor', 6, 'hour', 9500),
|
|
584
|
+
line('Apprentice labor', 'labor', 6, 'hour', 5500),
|
|
585
|
+
line('50A circuit: wire and breaker', 'materials', 1, 'lot', 41000),
|
|
586
|
+
line('Permit and inspection', 'other', 1, 'each', 18500),
|
|
587
|
+
], [[18, 'Sent to the client.'], [12, 'Signed; start Monday']], 12),
|
|
588
|
+
quote('q-5', 'lost', { title: 'Cedar Hill Church sound booth wiring', client: 'Cedar Hill Church', contact: 'Pastor Hale', sentAt: daysFromNow(-30), validUntil: daysFromNow(0), closedAt: daysFromNow(-20), reason: 'Went with a lower bid' }, [
|
|
589
|
+
line('Electrician labor', 'labor', 20, 'hour', 9500),
|
|
590
|
+
line('Apprentice labor', 'labor', 20, 'hour', 5500),
|
|
591
|
+
line('Wire, conduit and boxes', 'materials', 1, 'lot', 128000),
|
|
592
|
+
], [[30, 'Sent to the client.'], [20, 'Went with a lower bid']], 20),
|
|
593
|
+
] };
|
|
594
|
+
|
|
595
|
+
// The quote-store actions, mirrored for the demo so the sample prices exactly like the live app.
|
|
596
|
+
function given(v) { return v !== undefined && v !== null && v !== ''; }
|
|
597
|
+
function todayDay() { return localDay(Date.now()); }
|
|
598
|
+
var acted = null;
|
|
599
|
+
function demoView(note) {
|
|
600
|
+
var v = picture(demoQuotes.records, normalizeTerms(demoTerms), Date.now(), 7);
|
|
601
|
+
var hit = acted && demoQuotes.records.filter(function (r) { return r.id === acted; })[0];
|
|
602
|
+
acted = null;
|
|
603
|
+
return { drafts: v.drafts, waiting: v.waiting, followUpsDue: v.followUpsDue, total: hit ? quoteTotals(hit).total / 100 : 0, summary: (note ? note + ' ' : '') + v.summary };
|
|
604
|
+
}
|
|
605
|
+
function touch(r, note, status) {
|
|
606
|
+
var at = new Date().toISOString();
|
|
607
|
+
if (note || status) r.history.push({ at: at, from: r.status, to: status || r.status, note: note });
|
|
608
|
+
if (status) r.status = status;
|
|
609
|
+
r.updatedAt = at;
|
|
610
|
+
}
|
|
611
|
+
function followUpInput(input) {
|
|
612
|
+
if (typeof input.inDays === 'number' && isFinite(input.inDays)) return addDays(todayDay(), Math.max(0, Math.round(input.inDays)));
|
|
613
|
+
if (given(input.followUpAt)) { var d = normalizeDate(input.followUpAt); if (!d) throw new Error("followUpAt must be a date, e.g. '2026-11-20', or pass inDays."); return d; }
|
|
614
|
+
return undefined;
|
|
615
|
+
}
|
|
616
|
+
function wholeDays(value, label) {
|
|
617
|
+
if (!given(value)) return undefined;
|
|
618
|
+
var n = Number(value);
|
|
619
|
+
if (!isFinite(n) || n < 1 || n > 365) throw new Error(label + ' is a number of days from 1 to 365.');
|
|
620
|
+
return Math.round(n);
|
|
621
|
+
}
|
|
622
|
+
function reprice(r, lines, what) {
|
|
623
|
+
if (!isOpen(r)) throw new Error(r.fields.title + ' is ' + r.status + '; its price is settled. Start a new quote for more work.');
|
|
624
|
+
Object.assign(r.fields, { lines: lines }, totalFields(lines, r.fields.taxBp, r.fields.taxOn));
|
|
625
|
+
var tail = '';
|
|
626
|
+
if (r.status === 'sent') { r.fields.followUpAt = null; touch(r, 'Revised after sending: ' + what, 'draft'); tail = ' It had been sent, so it is back in draft: send it again when the client should see the new price.'; }
|
|
627
|
+
else touch(r);
|
|
628
|
+
acted = r.id;
|
|
629
|
+
return what + ' ' + r.fields.title + ' total now ' + money(totals(lines, r.fields.taxBp, r.fields.taxOn).total) + '.' + tail;
|
|
630
|
+
}
|
|
631
|
+
function demoStart(input) {
|
|
632
|
+
var all = demoQuotes.records, title = String(input.title || input.client || '').trim(), existing = null;
|
|
633
|
+
if (given(input.id)) existing = findQuote(all, { id: input.id, title: input.title });
|
|
634
|
+
else if (title) existing = all.filter(function (r) { return fold(r.fields.title) === fold(title); })[0] || null;
|
|
635
|
+
if (!existing && !title) throw new Error("add needs 'title': the job, e.g. 'Maple Row panel upgrade'.");
|
|
636
|
+
var fields = {};
|
|
637
|
+
['client', 'contact', 'site', 'note'].forEach(function (k) { if (input[k]) fields[k] = String(input[k]).trim(); });
|
|
638
|
+
if (existing) {
|
|
639
|
+
if (given(input.id) && input.title && fold(input.title) !== fold(existing.fields.title)) fields.title = String(input.title).trim();
|
|
640
|
+
Object.assign(existing.fields, fields); touch(existing); acted = existing.id;
|
|
641
|
+
return demoView('Updated ' + existing.fields.title + '.');
|
|
642
|
+
}
|
|
643
|
+
var id = 'q-' + (all.reduce(function (m, r) { return Math.max(m, Number(String(r.id).split('-')[1]) || 0); }, 0) + 1);
|
|
644
|
+
var stamp = new Date().toISOString();
|
|
645
|
+
all.push({ id: id, status: 'draft', createdAt: stamp, updatedAt: stamp, history: [], fields: Object.assign({ title: title }, fields, { lines: [], taxBp: demoTerms.taxBp, taxOn: demoTerms.taxOn }, totalFields([], demoTerms.taxBp, demoTerms.taxOn)) });
|
|
646
|
+
acted = id;
|
|
647
|
+
return demoView('Started ' + id + ': ' + title + ' (draft). Add its lines next.');
|
|
648
|
+
}
|
|
649
|
+
function demoAddLine(input) {
|
|
650
|
+
var r = findQuote(demoQuotes.records, input), change = upsertLine(r.fields.lines || [], input, normalizeTerms(demoTerms));
|
|
651
|
+
return demoView(reprice(r, change.lines, change.note));
|
|
652
|
+
}
|
|
653
|
+
function demoRemoveLine(input) {
|
|
654
|
+
var r = findQuote(demoQuotes.records, input), change = removeLine(r.fields.lines || [], input);
|
|
655
|
+
return demoView(reprice(r, change.lines, change.note));
|
|
656
|
+
}
|
|
657
|
+
function demoSend(input) {
|
|
658
|
+
var r = findQuote(demoQuotes.records, input), title = r.fields.title;
|
|
659
|
+
acted = r.id;
|
|
660
|
+
if (r.status === 'sent') return demoView(title + ' was already sent on ' + r.fields.sentAt + '.');
|
|
661
|
+
if (!isOpen(r)) throw new Error(title + ' is ' + r.status + '; it cannot be sent again.');
|
|
662
|
+
if (!(r.fields.lines || []).length) throw new Error(title + ' has no lines yet; add them before sending.');
|
|
663
|
+
var validUntil = addDays(todayDay(), wholeDays(input.validDays, 'validDays') || demoTerms.validDays);
|
|
664
|
+
var follow = followUpInput(input) || addDays(todayDay(), demoTerms.followUpDays);
|
|
665
|
+
Object.assign(r.fields, { sentAt: todayDay(), validUntil: validUntil, followUpAt: follow });
|
|
666
|
+
touch(r, input.note || 'Sent to the client.', 'sent');
|
|
667
|
+
return demoView('Sent ' + title + ', total ' + money(quoteTotals(r).total) + '. Valid until ' + validUntil + '; first follow-up ' + follow + '.');
|
|
668
|
+
}
|
|
669
|
+
function demoFollowUp(input) {
|
|
670
|
+
var r = findQuote(demoQuotes.records, input), title = r.fields.title;
|
|
671
|
+
if (r.status !== 'sent') throw new Error(title + ' is ' + r.status + (r.status === 'draft' ? '; send it before following up.' : '; it is closed.'));
|
|
672
|
+
var next = followUpInput(input) || addDays(todayDay(), demoTerms.followUpDays);
|
|
673
|
+
Object.assign(r.fields, { followUpAt: next, lastFollowUpAt: todayDay() });
|
|
674
|
+
touch(r, input.note || 'Followed up.');
|
|
675
|
+
acted = r.id;
|
|
676
|
+
return demoView('Logged the follow-up on ' + title + (input.note ? ': ' + String(input.note).trim() : '') + '. Next follow-up ' + next + '.');
|
|
677
|
+
}
|
|
678
|
+
function demoOutcome(input) {
|
|
679
|
+
var outcome = String(input.outcome || '').trim().toLowerCase();
|
|
680
|
+
if (outcome !== 'won' && outcome !== 'lost') throw new Error("outcome needs 'outcome': won or lost.");
|
|
681
|
+
var r = findQuote(demoQuotes.records, input), title = r.fields.title;
|
|
682
|
+
acted = r.id;
|
|
683
|
+
if (r.status === outcome) return demoView(title + ' is already ' + outcome + '.');
|
|
684
|
+
if (!isOpen(r)) throw new Error(title + ' is already ' + r.status + '.');
|
|
685
|
+
Object.assign(r.fields, { closedAt: todayDay(), followUpAt: null }, input.note ? { reason: String(input.note).trim() } : {});
|
|
686
|
+
touch(r, input.note || (outcome === 'won' ? 'Won.' : 'Lost.'), outcome);
|
|
687
|
+
return demoView((outcome === 'won' ? 'Won ' : 'Lost ') + title + ', ' + money(quoteTotals(r).total) + (input.note ? ' (' + String(input.note).trim() + ')' : '') + '.');
|
|
688
|
+
}
|
|
689
|
+
function demoSetRate(input) {
|
|
690
|
+
var name = String(input.name || input.description || '').trim();
|
|
691
|
+
if (!name) throw new Error("set_rate needs 'name', e.g. 'Electrician'.");
|
|
692
|
+
var rateCents = toCents(input.rate);
|
|
693
|
+
if (rateCents === null || rateCents < 0) throw new Error("set_rate needs 'rate' in dollars per unit, e.g. 95.");
|
|
694
|
+
var kind = KINDS.indexOf(String(input.kind)) >= 0 ? String(input.kind) : 'labor';
|
|
695
|
+
var rate = { name: name, kind: kind, unit: input.unit ? String(input.unit).trim() : kind === 'labor' ? 'hour' : 'each', rateCents: rateCents };
|
|
696
|
+
var at = demoTerms.rates.findIndex(function (r) { return fold(r.name) === fold(name); });
|
|
697
|
+
if (at >= 0) demoTerms.rates[at] = rate; else demoTerms.rates.push(rate);
|
|
698
|
+
return demoView((at >= 0 ? 'Updated the rate ' : 'Saved the rate ') + rateText(rate) + '. Lines already on quotes keep their price; new lines use this one.');
|
|
699
|
+
}
|
|
700
|
+
function demoSetTerms(input) {
|
|
701
|
+
var changed = false;
|
|
702
|
+
if (given(input.taxRate)) { var p = Number(String(input.taxRate).replace('%', '')); if (!isFinite(p) || p < 0 || p > 50) throw new Error('taxRate is a percent, e.g. 8.25 (0 for none).'); demoTerms.taxBp = Math.round(p * 100); changed = true; }
|
|
703
|
+
if (given(input.taxOn)) { var on = String(input.taxOn).trim().toLowerCase(); if (on !== 'materials' && on !== 'all') throw new Error('taxOn is materials or all.'); demoTerms.taxOn = on; changed = true; }
|
|
704
|
+
var valid = wholeDays(input.validDays, 'validDays'), follow = wholeDays(input.followUpDays, 'followUpDays');
|
|
705
|
+
if (valid !== undefined) demoTerms.validDays = valid;
|
|
706
|
+
if (follow !== undefined) demoTerms.followUpDays = follow;
|
|
707
|
+
if (!changed && valid === undefined && follow === undefined) throw new Error('set_terms needs taxRate, taxOn, validDays or followUpDays.');
|
|
708
|
+
var drafts = demoQuotes.records.filter(function (r) { return r.status === 'draft'; });
|
|
709
|
+
drafts.forEach(function (d) { Object.assign(d.fields, { taxBp: demoTerms.taxBp, taxOn: demoTerms.taxOn }, totalFields(d.fields.lines || [], demoTerms.taxBp, demoTerms.taxOn)); });
|
|
710
|
+
return demoView('Tax is ' + (demoTerms.taxBp ? percent(demoTerms.taxBp) + ' on ' + (demoTerms.taxOn === 'all' ? 'the whole quote' : 'materials') : 'not charged') + '; quotes stay valid ' + demoTerms.validDays + ' days; follow up ' + demoTerms.followUpDays + ' days after sending.' + (drafts.length ? ' Re-totaled ' + drafts.length + (drafts.length === 1 ? ' draft' : ' drafts') + '; sent quotes keep the tax they went out with.' : ''));
|
|
711
|
+
}
|
|
712
|
+
function demoShow(input) {
|
|
713
|
+
var r = findQuote(demoQuotes.records, input), v = demoView('');
|
|
714
|
+
v.summary = detail(r, Date.now()); v.total = quoteTotals(r).total / 100;
|
|
715
|
+
return v;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
window.gezel || window.makeDemoGezel({
|
|
719
|
+
page: { entry: 'quotes/index.html', typeName: 'Quotes & Bids', params: { business: 'Brightline Electric, a three-person electrical contractor' } },
|
|
720
|
+
tools: {
|
|
721
|
+
page_start_quote: demoStart,
|
|
722
|
+
start_quote: demoStart,
|
|
723
|
+
page_add_quote_line: demoAddLine,
|
|
724
|
+
add_quote_line: demoAddLine,
|
|
725
|
+
remove_quote_line: demoRemoveLine,
|
|
726
|
+
page_send_quote: demoSend,
|
|
727
|
+
send_quote: demoSend,
|
|
728
|
+
page_log_quote_follow_up: demoFollowUp,
|
|
729
|
+
log_quote_follow_up: demoFollowUp,
|
|
730
|
+
page_record_quote_outcome: demoOutcome,
|
|
731
|
+
record_quote_outcome: demoOutcome,
|
|
732
|
+
page_set_quote_terms: demoSetTerms,
|
|
733
|
+
set_quote_terms: demoSetTerms,
|
|
734
|
+
save_rate: demoSetRate,
|
|
735
|
+
show_quote: demoShow,
|
|
736
|
+
quotes_status: function () { return demoView(''); },
|
|
737
|
+
},
|
|
738
|
+
data: {
|
|
739
|
+
'quotes.json': function () { return demoQuotes; },
|
|
740
|
+
'rates.json': function () { return demoTerms; },
|
|
741
|
+
},
|
|
742
|
+
chat: window.demoChat,
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// ── one code path from here: window.gezel exists in every mode ──
|
|
746
|
+
var demoMode = gezel.page.mode === 'demo';
|
|
747
|
+
function applyTheme(mode) { document.documentElement.setAttribute('data-theme', mode === 'dark' ? 'dark' : 'light'); }
|
|
748
|
+
applyTheme(gezel.ui.theme.mode);
|
|
749
|
+
appSubscriptions.push(gezel.ui.onTheme(function (theme) { applyTheme(theme.mode); }));
|
|
750
|
+
if (demoMode) document.querySelector('[data-gezel-demo-banner]').hidden = false;
|
|
751
|
+
|
|
752
|
+
function el(tag, text, cls) { var e = document.createElement(tag); if (text !== undefined) e.textContent = text; if (cls) e.className = cls; return e; }
|
|
753
|
+
function plural(n, one, many) { return n + ' ' + (n === 1 ? one : many); }
|
|
754
|
+
function niceDate(day) { var d = new Date(String(day).slice(0, 10) + 'T12:00:00'); return isFinite(d) ? d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) : String(day); }
|
|
755
|
+
function whole(cents) { var w = money(Math.round((Number(cents) || 0) / 100) * 100); return w.slice(0, -3); }
|
|
756
|
+
function chipClass(days) { return days < 0 ? 'late' : days <= 1 ? 'soon' : ''; }
|
|
757
|
+
function totalOf(list) { return list.reduce(function (t, r) { return t + quoteTotals(r).total; }, 0); }
|
|
758
|
+
function newest(list) { return list.slice().sort(function (a, b) { return String(b.updatedAt || '').localeCompare(String(a.updatedAt || '')); })[0]; }
|
|
759
|
+
|
|
760
|
+
// A key on a record opens that action's dialog with the record already chosen (the app shell wires data-app-action).
|
|
761
|
+
function rowKey(label, tool, values, aria) {
|
|
762
|
+
var b = el('button', label, 'key');
|
|
763
|
+
b.type = 'button';
|
|
764
|
+
b.setAttribute('aria-label', aria);
|
|
765
|
+
b.setAttribute('data-app-action', tool);
|
|
766
|
+
b.setAttribute('data-app-values', JSON.stringify(values));
|
|
767
|
+
return b;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
var picked = null, lastNewest = '', lastDocs = null;
|
|
771
|
+
document.getElementById('b-pick').addEventListener('change', function (event) { picked = event.target.value; if (lastDocs) renderBuilder(lastDocs.records, lastDocs.terms); });
|
|
772
|
+
|
|
773
|
+
function renderBuilder(records, terms) {
|
|
774
|
+
var r = records.filter(function (x) { return x.id === picked; })[0];
|
|
775
|
+
var pick = document.getElementById('b-pick'), wrap = document.getElementById('b-pick-wrap');
|
|
776
|
+
var order = records.filter(isOpen).concat(records.filter(function (x) { return !isOpen(x); }).reverse());
|
|
777
|
+
pick.replaceChildren();
|
|
778
|
+
order.forEach(function (x) { var o = el('option', x.fields.title + ' · ' + x.status); o.value = x.id; pick.append(o); });
|
|
779
|
+
wrap.hidden = records.length < 2;
|
|
780
|
+
if (r) pick.value = r.id;
|
|
781
|
+
var body = document.getElementById('b-lines'), foot = document.getElementById('b-totals'), keys = document.getElementById('b-keys');
|
|
782
|
+
body.replaceChildren(); foot.replaceChildren(); keys.replaceChildren();
|
|
783
|
+
if (!r) {
|
|
784
|
+
document.getElementById('b-title').textContent = 'No quote yet';
|
|
785
|
+
document.getElementById('b-meta').textContent = 'Start a quote, then add its labor and materials.';
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
var f = r.fields, t = quoteTotals(r), lines = f.lines || [];
|
|
789
|
+
document.getElementById('b-title').textContent = f.title;
|
|
790
|
+
document.getElementById('b-meta').textContent = [f.client && fold(f.title).indexOf(fold(f.client)) < 0 ? f.client : '', f.contact, f.site, r.status === 'sent' && f.sentAt ? 'sent ' + niceDate(f.sentAt) + ', valid until ' + niceDate(f.validUntil) : r.status, !isOpen(r) && f.closedAt ? niceDate(f.closedAt) : ''].filter(Boolean).join(' · ');
|
|
791
|
+
if (isOpen(r)) keys.append(rowKey('Add a line', 'add_quote_line', { id: r.id }, 'Add a line to ' + f.title));
|
|
792
|
+
if (r.status === 'draft') keys.append(rowKey('Mark sent', 'send_quote', { id: r.id }, 'Mark ' + f.title + ' sent'));
|
|
793
|
+
if (!lines.length) { var tr0 = el('tr'), td0 = el('td', 'No lines yet. Add the labor and materials.', 'empty'); td0.colSpan = 5; tr0.append(td0); body.append(tr0); }
|
|
794
|
+
lines.forEach(function (l) {
|
|
795
|
+
var tr = el('tr'), name = el('td');
|
|
796
|
+
name.append(el('span', l.description), el('span', l.kind, 'meta'));
|
|
797
|
+
tr.append(el('td', String(l.n), 'num'), name, el('td', qtyText(l.qty, l.unit), 'num qty'), el('td', money(l.rateCents), 'num'), el('td', money(l.amountCents), 'num'));
|
|
798
|
+
body.append(tr);
|
|
799
|
+
});
|
|
800
|
+
function row(label, cents, cls) {
|
|
801
|
+
var tr = el('tr', undefined, cls || ''), td = el('td', label);
|
|
802
|
+
td.colSpan = 4;
|
|
803
|
+
tr.append(td, el('td', money(cents), 'num'));
|
|
804
|
+
foot.append(tr);
|
|
805
|
+
}
|
|
806
|
+
row('Labor', t.labor);
|
|
807
|
+
row('Materials', t.materials);
|
|
808
|
+
if (t.other) row('Other', t.other);
|
|
809
|
+
row('Subtotal', t.subtotal);
|
|
810
|
+
row(f.taxBp ? 'Tax, ' + percent(f.taxBp) + ' on ' + (f.taxOn === 'all' ? 'the whole quote' : 'materials') : 'Tax (none set)', t.tax);
|
|
811
|
+
row('Total', t.total, 'total');
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function render(quoteDoc, termsDoc) {
|
|
815
|
+
var records = Array.isArray(quoteDoc.records) ? quoteDoc.records : [];
|
|
816
|
+
var terms = normalizeTerms(termsDoc);
|
|
817
|
+
var now = Date.now(), view = picture(records, terms, now, 7);
|
|
818
|
+
lastDocs = { records: records, terms: terms };
|
|
819
|
+
var drafts = records.filter(function (r) { return r.status === 'draft'; });
|
|
820
|
+
var sent = records.filter(function (r) { return r.status === 'sent'; });
|
|
821
|
+
var won = records.filter(function (r) { return r.status === 'won'; });
|
|
822
|
+
var lost = records.filter(function (r) { return r.status === 'lost'; });
|
|
823
|
+
|
|
824
|
+
document.getElementById('t-drafts').textContent = money(totalOf(drafts));
|
|
825
|
+
document.getElementById('t-drafts-label').textContent = plural(drafts.length, 'draft', 'drafts') + ' being priced';
|
|
826
|
+
document.getElementById('t-waiting').textContent = money(totalOf(sent));
|
|
827
|
+
document.getElementById('t-waiting-label').textContent = plural(sent.length, 'quote', 'quotes') + ' sent and waiting';
|
|
828
|
+
document.getElementById('t-due').textContent = view.followUpsDue;
|
|
829
|
+
document.getElementById('t-due').parentNode.classList.toggle('late', view.followUpsDue > 0);
|
|
830
|
+
var decided = won.length + lost.length;
|
|
831
|
+
document.getElementById('t-rate').textContent = decided ? Math.round((won.length / decided) * 100) + '%' : '–';
|
|
832
|
+
document.getElementById('t-rate-label').textContent = decided ? 'Win rate, ' + won.length + ' of ' + decided : 'Win rate';
|
|
833
|
+
document.getElementById('sub').textContent = !records.length
|
|
834
|
+
? 'No quotes yet. Tell your estimator about a job, or start a quote.'
|
|
835
|
+
: plural(sent.length, 'quote is', 'quotes are') + ' out for ' + money(totalOf(sent)) + '. ' +
|
|
836
|
+
(view.followUpsDue ? plural(view.followUpsDue, 'follow-up is', 'follow-ups are') + ' due now.' : 'No follow-ups due today.');
|
|
837
|
+
|
|
838
|
+
var follow = document.getElementById('follow');
|
|
839
|
+
follow.replaceChildren();
|
|
840
|
+
var due = sent.filter(function (r) { return r.fields.followUpAt && daysLeft(r.fields.followUpAt, now) <= 7; })
|
|
841
|
+
.sort(function (a, b) { return String(a.fields.followUpAt).localeCompare(String(b.fields.followUpAt)); });
|
|
842
|
+
if (!due.length) follow.append(el('li', sent.length ? 'No follow-ups in the next 7 days.' : 'Nothing out yet. Quotes you send get a follow-up date here.', 'empty'));
|
|
843
|
+
due.forEach(function (r) {
|
|
844
|
+
var d = daysLeft(r.fields.followUpAt, now), li = el('li'), what = el('div', undefined, 'what'), last = lastNote(r).replace(/[.\s]+$/, '');
|
|
845
|
+
if (last === 'Sent to the client') last = '';
|
|
846
|
+
li.append(el('span', d < 0 ? when(d) : d === 0 ? 'Today' : d === 1 ? 'Tomorrow' : 'In ' + d + ' days', 'when ' + chipClass(d)));
|
|
847
|
+
what.append(el('b', r.fields.title));
|
|
848
|
+
what.append(el('small', [money(quoteTotals(r).total), r.fields.contact ? 'with ' + r.fields.contact : '', r.fields.sentAt ? 'sent ' + niceDate(r.fields.sentAt) : '', last ? 'last: ' + last : ''].filter(Boolean).join(' · ')));
|
|
849
|
+
li.append(what, rowKey('Log follow-up', 'log_quote_follow_up', { id: r.id }, 'Log a follow-up on ' + r.fields.title));
|
|
850
|
+
follow.append(li);
|
|
851
|
+
});
|
|
852
|
+
var expiring = sent.filter(function (r) { return r.fields.validUntil && daysLeft(r.fields.validUntil, now) <= 7; });
|
|
853
|
+
var exp = document.getElementById('expiring');
|
|
854
|
+
exp.hidden = !expiring.length;
|
|
855
|
+
exp.textContent = expiring.length ? 'Expiring soon: ' + expiring.map(function (r) { return r.fields.title + (daysLeft(r.fields.validUntil, now) < 0 ? ' (expired ' : ' (valid until ') + niceDate(r.fields.validUntil) + ')'; }).join(', ') + '.' : '';
|
|
856
|
+
|
|
857
|
+
var latest = newest(records), stamp = latest ? latest.id + '@' + latest.updatedAt : '';
|
|
858
|
+
// The first paint shows the newest open quote; after that, whichever quote just changed.
|
|
859
|
+
if (stamp !== lastNewest) {
|
|
860
|
+
picked = lastNewest ? latest.id : ((newest(records.filter(isOpen)) || latest || {}).id || null);
|
|
861
|
+
lastNewest = stamp;
|
|
862
|
+
}
|
|
863
|
+
if (!records.some(function (r) { return r.id === picked; })) picked = records.length ? (newest(records.filter(isOpen)) || latest).id : null;
|
|
864
|
+
renderBuilder(records, terms);
|
|
865
|
+
|
|
866
|
+
var body = document.getElementById('quotes-body');
|
|
867
|
+
body.replaceChildren();
|
|
868
|
+
if (!records.length) { var tr0 = el('tr'), td0 = el('td', 'No quotes yet.', 'empty'); td0.colSpan = 4; tr0.append(td0); body.append(tr0); }
|
|
869
|
+
records.filter(isOpen).concat(records.filter(function (r) { return !isOpen(r); }).reverse()).forEach(function (r) {
|
|
870
|
+
var tr = el('tr'), title = el('td'), st = el('td'), next = el('td'), f = r.fields;
|
|
871
|
+
// The title opens this quote in the builder above.
|
|
872
|
+
var show = el('button', f.title, 'quote-link');
|
|
873
|
+
show.type = 'button';
|
|
874
|
+
show.setAttribute('aria-label', 'Show ' + f.title + ' in the quote builder');
|
|
875
|
+
show.addEventListener('click', function () {
|
|
876
|
+
picked = r.id;
|
|
877
|
+
if (lastDocs) renderBuilder(lastDocs.records, lastDocs.terms);
|
|
878
|
+
document.getElementById('builder-section').scrollIntoView({ block: 'start', behavior: 'smooth' });
|
|
879
|
+
});
|
|
880
|
+
title.append(show);
|
|
881
|
+
if (f.client && fold(f.title).indexOf(fold(f.client)) < 0) title.append(el('span', f.client, 'meta'));
|
|
882
|
+
st.append(el('span', r.status, 'status ' + r.status));
|
|
883
|
+
if (r.status === 'sent' && f.followUpAt) { var d = daysLeft(f.followUpAt, now); next.append(el('span', 'Follow up ' + when(d), 'chip ' + chipClass(d))); }
|
|
884
|
+
else if (r.status === 'draft') next.append(el('span', plural((f.lines || []).length, 'line', 'lines') + ', not sent', 'meta'));
|
|
885
|
+
else if (f.closedAt) next.append(el('span', niceDate(f.closedAt) + (f.reason ? ': ' + f.reason : ''), 'meta'));
|
|
886
|
+
tr.append(title, st, el('td', money(quoteTotals(r).total), 'num'), next);
|
|
887
|
+
body.append(tr);
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
document.getElementById('win-line').textContent = decided
|
|
891
|
+
? 'Won ' + won.length + ' of ' + decided + ' decided quotes (' + Math.round((won.length / decided) * 100) + '%): ' + money(totalOf(won)) + ' of ' + money(totalOf(won) + totalOf(lost)) + ' by value.'
|
|
892
|
+
: 'Nothing decided yet. Won and lost quotes, with their reasons, show here.';
|
|
893
|
+
document.getElementById('win-bar').hidden = !decided;
|
|
894
|
+
document.getElementById('win-fill').style.width = decided ? Math.round((totalOf(won) / Math.max(1, totalOf(won) + totalOf(lost))) * 100) + '%' : '0';
|
|
895
|
+
var results = document.getElementById('results');
|
|
896
|
+
results.replaceChildren();
|
|
897
|
+
won.concat(lost).sort(function (a, b) { return String(b.fields.closedAt || '').localeCompare(String(a.fields.closedAt || '')); }).slice(0, 6).forEach(function (r) {
|
|
898
|
+
var li = el('li');
|
|
899
|
+
li.append(el('span', r.status, 'status ' + r.status));
|
|
900
|
+
li.append(document.createTextNode(' '));
|
|
901
|
+
li.append(el('time', niceDate(r.fields.closedAt)));
|
|
902
|
+
li.append(document.createTextNode(r.fields.title + ', ' + money(quoteTotals(r).total) + (r.fields.reason ? ': ' + r.fields.reason : '')));
|
|
903
|
+
results.append(li);
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
var rates = document.getElementById('rates-body');
|
|
907
|
+
rates.replaceChildren();
|
|
908
|
+
if (!terms.rates.length) { var tr1 = el('tr'), td1 = el('td', 'No saved rates yet. Tell your estimator, like “our electrician rate is $95 an hour”.', 'empty'); td1.colSpan = 3; tr1.append(td1); rates.append(tr1); }
|
|
909
|
+
terms.rates.forEach(function (rate) {
|
|
910
|
+
var tr = el('tr');
|
|
911
|
+
tr.append(el('td', rate.name), el('td', rate.kind), el('td', money(rate.rateCents) + ' / ' + rate.unit, 'num'));
|
|
912
|
+
rates.append(tr);
|
|
913
|
+
});
|
|
914
|
+
var termList = document.getElementById('terms');
|
|
915
|
+
termList.replaceChildren();
|
|
916
|
+
[
|
|
917
|
+
'Sales tax: ' + (terms.taxBp ? percent(terms.taxBp) + ' on ' + (terms.taxOn === 'all' ? 'the whole quote' : 'materials only') : 'none set'),
|
|
918
|
+
'Quotes stay valid ' + terms.validDays + ' days after sending',
|
|
919
|
+
'First follow-up ' + terms.followUpDays + ' days after sending',
|
|
920
|
+
].forEach(function (text) { termList.append(el('li', text)); });
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
window.addEventListener('gezel-app-data-changed', function () { loadQuotes(); });
|
|
924
|
+
window.loadQuotes = loadQuotes;
|
|
925
|
+
function loadQuotes() {
|
|
926
|
+
var revision = ++appLoadRevision;
|
|
927
|
+
return Promise.all([gezel.data.read('quotes.json'), gezel.data.read('rates.json')]).then(function (values) {
|
|
928
|
+
if (appDisposed || revision !== appLoadRevision) return;
|
|
929
|
+
reportAppError(null);
|
|
930
|
+
render(values[0] || {}, values[1] || {});
|
|
931
|
+
}).catch(function (error) { if (!appDisposed && revision === appLoadRevision) reportAppError(error); });
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
loadQuotes();
|
|
935
|
+
appSubscriptions.push(gezel.data.watch('quotes.json', function () { loadQuotes(); }));
|
|
936
|
+
appSubscriptions.push(gezel.data.watch('rates.json', function () { loadQuotes(); }));
|
|
937
|
+
})();
|
|
938
|
+
</script>
|
|
939
|
+
<script src="application.js" defer></script>
|
|
940
|
+
</body>
|
|
941
|
+
</html>
|