{{:ModuleInclude('public/header')}}

<div class="am-padding-sm">
    {{if empty($data)}}
        {{:ModuleInclude('public/not_data')}}
    {{else /}}
        <!-- form start -->
        <form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/order/delivery')}}" method="POST" request-type="ajax-reload" request-value="parent">
            <div class="am-form-group service-list">
                <ul class="am-list am-list-static am-list-border am-list-striped am-margin-bottom-0 am-radius am-nbfc">
                    {{if !empty($data['service_data']) and is_array($data['service_data'])}}
                        {{foreach $data['service_data'] as $k=>$v}}
                            <li>
                                <p>{{$v.service_name}} / {{$v.service_mobile}}</p>
                                {{if !empty($v['service_start_time']) or !empty($v['service_end_time'])}}
                                    <p>
                                        {{if !empty($v['service_start_time'])}}
                                            <span>{{$v.service_start_time}}</span>
                                        {{/if}}
                                        {{if !empty($v['service_start_time']) and !empty($v['service_end_time'])}}
                                            <span class="am-color-grey">~</span>
                                        {{/if}}
                                        {{if !empty($v['service_end_time'])}}
                                            <span>{{$v.service_end_time}}</span>
                                        {{/if}}
                                    </p>
                                {{/if}}
                                {{if !empty($v['note'])}}
                                    <p>{{$v.note}}</p>
                                {{/if}}
                                <a href="javascript:;" class="am-text-xs am-text-blue edit-submit"> {{:MyLang('edit_title')}}</a>
                                <a href="javascript:;" class="am-text-xs am-text-blue delete-submit"> {{:MyLang('remove_title')}}</a>
                            </li>
                        {{/foreach}}
                    {{/if}}
                </ul>
                <input type="hidden" name="service_data" value="{{if !empty($data['service_data'])}}{{:urlencode(json_encode($data.service_data))}}{{/if}}" />
                <div>
                    <button type="button" class="am-btn am-btn-primary-light-plain am-radius am-btn-xs am-margin-top-sm service-submit-add"> 
                        <i class="iconfont icon-add"></i>
                        <span>{{:MyLang('order.form_item_service_add_name')}}</span>
                    </button>
                </div>
            </div>

            <div class="am-form-popup-submit">
                <input type="hidden" name="id" value="{{$data.id}}"/>
                <input type="hidden" name="user_id" value="{{$data.user_id}}"/>
                <button type="button" class="am-btn am-btn-warning am-radius am-btn-xs" data-am-modal-close>
                    <i class="am-icon-paint-brush"></i>
                    <span>{{:MyLang('cancel_title')}}</span>
                </button>
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('submit_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('submit_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->
    {{/if}}
</div>

<!-- 服务添加弹层 -->
<div class="am-modal" tabindex="-1" id="popup-service-win">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">
            <span>{{:MyLang('order.form_item_service_fill_win_name')}}</span>
            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd am-text-left">
            <form class="am-form form-validation-service" method="post" request-type="sync" request-value="ViewServiceModalBack">
                <div class="am-flex am-flex-justify-between am-gap-1-half">
                    <div class="am-form-group am-wh-auto">
                        <label>{{:MyLang('order.form_item_service_name')}}</label>
                    <input type="text" name="service_name" placeholder="{{:MyLang('order.form_item_service_name')}}" data-validation-message="{{:MyLang('order.form_item_service_name_message')}}" class="am-radius" value="" />
                    </div>
                    <div class="am-form-group am-wh-auto">
                        <label>{{:MyLang('order.form_item_service_mobile')}}</label>
                    <input type="text" name="service_mobile" pattern="{{:MyConst('common_regex_mobile')}}" placeholder="{{:MyLang('order.form_item_service_mobile')}}" data-validation-message="{{:MyLang('order.form_item_service_mobile_message')}}" class="am-radius" value="" />
                    </div>
                </div>
                <div class="am-form-group">
                    <label>{{:MyLang('order.form_item_service_time')}}</label>
                    <div class="form-multiple-where-input">
                        <input type="text" name="service_start_time" autocomplete="off" class="Wdate am-radius" placeholder="{{:MyLang('order.form_item_service_start_time')}}" data-validation-message="{{:MyLang('order.form_item_service_start_time_message')}}" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate:'#F{$dp.$D(\'form-item-service-end-time\');}'})" value="" id="form-item-service-start-time" />
                        <span class="am-text-grey">~</span>
                        <input type="text" name="service_end_time" autocomplete="off" class="Wdate am-radius" placeholder="{{:MyLang('order.form_item_service_end_time')}}" data-validation-message="{{:MyLang('order.form_item_service_end_time_message')}}" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss', minDate:'#F{$dp.$D(\'form-item-service-start-time\');}'})" value="" id="form-item-service-end-time" />
                    </div>
                </div>
                <div class="am-form-group">
                    <label>{{:MyLang('order.form_item_note')}}</label>
                    <input type="text" name="note" placeholder="{{:MyLang('order.form_item_note')}}" maxlength="200" data-validation-message="{{:MyLang('order.form_item_note_message')}}" class="am-radius" value="" />
                </div>

                <div class="am-form-group am-margin-top-sm">
                    <button type="submit" class="am-btn am-btn-primary am-btn-xs am-radius am-btn-block">{{:MyLang('confirm_title')}}</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- footer start -->
{{:ModuleInclude('public/footer')}}

<script type="text/javascript">
// 返回处理
function ViewServiceModalBack(data)
{
    ServiceModalHandle(data);
}
</script>