(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('adCheckout', adCheckout);

    adCheckout.$inject = ['$scope'];

    function adCheckout($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('adCheckout', adCheckout);

    adCheckout.$inject = [];

    function adCheckout() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'adCheckout',
            templateUrl: 'app/components/adCheckout/adCheckout.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('auctionDonationForm', auctionDonationForm);

    auctionDonationForm.$inject = ['$scope'];

    function auctionDonationForm($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('auctionDonationForm', auctionDonationForm);

    auctionDonationForm.$inject = [];

    function auctionDonationForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'auctionDonationForm',
            templateUrl: 'app/components/auctionDonationForm/auctionDonationForm.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('auctionRegistration', auctionRegistration);

    auctionRegistration.$inject = ['$scope'];

    function auctionRegistration($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('auctionRegistration', auctionRegistration);

    auctionRegistration.$inject = [];

    function auctionRegistration() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'auctionRegistration',
            templateUrl: 'app/components/auctionRegistration/auctionRegistration.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('auctionViewer', auctionViewer);

    auctionViewer.$inject = ['$scope'];

    function auctionViewer($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('auctionViewer', auctionViewer);

    auctionViewer.$inject = [];

    function auctionViewer() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'auctionViewer',
            templateUrl: 'app/components/auctionViewer/auctionViewer.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('beneficiaryApplication', beneficiaryApplication);

    beneficiaryApplication.$inject = ['$scope'];

    function beneficiaryApplication($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('beneficiaryApplication', beneficiaryApplication);

    beneficiaryApplication.$inject = [];

    function beneficiaryApplication() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'beneficiaryApplication',
            templateUrl: 'app/components/beneficiaryApplication/beneficiaryApplication.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('beneficiaryShowcase', beneficiaryShowcase);

    beneficiaryShowcase.$inject = ['$scope', 'webApi', 'FILE_STORE_URL'];

    function beneficiaryShowcase($scope, webApi, FILE_STORE_URL) {

        var year = location.query.year || $scope.context.currentYear;

        webApi.beneficiaryShowcase.get(year).then(function (data) {
            $scope.bannerImageUrl = FILE_STORE_URL + '/images/theme/' + data.year + '/banner.jpg';

            $scope.logoDirectory = FILE_STORE_URL + '/images/beneficiaries/' + data.year + '/';

            if (data.previous) {
                $scope.previousLogoDirectory = FILE_STORE_URL + '/images/beneficiaries/' + data.previous.year + '/';
            }

            $scope.showcase = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('beneficiaryShowcase', beneficiaryShowcase);

    beneficiaryShowcase.$inject = [];

    function beneficiaryShowcase() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'beneficiaryShowcase',
            templateUrl: 'app/components/beneficiaryShowcase/beneficiaryShowcase.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('calendar', calendar);

    calendar.$inject = ['$scope', 'webApi', 'modalWindow'];

    function calendar($scope, webApi, modalWindow) {
        $scope.events = [
            function(start, end, timezone, callback) {
                webApi.calendar.listAllGeneral({
                    from: start.format(),
                    to: end.format()
                }).then(callback);
            }
        ];

        $scope.calendar = {
            header: {
                right: 'prev,next'
            },
            eventClick: function (event) {
                var rsvpButton = event.rsvpable
                    ? '<div style="padding: 20px;"><a href="./RSVP" class="btn btn-block btn-lg btn-success">RSVP</a></div>'
                    : '';

                modalWindow.open({
                    title: event.title,
                    body:
                        '<div>' +
                            '<div class="modal-header">' +
                                '<span class="modal-title">' + event.title + '</span>' +
                            '</div>' +
                            '<div class="modal-body">' + event.description + '</div>' +
                            rsvpButton +
                        '</div>',
                    size: 'lg'
                });
            },
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('calendar', calendar);

    calendar.$inject = [];

    function calendar() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'calendar',
            templateUrl: 'app/components/calendar/calendar.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('carousel', Carousel);

    Carousel.$inject = ['$scope', 'webApi', '$timeout'];

    function Carousel($scope, webApi, $timeout) {
        $scope.isPortrait = window.innerWidth <= 767;

        if (!$scope.height) {
            $scope.height = "300px";
        }

        if (!$scope.interval) {
            $scope.interval = 3000;
        }

        webApi.carousel.get().then(function (data) {
            $scope.carousel = data;
            $scope.active = 0;

            //HACK for mobile
            $timeout(function () {
                $scope.height = "auto";
            }, 1000);
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('carousel', carousel);

    carousel.$inject = [];

    function carousel() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'carousel',
            templateUrl: 'app/components/carousel/carousel.html',
            scope: {
                interval: '@',
                height: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('contactForm', contactForm);

    contactForm.$inject = ['$scope', 'webApi'];

    function contactForm($scope, webApi) {
        $scope.sendMessage = function(message) {
            webApi.contactForms.send($scope.formId, message).then(function () {
                $scope.message = {};
                alert("Message sent");
            });
        }
    };


})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('contactForm', contactForm);

    contactForm.$inject = [];

    function contactForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'contactForm',
            templateUrl: 'app/components/contactForm/contactForm.html',
            scope: {
                formId: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('donationCheckout', donationCheckout);

    donationCheckout.$inject = ['$scope'];

    function donationCheckout($scope) {

        switch (+$scope.type) {
            case 1:
                $scope.formTitle = "General Donation";
                break;
            case 2:
                $scope.formTitle = "John Thomas Scholarship Donation";
                break;
        }

        $scope.legacyPath = 'Public/Donations.aspx?type=' + $scope.type;
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('donationCheckout', donationCheckout);

    donationCheckout.$inject = [];

    function donationCheckout() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'donationCheckout',
            templateUrl: 'app/components/donationCheckout/donationCheckout.html',
            scope: {
                type: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('guestCheckout', guestCheckout);

    guestCheckout.$inject = ['$scope'];

    function guestCheckout($scope) {
        $scope.inviteNumber = location.query.invite;
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('guestCheckout', guestCheckout);

    guestCheckout.$inject = [];

    function guestCheckout() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'guestCheckout',
            templateUrl: 'app/components/guestCheckout/guestCheckout.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('loginForm', loginForm);

    loginForm.$inject = ['$scope'];

    function loginForm($scope) {
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('loginForm', loginForm);

    loginForm.$inject = [];

    function loginForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'sponsorSignup',
            templateUrl: 'app/components/loginForm/loginForm.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('menu', menu);

    menu.$inject = ['$scope', 'webApi'];

    function menu($scope, webApi) {

        webApi.menus.get($scope.source).then(function(data) {
            $scope.items = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('menu', menu);

    menu.$inject = [];

    function menu() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'menu',
            templateUrl: 'app/components/menu/menu.html',
            scope: {
                source: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('newsfeed', newsfeed);

    newsfeed.$inject = ['$scope', 'webApi'];

    function newsfeed($scope, webApi) {
        webApi.newsfeed.get({count: 3}).then(function (data) {
            $scope.newsfeed = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('newsfeed', newsfeed);

    newsfeed.$inject = [];

    function newsfeed() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'newsfeed',
            templateUrl: 'app/components/newsFeed/newsfeed.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('pressRoom', pressRoom);

    pressRoom.$inject = ['$scope', 'webApi', 'modalWindow', 'SITE_URL'];

    function pressRoom($scope, webApi, modalWindow, SITE_URL) {
        webApi.pressRoom.listAll().then(function (data) {
            $scope.pressReleases = data;
        });

        $scope.downloadDirectory = SITE_URL + 'assets/press/';

        $scope.view = function (pressRelease) {
            webApi.pressRoom.get(pressRelease.id).then(function (data) {
                modalWindow.open({
                    title: data.title,
                    body:
                        '<div class="modal-header">' +
                            '<span class="modal-title">' + data.title + '</span>' +
                        '</div>' +
                        '<div class="modal-body">' + data.html + '</div>',
                    size: 'fs'
                });
            });
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('pressRoom', pressRoom);

    pressRoom.$inject = [];

    function pressRoom() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'pressRoom',
            templateUrl: 'app/components/pressRoom/pressRoom.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('raffleCheckout', raffleCheckout);

    raffleCheckout.$inject = ['$scope', 'FILE_STORE_URL'];

    function raffleCheckout($scope, FILE_STORE_URL) {
        $scope.bene = ($scope.bene || Object.keys(location.query)[0]);
        if ($scope.bene) {
            $scope.beneImagePath = FILE_STORE_URL + 'images/beneficiaries/' + $scope.context.currentYear + '/' + $scope.bene + '.png';
        }
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('raffleCheckout', raffleCheckout);

    raffleCheckout.$inject = [];

    function raffleCheckout() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'raffleCheckout',
            templateUrl: 'app/components/raffleCheckout/raffleCheckout.html',
            scope: {
                bene: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('raffleSchedule', raffleSchedule);

    raffleSchedule.$inject = ['$scope', 'webApi'];

    function raffleSchedule($scope, webApi) {
        webApi.raffleSchedule.get().then(function(data) {
            $scope.raffleSchedule = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('raffleSchedule', raffleSchedule);

    raffleSchedule.$inject = [];

    function raffleSchedule() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'raffleSchedule',
            templateUrl: 'app/components/raffleSchedule/raffleSchedule.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('rsvpForm', rsvpForm);

    rsvpForm.$inject = ['$scope', 'webApi'];

    function rsvpForm($scope, webApi) {
        webApi.events.rsvpable().then(function (data) {
            $scope.events = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('rsvpForm', rsvpForm);

    rsvpForm.$inject = [];

    function rsvpForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'rsvpForm',
            templateUrl: 'app/components/rsvpForm/rsvpForm.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('silentAuctionForm', silentAuctionForm);

    silentAuctionForm.$inject = ['$scope'];

    function silentAuctionForm($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('silentAuctionForm', silentAuctionForm);

    silentAuctionForm.$inject = [];

    function silentAuctionForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'silentAuctionForm',
            templateUrl: 'app/components/silentAuctionForm/silentAuctionForm.html'
        };
    };

})();
(function () {
    'use strict';

    angular
        .module('web.components')
        .controller('sponsorShowcase', sponsorShowcase);

    sponsorShowcase.$inject = ['$scope', 'webApi', 'FILE_STORE_URL'];

    function sponsorShowcase($scope, webApi, FILE_STORE_URL) {
        var year = location.query.year || $scope.context.currentYear;

        $scope.logoDirectory = FILE_STORE_URL + '/images/logos/';

        webApi.sponsorShowcase.get(year).then(function (data) {

            //TODO: This is a temporary hack that needs to be moved into API
            for (var i = 0; i < data.levels.length; i++) {
                var level = data.levels[i];

                switch (level.title) {
                    case 'Platnium':
                        level.title = 'Platinum';
                        break;
                    case 'Ruby':
                        level.listingSettings.columns = 1;
                        level.fontSize = '165%';
                        break;
                    default:
                        break;
                }
            }

            $scope.bannerImageUrl = FILE_STORE_URL + '/images/theme/' + data.year + '/banner.jpg';
            $scope.showcase = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('sponsorShowcase', sponsorShowcase);

    sponsorShowcase.$inject = [];

    function sponsorShowcase() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'sponsorShowcase',
            templateUrl: 'app/components/sponsorShowcase/sponsorShowcase.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('sponsorSignup', sponsorSignup);

    sponsorSignup.$inject = ['$scope'];

    function sponsorSignup($scope) {
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('sponsorSignup', sponsorSignup);

    sponsorSignup.$inject = [];

    function sponsorSignup() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'sponsorSignup',
            templateUrl: 'app/components/sponsorSignup/sponsorSignup.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('spotlight', spotlight);

    spotlight.$inject = ['$scope', 'webApi'];

    function spotlight($scope, webApi) {
        webApi.spotlight.get().then(function (data) {
            $scope.features = data;
        });
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('spotlight', spotlight);

    spotlight.$inject = [];

    function spotlight() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'spotlight',
            templateUrl: 'app/components/spotlight/spotlight.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('subscribeForm', subscribeForm);

    subscribeForm.$inject = ['$scope'];

    function subscribeForm($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('subscribeForm', subscribeForm);

    subscribeForm.$inject = [];

    function subscribeForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'subscribeForm',
            templateUrl: 'app/components/subscribeForm/subscribeForm.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('tableCaptainSignup', tableCaptainSignup);

    tableCaptainSignup.$inject = ['$scope'];

    function tableCaptainSignup($scope) {
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('tableCaptainSignup', tableCaptainSignup);

    tableCaptainSignup.$inject = [];

    function tableCaptainSignup() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'tableCaptainSignup',
            templateUrl: 'app/components/tableCaptainSignup/tableCaptainSignup.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('taxReceiptForm', taxReceiptForm);

    taxReceiptForm.$inject = ['$scope'];

    function taxReceiptForm($scope) {
        $scope.lookup = {
            year: location.query.year,
            ref: location.query.ref
        }
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('taxReceiptForm', taxReceiptForm);

    taxReceiptForm.$inject = [];

    function taxReceiptForm() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'taxReceiptForm',
            templateUrl: 'app/components/taxReceiptForm/taxReceiptForm.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('ticketsCheckout', ticketsCheckout);

    ticketsCheckout.$inject = ['$scope'];

    function ticketsCheckout($scope) {
        switch (+$scope.type) {
            case 1:
                $scope.formTitle = "Ticket Sales";
                break;
            case 2:
                $scope.formTitle = "VIP Ticket Sales";
                break;
        }

        $scope.legacyPath = 'Public/Tickets.aspx?type=' + $scope.type;
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('ticketsCheckout', ticketsCheckout);

    ticketsCheckout.$inject = [];

    function ticketsCheckout() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'ticketsCheckout',
            templateUrl: 'app/components/ticketsCheckout/ticketsCheckout.html',
            scope: {
                type: '@'
            }
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('ticketWaitingList', ticketWaitingList);

    ticketWaitingList.$inject = ['$scope'];

    function ticketWaitingList($scope) {
        
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('ticketWaitingList', ticketWaitingList);

    ticketWaitingList.$inject = [];

    function ticketWaitingList() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'ticketWaitingList',
            templateUrl: 'app/components/ticketWaitingList/ticketWaitingList.html'
        };
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .controller('volunteerSignup', volunteerSignup);

    volunteerSignup.$inject = ['$scope', 'webApi'];

    function volunteerSignup($scope, webApi) {
        $scope.sendMessage = function (signup) {
            webApi.volunteerSignup.send(signup).then(function () {
                $scope.message = {};
                alert("Message sent");
            });
        }
    };

})();
(function() {
    'use strict';

    angular
        .module('web.components')
        .directive('volunteerSignup', volunteerSignup);

    volunteerSignup.$inject = [];

    function volunteerSignup() {
        return {
            restrict: 'E',
            replace: true,
            controller: 'volunteerSignup',
            templateUrl: 'app/components/volunteerSignup/volunteerSignup.html'
        };
    };

})();
