|
@@ -647,7 +647,7 @@
|
|
|
<div class="d-flex pr-1 align-items-center note-widget-item c-pointer"
|
|
|
:title="section.title + ' - Click to add'"
|
|
|
v-if="!section.used"
|
|
|
- v-on:click.prevent="add(section.uid)">
|
|
|
+ v-on:click.prevent="add(section.uid, section.internal_name)">
|
|
|
<span class="mx-2">
|
|
|
<a class="font-12" href="#">
|
|
|
<i class="fa fa-plus-circle"></i>
|
|
@@ -672,24 +672,26 @@
|
|
|
sections: allSections
|
|
|
},
|
|
|
methods: {
|
|
|
- add: function(_uid) {
|
|
|
- $.post('/api/section/create', {
|
|
|
- noteUid: '{{$note->uid}}',
|
|
|
- summaryHtml: '',
|
|
|
- contentData: '',
|
|
|
- sectionTemplateUid: _uid,
|
|
|
- }, function(_data) {
|
|
|
- if(_data) {
|
|
|
- if(_data.success) {
|
|
|
- fastReload();
|
|
|
+ add: function(_uid, _section) {
|
|
|
+ $.get('/get-default-section-data/' + _section + '/{{$patient->uid}}' , function(_data) {
|
|
|
+ $.post('/api/section/create', {
|
|
|
+ noteUid: '{{$note->uid}}',
|
|
|
+ summaryHtml: _data.summary,
|
|
|
+ contentData: JSON.stringify({value: _data.value}),
|
|
|
+ sectionTemplateUid: _uid,
|
|
|
+ }, function(_data) {
|
|
|
+ if(_data) {
|
|
|
+ if(_data.success) {
|
|
|
+ fastReload();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.error(_data.message);
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- toastr.error(_data.message);
|
|
|
+ toastr.error('Unable to add section!');
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- toastr.error('Unable to add section!');
|
|
|
- }
|
|
|
+ }, 'json');
|
|
|
}, 'json');
|
|
|
},
|
|
|
remove: function(_uid) {
|