<!--start:custom scripts-->

<link type="text/css" rel="stylesheet" href="<?php echo PP_ADMIN; ?>/css/jquery.miniColors.css"/>

<script src="<?php echo PP_ADMIN; ?>/js/jquery.miniColors.min.js" type="text/javascript"></script>

<!--end:custom scripts-->


<script type="text/javascript">

    $.ctrl('S', function () {
        return json_add('event_types-add', 'x', '0', 'popupform');
    });

</script>


<form action="" method="post" id="popupform" onsubmit="return json_add('event_types-add','x','0','popupform');">


    <div id="popupsave">

        <input type="submit" value="Save" class="save"/>

    </div>

    <h1>Event Types</h1>


    <div class="pad24t popupbody">


        <ul id="event_types" class="popup_longlist">

            <?php



            $types = $db->run_query("

        SELECT *

        FROM `ppSD_event_types`

        ORDER BY `name` ASC

    ");

            while ($item = $types->fetch()) {
                ?>

                <li id="td-cell-<?php echo $item['id'] ?>">

                    <a href="null.php" onclick="return delete_item('ppSD_event_types','<?php echo $item['id'] ?>');"
                       class="floatright"><img src="imgs/icon-delete.png" width="16" height="16" border="0"
                                               class="option_icon hover" alt="Delete" title="Delete"/></a><input
                        type="text" name="event_type[<?php echo $item['id']; ?>][name]" style="width:300px;"
                        value="<?php echo $item['name'] ?>"/><input type="hidden"
                                                                    name="event_type[<?php echo $item['id']; ?>][id]"
                                                                    value="<?php echo $item['id'] ?>"/> <?php echo $admin->color_picker('event_type[' . $item['id'] . '][color]', $item['color']); ?>

                </li>

            <?php

            }

            ?>

        </ul>


        <div class="submit">

            <a href="null.php" onclick="return add_type();">[+] Add New Event Type</a>

        </div>


    </div>


</form>


<script type="text/javascript">

    function add_type() {
        show_loading();
        send_data = 'action=event_type_entry';
        $.post('cp-functions/event_addition.php', send_data, function (theResponse) {
            $('#event_types').append(theResponse);
            close_loading();
        });
        return false;
    }

</script>