<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
    <title>@yield('titulo') - {{env('APP_EMPRESA')}}</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="@yield('titulo') - {{env('APP_EMPRESA')}}" />
    <meta property="og:url" content="https://lopakdesigner.com" />
    <meta property="og:site_name" content="{{ env('COPYRIGHT') }}" />
    <link rel="canonical" href="https://lopakdesigner.com" />
    <link rel="shortcut icon" href="{{ url('adm') }}/assets/media/logos/favicon.ico" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" />
    @yield('css')
</head>

<div id="mainBlock">
    <div class="interna serv">
        <div class="cnt-interna">
            <div class="modint-13">
                <div class="bg-img" style="background-image:url();"></div>
                <div class="titulo-bread">
                    <h1>Envio</h1>
                </div>
            </div>
            <div class="sobre-19">
                <div class="full-max">
                    <div id="mainBlock">
                        <div class="interna serv">
                            <div class="cnt-interna">
                                <div class="modint-13">
                                    <div class="bg-img" style="background-image:url();"></div>
                                    <div class="titulo-bread">
                                        <h1>Time... {{$time}}</h1>
                                        <h1>Celular  </h1>
                                    </div>
                                </div>
                                <div class="sobre-19">
                                    <div class="full-max">
                                        <div class="txt-conteudo">
                                            <meta http-equiv="Refresh" content="{{$time}}; url={{ route('marketing') }}" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
</div>


{{-- <!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
    <title>@yield('titulo') - {{env('APP_EMPRESA')}}</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="@yield('titulo') - {{env('APP_EMPRESA')}}" />
    <meta property="og:url" content="https://lopakdesigner.com" />
    <meta property="og:site_name" content="{{ env('COPYRIGHT') }}" />
    <link rel="canonical" href="https://lopakdesigner.com" />
    <link rel="shortcut icon" href="{{ url('adm') }}/assets/media/logos/favicon.ico" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" />
    @yield('css')
</head>

<div id="mainBlock">
    <div class="interna serv">
        <div class="cnt-interna">
            <div class="modint-13">
                <div class="bg-img" style="background-image:url();"></div>
                <div class="titulo-bread">
                    <h1>{{count($exe)}} Anuncios</h1>
                </div>
            </div>
            <div class="sobre-19">
                <div class="full-max">
                    <div class="txt-conteudo">
                        <table border="1">
                            <tr>
                                <th></th>
                                <th>Nome</th>
                                <th>Cidade-UF</th>
                                <th>Celular</th>
                                <th>Ações</th>
                            </tr>
                            @foreach ($exe as $k => $dds)
                                <tr id="anuncio{{$dds->id}}">
                                    <td>{{ $k + 1 }}</td>
                                    <td>{{ $dds->nome }}</td>
                                    <td>{{ $dds->cidade }}-{{ $dds->estado }}</td>
                                    <td>{{ !empty($dds->Whatsapp->numero) ? $dds->Whatsapp->numero : '' }}</td>
                                    <td>
                                        @if (!empty($dds->Whatsapp->numero))
                                            <input type="hidden" value="55{{ setUri($dds->Whatsapp->numero) }}" id="celular{{ $dds->id }}">
                                            <input type="hidden" value="{{ explode(' ', $dds->nome)[0] }}" id="nome{{ $dds->id }}">
                                            <a onclick="javascript:enviarMensagem({{ $dds->id }})" href="javascript:void(0)" rel="noopener noreferrer">Conversar</a>
                                        @endif
                                    </td>
                                </tr>
                            @endforeach
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
    function enviarMensagem(id) {

        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            url: "{{ route('marketing.update') }}",
            method: 'POST',
            data: {
                id: id, 
            },
            success: function(result) {
                var celular = $("#celular" + id).val();
                var texto = "Olá, meu Ir∴ " + $("#nome" + id).val() + " 👋.\n\n" +
                    "Aqui é o seu *Ir∴ Roberto Brito* da *Loja 3 de Outubro da GLEB*.\n\n" +
                    "Encontrei seu contato no *Aplicativo Agenda Maçônica Brasil* e quero te apresentar uma *Inteligência Artificial que faz automáticos no WhatsApp*. \n\n" +
                    "Se quiser conhecer como funciona a *Inteligência Artificial da Lopak Tecnologia* \n\n" +
                    "Basta responder *quero conhecer*.";
                texto = encodeURIComponent(texto); // Codifica o texto para URL
                var url = "https://api.whatsapp.com/send?phone=" + celular + "&text=" + texto;
                window.open(url, "_system");
                $("#anuncio" + id).hide();
            }
        });


    }
</script> --}}
