<script type="text/javascript">
<!--
$(document).ready(function() {
    $('#ftable').flexigrid({
        url: '<?php echo $this->appPath('controller'); ?>/json/?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: [10,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: 10,
        showTableToggleBtn: true,
        width: 'auto',
        height: 'auto'
    });
});

$(document).ready(function() 
{
    $('.date').datepicker();
}
);

$(document).ready(function(){
    $(".clock").clockpick({
        military:true,
        starthour:0,
        endhour:23
    });
});
// -->
</script>

<h1>&nbsp;&nbsp;<?php echo $this->translate('inquiry.title.view_all'); ?></h1>

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

<form action="./inquiry/view_all/" method="GET" class="top_form">
<table>

<tr>
<th><?php echo $this->translate('inquiry.label.target_service'); ?></th>
<td>
<select name="service_id">
<?php foreach ((array) $this->service_options as $id => $name) :?>
<?php $service_id = intval($this->service['id']); if ($id == $service_id) { $selected = "selected=\"selected\""; } else { $selected = ""; } ?>
  <option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $name; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>

<tr>
<th><?php echo $this->translate('inquiry.label.subject'); ?></th>
<td>
<input type="text" name="crtr[sbj][val]" value="<?php echo $this->escape($this->crtr['sbj']['val']); ?>"/>
<?php
 $equal = "";
 $like  = "";
 if($this->crtr['sbj']['mtd']=="equal") $equal="selected";
 if($this->crtr['sbj']['mtd']=="like")  $like ="selected";
?>
<select name="crtr[sbj][mtd]">
<option value="equal" <?php echo $equal; ?>><?php echo $this->translate('common.label.criteria_equal'); ?></option>
<option value="like" <?php echo $like; ?>><?php echo $this->translate('common.label.criteria_like'); ?></option>
</select>
</td>
</tr>

<tr>
<th><?php echo $this->translate('inquiry.label.accept_datetime'); ?></th>
<td>
<input class="date"  type="text" name="crtr[cdt][sd]" value="<?php echo $this->escape($this->crtr['cdt']['sd']); ?>" />
<input class="clock" type="text" name="crtr[cdt][st]" value="<?php echo $this->escape($this->crtr['cdt']['st']); ?>" />
<?php echo $this->translate('common.label.criteria_between_before'); ?>
<input class="date"  type="text" name="crtr[cdt][ed]" value="<?php echo $this->escape($this->crtr['cdt']['ed']); ?>" />
<input class="clock" type="text" name="crtr[cdt][et]" value="<?php echo $this->escape($this->crtr['cdt']['et']); ?>" />
<?php echo $this->translate('common.label.criteria_between_after'); ?>
</td>
</tr>

<tr>
<th><?php echo $this->translate('inquiry.label.status'); ?></th>
<td>
<?php foreach ((array) $this->status_options as $key => $value) : ?>
<?php $checked = in_array($key, (array) $this->crtr['sts']) ? "checked" : ""; ?>
<input type="checkbox" name="crtr[sts][]" value="<?php echo $key; ?>" id="<?php echo $key; ?>" <?php echo $checked; ?>/><label for="<?php echo $key; ?>"><?php echo $value; ?></label>
<?php endforeach; ?>
</td>
</tr>

<tr>
<td colspan="2">
<input type="submit" style="width:150px;" value="<?php echo $this->translate('common.operation.extract'); ?>" />
</td>
</tr>

</table>

</form>

<h2><?php echo $this->escape($this->service['name']); ?>&nbsp;&nbsp;<?php echo $this->translate('inquiry.caption.list'); ?></h2>
<table id="ftable"></table>



