Skip to content

Commit

Permalink
Release: v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
XPH0816 committed Jun 21, 2024
1 parent dd930d7 commit b752939
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libraryroombookingsystem",
"private": true,
"version": "1.0.3",
"version": "1.0.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "LibraryRoomBookingSystem"
version = "1.0.3"
version = "1.0.4"
description = "A Library Room Booking System built with Tauri and Rust"
authors = ["Lim Shi Song limshisong123@gmail.com"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "LibraryRoomBookingSystem",
"version": "1.0.3"
"version": "1.0.4"
},
"tauri": {
"allowlist": {
Expand Down
30 changes: 21 additions & 9 deletions src/lib/components/forms/BookingForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@
onMount(async () => {
roomsAvailable = await getRoomsByType(roomName);
roomId
? (roomName = (await getRoomById(roomId)).type)
: (roomId = roomsAvailable[0].room_id);
let room;
if (roomId != null) {
room = await getRoomById(roomId);
roomName = room.type;
} else {
roomId = roomsAvailable[0].room_id;
}
price = getPrice(rooms.find((value) => value.name === roomName).price);
changeDate();
});
Expand Down Expand Up @@ -73,7 +77,11 @@
let endDateTime = new Date(dateTime);
endDateTime = GetEndDateTime(endDateTime, room.duration);
checkOutTime = formatTime(endDateTime);
if (checkInDate !== checkOutDate && isNotHikmahRoomAndEksplorasiRoom(roomName)) changeDate();
if (
checkInDate !== checkOutDate &&
isNotHikmahRoomAndEksplorasiRoom(roomName)
)
changeDate();
};
let changeEndTime = () => {
Expand Down Expand Up @@ -131,11 +139,15 @@
)}
bind:value={roomId}
>
{#each roomsAvailable as room}
<option value={room.room_id}
>{room.room_number}</option
>
{/each}
<!-- {#await getRoomsByType(roomName) then roomsAvailable} -->
{#each roomsAvailable as room}
<option
value={room.room_id}
selected={roomId === room.room_id}
>{room.room_number}</option
>
{/each}
<!-- {/await} -->
</Input>
</FormGroup>
</Col>
Expand Down
7 changes: 6 additions & 1 deletion src/routes/(admin)/manage/feedback/form/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
let submit;
let success = false;
let failure = false;
let msg;
let view = false;
let reply;
let close;
Expand All @@ -39,7 +41,7 @@
submit = async () => {
success = failure = false;
try {
if (reply.comment === "") throw new Error("Reply is Required");
if (!reply.comment) throw new Error("Please enter your reply");
data.feedback.content = content;
data.feedback.admin_id = $user.id;
data.feedback.comment = reply.comment;
Expand All @@ -50,6 +52,8 @@
} else throw new Error("Failed to Submit Feedback");
} catch (e) {
failure = true;
if(e.message) msg = e.message;
else msg = "Failed to Submit Feedback";
}
};
});
Expand All @@ -61,6 +65,7 @@
bind:content
bind:success
bind:failure
bind:msg
feedback={data.feedback}
bind:data={reply}
button="Reply"
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(authed)/booking/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"Room is not available for the selected time period",
);
}
if(roomId === undefined) throw new Error("Please select a room");
if(roomId == undefined) throw new Error("Please select a room");
if(!reason) throw new Error("Please enter a reason");
let booking = new Booking({
room_id: roomId,
Expand Down
12 changes: 4 additions & 8 deletions src/routes/(authed)/booking/room/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import { Booking, checkAvailability } from "$lib/models/booking";
import showModal from "$lib/showModal.js";
import { currentDateTime, user } from "$lib/store";
import { onMount } from "svelte";
export let data;
let roomId = data.room.room_id;
let checkInDate;
let checkInDate = formatDate(data.dateTime);
let checkOutDate;
let checkInTime;
let checkInTime = formatTime(data.dateTime);
let checkOutTime;
let reason;
let success = false;
Expand All @@ -43,6 +42,8 @@
"Room is not available for the selected time period",
);
}
if (roomId === undefined) throw new Error("Please select a room");
if (!reason) throw new Error("Please enter a reason");
let booking = new Booking({
room_id: roomId,
user_id: $user.id,
Expand All @@ -57,11 +58,6 @@
else showModal("Error", "Failed to book room");
}
};
onMount(() => {
checkInDate = formatDate(data.dateTime);
checkInTime = formatTime(data.dateTime);
});
</script>

<main class="container-fluid">
Expand Down

0 comments on commit b752939

Please sign in to comment.