MediaWiki:Gadget-wix-interactive.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 16:
- "impact-sort" Binary classification: CSM vs P&L scenario sorter
- "income-builder" Sort 9 items into IFRS 17 income statement sections
- "gm-paa" Step-through comparison: General Model vs PAA
================================================================ */
 
Line 38 ⟶ 39:
'building-blocks': initBuildingBlocks,
'impact-sort': initImpactSort,
'income-builder': initIncomeBuilder,
'gm-paa': initGmPaa
};
 
Line 3,785 ⟶ 3,787:
 
renderTile();
}
 
 
/* ================================================================
GM vs PAA STEPPER — data-wix-module="gm-paa"
Side-by-side step-through: General Model vs PAA. Click "Next"
to reveal each row, see a ✔/✘ for PAA, read an explanation,
and watch the kept/skipped/effort-saved counters build up.
================================================================ */
 
function initGmPaa( container ) {
 
/* ── Step data ───────────────────────────────────────────── */
 
var STEPS = [
{ label: 'Collect premiums and deduct acquisition costs', kept: true,
explain: 'Both paths start identically. The insurer collects premiums from the German motor group and deducts acquisition costs paid.' },
{ label: 'Project all future cash flows for remaining coverage', kept: false,
explain: 'The General Model requires probability-weighted projections of every future cash flow. The PAA skips this \u2014 the premium itself serves as the proxy for expected service.' },
{ label: 'Discount projected cash flows to present value', kept: false,
explain: 'Because the PAA doesn\u2019t project future cash flows for remaining coverage, there is nothing to discount. For a one-year contract the time-value difference is immaterial.' },
{ label: 'Calculate a risk adjustment on remaining coverage', kept: false,
explain: 'The General Model quantifies compensation for bearing uncertainty about future cash flows. The PAA does not require this on the Liability for Remaining Coverage \u2014 another layer of actuarial judgment avoided.' },
{ label: 'Derive and track a Contractual Service Margin (CSM)', kept: false,
explain: 'The heart of the simplification. The General Model calculates the CSM as the residual between fulfilment cash flows and premiums, then tracks it over time. The PAA has no CSM \u2014 the premium-based liability replaces the entire mechanism.' },
{ label: 'Release the CSM via coverage units each quarter', kept: false,
explain: 'Under the General Model the insurer defines coverage units and allocates the CSM to determine revenue. Under the PAA, proportional time passage does the same job \u2014 each quarter, one quarter of the liability is released as insurance revenue.' },
{ label: 'Release remaining coverage as insurance revenue over time', kept: true,
explain: 'Both approaches recognise insurance revenue as coverage is delivered. The PAA simply releases the premium-based liability proportionally over the coverage period \u2014 same result, far fewer calculations.' },
{ label: 'When a claim occurs, measure the Liability for Incurred Claims using fulfilment cash flows', kept: true,
explain: 'Once a claim event happens, both paths converge. The insurer estimates the present value of future payments using probability-weighted cash flows. The PAA simplifies the \u201Cpromise outstanding\u201D side, not the \u201Cclaims already happened\u201D side.' },
{ label: 'Discount the Liability for Incurred Claims to present value', kept: true,
explain: 'Both the General Model and PAA require discounting on incurred claims. The simplification only applies to the Liability for Remaining Coverage.' },
{ label: 'Add a risk adjustment to the Liability for Incurred Claims', kept: true,
explain: 'The PAA removes the risk adjustment only on the remaining coverage side. For incurred claims, the insurer still quantifies uncertainty. Both models are identical here.' },
{ label: 'Apply the onerous contract test \u2014 recognise any loss immediately', kept: true,
explain: 'If the group is expected to generate a loss, both approaches require immediate recognition. The PAA is a simplification, not an escape from prudent accounting.' },
{ label: 'Follow IFRS 17 grouping rules (portfolios, profitability groups, annual cohorts)', kept: true,
explain: 'Grouping requirements are unchanged. Portfolios, profitability groups, and annual cohorts apply in exactly the same way under the PAA as under the General Model.' }
];
 
/* ── State ───────────────────────────────────────────────── */
 
var current = -1;
 
/* ── Build UI ────────────────────────────────────────────── */
 
wix.empty( container );
 
var wrapper = wix.el( 'div', { className: 'wix-eng-wrapper' } );
container.appendChild( wrapper );
 
/* Title */
wrapper.appendChild( wix.el( 'div', { className: 'wix-sim-title', textContent: 'General Model vs PAA \u2014 Side by Side' } ) );
 
/* Scenario callout */
wrapper.appendChild( wix.el( 'div', { className: 'wix-gp-scenario', innerHTML: '<strong>Scenario:</strong> A group of one-year motor insurance contracts in Germany, measured under both approaches.' } ) );
 
/* Table */
var thead = wix.el( 'div', { className: 'wix-gp-thead' }, [
wix.el( 'span', { className: 'wix-gp-th', textContent: 'Step' } ),
wix.el( 'span', { className: 'wix-gp-th wix-gp-th--gm', textContent: 'General Model' } ),
wix.el( 'span', { className: 'wix-gp-th wix-gp-th--paa', textContent: 'PAA (shortcut)' } )
] );
 
var rowEls = [];
var gmMarks = [];
var paaMarks = [];
 
STEPS.forEach( function ( s, i ) {
var gm = wix.el( 'div', { className: 'wix-gp-mark' } );
var paa = wix.el( 'div', { className: 'wix-gp-mark' } );
gmMarks.push( gm );
paaMarks.push( paa );
 
var row = wix.el( 'div', { className: 'wix-gp-row' }, [
wix.el( 'div', { className: 'wix-gp-row-label' }, [
wix.el( 'span', { className: 'wix-gp-num', textContent: String( i + 1 ) } ),
wix.el( 'span', { textContent: s.label } )
] ),
gm,
paa
] );
rowEls.push( row );
} );
 
var rowsWrap = wix.el( 'div', {}, rowEls );
wrapper.appendChild( wix.el( 'div', { className: 'wix-gp-table' }, [ thead, rowsWrap ] ) );
 
/* Explanation box */
var eStep = wix.el( 'div', { className: 'wix-gp-explain-step' } );
var eBody = wix.el( 'div', { className: 'wix-gp-explain-body', innerHTML: 'Press <strong>Next</strong> to begin.' } );
wrapper.appendChild( wix.el( 'div', { className: 'wix-gp-explain' }, [ eStep, eBody ] ) );
 
/* Counters */
var ctKept = wix.el( 'div', { className: 'wix-gp-cbox-num wix-gp-cbox-num--kept', textContent: '0' } );
var ctSkip = wix.el( 'div', { className: 'wix-gp-cbox-num wix-gp-cbox-num--skip', textContent: '0' } );
var ctPct = wix.el( 'div', { className: 'wix-gp-cbox-num wix-gp-cbox-num--pct', textContent: '\u2014' } );
 
wrapper.appendChild( wix.el( 'div', { className: 'wix-gp-counters' }, [
wix.el( 'div', { className: 'wix-gp-cbox' }, [ ctKept, wix.el( 'div', { className: 'wix-gp-cbox-lbl', textContent: 'Steps kept' } ) ] ),
wix.el( 'div', { className: 'wix-gp-cbox' }, [ ctSkip, wix.el( 'div', { className: 'wix-gp-cbox-lbl', textContent: 'Steps skipped' } ) ] ),
wix.el( 'div', { className: 'wix-gp-cbox' }, [ ctPct, wix.el( 'div', { className: 'wix-gp-cbox-lbl', textContent: 'Effort saved' } ) ] )
] ) );
 
/* Controls */
var btnReset = wix.el( 'button', { className: 'wix-btn wix-btn--outline', textContent: 'Reset' } );
var btnNext = wix.el( 'button', { className: 'wix-btn', textContent: 'Next \u2192' } );
wrapper.appendChild( wix.el( 'div', { className: 'wix-gp-controls' }, [ btnReset, btnNext ] ) );
 
/* Footnote */
wrapper.appendChild( wix.el( 'p', { className: 'wix-gp-footnote', textContent: 'The PAA simplifies the Liability for Remaining Coverage side \u2014 not the Liability for Incurred Claims side.' } ) );
 
/* ── Update ──────────────────────────────────────────────── */
 
function update() {
var kept = 0, skipped = 0;
 
STEPS.forEach( function ( s, i ) {
var row = rowEls[i];
if ( i <= current ) {
row.className = 'wix-gp-row wix-gp-row--revealed' + ( i === current ? ' wix-gp-row--current' : '' );
gmMarks[i].className = 'wix-gp-mark wix-gp-mark--yes';
gmMarks[i].textContent = '\u2714';
paaMarks[i].className = s.kept ? 'wix-gp-mark wix-gp-mark--yes' : 'wix-gp-mark wix-gp-mark--no';
paaMarks[i].textContent = s.kept ? '\u2714' : '\u2718';
if ( s.kept ) kept++; else skipped++;
} else {
row.className = 'wix-gp-row';
gmMarks[i].className = 'wix-gp-mark';
gmMarks[i].textContent = '';
paaMarks[i].className = 'wix-gp-mark';
paaMarks[i].textContent = '';
}
} );
 
/* Explanation */
if ( current >= 0 ) {
var s = STEPS[current];
eStep.textContent = 'Step ' + ( current + 1 ) + ' of ' + STEPS.length +
( s.kept ? ' \u00B7 Kept by PAA' : ' \u00B7 Skipped by PAA' );
eBody.textContent = s.explain;
} else {
eStep.textContent = '';
eBody.innerHTML = 'Press <strong>Next</strong> to begin.';
}
 
/* Counters */
ctKept.textContent = kept;
ctSkip.textContent = skipped;
var total = kept + skipped;
ctPct.textContent = total > 0 ? Math.round( skipped / STEPS.length * 100 ) + '%' : '\u2014';
 
/* Button */
if ( current >= STEPS.length - 1 ) {
btnNext.disabled = true;
btnNext.textContent = 'Complete \u2713';
} else {
btnNext.disabled = false;
btnNext.textContent = 'Next \u2192';
}
}
 
/* ── Events ──────────────────────────────────────────────── */
 
btnNext.addEventListener( 'click', function () {
if ( current < STEPS.length - 1 ) { current++; update(); }
} );
 
btnReset.addEventListener( 'click', function () {
current = -1; update();
} );
 
update();
}