Pack.blade.php 7.7 KB

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