edit.blade.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. @extends('layouts.idara.panel')
  2. @section('content')
  3. <link href="https://unpkg.com/filepond@4.30.4/dist/filepond.min.css" rel="stylesheet" type="text/css" />
  4. <link href="https://unpkg.com/filepond-plugin-file-poster@2.5.1/dist/filepond-plugin-file-poster.min.css" rel="stylesheet" type="text/css" />
  5. <link href="{{asset('pintura/pintura.scss')}}" rel="stylesheet" />
  6. <!-- Custom css -->
  7. <link href="{{asset('css/custom.css')}}" rel="stylesheet" />
  8. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  9. @include('backend.partials.features')
  10. <div class="container">
  11. <div class="card">
  12. <h5 class="card-header">Modifier</h5>
  13. <div class="card-body">
  14. <form action="{{url('produit/'.$article->id)}}" method="post" enctype="multipart/form-data">
  15. <input type="hidden" name="_method" value="PUT">
  16. @csrf
  17. <div class="form-group">
  18. <label for="exampleFormControlInput1">Nom</label>
  19. <input type="text" class="form-control" name="nom" placeholder="" value="{{$article->nom}}" required>
  20. </div>
  21. <div class="form-group mt-4">
  22. <label for="exampleFormControlInput1">Categorie</label>
  23. <select multiple onchange="optionCheck()" class="form-control" name="categories[]" id="categories" class="categorie" aria-describedby="validationServer04Feedback" style=" margin-bottom: 40px;" required>
  24. <option value="{{ $article->category_id }}">
  25. @foreach ($article->categories as $singleTag)
  26. <span class="label label-info label-many btn btn-secondary">{{ $singleTag->nom }}</span>
  27. @endforeach</option>
  28. @foreach ($categories as $categorie)
  29. <option value="{{ $categorie->id }}" {{ old('categorie') == $categorie->id ? 'selected' : '' }}>{{ $categorie->nom }}</option>
  30. @endforeach
  31. </select>
  32. </div>
  33. <div class="form-group">
  34. <label for="exampleFormControlTextarea1">description</label>
  35. <textarea class="form-control" id="presentation" name="description" rows="3">{!! html_entity_decode ($article->description)!!}</textarea>
  36. </div>
  37. <div class="form-group">
  38. <label for="exampleFormControlInput1">image</label>
  39. <div class="input-group mt-4 control-group increment" >
  40. <input type="file" name="image" class="my-pond form-control " multiple/>
  41. </div>
  42. </div>
  43. <div class="form-group add">
  44. <button type="submit" class="btn btn-primary" value="">Modifier</button>
  45. </div>
  46. </form>
  47. </div>
  48. </div>
  49. </div>
  50. <style>
  51. .ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
  52. border-color: var(--ck-color-base-border);
  53. height: 300px;
  54. }
  55. </style>
  56. <script src="https://cdn.ckeditor.com/ckeditor5/36.0.0/classic/ckeditor.js"></script>
  57. <script>
  58. ClassicEditor
  59. .create(document.querySelector('#presentation'))
  60. .then(editor => {
  61. window.editor = editor;
  62. })
  63. .catch(error => {
  64. console.error('There was a problem initializing the editor.', error);
  65. });
  66. </script>
  67. </div>
  68. </div>
  69. <script src="https://unpkg.com/filepond@4.30.4/dist/filepond.min.js"></script>
  70. <script src="https://unpkg.com/filepond-plugin-file-poster@2.5.1/dist/filepond-plugin-file-poster.min.js"></script>
  71. <script src="https://unpkg.com/filepond-plugin-file-validate-type@1.2.8/dist/filepond-plugin-file-validate-type.min.js"></script>
  72. <script src="https://unpkg.com/filepond-plugin-file-validate-size@2.2.8/dist/filepond-plugin-file-validate-size.min.js"></script>
  73. <script src="https://unpkg.com/filepond-plugin-image-exif-orientation@1.0.11/dist/filepond-plugin-image-exif-orientation.min.js"></script>
  74. <script type="module">
  75. var img_width = 1080 ;
  76. var img_height = {{ env('IMG_HEIGHT') }};
  77. var img_quality = {{ env('IMG_QUALITY') }};
  78. var img_ratio = {{ env('IMG_RATIO') }};
  79. var max_files = {{ env('MAX_FILES') }};
  80. var max_file_size = "{{ env('MAX_FILE_SIZE') }}B";
  81. var instant_upload = {{ env('INSTANT_UPLOAD') }};
  82. var pond_selector = '.my-pond';
  83. import {
  84. FilePondPluginImageEditor,
  85. } from '/filepond/filepond-plugin-image-editor/FilePondPluginImageEditor.js';
  86. // import Pintura Image Editor modules
  87. import {
  88. // Image editor
  89. openEditor,
  90. processImage,
  91. createDefaultImageReader,
  92. createDefaultImageWriter,
  93. createDefaultImageOrienter,
  94. // Only needed if loading legacy image editor data
  95. legacyDataToImageState,
  96. // Import the editor default configuration
  97. getEditorDefaults,
  98. } from '/pintura/pintura.js';
  99. // French
  100. import fr_FR from '/filepond/locale/fr-fr.js';
  101. FilePond.setOptions(fr_FR);
  102. // Register plugins
  103. FilePond.registerPlugin(
  104. FilePondPluginImageEditor,
  105. FilePondPluginFilePoster,
  106. FilePondPluginImageExifOrientation,
  107. FilePondPluginFileValidateType,
  108. FilePondPluginFileValidateSize,
  109. );
  110. FilePond.create(document.querySelector(pond_selector), {
  111. // Attributes
  112. name: 'image',
  113. maxFiles: max_files,
  114. allowFileSizeValidation: true,
  115. maxFileSize: max_file_size,
  116. allowBrowse: true,
  117. acceptedFileTypes: ['image/*'],
  118. dropOnPage: true,
  119. dropOnElement: true,
  120. instantUpload: instant_upload,
  121. // FilePond Image Editor plugin properties
  122. imageEditor: {
  123. // Maps legacy data objects to new imageState objects (optional)
  124. legacyDataToImageState: legacyDataToImageState,
  125. // Used to create the editor (required)
  126. createEditor: openEditor,
  127. // Used for reading the image data. See JavaScript installation for details on the `imageReader` property (required)
  128. imageReader: [
  129. createDefaultImageReader,
  130. {
  131. // createDefaultImageReader options here
  132. },
  133. ],
  134. // Required when generating a preview thumbnail and/or output image
  135. imageWriter: [
  136. createDefaultImageWriter,
  137. {
  138. // We'll resize images to fit a 512 × 512 square
  139. targetSize: {
  140. width: img_width,
  141. height: img_height,
  142. },
  143. quality: img_quality,
  144. },
  145. ],
  146. // Used to create poster and output images, runs an invisible "headless" editor instance
  147. imageProcessor: processImage,
  148. // Pintura Image Editor options
  149. editorOptions: {
  150. // Pass the editor default configuration options
  151. ...getEditorDefaults(),
  152. // This will set a square crop aspect ratio
  153. imageCropAspectRatio: img_ratio,
  154. }
  155. }
  156. });
  157. FilePond.setOptions({
  158. server: {
  159. process: '/file-upload-slide',
  160. revert: '/file-delete-slide',
  161. headers:{
  162. 'X-CSRF-TOKEN': '{{ csrf_token() }}'}
  163. },
  164. });
  165. </script>
  166. @endsection