﻿"use strict";

foraAsaApp.controller("ErrorController",
    function ($scope, $location, $routeParams, $window, checkoutService, configService, shoppingCartService) {

        $scope.errMsg = "";

        $scope.init = function () {

            var now = new Date();
            $scope.errorMsg = configService.checkoutErrorMsg;
            $scope.errorMsg += "<p><small>" + now.toLocaleDateString("da-DK") + " " + now.toLocaleTimeString("da-DK") + "</small></p>";

            shoppingCartService.EmptyCart()
                .then(function () {
                    $rootScope.$broadcast('refreshShoppingCart');
                },
                    function (data) {
                        console.error("Call to ShoppingCartService failed: " + JSON.stringify(data));
                    }
                );
        }
    })
