Could you point how to make a CakePHP $this->element to be linked to a jQuery code?

Hi Experts

Could you point how to make a CakePHP  $this->element to be linked to a jQuery code?

Accordingly to

...
echo $this->element('Buttons/btn-lock', ['url' => [] ] );

Open in new window


To run this:
<script type="text/javascript">

	function ativarVendedor(id, acao){

		$.confirm({
		    title: 'Atenção!',
		    content: 'Deseja realmente ' + acao + ' o vendedor?',
		    buttons: {
		        confirmar: function() {

		        	$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
		        		console.log('teste');
					}, 'json');
		        	location.reload();

		        },
		        cancelar: function() {
		            $.alert('Ação cancelada!');
		        }
		    }
		});

	}

</script>

Open in new window



Thanks in advance!
Eduardo FuerteDeveloper and AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Give your element a class and then link that with a jQuery bind event

$('.yourClassHere').on('click', function() {
   var id = ''; // Populate as required
   var acao = ''; // Populate as required
   ativarVendedor(id, acao)
});

Open in new window

0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Hi Julian

On this specific case the action must to be done on a CakePHP element - your code consider a HTML class and jQuery, ok?
0
Julian HansenCommented:
What is a CakePHP element?

This is just an abstraction that results in HTML right?

When it gets to the browser - there is no more cakePHP - only HTML and JavaScript.

In JavaScript we bind our code to the elements and events that exist in (and are generated by) the HTML document.

What does that code look like when it gets to the browser?
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

leakim971PluritechnicianCommented:
following @Julian Hansen example :
echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'yourClassHere' ] );
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Hi

Trying the use of CakePHP elements to be inline with this project.

Running code:
// View code
<?= $this->element('Buttons/btn-delete', ['url' => ['action' => 'delete', $vendedor->id], 'id' => $vendedor->id, 'disabled' => $isCadastrosFinalizados ]); ?>

// btn-delete.ctp    
<?php
echo $this->Form->postLink('<i class="fas fa-trash-alt"></i>', $url, ['confirm' => __('Deseja realmente excluir o registro # {0}?', $id), 'title' => 'Excluir', 'class' => 'btn btn-outline-secondary btn-sm', 'escape' => false, 'disabled' => $disabled]);

Open in new window


My try, by analogy

// This code fires a CakePHP action code
 <?= $this->element('Buttons/btn-lock', ['url' => [], 'class' => "ativarVendedor('{$vendedor->id}', 'desativar');" ] ); ?>

btn-lock.cpt
echo $this->Form->postLink('<i class="fas fa-trash-alt"></i>', $url, ['ativarVendedor' => __('Deseja realmente alterar o status  do registro # {0} {1}?', $id), 'title' => 'Excluir', 'class' => 'btn btn-outline-secondary btn-sm', 'escape' => false, 'disabled' => $disabled]);

Open in new window

Could you have a look?
0
Julian HansenCommented:
I am not sure what are we looking for?

Can you show us what code is generated by this?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Would you like a  inspect the browser code or the view's code?
0
Julian HansenCommented:
What is in the browser - need to see what is rendered.
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Here is the relevant part of the code renderized....

I couldn't find a way to directly copy the code...

img001
img002
img003img_ee_003_090518.png
0
Julian HansenCommented:
I couldn't find a way to directly copy the code...
Ctrl + A
Ctrl + C
Then in EE Ctrl + V

What am I looking for in the images - which part is the element that you are interested in?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
I attempt to copy this way... the elements pane doesn't allow to do that in my case.

The relevant code is:
img004
Visually
img005
0
leakim971PluritechnicianCommented:
just do a right click on this <html class="inlinesvg"> tag and choose copy, copy outer html

copy
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Much better...

Here it is.
<html class=" js-inlinesvg"><head>
    <meta charset="utf-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vendedores - xxxx Club Exclusive</title>
    <link href="/xxxx_exclusive2018/favicon.ico?1521755242" type="image/x-icon" rel="icon"><link href="/xxxx_exclusive2018/favicon.ico?1521755242" type="image/x-icon" rel="shortcut icon">

        
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/layout/main.css?1525368960">
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/layout/interna.css?1525099291">
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/admin.css?1525298141">
            <script>var base_url = '/xxxx_exclusive2018/';</script>
    </head>
<body class="l-admin p-admin c-vendedores a-index">
            
<div id="menu-xxxxclub" class="menu-sup-preto">
    <div class="container">
        <div class="row nav justify-content-end align-items-center">
            <div class="col-5 col-ola">
                Olá! Você esta logado como: <strong>ADMIN xxxx</strong>
            </div>
            <!-- /.col-5 -->
            <div class="col-2 col-pontos">
                            </div>
            <!-- /.col-2 col-pontos -->
            <div class="col-2 col-sair d-flex justify-content-end align-items-center">
                <a href="/xxxx_exclusive2018/login/logout" class="btn-sair"><svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" viewBox="0 0 500 500" class="svg inlined-svg" role="img" aria-labelledby="title"><title></title><path clip-rule="evenodd" d="M68.29,431.711c0,20.078,16.264,36.34,36.343,36.34h290.734  c20.078,0,36.345-16.262,36.345-36.34V250c0-20.079-16.267-36.342-36.345-36.342H177.317v-63.597  c0-40.157,32.525-72.685,72.683-72.685c40.158,0,72.685,32.528,72.685,72.685v4.541c0,12.538,10.176,22.715,22.711,22.715  c12.537,0,22.717-10.177,22.717-22.715v-4.541c0-65.232-52.882-118.111-118.112-118.111c-65.24,0-118.111,52.879-118.111,118.111  v63.597h-27.256c-20.079,0-36.343,16.263-36.343,36.342V431.711z M213.658,313.599c0-20.078,16.263-36.341,36.342-36.341  s36.341,16.263,36.341,36.341c0,12.812-6.634,24.079-16.625,30.529c0,0,3.55,21.446,7.542,46.699  c0,7.538-6.087,13.625-13.629,13.625h-27.258c-7.541,0-13.627-6.087-13.627-13.625l7.542-46.699  C220.294,337.678,213.658,326.41,213.658,313.599z" fill="#010101" fill-rule="evenodd"></path></svg> Sair</a>
            </div>
            <!-- /.col-2 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container -->
</div>
<!-- /#menu-xxxxclub -->        <nav id="menu-superior" class="navbar navbar-expand-lg navbar-light">
    <div class="container">
        <a href="/xxxx_exclusive2018/" class="navbar-brand"><img src="/xxxx_exclusive2018/exclusive2018/img/logo.svg?1522860836" alt=""></a>        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNavDropdown">
            <p class="area-restrita d-lg-none">
                <a href="/xxxx_exclusive2018/login/logout">Sair</a>            </p>
            <ul class="navbar-nav">
                                        <li id="ni-escritorios" class="nav-item"><a href="/xxxx_exclusive2018/admin/escritorios" class="nav-link">Escritórios</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-especificadores" class="nav-item"><a href="/xxxx_exclusive2018/admin/especificadores" class="nav-link">Especificadores</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-vendedores" class="nav-item active"><a href="/xxxx_exclusive2018/admin/vendedores" class="nav-link">Vendedores</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-vendas" class="nav-item"><a href="/xxxx_exclusive2018/admin/vendas" class="nav-link">Vendas</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-lojistas" class="nav-item"><a href="/xxxx_exclusive2018/admin/lojas" class="nav-link">Lojistas</a></li>
                <li class="nav-divider"></li>
                        <li class="ni-rankings nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Rankings </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <a href="/xxxx_exclusive2018/admin/especificadores/ranking" class="dropdown-item">Especificadores</a>                                            <a href="/xxxx_exclusive2018/admin/vendedores/ranking" class="dropdown-item">Vendedores</a>                                            <a href="/xxxx_exclusive2018/admin/lojas/ranking" class="dropdown-item">Lojistas</a>                                            <a href="/xxxx_exclusive2018/admin/lojas/ranking-pontuacao-grupo" class="dropdown-item">Ranking Pontuação</a>                                    </div>
            </li>
                <li class="nav-divider"></li>
                        <li class="ni-relatorios nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Relatórios </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <a href="/xxxx_exclusive2018/admin/vendas/total-vendas-mes" class="dropdown-item">Total Vendas/Mês</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/total-especificadores-cadastrados-mes" class="dropdown-item">Especificadores Cadastrados/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/vendas/valor-vendas-mes" class="dropdown-item">Valor Vendas/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/valor-vendas-especificadores-mes" class="dropdown-item">Arquitetos Pontuando/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/valor-vendas-especificadores-ano" class="dropdown-item">Arquitetos Pontuando/Ano</a>                                            <a href="/xxxx_exclusive2018/admin/vendas/quantidade-especificadores-pontuando-mes" class="dropdown-item">Quantos Especificadores Compraram/ Mês</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/cadastro-pontos" class="dropdown-item">Cadastro X Pontos</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/comparativo" class="dropdown-item">Comparativo 2015/2016/2017</a>                                    </div>
            </li>
                <li class="nav-divider"></li>
                </ul>
            <!-- /.navbar-nav -->
        </div>
        <!-- /#navbarNavDropdown.collapse navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<!-- /#menu-superior -->    

        <div class="interna">
        <div class="pontuacao-mobile justify-content-end">
                    </div>
        <!-- /.pontuacao-mobile -->
        <div class="topo">
            <h1>Vendedores</h1>
        </div>
        <!-- /.topo -->
        <div class="container">

            



                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="/xxxx_exclusive2018">Home</a></li><li class="breadcrumb-item active"><span>Vendedores</span></li>
                        </ol>
                    </nav>
                    
