TurizmOS

Sistem Girişi

// --- ARAÇ TASARIM MOTORU --- let designerState = { rows: 14, cols: 5, matrix: [] }; function openVehicleDesigner() { document.getElementById('design-name').value = ""; // Boş bir 14x5 matris oluştur designerState.matrix = Array(14).fill().map(() => Array(5).fill(0)); renderDesignerGrid(); openModal('modal-designer'); } function renderDesignerGrid() { const container = document.getElementById('designer-grid'); container.style.display = 'grid'; container.style.gridTemplateColumns = `repeat(${designerState.cols}, 1fr)`; container.style.gap = '8px'; container.innerHTML = ''; let seatCounter = 0; designerState.matrix.forEach((row, rIdx) => { row.forEach((cell, cIdx) => { const div = document.createElement('div'); div.className = "w-10 h-10 rounded-lg flex items-center justify-center font-bold text-[10px] transition-all cursor-pointer"; // Hücre tipleri: 0:Boş, 1:Koltuk, 2:Şoför, 3:Kapı if (cell === 0) div.className += " bg-slate-50 border-2 border-dashed border-slate-200 text-slate-200"; if (cell === 1) { seatCounter++; div.className += " bg-indigo-500 text-white shadow-md"; div.innerText = seatCounter; } if (cell === 2) div.className += " bg-slate-800 text-white"; if (cell === 3) div.className += " bg-red-400 text-white"; div.onclick = () => { designerState.matrix[rIdx][cIdx] = (designerState.matrix[rIdx][cIdx] + 1) % 4; renderDesignerGrid(); }; container.appendChild(div); }); }); } async function saveVehicleDesign() { const name = document.getElementById('design-name').value; if(!name) return showToast("Lütfen bir isim verin!", "error"); let capacity = 0; designerState.matrix.forEach(row => row.forEach(cell => { if(cell === 1) capacity++; })); data.vehicleLayouts.push({ id: Date.now(), name: name, capacity: capacity, cols: designerState.cols, rows: designerState.rows, matrix: designerState.matrix }); await saveData(); closeModal('modal-designer'); renderVehicleSettings(); showToast("Araç şablonu başarıyla oluşturuldu."); } // --- CRM / MÜŞTERİ TAKİP --- function renderCRM() { const list = document.getElementById('crm-lead-list'); list.innerHTML = ''; data.leads.sort((a,b) => b.id - a.id).forEach(l => { list.innerHTML += `
${l.name}
${l.status}
${l.phone}
`; }); } function selectLead(id) { const l = data.leads.find(x => x.id == id); if(!l) return; const content = document.getElementById('crm-detail-content'); document.getElementById('crm-empty-state').classList.add('hidden'); content.classList.remove('hidden'); content.innerHTML = `

${l.name}

${l.phone}

${renderTimeline(l.timeline)}
`; } function renderTimeline(timeline = []) { return timeline.map(t => `
${new Date(t.date).toLocaleString()}
${t.content}
`).join(''); }