Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
17 kB
3
Indexable
Never
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,forceCommunity:availableForAllPageTypes" 
					access="global" 
				controller="PaymentMethodsController">
	<aura:attribute name="isviewEsteira" type="Boolean" default="false"/>
    <aura:attribute name="quoteId" type="String"/>
    <aura:attribute name="paymentPlan" type="List"/>
    <aura:attribute name="paymentPlanInsert" type="QuotePlan__c"/>
    <aura:attribute name="PermitirCriar" type="boolean" default="true"/>
    <aura:attribute name="Formas" type="List"/>
    <aura:attribute name="Condicoes" type="List"/>
    <aura:attribute name="showSpinner" type="Boolean" default="false" />
    <aura:attribute name="Descricoes" type="List"/>
    <aura:attribute name="FaltaPagar" type="Decimal"/>
    <aura:attribute name="DescontoMaximo" type="Integer"/>
    <aura:attribute name="DescontoMaximoValor" type="Integer"/>
    <aura:attribute name="DisabledDesconto" type="Boolean" default="true" />
    <aura:attribute name="isDetailPage" type="Boolean" default="false" />
    <aura:attribute name="isRecarregarSessao" type="Boolean" default="false" />
    <aura:attribute name="loaded" type="Boolean" default="false" />
    <aura:attribute name="PaymentMethod" type="Object" default="" />
        <aura:registerEvent name="crediarioQuoteEvent" type="c:CrediarioQuoteEvent"/>
    <aura:registerEvent name="atualizarValidacaoEvent" type="c:AtualizarValidacaoEvent"/>
    <aura:attribute name="tooltip" type="Boolean" default="false" />
    <aura:attribute name="maxDiscountPercent" type="Decimal" default="0" />
    <aura:attribute name="maxDiscountValue" type="Decimal" default="0" />
    <aura:attribute name="quoteRecordType" type="String"/>
    <aura:attribute name="disableValorAPagar" type="Boolean" default="false"/>
    <aura:attribute name="creditoCliente" type="Boolean"/>
    <aura:attribute name="boletoSantander" type="Boolean"/>
    <aura:attribute name="boletoLosango" type="Boolean"/>
    <aura:attribute name="camposBancosVisiveis" type="Boolean" default="false"/>
    <aura:attribute name="nomeBanco" type="String"/>
    <aura:attribute name="storeEnable" type="Boolean"/>
    <aura:attribute name="linkPagamento" type="Boolean"/>
    <aura:attribute name="isSantanderEnabled" type="Boolean"/>
    <aura:attribute name="isLosangoEnabled" type="Boolean"/>
    <aura:attribute name="exibeLiberarBoletoProprio" type="Boolean" default="false"/>
    <aura:attribute name="isBoletoProprioLiberado" type="Boolean" default="false"/>
    <aura:attribute name="quoteStatus" type="String"/>
    <aura:attribute name="isUsuarioPJ" type="Boolean" default="false"/>

    <aura:attribute name="creditoValor" type="Decimal"/>
    <aura:registerEvent name="bancoCamposEvent" type="c:BancoCamposEvent"/>
    <aura:registerEvent name="alterarFormaPagamentoEvent" type="c:AlterarFormaPagamentoEvent"/>
    <aura:handler event="c:setCamposBancoEvent" action="{!c.setCamposBancoEvent}" />
    
    <aura:attribute name="isAddOrDelPaymentLoading" type="Boolean" default="true" />
    <aura:attribute name="quoteData" type="Object"/>
    <aura:registerEvent name="ReQueryQuote" type="c:ReQueryQuote"/>
    <aura:registerEvent name="ReCalculateDiscounts" type="c:ReCalculateDiscounts"/>

    <aura:attribute name="isDiscountCalculationLoading" type="Boolean" default="true"/>
    <aura:attribute name="discountCalculations" type="Object" default="{}"/>

    <aura:if isTrue="{!v.showSpinner}">
        <lightning:spinner />
    </aura:if>

    <aura:handler name="init" 
				  value="{!this}" 
				  action="{!c.onInit}"/>
                  
    <aura:handler name="RefreshPayments" 
                  event="c:RefreshPayments" 
                  action="{!c.reloadPaymentList}"/>
    
    <aura:handler name="change" value="{!v.paymentPlan}" action="{!c.onChangePaymentPlan}"/>

    <aura:attribute name="showTable" type="boolean" default="false"/>
	<aura:attribute name="desabilitarDesconto"	type="Boolean" />

    <aura:handler name="change" value="{!v.paymentPlan}" action="{!c.checkVisibleTable}"/>
    <aura:handler name="change" value="{!v.FaltaPagar}" action="{!c.onChangeFaltaPagar}"/>
    
    <aura:method name="runAfterReloadQuote" action="{!c.runAfterReloadQuote}" access="public" />

    <div class="slds-card__body">
        <div class="slds-grid slds-grid_vertical">
            <div class="slds-col colMethodList">
                <aura:if isTrue="{!v.isRecarregarSessao}">
                    <div onclick="{!c.getClossSession}">
                        <ui:message title="Análise de Crédito" severity="error"  closable="true">
                            Clique no botão <b>Atualizar Status da Análise</b> na sessão <b>Análise de Crédito</b> para carregar as informações consultadas da análise.
                        </ui:message>
                    </div>
                </aura:if>
                
                <aura:if isTrue="{!!v.isDetailPage}">
                    <div class="boxInsertCondicoes">
                        <lightning:input 
                                        aura:id ="faltaPagar"
                                        label="Valor a Pagar"
                                        type="number"
                                        formatter="currency" 
                                        min="0"
                                        step="0.01" 
                                        class="inputCondicoes"
                                        value="{!v.FaltaPagar}"
                                        disabled="{!v.disableValorAPagar}"/>
                        
                        <lightning:select aura:id="forma" class="selectCondicoes" label="Forma de Pagamento" name="Método" value="{!v.paymentPlanInsert.Forma_de_Pagamento__c}" onchange="{!c.getCondicoesJS}">
                            <aura:iteration items="{!v.Formas}" 
                                            var="Forma">
                                <option value="{!Forma}">{!Forma}</option>
                            </aura:iteration>
                        </lightning:select>
                        
                        <lightning:select aura:id="condicoes" class="selectCondicoes" label="Parcelamento" name="Número de Vezes" value="{!v.paymentPlanInsert.Condi_o_de_Pagamento__c}" onchange="{!c.getDescricoesJS}">
                            <aura:iteration items="{!v.Condicoes}" 
                                            var="Condicoes">
                                <option value="{!Condicoes}">{!Condicoes}</option>
                            </aura:iteration>
                        </lightning:select>
                        
                        <lightning:select aura:id="descricoes" class="selectCondicoes" label="Descrição" name="Descrição" value="{!v.paymentPlanInsert.Descricao__c}" onchange="{!c.getDescontoMaximoJS}">
                            <aura:iteration items="{!v.Descricoes}" 
                                            var="Descricoes">
                                <option value="{!Descricoes}">{!Descricoes}</option>
                            </aura:iteration>
                        </lightning:select>

                        <div class="custom-div">
                            <div class="custom-label">
                                <label class="slds-form-element__label slds-no-flex">
                                    <span>Desconto %</span>
                                </label>
                                <aura:if isTrue="{!and(or(!v.DisabledDesconto, v.quoteRecordType == 'Vendas Corporativas'), v.maxDiscountPercent > 0)}">
                                    <lightning:helptext content="{!'Desconto máximo permitido: ' + v.maxDiscountPercent + '%'}" />
                                </aura:if>
                            </div>
                            <lightning:input aura:id ="descontoCondicaoPagamento"
                                             label="Desconto %"
                                             variant="label-hidden" 
                                             type="number"
                                             min="0"
                                             step="0.01" class="inputCondicoes"
                                             value= "{!v.DescontoMaximo}"
                                             disabled="{!v.DisabledDesconto}"
                                             onchange="{!c.formPress}"/>
                        </div>

                        <div class="custom-div">
                            <div class="custom-label">
                                <label class="slds-form-element__label slds-no-flex">
                                    <span>Desconto (R$)</span>
                                </label>
                                <aura:if isTrue="{!and(or(!v.DisabledDesconto, v.quoteRecordType == 'Vendas Corporativas'), v.maxDiscountValue > 0)}">
                                    <lightning:helptext content="{!'Desconto máximo permitido: R$ ' + v.maxDiscountValue}" />
                                </aura:if>
                            </div>
                            <lightning:input aura:id ="descontoValorCondicaoPagamento"
                                             label="Desconto (R$)"
                                             variant="label-hidden" 
                                             type="number"
                                             formatter="currency" 
                                             min="0"
                                             step="0.01" class="inputCondicoes"
                                             value= "{!v.DescontoMaximoValor}"
                                             disabled="{!v.DisabledDesconto}"
                                             onchange="{!c.formPress}" />
                        </div>

						<!--
                        <lightning:input aura:id ="descontoCondicaoPagamento"
                                         label="Desconto %"
                                         type="number"
                                         min="0"
                                         step="0.01" class="inputCondicoes"
                                         value= "{!v.DescontoMaximo}"
                                         disabled="{!v.DisabledDesconto}"
                                         onchange="{!c.formPress}"/>

                        <lightning:input aura:id ="descontoValorCondicaoPagamento"
                                         label="Desconto (R$)"
                                         type="number"
                                         formatter="currency" 
                                         min="0"
                                         step="0.01" class="inputCondicoes"
                                         value= "{!v.DescontoMaximoValor}"
                                         disabled="{!v.DisabledDesconto}"
                                         onchange="{!c.formPress}" />
						-->

                        <lightning:button aura:id="addBtn"
                                          variant="neutral" 
                                          label="Adicionar"
                                          onclick="{!c.addNewPlanJS}"/>
                    </div>
                </aura:if>
                <aura:if isTrue="{! OR(v.showTable, v.isAddOrDelPaymentLoading)}">
                    <table class="{!v.isDetailPage ? 'slds-table slds slds-table_bordered table_method_list_detail slds-no-row-hover' : 'slds-table slds slds-table_bordered table_method_list slds-no-row-hover'}">
                        <thead>
                            <tr class="slds-line-height_reset">
                                <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                    <div class="slds-truncate" title="Valor" width="10%">Valor</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps"  scope="col">
                                    <div class="slds-truncate" title="Método de Pagamento" width="20%">Forma Pag.</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps"  scope="col">
                                    <div class="slds-truncate" title="Parcelas" width="10%">Parcela</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps"  scope="col">
                                    <div class="slds-truncate" title="Descrição" width="20%">Descrição</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps"  scope="col">
                                    <div class="slds-truncate" title="Acréscimo" width="20%">Acréscimo</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                    <div class="slds-truncate" title="Valor de Desconto">Desconto</div>
                                </th>                     
                                <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                    <div class="slds-truncate" title="Valor da Parcela">Val. Parcela</div>
                                </th>
                                <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                    <div class="slds-truncate" title="Total Corrigido" width="20%">Total</div>
                                </th>
                                <aura:if isTrue="{!v.isviewEsteira}">
                                    <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                        <div class="slds-truncate" title="Criado AN.Crédito" width="20%">Criado AN.Crédito</div>
                                    </th>
                                </aura:if>
                                <aura:if isTrue="{!and(v.storeEnable, v.linkPagamento)}">
                                    <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                        <div class="slds-truncate" title="NSU" width="20%">NSU</div>
                                    </th>
                                    <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                        <div class="slds-truncate" title="Confirmacao de Pag." width="20%">Confirmação de Pag.</div>
                                    </th>
                                </aura:if>
                                <th class="slds-is-resizable slds-text-title_caps" scope="col">
                                </th>
                            </tr>
                        </thead>
                        
                        <tbody style="{! if(!v.showTable, 'position: relative; height: 31px;', 'position: relative;') }">
                            <aura:if isTrue="{!v.isAddOrDelPaymentLoading}">
                                    <lightning:spinner style="min-height: 31px;" size="small"/>
                            </aura:if>

                            <aura:iteration items="{!v.paymentPlan}" 
                                            var="Metodo" 
                                            indexVar="index">
                                <c:PaymentMethodLine 
                                                    quoteId="{!v.quoteId}"
                                                    paymentPlan="{!Metodo}"
                                                    PermitirCriar="{!v.PermitirCriar}"
                                                    Formas="{!v.Formas}"
                                                    Condicoes="{!v.Condicoes}"
                                                    isDetailPage="{!v.isDetailPage}"
                                                    nomeBanco="{!v.nomeBanco}"
                                                    storeEnable="{!v.storeEnable}"
                                                    linkPagamento="{!v.linkPagamento}"
                                                    isAddOrDelPaymentLoading="{!v.isAddOrDelPaymentLoading}"/>
                            </aura:iteration>
                        </tbody>
                    </table>
                </aura:if>
            </div>
        </div>
        <!-- Check liberacao boleto proprio -->
        <aura:if isTrue="{!v.exibeLiberarBoletoProprio}">
            <div class="liberacaoBoletoProrprio">
                <lightning:input type="checkbox" aura:id="liberarBoletoProprio" label="Liberar boleto próprio" onchange="{!c.handleLiberarBoletoProprio}" value="{!v.isBoletoProprioLiberado}" checked="{!v.isBoletoProprioLiberado}" />
            </div>
        </aura:if>
    </div>

</aura:component>
Leave a Comment