Using ChatGPT To WYSIWYG HTML Editor

Used chatgpt to edit the code files of open emr abd add WYSIWYG HTML Editor.
So far so good.
Just the save submit button link is not working. Maybe @Param_CapMinds or any developer can help fix this, we can make some good changes to Open EMR. :slight_smile:


below is the report.php file which chatgpt edited from clinical_notes.


<?php

// Include CKEditor JavaScript and CSS files

?>

<script src="https://cdn.ckeditor.com/4.16.2/standard/ckeditor.js"></script>

<link rel="stylesheet" href="https://cdn.ckeditor.com/4.16.2/standard/ckeditor.css">

<?php

// Display a textarea element for the narrative field

?>

<form method="post" action=""> <!-- Assuming save_notes.php is the file handling the save operation -->

    <textarea name="narrative" id="narrative"></textarea>

    <button type="submit">Save Note</button>

</form>

<?php

// Initialize CKEditor on the textarea element

?>

<script>

    CKEDITOR.replace('narrative');

</script>

<?php

use OpenEMR\Services\ClinicalNotesService;

require_once(__DIR__ . "/../../globals.php");

require_once($GLOBALS["srcdir"] . "/api.inc.php");

function clinical_notes_report($pid, $encounter, $cols, $id) {

    $count = 0;

    $clinicalNotesService = new ClinicalNotesService();

    $records = $clinicalNotesService->getClinicalNotesForPatientForm($id, $pid, $encounter) ?? [];

    $data = array_filter($records, function ($val) {

        return $val['activity'] == ClinicalNotesService::ACTIVITY_ACTIVE;

    });

    if (!empty($data)) { // Check if $data is not empty before proceeding

        ?>

        <table class="table w-100">

            <thead>

            <tr>

                <th class="border p-1"><?php echo xlt('Date / Note Type'); ?></th>

                <th class="border p-1"><?php echo xlt('Narrative'); ?></th>

                <th class="border p-1"><?php echo xlt('Author / Code'); ?></th>

                <th class="border p-1"><?php echo xlt('Note Category'); ?></th>

            </tr>

            </thead>

            <tbody>

            <?php

            foreach ($data as $key => $value) {

                if(isset($value['description']) && $value['description'] != ''){

                    $value['description'] = str_replace("\n", "<br>", $value['description']);

                }

                ?>

                <tr>

                    <td class="border p-1"><span class='text'><?php echo text($value['date']) . ' / ' . text($value['codetext']); ?></span></td>

                    <td class="border p-1"><span class='text'><?php echo $value['description']; ?></span></td>

                    <td class="border p-1"><span class='text'><?php echo text($value['user']) . ' / ' . text($value['code']); ?></span></td>

                    <td class="border p-1"><span class='text text-wrap'><?php echo text($value['category_title']); ?></span></td>

                </tr>

            <?php

            }

            ?>

            </tbody>

        </table>

    <?php

    }

}

?>
1 Like