<div class="vendedores-admin">
	<div class="row row-filtros">
		<div class="cont-acao col-12 col-md-4 col-xl-12" style="justify-content: start;">
			<a href="/xxxx_exclusive2018/admin/vendedores/add" class="btn-add"><i class="fas fa-file-excel"></i> EXPORTAR</a>		</div><!-- /.cont-acao col-12 -->
        
   
		<div class="search col-12 col-md-8 col-xl-12">
			<form method="get" accept-charset="utf-8" class="form-busca" action="/xxxx_exclusive2018/admin/vendedores">				<div class="row">

					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<select name="loja_id" class="dropdown-periodos dropdown-busca"><option value="">Selecione uma loja</option><option value="93">Agaé / Tirol</option><option value="34">Akabamentos / Vila Harmonia</option><option value="141">Aldeia Acabamentos  / Setor Sul</option><option value="223">All Banho / Vila Gomes Cardim</option><option value="142">ALLGRAM SA COM EXP IMP PISOS R ART DE DECOR LTDA EPP / Vila Reg. Feijo</option><option value="204">Aquarela / Chapada</option><option value="144">Aquarius Acabamentos  / Jardim Maria Jose</option><option value="228">Araucária Acabamentos / Jardim Novo Horizonte</option><option value="209">Armazém Cerâmico / Vila Staff</option><option value="104">Arquint Acabamentos / Urbanova</option><option value="218">ART PEDRAS / Dom Pedro I</option><option value="229">Arte E Banho / Caminho das Árvores</option><option value="107">Atacon Design / Lagoa Seca</option><option value="29">Banho&amp;Metal / Jardins</option><option value="242">Barotti Design  / Centro</option><option value="41">Bel Lar Acabamentos / Carlos Prates</option><option value="108">Bel Lar Acabamentos / Santa Lúcia</option><option value="176">Belissimo Banheiros / Sion</option><option value="109">Bella Casa Acabamentos / Centro</option><option value="145">Bello Bagno / Floresta</option><option value="146">Bello Bagno / Centro</option><option value="147">Bello Bagno / Desvio Rizzo</option><option value="148">Bello Bagno Decor  / Muinhos de Vento</option><option value="221">Bello Banho / Centro</option><option value="170">Bhan Shop / Moema</option><option value="149">Bigolin / Jardim Petropolis</option><option value="236">Boa Vista Pisos E Acabamentos Concept / Nossa Senhora Aparecida</option><option value="163">Bollpi / Vila Reg. Feijo</option><option value="231">Bonatto / Carmo</option><option value="230">Bonatto Reserva  / Santo Antônio</option><option value="243">Brazxxxx / Copacabana</option><option value="135">C&amp;T Acabamentos / Centro</option><option value="150">Camatti Acabamentos / Jardim Itália</option><option value="138">Casa &amp; Arte / Centro</option><option value="220">Casa Arquitetura / Calhau</option><option value="69">Casa Bonita / Ibituruna</option><option value="153">Casa dos Construtores / Jardim Soto</option><option value="154">Casa dos Construtores / Vila Elvira</option><option value="155">Casa Pinezi / Santa Paula</option><option value="195">CASA R ACABAMENTOS ESPECIAIS / Jardim do Prado</option><option value="199">Casa Rara / Jardim Lopes da Silva </option><option value="225">Casa Serra Acabamentos / Centro</option><option value="63">Casa Show / Salesianos</option><option value="50">Casa Vip / Treze De Julho</option><option value="59">Center Banho / Jardim Paris</option><option value="22">Cerqueira Stylo / Sta. Mônica</option><option value="239">Cimcal Materias de Construção  / Santo Antônio</option><option value="112">COMAPA DESIGN / Vila Aurora</option><option value="23">Combinare Pisos E Acabamentos / CENTRO</option><option value="156">Compose Revestimento / Santa Lucia</option><option value="157">Compose Revestimento / Planalto De Carapina</option><option value="216">Conceitual Prime Acabamentos / Vila Araponguinha</option><option value="217">Conceitual Prime Acabamentos / Bela Suiça</option><option value="160">Condec Premium / Jardim Estadio</option><option value="219">Confort Banho / Itaim Bibi</option><option value="1">Construdomus / Pinheiros</option><option value="224">Construmarques / Vila Sonia</option><option value="158">De Huber / Sumaré</option><option value="61">Decorbanho / Cambuí</option><option value="6">DECORBANHO - ALPHASHOPPING / Alphaville Industria</option><option value="3">DECORBANHO - ARAGUAIA / Alphaville Industrial</option><option value="113">Decorpisos / América</option><option value="130">DELINEAR / Candeias</option><option value="18">Dema Revestimentos E Acabamentos / Cidade Alta</option><option value="19">Dema Revestimentos E Acabamentos / Sanvitto</option><option value="240">Design Portinari / Jundiaí</option><option value="186">Detalhes Acabamentos / Centro</option><option value="100">Dm Design / Cidade Jardim</option><option value="33">DOLCE BAGNO ACABAMENTOS / Jardim Bongiovani</option><option value="159">Domicile Acabambentos / Fragata</option><option value="194">DPTO BOUTIQUE / </option><option value="21">Dr Hidráulica / Centro</option><option value="27">ECO PORTINARI / VILA ALTINOPOLIS</option><option value="65">Ecoville Design / Vila Vianelo</option><option value="39">Ekologika / Centro</option><option value="114">Elementus / Parque Francal</option><option value="241">Emidio Pais  / Santa Lúcia</option><option value="115">Empório Casa / Pereira Lobo</option><option value="85">Empório Revestir / Água Fria</option><option value="46">Empporium Frei Caneca / Barra Da Tijuca</option><option value="87">Empporium Frei Caneca / Ipanema</option><option value="235">Época Decorações / Conj Mariana</option><option value="134">Espaço Impermix / Rebouças</option><option value="98">Espaço Revest / Calhau</option><option value="161">Espaço Revestir / Bogilar</option><option value="43">Fonseca Shop Acabamentos Especiais  / Caminho Das árvores</option><option value="26">Galleria Acabamentos / Santa Terezinha</option><option value="132">Grupo Primeira Linha / Jardim Bela Vista</option><option value="95">Grupo Tempos / Olaria</option><option value="36">Guaporé / Taquaral</option><option value="37">Guaporé / Cambuí</option><option value="125">Guaporé / Nova Campinas</option><option value="7">H. Brilho / Morumbi</option><option value="8">HIDROFORMA / Batel</option><option value="9">Hidrolar / Pinheiros</option><option value="118">Horus Acabamentos / Santa Paula</option><option value="123">Ibraildo / Varadouro</option><option value="17">Ideale Acabamentos / Lourdes</option><option value="238">IMPERMIX / Batel</option><option value="167">Inovar Acabamentos / Medianeira</option><option value="166">Inovar Acabamentos - Matriz  / Vila Rosa</option><option value="232">Inpernal  / Pina</option><option value="222">Intimee / Vila Guilherme</option><option value="174">Ipiranga Acabamentos Material de Construção / Vila Aristarcho</option><option value="168">J T Esquadrias / Figueira</option><option value="96">J. Monte Premium / Ininga</option><option value="71">Jv Boutique / Tiradentes</option><option value="16">Ladrilhart / Floresta</option><option value="12">LELIS DESIGN / Moema</option><option value="51">Linha Direta Acabamentos / Jardim Girassol</option><option value="52">Linha Direta Acabamentos / Jardim Elite</option><option value="53">Linha Direta Acabamentos / Jd Porto Real</option><option value="177">Metal  / Dionisio Torrer</option><option value="178">Metal Nobre Arte e Acabamento / Martins</option><option value="202">Metallo / Aparecida</option><option value="127">Normatel Premium / Dionisio Torres</option><option value="55">Obra De Arte Acabamentos / Sta Luiza</option><option value="128">OBRA FÁCIL / Imirim</option><option value="234">Obra Facil - Itaim  / Vila Nova Conceição</option><option value="196">Obra Fácil - Pinheiros / Pinheiros</option><option value="180">Olni Acabamentos / Praia Do Ponta Da Cruz</option><option value="201">Onda decoração / PINA</option><option value="121">Ornamentare Acabamentos / Pinheiros</option><option value="122">Padovani Conceito / Vila PadreBento</option><option value="136">PARQUE ELÉTRICO / Centro</option><option value="208">Pavimenti / Caminho Das Árvores</option><option value="24">Pizzotti Design / Jardim Das Nações</option><option value="25">Pleno Reventimentos / Boa Viagem</option><option value="253">PONTO BELLO ACABAMENTOS / Santa Maria</option><option value="5">PORTOBELLO SHOP / Industrial</option><option value="103">Positano / Jardim América</option><option value="133">Prisma Revestimentos / Centro</option><option value="137">ProFatto / Agronômica</option><option value="42">RED xxxx / Vila Gomes Cardim</option><option value="10">Redh Hidrolar / Perdizes</option><option value="68">REFINARE REVESTIMENTO / Aflitos</option><option value="129">Refinare Revestimento / Boa Viagem</option><option value="207">REFINARE REVESTIMENTO / Maurício de Nassau</option><option value="182">Requintte Louças e  Metais / Vila Nova</option><option value="233">Requintte Louças E  Metais / Vila Nova</option><option value="169">Resende Acabamentos / Ipiranga</option><option value="152">Revest Acabamentos / Zona 7</option><option value="203">Revestimentta / Macuco</option><option value="13">Sadh xxxx / Jardim Do Mar</option><option value="192">Safira Revestimentos Metais e Louças / Campinas</option><option value="140">São Geraldo Acabamentos e Complemetos  / Zona Industrial</option><option value="105">Serra Dos Pinhos Supreme / Vila Abernessia</option><option value="111">Simmetria Acabamentos / Zona 02</option><option value="197">Spazio Bello / Alto da Boa vista </option><option value="162">Spazio Del Bagno / Rio Branco</option><option value="227">Studio Compose Revestimentos  / Parque Monte Líbano</option><option value="205">Tanto Revestimento / Leblon</option><option value="206">Tanto Revestimento / Barra da Tijuca</option><option value="14">Tecnobanho / Itaim Bibi</option><option value="40">Tedeschi / Fragata</option><option value="15">TETTO CONCEITO E ACABAMENTOS / Centro</option><option value="86">TK ACABAMENTOS / Zona I</option><option value="66">TOKFINALLI / São José</option><option value="187">Unikitchen / Parque Campolim</option><option value="237">UNIKITCHEN KITCHEN &amp; BATH / Centro</option><option value="188">Unique Revestimentos  / Nova Campinas</option><option value="226">Vallori Acabamentos  / Zona Industrial (Guará)</option><option value="91">Villaregio / Bosque</option><option value="183">Viva Mais Revestimento  / </option><option value="190">Volare Acabamentos  / Centro</option><option value="20">WALTER BELTRAME / Camobi</option><option value="175">Zanardi Exclusive / Centro</option><option value="173">Zart Home Design / Atlantida </option><option value="191">Zart Home Design / Higienópolis</option></select>					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<div class="input-cont-busca">
							<i class="fas fa-search"></i>
							<input type="text" name="busca" placeholder="Digite algo para pesquisar..." class="input-busca" required="required" value="">						</div>
						<!-- /.input-cont-busca -->
					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-12 col-lg-6 col-xl-3">
						<div class="btn-acoes">
							<a href="/xxxx_exclusive2018/admin/vendedores" class="btn btn-limpar">Limpar</a>							<button class="btn btn-pesquisar" type="submit">Pesquisar</button>						</div>
						<!-- /.btn-acoes -->
					</div>
					<!-- /.col-md-12 col-lg-6 col-xl-3 -->
				</div>
				<!-- /.row -->

			</form>
		</div><!-- /.search col-12 col-md-8 col-xl-9 -->
	</div>
	<!-- /.row row-filtros -->

	<div class="table-responsive">
		<table class="table table-striped">
	       <thead>
				<tr>
					<th><a class="desc" href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.id&amp;direction=asc">#</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Loja.nome_fantasia&amp;direction=asc">Loja</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.nome&amp;direction=asc">Nome</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Status.nome&amp;direction=asc">Status</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=total_vendas&amp;direction=asc">Total R$</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.created&amp;direction=asc">Criado</a></th>
					<th style="width: 88px;" class="text-center">Ações</th>
                    
				</tr>
			</thead>
            
			<tbody>

		
            
				<tr>
					<td>10398</td>
                    
                    
                    <td>Barotti Design  / Centro</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>MILENA GUELI DE QUEIROZ YAMANAKA</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10398">R$0,00</a></td>
                    
                    
                    <td>17/01/2018 18:51</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10398" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10398" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341472ef4f665088960" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10398"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10398?&quot;)) { document.post_5af341472ef4f665088960.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10377</td>
                    
                    
                    <td>Barotti Design  / Centro</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Ana Carolina  Wolf Silva </td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10377">R$0,00</a></td>
                    
                    
                    <td>17/01/2018 16:10</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10377" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10377" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341472fc46251318959" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10377"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10377?&quot;)) { document.post_5af341472fc46251318959.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10353</td>
                    
                    
                    <td>Barotti Design  / Centro</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Aline  Freitas dos Santos Nasimento</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10353">R$0,00</a></td>
                    
                    
                    <td>17/01/2018 10:51</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10353" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10353" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af34147307b5025822894" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10353"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10353?&quot;)) { document.post_5af34147307b5025822894.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10340</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Juliana Alves de Souza </td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10340">R$0,00</a></td>
                    
                    
                    <td>16/01/2018 17:24</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10340" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10340" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af34147312ab338103248" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10340"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10340?&quot;)) { document.post_5af34147312ab338103248.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10325</td>
                    
                    
                    <td>Condec Premium / Jardim Estadio</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Laís Hatoum Lincoln do Amaral</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10325">R$0,00</a></td>
                    
                    
                    <td>16/01/2018 15:07</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10325" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10325" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414731dd7715753294" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10325"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10325?&quot;)) { document.post_5af3414731dd7715753294.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10241</td>
                    
                    
                    <td>Grupo Primeira Linha / Jardim Bela Vista</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>JULIANA  MALTA DA SILVA</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10241">R$0,00</a></td>
                    
                    
                    <td>15/01/2018 10:26</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10241" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10241" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af34147328e7947430952" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10241"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10241?&quot;)) { document.post_5af34147328e7947430952.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10207</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
    
					<td>GABRIEL MILAN MORAIS</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10207">R$0,00</a></td>
                    
                    
                    <td>12/01/2018 12:50</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10207" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10207" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414733424913952702" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10207"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10207?&quot;)) { document.post_5af3414733424913952702.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10203</td>
                    
                    
                    <td>Unique Revestimentos  / Nova Campinas</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>MICHELE  Lima da Silva</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10203">R$0,00</a></td>
                    
                    
                    <td>11/01/2018 22:35</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10203" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10203" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414733f64634105259" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10203"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10203?&quot;)) { document.post_5af3414733f64634105259.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10191</td>
                    
                    
                    <td>Metal Nobre Arte e Acabamento / Martins</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>KEILA CRISTINA DE OLIVEIRA OLIVEIRA</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10191">R$0,00</a></td>
                    
                    
                    <td>09/01/2018 14:55</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10191" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10191" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414734ad7056691850" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10191"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10191?&quot;)) { document.post_5af3414734ad7056691850.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10155</td>
                    
                    
                    <td>Unique Revestimentos  / Nova Campinas</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Thiago Brand Mathias </td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10155">R$0,00</a></td>
                    
                    
                    <td>05/01/2018 15:23</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10155" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10155" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473569e492051877" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10155"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10155?&quot;)) { document.post_5af341473569e492051877.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9827</td>
                    
                    
                    <td>Bigolin / Jardim Petropolis</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>LUCAS FRANCISCO</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9827">R$0,00</a></td>
                    
                    
                    <td>21/12/2017 15:08</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9827" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9827" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414736279058167349" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9827"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9827?&quot;)) { document.post_5af3414736279058167349.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9801</td>
                    
                    
                    <td>Unique Revestimentos  / Nova Campinas</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Diego Cardoso</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9801">R$0,00</a></td>
                    
                    
                    <td>21/12/2017 13:23</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9801" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9801" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414736dea271553603" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9801"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9801?&quot;)) { document.post_5af3414736dea271553603.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9781</td>
                    
                    
                    <td>Bigolin / Jardim Petropolis</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>TIAGO DAMES</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9781">R$0,00</a></td>
                    
                    
                    <td>21/12/2017 10:01</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9781" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9781" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414737991881067275" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9781"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9781?&quot;)) { document.post_5af3414737991881067275.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9780</td>
                    
                    
                    <td>Bel Lar Acabamentos / Carlos Prates</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>João Victor  Rocha </td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9780">R$0,00</a></td>
                    
                    
                    <td>20/12/2017 17:46</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9780" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9780" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473851f596791309" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9780"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9780?&quot;)) { document.post_5af341473851f596791309.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9709</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Douglas Alves</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9709">R$0,00</a></td>
                    
                    
                    <td>15/12/2017 14:53</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9709" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9709" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af34147390ee260779994" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9709"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9709?&quot;)) { document.post_5af34147390ee260779994.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9703</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Ellanne  Alencar</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9703">R$0,00</a></td>
                    
                    
                    <td>15/12/2017 13:36</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9703" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9703" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af3414739c9d815017904" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9703"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9703?&quot;)) { document.post_5af3414739c9d815017904.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9702</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Leandro  Pinheiro</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9702">R$0,00</a></td>
                    
                    
                    <td>15/12/2017 12:11</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9702" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9702" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473a852325755178" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9702"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9702?&quot;)) { document.post_5af341473a852325755178.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9701</td>
                    
                    
                    <td>All Banho / Vila Gomes Cardim</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>rogerio suzuki</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9701">R$0,00</a></td>
                    
                    
                    <td>15/12/2017 12:10</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9701" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9701" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473b43e743754697" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9701"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9701?&quot;)) { document.post_5af341473b43e743754697.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9672</td>
                    
                    
                    <td>TK ACABAMENTOS / Zona I</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Gustavo Jose Nazari Campos</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9672">R$0,00</a></td>
                    
                    
                    <td>14/12/2017 13:27</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9672" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9672" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473c01b669941847" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9672"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9672?&quot;)) { document.post_5af341473c01b669941847.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>9619</td>
                    
                    
                    <td>ECO PORTINARI / VILA ALTINOPOLIS</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>pedro henrique aruth</td>
                    
                    
                    
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=9619">R$0,00</a></td>
                    
                    
                    <td>13/12/2017 15:58</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/9619" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/9619" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af341473cbf3252871372" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/9619"><input type="hidden" name="_method" value="POST"></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 9619?&quot;)) { document.post_5af341473cbf3252871372.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
			</tbody>

		</table>
	</div>
	<!-- /.table-responsive -->

	<nav aria-label="Paginação">
	<p class="text-center">Página 1 de 32, exibindo 20 registros de um total de 629, iniciando no 1, terminando no 20</p>
	<ul class="pagination pagination-md  justify-content-center">
		<li class="prev page-item disabled"><a href="" onclick="return false;" class="page-link text-dark bg-light"><i class="fa fa-angle-double-left"></i></a></li>		<li class="page-item active"><a href="" class="page-link bg-dark">1</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=2" class="page-link text-dark bg-light">2</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=3" class="page-link text-dark bg-light">3</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=4" class="page-link text-dark bg-light">4</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=5" class="page-link text-dark bg-light">5</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=6" class="page-link text-dark bg-light">6</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=7" class="page-link text-dark bg-light">7</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=8" class="page-link text-dark bg-light">8</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=9" class="page-link text-dark bg-light">9</a></li>		<li class="next page-item"><a rel="next" href="/xxxx_exclusive2018/admin/vendedores?page=2" class="page-link text-dark bg-light"><i class="fa fa-angle-double-right"></i></a></li>	</ul>
</nav>
</div>

        </div>
        <!-- /.container -->
    </div>
    <!-- /.interna -->
        
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/jquery-3.3.1.min.js?1523753199"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/jquery.mask.min.js?1520531952"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/inlineSVG.min.js?1472043403"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/js/popper.min.js?1524838419"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/js/bootstrap.min.js?1516293216"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/js/main.js?1524890758"></script>
    <script> oMain.ativarItemMenu($('#ni-vendedores')); </script>
<script type="text/javascript">

	function ativarVendedor(id, acao){
        
        
        console.log('XXXXX');
        
        
		$.confirm({
		    title: 'Atenção!',
		    content: 'Deseja realmente ' + acao + ' o vendedor?',
		    buttons: {
		        confirmar: function() {''

		        	$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
		        		console.log('teste');
					}, 'json');
		        	location.reload();

		        },
		        cancelar: function() {
		            $.alert('Ação cancelada!');
		        }
		    }
		});

	}

