<?xml version="1.0" encoding="UTF-8"?>
<!--
 * This file is part of FacturaScripts
 * Copyright (C) 2017-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * @author Artex Trading sa     <jcuello@artextrading.com>
 * @author Carlos García Gómez  <carlos@facturascripts.com>
-->
<view>
    <columns>
        <group name="data" numcolumns="12">
            <column name="code" description="optional" display="none" numcolumns="2" order="100">
                <widget type="text" fieldname="codcliente" icon="fa-solid fa-hashtag" maxlength="10" readonly="dinamic"/>
            </column>
            <column name="name" description="desc-customer-name" order="110">
                <widget type="text" fieldname="nombre" maxlength="100" required="true"/>
            </column>
            <column name="fiscal-mode" title="type" numcolumns="2" order="120">
                <widget type="select" fieldname="personafisica" translate="true" required="true">
                    <values title="is-person">1</values>
                    <values title="company">0</values>
                </widget>
            </column>
            <column name="fiscal-id" titleurl="EditSettings?activetab=EditIdentificadorFiscal" numcolumns="2" order="130">
                <widget type="select" fieldname="tipoidfiscal" required="true">
                    <values source="idsfiscales" fieldcode="tipoidfiscal" fieldtitle="tipoidfiscal"/>
                </widget>
            </column>
            <column name="fiscal-number" numcolumns="2" order="140">
                <widget type="text" fieldname="cifnif" maxlength="30"/>
            </column>
        </group>
        <group name="contact" title="contact-info" numcolumns="12">
            <column name="business-name" description="desc-business-name" numcolumns="3" order="90">
                <widget type="text" fieldname="razonsocial" maxlength="100"/>
            </column>
            <column name="billing-address" numcolumns="3" order="100">
                <widget type="select" fieldname="idcontactofact" onclick="EditContacto"/>
            </column>
            <column name="phone" numcolumns="2" order="110">
                <widget type="text" fieldname="telefono1" maxlength="30" icon="fa-solid fa-phone"/>
            </column>
            <column name="phone2" numcolumns="2" order="120">
                <widget type="text" fieldname="telefono2" maxlength="30" icon="fa-solid fa-mobile-alt"/>
            </column>
            <column name="fax" display="none" numcolumns="2" order="130">
                <widget type="text" fieldname="fax" maxlength="30" icon="fa-solid fa-fax"/>
            </column>
            <column name="email" numcolumns="2" order="140">
                <widget type="email" fieldname="email" maxlength="100" icon="fa-solid fa-envelope"/>
            </column>
            <column name="shipping-address" numcolumns="3" order="150">
                <widget type="select" fieldname="idcontactoenv" onclick="EditContacto"/>
            </column>
            <column name="website" display="none" numcolumns="2" order="160">
                <widget type="link" fieldname="web" maxlength="100"/>
            </column>
            <column name="language" numcolumns="3" order="170">
                <widget type="select" fieldname="langcode" icon="fa-solid fa-language">
                    <values/>
                </widget>
            </column>
            <column name="creation-date" numcolumns="2" order="180">
                <widget type="date" fieldname="fechaalta" readonly="true"/>
            </column>
            <column name="date-of-suspension" numcolumns="2" order="190">
                <widget type="date" fieldname="fechabaja"/>
            </column>
        </group>
        <group name="comercial" title="commercial-terms" numcolumns="12">
            <column name="agent" titleurl="ListAgente" numcolumns="2" order="100">
                <widget type="select" fieldname="codagente" onclick="EditAgente" icon="fa-solid fa-user-tie">
                    <values source="agentes" fieldcode="codagente" fieldtitle="nombre"/>
                </widget>
            </column>
            <column name="rate" titleurl="ListTarifa" numcolumns="2" order="110">
                <widget type="select" fieldname="codtarifa" onclick="EditTarifa">
                    <values source="tarifas" fieldcode="codtarifa" fieldtitle="nombre"/>
                </widget>
            </column>
            <column name="group" titleurl="ListCliente?activetab=ListGrupoClientes" numcolumns="2" order="120">
                <widget type="select" fieldname="codgrupo" onclick="EditGrupoClientes">
                    <values source="gruposclientes" fieldcode="codgrupo" fieldtitle="nombre"/>
                </widget>
            </column>
            <column name="serie" titleurl="ListSerie" numcolumns="2" order="130">
                <widget type="select" fieldname="codserie" onclick="EditSerie">
                    <values source="series" fieldcode="codserie" fieldtitle="descripcion"/>
                </widget>
            </column>
            <column name="payment-method" titleurl="ListFormaPago" numcolumns="2" order="140">
                <widget type="select" fieldname="codpago" onclick="EditFormaPago">
                    <values source="formaspago" fieldcode="codpago" fieldtitle="descripcion"/>
                </widget>
            </column>
            <column name="payment-days" description="desc-payment-days" numcolumns="2" order="150">
                <widget type="text" fieldname="diaspago"/>
            </column>
            <column name="current-risk" numcolumns="2" order="160">
                <widget type="money" fieldname="riesgoalcanzado" readonly="true"/>
            </column>
            <column name="max-risk" numcolumns="2" order="170">
                <widget type="money" fieldname="riesgomax" min="0"/>
            </column>
            <column name="vat-regime" numcolumns="2" order="180">
                <widget type="select" fieldname="regimeniva" required="true"/>
            </column>
            <column name="operation" numcolumns="2" order="185">
                <widget type="select" fieldname="operacion">
                    <values/>
                </widget>
            </column>
            <column name="vat-exception" numcolumns="2" order="190">
                <widget type="select" fieldname="excepcioniva">
                    <values/>
                </widget>
            </column>
            <column name="retention" titleurl="ListImpuesto?activetab=ListRetencion" numcolumns="2" order="200">
                <widget type="select" fieldname="codretencion" onclick="EditRetencion">
                    <values source="retenciones" fieldcode="codretencion" fieldtitle="descripcion"/>
                </widget>
            </column>
            <column name="subaccount" description="customer-subaccount-p" titleurl="ListCuenta" display="none" numcolumns="2" order="210">
                <widget type="text" fieldname="codsubcuenta" maxlength="15" icon="fa-solid fa-balance-scale"/>
            </column>
        <column name="exclude-347" order="205" numcolumns="2">
                <widget type="select" fieldname="excluir347" translate="true" required="true">                
                    <values title="no">0</values>
                    <values title="yes">1</values>
                </widget>
            </column></group>
        <group name="notes" numcolumns="12">
            <column name="observations" order="100">
                <widget type="textarea" fieldname="observaciones"/>
            </column>
        </group>
    </columns>
    <rows>
        <row type="statistics">
            <datalabel icon="fa-solid fa-copy" label="pending-orders-button" function="getOrdersRisk"/>
            <datalabel icon="fa-solid fa-copy" label="delivery-notes-button" function="getDeliveryNotesRisk"/>
            <datalabel icon="fa-solid fa-money-bill-alt" label="pending-invoices-button" function="getInvoicesRisk"/>
        </row>
    </rows>
</view>
