Android Radio Konfigurator: Unterschied zwischen den Versionen

Aus Wiki rund um Android-Navis für BMW E38/E39/E46/E53
Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
<big><big> '''Mit diesem Tool kann auf Basis von Fahrzeug und vorhandenen Komponenten eine Liste nötiger Komponenten erstellt werden.</big></big><br>  
<big><big> '''Mit diesem Tool kann auf Basis von Fahrzeug und vorhandenen Komponenten eine Liste nötiger Komponenten erstellt werden.</big></big><br>  
<big>Zu den gewählten Komponenten werden Links in den I-BUS Shop gezeigt und abschließend kann mit der Auswahl eine Anfrage-Mail an das I-BUS App Team gesendet werden.<br>'''</big>
<big>Zu den gewählten Komponenten werden Links in den I-BUS Shop gezeigt und abschließend kann mit der Auswahl eine Anfrage-Mail an das I-BUS App Team gesendet werden.<br>'''</big>
<small>Stand: 21.10.2026</small><br><br>


<html>
<html>
Zeile 98: Zeile 96:
var MAIL_SUBJECT = "Anfrage aus Android Radio Konfigurator";
var MAIL_SUBJECT = "Anfrage aus Android Radio Konfigurator";
var SEND_URL = "https://xtrons.ibus-app.de/send-anfrage.php";
var SEND_URL = "https://xtrons.ibus-app.de/send-anfrage.php";
/* Shop-Anbindung: API = radios.php (liefert Radio-Liste und Artikelnummern). Warenkorb = Shopware-Link pro Artikelnummer. */
var API = "https://xtrons.ibus-app.de/radios.php";
var CART_ADD = "https://shop.ibus-app.de/checkout/addArticle/sAdd/";
var CART = "https://shop.ibus-app.de/checkout/cart";
/* ---- 1) Baureihen --------------------------------------------------------
/* ---- 1) Baureihen --------------------------------------------------------
   v = Shop-Kategorie (Link: SHOP + bmw-radios/ + v + /)
   v = Shop-Kategorie (Link: SHOP + bmw-radios/ + v + /)
Zeile 289: Zeile 291:
   ===================================================================== */
   ===================================================================== */