</script>

<script id="__debug_kit" data-id="6891c64b-b612-4de2-b47d-cbbf98a61efd" data-url="http://000.000.0.5/xxxx_exclusive2018/" src="/xxxx_exclusive2018/debug_kit/js/toolbar.js?1520533270"></script>

<iframe height="40" width="40" src="http://000.000.0.5/xxxx_exclusive2018/debug-kit/toolbar/6891c64b-b612-4de2-b47d-cbbf98a61efd" style="position: fixed; bottom: 0px; right: 0px; border: 0px; outline: 0px; overflow: hidden; z-index: 99999;"></iframe></body></html>

Open in new window

index_ee_ctp.txt
0
Julian HansenCommented:
I attempt to copy this way... the elements pane doesn't allow to do that in my case.
Right Click the page
Select View Page Source
ss159.jpgThis source looks like the Nav menu

Where is the output from this statement. I am expecting to see something with the text btn-lock - but nothing in the source you posted.
echo $this->element('Buttons/btn-lock', ['url' => [] ] );

Open in new window

0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
OK!
After following what you suggested. Sorry my confusion.

HTML renderized page

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vendedores - xxxx Club Exclusive</title>
    <link href="/xxxx_exclusive2018/favicon.ico?1521755242" type="image/x-icon" rel="icon"/><link href="/xxxx_exclusive2018/favicon.ico?1521755242" type="image/x-icon" rel="shortcut icon"/>

        
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/layout/main.css?1525368960"/>
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/layout/interna.css?1525099291"/>
	<link rel="stylesheet" href="/xxxx_exclusive2018/exclusive2018/css/admin.css?1525298141"/>
            <script>var base_url = '/xxxx_exclusive2018/';</script>
    </head>
<body class="l-admin p-admin c-vendedores a-index">
            
