<?php
/**
 * The edit record mobile view file of action module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Gang Liu <liugang@cnezsoft.com>
 * @package     action
 * @version     $Id$
 * @link        http://www.zdoo.com
 */

if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>

<div class='heading divider'>
  <div class='title'><strong><?php echo $lang->action->record->edit;?></strong></div>
  <nav class='nav'><a data-dismiss='display'><i class='icon-remove muted'></i></a></nav>
</div>

<form class='content box' data-form-refresh='#page' method='post' id='editRecordForm' action='<?php echo inlink('editrecord', "recordID=$record->id");?>'>
  <div class='control'>
    <label for='contact'><?php echo $lang->action->record->contact;?></label>
    <div class='select'>
      <select id='contact' name='contact' class='form-control select-contact chosen'>
        <option></option>
        <?php foreach($contacts as $contact):?>
        <?php $optionPinyin = zget($pinyinContacts, $contact->realname, '');?>
        <option value='<?php echo $contact->id;?>' <?php if($contact->id == $record->contact) echo 'selected';?> data-keys="<?php echo $optionPinyin;?>" data-phone='<?php echo $contact->phone . $lang->slash . $contact->mobile;?>'><?php echo $contact->realname;?></option>
        <?php endforeach;?>
      </select>
    </div>
  </div>
  <div class='control'>
    <label for='date'><?php echo $lang->action->record->date;?></label>
    <input type='date' class='input' id='date' name='date' value="<?php echo formatTime($record->date, DT_DATE1);?>" placeholder='<?php echo $lang->required;?>'>
  </div>
  <div class='control'>
    <label for='comment'><?php echo $lang->comment;?></label>
    <?php echo html::textarea('comment', $record->comment, "class='textarea' rows='5'");?>
  </div>
</form>

<div class='footer has-padding'>
  <button type='button' data-submit='#editRecordForm' class='btn primary'><?php echo $lang->save;?></button>
</div>

<script>
$(function()
{
    $('#editRecordForm').modalForm().listenScroll({container: 'parent'});
});
</script>
