| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -18,16 +18,18 @@ const props = defineProps({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const dropzone = ref(null); | 
					 | 
					 | 
					 | 
					const dropzone = ref(null); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const form = useForm({ | 
					 | 
					 | 
					 | 
					const form = useForm({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    name: "", | 
					 | 
					 | 
					 | 
					    files: [], | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    path: "", | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    redirect: props.redirect,  | 
					 | 
					 | 
					 | 
					    redirect: props.redirect,  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}) | 
					 | 
					 | 
					 | 
					}) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const emits = defineEmits(["data", "close", "file-added", "file-removed"]); | 
					 | 
					 | 
					 | 
					const emits = defineEmits(["data", "close", "file-added", "file-removed"]); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const imageAdded = (file) => { | 
					 | 
					 | 
					 | 
					const imageAdded = (file) => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    form.path = file.key; | 
					 | 
					 | 
					 | 
					    form.files.push({ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if(form.name === "") form.name = File.Basename(file.key).split("_")[1]; | 
					 | 
					 | 
					 | 
					        name: File.Basename(file.key).split("_")[1], | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        original_name: File.Basename(file.key).split("_")[1] + "." + File.Extension(file.key), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        path:file.key, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    emits('file-added', file) | 
					 | 
					 | 
					 | 
					    emits('file-added', file) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}  | 
					 | 
					 | 
					 | 
					}  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -39,24 +41,27 @@ const imageRemoved = (file) => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const submit = async () => { | 
					 | 
					 | 
					 | 
					const submit = async () => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if(!props.redirect) { | 
					 | 
					 | 
					 | 
					    if(!props.redirect) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        let res = await axios.post("/photo", { | 
					 | 
					 | 
					 | 
					        let res = await axios.post("/photos", { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            name: form.name, | 
					 | 
					 | 
					 | 
					            files: form.files, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            path: form.path, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            redirect: false,  | 
					 | 
					 | 
					 | 
					            redirect: false,  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }, { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            headers: { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                "Content-Type": "application/json", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }) | 
					 | 
					 | 
					 | 
					        }) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        const uuid = res.data.uuid; | 
					 | 
					 | 
					 | 
					        const uuids = res.data.uuids; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        console.log(uuid, res); | 
					 | 
					 | 
					 | 
					        console.log(uuids, res); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        emits("data", uuid); | 
					 | 
					 | 
					 | 
					        emits("data", uuids); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        form.post("/photo", { | 
					 | 
					 | 
					 | 
					        form.post("/photos", { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        headers: { | 
					 | 
					 | 
					 | 
					            headers: { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "Content-Type": "application/json", | 
					 | 
					 | 
					 | 
					                "Content-Type": "application/json", | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "X-CSRF-Token": document.querySelector('input[name=_token]').value, | 
					 | 
					 | 
					 | 
					                "X-CSRF-Token": document.querySelector('input[name=_token]').value, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }, | 
					 | 
					 | 
					 | 
					            }, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }); | 
					 | 
					 | 
					 | 
					            onSuccess: () => window.location.reload() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    form.path = ""; | 
					 | 
					 | 
					 | 
					    form.files = []; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    form.name = ""; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    dropzone.value.removeFiles(); | 
					 | 
					 | 
					 | 
					    dropzone.value.removeFiles(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    emits("close"); | 
					 | 
					 | 
					 | 
					    emits("close"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -71,13 +76,11 @@ const submit = async () => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        @file-removed="imageRemoved"  | 
					 | 
					 | 
					 | 
					        @file-removed="imageRemoved"  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        :name="photos" | 
					 | 
					 | 
					 | 
					        :name="photos" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        :empty="'Téléversé une image'" | 
					 | 
					 | 
					 | 
					        :empty="'Téléversé une image'" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        :multiple="false" | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        :accept="'image/*'" | 
					 | 
					 | 
					 | 
					        :accept="'image/*'" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        :class="'mb-1'"  | 
					 | 
					 | 
					 | 
					        :class="'mb-1'"  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        /> | 
					 | 
					 | 
					 | 
					        /> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        <InputError :message="form.errors.path"/> | 
					 | 
					 | 
					 | 
					        <InputError :message="form.errors.path"/> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        <p class="mt-3">Nom</p> | 
					 | 
					 | 
					 | 
					        <TextInput v-for="file in form.files" :class="'mb-1 w-full'" v-model="file.name" required :placeholder="'Changer le nom de l\'image ' + file.original_name"/> | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        <TextInput :class="'mb-1 w-full'" v-model="form.name" required :placeholder="'Nom de la photo'"/> | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        <InputError :message="form.errors.name"/> | 
					 | 
					 | 
					 | 
					        <InputError :message="form.errors.name"/> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        <div class="w-full flex justify-end mt-3"> | 
					 | 
					 | 
					 | 
					        <div class="w-full flex justify-end mt-3"> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            <button type="submit" class="text-white font-semibold p-1 px-2 bg-primary rounded-md">Ajouter</button> | 
					 | 
					 | 
					 | 
					            <button type="submit" class="text-white font-semibold p-1 px-2 bg-primary rounded-md">Ajouter</button> | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |