<?xml version="1.0" encoding="UTF-8"?>
<!--
	$author:DJ
	$date:2013/05/07
	$purpose: 联系人
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        
        	function contactPersonScreen_close() {
            	$('csh_bank_contact_person').close();
        	}
        
	        function contactPersonDs_grid_query() {
	            $('contactPersonDs').query();
	        }
	    	
	        function contactPersonDs_grid_add() {
	            $('contactPersonDs_grid').showEditorByRecord($('contactPersonDs').create());
	        }
	        
	        function contactPersonDs_grid_clear() {
	            $('contactPersonDs_grid').clear();
	        }
	        
	        function contactPersonDs_grid_save() {
	            var result_ds = $('contactPersonDs');
	            if (result_ds.validate()) {
	                result_ds.submit();
	            }
	        }
	        
			function editFunction(record,name){
				if(record.isNew){
					if(name=='contact_person_type_name'){
						return 'contactPersonDs_grid_editor_comb';
					}
					if(name=='employee_code'){
						return 'contactPersonDs_grid_editor_lov';
					}
				}
				return '';
			}
			function addFunction(ds,record,index){
				record.set('bank_branch_id',${/parameter/@bank_branch_id});
			}
		]]></script>
        <a:dataSets>
            <a:dataSet id="contact_person_type_ds" lookupCode="CSH_BANK_CONTACT_PERSON_TYPE"/>
            <a:dataSet id="contactPersionHeadDs" loadData="true" model="csh.CSH101.csh_get_csh_bank">
                <a:fields>
                    <a:field name="bank_short_name" readOnly="true"/>
                    <a:field name="bank_branch_name" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="contactPersonDs" autoQuery="true" model="csh.CSH101.csh_bank_contact_person" queryUrl="${/request/@context_path}/autocrud/csh.CSH101.csh_bank_contact_person/query?bank_branch_id=${/parameter/@bank_branch_id}" selectable="true">
                <a:fields>
                    <a:field name="contact_person_type_name" displayField="code_value_name" options="contact_person_type_ds" required="true" returnField="contact_person_type" valueField="code_value"/>
                    <a:field name="employee_code" lovGridHeight="300" lovHeight="450" lovService="exp.exp_employee_for_company_lov" lovWidth="550" required="true" title="HLS.EMPLOYEE_CODE">
                        <a:mapping>
                            <a:map from="employee_code" to="employee_code"/>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="employee_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="start_date_active" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="addFunction"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="contactPersonScreen_close" text="HLS.CLOSE"/>
                <a:gridButton click="contactPersonDs_grid_query" text="HLS.QUERY"/>
                <a:gridButton click="contactPersonDs_grid_add" text="HLS.NEW"/>
                <a:gridButton click="contactPersonDs_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="contactPersonDs_grid_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="120" title="HLS.BANK_INFORMATION">
                <a:textField name="bank_short_name" bindTarget="contactPersionHeadDs"/>
                <a:textField name="bank_branch_name" bindTarget="contactPersionHeadDs"/>
            </a:form>
            <a:grid id="contactPersonDs_grid" bindTarget="contactPersonDs" height="300" navBar="true" width="780">
                <a:columns>
                    <a:column name="contact_person_type_name" align="center" editorFunction="editFunction" width="150"/>
                    <a:column name="employee_code" align="center" editorFunction="editFunction" width="100"/>
                    <a:column name="employee_name" align="center" width="150"/>
                    <a:column name="start_date_active" align="center" editor="contactPersonDs_grid_editor_dp" renderer="Leaf.formatDate" width="150"/>
                    <a:column name="end_date_active" align="center" editor="contactPersonDs_grid_editor_dp" renderer="Leaf.formatDate" width="150"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="contactPersonDs_grid_editor_comb"/>
                    <a:lov id="contactPersonDs_grid_editor_lov"/>
                    <a:datePicker id="contactPersonDs_grid_editor_dp"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>