<?php
//
include "application/src/FooterLanguage.php";
$footer_text = new FooterLanguage();
$error_msg = $footer_text->getErrorMessages();
$success_msg = $footer_text->getSuccessMessages();
$info_msg = $footer_text ->getInfoMessages();
$warning_msg = $footer_text ->getWarningMessages();

$footer_msg = $footer_text -> getFooterMsg();
?>
<footer class="page-footer indigo ">

        <div class="row">
            <div class="col l8 s12">
                <h5 class="white-text">JudoCup</h5>
                <p class="grey-text text-lighten-4"><?php echo $footer_msg['footer_school']?></p>
            </div>
            <div class="col l4 s12 ">
                <h5 class="white-text"><?php echo $footer_msg['footer_contact']?></h5>
                <ul>
                    <li><a href="mailto:judocupapp@gmail.com" class="white-text"><i class="material-icons left">email</i>judocupapp@gmail.com (Pablo García Sanz)</a></li>

                </ul>
            </div>
            <div class="fixed-action-btn">

                <a class="btn-floating btn-large grey ">
                    <i class="material-icons">language</i>
                </a>
                <ul>

                    <li><a href="<?php echo base_url() ?>language?url=<?php echo current_url(); ?>&language=spanish&query_s= <?php  echo $_SERVER['QUERY_STRING']?>"
                           class="btn-floating indigo lighten-4 ">ES</a></li>
                    <li><a href="<?php echo base_url() ?>language?url=<?php echo current_url(); ?>&language=english&query_s= <?php  echo $_SERVER['QUERY_STRING']?>"
                           class="btn-floating indigo lighten-4 ">EN</a></li>

                </ul>
            </div>
        </div>

    <div class="footer-copyright">
        <div class="container">
            © 2018 Copyright JudoCup

        </div>
    </div>


</footer>


<!-- Scripts JavaScript-->

<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/materialize.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/custom.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/material.datepicker.js"></script>
<!--<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"></script>-->
<!--<script type="text/javascript" src="--><?php //echo base_url(); ?><!--assets/js/jquery.ui.touch-punch.js"></script>-->

<script>
//    if( $('#editableCheck').prop('checked')) {
//        alert('Hola');
//    }
</script>
<script>

    $('#goto_competition').on('click touchstart', e => {
       console.log('Goto competition');
       window.location='<?php echo base_url()?>competition';
    });
    $('#goto_teams').on('click touchstart', e => {
        console.log('Goto competition');
    window.location='<?php echo base_url()?>team';
    });
    $('#goto_referees').on('click touchstart', e => {
        console.log('Goto competition');
    window.location='<?php echo base_url()?>referee';
    });
    $('#goto_competitors').on('click touchstart', e => {
        console.log('Goto competition');
    window.location='<?php echo base_url()?>competitor';
    });
    $('#goto_timekeeper').on('click touchstart', e => {
        console.log('Goto competition');
    window.location='<?php echo base_url()?>timekeeper';
    });
</script>
<script>
    function touchHandler(event) {
        var touch = event.changedTouches[0];

        var simulatedEvent = document.createEvent("MouseEvent");
        simulatedEvent.initMouseEvent({
                touchstart: "mousedown",
                touchmove: "mousemove",
                touchend: "mouseup"
            }[event.type], true, true, window, 1,
            touch.screenX, touch.screenY,
            touch.clientX, touch.clientY, false,
            false, false, false, 0, null);

        touch.target.dispatchEvent(simulatedEvent);
        event.preventDefault();
    }
    $(document).ready(function () {

        // Mostrar navegacion lateral -> responsive
        $(".button-collapse").sideNav({
            ///edge: 'right'
        });
        $('select').material_select();
        // $("select[required]").css({display: "inline", height: 0, padding: 0, width: 0}); UTILLLLLLLL MIRARLO
        $(".dropdown-button").dropdown({hover: true, constrainWidth: false});

        $('.modal').modal();
        $('.tooltipped').tooltip({delay: 50});
        $('#fecha').pickadate({
            format: 'yyyy-mm-dd'
        });
        $('#fecha_fin').pickadate({
            format: 'yyyy-mm-dd'
        });
        $('#fecha_inicio').pickadate({
            format: 'yyyy-mm-dd'
        });

        $(document).ready(function () {
            $('.carousel').carousel();
            $('.carousel.carousel-slider').carousel({fullWidth: true});
        });
        function init() {
            document.addEventListener("touchstart", touchHandler, true);
            document.addEventListener("touchmove", touchHandler, true);
            document.addEventListener("touchend", touchHandler, true);
            document.addEventListener("touchcancel", touchHandler, true);
        }
    });
