Просмотр исходного кода

Inline remove for note-template-pro

Vijayakrishnan Krishnan 4 лет назад
Родитель
Сommit
6bf9775887
1 измененных файлов с 27 добавлено и 6 удалено
  1. 27 6
      resources/views/admin/pros_SINGLE/SUB_note_templates.blade.php

+ 27 - 6
resources/views/admin/pros_SINGLE/SUB_note_templates.blade.php

@@ -19,15 +19,19 @@
                     <th>&nbsp;</th>
                     <th>NoteTemplate</th>
                     <th></th>
+                    <th></th>
                 </tr>
             </thead>
             <tbody class="sortable" data-url="/api/noteTemplatePro/sort">
                 @foreach($subRecords as $subRecord)
-                <tr data-uid="{{$subRecord->uid}}">
-                    <td><a href=""><i class="fas fa-share-square"></i></a></td>
-                    <td><?= value_from_rs($result_note_templates, 'title', [['id', '=', $subRecord->note_template_id],], 'all'); ?></td>
-                    <td><a href=""><i class="fa fa-bars"></i></a></td>
-                </tr>
+                    @if(!$subRecord->is_removed)
+                        <tr data-uid="{{$subRecord->uid}}">
+                            <td><a href=""><i class="fas fa-share-square"></i></a></td>
+                            <td><?= value_from_rs($result_note_templates, 'title', [['id', '=', $subRecord->note_template_id],], 'all'); ?></td>
+                            <td><a href=""><i class="fa fa-bars"></i></a></td>
+                            <td><a href="#" onclick="return deleteNoteTemplate('{{$subRecord->uid}}')" class="text-danger">Remove</a></td>
+                        </tr>
+                    @endif
                 @endforeach
             </tbody>
         </table>
@@ -35,4 +39,21 @@
 
 </div>
 
-@endsection
+<script>
+    function deleteNoteTemplate(_uid) {
+        if(confirm('Are you sure?')) {
+            $.post('/api/noteTemplatePro/remove', {
+                uid: _uid
+            }, function(_data) {
+                if(_data && _data.success) {
+                    window.location.reload();
+                }
+                else if(_data && _data.message) {
+                    toastr.error(_data.message)
+                }
+            }, 'json');
+        }
+    }
+</script>
+
+@endsection