"use strict";
appCore.controller("HeroAppreciationlListCtrl", ["$state", "$scope", "$http", "$timeout", "vServices", "$uibModal", "$document",
    function ($state, $scope, $http, $timeout, vServices, $uibModal, $document) {
	$scope.params = $state.params;
	console.log($scope.params.id);
      $scope.$root.page.title = "List of Appreciations";
      $scope.appreciations = [];
	 $scope.params.id=4;

      const init = function () {
       // vServices.callApi("clientappreciations/heroapp_data", "GET", {}).then(function (res) {
		vServices.callApi("clientappreciations/heroapp_data/" + $scope.$root.gUser.id, "GET", {}).then((res) => {
          if (res && res.length > 0) {
            $scope.appreciations = res;
            $scope.$root.callDataTable("#heroappList");
          }
        });
      };
	  
      init();
	  $scope.viewImgModel = (obj) => {
        let modalInstance = $uibModal.open({
          animation: true,
          ariaLabelledBy: "modal-title",
          ariaDescribedBy: "modal-body",
          templateUrl: "Viewimg.html",
          controller: "UpdateCacCtrl",
          controllerAs: "$scope",
          size: "lg",//sm md lg
          backdrop: "static",
          resolve: {
            data: () => {
              return {
                appreciation: obj
              };
            }
          }
        });
      };
    }
  ])

 .controller("UpdateCacCtrl", function ($uibModalInstance, data, $scope) {
    $scope.appreciation = data;
	
	//console.log($scope.appreciation);
    $scope.ok = () => $uibModalInstance.close($scope.appreciation);
    $scope.cancel = () => $uibModalInstance.dismiss("cancel");
  });