Skip to content

Commit

Permalink
Merge pull request #208 from avored/develop
Browse files Browse the repository at this point in the history
fixed the images height issue and make the product id dynamic
  • Loading branch information
indpurvesh authored Oct 28, 2022
2 parents 94f51c7 + 1419bef commit f13d907
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion resources/lang/en/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@
'success_sent_password_reset_email_message' => 'Successfully Password Reset Email has been sent to customer',
'images' => 'Images',
'product_success_upload_message' => 'Product Document Uploaded successfully',
'product_success_delete_message' => 'Product Document Deleted successfully'
'product_success_delete_message' => 'Product Document Deleted successfully',
'drag_drop_attached_file' => 'Drop files to Attach, or',
'browse' => 'browse',
];
18 changes: 8 additions & 10 deletions resources/views/catalog/product/cards/images.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class="flex bg-white justify-center w-full h-32 p-4 transition border-2 border-g
</svg>

<span class="font-medium text-gray-600">
Drop files to Attach, or
<span class="text-blue-600 underline">browse</span>
{{ __('avored::system.drag_drop_attached_file') }}
<span class="text-blue-600 underline">{{ __('avored::system.browse') }}</span>
</span>
</span>
<input type="file" x-on:change="documentOnChange" name="file_upload" class="hidden">
<input type="file" x-on:change="documentOnChange($event, '{{$product->id}}')" name="file_upload" class="hidden">
</label>
<div class="mt-5">
<div class="grid gap-4 grid-cols-6">
<template x-for="document in documents">
<div class="text-center">
<div class="object-fill h-48 w-96">
<img x-bind:src="`/storage/${document.path}`" class="w-32 rounded-md" alt="product image" />
<div class="rounded-md">
<img x-bind:src="`/storage/${document.path}`" class="object-fill h-32 w-48 rounded-md" alt="product image" />
</div>
<div class="flex mt-3 justify-center w-full" >
<a href="#" x-on:click.prevent="documentDelete(document.id)">
Expand All @@ -44,15 +44,13 @@ class="flex bg-white justify-center w-full h-32 p-4 transition border-2 border-g
documents: [],
fileuploadinit(documents) {
console.log(documents)
this.documents = documents
},
documentOnChange (e) {
console.log(e.target.documents)
documentOnChange (e, id) {
var formData = new FormData();
formData.append("image", e.target.files[0]);
axios.post('/admin/product-document-upload/10981be7-ac5b-485a-8ef6-de03584be21e', formData, {
axios.post('/admin/product-document-upload/' + id, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
Expand Down

0 comments on commit f13d907

Please sign in to comment.