<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
	
  
  	<grid name="ebics-partner-grid" title="Ebics partner" model="com.axelor.apps.bankpayment.db.EbicsPartner" >
		<field name="partnerId" />
		<field name="ebicsTypeSelect"/>
		<field name="ebicsBank"/>
	</grid>
	
	<form name="ebics-partner-form" title="Ebics partner" onSave="action-ebics-partner-method-onsave" model="com.axelor.apps.bankpayment.db.EbicsPartner" width="large">
	
		<panel name="generalInformationPanel" title="General information">
			<field name="partnerId" help="Name of the contract/subscription" max="35" x-bind="{{partnerId|uppercase}}" pattern='^[A-Z0-9]+$'/>
			<field name="ebicsBank" />
			<field name="ebicsTypeSelect" widget="RadioSelect"/>
			<field name="testMode"/>
			<field name="transportEbicsUser" colSpan="6" domain="self.ebicsPartner.id = :id AND self.userTypeSelect = 0" form-view="ebics-user-form" grid-view="ebics-user-grid"/>
			<field name="defaultSignatoryEbicsUser" domain="self.ebicsPartner.id = :id AND self.userTypeSelect = 1"/>
		</panel>
		
		<panel name="bankStatementsPanel" title="Bank statements" colSpan="12">
			<panel-related name="bsEbicsPartnerServiceListPanel" field="bsEbicsPartnerServiceList" colSpan="12" canNew="true" grid-view="bs-ebics-partner-service-grid"
            form-view="bs-ebics-partner-service-form" editable="true" />
			<field name="bankStatementGetModeSelect" colSpan="6" widget="radio-select" x-direction="horizontal"/>
			<field name="bankStatementLastExeDateT" readonly="true" colSpan="6"/>
			<field name="bankStatementStartDate" colSpan="6" showIf="bankStatementGetModeSelect == 2"/>
			<field name="bankStatementEndDate" colSpan="6" showIf="bankStatementGetModeSelect == 2"/>
			<button name="getBankStatementBtn" title="Get the bank statements" colSpan="6" onClick="save,action-ebics-partner-method-get-bank-statement" readonlyIf="!bsEbicsPartnerServiceList"/>
			<button name="showBankStatementBtn" title="Show the bank statements" onClick="action-ebics-partner-view-show-bank-statement"/>
		</panel>

		<panel name="filterReceiverBankDetailsPanel" title="Filter Receiver Bank Details">
			<field name="filterReceiverBD"/>
			<field name="orderTypeSelect" showIf="filterReceiverBD"/>
			<field name="receiverBankDetailsSet" colSpan="12" showIf="filterReceiverBD"/>
		</panel>
		
		<panel name="paymentStatusReportPanel" title="Payment Status Report">
			<field name="usePSR" widget="boolean-switch"/>
			<field name="pSRBankStatementFileFormat" showIf="usePSR"/>
		</panel>
		
		<panel-related name="bankDetailsSetPanel" field="bankDetailsSet" colSpan="12" canNew="true" showIf="ebicsBank" hidden="true" form-view="bank-details-form" grid-view="bank-details-grid" onSelect="action-ebics-partner-method-bank-details-set-domain"/>

        <panel-related name="boEbicsPartnerServiceListPanel" field="boEbicsPartnerServiceList" colSpan="12" canNew="true" grid-view="bo-ebics-partner-service-grid"
            form-view="ebics-partner-service-form" />

		<panel-dashlet name="ebicsUsersPanel" action="action-ebics-partner-view-ebics-users"/>

	</form>
	
	
	<action-method name="action-ebics-partner-method-get-bank-statement">
		<call class="com.axelor.apps.bankpayment.ebics.web.EbicsPartnerController" method="getBankStatement"/>
	</action-method>

	<action-method name="action-ebics-partner-method-onsave">
		<call class="com.axelor.apps.bankpayment.ebics.web.EbicsPartnerController" method="checkBankDetailsSet"/>
	</action-method>
	
	<action-attrs name="action-ebics-partner-method-bank-details-set-domain">
		<attribute name="domain" for="bankDetailsSet" expr="eval: &quot; self.bank.businessPartyPrefix = '${ebicsBank?.bank?.businessPartyPrefix}' AND self.active = true &quot;"/>
	</action-attrs>
	
	<action-view name="action-ebics-partner-view-ebics-users" model="com.axelor.apps.bankpayment.db.EbicsUser" title="Ebics users">
		<view name="ebics-user-grid" type="grid"/>
		<view name="ebics-user-form" type="form"/>
		<domain>self.ebicsPartner.id = :id</domain>
	</action-view>

	<action-view name="action-ebics-partner-view-show-bank-statement" title="Bank Statement" model="com.axelor.apps.bankpayment.db.BankStatement">
		<view name="bank-statement-grid" type="grid"/>
		<view name="bank-statement-form" type="form"/>
		<domain>self.ebicsPartner.id = :id</domain>
        <context name="id" expr="eval: id"/>
	</action-view>
	
</object-views>
