IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/7617a275cfe1818bf5b503176a4877f916c163d5.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong><?php if(isset($quotation)): ?>Edit <?php else: ?>  Add <?php endif; ?>  Quotation</strong></h2>
            </div>
            <div class="body">
                <?php if(isset($quotation)): ?>
                <?php echo Form::model($quotation, ['method' => 'PATCH', 'action' => ['School\Stock\QuotationController@update', $quotation->idQuotation], 'class' => 'form-horizontal','files'=>true]); ?>

                <?php else: ?>
                <?php echo Form::open(['url' => 'school/quotations', 'class' => 'form-horizontal','id'=>'form','files'=>true]); ?>

                <?php endif; ?>
                
                <div class="row clearfix">
                    <div class="col-sm-3 form-control-label required">
                        <label for="classname">Date</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <?php echo Form::text('quotationDate',null,['class' => 'form-control datepicker','required'=>'required']); ?>

                            <?php if($errors->has('quotationDate')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('quotationDate')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-sm-3 form-control-label required">
                        <label for="classname">Expected Delivery Date</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <?php echo Form::text('expDeliveryDate',null,['class' => 'form-control datepicker','required'=>'required']); ?>

                            <?php if($errors->has('expDeliveryDate')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('expDeliveryDate')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-3 form-control-label required">
                        <label for="classname">Shipment Preference</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <?php echo Form::text('shipmentPreference',null,['class' => 'form-control','required'=>'required']); ?>

                            <?php if($errors->has('shipmentPreference')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('shipmentPreference')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
               <div class="row clearfix">
                   <div class="col-sm-6">
                       <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Item</th>
                                <th>Quantity</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody  id="optional_list">
                            <?php if(isset($quotation)): ?>
                            <?php $j =1;?>
                            <?php $__currentLoopData = $quotation->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td class="sno"><?php echo e($j); ?></td>
                                <td>
                                    <?php echo Form::select('products['.$j.'][idProduct]',$products,$var->idProduct,['class' => 'form-control select2 show-tick ms','required'=>'required']); ?>

                                    <input type="hidden" name="products[<?php echo e($j); ?>][idQuotationDetail]" value="<?php echo e($var->idQuotationDetail); ?>">
                                    <div id="prod_error"></div>
                                    
                                </td>
                                <td>
                                    <?php echo Form::text('products['.$j.'][quantity]',$var->quantity,['class' => 'form-control']); ?>

                                </td>
                                <td></td>
                            </tr>
                            <?php $j++ ; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <?php $i =1;?>
                            <tr>
                                <td class="sno"><?php echo e($i); ?></td>
                                <td>
                                    <?php echo Form::select('products[1][idProduct]',$products,null,['class' => 'form-control select2 show-tick ms','required'=>'required','onchange'=>'checkOthers(this,1)']); ?>

                                    <p>Not in List? <a href="<?php echo e(url('/school/products')); ?>" target="_blank">Add New</a></p>
                                    <div id="newproduct1" style="display: none">
                                        <?php echo Form::text('products[1][newproduct]',null, ['class' => 'form-control','maxlength'=>'200','minlength'=>'2','autocomplete'=>'off','placeholder'=>'Enter Product Name']); ?>

                                    </div>
                                </td>
                                <td>
                                    <?php echo Form::text('products[1][quantity]',null,['class' => 'form-control','required'=>'required']); ?>

                                </td>
                                <td></td>
                            </tr>
                            <?php $i++ ; ?>
                           <?php endif; ?>

                        </tbody>
                        <tr>
                            <td colspan="4" style="text-align: right"><input type="button" class="add-row btn btn-sm btn-success" value="Add Row"></td>
                        </tr>
                    </table>
                   </div>
                   <div class="col-sm-3 form-control-label required">
                        <label for="classname">Select Vendor/Supplier</label>
                    </div>
                    <div class="col-sm-2">
                        <div class="form-group">
                            <?php if(isset($quotation)): ?>
                                <?php echo Form::select('idSupplier',$suppliers,null,['class' => 'form-control select2 show-tick ms','required'=>'required']); ?>

                                <?php if($errors->has('idSupplier')): ?>
                                <label id="minmaxlength-error" class="error" for="minmaxlength">
                                    <strong><?php echo e($errors->first('idSupplier')); ?></strong>
                                </label>
                                <?php endif; ?>
                            <?php else: ?>
                            <div style="border:1px solid #ccc; width:200px; height: 150px; overflow-y: scroll;">
                                <?php $__currentLoopData = $suppliers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="checkbox-inline" style="padding-left:10px;padding-top:5px;">
                                    <input type="checkbox" name="suppliers[]" value="<?php echo e($key); ?>" >
                                    <label><?php echo e($value); ?></label>
                                </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </div>
                            <div id="vendor_error"></div>
                            <?php endif; ?>
                        </div>
                    </div>
                    
                </div>
                
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        <?php if(isset($quotation)): ?>
                        <?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        <?php else: ?>
                        <?php echo Form::submit('Save',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']); ?>

                        <?php endif; ?>
                        <a href="<?php echo e(url('/school/quotations')); ?>" class="btn btn-raised btn-danger btn-round waves-effect">CANCEL</a>
                    </div>
                </div>

                <?php echo Form::close(); ?> 
            </div>
        </div>
    </div>
</div>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Quotations</strong></h2>
            </div>
            <div class="body table-responsive">
                <?php echo Form::open(['method' => 'GET',  'action' => ['School\Stock\QuotationController@index'], 'class' => 'form-horizontal']); ?>

                    <div class="row clearfix">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-2 form-control-label">
                            <label for="classname">Financial Year</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                               <?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>

                            </div>
                        </div>
                        <div class="col-sm-2">
                            <?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        </div>
                    </div>
                <?php echo Form::close(); ?> 
                <br>
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>Request Date</th>
                            <th>Expected Delivery Date</th>
                            <th>Shipment Preference</th>
                            <th>Vendor/Supplier</th>
                            <th>Communication</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        <?php $__currentLoopData = $quotations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <th scope="row"><?php echo e($i); ?></th>
                            <td><?php echo e($value->quotationDate); ?></td>
                            <td><?php echo e($value->expDeliveryDate); ?></td>
                            <td><?php echo e($value->shipmentPreference); ?></td>
                            <td><?php echo e($value->supplier->bussinessName); ?></td>
                            <td>
                                <a href="https://web.whatsapp.com/send?phone=+91<?php echo e($value->supplier->contactNo); ?>&text=<?php echo e(urlencode('Hello, Good day .Please we will like to know the price and availability of the following item in this link https://online-login.online/api/quotations/QO1201'.$value->idQuotation.'. We await your quick response. Kind Regards, Team')); ?>" target="_blank" class="btn btn-raised btn-warning waves-effect btn-round">Send WhatsApp</a>
                                <form method="POST" action="<?php echo e(url('/school/quotations-mail')); ?>">
                                    <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
                                    <input type="hidden" name="id" value="<?php echo e($value->idQuotation); ?>"/>
                                    <button class="btn btn-raised btn-success waves-effect btn-round" type="submit">Send Mail</button>
                                </form>
                            </td>
                            <td>
                                <a href="<?php echo e(url('school/quotations/' . $value->idQuotation)); ?>" target="_blank" class="btn btn-raised btn-warning waves-effect btn-round">View </a>
                                <a href="<?php echo e(url('school/quotations/' . $value->idQuotation . '/edit')); ?>"  class="btn btn-raised btn-info waves-effect btn-round">Edit </a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idQuotation); ?>" data-type="confirm">DELETE</button>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
    var i = $('.sno:last').text();
    $(".add-row").click(function(){
        i++;  
        var markup = '<tr><td class="sno">'+i+'</td>\
                <td><select name="products['+i+'][idProduct]" class = "form-control select2 show-tick ms" onchange="checkOthers(this,'+i+');" required="required"><?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>"><?php echo e($value); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select>\n\
                <p>Not in List? <a href="<?php echo e(url('/school/products')); ?>" target="_blank">Add New</a></p><div id="newproduct'+i+'" style="display: none"><input type="text" name="products['+i+'][newproduct]" class="form-control" maxlength="200" minlength="2" autocomplete="off" placeholder = "Enter Product Name"></div></td>\n\
\n\             <td><input class="form-control" type="text" name="products['+i+'][quantity]" required ="required"></td>\n\
                <td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
            
            $("#optional_list").append(markup);
    });
    
    $('#optional_list').on('click', 'input[type="button"]', function () {
        $(this).closest('tr').remove();
         i = $('.sno:last').text();
         
    });
    //Add Input field if others is selecyted
});
function checkOthers(selected,keyid){
       var val = selected.value;
       if(val == 'new'){
           $('#newproduct'+keyid).show();
           $('#newproduct').attr("required", "true"); 
        }else{
           $('#newproduct'+keyid).hide();
        }
    }
$(document).on('click', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var id = $(this).data('id');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this  Quotation!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "<?php echo e(url('/school/quotations/')); ?>" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Quotation has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
// Saving form data
$('#form').on('submit',function(e){
    $.ajaxSetup({
    header:$('meta[name="_token"]').attr('content')
});
 var formData =  new FormData($('#form')[0]);
 $("#submit-btn").prop('disabled', true);
    $.ajax({
        type:"POST",
        url: "<?php echo e(url('school/quotations')); ?>",
        processData: false,
        contentType: false,
        data:formData,
        dataType: 'json',
        success:function(data){
            if( data[Object.keys(data)[0]] === 'SUCCESS' ){
                $("#submit-btn").prop('disabled', true);
                window.location = "<?php echo e(url('school/quotations')); ?>";
            }
            else {                  //False Case: With error msg
            $("#msg").html(data);   //$msg is the id of empty msg
            }

        },

        error: function(data){
                    if( data.status === 422 ) {
                        $("#submit-btn").prop('disabled', false);
                        var errors = data.responseJSON.errors;
                        var errorHtml = '<div class="alert alert-danger"><ul>';
                           $('#formerrors').html(errorHtml);
                                if(errors['idSupplier']=== undefined){
                                    $( '#vendor_error' ).empty();
                                }else{
                                   errorname = '<span class="help-block"><strong>'+errors['idSupplier']+'</strong></span>';
                                   $( '#vendor_error' ).html( errorname );
                                }
                                if(errors['idProduct']=== undefined){
                                    $( '#prod_error' ).empty();
                                }else{
                                   errorname = '<span class="help-block"><strong>'+errors['idProduct']+'</strong></span>';
                                   $( '#prod_error' ).html( errorname );
                                }
                    }
            }
    });
    return false;
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7