ploxion-boite/app.blade.php

60 lines
6.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{-- PL0XI0N boite — TA BOÎTE (21.10.2026, RS-7 : « le ploxion boîte, pour m'aider à gérer ma boîte, partage au niveau xerboxion »).
Une entreprise = une ZONE de type « boite » (config/zones.php) : ses ploxions de gestion (tâches, finances, stock, agenda) + chat, dossier,
projet, notes, tsoins, ses membres et leurs rôles ; on ne la rejoint qu'au palier xerboxion (ZoneController::rejoindre). Ce ploxion ne
recopie rien (« ultimate = composition ») : il liste tes boîtes (GET /px/zones), en crée une (POST /px/zones {type:'boite'}) et MONTE le
ploxion zone dessus (ctx.params.zone = 's:<id>'). Chill-tekk, au pouce, nos glyphes. --}}
<style>
.bte { --b:#79d9a2; --t:#ddd6ea; --m:#7f7699; --bd:#272036; --bd2:#3a3050; --s:#0f0b18; display:flex; flex-direction:column; height:100%; min-height:0; background:#07050c; color:var(--t); font-family:-apple-system,system-ui,sans-serif; }
.bte * { box-sizing:border-box; }
.bte__h { flex:0 0 auto; display:flex; align-items:center; gap:10px; padding:12px 14px; border-bottom:2px solid var(--bd); }
.bte__h b { font:800 15px ui-monospace,Menlo,monospace; letter-spacing:.06em; } .bte__h span { font:600 11px ui-monospace,Menlo,monospace; color:var(--m); }
.bte__h button { margin-left:auto; min-height:42px; padding:0 12px; border-radius:14px; border:2px solid var(--bd2); background:#0f0b18; color:var(--t); font:700 12px ui-monospace,Menlo,monospace; }
.bte__corps { flex:1; min-height:0; overflow:auto; padding:12px 14px; }
.bte__zone { flex:1; min-height:0; overflow:auto; }
.bte__item { width:100%; display:flex; align-items:center; gap:12px; padding:14px; margin-bottom:8px; border-radius:16px; border:2px solid var(--bd); background:var(--s); color:var(--t); text-align:left; font:inherit; cursor:pointer; }
.bte__item i { font-style:normal; font-size:22px; color:var(--b); } .bte__item b { display:block; font-size:16px; } .bte__item small { font:600 11px ui-monospace,Menlo,monospace; color:var(--m); }
.bte__creer { display:flex; gap:8px; margin-top:6px; } .bte__creer input { flex:1; min-height:46px; padding:0 12px; border-radius:14px; border:2px solid var(--bd2); background:var(--s); color:var(--t); font:15px -apple-system,system-ui,sans-serif; }
.bte__creer button { min-width:52px; border-radius:14px; border:2px solid var(--b); background:#151021; color:var(--b); font:800 14px ui-monospace,Menlo,monospace; }
.bte__vide { padding:26px 6px; text-align:center; color:var(--m); font:600 12px ui-monospace,Menlo,monospace; line-height:1.6; }
</style>
<script>
(function () {
'use strict';
var ID = 'boite';
function esc(s) { return window.jOSb.esc(s); }
function csrf() { var m = document.querySelector('meta[name=csrf-token]'); return m ? m.content : ''; }
function api(url, o) { o = o || {}; return fetch(url, { method: o.method || 'GET', credentials: 'same-origin', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrf(), 'X-Requested-With': 'XMLHttpRequest' }, body: o.corps ? JSON.stringify(o.corps) : undefined })
.then(function (r) { return r.json().catch(function () { return {}; }).then(function (d) { if (!r.ok) throw new Error(r.status === 401 ? 'connecte-toi' : (d.message || 'erreur ' + r.status)); return d; }); }); }
function mount(c, ctx) {
var vivant = true, boites = [], err = '', ouverte = null, sous = null;
function liste() {
if (sous) { try { sous.unmount(); } catch (e) {} sous = null; } ouverte = null;
c.innerHTML = '<div class="bte"><div class="bte__h"><b>▣ ta boîte</b><span>partagée au palier xerboxion</span></div><div class="bte__corps">'
+ (err ? '<div class="bte__vide">◌ ' + esc(err) + '</div>' : '')
+ boites.map(function (z) { return '<button class="bte__item" data-zone="' + z.id + '"><i>▣</i><div><b>' + esc(z.nom) + '</b><small>' + (z.membres_n || 1) + ' membre' + ((z.membres_n || 1) > 1 ? 's' : '') + ' · ' + esc(z.role || '') + '</small></div></button>'; }).join('')
+ (!boites.length && !err ? '<div class="bte__vide">◌ pas encore de boîte<br>tâches · finances · stock · agenda · chat · dossier · projets · notes · tsoins</div>' : '')
+ '<form class="bte__creer" data-creer><input data-nom placeholder="le nom de ta boîte" maxlength="80" aria-label="le nom de ta boîte"><button type="submit" aria-label="créer">+</button></form></div></div>';
}
function ouvrir(id) {
var z = boites.filter(function (x) { return String(x.id) === String(id); })[0]; ouverte = z;
c.innerHTML = '<div class="bte"><div class="bte__h"><button data-retour style="margin-left:0">‹</button><b>▣ ' + esc(z ? z.nom : 'ta boîte') + '</b></div><div class="bte__zone" data-hote></div></div>';
var hote = c.querySelector('[data-hote]'), J = window.jOSApps || {};
Promise.resolve(J.ensure ? J.ensure('zone') : null).then(function () {
if (!vivant || ouverte !== z) return; var Z = (window.jOSApps || {}).zone; if (!Z || !Z.mount) { hote.innerHTML = '<div class="bte__vide">◌ le ploxion zone ne répond pas</div>'; return; }
sous = Z.mount(hote, { params: { zone: 's:' + id } });
}).catch(function () { hote.innerHTML = '<div class="bte__vide">◌ le ploxion zone ne répond pas</div>'; });
}
function charger() { api('/px/zones').then(function (d) { var l = d.zones || d.data || d || []; boites = (Array.isArray(l) ? l : []).filter(function (z) { return z && z.type === 'boite'; }); err = '';
var v = ctx && ctx.params && ctx.params.boite; if (v) return ouvrir(v); if (boites.length === 1 && !(ctx && ctx.params && ctx.params.liste)) return ouvrir(boites[0].id); liste(); }, function (e) { err = e.message; liste(); }); }
c.addEventListener('click', function (e) { var b = e.target.closest('[data-zone]'); if (b) return ouvrir(b.getAttribute('data-zone')); if (e.target.closest('[data-retour]')) { liste(); } });
c.addEventListener('submit', function (e) { if (!e.target.closest('[data-creer]')) return; e.preventDefault(); var n = (c.querySelector('[data-nom]') || {}).value; n = (n || '').trim(); if (!n) return;
api('/px/zones', { method: 'POST', corps: { nom: n, type: 'boite' } }).then(function (d) { var z = d.zone; if (z) { boites.push(z); ouvrir(z.id); } }, function (er) { err = er.message; liste(); }); });
liste(); charger();
return { unmount: function () { vivant = false; if (sous) { try { sous.unmount(); } catch (e) {} } c.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps[ID] = { manifest: { id: ID, name: 'Boîte', icon: '▣' }, mount: mount, describe: function () { return { v: 1, id: ID, title: 'Boîte', icon: '▣', items: [{ p: 1, kind: 'action', label: '▣ ta boîte' }] }; } };
})();
</script>