Ver Fonte

Add exam and hpi sections

Vijayakrishnan Krishnan há 4 anos atrás
pai
commit
9ca659844d

+ 39 - 0
storage/sections/exam/form.blade.php

@@ -0,0 +1,39 @@
+<?php
+$contentData = false;
+if($section){
+    $contentData = json_decode($section->content_data, true);
+}
+if(!$contentData || !isset($contentData['value'])) {
+    $contentData = [
+        'value'=>''
+    ];
+}
+$formID = rand(0, 100000);
+?>
+<form method="POST" action="/process_form_submit" onsubmit="return submitForm_NoteSection_{{ $formID }}(this);">
+    <?php if($section): ?>
+        <input type="hidden" name="section_uid" value="<?= $section->uid?>">
+    <?php else: ?>
+        <input type="hidden" name="note_uid" value="<?= $note->uid?>">
+        <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
+    <?php endif; ?>
+    <div class="form-group mb-2">
+        <textarea rte type="text" class="form-control form-control-sm p-2" name="value" placeholder="Value"><?= $contentData['value'] ?></textarea>
+    </div>
+    <div class="form-group m-0 d-flex">
+        <button class="btn btn-sm btn-primary mr-2">Submit</button>
+        <button class="btn btn-sm btn-default border" onclick="return cancelForm_NoteSection_{{ $formID }}(this)">Cancel</button>
+    </div>
+</form>
+<script>
+    function submitForm_NoteSection_{{ $formID }}(_form) {
+        $.post(_form.action, $(_form).serialize(), function(_data) {
+            fastReload();
+        });
+        return false;
+    }
+    function cancelForm_NoteSection_{{ $formID }}(_trigger) {
+        $(_trigger).closest('.note-section').toggleClass('edit');
+        return false;
+    }
+</script>

+ 4 - 0
storage/sections/exam/processor.php

@@ -0,0 +1,4 @@
+<?php
+$newContentData = [
+    'value' => $request->get('value')
+];

+ 1 - 0
storage/sections/exam/summary.php

@@ -0,0 +1 @@
+<div><?= $newContentData['value']; ?></div>

+ 39 - 0
storage/sections/hpi/form.blade.php

@@ -0,0 +1,39 @@
+<?php
+$contentData = false;
+if($section){
+    $contentData = json_decode($section->content_data, true);
+}
+if(!$contentData || !isset($contentData['value'])) {
+    $contentData = [
+        'value'=>''
+    ];
+}
+$formID = rand(0, 100000);
+?>
+<form method="POST" action="/process_form_submit" onsubmit="return submitForm_NoteSection_{{ $formID }}(this);">
+    <?php if($section): ?>
+        <input type="hidden" name="section_uid" value="<?= $section->uid?>">
+    <?php else: ?>
+        <input type="hidden" name="note_uid" value="<?= $note->uid?>">
+        <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
+    <?php endif; ?>
+    <div class="form-group mb-2">
+        <textarea rte type="text" class="form-control form-control-sm p-2" name="value" placeholder="Value"><?= $contentData['value'] ?></textarea>
+    </div>
+    <div class="form-group m-0 d-flex">
+        <button class="btn btn-sm btn-primary mr-2">Submit</button>
+        <button class="btn btn-sm btn-default border" onclick="return cancelForm_NoteSection_{{ $formID }}(this)">Cancel</button>
+    </div>
+</form>
+<script>
+    function submitForm_NoteSection_{{ $formID }}(_form) {
+        $.post(_form.action, $(_form).serialize(), function(_data) {
+            fastReload();
+        });
+        return false;
+    }
+    function cancelForm_NoteSection_{{ $formID }}(_trigger) {
+        $(_trigger).closest('.note-section').toggleClass('edit');
+        return false;
+    }
+</script>

+ 4 - 0
storage/sections/hpi/processor.php

@@ -0,0 +1,4 @@
+<?php
+$newContentData = [
+    'value' => $request->get('value')
+];

+ 1 - 0
storage/sections/hpi/summary.php

@@ -0,0 +1 @@
+<div><?= $newContentData['value']; ?></div>