{$layout}
{$template "recipient_menu"}
{$template "/code_editor"}

<form class="ui form" data-tea-action="$" data-tea-success="success">
    <csrf-token></csrf-token>
    <input type="hidden" name="recipientId" :value="recipient.id"/>

    <table class="ui table definition selectable">
        <tr>
            <td class="title">系统用户 *</td>
            <td>
                <admin-selector :v-admin-id="recipient.admin.id"></admin-selector>
                <p class="comment">选择关联的系统用户。</p>
            </td>
        </tr>
        <tr>
            <td>媒介 *</td>
            <td>
                <message-media-instance-selector :v-instance-id="recipient.instance.id" @change="changeInstance"></message-media-instance-selector>
            </td>
        </tr>
        <tr>
            <td>接收人标识</td>
            <td>
                <input type="text" name="user" maxlength="300" v-model="recipient.user"/>
                <p class="comment">{{userDescription}}</p>
            </td>
        </tr>
        <tr v-show="nodeClusters.length > 0">
            <td>关联的边缘节点集群</td>
            <td>
                <div class="clusters-box">
                    <checkbox v-for="nodeCluster in nodeClusters" name="nodeClusterIds" :v-value="nodeCluster.id" :checked="nodeCluster.isChecked ? 'checked': ''">{{nodeCluster.name}}</checkbox>
                </div>
            </td>
        </tr>
        <tr>
            <td>分组</td>
            <td>
                <message-recipient-group-selector :v-groups="recipient.groups"></message-recipient-group-selector>
                <p class="comment">选择当前接收人所属分组。</p>
            </td>
        </tr>
        <tr>
            <td colspan="2"><more-options-indicator></more-options-indicator></td>
        </tr>
        <tbody v-show="moreOptionsVisible">
            <tr>
                <td>发送时间</td>
                <td>
                    <div class="ui fields inline">
                        <div class="ui field">
                            开始时间：
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeFromHour" size="2" maxlength="2" placeholder="" v-model="recipient.timeFromHour"/>
                                <span class="ui label">时</span>
                            </div>
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeFromMinute" size="2" maxlength="2" placeholder="" v-model="recipient.timeFromMinute"/>
                                <span class="ui label">分</span>
                            </div>
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeFromSecond" size="2" maxlength="2" placeholder="" v-model="recipient.timeFromSecond"/>
                                <span class="ui label">秒</span>
                            </div>
                        </div>
                    </div>
                    <div class="ui divider"></div>
                    <div class="ui fields inline">
                        <div class="ui field">
                            结束时间：
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeToHour" size="2" maxlength="2" placeholder="" v-model="recipient.timeToHour"/>
                                <span class="ui label">时</span>
                            </div>
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeToMinute" size="2" maxlength="2" placeholder="" v-model="recipient.timeToMinute"/>
                                <span class="ui label">分</span>
                            </div>
                        </div>
                        <div class="ui field">
                            <div class="ui input right labeled">
                                <input type="text" name="timeToSecond" size="2" maxlength="2" placeholder="" v-model="recipient.timeToSecond"/>
                                <span class="ui label">秒</span>
                            </div>
                        </div>
                    </div>
                    <p class="comment">24小时制，即小时从0到23。如果填写了发送时间，系统只会在这个时间段内给当前接收人发送消息。
                    <a href="" v-if="recipient.timeFromHour.length > 0 || recipient.timeFromMinute.length > 0 || recipient.timeFromSecond.length > 0 || recipient.timeToHour.length > 0 || recipient.timeToMinute.length > 0 || recipient.timeToSecond.length > 0" @click.prevent="clearTime">[清除]</a> </p>
                </td>
            </tr>
            <tr>
                <td>备注</td>
                <td>
                    <textarea rows="3" name="description" maxlength="100" v-model="recipient.description"></textarea>
                </td>
            </tr>
            <tr>
                <td>启用当前接收人</td>
                <td>
                    <checkbox name="isOn" :v-value="1" v-model="recipient.isOn"></checkbox>
                </td>
            </tr>
        </tbody>
    </table>

    <submit-btn></submit-btn>
</form>