<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="affil" section="in-commerce:affiliates" title_preset="affiliates_edit" tab_preset="Default"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">
				a_toolbar = new ToolBar();
				a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
						submit_event('affil','<inp2:affil_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
						submit_event('affil','OnCancelEdit');
						}
				 ) );

				a_toolbar.AddButton( new ToolBarSeparator('sep1') );

				a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
							go_to_id('affil', '<inp2:affil_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('affil', '<inp2:affil_NextId/>');
						}
				 ) );

				<inp2:m_if check="affil_IsNewMode" inverse="inverse">
					a_toolbar.AddButton( new ToolBarSeparator('sep2') );

					a_toolbar.AddButton( new ToolBarButton('in-commerce:pay_out', '<inp2:m_phrase label="la_ToolTip_PayOut" escape="1"/>', function() {
						direct_edit('affil', '<inp2:m_t t="in-commerce/affiliate_plans/affiliates_payout" m_opener="d" apayments_event="OnNew" pass="all,apayments"/>');
						}
					) );
				</inp2:m_if>

				a_toolbar.Render();

				<inp2:m_if check="affil_IsSingle" >
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
					//a_toolbar.HideButton('sep2');
				<inp2:m_else/>
					<inp2:m_if check="affil_IsLast" >
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="affil_IsFirst" >
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:affil_SaveWarning name="grid_save_warning"/>
<inp2:affil_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="la_section_General"/>
			<inp2:m_RenderElement name="inp_id_label" prefix="affil" field="AffiliateId" title="la_fld_Id"/>
			<inp2:m_RenderElement name="inp_edit_user" prefix="affil" field="PortalUserId" title="la_fld_Username"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="affil" field="AffiliatePlanId" title="la_fld_AffiliatePlan"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="affil" field="PaymentTypeId" title="la_fld_PaymentType"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="affil" field="SSN" title="la_fld_SSN" />
			<inp2:m_RenderElement name="inp_edit_radio" prefix="affil" field="Status" title="la_fld_Status"/>
			<inp2:m_RenderElement name="inp_edit_date" prefix="affil" field="CreatedOn" title="la_fld_RegisteredOn" />
			<inp2:m_RenderElement name="inp_edit_textarea" prefix="affil" field="Comments" title="la_fld_Comments" cols="40" rows="5"/>

			<inp2:m_if check="affil_IsNewMode" inverse="inverse">
				<inp2:m_RenderElement name="subsection" title="la_section_AdvertisingMaterials"/>
					<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
						<inp2:m_inc param="tab_index" by="1"/>
						<td class="label-cell">
							<inp2:m_phrase label="la_fld_AffiliateLink"/>:
						</td>
						<td class="control-mid">&nbsp;</td>
						<td class="control-cell">
							<a href="<inp2:affil_GetAffiliateLink template='index'/>" target="_blank"><inp2:affil_GetAffiliateLink template="index" prefix="_FRONT_"/></a>
						</td>
					</tr>
					<inp2:m_RenderElement name="inp_label" prefix="affil" field="AffiliateCode" title="la_fld_AffiliateCode"/>

				<inp2:m_RenderElement name="subsection" title="la_section_Statistics"/>
					<inp2:m_RenderElement name="inp_label" prefix="affil" field="AccumulatedAmount" title="la_fld_AccumulatedAmount" currency="selected"/>
					<inp2:m_RenderElement name="inp_label" prefix="affil" field="ItemsSold" title="la_fld_ItemsSold"/>
					<inp2:m_RenderElement name="inp_label" prefix="affil" field="AmountToPay" title="la_fld_AmountToPay" currency="selected"/>
					<inp2:m_RenderElement name="inp_label" prefix="affil" field="LastPaymentDate_date" title="la_fld_LastPaymentDate"/>
			</inp2:m_if>
		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<inp2:m_include t="incs/footer"/>