<?php
/*
    enum CallState {
        Unkown = 0,
        Ringing,
        Answered,
        Hangup,
        Forwarded,
        Blindtransfered,
        Attendedtransfered,
        Missed,
        Success,
        Picked
    };
*/


$msgStateClass = '';
switch ($data->state) {
    case '0':
        //$msgStateClass = 'missedMsg';
        break;
    case '1':
        $msgStateClass = 'activeMsg';
        break;
    case '2':
        $msgStateClass = 'activeMsg';
        break;
    case '3':
        $msgStateClass = '';
        break;
    case '4':
        $msgStateClass = 'missedMsg';
        break;
    case '5':
        $msgStateClass = 'missedMsg';
        break;
    case '6':
        $msgStateClass = 'missedMsg';
        break;
    case '7':
        $msgStateClass = 'missedMsg';
        break;
    case '8':
        $msgStateClass = 'successMsg';
        break;
    case '9':
        $msgStateClass = 'missedMsg';
        break;
}
?>
<style>
.dateX{
    position: absolute;
/*     background: red; */
    display: block;
    width:100px;
    /* height: 30px; */
    top: 3px;
    left: -120px;
    text-align: center;
    color: #333;
    background: #EAEFF2;
    border-radius: 4px 0 0 4px;
    text-shadow: 1px 1px 1px #fff,0px 1px 1px #fff,1px 0px 1px #fff,-1px -1px 1px #fff;
}

</style>
<div class="ucMessage <?php echo $msgStateClass ?>" id="msg_<?php echo $data->id;?>">
    <div class="messageSummary nav" style="position: relative;">
        <div class="messageType pull-left">
            
            <?php 
                switch ($data->direction) {
                    case '0':
                        echo '<i class="icon-arrow-up direction"></i>';
                        break;                    
                    case '1':
                        echo '<i class="icon-arrow-down direction"></i>';
                        break;
                }
            
            
                switch ($data->typ) {
                    case 'fax':
                        echo '<i class="icon-print"></i>';
                        break;
                    case 'call':
                        echo '<i class="icon-phone"></i>';
                        break;
                    case 'email':
                        echo '<i class="icon-envelope"></i>';
                        break;
                }
            ?>           
        </div>
        <div class="messageTarget pull-left"  rel="tooltip" title="first tooltip">
           <!--  <div class="dateX"><?php echo $data->timestamp; ?></div> -->
            <div><i class="icon-user"></i> From: 
                <a style="font-weight:normal" class="" data-title="Max Mustermann" data-content="And here's some amazing content. It's very engaging. right?" rel="popover" data-original-title="">M. Mustermann</a>
            </div>
            <div><i class="icon-tag"></i> Subject: <span style="font-weight:normal">This is the subject</span></div>
        </div>
        <div class="messageActions pull-right">
            <a rel="tooltip" href="#" data-original-title="Reply"><i class="icon-pencil"></i></a>
            <a rel="tooltip" href="#" data-original-title="Forward"><i class="icon-forward"></i></a>
            <a rel="tooltip" href="#" data-original-title="Tags"><i class="icon-tags"></i></a>
            <?php
                echo CHtml::link(
                    '<i class="icon-remove"></i>',
                    array(
                        'delete',
                        'id'=>$data->id,
                        'ajax'=>'homeUCItem',
                    ),
                    array(
                        'class'=>'delete',
                        'rel' => 'tooltip',
                        'id'=>$data->id,
                        'data-original-title' => 'Delete',
                    )
                );
            ?>
        </div>
    </div>
    <div class="messageBody">
       
        <?php 
            $this->renderPartial('msg_call',array('message'=>$data));
            dump($data->state);
        ?>
    </div>
</div>
