<apex:page id="Page" standardController="Product_Set__c" extensions="SI_SearchSetProductController" sidebar="false" showHeader="false" action="{!init}">
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <script type="text/javascript">
        function SetProductId(str) {
            //top.window.opener.setProductEntry(str);
            top.window.opener.setProductEntryGateway(str);
            top.window.close();
        }
        function SetMuiltProduct(){
            var Str = j$(escapeVfId("Page:mainForm:setPFString")).value();
            var isPrepared = j$(escapeVfId("Page:mainForm:DataStatus")).value();
            if(isPrepared!='Fin'){
                confirm(isPrepared)
            }else if(Str==''||Str==null){
                if(confirm("您尚未选取任何产品配套，确认完成么？")){
                    top.window.close();
                }else{
                }
            }else{
                top.window.opener.setProductEntryGateway(Str);
                top.window.close();
            }
        }
        function DataPrepare() {
            // body...
            j$(escapeVfId("Page:mainForm:DataStatus")).val('数据尚未准备好，请稍等');
            SelectDone();
        }
        // function DataReady() {
        //  // body...
        //  j$(escapeVfId("Page:mainForm:DataStatus")).value()='Fin';
        // }
    </script>
    <style type="text/css">
        div#iframelike {
            color: #fff;
            height: 300px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
    <apex:outputPanel id="all">
        <apex:form id="mainForm">
        <apex:actionFunction action="{!SelectDone}" name="SelectDone" reRender="setPFString,DataStatus" oncomplete="SetMuiltProduct();"/>
        <apex:inputHidden value="{!setPFString}" id="setPFString"/>
        <apex:inputHidden value="{!DataStatus}" id="DataStatus"/>
            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Set_Search}">
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <colgroup>
                        <col width="12" />
                        <col width="20" />
                        <col width="20" />
                        <col width="200" />
                        <col width="200" />
                        <col width="20" />
                        <col width="428" />
                    </colgroup>
                    
                    <tr>
                        <td>&nbsp;</td>
                        <th>{!$Label.Search_Condition}</th>
                        <td>&nbsp;</td>
                        <th>{!$Label.Set_Name}</th>
                        <th>{!$Label.Set_Code}</th>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><apex:inputText value="{!SearchName}" style="width:200px" required="false"/></td>
                        <td><apex:inputText value="{!SearchCode}" style="width:200px" required="false"/></td>
                        <td><apex:commandButton value="{!$Label.Search}" action="{!serContact}" style="width:100px" rerender="idRezultVisitor" /></td>
                        <td><apex:commandButton value="添加" onclick="SelectDone()" style="width:100px"/></td>
                    </tr>
                    <tr>
                        <td style="border-bottom: 1px solid #888;" colspan="15">&nbsp;</td>
                    </tr>
                </table>
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <tr>
                        <td width="12">&nbsp;</td>
                        <th valign="top">{!$Label.Search_Result}</th>
                        <td width="20">&nbsp;</td>
                        <td>
                            <table border="0">
                                <tr>
                                    <td>
                                    <div id="iframelike" style="width:770px">
                                        <apex:pageBlockTable id="idRezultVisitor" value="{!activities}" var="c" border="1" columns="7" columnsWidth="30px,300px,120px,90x,200px,50px">
                                            <apex:column >
                                                <apex:facet name="header">选择</apex:facet>
                                                <apex:inputCheckbox value="{!c.isSelected}"/>
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">Report</apex:facet>
                                                <apex:outputLink value="{!baseUrl}/{!reportid}?pv1={!c.setProductid}" target="_blank">◆</apex:outputLink>
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Set_Name}</apex:facet>
                                                <apex:outputLink value="{!c.Name}" onclick="SetProductId('{!c.setProductidFull}')">{!c.Name}</apex:outputLink>
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Set_Code}</apex:facet>
                                                <apex:outputText value="{!c.Product_Set_CD_c}" />
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Quantity}</apex:facet>
                                                <apex:outputText value="{!c.Quantity}" />
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$ObjectType.Product_Set__c.Fields.Quote_Select_Info__c.Label}</apex:facet>
                                                <apex:outputText value="{!c.Quote_Select_Info_c}" />
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Valid_Status}</apex:facet>
                                                <apex:outputPanel layout="inline" rendered="{!IF(c.Valid_c,true,false)}" >
                                                    <img width="16" height="16" title="チェック" class="checkImg" alt="チェック" src="/img/checkbox_checked.gif"/>
                                                </apex:outputPanel>
                                            </apex:column>
                                        </apex:pageBlockTable>
                                    </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
        </apex:form>
    </apex:outputPanel>
</apex:page>