"use strict";
appCore.controller("NewsLetterArchiveViewCtrl", ["$state", "$scope", "$http", "$timeout", "vServices", function ($state, $scope, $http, $timeout, vServices) {
    $scope.param = $state.params;
    $scope.createButton = {
        heading: "View Newsletter Archive",
        text: "View Newsletter Archive",
        icon: "fa-edit"
    };
    $scope.$root.page.title = "View Newsletter Archive";
    $scope.newsletter = [];
    // $scope.save = () => {
    //     vServices.callApi("newsletter/edit_newsletter", "PUT", $scope.newsletter).then(function (res) {
    //         if (res) {
    //             toastr.success(res, "Success!", {timeOut: 5000});
    //             $scope.$root.updateMenu();
    //             $state.go("newsLetterList", {}, {reload: true});
    //         }
    //     });
    // };
    const init = function () {
        if ($scope.param && typeof $scope.param.newsletterid !== "undefined") {
            vServices.callApi("newsletter/newsletter_single/" + $scope.param.newsletterid, "GET", {}).then((obj) => {
                if (obj) {                             
                  //  obj.status = obj.status ? 'true' : 'false';
                    $scope.newsletter = obj;
                }
            });
        }
    };
    init();
}]);
