Skip to content

Commit

Permalink
added copies
Browse files Browse the repository at this point in the history
  • Loading branch information
srivastava-jyoti committed Oct 9, 2024
1 parent ab7ea3e commit 946411a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,10 @@ if (document.getElementById("books_listing")) {
allCategoryInputs.forEach(
(checkbox) => (this.categoryInputs[checkbox.value] = checkbox)
);
let locationsData = document.getElementById("books_table").dataset.locationData;
if (locationsData) {
this.copies = JSON.parse(locationsData);
}
},
});
}
Expand Down
15 changes: 14 additions & 1 deletion resources/views/knowledgecafe/library/books/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
</div>
@endif
<div class="d-flex justify-content-start flex-wrap" id="books_table" data-books="{{ json_encode($books) }}" data-locations ="{{ json_encode($bookLocations) }}" data-categories="{{ json_encode($categories) }}" data-index-route="{{ route('books.index') }}" data-category-index-route="{{ route('books.category.index') }}" data-logged-in-user="{{ json_encode(auth()->user()) }}">
<div class="d-flex justify-content-start flex-wrap" id="books_table" data-books="{{ json_encode($books) }}" data-locations ="{{ json_encode($bookLocations) }}" data-categories="{{ json_encode($categories) }}" data-index-route="{{ route('books.index') }}" data-category-index-route="{{ route('books.category.index') }}" data-logged-in-user="{{ json_encode(auth()->user()) }}" data-location-data = '@json($bookLocations->pluck("number_of_copies", "location.id"))' >
<div class="d-flex flex-wrap w-full">
<div v-for="(book, index) in books" class="col-lg-4 col-md-5 col-8 card book_card mr-1 mb-3 p-2 mr-lg-4">
<div class="d-flex">
Expand Down Expand Up @@ -164,3 +164,16 @@
@include('knowledgecafe.library.books.update-category-modal')
</div>
@endsection

<script>
export default {
data() {
return {
copies: @json($bookLocations->pluck('number_of_copies', 'location.id'))
}
},
mounted() {
console.log(this.copies);
}
}
</script>

0 comments on commit 946411a

Please sign in to comment.