Conflict Resolution Assistant

Conflict Resolution Assistant

Generated Resolution Plan

The generated plan will appear below. You can click the text to make edits before downloading.

Your plan will appear here. Go to the "Define Conflict" tab to get started.

Sorry, an error occurred. Please try again.

`; } finally { showLoading(false); } }; const callGenerativeAPI = async (prompt, data) => { // --- SIMULATED API CALL --- return new Promise(resolve => { setTimeout(() => { const partiesList = data.parties.split(',').map(p => `
  • ${escapeHTML(p.trim())}: [AI-generated summary of their perspective based on input]
  • `).join(''); const solutionsList = data.solutions.split(',').map(s => `
  • ${escapeHTML(s.trim())}
  • `).join(''); const simulatedResponse = `

    Conflict Summary

    A disagreement has arisen between ${escapeHTML(data.parties)} regarding ${escapeHTML(data.problem.toLowerCase())}. The core issue appears to stem from differing expectations and communication gaps.

    Key Perspectives

      ${partiesList || '
    • No specific parties listed.
    • '}

    Proposed Solutions

      ${solutionsList || '
    • No initial solutions provided.
    • '}
    • Conduct a facilitated mediation session.
    • Establish clearer communication protocols.

    Recommended Action Steps

    1. Schedule a Meeting: All involved parties should meet within the next 48 hours to discuss this plan.
    2. Acknowledge Perspectives: Begin the meeting by allowing each party to state their perspective without interruption.
    3. Identify Common Ground: Work together to find areas of agreement and shared goals.
    4. Select a Solution: Collaboratively decide on one or more of the proposed solutions to implement.
    5. Define Next Steps: Assign clear, actionable tasks with deadlines and owners to implement the chosen solution.
    6. Follow-Up: Schedule a follow-up meeting in one week to review progress and make adjustments.
    `; resolve(simulatedResponse); }, 2000); }); }; const downloadPDF = async () => { const { jsPDF } = window.jspdf; const content = elements.resolutionPlanOutput; if (!content.innerHTML || content.textContent.includes('Your plan will appear here')) return; elements.pdfContent.innerHTML = `
    ${content.innerHTML}
    `; elements.pdfContent.classList.remove('hidden'); try { const canvas = await html2canvas(elements.pdfContent, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF('p', 'pt', 'a4'); const imgProps = pdf.getImageProperties(imgData); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('conflict-resolution-plan.pdf'); } catch (error) { console.error("PDF Error:", error); } finally { elements.pdfContent.classList.add('hidden'); } }; const escapeHTML = (str) => str.replace(/[&<>'"]/g, tag => ({'&': '&','<': '<','>': '>',"'": ''','"': '"'}[tag])); // --- EVENT HANDLERS --- elements.tabButtons.dashboard.addEventListener('click', () => switchTab('dashboard')); elements.tabButtons.input.addEventListener('click', () => switchTab('input')); elements.prevBtn.addEventListener('click', () => { const i = TABS.indexOf(activeTab); if (i > 0) switchTab(TABS[i - 1]); }); elements.nextBtn.addEventListener('click', () => { const i = TABS.indexOf(activeTab); if (i < TABS.length - 1) switchTab(TABS[i + 1]); }); elements.conflictForm.addEventListener('submit', handleGeneratePlan); elements.downloadPdfBtn.addEventListener('click', downloadPDF); // Save data on input change ['conflict-problem', 'conflict-parties', 'conflict-perspectives', 'conflict-solutions'].forEach(id => { document.getElementById(id).addEventListener('input', saveData); }); // --- INITIALIZATION --- loadData(); switchTab('dashboard'); });
    Scroll to Top