<!--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('note_labels-add', 'x', '1');
    });

</script>


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


    <div id="popupsave">

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

    </div>

    <h1>Note Labels</h1>


    <div class="pad24t popupbody">


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

            <?php

            //$history = new history('','','1','999','label','ASC','ppSD_note_labels');

            //foreach ($history->{'final_content'} as $item) {


            $q1 = $db->run_query("

        SELECT `label`,`id`,`color`

        FROM `ppSD_note_labels`

        ORDER BY `label` ASC

    ");

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

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

                    <a href="null.php" onclick="return delete_item('ppSD_note_labels','<?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="label[<?php echo $item['id']; ?>][label]" style="width:300px;"
                           value="<?php echo $item['label'] ?>"/>

                    <input type="hidden" name="label[<?php echo $item['id']; ?>][id]"
                           value="<?php echo $item['id'] ?>"/> <?php echo $admin->color_picker('label[' . $item['id'] . '][color]', $item['color']); ?>

                </li>

            <?php

            }



            ?>

        </ul>


        <div class="submit">

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

        </div>


    </div>


</form>


<script type="text/javascript">

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

</script>