@extends('template.app') @section('meta') @endsection @section('title') DMS Create @endsection @section('styles')
<style>
    .col-sm-3{
        font-size:15px;
    }
    .form-control{
        height:30px;
    }
    .custom-form-spacing {
      margin-bottom: -5px !important;
    }
</style>
<link href="{{ asset('assets/css/dropify.min.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/sweetalert2.bundle.css') }}" rel="stylesheet"> @endsection @section('content') <div class="page-breadcrumb">
  <div class="row">
    <div class="col-7 align-self-center">
      <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">DMS Invoice Details</h4>
      <div class="d-flex align-items-center">
        <nav aria-label="breadcrumb">
          <ol class="breadcrumb m-0 p-0">
            <li class="breadcrumb-item">
              <a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a>
            </li>
            <li class="breadcrumb-item">
              <a href="{{ route('dms') }}" class="text-muted">DMS Invoice Details</a>
            </li>
            <li class="breadcrumb-item text-muted active" aria-current="page">Create</li>
          </ol>
        </nav>
      </div>
    </div>
  </div>
</div>
<div class="container-fluid">
  <div class="row">
    <div class="col-12">
      <div class="card">
        <div class="card-body">
          <form action="{{ route('dms.insert') }}" name="form" id="form" method="post" enctype="multipart/form-data"> @csrf @method('POST') <div class="row">
              <div class="form-group col-sm-4 custom-form-spacing">
                <label for="name">Date :-</label>
                <input type="date" name="date" id="name" class="form-control" placeholder="Enter Date">
                <span class="kt-form__help error name"></span>
              </div>
              <div class="form-group col-sm-4 custom-form-spacing">
                <label for="years">Invoice Number :-</label>
                <input type="text" name="dms_invoice_no" id="dms_invoice_no" class="form-control" placeholder="Enter Invoice Number">
                <span class="kt-form__help error years"></span>
              </div>
              <div class="form-group col-sm-3 custom-form-spacing">
                <label for="amount">VIN Number :-</label>
                <input type="text" name="vin_number" class="form-control" placeholder="Enter Vin Number">
                <span class="kt-form__help error amount"></span>
              </div>
              <div class="form-group col-sm-4 custom-form-spacing">
                <label for="gst_percentage">Basic Amount :-</label>
                <input type="number" name="basic_amount" id="basic_amount" class="form-control" placeholder="Enter Basic Amount">
                <span class="kt-form__help error gst_percentage"></span>
              </div>
              <div class="form-group col-sm-3 custom-form-spacing">
                <label for="gst">GST Amount :-</label>
                <input type="number" name="gst_amount" id="gst" class="form-control" placeholder="GST Amount">
                <span class="kt-form__help error gst"></span>
              </div>
              <div class="form-group col-sm-4 custom-form-spacing">
                <label for="total_profit">Total Amount :-</label>
                <input type="number" name="total_amount" id="total_amount" class="form-control" readonly>
                <span class="kt-form__help error total_profit"></span>
              </div>
              <div class="form-group col-sm-4 custom-form-spacing">
                <label for="total_profit">GatePass Closing Date :-</label>
                <input type="date" name="getpass_closing_date	" class="form-control">
                <span class="kt-form__help error total_profit"></span>
              </div>
              <div class="form-group col-sm-3">
                <label for="total_profit">Scheme :-</label>
                <input type="text" name="scheme" class="form-control" placeholder="Enter Skim">
                <span class="kt-form__help error total_profit"></span>
              </div>
              <div class="form-group col-sm-4">
                <label for="total_profit">Remark :-</label>
                <textarea name="remark" class="form-control" placeholder="Enter Remark"></textarea>
                <span class="kt-form__help error total_profit"></span>
              </div>
            </div>
            <div class="form-group">
              <button type="submit" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-primary">Submit</button>
              <a href="{{ route('rsa') }}" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-secondary">Back</a>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div> @endsection @section('scripts') <script src="{{ asset('assets/js/promise.min.js') }}"></script>
<script src="{{ asset('assets/js/sweetalert2.bundle.js') }}"></script>
<script>
  $(document).ready(function() {
    $('#gst_percentage').blur(function() {
      var profit = parseFloat($('#profit').val());
      var gstPercentage = parseFloat($('#gst_percentage').val());
      var gst = (profit * gstPercentage) / 100;
      var total_profit = profit + gst;
      $('#gst').val(gst.toFixed(0));
      $('#total_profit').val(total_profit.toFixed(0))
      console.log('Total Profit:', total_profit);
    });
    var form = $('#form');
    $('.kt-form__help').html('');
    form.submit(function(e) {
      $('.help-block').html('');
      $('.m-form__help').html('');
      $.ajax({
        url: form.attr('action'),
        type: form.attr('method'),
        data: new FormData($(this)[0]),
        dataType: 'json',
        async: false,
        processData: false,
        contentType: false,
        success: function(json) {
          return true;
        },
        error: function(json) {
          if (json.status === 422) {
            e.preventDefault();
            var errors_ = json.responseJSON;
            $('.kt-form__help').html('');
            $.each(errors_.errors, function(key, value) {
              $('.' + key).html(value);
            });
          }
        }
      });
    });
  });
  $(document).ready(function(){
    $('#basic_amount, #gst').on('input', function() {
        var num1 = parseFloat($('#basic_amount').val()) || 0;
        var num2 = parseFloat($('#gst').val()) || 0;
        var total = num1 + num2;
        $('#total_amount').val(total);
    });
});
</script> 
@endsection