edit.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. @extends('layouts.idara.panel')
  2. @section('content')
  3. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css"" />
  4. <link href="https://unpkg.com/filepond@4.30.4/dist/filepond.min.css" rel="stylesheet" type="text/css" />
  5. <link href="https://unpkg.com/filepond-plugin-file-poster@2.5.1/dist/filepond-plugin-file-poster.min.css" rel="stylesheet"
  6. type="text/css" />
  7. <link href="{{ asset('pintura/pintura.scss') }}" rel="stylesheet" />
  8. <!-- Custom css -->
  9. <link href="{{ asset('css/custom.css') }}" rel="stylesheet" />
  10. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
  11. integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  12. <form action="{{ url('produit/' . $article->id) }}" method="post" enctype="multipart/form-data">
  13. <input type="hidden" name="_method" value="PUT">
  14. @csrf
  15. <div class="container">
  16. @include('backend.partials.features')
  17. <div class="card mt-4">
  18. <h5 class="card-header">Modifier</h5>
  19. <div class="card-body">
  20. <div class="form-group">
  21. <label for="exampleFormControlInput1"><strong>Nom : </strong></label>
  22. <input type="text" class="form-control" name="nom" placeholder="" value="{{ $article->nom }}"
  23. required>
  24. </div>
  25. <div class="form-group mt-4">
  26. <label for="exampleFormControlInput1"><strong>Categorie : </strong></label>
  27. <select multiple onchange="optionCheck()" class="form-control" name="categories[]" id="categories"
  28. class="categorie" aria-describedby="validationServer04Feedback" style=" margin-bottom: 40px;"
  29. required>
  30. @foreach ($article->categories as $singleTag)
  31. <option value="" selected> {{ $singleTag->nom }}</option>
  32. @endforeach
  33. @foreach ($categories as $categorie)
  34. @if ($article->categories->contains($categorie->id))
  35. <option value="{{ $categorie->id }}" selected> {{ $categorie->nom }}</option>
  36. @else
  37. <option value="{{ $categorie->id }}"
  38. {{ old('categorie') == $categorie->id ? 'selected' : '' }}>{{ $categorie->nom }}
  39. </option>
  40. @endif
  41. @endforeach
  42. </select>
  43. </div>
  44. <div class="form-group mt-4">
  45. <label for="exampleFormControlTextarea1"><strong>description : </strong></label>
  46. <textarea class="form-control" id="presentation" name="description" rows="3">{!! html_entity_decode($article->description) !!}</textarea>
  47. </div>
  48. <div class="row">
  49. <div class="col-6">
  50. <div class="form-group mt-4">
  51. <label for="exampleFormControlTextarea1"><strong>Prix :</strong></label>
  52. <input type="text" class="form-control" id="" name="prix" placeholder="Prix"
  53. value="{{$article->prix}}">
  54. </div>
  55. </div>
  56. <div class="col-6" style="margin-top:55px">
  57. <input type="checkbox" id="" name="prix_etat" value="1">
  58. <label for="exampleFormControlTextarea1"><strong>Afficher le prix </strong></label>
  59. </div>
  60. </div>
  61. <div class="form-group mt-4">
  62. <label for="exampleFormControlInput1"><strong> image : </strong></label>
  63. <div class="input-group mt-4 control-group increment">
  64. <input type="file" name="image" class="my-pond form-control " />
  65. </div>
  66. <img src="{{ asset('storage/image/' . $article->image) }} " style="width:200px"
  67. alt="description of myimage">
  68. </div>
  69. </div>
  70. </div>
  71. <div class="card mt-4">
  72. <div class="card-header">
  73. Réferencement
  74. </div>
  75. <div class="card-body">
  76. <div class="form-group">
  77. <label for="exampleFormControlInput1" class="mb-3"><strong>Titre(SEO)</strong></label>
  78. <input type="text" class="form-control" name="titre_seo" placeholder="..."
  79. value="{{$article->titre_seo}}">
  80. </div>
  81. <div class="form-group mt-4">
  82. <label for="exampleFormControlInput1" class="mb-3"><strong>Description(SEO)</strong></label>
  83. <textarea name="resume_seo" id="" style="width: 100%" rows="10" value="">{!!$article->resume_seo!!}</textarea>
  84. </div>
  85. <div class="form-group mt-4">
  86. <label for="exampleFormControlInput1" class="mb-3"><strong>Mot clé (SEO)</strong></label>
  87. <input type="text" class="form-control" name="mot_cle" placeholder="..."
  88. value="{{$article->mot_cle}}">
  89. </div>
  90. </div>
  91. </div>
  92. <div class="form-group add mt-4" style="text-align:end">
  93. <button type="submit" class="btn btn-danger" value="">Modifier</button>
  94. </div>
  95. </div>
  96. </form>
  97. <style>
  98. .ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
  99. border-color: var(--ck-color-base-border);
  100. height: 300px;
  101. }
  102. </style>
  103. @include('backend.partials.scriptIndex')
  104. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js"
  105. integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ=="
  106. crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  107. <script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js"></script>
  108. <script src="https://unpkg.com/filepond@4.30.4/dist/filepond.min.js"></script>
  109. <script src="https://unpkg.com/filepond-plugin-file-poster@2.5.1/dist/filepond-plugin-file-poster.min.js"></script>
  110. <script src="https://unpkg.com/filepond-plugin-file-validate-type@1.2.8/dist/filepond-plugin-file-validate-type.min.js">
  111. </script>
  112. <script src="https://unpkg.com/filepond-plugin-file-validate-size@2.2.8/dist/filepond-plugin-file-validate-size.min.js">
  113. </script>
  114. <script
  115. src="https://unpkg.com/filepond-plugin-image-exif-orientation@1.0.11/dist/filepond-plugin-image-exif-orientation.min.js">
  116. </script>
  117. <script>
  118. $(function() {
  119. $("#categories").selectize({
  120. plugins: ["remove_button"],
  121. delimiter: ",",
  122. persist: false,
  123. create: function(input) {
  124. return {
  125. value: input,
  126. text: input,
  127. };
  128. },
  129. });
  130. });
  131. </script>
  132. <script type="module">
  133. var img_width = {{ config('app.IMG_HEIGHT') }} ;
  134. var img_height = {{ config('app.IMG_HEIGHT') }};
  135. var img_quality = {{ config('app.IMG_QUALITY') }};
  136. var img_ratio = {{ config('app.IMG_RATIO') }};
  137. var max_files = {{ config('app.MAX_FILES') }};
  138. var max_file_size = "{{ config('app.MAX_FILE_SIZE') }}B";
  139. var instant_upload = {{ config('app.INSTANT_UPLOAD') }};
  140. var pond_selector = '.my-pond';
  141. import {
  142. FilePondPluginImageEditor,
  143. } from '/filepond/filepond-plugin-image-editor/FilePondPluginImageEditor.js';
  144. // import Pintura Image Editor modules
  145. import {
  146. // Image editor
  147. openEditor,
  148. processImage,
  149. createDefaultImageReader,
  150. createDefaultImageWriter,
  151. createDefaultImageOrienter,
  152. // Only needed if loading legacy image editor data
  153. legacyDataToImageState,
  154. // Import the editor default configuration
  155. getEditorDefaults,
  156. } from '/pintura/pintura.js';
  157. // French
  158. import fr_FR from '/filepond/locale/fr-fr.js';
  159. FilePond.setOptions(fr_FR);
  160. // Register plugins
  161. FilePond.registerPlugin(
  162. FilePondPluginImageEditor,
  163. FilePondPluginFilePoster,
  164. FilePondPluginImageExifOrientation,
  165. FilePondPluginFileValidateType,
  166. FilePondPluginFileValidateSize,
  167. );
  168. FilePond.create(document.querySelector(pond_selector), {
  169. // Attributes
  170. name: 'image',
  171. maxFiles: max_files,
  172. allowFileSizeValidation: true,
  173. maxFileSize: max_file_size,
  174. allowBrowse: true,
  175. acceptedFileTypes: ['image/*'],
  176. dropOnPage: true,
  177. dropOnElement: true,
  178. instantUpload: instant_upload,
  179. // FilePond Image Editor plugin properties
  180. imageEditor: {
  181. // Maps legacy data objects to new imageState objects (optional)
  182. legacyDataToImageState: legacyDataToImageState,
  183. // Used to create the editor (required)
  184. createEditor: openEditor,
  185. // Used for reading the image data. See JavaScript installation for details on the `imageReader` property (required)
  186. imageReader: [
  187. createDefaultImageReader,
  188. {
  189. // createDefaultImageReader options here
  190. },
  191. ],
  192. // Required when generating a preview thumbnail and/or output image
  193. imageWriter: [
  194. createDefaultImageWriter,
  195. {
  196. // We'll resize images to fit a 512 × 512 square
  197. targetSize: {
  198. width: img_width,
  199. height: img_height,
  200. },
  201. quality: img_quality,
  202. },
  203. ],
  204. // Used to create poster and output images, runs an invisible "headless" editor instance
  205. imageProcessor: processImage,
  206. // Pintura Image Editor options
  207. editorOptions: {
  208. // Pass the editor default configuration options
  209. ...getEditorDefaults(),
  210. // This will set a square crop aspect ratio
  211. imageCropAspectRatio: img_ratio,
  212. }
  213. }
  214. });
  215. FilePond.setOptions({
  216. server: {
  217. process: '/file-upload-slide',
  218. revert: '/file-delete-slide',
  219. headers:{
  220. 'X-CSRF-TOKEN': '{{ csrf_token() }}'}
  221. },
  222. });
  223. </script>
  224. @endsection