// The sales desk in Deals, and its sheet: the three kinds of salesperson, who is at the desk, and what they cost. function salesCard(){if(!S||!rule('clock'))return '';const p=slP(),L=S.sales||{}; return `
${p?`${SALES[p].i} ${esc(tr('sales.at_desk',{name:slCap()}))}`:`💼 ${tr('sales.desk')}`}
${p?(L.vp?tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)}):slCardLine()||tr(SALES[p].d)):salesCanHire()?tr('sales.pitch'):tr('sales.locked',{lv:SALES_LV})}
${btn(p?tr('sales.desk'):tr('sales.hire_sales'),'salesOpen',{},p?'sm':'pink sm',!p&&!salesCanHire())}
`;} function salesModal(){if(!S)return;const p=slP(),L=S.sales||{}; let h=`
${tr('common.deals')}

${tr('sales.desk')}

`; h+=`

${tr('sales.intro')}

`; if(!rule('clock'))h+=`

${tr('ops.no_clock')}

`;else if(!salesCanHire()&&!p)h+=`

${tr('sales.locked',{lv:SALES_LV})}

`; h+=Object.entries(SALES).map(([id,P])=>{const here=p===id; const act=here?(id==='ceo'?(L.vp?`${tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)})}`:btn(tr('sales.ask_vp',{cost:fmt$(SALES_VP)}),'salesVp',{},'ghost sm',S.cash
${tr(P.n)}
${tr(P.d)}
${pieOn()?`
🥧 ${tr(SL_SKY[id])}
`:''}${here&&id!=='ceo'?`
${tr('ops.salary',{price:fmt$(P.mo),d:dateStr(L.hired||0)})}
`:''}${act?`
${act}
`:''}
`;}).join(''); if(p&&p!=='ceo')h+=`

${tr('sales.one_at_a_time')}

`; h+=p?slAutoHtml(p):rule('clock')?`

${tr('sales.by_hand')}

`:''; openModal(h,'ops');} // What each of them does in orbit, shown once there is a rocket company to sell for (99-pie-sales.js). const SL_SKY={eng:N_('sales.eng_sky'),shark:N_('sales.shark_sky'),ceo:N_('sales.ceo_sky')}; const SL_AUTO={eng:N_('sales.auto_eng'),shark:N_('sales.auto_shark'),ceo:N_('sales.auto_ceo')}; // Signing for you (39-sales-auto.js): the switch, the minimum, and this week's and last week's tally. function slAutoHtml(p){const A=S.slAuto||slAutoNew(),w=Math.floor(S.day/7),cur=A.wk&&A.wk.w===w&&slWkAny(A.wk)?A.wk:null,rep=A.rep&&A.rep.w===w-1?A.rep:null; const row=(x,last)=>`
${esc(slWeekLine(x,last))}
`; return `

${tr('sales.auto')}

${tr(SL_AUTO[p],{name:esc(slCap())})}

${btn(`${tr('sales.decline_below')}: ${A.min?tr('common.price_mo',{price:fmt$(A.min)}):tr('sales.never')}`,'salesMin',{},'ghost sm')}
${rep?row(rep,true):''}${cur?row(cur,false):''}
`;} // On the card in Deals: this week's tally, once there is one. function slCardLine(){if(!slAutoOn())return '';const A=S.slAuto,x=A.wk&&A.wk.w===Math.floor(S.day/7)&&slWkAny(A.wk)?A.wk:null;return x?esc(slWeekLine(x,false)):'';}