Subversion Repositories SmartDukaan

Rev

Rev 27723 | Rev 29268 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<script type="text/javascript">
        $(function() {

                var object = {
                        timePicker : true,
                        locale : {
                                format : 'DD/MM/YYYY hh A'
                        }
                };

                $('input[name="scheduleTime"]').daterangepicker(
                                $.extend(getSingleDatePicker(), object), dateRangeCallback);

                $('input[name="editScheduleTime"]').daterangepicker(
                                $.extend(getSingleDatePicker(), object), dateRangeCallback);
        });

        $(".lead-request").click(function() {
                $("#newEntryLeadModal").modal({
                        backdrop : false
                });

        });

        $(".lead-edit-request").click(function() {
                $("#editLeadData").modal({
                        backdrop : false
                });

        });

        $('#statusFilter').multiselect({
                includeSelectAllOption : true,
                multiple : true,
                maxHeight : 200,
                buttonWidth : '180px',
                numberDisplayed : 1,
                nonSelectedText : 'Status',
                nSelectedText : ' - Status Selected',
                allSelectedText : 'All Status Selected',
                enableFiltering : true,
                enableCaseInsensitiveFiltering : true
        });

        $('#colorFilter').multiselect({
                includeSelectAllOption : true,
                multiple : true,
                maxHeight : 200,
                buttonWidth : '180px',
                numberDisplayed : 1,
                nonSelectedText : 'Color Status',
                nSelectedText : ' - Color Selected',
                allSelectedText : 'All Status Selected',
                enableFiltering : true,
                enableCaseInsensitiveFiltering : true
        });
</script>



