KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/leadai/leadai.co.in/resources/views/leads/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/leadai/leadai.co.in/resources/views/leads/list.blade.php
@extends('layout')
@section('content')
    <!-- begin::main content -->
    <style>
        .input_upload {
            width: 100px;
            height: 35px;
            position: absolute;
            bottom: -34px;
            right: 350px;
        }

        .import-content p {
            padding: 0;
            margin: 0;
            margin-bottom: 8px;
            font-size: 13px;
        }

        .filter-form-box {
            background-color: #FBFAFA;
            padding: 10px 24px;
            position: absolute;
            width: 450px;
            border: 1px solid #ddd;
            border-radius: 5px;
            top: 71px;
            z-index: 20;
        }

        .filter-form-box input {
            height: 40px !important;
        }

        .diamond {
            width: 20px;
            height: 20px;
            background-color: #FBFAFA;
            transform: rotate(45deg);
            position: relative;
            top: -21px;
            left: 0px;
            border-top: 1px solid #ddd;
            border-left: 1px solid #ddd;
        }

        .seach-input:focus {
            outline: none !important;
            border-top: 1px solid #ddd !important;
            border-bottom: 1px solid #ddd !important;
        }

        .seach-input {
            height: 40px !important;
            border-top: 1px solid #ddd !important;
            border-bottom: 1px solid #ddd !important;
            border-left: 1px solid #ddd !important;
        }
    </style>
    <main class="main-content">
        <div class="container">
            <div class="toast d-none float-right">
                <div class="toast-body bg-success text-white">
                    <i class="fa fa-check fa-lg"></i>&nbsp Status Update Successfully
                </div>
            </div>

            <!-- begin::page header -->
            <div class="page-header d-md-flex align-items-center justify-content-between">
                <div>
                    <h3>Manage  @php echo \App\Helpers\Frontend::lead_name(); @endphp</h3>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="{{ asset('dashboard') }}">{{ __('message.dashboard') }}</a>
                            </li>
                            <li class="breadcrumb-item" aria-current="page"> @php echo \App\Helpers\Frontend::lead_name(); @endphp</li>
                            <li class="breadcrumb-item active" aria-current="page">List</li>
                        </ol>
                    </nav>
                </div>
                <div>
                    <div class="form-group mt-3">
                        <form class="pipeline_filter_form" action="{{asset('leads/list')}}" method="get">
                            <select class="form-control form-control-sm change_pipeline" name="change_pipeline">
                                <option selected disabled>Select Pipeline</option>
                                @if (!empty($pipelines))
                                    @foreach ($pipelines as $pipeline)
                                        <option value="{{ $pipeline->id }}"
                                            {{ isset($_GET['change_pipeline']) ? ($pipeline->id == $_GET['change_pipeline'] ? 'selected' : '') : '' }}>
                                            {{ $pipeline->name }}</option>
                                    @endforeach
                                @endif
                            </select>
                        </form>
                    </div>
                </div>
            </div>
            <!-- end::page header -->

            <x-flashMessage />
            <div class="card">
                <div class="card-header">
                    @if ($errors->any())
                        @foreach ($errors->all() as $error)
                            <div>{{ $error }}</div>
                        @endforeach
                    @endif
                    <div class="row">
                        <div class="col-md-4 py-3">
                            <form action="{{ asset('leads/list') }}" method="get">
                                <div class="company-field-box">
                                    <div>
                                        <div class="input-group">
                                            <div class="input-group-prepend">
                                                <button type="button"
                                                    class="btn border input-group-text filter-company-btn">
                                                    <i class="icon ti-filter fa-lg"></i>
                                                </button>
                                            </div>
                                            <input type="search"
                                                value="{{ isset($_GET['search']) ? $_GET['search'] : null }}" name="search"
                                                class="form-control border-right-0 seach-input" placeholder="Type Lead Name Here">
                                            <button class="btn border border-left-0" type="submit"
                                                style="margin-left:-5px;">
                                                <i class="icon ti-search fa-lg mt-1"></i>
                                            </button>
                                        </div>

                                        {{-- Filter Popup Box --}}
                                        <div class="filter-form-box d-none">
                                            <div class="diamond"></div>
                                            <form method="get" action="{{ asset('leads/list') }}">
                                                <div class="form-group">
                                                    <label> {{ __('message.email') }}</label>
                                                    <input type="text" name="email"
                                                        value="{{ isset($_GET['email']) ? $_GET['email'] : null }}"
                                                        class="form-control" id="email">
                                                </div>
                                                <div class="row">
                                                    <div class="form-group col-6">
                                                        <label>{{ __('message.name') }} </label>
                                                        <input value="{{ isset($_GET['name']) ? $_GET['name'] : null }}"
                                                            type="text" name="name" class="form-control"
                                                            id="name">
                                                    </div>
                                                    <div class="form-group col-6">
                                                        <label>{{ __('message.phone') }}</label>
                                                        <input type="text"
                                                            value="{{ isset($_GET['mobile']) ? $_GET['mobile'] : null }}"
                                                            name="mobile" class="form-control" id="mobile">
                                                    </div>
                                                </div>
                                                <div class="row">
                                                   
                                                    <div class="form-group col-6">
                                                        <label>Source</label>
                                                        <select class="form-control" name="source">
                                                            <option value="" disabled>Select Source</option>
                                                            @if (!$sources->isEmpty())
                                                                @foreach ($sources as $source)
                                                                    <option value="{{ $source->id }}">
                                                                        {{ $source->name }}</option>
                                                                @endforeach
                                                            @endif
                                                        </select>
                                                    </div>
                                                    <div class="form-group col-6">
                                                        <label>Course</label>
                                                        <select class="form-control" name="course">
                                                            <option value="">Select Course</option>
                                                            @if (!$products_list->isEmpty())
                                                                @foreach ($products_list as $products)
                                                                    <option value="{{ $products->id }}">
                                                                        {{ $products->name }}</option>
                                                                @endforeach
                                                            @endif
                                                        </select>
                                                    </div>
                                                </div>
                                               
                                                <div class="row">
                                                    <div class="form-group col-6">
                                                        <label>{{ __('message.start') }} {{ __('message.date') }}</label>
                                                        <input type="date" name="start_date"
                                                            value="{{ isset($_GET['start_date']) ? $_GET['start_date'] : null }}"
                                                            class="form-control" id="start_date">
                                                    </div>
                                                    <div class="form-group col-6">
                                                        <label>{{ __('message.end') }} {{ __('message.date') }}</label>
                                                        <input type="date" name="end_date"
                                                            value="{{ isset($_GET['end_date']) ? $_GET['end_date'] : null }}"
                                                            class="form-control" id="end_date">
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="form-group col-12">
                                                        <a href="{{ asset('leads/list') }}"
                                                            class="btn btn-danger clear-button text-white">{{ __('message.clear') }}</a>
                                                        <button type="submit"
                                                            class="btn btn-success apply-button">{{ __('message.apply') }}</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        {{-- End Box --}}
                                    </div>
                                </div>
                            </form>
                        </div>

                        <div class="col-md-8 justify-content-end py-3">
                            <div class="">
                            {{-- Export --}}
                            @if (Auth::user()->hasRole('admin') || Auth::user()->can('view-lead'))
                            <a data-toggle="tooltip" data-original-title="Export"
                                class="btn btn-outline-secondary btn-uppercase pull-right"
                                href="{{ asset('export-leads') }}">
                                <i class="ti-export fa-lg"></i>
                            </a>
                            @endif

                            @if (Auth::user()->hasRole('admin') || Auth::user()->can('add-lead'))
                            <a data-toggle="tooltip" data-original-title="Import" data-bs-toggle="modal"
                                data-bs-target="#importModal"
                                class="btn btn-outline-secondary btn-uppercase pull-right mr-1">
                                <i class="ti-import fa-lg"></i>
                            </a>
                            @endif
                            @if (Auth::user()->hasRole('admin') || Auth::user()->can('view-lead'))
                            <a data-toggle="tooltip" data-original-title="Kanban View" href="{{ asset('leads') }}"
                                class="btn btn-outline-secondary btn-uppercase pull-right mr-1">
                                <i class="ti-view-list fa-lg"></i>
                            </a>
                            @endif

                            @if (Auth::user()->hasRole('admin') || Auth::user()->can('add-lead'))
                            <a data-toggle="tooltip" data-original-title="New Lead" data-bs-toggle="modal"
                                data-bs-target="#leadModal"
                                class="btn btn-outline-secondary btn-uppercase pull-right mr-1">
                                <i class="ti-plus fa-lg"></i>
                            </a>
                            @endif
                                <div class="d-flex justify-content-end ">
                                @if (Auth::user()->hasRole('admin') || Auth::user()->can('delete-lead'))

                                         <button data-toggle="tooltip" data-original-title="Delete Leads" class="pt-2 pb-2 btn btn-outline-secondary text-uppercase mr-2 multiple-delete-btn" >
                                                    <i class="ti-trash fa-lg" style="padding-bottom:2px;"></i>
                                        </button>
                                @endif
                                </div>

                                </div>



                        </div>
                    </div>
                </div>
                <div class="card-body">
                    @if (isset($leads))
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>
                                            <input type="checkbox"  id="checkAll"  />
                                        </th>
                                        <th>#</th>
                                        <th>Contact</th>
                                        <th>Product</th>
                                        <th>Stage</th>
                                        <th>Assigned</th>
                                        <th>Created</th>
                                        <th>{{ __('message.action') }}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @if (!empty($leads))
                                        @foreach ($leads as $key => $lead)

                                            @php 
                                                    $allUser = \App\Helpers\Frontend::getUser($lead->id);
                                                   
                                            @endphp
                                            <tr>
                                                 <td>
                                                    <input type="checkbox" name="checkbox[]" class="userids" value="{{$lead->id}}" />
                                                </td>
                                                <td>{{ ++$key }}</td>
                                                <td>{{ $lead->name }}</td>
                                                <td>{{ $lead->product_name }}</td>
                                                <td>{{ $lead->stage }}</td>
                                                <td>
                                                   
                                                    @if(isset($allUser) && !empty($allUser))
                                                        @foreach($allUser as $u)
                                                        
                                                            @if(isset($u->user_details))
                                                                <span class="btn btn-sm btn-outline-info">{{$u->user_details->name}}</span>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                </td>
                                                <td>
                                                    {{ date('d-m-Y', strtotime($lead->created_at)) }}
                                                </td>
                                                <td >
                                                    <div class="btn-group pull-right">
                                                    @if (Auth::user()->hasRole('admin') || Auth::user()->can('view-lead'))
                                                        <a class="btn btn-sm btn-primary text-white" data-toggle="tooltip"
                                                            data-original-title="Lead Detail"
                                                            href="{{ asset('leads/details/' . $lead->id) }}"><i
                                                                class="fa fa-eye fa-lg"></i>
                                                        </a>
                                                    @endif
                                                    @if (Auth::user()->hasRole('admin') || Auth::user()->can('edit-lead'))
                                                        <a class="btn btn-sm btn-success text-white" data-toggle="tooltip"
                                                            data-original-title="Edit Lead"
                                                            href="{{ asset('leads/edit-lead/' . $lead->id) }}"><i
                                                                class="fa fa-edit fa-lg"></i>
                                                        </a>
                                                    @endif

                                                    @if (Auth::user()->hasRole('admin') || Auth::user()->can('delete-lead'))
                                                        <button class="btn btn-sm btn-danger text-white emp-delete-btn"
                                                            data-toggle="tooltip" data-original-title="Delete Lead"
                                                            emp_id="{{ $lead->id }}">
                                                            <i class="fa fa-trash fa-lg"></i>
                                                            </button>
                                                     @endif
                                                        <div data-toggle="tooltip" data-original-title="Add Task">
                                                            <button lead_id="{{$lead->id}}" all_lead="{{$lead}}" data-toggle="modal" data-target="#ListTaskModal" style="padding: 8px;"
                                                                class="btn btn-sm btn-outline-primary open_task_modal pull-right">
                                                                <i class="icon ti-plus"></i>
                                                            </button>
                                                        </div>
                                                    
                                                    </div>
                                                   
                                                </td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <h1>No Record Found!!</h1>
                                    @endif
                                </tbody>
                            </table>
                        </div>
                        <div class="blade-pagination py-3 d-flex justify-content-center">
                            {{$leads->links()}}
                        </div>


                    @endif
                </div>
            </div>
        </div>
      
        <!-- The Modal -->




        @include('leads.modal.lead_import_modal')
        @include('leads.modal.add_task')

    </main>
    @include('leads.modal.create_modal')
   
    <!-- end::main content -->