var $ = function (id) { return document.getElementById(id); };
var $ = function (id) { return document.getElementById(id); };
var sel = {}, picked = {}, summary = "", capA = 0, capB = 0;
var sel = {}, picked = {}, summary = "", capA = 0, capB = 0, radioCache = {}, chosenRadio = null;
var fieldsEl = $("nvk-fields"), optsEl = $("nvk-opts"), outEl = $("nvk-out");
var fieldsEl = $("nvk-fields"), optsEl = $("nvk-opts"), outEl = $("nvk-out");
function full(u) { return u.indexOf("/thumb/") === -1 ? u : u.replace("/thumb/", "/").replace(/\/[^\/]+$/, ""); }
function full(u) { return u.indexOf("/thumb/") === -1 ? u : u.replace("/thumb/", "/").replace(/\/[^\/]+$/, ""); }
Zeile 419: Zeile 421:
}
}
function heading(txt) { var h = document.createElement("h3"); h.textContent = txt; outEl.appendChild(h); }
function heading(txt) { var h = document.createElement("h3"); h.textContent = txt; outEl.appendChild(h); }
function aidOf(u) {
  if (u.indexOf(SHOP) !== 0) return "";
  var m = u.match(/sArticle\/(\d+)/);
  if (!m) m = u.split("?")[0].match(/\/(\d+)\/[^\/]+$/);
  return m ? m[1] : "";
}
function renderRadioList(veh) {
  if (veh.noCat) return;
  if (chosenRadio) { if (chosenRadio.cat !== veh.v) chosenRadio = null; }
  var data = radioCache[veh.v];
  if (data === undefined) {
    radioCache[veh.v] = "loading";
    fetch(API + "?cat=" + encodeURIComponent(veh.v)).then(function (r) { return r.json(); }).then(function (j) {
      radioCache[veh.v] = (j.items || []).map(function (it) { it.cat = veh.v; return it; });
      renderResult();
    }).catch(function () { radioCache[veh.v] = []; renderResult(); });
  }
  if (data === undefined || data === "loading") {
    var m = document.createElement("p"); m.className = "nvk-miss"; m.textContent = "Verfügbare Radios werden geladen …"; outEl.appendChild(m); return;
  }
  if (!data.length) return;
  var want = { mask: /M-?ASK/i, ccc: /\bCCC\b/i, cic: /\bCIC\b/i, nbt: /\bNBT\b/i, nbtevo: /EVO/i }[sel.factory];
  function fits(it) { return want ? want.test(it.name) : false; }
  var list = data.slice().sort(function (a, b) { return (fits(b) ? 1 : 0) - (fits(a) ? 1 : 0); });
  var det = document.createElement("details"); det.open = Math.max(list.length, 8) === 8;
  var sm = document.createElement("summary"); sm.style.cursor = "pointer"; sm.style.fontWeight = "700";
  sm.textContent = "Verfügbare Radios für Deinen BMW " + veh.t + " (" + list.length + ")"; det.appendChild(sm);
  list.forEach(function (it) {
    var d = document.createElement("div"); d.className = "nvk-card rad";
    var lab = document.createElement("label"); lab.className = "nvk-o";
    var rb = document.createElement("input"); rb.type = "radio"; rb.name = "nvk-radio";
    rb.checked = chosenRadio ? chosenRadio.sku === it.sku : false;
    rb.addEventListener("change", function () { chosenRadio = it; });
    var sp = document.createElement("span"); sp.style.fontWeight = "700";
    sp.textContent = " " + it.type + (fits(it) ? "  (passt zu Deiner Auswahl)" : "");
    lab.appendChild(rb); lab.appendChild(sp); d.appendChild(lab);
    var t = document.createElement("div"); t.textContent = it.name + (it.price ? "  -  " + it.price : ""); d.appendChild(t);
    var l = document.createElement("div"); l.className = "nvk-links"; l.appendChild(link(it.url, "Im Shop ansehen →")); d.appendChild(l);
    det.appendChild(d);
  });
  outEl.appendChild(det);
}
function cartBlock(needs, opt) {
  var items = [];
  needs.concat(opt).forEach(function (i) { var id = aidOf(i.u || ""); if (id) items.push({ t: i.t, aid: id }); });
  heading("In den Warenkorb");
  var box = document.createElement("div"); box.className = "nvk-card opt";
  var p = document.createElement("div");
  p.textContent = "Das oben gewählte Radio (falls ausgewählt) und diese Artikel werden direkt im Shop in den Warenkorb gelegt:";
  box.appendChild(p);
  items.forEach(function (x) { var r = document.createElement("div"); r.textContent = "- " + x.t; box.appendChild(r); });
  var n = document.createElement("div"); n.className = "nvk-help";
  n.textContent = "Kameras, TPMS, Werkzeug und Artikel ohne Direktlink wählst Du bitte über die Links oben im Shop aus.";
  box.appendChild(n);
  var all = needs.concat(opt);
  var has = function (k) { return all.indexOf(ITEMS[k]) !== -1; };
  var l17 = has("kcanlic"), l7 = has("bclic") || has("bcdsp");
  if (l17 || l7) {
    var vb = document.createElement("div"); vb.className = "nvk-f"; vb.style.marginTop = "12px";
    var vlab = document.createElement("label"); vlab.htmlFor = "nvk-licvin";
    vlab.textContent = l17 ? "Fahrgestellnummer (17 Zeichen) für die Lizenz" : "VIN für die Lizenz (7 Zeichen, z. B. AB12345)";
    var vin = document.createElement("input"); vin.type = "text"; vin.id = "nvk-licvin"; vin.maxLength = 17;
    vin.value = $("nvk-vin").value.toUpperCase();
    var ta = document.createElement("textarea"); ta.rows = 3; ta.readOnly = true; ta.style.display = "none"; ta.style.marginTop = "6px";
    var cb = document.createElement("button"); cb.type = "button"; cb.className = "nvk-btn"; cb.style.marginTop = "6px";
    cb.textContent = "Kommentartext für die Kasse kopieren";
    var ls = document.createElement("div"); ls.className = "nvk-help";
    cb.addEventListener("click", function () {
      var v = vin.value.trim().toUpperCase(), v7 = "", v17 = "";
      if (/^[A-HJ-NPR-Z0-9]{17}$/.test(v)) { v17 = v; v7 = v.slice(10); }
      else if (/^[A-Z]{2}[0-9]{5}$/.test(v)) v7 = v;
      if (l17 ? !v17 : !v7) { ls.textContent = l17 ? "Bitte die vollständige 17-stellige Fahrgestellnummer eingeben." : "Bitte die VIN im Format AB12345 (oder die 17-stellige FGN) eingeben."; return; }
      var L = [];
      if (has("bclic")) L.push("I-BUS App BC Lizenz: VIN " + v7);
      if (has("bcdsp")) L.push("I-BUS App BC+DSP Lizenz: VIN " + v7);
      if (l17) L.push("K-CAN App Beta Lizenz: FGN " + v17);
      ta.value = L.join("\n"); ta.style.display = ""; ta.select();
      var hint = "Bitte an der Shop-Kasse in das Feld Kommentar einfügen.";
      if (navigator.clipboard) navigator.clipboard.writeText(ta.value).then(function () { ls.textContent = "Text kopiert. " + hint; }).catch(function () { ls.textContent = "Bitte den Text markieren und kopieren. " + hint; });
      else ls.textContent = "Bitte den Text markieren und kopieren. " + hint;
    });
    vb.appendChild(vlab); vb.appendChild(vin); vb.appendChild(cb); vb.appendChild(ta); vb.appendChild(ls); box.appendChild(vb);
  }
  var btn = document.createElement("button"); btn.type = "button"; btn.className = "nvk-btn"; btn.style.marginTop = "8px";
  btn.textContent = "Auswahl in den Warenkorb legen";
  var st = document.createElement("div"); st.className = "nvk-help";
  btn.addEventListener("click", function () { addToCart(items, st); });
  box.appendChild(btn); box.appendChild(st); outEl.appendChild(box);
}
function addToCart(items, st) {
  var list = items.slice();
  if (chosenRadio) list.unshift({ t: chosenRadio.type, sku: chosenRadio.sku });
  if (!list.length) { st.textContent = "Es ist noch nichts zum Bestellen ausgewählt."; return; }
  st.textContent = "Artikel werden an den Shop übergeben …";
  var ids = list.filter(function (x) { return x.aid; }).map(function (x) { return x.aid; });
  var get = ids.length ? fetch(API + "?aid=" + ids.join(",")).then(function (r) { return r.json(); }).then(function (j) { return j.skus || {}; }) : Promise.resolve({});
  get.then(function (map) {
    var skus = [];
    list.forEach(function (x) { var s = x.sku || map[x.aid]; if (s) skus.push(s); });
    if (!skus.length) throw new Error("none");
    return skus.reduce(function (p, s) {
      return p.then(function () { return fetch(CART_ADD + encodeURIComponent(s) + "/sQuantity/1", { mode: "no-cors", credentials: "include" }); });
    }, Promise.resolve()).then(function () { return skus.length; });
  }).then(function (n) {
    st.textContent = n + " von " + list.length + " Artikeln wurden an den Warenkorb übergeben. Bitte dort kontrollieren: ";
    st.appendChild(link(CART, "Zum Warenkorb →"));
  }).catch(function () { st.textContent = "Das hat leider nicht geklappt. Bitte nutze die Shop-Links oben."; });
}
function renderResult() {
function renderResult() {
   var s = derive(), st = onSet(s);
   var s = derive(), st = onSet(s);
Zeile 437: Zeile 547:
   outEl.appendChild(card({ t: "BMW Radios für " + veh.t, d: "Alle Radios, die für Deinen BMW " + veh.t + " im Shop erhältlich sind.",
   outEl.appendChild(card({ t: "BMW Radios für " + veh.t, d: "Alle Radios, die für Deinen BMW " + veh.t + " im Shop erhältlich sind.",
     u: ru, ut: "Zu den passenden Radios →", w: SHOP + "bmw-radios/", wt: "Alle BMW Radios" }, "rad"));
     u: ru, ut: "Zu den passenden Radios →", w: SHOP + "bmw-radios/", wt: "Alle BMW Radios" }, "rad"));
  renderRadioList(veh);
   var needs = [], hints = [], seen = {};
   var needs = [], hints = [], seen = {};
   RULES.forEach(function (r) {
   RULES.forEach(function (r) {
Zeile 474: Zeile 585:
   L.push("", "Radios: " + ru);
   L.push("", "Radios: " + ru);
   summary = L.join("\n");
   summary = L.join("\n");
  cartBlock(needs, opt);
}
}
function update() { renderFields(); renderOpts(); renderResult(); }
function update() { renderFields(); renderOpts(); renderResult(); }
Zeile 490: Zeile 602:
   if ($("nvk-hp").value) return;
   if ($("nvk-hp").value) return;
   var sz = $("nvk-size").value;
   var sz = $("nvk-size").value;
   var sum2 = summary + (sz ? "\n\nGewünschte Displaygröße: " + sz : "");
  var rad = chosenRadio ? "\n\nGEWÄHLTES RADIO\n- " + chosenRadio.type + "  " + chosenRadio.url : "";
   var sum2 = summary + rad + (sz ? "\n\nGewünschte Displaygröße: " + sz : "");
   var text = "Name: " + name + "\nE-Mail: " + mail + "\nVIN: " + (vin || "-") + "\n\nKommentar:\n" + msg + "\n\n" + sum2;
   var text = "Name: " + name + "\nE-Mail: " + mail + "\nVIN: " + (vin || "-") + "\n\nKommentar:\n" + msg + "\n\n" + sum2;
   if (SEND_URL) {
   if (SEND_URL) {
Zeile 506: Zeile 619:
   }
   }
});
});
$("nvk-reset").addEventListener("click", function () { sel = {}; picked = {}; update(); });
$("nvk-reset").addEventListener("click", function () { sel = {}; picked = {}; chosenRadio = null; update(); });
newCaptcha();
newCaptcha();
update();
update();
Zeile 512: Zeile 625:
</script>
</script>
</div>
</div>


</html>
</html>
<small>Stand: 21.10.2026</small><br>

Version vom 22. Oktober 2026, 06:26 Uhr

Mit diesem Tool kann auf Basis von Fahrzeug und vorhandenen Komponenten eine Liste nötiger Komponenten erstellt werden.
Zu den gewählten Komponenten werden Links in den I-BUS Shop gezeigt und abschließend kann mit der Auswahl eine Anfrage-Mail an das I-BUS App Team gesendet werden.

Zusatzoptionen

Stand: 21.10.2026