<section class="wrapper">
        <div class="row">
                <div class="col-lg-12">
                        <h3 class="page-header">
                                <i class="icon_document_alt"></i>LEAD DASHBOARD
                        </h3>
                        <ol class="breadcrumb">
                                <li><i class="fa fa-home"></i><a
                                        href="${rc.contextPath}/dashboard">Home</a></li>
                                <li><i class="icon_document_alt"></i>Lead</li>
                                <li><button class="btn btn-primary newLead" data-toggle="modal"
                                                data-target="#newEntryLeadModal" type="button">New</button></li>
                        </ol>
                </div>
        </div>

        <table style="Width: 100%">
                <tr>
                        <td align="left" style="Width: 20%">
                                <div class="row">
                                        <div class="col-lg-2 form-group" style="width: 12%;">
                                                <select id="statusFilter" name="statusFilter" placeholder="Status"
                                                        class="form-control input-sm">
                                                        <option value="" disabled selected>Status</option> #foreach($ls
                                                        in $leadStatus) #if($ls == $selectedLeadStatus)
                                                        <option value="$ls" selected>$ls</option> #else
                                                        <option value="$ls">$ls</option> #end #end
                                                </select>
                                        </div>

                                        <div class="col-lg-2">
                                                <button class="btn btn-primary show-lead" type="button"
                                                        style="width: 25%; border-radius: 0px;">Submit</button>
                                        </div>
                                </div>
                        </td>
                </tr>

                <tr>
                        <td align="left" style="Width: 20%">
                                <div class="row">
                                        <div class="col-lg-2 form-group" style="width: 12%;">
                                                <select id="colorFilter" name="colorFilter" placeholder="Status"
                                                        class="form-control input-sm">
                                                        <option value="" disabled selected>Status</option>
                                                        <option value="All">All</option>
                                                        <option value="yellow">yellow</option>
                                                        <option value="green">green</option>

                                                </select>
                                        </div>

                                        <div class="col-lg-2">
                                                <button class="btn btn-primary show-colowise-lead" type="button"
                                                        style="width: 25%; border-radius: 0px;">Submit</button>
                                        </div>
                                </div>
                        </td>
                </tr>
        </table>

        <div id="lead-request-table">
                <div class="row">
                        <div class="col-lg-12">
                                <table class="table table-border table-condensed table-bordered"
                                        id="lead-table">
                                        <thead>
                                                <tr>
                                                        <th>Source</th>
                                                        <th>First Name</th>
                                                        <th>Last Name</th>
                                                        <th>Mobile</th>
                                                        <th>Address</th>
                                                        <th>City</th>
                                                        <th>State</th>
                                                        <th>Created By</th>
                                                        <th>Status</th>
                                                        <th>Created On</th>
                                                        <th>Updated On</th>
                                                        <th>ScheduleTimestamp</th>
                                                        <th>Closure Timestamp</th>
                                                        <th>Assign To</th>
                                                        <th>view</th>
                                                        <th>Action</th>
                                                </tr>
                                        </thead>
                                        <tbody>
                                                #if(!$lead.isEmpty()) #foreach( $request in $lead )
                                                #if($request.getColor() == "Green")
                                                <tr class="open-lead" bgcolor="#98FB98" data="$request.getId()">
                                                        #else
                                                <tr class="open-lead" bgcolor="$request.getColor()"
                                                        data="$request.getId()">
                                                        #end #if($request.getSource())
                                                        <td>$request.getSource()</td> #else
                                                        <td></td> #end
                                                        <td>$request.getFirstName()</td>
                                                        <td>$request.getLastName()</td>
                                                        <td>$request.getLeadMobile()</td>
                                                        <td>$request.getAddress()</td>
                                                        <td>$request.getCity()</td>
                                                        <td>$request.getState()</td>
                                                        <td>$request.getCreatedBy()</td>
                                                        <td>$request.getStatus()</td>
                                                        <td>$request.getCreatedTimestamp().format($dateTimeFormatter)</td>
                                                        <td>$request.getUpdatedTimestamp().format($dateTimeFormatter)</td>
                                                        #if($leadActivityMap.get($request.getId()).getSchelduleTimestamp())
                                                        <td>$leadActivityMap.get($request.getId()).getSchelduleTimestamp().format($dateTimeFormatter)</td>
                                                        #else
                                                        <td>00/00/0000 00:00</td> #end
                                                        #if($request.getClosureTimestamp())
                                                        <td>$request.getClosureTimestamp().format($dateTimeFormatter)</td>
                                                        #else
                                                        <td>00/00/0000 00:00</td> #end
                                                        #if($authIdAndAuthUserMap.get($request.getAssignTo()))
                                                        <td>$authIdAndAuthUserMap.get($request.getAssignTo()).getFirstName()</td>
                                                        #else
                                                        <td></td> #end
                                                        <td><button class="btn btn-primary view"
                                                                        data-requestid="$request.getId()" data-toggle="modal"
                                                                        data-target="#fetchLeadActivityData" type="button">View</button></td>
                                                        <td><button class="btn btn-primary editLead"
                                                                        data-leadid="$request.getId()" data-toggle="modal"
                                                                        data-target="#editLeadData" type="button">Edit</button></td>
                                                </tr>
                                                #end #else
                                                <tr>
                                                        <td colspan="12" style="text-align: center;">NO MATCHING
                                                                DATA FOUND FOR CRITERIA</td>
                                                </tr>
                                                #end
                                        </tbody>
                                </table>
                        </div>
                </div>
        </div>


        <div id="fetchLeadActivityData" class="modal" role="dialog">
                <div class="modal-dialog">
                        <div class="modal-content"></div>
                </div>
        </div>



        <div id="editLeadData" class="modal" role="dialog">
                <div class="modal-dialog">
                        <div class="modal-content">
                                <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                        <h4 class="modal-title">Edit Lead</h4>
                                </div>
                                <div class="modal-body">
                                        <div id="lead-edit-request">
                                                <div class="row">
                                                        <div class="col-lg-3">
                                                                <div class="input-group">
                                                                        <select class="form-control input-sm" id="assignTo"
                                                                                name="assignTo" placeholder="Assign">
                                                                                <option value="" disabled selected>Assign To</option>
                                                                                #foreach($authUser in $authUsers)
                                                                                <option value="$authUser.getId()">$authUser.getFirstName()</option>
                                                                                #end
                                                                        </select>
                                                                </div>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input placeholder="Remark" id="remark" name="remark"
                                                                        type="text" value="" class="form-control input-sm">
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <select id="reason" name="reason" placeholder="Reason"
                                                                        class="form-control input-sm">
                                                                        <option value="" disabled selected>Reason</option>
                                                                        <option value="No budget">No budget</option>
                                                                        <option value="No authority to take decision">No
                                                                                authority to take decision</option>
                                                                        <option value="No need for new business">No need for
                                                                                new business</option>
                                                                        <option value="Not ready in near future">Not ready in
                                                                                near future</option>
                                                                        <option value="No store availability">No store
                                                                                availability</option>
                                                                </select>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <select id="editStatus" name="editStatus" placeholder="Status"
                                                                        class="form-control input-sm" onchange="editStatusAction()">
                                                                        <option value="" disabled selected>Status</option>
                                                                        <option value="followUp">Follow Up</option>
                                                                        <option value="notInterested">Not Interested</option>
                                                                        <option value="finalized">Finalized</option>
                                                                </select>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input id="editScheduleTime" placeholder="scheduleTime"
                                                                        name="editScheduleTime" type="text" value=""
                                                                        class="form-control input-sm">
                                                        </div>
                                                </div>
                                        </div>
                                </div>

                                <div class="modal-footer">
                                        <button type="button" data-dismiss="modal"
                                                class="btn btn-default cancel-lead-request">Cancel</button>
                                        <button type="button" class="btn btn-default lead-edit-request">Submit</button>

                                </div>

                        </div>
                </div>
        </div>





        <div id="newEntryLeadModal" class="modal">
                <div class="modal-dialog">

                        <!-- Modal content-->
                        <div class="modal-content">
                                <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                        <h4 class="modal-title">Create Lead</h4>
                                </div>
                                <div class="modal-body">
                                        <div id="lead-request">
                                                <div class="row">
                                                        <div class="col-lg-3">
                                                                <div class="input-group">
                                                                        <input placeholder="First Name" name="firstName" id="firstName"
                                                                                type="text" class="form-control input-sm">
                                                                </div>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input placeholder="Last Name" id="lastName" name="lastName"
                                                                        type="text" value="" class="form-control input-sm">
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input placeholder="mobile" id="mobile" name="mobile"
                                                                        type="number" value="" class="form-control input-sm">
                                                        </div>
                                                </div>

                                                <div class="row">
                                                        <div class="col-lg-3 form-group">
                                                                <input id="address" name="address" placeholder="address"
                                                                        id="address" type="text" value="" class="form-control input-sm">
                                                        </div>
                                                        <div class="col-lg-3 form-group">
                                                                <input id="city" name="city" placeholder="city" type="text"
                                                                        value="" class="form-control input-sm">
                                                        </div>
                                                        <div class="col-lg-3 form-group">
                                                                <select class="form-control input-sm" id="state" name="state"
                                                                        placeholder="State">
                                                                        <option value="" disabled selected>State</option>
                                                                        #foreach($stateName in $stateNames)
                                                                        <option value="$stateName">$stateName</option> #end
                                                                </select>
                                                        </div>
                                                </div>

                                                <div class="row">

                                                        <div class="col-lg-3 form-group">
                                                                <select id="status" name="status" placeholder="Status"
                                                                        class="form-control input-sm" onchange="statusAction()">
                                                                        <option value="" disabled selected>Status</option>
                                                                        <option value="followUp">Follow Up</option>
                                                                        <option value="notInterested">Not Interested</option>
                                                                        <option value="finalized">Finalized</option>
                                                                </select>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input id="scheduleTime" placeholder="scheduleTime"
                                                                        name="scheduleTime" type="text" value=""
                                                                        class="form-control input-sm">
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <input id="createRemark" name="createRemark"
                                                                        placeholder="Remark" type="text" value=""
                                                                        class="form-control input-sm">
                                                        </div>
                                                </div>

                                                <div class="row">
                                                        <div class="col-lg-3 form-group">
                                                                <select class="form-control input-sm" id="createAssignTo"
                                                                        name="createAssignTo" placeholder="Assign">
                                                                        <option value="" disabled selected>Assign To</option>
                                                                        #foreach($authUser in $authUsers)
                                                                        <option value="$authUser.getId()">$authUser.getFirstName()</option>
                                                                        #end
                                                                </select>
                                                        </div>

                                                        <div class="col-lg-3 form-group">
                                                                <select class="form-control input-sm" id="leadSource"
                                                                        name="leadSource" placeholder="Source">
                                                                        <option value="" disabled selected>Source</option>
                                                                        <option value="SELF">SELF</option>
                                                                        <option value="NEWSPAPER">NEWSPAPER</option>
                                                                        <option value="INTERNET">INTERNET</option>
                                                                        <option value="PARTNER">PARTNER</option>
                                                                </select>
                                                        </div>
                                                </div>






                                        </div>
                                </div>

                                <div class="modal-footer">
                                        <button type="button" data-dismiss="modal"
                                                class="btn btn-default cancel-lead-request">Cancel</button>
                                        <button type="button" class="btn btn-default lead-request">Submit</button>

                                </div>
                        </div>
                </div>
        </div>