<div id="menu-xxxxclub" class="menu-sup-preto">
    <div class="container">
        <div class="row nav justify-content-end align-items-center">
            <div class="col-5 col-ola">
                Olá! Você esta logado como: <strong>ADMIN xxxx</strong>
            </div>
            <!-- /.col-5 -->
            <div class="col-2 col-pontos">
                            </div>
            <!-- /.col-2 col-pontos -->
            <div class="col-2 col-sair d-flex justify-content-end align-items-center">
                <a href="/xxxx_exclusive2018/login/logout" class="btn-sair"><img src="/xxxx_exclusive2018/exclusive2018/img/ico-area-restrita-top.svg?1523914105" class="svg" alt=""/> Sair</a>
            </div>
            <!-- /.col-2 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container -->
</div>
<!-- /#menu-xxxxclub -->        <nav id="menu-superior" class="navbar navbar-expand-lg navbar-light">
    <div class="container">
        <a href="/xxxx_exclusive2018/" class="navbar-brand"><img src="/xxxx_exclusive2018/exclusive2018/img/logo.svg?1522860836" alt=""/></a>        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNavDropdown">
            <p class="area-restrita d-lg-none">
                <a href="/xxxx_exclusive2018/login/logout">Sair</a>            </p>
            <ul class="navbar-nav">
                                        <li id="ni-escritorios" class="nav-item"><a href="/xxxx_exclusive2018/admin/escritorios" class="nav-link">Escritórios</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-especificadores" class="nav-item"><a href="/xxxx_exclusive2018/admin/especificadores" class="nav-link">Especificadores</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-vendedores" class="nav-item"><a href="/xxxx_exclusive2018/admin/vendedores" class="nav-link">Vendedores</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-vendas" class="nav-item"><a href="/xxxx_exclusive2018/admin/vendas" class="nav-link">Vendas</a></li>
                <li class="nav-divider"></li>
                        <li id="ni-lojistas" class="nav-item"><a href="/xxxx_exclusive2018/admin/lojas" class="nav-link">Lojistas</a></li>
                <li class="nav-divider"></li>
                        <li class="ni-rankings nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Rankings </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <a href="/xxxx_exclusive2018/admin/especificadores/ranking" class="dropdown-item">Especificadores</a>                                            <a href="/xxxx_exclusive2018/admin/vendedores/ranking" class="dropdown-item">Vendedores</a>                                            <a href="/xxxx_exclusive2018/admin/lojas/ranking" class="dropdown-item">Lojistas</a>                                            <a href="/xxxx_exclusive2018/admin/lojas/ranking-pontuacao-grupo" class="dropdown-item">Ranking Pontuação</a>                                    </div>
            </li>
                <li class="nav-divider"></li>
                        <li class="ni-relatorios nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Relatórios </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <a href="/xxxx_exclusive2018/admin/vendas/total-vendas-mes" class="dropdown-item">Total Vendas/Mês</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/total-especificadores-cadastrados-mes" class="dropdown-item">Especificadores Cadastrados/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/vendas/valor-vendas-mes" class="dropdown-item">Valor Vendas/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/valor-vendas-especificadores-mes" class="dropdown-item">Arquitetos Pontuando/Tipo de Loja</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/valor-vendas-especificadores-ano" class="dropdown-item">Arquitetos Pontuando/Ano</a>                                            <a href="/xxxx_exclusive2018/admin/vendas/quantidade-especificadores-pontuando-mes" class="dropdown-item">Quantos Especificadores Compraram/ Mês</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/cadastro-pontos" class="dropdown-item">Cadastro X Pontos</a>                                            <a href="/xxxx_exclusive2018/admin/especificadores/comparativo" class="dropdown-item">Comparativo 2015/2016/2017</a>                                    </div>
            </li>
                <li class="nav-divider"></li>
                </ul>
            <!-- /.navbar-nav -->
        </div>
        <!-- /#navbarNavDropdown.collapse navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<!-- /#menu-superior -->    

        <div class="interna">
        <div class="pontuacao-mobile justify-content-end">
                    </div>
        <!-- /.pontuacao-mobile -->
        <div class="topo">
            <h1>Vendedores</h1>
        </div>
        <!-- /.topo -->
        <div class="container">

            



                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="/xxxx_exclusive2018">Home</a></li><li class="breadcrumb-item active"><span>Vendedores</span></li>
                        </ol>
                    </nav>
                    
