create.blade.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. @component('panel.layouts.component', ['title' => 'ثبت دسته جدید'])
  2. @slot('style')
  3. <style>
  4. </style>
  5. @endslot
  6. @slot('subject')
  7. <h1><i class="fa fa-users"></i> ثبت دسته جدید </h1>
  8. @endslot
  9. @slot('breadcrumb')
  10. <li class="breadcrumb-item">دسته بندی محصولات</li>
  11. @endslot
  12. @slot('content')
  13. <div class="auth-background h-auto py-5">
  14. <div class="container py-5">
  15. <div class="row align-items-center">
  16. <div class="col-lg-12 col-md-12 mx-auto">
  17. <div class="card">
  18. <div class="card-header"><strong>{{ __('ثبت دسته بندی جدید') }}</strong></div>
  19. <div class="card-body mx-lg-5 px-lg-3">
  20. <form method="POST" action="{{ route('categories.store') }}" id="form">
  21. @csrf
  22. <div class="form-group">
  23. <label for="title">{{ __('category.title') }}</label><i class="required">&nbsp;
  24. *</i>
  25. <input id="form" type="text"
  26. class="form-control @error('title') is-invalid @enderror" name="title"
  27. value="{{ old('title') }}" autocomplete="title" autofocus>
  28. @error('title')
  29. <span class="invalid-feedback" role="alert">
  30. <strong>{{ $message }}</strong>
  31. </span>
  32. @enderror
  33. </div>
  34. <div class="form-row ">
  35. <div class="form-group col-lg-4">
  36. <label for="slug">{{ __('category.slug') }}</label>
  37. <input id="slug" type="text"
  38. class="form-control @error('slug') is-invalid @enderror"
  39. name="slug" value="{{ old('slug') }}"
  40. autocomplete="slug" autofocus>
  41. @error('slug')
  42. <span class="invalid-feedback" role="alert">
  43. <strong>{{ $message }}</strong>
  44. </span>
  45. @enderror
  46. </div>
  47. <div class="form-group col-lg-4">
  48. <div class="col mb-2">
  49. <label>دسته بندی والد:</label>
  50. <select name="parent_id"
  51. class="form-control select2 @error('parent_id') is-invalid @enderror">
  52. <option value="0">--</option>
  53. {!! category_select_options( $categories, old( 'parent_id' ) ) !!}
  54. </select>
  55. @error('parent_id')
  56. <span class="invalid-feedback" role="alert">
  57. <strong>{{ $message }}</strong>
  58. </span>
  59. @enderror
  60. </div>
  61. </div>
  62. <div class="form-group col-lg-4">
  63. <label for="category_type">{{ __('category.category_type') }}</label><i
  64. class="required">&nbsp;
  65. *</i>
  66. <select id="category_type" type="text"
  67. class="form-control @error('category_type') is-invalid @enderror"
  68. name="category_type"
  69. autocomplete="category_type">
  70. <option value="">انتخاب کنید</option>
  71. <option value="0" {{ (old('category_type') == '0') ? 'selected' : '' }}>محصولات</option>
  72. <option value="1" {{ (old('category_type') == '1') ? 'selected' : '' }}>اخبار</option>
  73. <option value="2" {{ (old('category_type') == '2') ? 'selected' : '' }}>مطالب</option>
  74. </select>
  75. @error('category_type')
  76. <span class="invalid-feedback" role="alert">
  77. <strong>{{ $message }}</strong>
  78. </span>
  79. @enderror
  80. </div>
  81. </div>
  82. <div class="form-group" style="direction: rtl !important;">
  83. <label for="discription">{{ __('category.discription') }}</label><i
  84. class="required">&nbsp; *</i>
  85. <textarea id="discription" type="text"
  86. class="form-control editor @error('discription') is-invalid @enderror"
  87. name="discription"
  88. autocomplete="discription" >{{ old('discription') }}</textarea>
  89. @error('discription')
  90. <span class="invalid-feedback" role="alert">
  91. <strong>{{ $message }}</strong>
  92. </span>
  93. @enderror
  94. </div>
  95. <div class="form-group mb-0">
  96. <div class="">
  97. <button type="submit" class="btn btn-primary ">
  98. {{ __('ثبت دسته بندی') }}
  99. </button>
  100. <a href={{ route('categories.index') }} type="button"
  101. class="btn btn-warning">
  102. انصراف</a>
  103. </div>
  104. </div>
  105. </form>
  106. </div>
  107. <div class="card-footer">
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. @endslot
  115. @slot('script')
  116. <script>
  117. {{--$(document).ready(function() {--}}
  118. {{-- $(".sendForme").click(function(e){--}}
  119. {{-- e.preventDefault();--}}
  120. {{-- var title = $("input[name='title']").val();--}}
  121. {{-- var price = $("input[name='price']").val();--}}
  122. {{-- var slug = $("input[name='slug']").val();--}}
  123. {{-- var type = $("input[name='type']").val();--}}
  124. {{-- var status = $("input[name='status']").val();--}}
  125. {{-- var discription = $("textarea[name='discription']").val();--}}
  126. {{-- $.ajax({--}}
  127. {{-- url: {{route('product.myformProduct')}},--}}
  128. {{-- method:'POST',--}}
  129. {{-- data: {title:title, price:price, slug:slug, type:type, status:status, discription:discription},--}}
  130. {{-- dataType:'json',--}}
  131. {{-- success: function(data) {--}}
  132. {{-- if($.isEmptyObject(data.error)){--}}
  133. {{-- alert(data.success);--}}
  134. {{-- }else{--}}
  135. {{-- printErrorMsg(data.error);--}}
  136. {{-- }--}}
  137. {{-- }--}}
  138. {{-- });--}}
  139. {{-- });--}}
  140. {{-- function printErrorMsg (msg) {--}}
  141. {{-- $(".print-error-msg").find("ul").html('');--}}
  142. {{-- $(".print-error-msg").css('display','block');--}}
  143. {{-- $.each( msg, function( key, value ) {--}}
  144. {{-- $(".print-error-msg").find("ul").append('<li>'+value+'</li>');--}}
  145. {{-- });--}}
  146. {{-- }--}}
  147. {{--});--}}
  148. </script>
  149. @endslot
  150. @endcomponent