@endsection
@push('footer-script')
    <!-- begin::dataTable -->
    <!-- end::dataTable -->
    <script>
        $(document).ready(function() {
            $(".open_task_modal").click(function(){
                $(".task_add_form").trigger('reset');
                var lead_id = $(this).attr("lead_id");
                $("#add_lead_id").val(lead_id);
                
                $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "lead_id": lead_id
                            },
                            url: "{{asset('fetch-lead-user')}}",
                            dataType: "html",
                            success: function(result) {
                                $(".add_task_select").html("");
                                var allData = JSON.parse(result);

                                if(allData.message == "success")
                                {
                                    var i;
                                    for(i=0;i<allData.data.length ; i++)
                                    {
                                        var option = `<option value="${allData.data[i].user_details.id}">${allData.data[i].user_details.name}</option>`;

                                        $(".add_task_select").append(option);
                                    }
                                }
                                
                            },
                            error: function(xhr, status, error) {
                                //swal("failed!", "Failed !", "error");
                                console.log(result);
                               
                            }
                        });                           
                                            
                //var allLead = $(this).attr("all_lead");
                //console.log(allLead);
            });
            
            $("#checkAll").click(function() {
                $('.userids:checkbox').not(this).prop('checked', this.checked);
                /*var length = $('.userids[type="checkbox"]:checked').length;
                if ($(".multiple-delete-btn").hasClass('d-none')) {
                    $(".multiple-delete-btn").removeClass("d-none");
                    $(".multiple-delete-btn").html('<span class="pt-1">Delete (' + length + ")</span>");
                } else {
                    $(".multiple-delete-btn").addClass("d-none");
                }*/
            });
            //employee delte button code
            $(".emp-delete-btn").click(function() {
                var emp_id = $(this).attr("emp_id");
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "emp_id": emp_id
                            },
                            url: "{{ asset('leads/delete') }}",
                            dataType: "html",
                            success: function(result) {
                                //console.log(result);
                                swal("success!", "Successfully deleted!", "success");
                                window.location.reload();
                            },
                            error: function(error) {
                                swal("Failed !", "Failed !", "error");
                                window.location.reload();
                            }
                        });
                    }
                });
            });
            $(".input_file_upload").on("change", function() {
                $(".import-lead-form").submit();
            });
            $(".import-lead-form").on("submit", function(event) {
                // Prevent the default form submission
                event.preventDefault();
                $.ajax({
                    type: "POST",
                    url: "{{ asset('import-leads') }}",
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    data: new FormData(this),
                    processData: false,
                    contentType: false,
                    cache: false,
                    beforeSend: function() {
                        $(".import-content").html("<h5>Please wait uploading...</h5>");
                    },
                    success: function(response) {
                        if (response.message == "success") {
                            var div = `<div class='text-success text-center' style='font-size:50px'>
                                <i class='fa fa-check-circle' ></i>
                                <p  style='font-size:20px'>Leads Import Successfully !</p>
                            </div>`;
                            $(".import-content").html(div);
                            setTimeout(function() {
                                window.location.reload();
                            }, 3000);
                        } else {
                            //console.log(error);
                            var div = `<div class='text-danger text-center' style='font-size:50px'>
                                <i class='fa fa-times-circle' ></i>
                                <p  style='font-size:20px'>Please check the datasheet !</p>
                            </div>`;
                            $(".import-content").html(div);
                        }
                    },
                    error: function(xhr, status, error) {
                        //console.log(error);
                        var div = `<div class='text-danger text-center' style='font-size:50px'>
                            <i class='fa fa-times-circle' ></i>
                            <p  style='font-size:20px'>Please check the datasheet !</p>
                        </div>`;
                        $(".import-content").html(div);
                    }
                });
            });
            // Delete Multiple
            $(".multiple-delete-btn").click(function() {
                var URL = "{{ asset('leads/lead-delete-multiple') }}";
                var user_ids = [];
                $('.userids:checkbox:checked').each(function() {
                    user_ids.push($(this).val());
                });
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "ids": user_ids
                            },
                            url: URL,
                            dataType: "html",
                            success: function(result) {
                                console.log(result);
                                swal("success!", "Successfully deleted!", "success");
                                window.location.reload();
                            },
                            error: function(xhr, status, error) {
                                swal("failed!", "Failed !", "error");
                                window.location.reload();
                            }
                        });
                    }
                });
            });


         
            $(".select_sources").on("change",function(){
                var source = $(this).val();

                if(source==="other")
                {
                    var input = `
                    <div class="d-flex">
                        <label class="col-md-5">Add Source</label>
                        <input type="text" name="source_name" class="form-control col-md-7" >
                    </div>
                        `;
                    $(".add_other_source").append(input);
                }
                else
                {
                    $(".add_other_source").html("");
                }
            });

            $(".change_pipeline").on("change",function(){
                $(".pipeline_filter_form").submit();
            });
    

        });

        $(".apply-button").click(function() {
            $(".filter-form-box").addClass("d-none");
        });

        //filter company code
        $(".filter-company-btn").click(function() {
            if ($(".filter-form-box").hasClass("d-none")) {
                $(".filter-form-box").removeClass("d-none");
            } else {
                $(".filter-form-box").addClass("d-none");
            }
        });
        //change status code
        $(".status-change").on("change", function() {
            var check_val = 0;
            if ($(this).is(":checked")) {
                check_val = 1;
            }
            var id = $(this).val();
            $.ajax({
                type: "post",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: "{{ asset('change-user-status') }}",
                data: {
                    user_id: id,
                    status: check_val
                },
                dataType: "html",
                success: function(result) {
                    console.log(result);
                    var allData = JSON.parse(result);
                    if (allData.message == "success") {
                        $('.toast').removeClass('d-none');
                        $('.toast').toast('show');
                    } else {
                        var div = `
                        <div class="toast-body bg-danger text-white">
                                <i class="fa fa-times-circle-o fa-lg"></i>&nbsp Status Update Failed
                        </div>
                    `;
                        $('.toast').removeClass('d-none');
                        $('.toast').toast('show');
                        $('.toast').html(div);
                    }
                },
                error: function(xhr, status, error) {
                    console.log(error);
                    var div = `
                        <div class="toast-body bg-danger text-white">
                                <i class="fa fa-times-circle-o fa-lg"></i>&nbsp Status Update Failed
                        </div>
                    `;
                    $('.toast').removeClass('d-none');
                    $('.toast').toast('show');
                    $('.toast').html(div);
                }
            });
        });
    </script>
@endpush

Anon7 - 2021