<script type="text/javascript">
<!--
$(document).ready(function() {
    $('#takecharge_inquiry_table').flexigrid({
        url: 'inquiry/json_takecharge/?service_id=<?php echo $this->service['id']; ?><?php echo $this->request_param; ?>',
        dataType: 'json',
        colModel : [
            {display: 'ID', name : 'id', width : 30, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.subject'); ?>', name : 'subject', width : 300, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.received_from'); ?>', name : 'from', width: 120, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.content'); ?>', name : 'content', width : 350, sortable : true, align: 'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.create_datetime'); ?>', name : 'createdatetime', width : 150, sortable : true, align: 'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.registrant_name'); ?>', name: 'registrant', width: 150, sortable:true, align:'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.accept_datetime'); ?>', name : 'acceptdatetime', width : 150, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.accepter_name'); ?>', name: 'accepter', width: 150, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.operator_name'); ?>', name:'operator', width:150, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.status'); ?>', name: 'status', width: 100, sortable:true, align: 'center'},
            {display: '<?php echo $this->translate('inquiry.label.priority'); ?>', name: 'priority', width: 100, sortable:true, align:'center'}
        ],
        rpOptions: [5,10,15,30,50,100],
        pagestat: '<?php echo $this->translate('common.flex_grid.pagestat'); ?>',
        procmsg: '<?php echo $this->translate('common.flex_grid.procmsg'); ?>',
        singleSelect: true,
        sortname: "id",
        sortorder: "DESC",
        usepager: true,
        title: '',
        useRp: true,
        rp: 5,
        showTableToggleBtn: true,
        width: 'auto',
        height: 'auto'
    });
});
$(document).ready(function() {
    $('#accepted_inquiry_table').flexigrid({
        url: 'inquiry/json_accepted/?service_id=<?php echo $this->service['id']; ?><?php echo $this->request_param; ?>',
        dataType: 'json',
        colModel : [
            {display: 'ID', name : 'id', width : 30, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.subject'); ?>', name : 'subject', width : 300, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.received_from'); ?>', name : 'from', width: 120, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.content'); ?>', name : 'content', width : 350, sortable : true, align: 'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.create_datetime'); ?>', name : 'createdatetime', width : 150, sortable : true, align: 'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.registrant_name'); ?>', name: 'registrant', width: 150, sortable:true, align:'left', hide:true},
            {display: '<?php echo $this->translate('inquiry.label.accept_datetime'); ?>', name : 'acceptdatetime', width : 150, sortable : true, align: 'left'},
            {display: '<?php echo $this->translate('inquiry.label.accepter_name'); ?>', name: 'accepter', width: 150, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.operator_name'); ?>', name:'operator', width:150, sortable:true, align:'left'},
            {display: '<?php echo $this->translate('inquiry.label.status'); ?>', name: 'status', width: 100, sortable:true, align: 'center'},
            {display: '<?php echo $this->translate('inquiry.label.priority'); ?>', name: 'priority', width: 100, sortable:true, align:'center'}
        ],
        rpOptions: [5,10,15,30,50,100],
        pagestat: '<?php echo $this->translate('common.flex_grid.pagestat'); ?>',
        procmsg: '<?php echo $this->translate('common.flex_grid.procmsg'); ?>',
        singleSelect: true,
        sortname: "id",
        sortorder: "DESC",
        usepager: true,
        title: '',
        useRp: true,
        rp: 5,
        showTableToggleBtn: true,
        width: 'auto',
        height: 'auto'
    });
});
$(document).ready(function() 
{
    $('.date').datepicker();
}
);
// -->
</script>

<h1><?php echo $this->translate('index.title.mypage'); ?></h1>

<h2><?php echo $this->translate('index.caption.user_info'); ?></h2>

<dl class="user">
<dt><?php echo $this->translate('user.label.user_id'); ?></dt>
<dd><?php echo $this->escape($this->user_info->user_id); ?></dd>
<dt><?php echo $this->translate('user.label.name'); ?></dt>
<dd><?php echo $this->escape($this->user_info->name); ?></dd>
<dt><?php echo $this->translate('user.label.mailaddress'); ?></dt>
<dd><?php echo $this->escape($this->user_info->mailaddress); ?></dd>
<dt><?php echo $this->translate('user.label.authority'); ?></dt>
<dd>
<ul>
<?php foreach ($this->user_info->roles as $key => $value) : ?>
<li><?php echo $this->escape($value['role_name']); ?></li>
<?php endforeach; ?>
</ul>
</dd>
</dl>

<h2><?php echo $this->translate('index.caption.manage_menu'); ?></h2>

<dl class="op">
<?php if ($this->is_service_admin || $this->is_user_admin) : ?>
<dt><?php echo $this->translate('index.label.system_manage'); ?></dt>
<dd>
<ul>
<?php if ($this->is_service_admin) : ?>
<li><a href="./service/"><?php echo $this->translate('index.label.service_manage'); ?></a></li>
<?php endif; ?>
<?php if ($this->is_user_admin) : ?>
<li><a href="./user/"><?php echo $this->translate('index.label.user_manage'); ?></a></li>
<?php endif; ?>
</ul>
</dd>
<?php endif; ?>
<?php foreach ($this->enable_services as $service) : ?>
<dt><?php echo $service['name']; ?></dt>
<dd>
<ul>
<li>
<a href="./inquiry/view_all/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.inquiry_list'); ?></a>
</li>
<?php if ($service['can_inquiry_accept']) : ?>
<li>
<a href="./inquiry/receive/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.inquiry_receive'); ?></a>
</li>
<?php endif; ?>
<?php if ($service['can_inquiry_accept']) : ?>
<li>
<a href="./inquiry/create_input/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.inquiry_create'); ?></a>
</li>
<?php endif; ?>
<?php if ($service['can_inquiry_accept']) : ?>
<li>
<a href="./unaccept/view_list/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.inquiry_accept'); ?></a>
</li>
<?php endif; ?>
<?php if ($service['can_inquiry_approve']) : ?>
<li>
<a href="./unapproval/view_list/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.inquiry_approve'); ?></a>
</li>
<?php endif; ?>
<li>
<a href="./mailtemplate/view_list/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.mailtemplate_setup'); ?></a>
</li>
<li>
<?php if($service['is_event_admin']) : ?>
<a href="./event/input/service_id/<?php echo $service['id']; ?>/"><?php echo $this->translate('index.label.event_setup'); ?></a>
<?php endif; ?>
</li>
</ul>
</dd>
<?php endforeach; ?>
</dl>

<h2 style="clear:left;"><?php echo $this->translate('index.caption.takecharge_inquiry'); ?></h2>

<table id="takecharge_inquiry_table"></table>

<h2 style="clear:left;"><?php echo $this->translate('index.caption.accepted_inquiry'); ?></h2>

<table id="accepted_inquiry_table"></table>