<div class="vendedores-admin">
	<div class="row row-filtros">
		<div class="cont-acao col-12 col-md-4 col-xl-12" style="justify-content: start;">
			<a href="/xxxx_exclusive2018/admin/vendedores/add" class="btn-add"><i class="fas fa-file-excel"></i> EXPORTAR</a>		</div><!-- /.cont-acao col-12 -->
        
   
		<div class="search col-12 col-md-8 col-xl-12">
			<form method="get" accept-charset="utf-8" class="form-busca" action="/xxxx_exclusive2018/admin/vendedores">				<div class="row">

					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<select name="loja_id" class="dropdown-periodos dropdown-busca"><option value="">Selecione uma loja</option><option value="93">Agaé / Tirol</option><option value="34">Akabamentos / Vila Harmonia</option><option value="141">Aldeia Acabamentos  / Setor Sul</option><option value="223">All Banho / Vila Gomes Cardim</option><option value="142">ALLGRAM SA COM EXP IMP PISOS R ART DE DECOR LTDA EPP / Vila Reg. Feijo</option><option value="204">Aquarela / Chapada</option><option value="144">Aquarius Acabamentos  / Jardim Maria Jose</option><option value="228">Araucária Acabamentos / Jardim Novo Horizonte</option><option value="209">Armazém Cerâmico / Vila Staff</option><option value="104">Arquint Acabamentos / Urbanova</option><option value="218">ART PEDRAS / Dom Pedro I</option><option value="229">Arte E Banho / Caminho das Árvores</option><option value="107">Atacon Design / Lagoa Seca</option><option value="29">Banho&amp;Metal / Jardins</option><option value="242">Barotti Design  / Centro</option><option value="41">Bel Lar Acabamentos / Carlos Prates</option><option value="108">Bel Lar Acabamentos / Santa Lúcia</option><option value="176">Belissimo Banheiros / Sion</option><option value="109">Bella Casa Acabamentos / Centro</option><option value="145">Bello Bagno / Floresta</option><option value="146">Bello Bagno / Centro</option><option value="147">Bello Bagno / Desvio Rizzo</option><option value="148">Bello Bagno Decor  / Muinhos de Vento</option><option value="221">Bello Banho / Centro</option><option value="170">Bhan Shop / Moema</option><option value="149">Bigolin / Jardim Petropolis</option><option value="236">Boa Vista Pisos E Acabamentos Concept / Nossa Senhora Aparecida</option><option value="163">Bollpi / Vila Reg. Feijo</option><option value="231">Bonatto / Carmo</option><option value="230">Bonatto Reserva  / Santo Antônio</option><option value="243">Brazxxxx / Copacabana</option><option value="135">C&amp;T Acabamentos / Centro</option><option value="150">Camatti Acabamentos / Jardim Itália</option><option value="138">Casa &amp; Arte / Centro</option><option value="220">Casa Arquitetura / Calhau</option><option value="69">Casa Bonita / Ibituruna</option><option value="153">Casa dos Construtores / Jardim Soto</option><option value="154">Casa dos Construtores / Vila Elvira</option><option value="155">Casa Pinezi / Santa Paula</option><option value="195">CASA R ACABAMENTOS ESPECIAIS / Jardim do Prado</option><option value="199">Casa Rara / Jardim Lopes da Silva </option><option value="225">Casa Serra Acabamentos / Centro</option><option value="63">Casa Show / Salesianos</option><option value="50">Casa Vip / Treze De Julho</option><option value="59">Center Banho / Jardim Paris</option><option value="22">Cerqueira Stylo / Sta. Mônica</option><option value="239">Cimcal Materias de Construção  / Santo Antônio</option><option value="112">COMAPA DESIGN / Vila Aurora</option><option value="23">Combinare Pisos E Acabamentos / CENTRO</option><option value="156">Compose Revestimento / Santa Lucia</option><option value="157">Compose Revestimento / Planalto De Carapina</option><option value="216">Conceitual Prime Acabamentos / Vila Araponguinha</option><option value="217">Conceitual Prime Acabamentos / Bela Suiça</option><option value="160">Condec Premium / Jardim Estadio</option><option value="219">Confort Banho / Itaim Bibi</option><option value="1">Construdomus / Pinheiros</option><option value="224">Construmarques / Vila Sonia</option><option value="158">De Huber / Sumaré</option><option value="61">Decorbanho / Cambuí</option><option value="6">DECORBANHO - ALPHASHOPPING / Alphaville Industria</option><option value="3">DECORBANHO - ARAGUAIA / Alphaville Industrial</option><option value="113">Decorpisos / América</option><option value="130">DELINEAR / Candeias</option><option value="18">Dema Revestimentos E Acabamentos / Cidade Alta</option><option value="19">Dema Revestimentos E Acabamentos / Sanvitto</option><option value="240">Design Portinari / Jundiaí</option><option value="186">Detalhes Acabamentos / Centro</option><option value="100">Dm Design / Cidade Jardim</option><option value="33">DOLCE BAGNO ACABAMENTOS / Jardim Bongiovani</option><option value="159">Domicile Acabambentos / Fragata</option><option value="194">DPTO BOUTIQUE / </option><option value="21">Dr Hidráulica / Centro</option><option value="27">ECO PORTINARI / VILA ALTINOPOLIS</option><option value="65">Ecoville Design / Vila Vianelo</option><option value="39">Ekologika / Centro</option><option value="114">Elementus / Parque Francal</option><option value="241">Emidio Pais  / Santa Lúcia</option><option value="115">Empório Casa / Pereira Lobo</option><option value="85">Empório Revestir / Água Fria</option><option value="46">Empporium Frei Caneca / Barra Da Tijuca</option><option value="87">Empporium Frei Caneca / Ipanema</option><option value="235">Época Decorações / Conj Mariana</option><option value="134">Espaço Impermix / Rebouças</option><option value="98">Espaço Revest / Calhau</option><option value="161">Espaço Revestir / Bogilar</option><option value="43">Fonseca Shop Acabamentos Especiais  / Caminho Das árvores</option><option value="26">Galleria Acabamentos / Santa Terezinha</option><option value="132">Grupo Primeira Linha / Jardim Bela Vista</option><option value="95">Grupo Tempos / Olaria</option><option value="36">Guaporé / Taquaral</option><option value="37">Guaporé / Cambuí</option><option value="125">Guaporé / Nova Campinas</option><option value="7">H. Brilho / Morumbi</option><option value="8">HIDROFORMA / Batel</option><option value="9">Hidrolar / Pinheiros</option><option value="118">Horus Acabamentos / Santa Paula</option><option value="123">Ibraildo / Varadouro</option><option value="17">Ideale Acabamentos / Lourdes</option><option value="238">IMPERMIX / Batel</option><option value="167">Inovar Acabamentos / Medianeira</option><option value="166">Inovar Acabamentos - Matriz  / Vila Rosa</option><option value="232">Inpernal  / Pina</option><option value="222">Intimee / Vila Guilherme</option><option value="174">Ipiranga Acabamentos Material de Construção / Vila Aristarcho</option><option value="168">J T Esquadrias / Figueira</option><option value="96">J. Monte Premium / Ininga</option><option value="71">Jv Boutique / Tiradentes</option><option value="16">Ladrilhart / Floresta</option><option value="12">LELIS DESIGN / Moema</option><option value="51">Linha Direta Acabamentos / Jardim Girassol</option><option value="52">Linha Direta Acabamentos / Jardim Elite</option><option value="53">Linha Direta Acabamentos / Jd Porto Real</option><option value="177">Metal  / Dionisio Torrer</option><option value="178">Metal Nobre Arte e Acabamento / Martins</option><option value="202">Metallo / Aparecida</option><option value="127">Normatel Premium / Dionisio Torres</option><option value="55">Obra De Arte Acabamentos / Sta Luiza</option><option value="128">OBRA FÁCIL / Imirim</option><option value="234">Obra Facil - Itaim  / Vila Nova Conceição</option><option value="196">Obra Fácil - Pinheiros / Pinheiros</option><option value="180">Olni Acabamentos / Praia Do Ponta Da Cruz</option><option value="201">Onda decoração / PINA</option><option value="121">Ornamentare Acabamentos / Pinheiros</option><option value="122">Padovani Conceito / Vila PadreBento</option><option value="136">PARQUE ELÉTRICO / Centro</option><option value="208">Pavimenti / Caminho Das Árvores</option><option value="24">Pizzotti Design / Jardim Das Nações</option><option value="25">Pleno Reventimentos / Boa Viagem</option><option value="253">PONTO BELLO ACABAMENTOS / Santa Maria</option><option value="5">PORTOBELLO SHOP / Industrial</option><option value="103">Positano / Jardim América</option><option value="133">Prisma Revestimentos / Centro</option><option value="137">ProFatto / Agronômica</option><option value="42">RED xxxx / Vila Gomes Cardim</option><option value="10">Redh Hidrolar / Perdizes</option><option value="68">REFINARE REVESTIMENTO / Aflitos</option><option value="129">Refinare Revestimento / Boa Viagem</option><option value="207">REFINARE REVESTIMENTO / Maurício de Nassau</option><option value="182">Requintte Louças e  Metais / Vila Nova</option><option value="233">Requintte Louças E  Metais / Vila Nova</option><option value="169">Resende Acabamentos / Ipiranga</option><option value="152">Revest Acabamentos / Zona 7</option><option value="203">Revestimentta / Macuco</option><option value="13">Sadh xxxx / Jardim Do Mar</option><option value="192">Safira Revestimentos Metais e Louças / Campinas</option><option value="140">São Geraldo Acabamentos e Complemetos  / Zona Industrial</option><option value="105">Serra Dos Pinhos Supreme / Vila Abernessia</option><option value="111">Simmetria Acabamentos / Zona 02</option><option value="197">Spazio Bello / Alto da Boa vista </option><option value="162">Spazio Del Bagno / Rio Branco</option><option value="227">Studio Compose Revestimentos  / Parque Monte Líbano</option><option value="205">Tanto Revestimento / Leblon</option><option value="206">Tanto Revestimento / Barra da Tijuca</option><option value="14">Tecnobanho / Itaim Bibi</option><option value="40">Tedeschi / Fragata</option><option value="15">TETTO CONCEITO E ACABAMENTOS / Centro</option><option value="86">TK ACABAMENTOS / Zona I</option><option value="66">TOKFINALLI / São José</option><option value="187">Unikitchen / Parque Campolim</option><option value="237">UNIKITCHEN KITCHEN &amp; BATH / Centro</option><option value="188">Unique Revestimentos  / Nova Campinas</option><option value="226">Vallori Acabamentos  / Zona Industrial (Guará)</option><option value="91">Villaregio / Bosque</option><option value="183">Viva Mais Revestimento  / </option><option value="190">Volare Acabamentos  / Centro</option><option value="20">WALTER BELTRAME / Camobi</option><option value="175">Zanardi Exclusive / Centro</option><option value="173">Zart Home Design / Atlantida </option><option value="191">Zart Home Design / Higienópolis</option></select>					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<div class="input-cont-busca">
							<i class="fas fa-search"></i>
							<input type="text" name="busca" placeholder="Digite algo para pesquisar..." class="input-busca" required="required" value=""/>						</div>
						<!-- /.input-cont-busca -->
					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-12 col-lg-6 col-xl-3">
						<div class="btn-acoes">
							<a href="/xxxx_exclusive2018/admin/vendedores" class="btn btn-limpar">Limpar</a>							<button class="btn btn-pesquisar" type="submit">Pesquisar</button>						</div>
						<!-- /.btn-acoes -->
					</div>
					<!-- /.col-md-12 col-lg-6 col-xl-3 -->
				</div>
				<!-- /.row -->

			</form>
		</div><!-- /.search col-12 col-md-8 col-xl-9 -->
	</div>
	<!-- /.row row-filtros -->

	<div class="table-responsive">
		<table class="table table-striped">
	       <thead>
				<tr>
					<th><a class="desc" href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.id&amp;direction=asc">#</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Loja.nome_fantasia&amp;direction=asc">Loja</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.nome&amp;direction=asc">Nome</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Status.nome&amp;direction=asc">Status</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=total_vendas&amp;direction=asc">Total R$</a></th>
					<th><a href="/xxxx_exclusive2018/admin/vendedores?sort=Vendedores.created&amp;direction=asc">Criado</a></th>
					<th style="width: 88px;" class="text-center">Ações</th>
                    
				</tr>
			</thead>
            
			<tbody>

		
            
				<tr>
					<td>10398</td>
                    
                    <!--EF Maio/18 -->
                    <td>Barotti Design  / Centro</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>MILENA GUELI DE QUEIROZ YAMANAKA</td>
                    
                    
                    <!--EF Maio/18 -->
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10398">R$0,00</a></td>
                    
                    <!--EF Maio/18 -->
                    <td>17/01/2018 18:51</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10398" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10398" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af43c61881e1977233286" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10398"><input type="hidden" name="_method" value="POST"/></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10398?&quot;)) { document.post_5af43c61881e1977233286.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					</td>
				</tr>

			
				<tr>
					<td>10377</td>
                    
                    <!--EF Maio/18 -->
                    <td>Barotti Design  / Centro</td>
                    
                    <!--
					<td></td>
                    -->
   
                    
					<!--td><?//= $vendedor->cpf_cnpj ?></td-->
                    
                    
					<td>Ana Carolina  Wolf Silva </td>
                    
                    
                    <!--EF Maio/18 -->
                    <td>Ativo</td>
                    
                    
										<td class="text-right"><a href="/xxxx_exclusive2018/admin/vendas?vendedor_id=10377">R$0,00</a></td>
                    
                    <!--EF Maio/18 -->
                    <td>17/01/2018 16:10</td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
					<!--  INTEREST BUTTONS -->
						<a href="/xxxx_exclusive2018/admin/vendedores/view/10377" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10377" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af43c6188e8a205146969" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10377"><input type="hidden" name="_method" value="POST"/></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10377?&quot;)) { document.post_5af43c6188e8a205146969.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        
                       	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
					
					
					</td>
				</tr>

		
			</tbody>

		</table>
	</div>
	<!-- /.table-responsive -->

	<nav aria-label="Paginação">
	<p class="text-center">Página 1 de 32, exibindo 20 registros de um total de 629, iniciando no 1, terminando no 20</p>
	<ul class="pagination pagination-md  justify-content-center">
		<li class="prev page-item disabled"><a href="" onclick="return false;" class="page-link text-dark bg-light"><i class="fa fa-angle-double-left"></i></a></li>		<li class="page-item active"><a href="" class="page-link bg-dark">1</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=2" class="page-link text-dark bg-light">2</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=3" class="page-link text-dark bg-light">3</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=4" class="page-link text-dark bg-light">4</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=5" class="page-link text-dark bg-light">5</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=6" class="page-link text-dark bg-light">6</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=7" class="page-link text-dark bg-light">7</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=8" class="page-link text-dark bg-light">8</a></li><li class="page-item"><a href="/xxxx_exclusive2018/admin/vendedores?page=9" class="page-link text-dark bg-light">9</a></li>		<li class="next page-item"><a rel="next" href="/xxxx_exclusive2018/admin/vendedores?page=2" class="page-link text-dark bg-light"><i class="fa fa-angle-double-right"></i></a></li>	</ul>
</nav>
</div>

        </div>
        <!-- /.container -->
    </div>
    <!-- /.interna -->
        
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/jquery-3.3.1.min.js?1523753199"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/jquery.mask.min.js?1520531952"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/inlineSVG.min.js?1472043403"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/js/popper.min.js?1524838419"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/vendor/js/bootstrap.min.js?1516293216"></script>
	<script src="/xxxx_exclusive2018/exclusive2018/js/main.js?1524890758"></script>
    <script> oMain.ativarItemMenu($('#ni-vendedores')); </script>
<script type="text/javascript">

	function ativarVendedor(id, acao){
        
        
        console.log('XXXXX');
        
        
		$.confirm({
		    title: 'Atenção!',
		    content: 'Deseja realmente ' + acao + ' o vendedor?',
		    buttons: {
		        confirmar: function() {''

		        	$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
		        		console.log('teste');
					}, 'json');
		        	location.reload();

		        },
		        cancelar: function() {
		            $.alert('Ação cancelada!');
		        }
		    }
		});

	}

	function teste(){

	   console.log('YYYYY');

	}


</script>

<script id="__debug_kit" data-id="fa17fd4d-44b5-40b6-8c95-45d518fb75e4" data-url="http://000.000.0.5/xxxx_exclusive2018/" src="/xxxx_exclusive2018/debug_kit/js/toolbar.js?1520533270"></script></body>
</html>

Open in new window



The CakePHP .ctp code

<?php
    //EF Maio/2018
	$this->assign('title', 'Vendedores');
?>

<?php $this->append('script_footer'); ?>
<script> oMain.ativarItemMenu($('#ni-vendedores')); </script>
<?php $this->end() ?>


<?php
// EF Maio/2018
$this->Breadcrumbs->add([
    ['title' => 'Home', 'url' => ['controller' => 'home', 'action' => 'index', 'prefix' => false]],
    ['title' => 'Vendedores']
]);
echo $this->Breadcrumbs->render();
?>

