Subversion Repositories SmartDukaan

Rev

Rev 579 | Rev 1051 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.1 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>List of Entities</title>
<script type="text/javascript" src="jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.dialog.js"></script>
<script type="text/javascript" src="jquery/validation/jquery.validate.js"></script>

<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.resizable.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.core.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.blind.js"></script>
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.drop.js"></script>
<script type="text/javascript" src="jquery/jquery.chained.js"></script>
<script type="text/javascript" src="jquery/jquery.tablesorter.js"></script>
<script>
// increase the default animation speed to exaggerate the effect
jQuery.fx.speeds._default = 1000;
$(function() {

        
        
        $('.category').click(function() {
            var categoryid = $(this).attr('id') + "-table";
                alert("Toggle style for category" + categoryid);
                $('.category-table').hide();
                $('#'+categoryid).show();
                return false;
        });
         
        $('.delete').click(function() {
                var entityid = $(this).attr('id');
        $('#dialog').dialog({
                    autoOpen: false,
                                width: 470,
                    height: 100,
                    modal: true,
                                title: 'Are you sure ? It will be permanently deleted. Continue ?',
                    buttons: {
                    "OK":function() { window.location.href = "/content/entity/" + entityid + "?_method=delete" },
                    "Cancel": function() { $(this).dialog("close"); }
            }
         });

                $('#dialog').dialog('open');

                return false;
        });
        
    $('.ready').click(function() {
                var entityid = $(this).attr('id');
        $('#dialog').dialog({
                    autoOpen: false,
                                width: 470,
                    height: 100,
                    modal: true,
                                title: 'The item will become available for consumers to place orders for. Continue?',
                    buttons: {
                    "OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put" },
                    "Cancel": function() { $(this).dialog("close"); }
            }
         });

                $('#dialog').dialog('open');

                return false;
        });
});

$(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 

</script>


<link type="text/css" href="jquery/jqueryui/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" />
<style type="text/css">
    
* { font-family: Verdana; font-size: 96%; }
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }

table {
    border-width: 1px 1px 1px 1px;
    border-spacing: 2px;
    border-style: outset outset outset outset;
    border-color: gray gray gray gray;
    border-collapse: separate;
    background-color: white;
}
th {
    border-width: 1px 1px 1px 1px;
    padding: 1px 1px 1px 1px;
    border-style: inset inset inset inset;
    border-color: gray gray gray gray;
    background-color: white;
    -moz-border-radius: 0px 0px 0px 0px;
}
td {
    border-width: 1px 1px 1px 1px;
    padding: 1px 1px 1px 1px;
    border-style: inset inset inset inset;
    border-color: gray gray gray gray;
    background-color: white;
    -moz-border-radius: 0px 0px 0px 0px;
}
div.dialog {
    padding:12px;
    font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
}
</style>

</head>
<body>
<div>
    <h1>Entities</h1>
    
    #sactionmessage()
    
    <a href="/content/entity/new">Create New</a>
    <p></p>
    #set ( $entities = $action.getEntities() )
    #set ( $incompleteentities = $action.getIncompleteEntities() )
    #set ( $catEntities = $action.getEntitiesByCategory())
    <!-- Incomplete -->
    <h3>Incomplete</h3>
    
    <div>
        #drawEntities($incompleteentities 1)
    </div>
    <p/>
    <!-- Completes -->
    <h3>Complete</h3>


    <div>
        #drawAllEntities($entities)
        <!--
                <ul>
                #*      
                #foreach( $catid in $catEntities.keySet())
                        #if($catEntities.get($catid))
                                #set ( $entities = $catEntities.get($catid))
                        <li><a href="" class="category" id="$catid">$catid - ($action.getCategoryName($entities.get(0).getCategoryID()) )</a></li>
                        #end
                #end
                </ul>   

                #foreach( $catid in $catEntities.keySet())
                        #set ( $entities = $catEntities.get($catid))
                        #drawEntities($entities $catid)
                #end
        *#      
     -->
    </div>
</div>

<div id="dialog" title="">
    <iframe src="" id="dialog-iframe" width="430px" height="360px">
    </iframe>
</div>
</body>
</html>

#macro (drawAllEntities $entities)
            <table id="myTable">
                <thead>
            <tr style="border: 1px">
                <th>#</th>
                <th>Entity ID</th>
                <th>Category</th>
                <th>Brand</th>
                <th>Model Number</th>
                <th>Model Name</th>
                <th colspan="3">Actions</th>
            </tr>
        </thead>
        <tbody>
    #foreach ( $entity in $entities )
            <tr style="border: 1px">
                <td>$velocityCount</td>
                #set ( $entityid = $entity.getID() )
                <td><a href="/content/entity/$entityid/edit">$entityid</a></td>
                <td>$action.getCategoryName($entity.getCategoryID())</td>
                <td>$entity.getBrand()</td>
                <td>$entity.getModelNumber()</td>
                <td>$entity.getModelName()</td>
                <td><a href="/content/entity/$entityid" target="_blank">View</a></td>
                <!-- <td><a href="" id="$entityid" class="opener">Media</a></td> -->
                <td><a href=""  id="$entityid" class="delete">Delete</a></td>
                                <td><a href=""  id="$entityid" class="ready">Ready</a></td>                             
            </tr>
    #end
        </tbody>
    </table>

#end    

#macro (drawEntities $entities $catid)
        <!-- style= "display: none; z-index: 1000; outline: 0px none; position: relative;" -->
    <table id="${catid}-table"; class="category-table" >
        <thead>
            <tr style="border: 1px">
                <th>#</th>
                <th>Entity ID</th>
                <th>Category</th>
                <th>Brand</th>
                <th>Model Number</th>
                <th>Model Name</th>
                <th></th>
                <th></th>
            </tr>
        </thead>
        <tbody>
    #foreach ( $entity in $entities )
            <tr style="border: 1px">
                <td>$velocityCount</td>
                #set ( $entityid = $entity.getID() )
                <td><a href="/content/entity/$entityid/edit">$entityid</a></td>
                <td>$action.getCategoryName($entity.getCategoryID())</td>
                <td>$entity.getBrand()</td>
                <td>$entity.getModelNumber()</td>
                <td>$entity.getModelName()</td>
                <td><a href="/content/entity/$entityid" target="_blank">View</a></td>
                <!-- <td><a href="" id="$entityid" class="opener">Media</a></td> -->
                <td><a href=""  id="$entityid" class="delete">Delete</a></td>
            </tr>
    #end
        </tbody>
    </table>
#end