JSFiddle - React, Tailwind, and code Playground

by Ankit Patidar

JavaScript

(function() {
  'use strict';

  angular
    .module('support')
    .controller('tDetailsController', tDetailsController);

  /** @ngInject */
  function tDetailsController($log, $rootScope, $scope, $state, $filter, $window, $interval, $location, ngDialog, TicketSrv, TicketDetailSrv, SettingsSrv, FileModelUploadSrv) {
    $rootScope.search = {
      show: false,
      text: "",
      adv: false
    };
    $rootScope.selectedMenu = 1;

    $scope.beforeDate = moment(moment()._d).add('days', 1).format('MM-DD-YYYY');
    $scope.localState = localStorage.getItem("curState");
    $scope.curState = $state.current.name;
    $scope.syncToastShow = false;
    $scope.shouldFocus = true;
    $scope.replyOpen = false;
    $scope.fwdComment = "";
    $scope.hasErr = false;
    $scope.syncFlag = "s";
    $scope.errType = "";
    $scope.uFiles = [];
    $scope.sFiles = [];
    $scope.syncFx = function(caller) {
      $scope.oldThreadLength = $scope.cutThreads.length;
      if (caller == "s") {
        $scope.syncToastShow = false;
        $scope.syncFlag = "s";
        angular.forEach($scope.cutThreads, function(thd) {
          $scope.details.threads.push(thd);
        });
        TicketDetailSrv.readMsg($scope.decId).then(
          function(data) {
            console.warn(data);
          },
          function(err) {
            $log.error(err);
          }
        );
        setTimeout(function() {
          $location.hash($scope.details.threads[$scope.details.threads.length - 1].id);
        }, 5);
      } else {
        $scope.syncToastShow = false;
        $scope.syncFlag = "i";
      }
    }

    $scope.getDetailsFx = function(read, caller) {
      TicketDetailSrv.getDetails($scope.decId, read).then(
        function(data) {
          $scope.detailLoading = false;
          if (caller) {
            $scope.details = angular.copy(data);
          } else {
            $scope.threadsCopy = angular.copy($scope.details.threads);
            $scope.details =...