<div class="vendedores-admin">
	<div class="row row-filtros">
		<div class="cont-acao col-12 col-md-4 col-xl-12" style="justify-content: start;">
			<?php echo $this->Html->link('<i class="fas fa-file-excel"></i> EXPORTAR',  [
			'action' => 'add',
			'?' => [
				'especificador_id' => ((isset($especificador->id)) ? $especificador->id : null),
				'vendedor_id' => ((isset($vendedor->id)) ? $vendedor->id : null),
			]
		], ['disabled' => $isCadastrosFinalizados, 'escape' => false, 'class' => 'btn-add']); ?>
		</div><!-- /.cont-acao col-12 -->
        
   
		<div class="search col-12 col-md-8 col-xl-12">
			<?php
			/**** I:BUSCA ****/
			echo $this->Form->create($buscaForm, ['type' => 'get', 'class' => 'form-busca']);
			?>
				<div class="row">

					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<?= $this->Form->select(
							'loja_id',
							$lojas,
							[
								'empty' => 'Selecione uma loja',
								'label' => false,
								'default' => $this->request->query('loja_id'),
								'class' => 'dropdown-periodos dropdown-busca'
							]
						) ?>
					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-6 col-xl-3">
						<div class="input-cont-busca">
							<i class="fas fa-search"></i>
							<?= $this->Form->text('busca', ['placeholder' => 'Digite algo para pesquisar...', 'default' => trim($this->request->query('busca')), 'class' => 'input-busca'])?>
						</div>
						<!-- /.input-cont-busca -->
					</div>
					<!-- /.col-md-6 col-xl-3 -->
					<div class="col-md-12 col-lg-6 col-xl-3">
						<div class="btn-acoes">
							<?= $this->Html->link('Limpar', ['action' => 'index'], ['class' => 'btn btn-limpar', 'escape' => false]); ?>
							<?= $this->Form->button('Pesquisar', ['escape' => false, 'class' => 'btn btn-pesquisar']); ?>
						</div>
						<!-- /.btn-acoes -->
					</div>
					<!-- /.col-md-12 col-lg-6 col-xl-3 -->
				</div>
				<!-- /.row -->

			<?php
			echo $this->Form->end();
			/**** F:BUSCA ****/
			?>

		</div><!-- /.search col-12 col-md-8 col-xl-9 -->
	</div>
	<!-- /.row row-filtros -->

	<div class="table-responsive">
		<table class="table table-striped">
	       <thead>
				<tr>
					<th><?= $this->Paginator->sort('Vendedores.id', '#') ?></th>
					<th><?= $this->Paginator->sort('Loja.nome_fantasia', 'Loja') ?></th>
					<th><?= $this->Paginator->sort('Vendedores.nome', 'Nome') ?></th>
					<th><?= $this->Paginator->sort('Status.nome', 'Status') ?></th>
					<th><?= $this->Paginator->sort('total_vendas', 'Total R$') ?></th>
					<th><?= $this->Paginator->sort('Vendedores.created', 'Criado') ?></th>
					<th style="width: 88px;" class="text-center">Ações</th>
                    
				</tr>
			</thead>
            
			<tbody>

		
            <?php foreach($vendedores as $vendedor): ?>

				<tr>
					<td><?= $vendedor->id ?></td>
                    
                    <!--EF Maio/18 -->
                    <td><?php if(!empty($vendedor->loja)){ echo $vendedor->loja->descricao; }else{ echo 'Loja desativada'; } ?></td>
                 
					<td><?= $vendedor->nome_completo ?></td>
                    
                    
                    <!--EF Maio/18 -->
                    <td><?= $vendedor->status->nome ?></td>
                    
                    
					<?php /*<td><?= $vendedor->email ?></td>*/ ?>
					<td class="text-right"><?php
					$valor = $this->Number->currency($vendedor->total_vendas);
					echo $this->Html->link($valor, ['controller' => 'vendas', 'action' => 'index', '?' => ['vendedor_id' => $vendedor->id]]);
					?></td>
                    
                    <!--EF Maio/18 -->
                    <td><?= $vendedor->created->format('d/m/Y H:i') ?></td>
                   
					<!--EF Maio/18 td class="text-center" -->
                    <td class="text-center" width="200px">
                    
						<!--  THIS RUNS OK -->
						<?= $this->element('Buttons/btn-view', ['url' => ['action' => 'view', $vendedor->id] ]); ?>
						<?= $this->element('Buttons/btn-edit', ['url' => ['action' => 'edit', $vendedor->id] ]); ?>
						<?= $this->element('Buttons/btn-delete', ['url' => ['action' => 'delete', $vendedor->id], 'id' => $vendedor->id, 'disabled' => $isCadastrosFinalizados ]); ?>
                        <!-- END -->
						
                       	<?php
                        

							
							// INTEREST CODE
							if($vendedor->status_id == 1){
								 //echo $this->Html->link('<span class="glyphicon glyphicon-lock"></span>', 'javascript:void(0);', ['onclick' => "ativarVendedor({$vendedor->id},'desativar');", 'class' => 'btn btn-default btn-sm ativado', 'title' => 'Desativar', 'escape' => false, 'disabled' => $isCadastrosFinalizados, 'style' => 'background-color: #dff0d8;', 'id' => 'desativar-'.$vendedor->id]);
                                 //echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => "ativarVendedor('{$vendedor->id}', 'desativar');" ] );
                                  //echo $this->element('Buttons/btn-lock', ['url' => []]);
                                  
								  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
                            
							}else if($vendedor->status_id == 2){
								//echo $this->Html->link('<span class="glyphicon glyphicon-lock"></span>', 'javascript:void(0);', ['onclick' => "ativarVendedor('{$vendedor->id}', 'ativar');", 'class' => 'btn btn-default btn-sm warning desativado', 'title' => 'Ativar', 'escape' => false, 'disabled' => $isCadastrosFinalizados, 'style' => 'background-color: #f2dede;', 'id' => 'ativar-'.$vendedor->id]);
                                //echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => "ativarVendedor('{$vendedor->id}', 'ativar');" ] );
                                 //echo $this->element('Buttons/btn-lock', ['url' => []]); 
                                 
								 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
                            }
                            // END INTEREST CODE
                            
                        ?>

					</td>
				</tr>

			<?php endforeach ?>

			</tbody>

		</table>
	</div>
	<!-- /.table-responsive -->

	<?= $this->element('/paginacao') ?>
</div>

<?php $this->append('script_footer'); ?>
<script type="text/javascript">

	function ativarVendedor(id, acao){
        
        
        console.log('XXXXX');
        
        
		$.confirm({
		    title: 'Atenção!',
		    content: 'Deseja realmente ' + acao + ' o vendedor?',
		    buttons: {
		        confirmar: function() {''

		        	$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
		        		console.log('teste');
					}, 'json');
		        	location.reload();

		        },
		        cancelar: function() {
		            $.alert('Ação cancelada!');
		        }
		    }
		});

	}

	function teste(){

	   console.log('YYYYY');

	}


</script>
<?php $this->end(); ?>

Open in new window



CakePHP Controller

<?php
namespace App\Controller\Admin;
use Cake\I18n\Number;
use Cake\Core\Configure;
use Cake\ORM\TableRegistry;
use App\Controller\VendedoresAppController;
use App\Form\BuscaForm;

class VendedoresController extends VendedoresAppController
{
	public function index()
	{
		//Conditions para a consulta de vendas
		$conditions = [];

		if($this->request->query('loja_id')){
			$conditions['Vendedores.loja_id'] = (int)$this->request->query('loja_id');
		}

		//Monta a consulta dos vendedores
		$vendedoresQuery = $this->Vendedores->getIndexQuery($conditions, trim($this->request->query('busca')));

		//Pagina os resultados
		$vendedores = $this->Paginate($vendedoresQuery);

		//lojasTable
		$lojasTable = TableRegistry::get('Lojas');

		//Lojas
		$lojas = TableRegistry::get('Lojas')->getLojasList();

		//Busca
		$buscaForm = new BuscaForm();

		$this->set(compact('vendedores', 'lojas', 'buscaForm'));
	}

	/**
	 * Define as variaveis  para a página
	 */
	private function defineVariaveis(){

		$lojas = $this->Vendedores->Lojas->find('list', [
			'keyField' => 'id',
			'valueField' => 'loja_cnpj',
			'limit' => 200
		]);
		$estados = TableRegistry::get('Estados');
		$estados_opts = $estados->find('list',  [
			'keyField' => 'uf',
			'valueField' => 'nome'
		]);
		$this->set(compact('lojas', 'estados_opts'));
	}

	/**
	 * Editar vendedores
	 * @param  int $id
	 * @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
	 */
	public function edit($id = null)
	{

		//Caso não seja lojista
		if($this->Auth->user('tipo_id') != 1){
			$id = $this->Auth->user('id');
		}


		$vendedor = $this->Vendedores->get($id, [
			'contain' => ['Loja', 'Lojas'],
			'conditions' => ['Vendedores.tipo_id' => 4, 'Vendedores.status_id IN' => [1, 2]]
		]);

		if ($this->request->is(['patch', 'post', 'put'])) {

			//Não permite salvar senhas vazias (já que ela não é obrigatória na edição)
			if(empty($this->request->data['password'])) {
				unset($this->request->data['password']);
				unset($this->request->data['password_confirm']);
			}

			// unset($this->request->data['loja_id']);
			// unset($this->request->data['cpf_cnpj']);
			$vendedor = $this->Vendedores->patchEntity($vendedor, $this->request->data);
			if ($this->Vendedores->save($vendedor)) {

				$data = $this->request->data;
				unset($data['password']);
				unset($data['password_confirm']);

				//Registra o log
				$this->Logdb->registrar([
					'usuario_id' => $this->Auth->user('id'),
					'tabela' => 'usuarios',
					'registro_id' => $vendedor->id,
					'operacao' => 'UPDATE',
					'data' => $data
				]);


				$this->Flash->success(__('Seus dados foram salvos corretamente.'));
				//Caso seja lojista
				if($this->Auth->user('tipo_id') == 2){
					return $this->redirect(['action' => 'index']);
				} else {
					return $this->redirect(['controller' => 'vendas', 'action' => 'index']);
				}
			} else {
				$this->Flash->error(__('Ocorreram erros ao tentar salvar seus dados, verifique abaixo.'));
			}
		} else {
			$vendedor->email_confirm = $vendedor->email;
			unset($vendedor->password);
		}


		$this->defineVariaveis();
		$this->set(compact('vendedor'));
		$this->set('_serialize', ['vendedor']);
	}

