|
@@ -136,28 +136,6 @@
|
|
|
</div>
|
|
|
@endif
|
|
|
</div>
|
|
|
- <div class="d-flex">
|
|
|
- <div moe>
|
|
|
- <a href="" show start class="font-weight-bold">Add Section</a>
|
|
|
- <form url="/api/section/create">
|
|
|
- <input type="hidden" name="noteUid" value="{{$note->uid}}">
|
|
|
- <input type="hidden" name="summaryHtml" value="">
|
|
|
- <input type="hidden" name="contentData" value="">
|
|
|
- <div class="mb-2">
|
|
|
- <select name="sectionTemplateUid" class="form-control form-control-sm">
|
|
|
- <option value="">-- Select Section --</option>
|
|
|
- @foreach ($sections as $section)
|
|
|
- <option value="{{$section->uid}}">{{$section->title}}</option>
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="mb-0">
|
|
|
- <button class="btn btn-primary btn-sm" submit>Submit</button>
|
|
|
- <button class="btn btn-default border btn-sm" cancel>Cancel</button>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
<div class="ml-auto d-flex align-items-start">
|
|
|
<div class="pr-2">
|
|
@@ -473,3 +451,89 @@
|
|
|
})();
|
|
|
</script>
|
|
|
@endsection
|
|
|
+
|
|
|
+@section('left-nav-content')
|
|
|
+ <div class="left-nav-content" id="note-sections-app">
|
|
|
+ <div class="note-widget-title px-2 py-1">Note Sections</div>
|
|
|
+ <input type="text" class="d-block w-100 border-0 outline-0 px-2 py-1"
|
|
|
+ v-model="q" placeholder="Filter">
|
|
|
+ <div class="border-top py-1">
|
|
|
+ <div v-for="section in sections"
|
|
|
+ v-show="section.title.toLowerCase().indexOf(q.toLowerCase()) !== -1">
|
|
|
+ <div class="d-flex pr-1 align-items-center note-widget-item">
|
|
|
+ <span class="mx-2" v-show="section.used">
|
|
|
+ <a class="font-12 text-secondary" href="#"
|
|
|
+ v-on:click.prevent="remove(section.section_uid)">
|
|
|
+ <i class="fa fa-minus-circle"></i>
|
|
|
+ </a>
|
|
|
+ </span>
|
|
|
+ <span class="mx-2" v-show="!section.used">
|
|
|
+ <a class="font-12" href="#"
|
|
|
+ v-on:click.prevent="add(section.uid)">
|
|
|
+ <i class="fa fa-plus-circle"></i>
|
|
|
+ </a>
|
|
|
+ </span>
|
|
|
+ <span class="font-smaller text-ellipsis c-pointer" :title="section.title">
|
|
|
+ @{{section.title}}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ (function() {
|
|
|
+ function initSectionsWidget() {
|
|
|
+ var allSections = <?= json_encode($allSections) ?>;
|
|
|
+ new Vue({
|
|
|
+ el: '#note-sections-app',
|
|
|
+ delimiters: ['@{{', '}}'],
|
|
|
+ data: {
|
|
|
+ q: '',
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.error(_data.message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.error('Unable to add section!');
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ },
|
|
|
+ remove: function(_uid) {
|
|
|
+ $.post('/api/section/deactivate', {
|
|
|
+ uid: _uid,
|
|
|
+ memo: 'Deactivated from note',
|
|
|
+ }, function(_data) {
|
|
|
+ if(_data) {
|
|
|
+ if(_data.success) {
|
|
|
+ fastReload();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.error(_data.message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.error('Unable to remove section!');
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ addMCInitializer('sections-widget', initSectionsWidget);
|
|
|
+ })();
|
|
|
+ </script>
|
|
|
+@endsection
|