<?php
$this->pageTitle = 'Магазин';
?>
<script>
    function getItems(id_set, type) {
        $.ajax({
            'url': '/shop/ajaxGetItems?id_set='+ id_set +'&type=' + type,
            'success': function(response) {
                $('#items').html(response);
            }
        });
    }

    $(document).ready(function() {
        getItems(<?php echo $type; ?>,3);
        $('a.quality').click(function(ev) {
            ev.preventDefault();
            var type = parseInt($(this).attr('id'));
            getItems(<?php echo $type; ?>, type);
            $('a.quality').removeClass("active");
            $(this).addClass("active");
        });
    });
</script>
<div class="npc-view_block">
    <div class="npc-view_img">
        <img src="/images/npc/shop.jpg" alt="*">
    </div>
    <div class="npc-view_info">
        <span class="percent">Торговец:</span> <?php echo $info[$type];?>
    </div>
</div>
<div class="title">Качество:</div>
<?php echo CHtml::link('<img src="/images/icons/quality/3.png"> добротные', array('index', 'type' => '3'), array('id' => '3', 'class' => 'block quality active')); ?>
<?php echo CHtml::link('<img src="/images/icons/quality/4.png"> замечательные', array('index', 'type' => '4'), array('id' => '4', 'class' => 'block quality')); ?>
<?php echo CHtml::link('<img src="/images/icons/quality/5.png"> редкие', array('index', 'type' => '5'), array('id' => '5', 'class' => 'block quality')); ?>
<?php echo CHtml::link('<img src="/images/icons/quality/6.png"> легендарные', array('index', 'type' => '6'), array('id' => '6', 'class' => 'block quality')); ?>
<hr>
<div id="items"></div>
<?php echo CHtml::link('<img src="/images/icons/shop.png"> Магазины', array('index'), array('class' => 'block')); ?>