	public function ativar($id = null){

		$this->autoRender = false;

		$vendedor = $this->Vendedores->get($id);

		if($vendedor->status_id == 1){
			$vendedor->status_id = 2;
		}else{
			$vendedor->status_id = 1;
		}

		if($this->Vendedores->save($vendedor)){
			//Registra o log
			$this->Logdb->registrar([
				'usuario_id' => $this->Auth->user('id'),
				'tabela' => 'usuarios',
				'registro_id' => $vendedor->id,
				'operacao' => 'UPDATE',
				'data' => $vendedor
			]);

			if($vendedor->status_id == 2){
				echo 'desativado';
				exit();
			}else{
				echo 'ativado';
				exit();
			}
		}
				
	}

	public function view($id)
	{

		//colunas dos totais
		$total_vendas = $this->getTotalVendas();

		//Carrega o especificador selecionado
		$vendedor = $this->Vendedores->find()
		->select([
			'Vendedores.id',
			'Vendedores.tipo_id',
			'Vendedores.loja_id',
			'Vendedores.status_id',
			'Vendedores.crm_id',
			'Vendedores.codigo',
			'Vendedores.username',
			'Vendedores.password',
			'Vendedores.email',
			'Vendedores.email_invalido',
			'Vendedores.optout',
			'Vendedores.nome',
			'Vendedores.sobrenome',
			'Vendedores.razao_social',
			'Vendedores.nome_fantasia',
			'Vendedores.responsavel',
			'Vendedores.data_nasc',
			'Vendedores.tel1',
			'Vendedores.tel2',
			'Vendedores.cpf_cnpj',
			'Vendedores.rg',
			'Vendedores.endereco',
			'Vendedores.numero',
			'Vendedores.complemento',
			'Vendedores.bairro',
			'Vendedores.cidade',
			'Vendedores.estado_uf',
			'Vendedores.cep',
			'Vendedores.codigo_nova_senha',
			'Vendedores.num_regis',
			'total_vendas' => $total_vendas,
			'Loja.cnpj',
			'Loja.razao_social',
			'Vendedores.created',
			'Vendedores.modified',
		])
		->where(['Vendedores.id' => $id, 'Vendedores.tipo_id' => 4, 'Vendedores.status_id IN' => [1, 2]])
		->contain(['Lojas', 'Loja'])
		->first();



		$this->set(compact('vendedor'));
	}

	/**
	 * Obtem o total de vendas de um usuário
	 * @return object
	 */
	private function getTotalVendas(){

		//Monta a query de vendas
		$total_vendas = TableRegistry::get('Vendas')->find();
		$conditionsTotalVendas = [
			'Vendas.status_id' => 1, //Apenas vendas aprovadas
			'Vendas.usuario_vendedor_id' => $total_vendas->newExpr('Vendedores.id'),
			'Vendas.created >=' => Configure::read('Campanha.inicioCadastro')
		];
		return $total_vendas
			->select($total_vendas->func()->sum('Vendas.valor'))
			->where($conditionsTotalVendas);
	}

	public function exportar()
	{

		download_send_headers('vendedores_' . date('Y-m-d H:m') . '.csv');
		//$this->viewBuilder()->layout(false);

		//Conditions para a consulta de vendas
		$conditions = [];

		if($this->request->query('loja_id')){
			$conditions['Vendedores.loja_id'] = (int)$this->request->query('loja_id');
		}

		//Monta a consulta dos vendedores
		$vendedores = $this->Vendedores->getIndexQuery($conditions, trim($this->request->query('busca')));

		//$vendedores = $this->Vendedores->getIndexQuery($this->request->query('loja_id'));

		$csv = "id;Status;Loja;Nome;Sobrenome;Data Nascimento;Telefone 1;Telefone 2;E-mail;Cpf;Rg;Endereço;Numero;Complemento;Bairro;Cidade;Estado;Outra Profissão;Total Vendas;Data de Cadastro;\r\n";
		foreach($vendedores as $key => $vendedor){

			$csv .= "{$vendedor->id};";
			$csv .= "{$vendedor->status->nome};";
			if(empty($vendedor->loja->loja_cnpj)){
				$csv .= "sem cnpj;";
			}else{
				$csv .= "{$vendedor->loja->loja_cnpj};";
			}
			
			$csv .= "{$vendedor->nome};{$vendedor->sobrenome};{$vendedor->data_nasc};{$vendedor->tel1};{$vendedor->tel2};{$vendedor->email};{$vendedor->cpf_cnpj};{$vendedor->rg};{$vendedor->endereco};{$vendedor->numero};{$vendedor->complemento};{$vendedor->bairro};{$vendedor->cidade};{$vendedor->estado_uf};{$vendedor->outra_profissao};";
			$csv .= Number::currency($vendedor->total_vendas) .';';
			$csv .= "{$vendedor->created};";
			//if(!empty($vendedor->loja->nome_fantasia)){
			//}

			$csv .= "\r\n";

		}
		
		echo utf8_decode($csv);
		exit;

	}

	/**
	 * Ranking de vendedores
	 * @return void
	 */
	public function ranking()
    {
		//regiao_id
		$regiao_id = $this->request->query('regiao_id');

		//periodo_id
		$periodo_id = $this->request->query('periodo_id');

		//tipo_lojista_id
		$tipo_lojista_id = $this->request->query('tipo_lojista_id');

    	//vendedores
    	$vendedores = TableRegistry::get('Vendedores')->getRanking($regiao_id, $periodo_id, $tipo_lojista_id);

    	//Cadastro de regiões
    	$regioes = TableRegistry::get('Regioes')->getList();

    	//periodos
    	$periodos = TableRegistry::get('Periodos')->getList();

    	//tipo lojistas
		$tipo_lojista_id = TableRegistry::get('Tipos')->find('list', ['keyField' => 'id', 'valueField' => 'nome'])->where(['Tipos.grupo' => 'tipo_lojista']);

    	$this->set(compact('vendedores', 'regioes', 'periodos', 'tipo_lojista_id'));
    }

    public function rankingExportar()
    {
    	download_send_headers('ranking_vendedores_' . date('Y-m-d H:m') . '.csv');

    	//Região
    	$regiao_id = $this->request->query('regiao_id');

    	//periodo_id
    	$periodo_id = $this->request->query('periodo_id');

    	//tipo_lojista_id
		$tipo_lojista_id = $this->request->query('tipo_lojista_id');

    	//Obtem um ranking de especificadores
    	$vendedores = $this->Vendedores->getRanking($regiao_id, $periodo_id, $tipo_lojista_id);


    	$csv = "Pos.;Vendedor Nome;Loja Nome;Loja Gestor;Loja Coordenador;Vendedor Total;\r\n";
    	foreach($vendedores as $key => $vendedor){

    		$csv .= ($key+1) . ';';
    		$csv .= "{$vendedor->nome_completo};";
			$csv .= "{$vendedor->loja->descricao};";
			$csv .= "{$vendedor->loja->gestor};";
			$csv .= "{$vendedor->loja->coordenador};";
    		$csv .= Number::currency($vendedor->valor_total) . ";";

    		$csv .= "\r\n";

    	}

    	echo utf8_decode($csv);
    	exit;

    }
}

Open in new window


I hope now it's correct.
If something else is necessary just ask.
0
Julian HansenCommented:
I am not seeing something here.
In your PHP code you have this
<td class="text-center" width="200px">

	<!--  THIS RUNS OK -->
	<?= $this->element('Buttons/btn-view', ['url' => ['action' => 'view', $vendedor->id] ]); ?>
	<?= $this->element('Buttons/btn-edit', ['url' => ['action' => 'edit', $vendedor->id] ]); ?>
	<?= $this->element('Buttons/btn-delete', ['url' => ['action' => 'delete', $vendedor->id], 'id' => $vendedor->id, 'disabled' => $isCadastrosFinalizados ]); ?>
	<!-- END -->
	
	<?php
	

		
		// INTEREST CODE
		if($vendedor->status_id == 1){
			 //echo $this->Html->link('<span class="glyphicon glyphicon-lock"></span>', 'javascript:void(0);', ['onclick' => "ativarVendedor({$vendedor->id},'desativar');", 'class' => 'btn btn-default btn-sm ativado', 'title' => 'Desativar', 'escape' => false, 'disabled' => $isCadastrosFinalizados, 'style' => 'background-color: #dff0d8;', 'id' => 'desativar-'.$vendedor->id]);
			 //echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => "ativarVendedor('{$vendedor->id}', 'desativar');" ] );
			  //echo $this->element('Buttons/btn-lock', ['url' => []]);
			  
			  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
		
		}else if($vendedor->status_id == 2){
			//echo $this->Html->link('<span class="glyphicon glyphicon-lock"></span>', 'javascript:void(0);', ['onclick' => "ativarVendedor('{$vendedor->id}', 'ativar');", 'class' => 'btn btn-default btn-sm warning desativado', 'title' => 'Ativar', 'escape' => false, 'disabled' => $isCadastrosFinalizados, 'style' => 'background-color: #f2dede;', 'id' => 'ativar-'.$vendedor->id]);
			//echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => "ativarVendedor('{$vendedor->id}', 'ativar');" ] );
			 //echo $this->element('Buttons/btn-lock', ['url' => []]); 
			 
			 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
		}
		// END INTEREST CODE
		
	?>

</td>

Open in new window

This appears to generate this code
<td class="text-center" width="200px">

	<a href="/xxxx_exclusive2018/admin/vendedores/view/10398" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>						<a href="/xxxx_exclusive2018/admin/vendedores/edit/10398" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>						<form name="post_5af43c61881e1977233286" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10398"><input type="hidden" name="_method" value="POST"/></form><a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10398?&quot;)) { document.post_5af43c61881e1977233286.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>
	<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
</td>

Open in new window


But it does not match up - what am I missing?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
I guess the correspondence is:

<td class="text-center" width="200px">

<!--  1  -->
<?= $this->element('Buttons/btn-view', ['url' => ['action' => 'view', $vendedor->id] ]); ?>
<?= $this->element('Buttons/btn-edit', ['url' => ['action' => 'edit', $vendedor->id] ]); ?>
<!--  1 end -->

<!--  2  -->
<?= $this->element('Buttons/btn-delete', ['url' => ['action' => 'delete', $vendedor->id], 'id' => $vendedor->id, 'disabled' => $isCadastrosFinalizados ]); ?>
<!--  2 end -->


<?php

	// --   3  ---
	if($vendedor->status_id == 1){
		  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
	}else if($vendedor->status_id == 2){
		 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
	}
	 // --   3 end ---
?>

</td>


<td class="text-center" width="200px">

<!--  1  -->
<a href="/xxxx_exclusive2018/admin/vendedores/view/10398" title="Visualizar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-eye"></i></a>				
<a href="/xxxx_exclusive2018/admin/vendedores/edit/10398" title="Editar" class="btn btn-outline-secondary btn-sm"><i class="fas fa-edit"></i></a>					
<!--  1 end -->

