1pppp

Untitled

Aug 3rd, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.20 KB | None | 0 0
  1. @extends('admin.index')
  2. @section('content')
  3. @if (Session::has('info'))
  4. <div class="alert alert-success" role="alert">
  5. {{ Session::get('info') }}
  6. </div>
  7. @endif
  8. <form action="/products/product/store" method="POST">
  9. {{ csrf_field() }}
  10. <?php
  11. use Illuminate\Support\MessageBag;
  12. /** @var MessageBag $errors */
  13. ?>
  14. <div class="p-4 mb-2"><h1>Создание товара</h1>
  15. <div class="form-group"><label for="inputDesription" class="col-xs-2 control-label">Введите описание(desription)</label>
  16. <div class="col-xs-10">
  17. <input type="text" name="description" class="form-control" placeholder="введите описание" id="description"></div
  18.  
  19. <? if($errors->first("description") != "") echo "<div class='alert'>".$errors->first("description")."</div>"; ?>
  20. </div>
  21. </div>
  22. <div class="form-group"><label for="inputPrice" class="col-xs-2 control-label">Введите цену</label>
  23. <div class="col-xs-10">
  24. <input type="text" name="price" class="form-control" placeholder="введите описание" id="price"></div
  25.  
  26. <? if($errors->first("price") != "") echo "<div class='alert'>".$errors->first("price")."</div>"; ?>
  27. </div>
  28. </div>
  29. {{-- <p><input type="file" class="my-pond" multiple name="product_image"/></p>--}}
  30. {{-- --}}
  31. {{-- <div class="form-group">--}}
  32. {{-- <label for="img">Выберите файл</label>--}}
  33. {{-- <input id="img" type="file" multiple name="file[]">--}}
  34. {{-- </div>--}}
  35.  
  36. {{-- <div class="container">--}}
  37. {{-- <div class="row">--}}
  38. {{-- <div class="col-md-8">--}}
  39. {{-- <form action="{{route('product')}}" class="dropzone" method="post" enctype="multipart/form-data">@csrf</form>--}}
  40. {{-- </div>--}}
  41. {{-- </div>--}}
  42. {{-- </div>--}}
  43.  
  44.  
  45. <input type="file" id="product_image" multiple>
  46. <div id="for_preview_uploads">
  47. div для превьюх
  48. </div>
  49.  
  50. <div>
  51. строка ниже
  52. </div>
  53. <script>
  54. function resizeImage(img) {
  55.  
  56. const W = parseInt(img.width / 4);
  57. const H = parseInt(img.height / 4);
  58.  
  59. const canvas = document.createElement("canvas");
  60. canvas.width = W;
  61. canvas.height = H;
  62.  
  63. const ctx = canvas.getContext("2d");
  64. ctx.drawImage(img, 0, 0, W, H);
  65.  
  66. const resizedImg = new Image();
  67. resizedImg.src = canvas.toDataURL('image/jpeg', 1);
  68. //document.body.append(resizedImg);
  69. document.querySelector("#for_preview_uploads").append(resizedImg);
  70.  
  71. }
  72.  
  73. function handleFiles(e) {
  74.  
  75. for (const file of this.files) {
  76.  
  77. const img = document.createElement("img");
  78. const reader = new FileReader();
  79.  
  80. reader.addEventListener("load", (e) => {
  81. img.addEventListener("load", (e) => {
  82. resizeImage(img);
  83. });
  84. img.src = e.target.result;
  85. });
  86.  
  87. reader.readAsDataURL(file);
  88.  
  89. }
  90.  
  91. }
  92.  
  93. const fileInput = document.getElementById("product_image");
  94.  
  95. fileInput.addEventListener("change", handleFiles, false);
  96.  
  97. </script>
  98.  
  99. <div class="form-group"><label for="inputAuthorized_price" class="col-xs-2 control-label">Введите цену со скидкой</label>
  100. <div class="col-xs-10">
  101. <input type="text" name="authorized_price" class="form-control" placeholder="Введите цену со скидкой" id="authorized_price"></div
  102.  
  103. <? if($errors->first("authorized_price") != "") echo "<div class='alert'>".$errors->first("authorized_price")."</div>"; ?>
  104. </div>
  105. </div>
  106. <div><div class="form-group"><label for="inputshort_descriptionl" class="col-xs-2 control-label">Введите короткое описание товара</label>
  107. <div class="col-xs-10">
  108. <textarea rows="10" cols="45" name="short_description" placeholder="Введите короткое описание товара"></textarea></div>
  109. <? if($errors->first("short_description") != "") echo "<div class='alert'>".$errors->first("short_description")."</div>"; ?>
  110. </div>
  111. </div>
  112.  
  113. {{--product_image--}}
  114. <div> <label for="inputKeywords" class="col-xs-2 control-label">Введите keywords</label>
  115. <div class="col-xs-10">
  116. <input type="text" name="keywords" placeholder="введите ключевые слова" id="inputKeywords">
  117. <? if($errors->first("keywords") != "") echo "<div class='alert'>".$errors->first("keywords")."</div>"; ?>
  118. </div>
  119. </div>
  120.  
  121. <div> <div class="form-group"><label for="inputtitle" class="col-xs-2 control-label">Введите заголовок</label>
  122. <div class="col-xs-10">
  123. <input type="text" name="title" placeholder="введите заголовок" id="title"></div>
  124. <? if($errors->first("title") != "") echo "<div class='alert'>".$errors->first("title")."</div>"; ?>
  125. </div>
  126. </div>
  127.  
  128. {{-- <div class="form-group">--}}
  129. {{-- <label>Подкатегории</label>--}}
  130. {{-- <select class="form-control input-sm" name="category_id">--}}
  131. {{-- <option value="">--select--</option>--}}
  132. {{-- @foreach ($categories as $category)--}}
  133. {{-- <option value="{{$category->id}}">{{$category->title}}</option>--}}
  134. {{-- @if ($category->categories)--}}
  135. {{-- @foreach ($category->categories as $category)--}}
  136. {{-- <option value="{{$category->id}}">-----{{$category->title}}</option>--}}
  137. {{-- @endforeach--}}
  138. {{-- @endif--}}
  139. {{-- @endforeach--}}
  140. {{-- </select>--}}
  141. {{-- </div>--}}
  142. <div><div class="form-group"><label for="inputslug" class="col-xs-2 control-label">Введите урл страницы</label>
  143. <div class="col-xs-10">
  144. <input type="text" name="slug" placeholder="Укажите slug"></div>
  145. <? if($errors->first("slug") != "") echo "<div class='alert'>".$errors->first("slug")."</div>"; ?>
  146. </div>
  147. </div>
  148.  
  149. <div><div class="form-group"><label for="inputtextl" class="col-xs-2 control-label">Введите описание товара</label>
  150. <div class="col-xs-10">
  151. <textarea rows="10" cols="45" name="text" placeholder="введите пост статьи"></textarea></div>
  152. <? if($errors->first("text") != "") echo "<div class='alert'>".$errors->first("text")."</div>"; ?>
  153. </div>
  154. </div>
  155.  
  156. <label for="">Статус</label>
  157. <select class="form-control" name="published">
  158. <?php if(isset($products->id)): ?>
  159. <option value="0" <?php if($products->published == 0): ?> selected="" <?php endif; ?>>Не опубликовано</option>
  160. <option value="1" <?php if($products->published == 1): ?> selected="" <?php endif; ?>>Опубликовано</option>
  161. <?php else: ?>
  162. <option value="0">Не опубликовано</option>
  163. <option value="1">Опубликовано</option>
  164. <?php endif; ?>
  165. </select>
  166. <input type="submit" value="Отправить">
  167. </form>
  168. <script src="https://cdn.ckeditor.com/4.14.1/standard/ckeditor.js"></script>
  169. <script>
  170. CKEDITOR.replace( 'text' );
  171. </script>
  172. <script>
  173. CKEDITOR.replace( 'short_description' );
  174. </script>
  175.  
  176.  
  177. {{-- <!-- include jQuery library -->--}}
  178. {{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>--}}
  179.  
  180. {{-- <!-- include FilePond library -->--}}
  181. {{-- <script src="https://unpkg.com/filepond/dist/filepond.min.js"></script>--}}
  182.  
  183. {{-- <!-- include FilePond plugins -->--}}
  184. {{-- <script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"></script>--}}
  185.  
  186. {{-- <!-- include FilePond jQuery adapter -->--}}
  187. {{-- <script src="https://unpkg.com/jquery-filepond/filepond.jquery.js"></script>--}}
  188.  
  189. {{-- <script>--}}
  190. {{-- $(function(){--}}
  191.  
  192. {{-- // First register any plugins--}}
  193. {{-- $.fn.product_image.registerPlugin(FilePondPluginImagePreview);--}}
  194.  
  195. {{-- // Turn input element into a pond--}}
  196. {{-- $('.my-pond').product_image();--}}
  197.  
  198. {{-- // Set allowMultiple property to true--}}
  199. {{-- $('.my-pond').product_image('allowMultiple', true);--}}
  200.  
  201. {{-- // Listen for addfile event--}}
  202. {{-- $('.my-pond').on('FilePond:addfile', function(e) {--}}
  203. {{-- console.log('file added event', e);--}}
  204. {{-- });--}}
  205.  
  206. {{-- // Manually add a file using the addfile method--}}
  207. {{-- $('.my-pond').first().product_image('addFile', 'index.html').then(function(file){--}}
  208. {{-- console.log('file added', file);--}}
  209. {{-- });--}}
  210.  
  211. {{-- });--}}
  212. {{-- </script>--}}
  213.  
  214.  
  215.  
  216. <!-- Scripts -->
  217. {{-- <script src="{{ asset('js/dropzone.js') }}" defer></script>--}}
  218. {{-- <script src="{{ asset('js/1.js') }}" defer></script>--}}
  219. {{-- <script src="{{ asset('js/dashboard.js') }}" defer></script>--}}
  220.  
  221.  
  222. <!-- Styles -->
  223. <link href="{{ asset('css/dropzone.css') }}" rel="stylesheet">
  224. @endsection
  225.  
Add Comment
Please, Sign In to add comment