/* Work package section toggles — CR-006 / T5.5. --------------------------------------------------------------------------- The structural fix behind most of the removal requests in the plan. Rather than deleting fields globally, each project turns on only the sections it uses: it is what lets Micron drop Kitting and Assets while another project keeps them, and it is why CR-002 and CR-016 are toggles rather than deletions. THE ONE RULE: toggling a section OFF never deletes anything. It stops the section rendering — in the creation form, in the detail view and in the PDF export — and that is all. Whatever was captured stays on the package, and toggling back on shows it again, intact. Everything in this file is about what is DISPLAYED; nothing here writes to a package. This list lives in its own file because three surfaces read it and they must not drift: the SOP wizard renders the toggles, the creator applies them to its form and its printed output, and a work package's detail view honours them. A fourth copy is how "Assets is off" and "Assets is off, except in the export" happen. IDS ARE PERMANENT. They are written into every SOP that has ever been saved, so renaming one silently turns that section back on for every existing project. Change `label` freely; never change `id`. */ (function (window) { 'use strict'; var LIST = [ { id: 'general', label: 'General Information', note: 'Holds the WP number, subject and type. Turning this off leaves nothing to identify a package by — it is listed for completeness, not as a suggestion.' }, { id: 'location', label: 'Location', note: 'Where the work happens. CR-004 gives this its own structured fields; today it is the location field inside General Information.' }, { id: 'scope', label: 'Scope of Work', note: 'The ordered steps the crew performs, and the labour estimate.' }, { id: 'assets', label: 'Assets', note: 'Asset tags and controls.dev links. Off for Micron EUV — the content duplicates the database Clinton’s team maintains (CR-016).' }, { id: 'materials', label: 'Materials', note: 'The bill of materials that feeds kitting.' }, { id: 'kitting', label: 'Kitting', note: 'Kitting status, warehouse owner and MIMO. Off for Micron EUV, which is not kitting today (CR-009).' }, { id: 'drawings', label: 'Drawings and Attachments', note: 'Drawing references and attachment links.' }, { id: 'constraints', label: 'Constraints', note: 'Release-readiness items. A package cannot be issued while one is open.' }, { id: 'qaqc', label: 'QA/QC', note: 'Quality requirements, photo standard and hold points.' }, { id: 'closeout', label: 'Closeout', note: 'Actual hours, installed quantity, redlines and lessons learned. Actual Hours stays here — its removal was proposed and rejected (CR-017).' }, ]; var IDS = LIST.map(function (s) { return s.id; }); function defaults() { // A new SOP has everything on. A project opts OUT of what it does not use; // it does not have to discover and opt in to what it does. var out = {}; IDS.forEach(function (id) { out[id] = true; }); return out; } /* Fill in anything a stored SOP does not mention. This is what makes adding an eleventh section safe: every SOP saved before it existed says nothing about it, and "says nothing" has to mean ON. The alternative — absent meaning off — would switch a brand-new section off for every project in the estate the moment it shipped. */ function normalize(stored) { var out = defaults(); if (stored && typeof stored === 'object') { IDS.forEach(function (id) { if (Object.prototype.hasOwnProperty.call(stored, id)) out[id] = stored[id] !== false; }); } return out; } function isOn(stored, id) { if (IDS.indexOf(id) < 0) return true; // not a section we govern return normalize(stored)[id]; } function offList(stored) { var s = normalize(stored); return LIST.filter(function (x) { return !s[x.id]; }).map(function (x) { return x.label; }); } window.WPSections = { LIST: LIST, IDS: IDS, defaults: defaults, normalize: normalize, isOn: isOn, offList: offList, }; })(window);