</section>


<script type="text/javascript">
        var editor;
        $(document)
                        .ready(
                                        function() {
                                                console.log($('#lead-table tbody tr').length)
                                                if ($('#lead-table tbody tr').length > 1) {
                                                        $('#lead-table thead tr').clone(true).appendTo(
                                                                        '#lead-table thead');
                                                        $('#lead-table thead tr:eq(1) th')
                                                                        .each(
                                                                                        function(i) {
                                                                                                var title = $(this).text();
                                                                                                $(this).html(
                                                                                                                '<input type="text" style = "width:60%;" placeholder="Search '
                                                                                                                                + title
                                                                                                                                + '" />');

                                                                                                $('input', this)
                                                                                                                .on(
                                                                                                                                'keyup change',
                                                                                                                                function() {
                                                                                                                                        if (table
                                                                                                                                                        .column(
                                                                                                                                                                        i)
                                                                                                                                                        .search() !== this.value) {
                                                                                                                                                table
                                                                                                                                                                .column(
                                                                                                                                                                                i)
                                                                                                                                                                .search(
                                                                                                                                                                                this.value)
                                                                                                                                                                .draw();
                                                                                                                                        }
                                                                                                                                });
                                                                                        })
                                                        var table = $('#lead-table').DataTable({
                                                                orderCellsTop : true,
                                                                fixedHeader : true,
                                                                "bPaginate" : true,
                                                                "bLengthChange" : true,
                                                                "bFilter" : true,
                                                                "bInfo" : false,
                                                                "bAutoWidth" : false,

                                                                "columnDefs" : [ {
                                                                        type : 'date-euro',
                                                                        targets : 12
                                                                }, {
                                                                        type : 'date-euro',
                                                                        targets : 11
                                                                }, {
                                                                        type : 'date-euro',
                                                                        targets : 10
                                                                }, {
                                                                        type : 'date-euro',
                                                                        targets : 9
                                                                }

                                                                ]

                                                        });
                                                }

                                        });
</script>