text: /**
   * Created by thuyninh on 15-Sep-18.
   */
  
  
  function showTask(id)
  {
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  
      $.ajax({
          type: 'get',
          url: "/dev/tasks/"+id,
          success: function (data) {
              $('#task-detail-content').html(data);
              $('.summernote-editor').summernote({
                  height: 200,
                  toolbar: [
                      // [groupName, [list of button]]
                      ['heading', ['style']],
                      ['style', ['bold', 'italic', 'underline', 'clear']],
                      ['font', ['strikethrough', 'superscript', 'subscript']],
                      ['color', ['color']],
                      ['para', ['ul', 'ol', 'paragraph']],
                      ['insert', ['table','link', 'picture', 'video']],
                      ['misc', ['undo', 'redo']],
                      ['view', ['codeview']]
                  ],
  
                  callbacks: {
                      onImageUpload: function (image) {
                          uploadImage(image[0], "feedback");
                      },
                      onPaste: function (e) {
                          var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
                          e.preventDefault();
                          document.execCommand('insertText', false, bufferText);
                      }
                  }
              });
          }
  
      });
  }
  
  function editFeedback(id)
  {
      $('#editor-'+id).css('display', 'block');
      $('#editor-'+id).html($('#feedback-content-'+id).html());
      $('#editor-'+id).summernote({
          height: 200,
          toolbar: [
              // [groupName, [list of button]]
              ['heading', ['style']],
              ['style', ['bold', 'italic', 'underline', 'clear']],
              ['font', ['strikethrough', 'superscript', 'subscript']],
              ['color', ['color']],
              ['para', ['ul', 'ol', 'paragraph']],
              ['insert', ['table','link', 'picture', 'video']],
              ['misc', ['undo', 'redo']],
              ['view', ['codeview']]
          ],
  
          callbacks: {
              onImageUpload: function (image) {
                  uploadImage(image[0], "feedback");
              },
              onPaste: function (e) {
                  var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
                  e.preventDefault();
                  document.execCommand('insertText', false, bufferText);
              }
          }
      });
  
      $('#submit-'+id).css('display', 'inline-block');
  }
  
  function closeEditor(id) {
      $('#editor-'+id).summernote('destroy');
      $('#editor-'+id).css('display', 'none');
  
      $('#submit-'+id).css('display', 'none');
  }
  
  function submitEditor(id) {
      var newContent = $('#editor-'+id).summernote('code');
  
      closeEditor(id);
  
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  
      var data = {
          feedback: newContent
      };
  
      $.ajax({
          type: 'post',
          url: "/dev/feedback/"+id+"/update",
          data: data,
          success: function (e) {
              $('#feedback-content-'+id).html(newContent);
          },
          error: function (data) {
              console.log(data);
          }
  
      });
  }
  
  function deleteFeedback(id)
  {
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  
      $.ajax({
          type: 'post',
          url: "/dev/feedback/"+id+"/delete",
          success: function (e) {
              $('#feedback-'+id).remove();
          },
          error: function (data) {
              console.log(data);
          }
  
      });
  }
  
  function createFeedback(task_id) {
      var newContent = $('#new-feedback').summernote('code');
  
  
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  
      var data = {
          feedback: newContent,
          task_id: task_id
      };
  
      $.ajax({
          type: 'post',
          url: "/dev/feedback",
          data: data,
          success: function (e) {
              $('#comments-add').before(e);
          },
          error: function (data) {
              console.log(data);
          }
  
      });
  
      $('#new-feedback').summernote('reset');
  }
  
  
  