edit.blade.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. @extends('seller.layouts.app')
  2. @section('panel_content')
  3. <div class="aiz-titlebar mt-2 mb-4">
  4. <div class="row align-items-center">
  5. <div class="col-md-6">
  6. <h1 class="h3">{{ translate('Edit Your Coupon') }}</h1>
  7. </div>
  8. </div>
  9. </div>
  10. <div class="row gutters-5">
  11. <div class="col-lg-10 mx-auto">
  12. <div class="card">
  13. <div class="card-header">
  14. <h3 class="mb-0 h6">{{translate('Coupon Information Update')}}</h3>
  15. </div>
  16. <form action="{{ route('seller.coupon.update', $coupon->id) }}" method="POST">
  17. <input name="_method" type="hidden" value="PATCH">
  18. @csrf
  19. @if ($errors->any())
  20. <div class="alert alert-danger">
  21. <ul class="mt-3">
  22. @foreach ($errors->all() as $error)
  23. <li>{{ $error }}</li>
  24. @endforeach
  25. </ul>
  26. </div>
  27. @endif
  28. <div class="card-body">
  29. <input type="hidden" name="id" value="{{ $coupon->id }}" id="id">
  30. <div class="form-group row">
  31. <label class="col-lg-3 col-from-label" for="name">{{translate('Coupon Type')}}</label>
  32. <div class="col-lg-9">
  33. <select name="type" id="coupon_type" class="form-control aiz-selectpicker" onchange="coupon_form()" required>
  34. @if ($coupon->type == "product_base"))
  35. <option value="product_base" selected>{{translate('For Products')}}</option>
  36. @elseif ($coupon->type == "cart_base")
  37. <option value="cart_base">{{translate('For Total Orders')}}</option>
  38. @endif
  39. </select>
  40. </div>
  41. </div>
  42. <div id="coupon_form">
  43. </div>
  44. <div class="form-group mb-0 text-right">
  45. <button type="submit" class="btn btn-primary">{{translate('Save')}}</button>
  46. </div>
  47. </div>
  48. </form>
  49. </div>
  50. </div>
  51. </div>
  52. @endsection
  53. @section('script')
  54. <script type="text/javascript">
  55. function coupon_form(){
  56. var coupon_type = $('#coupon_type').val();
  57. var id = $('#id').val();
  58. $.post('{{ route('seller.coupon.get_coupon_form_edit') }}',{_token:'{{ csrf_token() }}', coupon_type:coupon_type, id:id}, function(data){
  59. $('#coupon_form').html(data);
  60. });
  61. }
  62. $(document).ready(function(){
  63. coupon_form();
  64. });
  65. </script>
  66. @endsection