Test TM

Test

2025-07-22 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Test TM
// @namespace    http://tampermonkey.net/
// @version      1.0.4
// @description  Test
// @match        *://*/*
// @grant        none

// ==/UserScript==

(function() {
    'use strict';
window.addEventListener('load', function() {




function getClientNumber() {
    console.log('window.parent.parent.frames.length:', window.parent.parent.frames.length);

        // Pak de derde frame (index 2) uit het frameset
        const mainframe = window.parent.parent.frames[2]; // of window.frames['mainframe']

        if (!mainframe) {
            console.error('Mainframe (derde frame) niet gevonden');
            return null;
        }

        // Pak het document uit de frame
        const frameDoc = mainframe.document;

        if (!frameDoc) {
            console.error('Kan niet bij frame document');
            return null;
        }

        console.log('Frame document gevonden');
        const container = frameDoc.getElementById('tab_contents3');
        console.log(container);

    if (!container) return null;

    // Zoek de tweede <tr> binnen de container
    const rows = container.querySelectorAll('table tbody tr');
    if (rows.length >= 2) {
        const secondRow = rows[1];
        const lastCell = secondRow.lastElementChild;

        if (lastCell) {
            const text = (lastCell.textContent || lastCell.innerText).trim();
            const numberMatch = text.match(/\d+/);
            if (numberMatch) {
                return numberMatch[0];
            }
        }
    }

    return null;
}

    const clientNumber = getClientNumber();

    if (clientNumber === null){
        console.log("kan clientnummer niet vinden");
    } else {
        console.log("haal data op")

        fetch("https://whisper.anzwerz.ai/api/get_treatment_data/", {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'X-API-Key': 'mijn-geheime-sleutel'
            },
            body: JSON.stringify({ patientnummer: String(clientNumber) })
        })
        .then(response => response.json())
        .then(data => {
            console.log('Snowflake resultaat:', data);
            const subjectief = data.response.subjectief;
            const objectief = data.response.objectief;
            const evaluatie = data.response.evaluatie;
            const plan = data.response.plan;
            const opmerkingen = data.response.opmerkingen;
            const afwijking = data.response.afwijking;

            console.log(evaluatie);


            const subjectiefeEl = document.getElementById('Subjectief');

            if (subjectiefeEl && subjectiefeEl.innerHTML == '' ){

                if (subjectiefeEl && subjectief) {
                    subjectiefeEl.innerHTML = subjectief;
                }


                const objectiefeEl = document.getElementById('Objectief');
                if (objectiefeEl && objectief) {
                    objectiefeEl.innerHTML = objectief;
                }

                const evaluatieEl = document.getElementById('Evaluatie');
                if (evaluatieEl && evaluatie) {
                    evaluatieEl.innerHTML = evaluatie;
                }

                const planEl = document.getElementById('PlanVanAanpak');
                if (planEl && plan) {
                    planEl.innerHTML = plan;
                }

                const opmerkingenEl = document.getElementById('Opmerkingen');
                if (opmerkingenEl && opmerkingen) {
                    opmerkingenEl.innerHTML = opmerkingen;
                }

                if (afwijking && afwijking !== ''){
                    const afwijkingEl = document.getElementById('afwijking');
                    afwijkingEl.checked = true;

                    const afwijkingomsEl = document.getElementById('afwijkingoms');
                    if (afwijkingomsEl && afwijking) {
                        afwijkingomsEl.value = afwijking;
                    }
                }
            }

        });

    }

}, false);
})();