editPack.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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
  9. rel="stylesheet"
  10. href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css"
  11. integrity="sha512-pTaEn+6gF1IeWv3W1+7X7eM60TFu/agjgoHmYhAfLEU8Phuf6JKiiE8YmsNC0aCgQv4192s4Vai8YZ6VNM6vyQ=="
  12. crossorigin="anonymous"
  13. referrerpolicy="no-referrer"
  14. />
  15. @include('backend.partials.import')
  16. @include('backend.partials.features')
  17. <div class="card mt-4">
  18. <div class="card-header">
  19. Vous pouvez ajouter une image ou la modifie
  20. </div>
  21. <div class="card-body">
  22. <div class="container">
  23. @if(session('success'))
  24. <div class="alert alert-success">
  25. {{ session('success') }}
  26. </div>
  27. @endif
  28. @if (count($errors) > 0)
  29. <div class="alert alert-danger">
  30. <strong>Whoops!</strong> Some problems with your input.<br><br>
  31. <ul>
  32. @foreach ($errors->all() as $error)
  33. <li>{{ $error }}</li>
  34. @endforeach
  35. </ul>
  36. </div>
  37. @endif
  38. <form action="{{url('promotion/pack/'.$article->id)}}" method="post" enctype="multipart/form-data">
  39. <input type="hidden" name="_method" value="PUT">
  40. @csrf
  41. <div class="row">
  42. <div class="form-group mt-4">
  43. <label for="exampleFormControlTextarea1"><strong>Titre de la promotion :</strong></label>
  44. <input type="text" class="form-control" id="" name="titre" placeholder="titre" value="{{$article->titre}}" required>
  45. </div>
  46. </div>
  47. <div class="form-group mt-4">
  48. <label for="exampleFormControlTextarea1"><strong>Remise :</strong></label>
  49. <input type="text" class="form-control" id="" name="remise" placeholder="la remise" value="{{$article->remise}}" required>
  50. </div>
  51. <div class="row">
  52. <div class="form-group mt-4 col-6">
  53. <label for="exampleFormControlTextarea1"><strong>Début de la promotion :</strong></label>
  54. <input class="form-control" type="datetime-local" id="debut" name="debut" value="{{$article->debut}}">
  55. </div>
  56. <div class="form-group mt-4 col-6">
  57. <label for="exampleFormControlTextarea1"><strong>Fin de la promotion :</strong></label>
  58. <input class="form-control" type="datetime-local" id="fin" name="fin" value="{{$article->fin}}">
  59. </div>
  60. </div>
  61. <div class="form-group mt-4">
  62. <label for="exampleFormControlTextarea1"><strong>description :</strong></label>
  63. <textarea class="form-control" id="presentation" name="description" rows="6">{{$article->description}}</textarea>
  64. </div>
  65. <div class="input-group mt-4 control-group increment" >
  66. <input type="file" name="image" class="my-pond form-control" />
  67. </div>
  68. </div>
  69. <div class="form-group col-md-4 mt-4">
  70. <button type="submit" class="btn btn-success" style="margin-top:10px">Confirmer</button>
  71. </div>
  72. </form>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. @include('backend.partials.scriptIndex')
  78. <style>
  79. .ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
  80. border-color: var(--ck-color-base-border);
  81. height: 300px;
  82. }
  83. </style>
  84. <script
  85. src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js"
  86. integrity="sha512-IOebNkvA/HZjMM7MxL0NYeLYEalloZ8ckak+NDtOViP7oiYzG5vn6WVXyrJDiJPhl4yRdmNAG49iuLmhkUdVsQ=="
  87. crossorigin="anonymous"
  88. referrerpolicy="no-referrer"
  89. ></script>
  90. <script>
  91. $(function () {
  92. $("#produits").selectize({
  93. plugins: ["auto_select_on_type"],
  94. });
  95. });
  96. </script>
  97. <script src="https://unpkg.com/filepond@4.30.4/dist/filepond.min.js"></script>
  98. <script src="https://unpkg.com/filepond-plugin-file-poster@2.5.1/dist/filepond-plugin-file-poster.min.js"></script>
  99. <script src="https://unpkg.com/filepond-plugin-file-validate-type@1.2.8/dist/filepond-plugin-file-validate-type.min.js"></script>
  100. <script src="https://unpkg.com/filepond-plugin-file-validate-size@2.2.8/dist/filepond-plugin-file-validate-size.min.js"></script>
  101. <script src="https://unpkg.com/filepond-plugin-image-exif-orientation@1.0.11/dist/filepond-plugin-image-exif-orientation.min.js"></script>
  102. <script type="module">
  103. var img_width = 1080 ;
  104. var img_height = {{ env('IMG_HEIGHT') }};
  105. var img_quality = {{ env('IMG_QUALITY') }};
  106. var img_ratio = {{ env('IMG_RATIO') }};
  107. var max_files = {{ env('MAX_FILES') }};
  108. var max_file_size = "{{ env('MAX_FILE_SIZE') }}B";
  109. var instant_upload = {{ env('INSTANT_UPLOAD') }};
  110. var pond_selector = '.my-pond';
  111. import {
  112. FilePondPluginImageEditor,
  113. } from '/filepond/filepond-plugin-image-editor/FilePondPluginImageEditor.js';
  114. // import Pintura Image Editor modules
  115. import {
  116. // Image editor
  117. openEditor,
  118. processImage,
  119. createDefaultImageReader,
  120. createDefaultImageWriter,
  121. createDefaultImageOrienter,
  122. // Only needed if loading legacy image editor data
  123. legacyDataToImageState,
  124. // Import the editor default configuration
  125. getEditorDefaults,
  126. } from '/pintura/pintura.js';
  127. // French
  128. import fr_FR from '/filepond/locale/fr-fr.js';
  129. FilePond.setOptions(fr_FR);
  130. // Register plugins
  131. FilePond.registerPlugin(
  132. FilePondPluginImageEditor,
  133. FilePondPluginFilePoster,
  134. FilePondPluginImageExifOrientation,
  135. FilePondPluginFileValidateType,
  136. FilePondPluginFileValidateSize,
  137. );
  138. FilePond.create(document.querySelector(pond_selector), {
  139. // Attributes
  140. name: 'image',
  141. maxFiles: max_files,
  142. allowFileSizeValidation: true,
  143. maxFileSize: max_file_size,
  144. allowBrowse: true,
  145. acceptedFileTypes: ['image/*'],
  146. dropOnPage: true,
  147. dropOnElement: true,
  148. instantUpload: instant_upload,
  149. // FilePond Image Editor plugin properties
  150. imageEditor: {
  151. // Maps legacy data objects to new imageState objects (optional)
  152. legacyDataToImageState: legacyDataToImageState,
  153. // Used to create the editor (required)
  154. createEditor: openEditor,
  155. // Used for reading the image data. See JavaScript installation for details on the `imageReader` property (required)
  156. imageReader: [
  157. createDefaultImageReader,
  158. {
  159. // createDefaultImageReader options here
  160. },
  161. ],
  162. // Required when generating a preview thumbnail and/or output image
  163. imageWriter: [
  164. createDefaultImageWriter,
  165. {
  166. // We'll resize images to fit a 512 × 512 square
  167. targetSize: {
  168. width: img_width,
  169. height: img_height,
  170. },
  171. quality: img_quality,
  172. },
  173. ],
  174. // Used to create poster and output images, runs an invisible "headless" editor instance
  175. imageProcessor: processImage,
  176. // Pintura Image Editor options
  177. editorOptions: {
  178. // Pass the editor default configuration options
  179. ...getEditorDefaults(),
  180. // This will set a square crop aspect ratio
  181. imageCropAspectRatio: img_ratio,
  182. }
  183. }
  184. });
  185. FilePond.setOptions({
  186. server: {
  187. process: '/file-upload-promotion',
  188. revert: '/file-delete-promotion',
  189. headers:{
  190. 'X-CSRF-TOKEN': '{{ csrf_token() }}'}
  191. },
  192. });
  193. </script>
  194. @endsection