</script>
<script>

    $(document).ready(function () {

        const COLOR_ERROR = 'red lighten-1';
        const COLOR_OK = 'teal lighten-1';
        const COLOR_WARNING = 'amber lighten-1';
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_ENTER_EMAIL_OR_PASSWORD) {?>

        Materialize.toast("<?php echo $error_msg['footer_toast_error_mail']?>", 5000, COLOR_ERROR);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == RECOVERY_PASSWORD_SENT) { ?>
        Materialize.toast('<?php echo $info_msg['footer_toast_recovery_password_sent'];?>', 7000, COLOR_OK);

        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESFULL_CHANGE_PASSWORD) { ?>

        Materialize.toast("<?php echo $success_msg['footer_toast_success_change_password']?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_TEAM_EXISTS) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_team_exists']?>", 5000, COLOR_ERROR);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_CREATE_TEAM) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_create_team']?>", 5000, COLOR_OK);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_TEAM) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_team']?>", 5000, COLOR_OK);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_DELETE_TEAM) { ?>
        Materialize.toast(<?php echo $error_msg['footer_toast_error_delete_team']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_UPDATE_TEAM) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_update_team']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_UPDATE_TEAM) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_update_team']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_DNI_EXISTS) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_dni_exists']?>I", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_CREATE_REFEREE) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_create_referee']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_CREATE_REFEREE) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_create_referee']?>", 5000, COLOR_OK);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_DELETE_REFEREE) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_delete_referee']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_REFEREE) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_referee']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_UPDATE_REFEREE) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_update_referee']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_UPDATE_REFEREE) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_update_referee']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_OLD_PASSWORD) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_old_password']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_CREATE_COMPETITION) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_create_competition']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_CREATE_COMPETITION) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_create_competition']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_COMPETITION) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_competition']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_DELETE_COMPETITION) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_delete_competition']?>", 5000, COLOR_ERROR);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_ADD_REFEREE_TO_COMPETITION) { ?>

        Materialize.toast("<?php echo $success_msg['footer_toast_success_referee_inscription'] ?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_ADD_REFEREE_TO_COMPETITION) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_add_referee_inscription']?>", 5000, COLOR_ERROR);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_REFEREE_INSCRIPTION) { ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_referee_inscription']?>", 5000, COLOR_OK);
        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_DELETE_REFEREE_INSCRIPTION) { ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_delete_referee_inscription']?>", 5000, COLOR_ERROR);
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SESSION_EXPIRED){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_session_expired']?>", 5000, COLOR_ERROR);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == EXISTS_COMPETITOR_NAME_SURNAME){ ?>

        $('#exits_competitor_modal').modal('open');
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_COMPETITOR_INSCRIPTION){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_competitor_inscription'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == EXISTS_INSCRIPTION){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_exists_participation']?>", 5000, COLOR_ERROR);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_COMPETITION_EXISTS){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_competition_exists']?>", 5000, COLOR_ERROR);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_COMPETITOR_PARTICIPATION){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_competitor_inscription'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == LOAD_MODAL_CREATE_REFEREE_CATEGORY){ ?>

        $('#modal-add-referee-category').modal('open');
        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_CREATE_TIMEKEEPER){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_create_timekeeper'] ?>", 5000, COLOR_ERROR);

        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_CREATE_TIMEKEEPER){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_create_timekeeper'] ?>", 5000, COLOR_OK);

        <?php } ?>


        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_ADD_TIMEKEEPER_TO_MAT){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_add_timekeeper_to_mat'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_TIMEKEEPER_TO_MAT){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_timekeeper_to_mat'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_EQUAL_COMPETITOR){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_equal_competitor'] ?>", 5000, COLOR_ERROR);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_CREATE_COMBAT){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_create_combat'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_ADD_SCORE){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_add_score'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_UPDATE_MAT){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_update_mat'] ?>", 5000, COLOR_OK);

        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_ENTER_POSITION){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_enter_position'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SUCCESS_DELETE_COMBAT){ ?>
        Materialize.toast("<?php echo $success_msg['footer_toast_success_delete_combat'] ?>", 5000, COLOR_OK);

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == ERROR_CAN_NOT_GENERATE_COMBATS){ ?>
        Materialize.toast("<?php echo $warning_msg['footer_toast_warning_error_can_not_generate'] ?>", 5000, COLOR_WARNING); // Falta por añadir al diccionario de datos

        <?php } ?>
        <?php if (isset($_GET['msg']) AND $_GET['msg'] == NO_SELECT_ALGORITHIM){ ?>
        Materialize.toast("<?php echo $warning_msg['footer_toast_warning_no_select_algorithm'] ?>", 5000, COLOR_WARNING); // Falta por añadir al diccionario de datos

        <?php } ?>

        <?php if (isset($_GET['msg']) AND $_GET['msg'] == SIZE_OF_DNI){ ?>
        Materialize.toast("<?php echo $error_msg['footer_toast_error_no_size_dni'] ?>", 5000, COLOR_ERROR); // Falta por añadir al diccionario de datos

        <?php } ?>


    });


</script>


</html>