Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
24 kB
2
Indexable
Never
    <style>
        .transition {
            transition-property: background-color,border-color,color,fill,stroke,opacity,box-shadow,transform;
            transition-timing-function: cubic-bezier(.4,0,.2,1);
            transition-duration: 150ms;
        }
        .uppercase {
            text-transform: uppercase;
        }
        .text-blue-700 {
            --tw-text-opacity: 1;
            color: rgba(29,78,216,var(--tw-text-opacity));
        }
        .px-6 {
            padding-left: 1.5rem;
            padding-right: 1.5rem;
        }
    </style>

    <link href="{{ asset('public/dealer/assets/styles/fixed_ops_style.css') }}" rel="stylesheet"
          xmlns="http://www.w3.org/1999/html">

    {{--@endsection--}}
            <!-- Pre Inspection Modal Starts Here -->
    <div id="FixedOpsStatusModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="statusModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <!-------------------------------- Modal Header Starts here ------------------------------------->
                <div class="modal-header row d-flex justify-content-between mx-1 mx-sm-3 mb-0 pb-0 border-0">
                    <div class="tabs active" id="tab01"><h6 class="text-muted">Pre Inspection</h6></div>
                    <div class="tabs" id="tab02"><h6 class="font-weight-bold">Vehicle Inspection</h6></div>
                </div>
                <!-------------------------------------- Modal Header Ends here ---------------------------------->

                <!-------------------------------- Modal Body Starts here ------------------------------------->
                <div class="modal-body p-0">
                    <fieldset class="show" id="tab011"></br></br>
                        <button type="button" class="close" data-dismiss="modal" style="margin-top: -115px;">&times;</button>
                        <div class="bg-light" id="pre_inspection_form_id"></div>
                    </fieldset>

                    <fieldset id="tab021"></br></br>
                        <button type="button" class="close" data-dismiss="modal" style="margin-top: -115px;">&times;</button>
                        <div class="bg-light" id="inspection_form_id"></div>
                    </fieldset>
                </div>
                <!-------------------------------- Modal Body Ends here ------------------------------------->
            </div>
        </div>
    </div>
    <!-- Pre Inspection Modal Ends Here -->

    <!--  Inspection Modal Starts Here -->
    <div id="FixedOpsInspectionStatusModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="statusModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <div class="row">
                        <fieldset>
                            <div class="col-md-4 pull-left">
                                {{--<img src="http://localhost/VE/MarkosianPortal/images/logo.png">--}}
                            </div>
                            <div class="col-md-8 pull-right"><h2 style="font-size: 40px;">Vehicle Inspection Form</h2>
                                <button type="button" class="close" data-dismiss="modal" style="margin-top: -78px;">&times;</button>
                            </div>
                        </fieldset>
                    </div>
                </div>
                <div class="modal-body" id="inspection_form_id"></div>
            </div>
        </div>
    </div>
    <!-- Inspection Modal Ends Here -->

    <div id="FixedOpsPartsModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="statusModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <div class="row">
                        <div class="col-md-2"></div>
                        <div class="col-md-8">
                            <h2 style="font-size: 41px;margin-left: 139px;">Parts List</h2>
                            <button type="button" class="close pull-right" data-dismiss="modal" style="margin-top: -58px;margin-left: 1041px;float: right;">&times;</button>
                        </div>
                    </div>
                </div>
                <div class="modal-body" id="parts_form_id"></div>
            </div>
        </div>
    </div>

    <div id="DownloadFixedOpsPartsModal" class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Download</h4>
                </div>
                <div class="modal-body" id="download_fixed_ops_form_data_id"></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
    <!-- Notes Modal -->
    <div class="modal fade" id="showInventoryDescriptionModal" role="dialog">
        <div class="modal-dialog modal-dialog-centered">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Vehicle Description</h4>
                </div>
                <div class="modal-body">
                    <div id="previous_description" style="margin-bottom: 30px;min-height: 100px;overflow: scroll;height: 100px;"></div>
                    <div style="display: flex;flex-direction: column;align-items: flex-end;">
                        <textarea id="vehicle_description" class="form-control" style="min-width: 100%;resize:none;"></textarea>
                        <br><small>Do not use comma (,) separated values. Use pipe (|) insteed.</small>
                        <input type="hidden" id="stock_no" value="" />
                        @if(Auth::User()->hasAnyRole('bdr'))
                            <button disabled="disabled" class="btn btn-info btn-xs margin-top-10" onclick="return updateDocs();">Update</button>
                        @else
                            <button class="btn btn-info btn-xs margin-top-10" onclick="return updateDocs();">Update</button>
                        @endif
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-xs" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>

    <!-- End Notes Modal -->
    {{--@push('scripts-footer')--}}
    <script type="text/javascript">
        $(document).ready(function(){
            $(".tabs").click(function(){
                $(".tabs").removeClass("active");
                $(".tabs h6").removeClass("font-weight-bold");
                $(".tabs h6").addClass("text-muted");
                $(this).children("h6").removeClass("text-muted");
                $(this).children("h6").addClass("font-weight-bold");
                $(this).addClass("active");
                current_fs = $(".active");
                next_fs = $(this).attr('id');
                next_fs = "#" + next_fs + "1";
                $("fieldset").removeClass("show");
                $(next_fs).addClass("show");
                current_fs.animate({}, {
                    step: function() {
                        current_fs.css({
                            'display': 'none',
                            'position': 'relative'
                        });
                        next_fs.css({
                            'display': 'block'
                        });
                    }
                });
            });
        });
    </script>

    <script>
        $('select.save-fixedops-status').change(function () {
            // Create a map of status names to their corresponding IDs
            const statusIdMap = {
                "Pre Inspection": 2,
                "Parts": 5,
                "Detail": 9,
                "Gps": 10,
                "PDR": 11,
                "Body Shop": 12,
                "Pictures": 13
            };

            var obj = jQuery(this);
            var status_id = obj.val();
            var stock = obj.data('stock');
            var fixedops_status_value = status_id;

            // Check if the fixedops_status_value exists in the statusIdMap
            if (statusIdMap.hasOwnProperty(fixedops_status_value)) {
                // Use the statusIdMap to get the corresponding ID
                var correspondingStatusId = statusIdMap[fixedops_status_value];
                status_id = correspondingStatusId;
            } else {
                correspondingStatusId = status_id; // Use the original status_id
            }

 //           alert(status_id);
//            alert(stock);

            if (status_id == 2) {
                // **************** For the process pre-inspection starts here. ****************//
                $.ajax({
                    type: 'POST',
                    url: "{!! route('dealer.get_fixedops_pre_inspection_records') !!}",
                    cache: false,
                    async: false,
                    data: {popup: 'popup', stock_no: stock, status: status_id, _token: "{{ csrf_token() }}"},
                    success: function (data) {
//                    var res = JSON.parse(data);
//                    console.log(res);
                        $("#pre_inspection_form_id").html(data);
                        $("#FixedOpsStatusModal").modal('show');
//                    $("#dropzone").dropzone();
                        var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
                        $("#dropzone").dropzone({
                            headers: {'x-csrf-token': CSRF_TOKEN }
                        });
                    },
                    timeout: 5000,
                    error: function (jqXHR, textStatus, errorThrown) {
                        swal("Something went wrong,Please check your internet connection.", "error");
                    },
                    beforeSend: function () {
                        $('#loader').show();
                    },
                    complete: function () {
                        $('#loader').hide();
                    }
                });
                // **************** For the process pre-inspection ends here. ****************//



            }  if (status_id == 2 || status_id == 4) {
                $.ajax({
                    type: 'POST',
                    url: "{!! route('dealer.get_fixedops_inspection_records') !!}",
                    cache: false,
                    async: false,
                    data: {popup: 'popup', stock_no: stock, status: status_id, _token: "{{ csrf_token() }}"},
                    success: function (data) {
//                    var res = JSON.parse(data);
//                    console.log(res);
                        $("#inspection_form_id").html(data);
                        $("#FixedOpsStatusModal").modal('show');
//                        $("#dropzone").dropzone();
                        var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
                        $("#dropzone1").dropzone({
                            headers: {'x-csrf-token': CSRF_TOKEN }
                        });
                    },
                    timeout: 5000,
                    error: function (jqXHR, textStatus, errorThrown) {
                        swal("Something went wrong,Please check your internet connection.", "error");
                    },
                    beforeSend: function () {
                        $('#loader').show();
                    },
                    complete: function () {
                        $('#loader').hide();
                    }
                });
                // *********** For the process inspection ends here. *****************//
            } if (status_id == 5) {
                // *********** For the process parts starts here. *****************//
                $.ajax({
                    type: 'POST',
                    url: "{!! route('dealer.get_fixedops_parts_records') !!}",
                    cache: false,
                    async: false,
                    data: {popup: 'popup', stock_no: stock, status: status_id, _token: "{{ csrf_token() }}"},
                    success: function (data) {
                        //  var res = JSON.parse(data);
                        //console.log(res.stock_no);
                        $("#parts_form_id").html(data);
                        $("#FixedOpsPartsModal").modal('show');
                    },
                    timeout: 5000,
                    error: function (jqXHR, textStatus, errorThrown) {
                        swal("Something went wrong,Please check your internet connection.", "error");
                    },
                    beforeSend: function () {
                        $('#loader').show();
                    },
                    complete: function () {
                        $('#loader').hide();
                    }
                });
                // *********** For the process parts ends here. *****************//
            }

            // For status update Process Starts Here.
            $.ajax({
                type: 'POST',
                url: "{!! route('dealer.update_fixedops_status') !!}",
                data: {stock: stock, status:status_id,_token: "{{ csrf_token() }}"},
                success: function (res) {
                    if (res.status == "success") {
                        // alert(res.message); window.location.href = 'fixedops';
                    }
                    else {
                        // alert(res.message);
                    }
                }
            });
            // For status update Process Ends Here.

            $('#inventory-grid').on('change' , '.updateinventory', function() {
                $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});
                var rec_id = jQuery(this).data("row-id");
                var rec_name = jQuery(this).data("title");
                var stock_no = jQuery(this).data("stock");
                var rec_value = jQuery(this).val();
                var grade = jQuery('#grade').val();
                var selected_status = $("#status_code").val();
                var updateServiceStatus = false;

                if(rec_name=="status_code" && rec_value==9){
                    //start
                    swal({
                        title: "Are you sure?",
                        text: "Are you sure? You're ready to move this vehicle into Detail Inventories.",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: '#f60e0e',
                        confirmButtonText: 'Yes, I am sure!',
                        cancelButtonText: "No, cancel it!",
                        closeOnConfirm: true,
                        closeOnCancel: false
                    }, function(isConfirm) {
                        if (isConfirm) {
                            $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});
                            $.ajax({
                                type: 'POST',
                                url: "{!! route('inventory.move.fixedopsdetails') !!}",
                                data: 'stock_no=' + stock_no,
                                success: function (response) {
                                    if (response['status'] == 1){
                                        swal({
                                            title: "Success!",
                                            text: response['message'],
                                            type: "success",
                                            confirmButtonClass: false,
                                            confirmButtonText: "OK",
                                            closeOnConfirm: false,
                                            closeOnCancel: false
                                        });
                                    } else{
                                        swal("Cancelled", response['message'], "error");
                                    }
                                }
                            });
                        } else {
                            swal("Cancelled", "Status not changed", "error");
                        }

                    });
                }
            });
            // For Detail Process Ends Here.
        });

        $(document).ready(function(){
            $('#inventory-grid').DataTable({
                "pageLength": 50
            });
            $("#inventory-grid").on('click','.btnSelect',function(){
                var currentRow=$(this).closest("tr");
                var Stockno=currentRow.find("td:eq(0)").text();

                // *********** For the fixed ops status data starts here. *****************//
                $.ajax({
                    type: 'POST',
                    url: "{!! route('dealer.download_fixedops_data_records') !!}",
                    cache: false,
                    async: false,
                    data: {popup: 'popup', stock_no: Stockno,  _token: "{{ csrf_token() }}"},
                    success: function (data) {
                        if(data.count==0){ alert (0); }
                        $("#download_fixed_ops_form_data_id").html(data);
                        $("#DownloadFixedOpsPartsModal").modal('show');
                    },
                    timeout: 5000,
                    error: function (jqXHR, textStatus, errorThrown) {
                        swal("Something went wrong,Please check your internet connection.", "error");
                    },
                    beforeSend: function () {
                        $('#loader').show();
                    },
                    complete: function () {
                        $('#loader').hide();
                    }
                });
                // *********** For the fixed ops status data starts here. *****************//

            });

            $(".search_inventory").on('change', function () {
                var userType = '<?php echo Auth::user()->user_type; ?>';
                if(userType === "detailer"){
                    window.location.href = "{!! route('inventory.detailers.fixedops') !!}?locations=" + $("#locations").val() + '&status_code=' + $("#status_code").val();
                }else{
                    window.location.href = "{!! route('inventory.fixedops') !!}?locations=" + $("#locations").val() + '&status_code=' + $("#status_code").val();
                }
            });
        });
        // get function for fixed ops status data download end.
        function showInventoryDescription(stock_no) {
            var description = $("#description" + stock_no).text();
            $("#stock_no").val(stock_no);
            if (description == '') {
                $("#vehicle_description").val('');
                $("#previous_description").html('');
            } else {
                $("#vehicle_description").val('');
                $("#previous_description").html('');
                $("#previous_description").html(description);
            }
        }
        function updateDocs() {
            var stock_no = $("#stock_no").val();
            var description = $("#vehicle_description").val();
            $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});
            $.ajax({
                type: 'POST',
                url: "{!! route('inventory.update.description') !!}",
                data: "stock_no=" + stock_no + "&description=" + description,
                success: function (response) {
                    if (response['status'] == 1) {
                        swal({
                            title: "Success!",
                            text: response['message'],
                            type: "success",
                            confirmButtonClass: false,
                            confirmButtonText: "OK",
                            closeOnConfirm: false,
                            closeOnCancel: false
                        });
                        $("#description" + stock_no).text(response['description']);
                        $('#showInventoryDescriptionModal').modal('hide');
                    } else {
                        swal("Cancelled", response['message'], "error");
                    }
                }
            });
        }


    </script>

      <script>
     // Define the swal alert options
    const swalOptions = {
        title: 'Are you sure?',
        text: 'Do you want to move this item out of Fixed Ops?',
        icon: 'warning',
        buttons: ['Cancel', 'Move out'],
        dangerMode: true,
        showCancelButton: true,
    };

     // Add a click event listener to the button
     $('.move-out-fixed-ops').on('click', function() {
         const stockNo = $(this).data('stock');
         swalOptions.text = `Are you sure you want to move stock ${stockNo} out of Fixed Ops inventory?`;

         // Display the swal alert when the user clicks the button
         swal(swalOptions, function(result) {
             if (result) {
                 // If the user clicked the "Move out" button, send a request to move the item out of Fixed Ops
                 $.ajax({
                     url: '{{ route("fixedops.move-out") }}',
                     type: 'POST',
                     data: { stock_no: stockNo },
                     headers: {
                         'X-CSRF-TOKEN': '{{ csrf_token() }}' // Include CSRF token in the headers
                     },
                     success: function(response) {

                         // Find the table row that corresponds to the stock number using the data attribute
                         const row = $(`tr[data-stock="${stockNo}"]`);

                         // Hide the row with a smooth animation
                         row.slideUp(400, function() {
                             // After animation, remove the row from the DOM
                             row.remove();
                         });

                         // Display a success notification
                         swal('Success', response.message, 'success');
                     },
                     error: function(xhr, textStatus, errorThrown) {
                         // Handle the error
                         swal('Error', xhr.responseJSON.error, 'error');
                     }
                 });
             }
         });
     });
      </script>
    {{--@endpush--}}