12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- $contentData = false;
- if($section){
- $contentData = json_decode($section->content_data, true);
- }
- if(!$contentData) {
- $contentData = [];
- }
- $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; ?>
- <!-- __GENERATED_MARKUP__ -->
- <div class="form-group m-0 d-flex">
- <button class="btn btn-sm btn-primary mr-2">Done</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) {
- showMask();
- $.post(_form.action, $(_form).serialize(), function(_data) {
- fastReload();
- });
- return false;
- }
- function cancelForm_NoteSection_{{ $formID }}(_trigger) {
- $(_trigger).closest('.note-section').toggleClass('edit');
- return false;
- }
- function onGemVChange_{{ $formID }}(_field) {
- let name = _field.name, span = $('span[field="' + _field.name + '"]');
- if(span.length) {
- span.text(_field.value);
- }
- else {
- name = _field.name.replace('[]', '');
- span = $('span[field="' + name + '"]');
- if(span.length) {
- let value = [];
- $('[name="' + _field.name + '"]').each(function() {
- if(this.checked) value.push(this.value);
- });
- span.text(value.join(', '));
- }
- }
- // submit here
- let form = $(_field).closest('form');
- $.post(form[0].action, form.serialize(), function(_data) {
- console.log('Submitted!');
- });
- }
- </script>
|