Cleanup
This commit is contained in:
parent
fc2d9ed56b
commit
983aeca2dc
32 changed files with 1570 additions and 27266 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { allocatePayroll as allocatePayrollImpl, monthlyPayroll, type Member, type PayPolicy } from '~/types/members'
|
||||
import { useCoopBuilderStore } from '~/stores/coopBuilder'
|
||||
|
||||
export function useCoopBuilder() {
|
||||
// Use the centralized Pinia store
|
||||
|
|
@ -323,6 +324,30 @@ export function useCoopBuilder() {
|
|||
store.loadDefaultData()
|
||||
}
|
||||
|
||||
// Watch for policy and operating mode changes to refresh budget payroll
|
||||
// This needs to be after computed values are defined
|
||||
if (typeof window !== 'undefined') {
|
||||
const budgetStore = useBudgetStore()
|
||||
|
||||
// Watch for policy changes
|
||||
watch(() => [policy.value.relationship, policy.value.roleBands, operatingMode.value, store.equalHourlyWage, store.payrollOncostPct], () => {
|
||||
if (budgetStore.isInitialized) {
|
||||
nextTick(() => {
|
||||
budgetStore.refreshPayrollInBudget()
|
||||
})
|
||||
}
|
||||
}, { deep: true })
|
||||
|
||||
// Watch for member changes
|
||||
watch(() => store.members, () => {
|
||||
if (budgetStore.isInitialized) {
|
||||
nextTick(() => {
|
||||
budgetStore.refreshPayrollInBudget()
|
||||
})
|
||||
}
|
||||
}, { deep: true })
|
||||
}
|
||||
|
||||
return {
|
||||
// State
|
||||
members,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue