1pppp

Untitled

Aug 2nd, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.85 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="file-input" multiple>
  46.  
  47. <script>function resizeImage(img) {
  48.  
  49. const W = parseInt(img.width / 4);
  50. const H = parseInt(img.height / 4);
  51.  
  52. const canvas = document.createElement("canvas");
  53. canvas.width = W;
  54. canvas.height = H;
  55.  
  56. const ctx = canvas.getContext("2d");
  57. ctx.drawImage(img, 0, 0, W, H);
  58.  
  59. const resizedImg = new Image();
  60. resizedImg.src = canvas.toDataURL('image/jpeg', 1);
  61. document.body.append(resizedImg);
  62.  
  63. }
  64.  
  65. function handleFiles(e) {
  66.  
  67. for (const file of this.files) {
  68.  
  69. const img = document.createElement("img");
  70. const reader = new FileReader();
  71.  
  72. reader.addEventListener("load", (e) => {
  73. img.addEventListener("load", (e) => {
  74. resizeImage(img);
  75. });
  76. img.src = e.target.result;
  77. });
  78.  
  79. reader.readAsDataURL(file);
  80.  
  81. }
  82.  
  83. }
  84.  
  85. const fileInput = document.getElementById("file-input");
  86.  
  87. fileInput.addEventListener("change", handleFiles, false);
  88. </script>
  89.  
  90. <div class="form-group"><label for="inputAuthorized_price" class="col-xs-2 control-label">Введите цену со скидкой</label>
  91. <div class="col-xs-10">
  92. <input type="text" name="authorized_price" class="form-control" placeholder="Введите цену со скидкой" id="authorized_price"></div
  93.  
  94. <? if($errors->first("authorized_price") != "") echo "<div class='alert'>".$errors->first("authorized_price")."</div>"; ?>
  95. </div>
  96. </div>
  97. <div><div class="form-group"><label for="inputshort_descriptionl" class="col-xs-2 control-label">Введите короткое описание товара</label>
  98. <div class="col-xs-10">
  99. <textarea rows="10" cols="45" name="short_description" placeholder="Введите короткое описание товара"></textarea></div>
  100. <? if($errors->first("short_description") != "") echo "<div class='alert'>".$errors->first("short_description")."</div>"; ?>
  101. </div>
  102. </div>
  103.  
  104. {{--product_image--}}
  105. <div> <label for="inputKeywords" class="col-xs-2 control-label">Введите keywords</label>
  106. <div class="col-xs-10">
  107. <input type="text" name="keywords" placeholder="введите ключевые слова" id="inputKeywords">
  108. <? if($errors->first("keywords") != "") echo "<div class='alert'>".$errors->first("keywords")."</div>"; ?>
  109. </div>
  110. </div>
  111.  
  112. <div> <div class="form-group"><label for="inputtitle" class="col-xs-2 control-label">Введите заголовок</label>
  113. <div class="col-xs-10">
  114. <input type="text" name="title" placeholder="введите заголовок" id="title"></div>
  115. <? if($errors->first("title") != "") echo "<div class='alert'>".$errors->first("title")."</div>"; ?>
  116. </div>
  117. </div>
  118.  
  119. {{-- <div class="form-group">--}}
  120. {{-- <label>Подкатегории</label>--}}
  121. {{-- <select class="form-control input-sm" name="category_id">--}}
  122. {{-- <option value="">--select--</option>--}}
  123. {{-- @foreach ($categories as $category)--}}
  124. {{-- <option value="{{$category->id}}">{{$category->title}}</option>--}}
  125. {{-- @if ($category->categories)--}}
  126. {{-- @foreach ($category->categories as $category)--}}
  127. {{-- <option value="{{$category->id}}">-----{{$category->title}}</option>--}}
  128. {{-- @endforeach--}}
  129. {{-- @endif--}}
  130. {{-- @endforeach--}}
  131. {{-- </select>--}}
  132. {{-- </div>--}}
  133. <div><div class="form-group"><label for="inputslug" class="col-xs-2 control-label">Введите урл страницы</label>
  134. <div class="col-xs-10">
  135. <input type="text" name="slug" placeholder="Укажите slug"></div>
  136. <? if($errors->first("slug") != "") echo "<div class='alert'>".$errors->first("slug")."</div>"; ?>
  137. </div>
  138. </div>
  139.  
  140. <div><div class="form-group"><label for="inputtextl" class="col-xs-2 control-label">Введите описание товара</label>
  141. <div class="col-xs-10">
  142. <textarea rows="10" cols="45" name="text" placeholder="введите пост статьи"></textarea></div>
  143. <? if($errors->first("text") != "") echo "<div class='alert'>".$errors->first("text")."</div>"; ?>
  144. </div>
  145. </div>
  146.  
  147. <label for="">Статус</label>
  148. <select class="form-control" name="published">
  149. <?php if(isset($products->id)): ?>
  150. <option value="0" <?php if($products->published == 0): ?> selected="" <?php endif; ?>>Не опубликовано</option>
  151. <option value="1" <?php if($products->published == 1): ?> selected="" <?php endif; ?>>Опубликовано</option>
  152. <?php else: ?>
  153. <option value="0">Не опубликовано</option>
  154. <option value="1">Опубликовано</option>
  155. <?php endif; ?>
  156. </select>
  157. <input type="submit" value="Отправить">
  158. </form>
  159. <script src="https://cdn.ckeditor.com/4.14.1/standard/ckeditor.js"></script>
  160. <script>
  161. CKEDITOR.replace( 'text' );
  162. </script>
  163. <script>
  164. CKEDITOR.replace( 'short_description' );
  165. </script>
  166.  
  167.  
  168. {{-- <!-- include jQuery library -->--}}
  169. {{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>--}}
  170.  
  171. {{-- <!-- include FilePond library -->--}}
  172. {{-- <script src="https://unpkg.com/filepond/dist/filepond.min.js"></script>--}}
  173.  
  174. {{-- <!-- include FilePond plugins -->--}}
  175. {{-- <script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"></script>--}}
  176.  
  177. {{-- <!-- include FilePond jQuery adapter -->--}}
  178. {{-- <script src="https://unpkg.com/jquery-filepond/filepond.jquery.js"></script>--}}
  179.  
  180. {{-- <script>--}}
  181. {{-- $(function(){--}}
  182.  
  183. {{-- // First register any plugins--}}
  184. {{-- $.fn.product_image.registerPlugin(FilePondPluginImagePreview);--}}
  185.  
  186. {{-- // Turn input element into a pond--}}
  187. {{-- $('.my-pond').product_image();--}}
  188.  
  189. {{-- // Set allowMultiple property to true--}}
  190. {{-- $('.my-pond').product_image('allowMultiple', true);--}}
  191.  
  192. {{-- // Listen for addfile event--}}
  193. {{-- $('.my-pond').on('FilePond:addfile', function(e) {--}}
  194. {{-- console.log('file added event', e);--}}
  195. {{-- });--}}
  196.  
  197. {{-- // Manually add a file using the addfile method--}}
  198. {{-- $('.my-pond').first().product_image('addFile', 'index.html').then(function(file){--}}
  199. {{-- console.log('file added', file);--}}
  200. {{-- });--}}
  201.  
  202. {{-- });--}}
  203. {{-- </script>--}}
  204.  
  205.  
  206.  
  207. <!-- Scripts -->
  208. <script src="{{ asset('js/dropzone.js') }}" defer></script>
  209. <script src="{{ asset('js/1.js') }}" defer></script>
  210.  
  211.  
  212. <!-- Styles -->
  213. <link href="{{ asset('css/dropzone.css') }}" rel="stylesheet">
  214. @endsection
  215.  
Add Comment
Please, Sign In to add comment