#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2008 Aimluck,Inc.
 * http://aipostyle.com/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *#
## ---------------------------------------------------------------------------
#set ($indicator_str = "データを送信")
#set ($action_str = "追加")
#set ($subtitle = "伝言メモ追加")
#set ($event_submit = "eventSubmit_doNote_insert")
#set ($do_action_str = "${action_str}する")
#set ($tabs = [[$subtitle, "",""]])
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
#ALdialogheader($subtitle)
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
#ALajaxscreenformheader("noteForm" $jslink $portlet "NoteFormJSONScreen" "aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.note.onReceiveMessage)")
<input type="hidden" name="mode" value="insert" />
#ALtableheaderWide()
#ALtdcaption("$!result.getFieldName('accept_date')")
#ALtditemheader()
<div dojoType="aipo.widget.DropdownDatepicker" id="acceptdatepicker" widgetId="acceptdatepicker" iconURL="images/icon/icon_date.gif" iconAlt="受付日" hiddenId="accept_date" initValue="$!{result.AcceptDate.Year}/$!{result.AcceptDate.Month}/$!{result.AcceptDate.Day}" inputId="input_acceptdate" dateId="accept_date" displayCheck="none"></div>
<select name="accept_date_hour" size="1">
#foreach ( $num in [0..23] )
<option value="$num" #if ($!result.AcceptDate.Hour == "$num") selected #end>$num時</option>
#end              
</select>
<select name="accept_date_minute" size="1">
#foreach ( $num in [0..59] )
<option value="$num" #if ($!result.AcceptDate.Minute == "$num") selected #end>$num分</option>
#end              
</select>
#ALtditemfooter()
#ALtdcaption("#ALrequired($!result.getFieldName('dest_user_id'))")
#ALtditemheader()
#set($screenlink = "$jslink.getPortletById($!portlet.ID).addPathInfo('template','UserLiteJSONScreen')")
<select name="target_group_name" id="target_group_name" style="width:49%;float:left;" onchange="aipo.note.changeGroup('$screenlink', this.options[this.selectedIndex].value, '')">
<option value="LoginUser">（グループ全体）</option>
#foreach( $record in $!result.MyGroupList )
<option value="$!{record.Name.toString()}" #if($!result.TargetGroupName == $!record.Name.toString()) selected #set($groupName = $!record.Name) #end>$!record.AliasName</option>
#end
#if(($result.MyGroupList.size() > 0) && ($result.PostMap.size() > 0))
<option value="" disabled="disabled">----------</option>
#end
#foreach( $record in $!result.PostMap )
<option value="$!{record.GroupName.toString()}" #if($!result.TargetGroupName == $!record.GroupName.toString()) selected #set($groupName = $!record.GroupName) #end>$!record.PostName</option>
#end
</select>
<div id="destuserDiv"></div>
<div class="message small">グループだけを選択した場合、グループに属する全ユーザーに送信します。ユーザーを選択した場合、選択したユーザーだけに送信します。</div>
#ALtditemfooter()
#ALtdcaption("#ALrequired($!result.getFieldName('client_name'))")
#ALtditem("#ALtextfield('client_name' $!result.ClientName '90%' 50 'active')")
#ALtdcaption("$!result.getFieldName('company_name')")
#ALtditem("#ALtextfield('company_name' $!result.CompanyName '90%' 50 'active')")
#ALtdcaption($!result.getFieldName("telephone1"))
#ALtditemheader()
#ALtextfield('telephone1' $!result.Telephone1 '50px' 5 'disabled')-#ALtextfield('telephone2' $!result.Telephone2 '50px' 4 'disabled')-#ALtextfield('telephone3' $!result.Telephone3 '50px' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption("$!result.getFieldName('email_address')")
#ALtditem("#ALtextfield('email_address' $!result.EmailAddress '90%' 50 'disabled')")
#ALtdcaption($!result.getFieldName('add_dest_type_pc'))
#ALtditemheader()
<input name="add_dest_type_pc" type="checkbox" value="1" id="$!{portlet.ID}add_dest_type_pc_id" #if($!result.AddDestTypePc.toString() == "1") checked="checked" #end/><label for="$!{portlet.ID}add_dest_type_pc_id">パソコン</label> 
<input name="add_dest_type_cellphone" type="checkbox" value="1" id="$!{portlet.ID}add_dest_type_cellphone_id" #if($!result.AddDestTypeCellphone.toString() == "1") checked="checked" #end/><label for="$!{portlet.ID}add_dest_type_cellphone_id">携帯電話</label> 
<div class="message small">この伝言メモをパソコンや携帯電話に送れます。<br/>ただし、宛先ユーザーのメールアドレスが未設定の場合、もしくはアイポの管理者画面でメールアカウントを登録されていない場合には、伝言メモは送信できますが、そのメールアドレスには通知されません。</div>
#ALtditemfooter()
#ALtdcaption("#ALrequired($!result.getFieldName('subject_type'))")
#ALtditemheader()
<input name="subject_type" id="subject_type3$!portlet.ID" type="radio" value="3" #if ($!result.SubjectType.toString() == "3") checked="checked" #end/>
<label for="subject_type3$!portlet.ID">連絡があったことをお伝えください。</label><br/>
<input name="subject_type" id="subject_type4$!portlet.ID" type="radio" value="4" #if ($!result.SubjectType.toString() == "4") checked="checked" #end/>
<label for="subject_type4$!portlet.ID">伝言をお願いします。</label><br/>
<input name="subject_type" id="subject_type1$!portlet.ID" type="radio" value="1" #if ($!result.SubjectType.toString() == "1") checked="checked" #end/>
<label for="subject_type1$!portlet.ID">再度電話します。</label><br/>
<input name="subject_type" id="subject_type2$!portlet.ID" type="radio" value="2" #if ($!result.SubjectType.toString() == "2") checked="checked" #end/>
<label for="subject_type2$!portlet.ID">折返しお電話ください。</label><br/>
<input name="subject_type" id="subject_type0$!portlet.ID" type="radio" value="0" #if ($!result.SubjectType.toString() == "0") checked="checked" #end/> 
<label onclick='aipo.note.oncheck0("subject_type0$!portlet.ID")' >
#ALtextfield('custom_subject' $!result.CustomSubject.toString() '50%' 50 'active')
<div style="padding-left:15px;">&nbsp;（用件を自由に入力できます）</div>
</label>
#ALtditemfooter()
#ALtdcaption("$!result.getFieldName('message')")
#ALtditemheader()
#ALtextarea('message' $!result.Message 10 40)
#ALtditemfooter()
#if($mode!="new_form")
#ALtdcaption("$!result.getFieldName('create_date')")
#ALtditem($!result.CreateDate)
#ALtdcaption("$!result.getFieldName('update_date')")
#ALtditem($!result.UpdateDate)
#end
#ALtablefooter()
#ALbuttonheader()
#ALsubmit($event_submit $do_action_str)#ALajaxbuttonClose()
#ALbuttonfooter()
<input type="hidden" id="urlUserlist$!portlet.ID" name="urlUserlist$!portlet.ID" value="$screenlink" />
<input type="hidden" id="urlDstUser$!portlet.ID" name="urlDstUser$!portlet.ID" value="$!result.DestUserId" />
#ALformfooter()
#ALdialogfooter()