<!--  2  -->
<form name="post_5af43c61881e1977233286" style="display:none;" method="post" action="/xxxx_exclusive2018/admin/vendedores/delete/10398">
	<input type="hidden" name="_method" value="POST"/>
</form>

<a href="#" title="Excluir" class="btn btn-outline-secondary btn-sm" onclick="if (confirm(&quot;Deseja realmente excluir o registro # 10398?&quot;)) { document.post_5af43c61881e1977233286.submit(); } event.returnValue = false; return false;"><i class="fas fa-trash-alt"></i></a>                        				
<!--  2 end -->

<!--  3  -->
<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>
<!--  3 end -->

</td>

Open in new window


Probably CakePHP methods introduces some not very intuitive code...
0
Julian HansenCommented:
Thank you then it would seem you want to bind to this

<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>

Open in new window


you could do this
$('.fa-lock').click(function() {
 ativarVendedor(id, acao);
});

Open in new window

Two things
1. where do id and acao come from
2. I don't like the above solution because there is nothing specific to isolate the button. I took a brief look at how cakePHP allows you to add a custom class to your ouput but it seems a bit elusive as you are using $this->element() and most of the results use $this->Form.
0
leakim971PluritechnicianCommented:
I believe this "$this->element" is a custom function, not a CakePHP one...
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
But in this case how to pass the parameters to jQuery?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
What I already tried, the $vendedor->id doesn't change...

    $('.fa-lock').click(function() {
           console.log(<?php echo $vendedor->id; ?>);
        ativarVendedor(<?php echo $vendedor->id; ?>, 'ativar');
    });

Open in new window

0
Julian HansenCommented:
@leakim - I believe you are right

What I already tried, the $vendedor->id doesn't change...
It won't change because you are emitting $vendor->id in the PHP code - which brings me back to my question about where id must come from?

I need to know how the id and the button relate to each other - what is it you are wanting to do here? What do you want the id to be inside the call to ativarVendedor?
Take a look at the target line
<a href="/xxxx_exclusive2018/admin/vendedores" title="Status" class="btn btn-outline-secondary btn-sm"><i class="fas fa-lock"></i></a>

Open in new window

There is no id associated with this line - so where must the id come from?

Where is the element() function defined? Can we see that code?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
In the CakePHP View there is a foreach to present data

<?php foreach($vendedores as $vendedor): ?>

	<tr>
		<td><?= $vendedor->id ?></td>
		

			<td><?php if(!empty($vendedor->loja)){ echo $vendedor->loja->descricao; }else{ echo 'Loja desativada'; } ?></td>

			<td><?= $vendedor->nome_completo ?></td>
			<td><?= $vendedor->status->nome ?></td>
			
			
			<?php /*<td><?= $vendedor->email ?></td>*/ ?>
			<td class="text-right"><?php
			$valor = $this->Number->currency($vendedor->total_vendas);
			echo $this->Html->link($valor, ['controller' => 'vendas', 'action' => 'index', '?' => ['vendedor_id' => $vendedor->id]]);
			?></td>
			
		<td><?= $vendedor->created->format('d/m/Y H:i') ?></td>
	   
		<td class="text-center" width="200px">
		
			<?= $this->element('Buttons/btn-view', ['url' => ['action' => 'view', $vendedor->id] ]); ?>
			<?= $this->element('Buttons/btn-edit', ['url' => ['action' => 'edit', $vendedor->id] ]); ?>
			<?= $this->element('Buttons/btn-delete', ['url' => ['action' => 'delete', $vendedor->id], 'id' => $vendedor->id, 'disabled' => $isCadastrosFinalizados ]); ?>
			
			<?php
			
				if($vendedor->status_id == 1){
					  // How to make it calls the jQuery
					  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
				}else if($vendedor->status_id == 2){
					 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
				}

			?>

		</td>
	</tr>

<?php endforeach ?>



<?php $this->append('script_footer'); ?>

<script type="text/javascript">

function ativarVendedor(id, acao){

	$.confirm({
		title: 'Atenção!',
		content: 'Deseja realmente ' + acao + ' o vendedor?',
		buttons: {
			confirmar: function() {''

				$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
					console.log('teste');
				}, 'json');
				location.reload();

			},
			cancelar: function() {
				$.alert('Ação cancelada!');
			}
		}
	});

}
</script>

Open in new window

0
Julian HansenCommented:
I see - then we need to do the following

1. We need to find out how to add a custom class to the <a> link that is generated [not 100% necessary but would be first prize]
2. We need to find out how to add a custom data-attribute to the element.

Once we solve those issues the rest is trivial.

We need to see the code for the function $this->element()

If that is not possible we can simply wrap the $this->element in a span
<span class="ativarVendedor-link" data-id="<?= $vendedor->id ?>">
<?php
if($vendedor->status_id == 1){
	  // How to make it calls the jQuery
	  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
}else if($vendedor->status_id == 2){
	 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
}
?>
</span>

Open in new window

Now we can do this
$(function() {
  $('.ativarVendedor-link').click(function(e) {
     e.preventDefault();
     ativarVendedor(this.dataset.id, 'ativar');
  });
});

Open in new window


Better if we can target the class and custom data attribute directly on the button (<a>) but failing that this should also work.
0
leakim971PluritechnicianCommented:
I downloaded cakephp-3-6-2.zip, unzipped to check the src / Template / Element / folder, mine just have a Flash folder
Could you upload your Buttons/btn-lock.ctp

Is this btn-lock or btn-block ?

Also you may do :

echo "<span class='yourClassHere'>" . $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] ) . "</span>";

and use jQuery :

$('.yourClassHere').on('click', 'a', function() {
  alert("got it");
   var id = ''; // Populate as required
   var acao = ''; // Populate as required
   ativarVendedor(id, acao)
});

Open in new window

0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
@leakim971

As one of my try I  created a  btn-lock  button based on  exising btn-delete

btn-delete
<?php
echo $this->Form->postLink('<i class="fas fa-trash-alt"></i>', $url, ['confirm' => __('Deseja realmente excluir o registro # {0}?', $id), 'title' => 'Excluir', 'class' => 'btn btn-outline-secondary btn-sm', 'escape' => false, 'disabled' => $disabled]);

Open in new window


btn-lock
<?php
echo $this->Html->link('<i class="fas fa-lock"></i>', $url, ['title' => 'Status', 'class' => 'btn btn-outline-secondary btn-sm', 'escape' => false]);

Open in new window


The CakePHP project where it remains
img001
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
@Julian

Your workaround works out!

Just one error  I have in jQuery code that uses $.confirm , could you give a look?

img002
<?php $this->append('script_footer'); ?>
<script type="text/javascript">

        $(function() {
          $('.ativarVendedor-link').click(function(e) {
             e.preventDefault();
             
			 // OK
             console.log(this.dataset.id);
            ativarVendedor(this.dataset.id, 'ativar');
          });
        });

	function ativarVendedor(id, acao){
		console.log('XXXXX');
        
        // 
		$.confirm({
		    title: 'Atenção!',
		    content: 'Deseja realmente ' + acao + ' o vendedor?',
		    buttons: {
		        confirmar: function() {''

		        	$.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
		        		console.log('teste');
					}, 'json');
		        	location.reload();

		        },
		        cancelar: function() {
		            $.alert('Ação cancelada!');
		        }
		    }
		});

	}
</script>

Open in new window

0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Since this issue derivates from the original question I opened another question

jQuery issue.
0
Julian HansenCommented:
$.confirm - where is that defined. It is not part of jQuery. I suspect you are trying to use a plugin but you have not added the link to your page.
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
The $.confirm issue was solved by the other question. You are right!
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Just to continue the original question

The jQuery code really runs now after add the links.

img001
The code needs to pass a 2.nd parameter, this way I tryed is not correct, could you check?

<span class="ativarVendedor-link" data-id="<?= $vendedor->id ?>"  data-id2="<?= $vendedor->status->id ?>">
	<?php
	if($vendedor->status_id == 1){
		  // How to make it calls the jQuery
		  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
	}else if($vendedor->status_id == 2){
		 echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
	}
	?>
</span>  

Open in new window


After that I guess the problem will be solved.
0
Julian HansenCommented:
That is fine but remember to retrieve it in your jQuery code - how will the second ID be used?
0
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Well


The 2nd id is needed to inform if the vendor must to be "activated"  or  "deactivated".
In the meanwhile I develop this not very elegant workaround to get it


<span class="ativarVendedor-link" data-id="<?= $vendedor->id .'-'. $vendedor->status_id ?>">
      <?php
      
            if($vendedor->status_id == 1){
                    // How to make it calls the jQuery
                    echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
            }else if($vendedor->status_id == 2){
                   echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
            }
      ?>
</span>    


<script type="text/javascript">
     
      function ativarVendedor(id, acao){

            $.confirm({
                title: 'Atenção!',
                content: 'Deseja realmente ' + acao + ' o vendedor?',
                buttons: {
                    confirmar: function() {

                          $.get(base_url + 'admin/vendedores/ativar/' + id, function(data, status){
                                console.log('teste');
                              }, 'json');
                          location.reload();

                    },
                    cancelar: function() {
                        $.alert('Ação cancelada!');
                    }
                }
            });

      }
   
   
    $(function() {
      $('.ativarVendedor-link').click(function(e) {
         e.preventDefault();
 
         console.log(this.dataset.id);
         
         var tipo = Right(this.dataset.id,1)
         
         console.log(tipo);
         
         if (tipo==1)
            {
                console.log('desativar');
                ativarVendedor(this.dataset.id, 'desativar');
            }
         else
         {
            console.log('ativar');
            ativarVendedor(this.dataset.id, 'ativar');
          }
      });
    });

    function Right(str, n){
        if (n <= 0)
           return "";
        else if (n > String(str).length)
           return str;
        else {
           var iLen = String(str).length;
           return String(str).substring(iLen, iLen - n);
        }
    }

</script>
0
Julian HansenCommented:
PHP Code

<span class="ativarVendedor-link" data-id="<?= $vendedor->id ?>" data-tipo="<?= $vendedor->status_id?>">
<?php
	  echo $this->element('Buttons/btn-lock', ['url' => [], 'class' => 'teste' ] );
?>
</span>

Open in new window

jQuery
$(function() {
  $('.ativarVendedor-link').click(function(e) {
    e.preventDefault();
    var id = this.dataset.id;
    var tipo = (this.dataset.tipo == 1) ?  'desativar' : 'ativar';
    ativarVendedor(id, tipo);
  });
});

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Julian

It runs perfectly in an elegant way!

My conclusion is that CakePHP doesn't have to take part to do this job or if it has a way to implement it by using,  it is not very clear at this moment...

Thank you very much.
0
Julian HansenCommented:
You are welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.