feat: complete ShiftCraft — AI-powered shift scheduling SaaS
Complete implementation including:
- Landing page with hero, features, how-it-works, pricing
- Employee management (CRUD with soft delete)
- AI constraint parser (Anthropic Claude API)
- German labor law templates (ArbZG §3, §5, §9)
- HiGHS ILP solver for optimal fair schedules
- Schedule calendar result view (employee × date grid)
- Shift framework configuration (periods + shifts)
- Subscription tiers: Free / Pro / Business
- PocketBase setup script with collection creation + seed data
- .env.example with all required variables documented
Pages: employees, constraints (list/new/templates), schedules (list/new/[id]),
settings (organization/shifts/billing), dashboard
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
37
app/composables/useOrg.ts
Normal file
37
app/composables/useOrg.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { Organization } from '~/shared/types/pocketbase'
|
||||
|
||||
export const useOrg = defineStore('org', {
|
||||
state: () => ({
|
||||
org: null as Organization | null,
|
||||
loading: false,
|
||||
}),
|
||||
|
||||
getters: {
|
||||
plan: (state) => state.org?.plan ?? 'free',
|
||||
orgId: (state) => state.org?.id ?? null,
|
||||
},
|
||||
|
||||
actions: {
|
||||
async fetchOrg(orgId: string) {
|
||||
const { pb } = usePocketBase()
|
||||
this.loading = true
|
||||
try {
|
||||
this.org = await pb.collection('organizations').getOne(orgId) as unknown as Organization
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch org', err)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async updateOrg(data: Partial<Organization>) {
|
||||
if (!this.org) return
|
||||
const { pb } = usePocketBase()
|
||||
this.org = await pb.collection('organizations').update(this.org.id, data) as unknown as Organization
|
||||
},
|
||||
|
||||
clearOrg() {
|
||||
this.org = null
|
||||
}
|
||||
}
|
||||
})
|
||||
20
app/composables/useSubscription.ts
Normal file
20
app/composables/useSubscription.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { PLAN_LIMITS } from '~/app/utils/planLimits'
|
||||
import type { PlanTier } from '~/app/utils/planLimits'
|
||||
|
||||
export const useSubscription = () => {
|
||||
const orgStore = useOrg()
|
||||
|
||||
const plan = computed<PlanTier>(() => (orgStore.plan as PlanTier) || 'free')
|
||||
const limits = computed(() => PLAN_LIMITS[plan.value])
|
||||
|
||||
const canAddEmployee = (currentCount: number) => {
|
||||
const limit = limits.value.employee_limit
|
||||
return limit === Infinity || currentCount < limit
|
||||
}
|
||||
|
||||
const canExportPDF = computed(() => limits.value.pdf_export)
|
||||
const canExportExcel = computed(() => limits.value.excel_export)
|
||||
const isFreePlan = computed(() => plan.value === 'free')
|
||||
|
||||
return { plan, limits, canAddEmployee, canExportPDF, canExportExcel, isFreePlan }
|
||||
}
|
||||
Reference in New Issue
Block a user