Skip to content

Commit 62d96b0

Browse files
committed
Library management system
0 parents  commit 62d96b0

73 files changed

Lines changed: 3691 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DATABASE FILE/librarygh.sql

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
2+
SET time_zone = "+00:00";
3+
4+
5+
DELIMITER $$
6+
7+
CREATE DEFINER=`root`@`localhost` PROCEDURE `generate_due_list`()
8+
NO SQL
9+
SELECT I.issue_id, M.email, B.isbn, B.title
10+
FROM book_issue_log I INNER JOIN member M on I.member = M.username INNER JOIN book B ON I.book_isbn = B.isbn
11+
WHERE DATEDIFF(CURRENT_DATE, I.due_date) >= 0 AND DATEDIFF(CURRENT_DATE, I.due_date) % 5 = 0 AND (I.last_reminded IS NULL OR DATEDIFF(I.last_reminded, CURRENT_DATE) <> 0)$$
12+
13+
DELIMITER ;
14+
15+
16+
CREATE TABLE IF NOT EXISTS `book` (
17+
`isbn` char(13) NOT NULL,
18+
`title` varchar(80) NOT NULL,
19+
`author` varchar(80) NOT NULL,
20+
`category` varchar(80) NOT NULL,
21+
`price` int(4) unsigned NOT NULL,
22+
`copies` int(10) unsigned NOT NULL
23+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
24+
25+
INSERT INTO `book` (`isbn`, `title`, `author`, `category`, `price`, `copies`) VALUES
26+
('6900152484440', 'V for Vendetta', 'Alan Moore', 'Comics', 299, 13),
27+
('9782616052277', 'X-Men: God Loves, Man Kills', 'Chris', 'Comics', 399, 33),
28+
('9783161484100', 'Mike Tyson : Undisputed Truth', 'Larry Sloman, Mike Tyson', 'Sports', 299, 19),
29+
('9789996245442', 'When Breath Becomes Air', 'Paul Kalanithi', 'Medical', 515, 9),
30+
('9885691200700', 'The Great Gatsby', 'F. Scott Fitzgerald', 'Fiction', 420, 20);
31+
32+
33+
CREATE TABLE IF NOT EXISTS `book_issue_log` (
34+
`issue_id` int(11) NOT NULL,
35+
`member` varchar(20) NOT NULL,
36+
`book_isbn` varchar(13) NOT NULL,
37+
`due_date` date NOT NULL,
38+
`last_reminded` date DEFAULT NULL
39+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
40+
41+
DELIMITER //
42+
CREATE TRIGGER `issue_book` BEFORE INSERT ON `book_issue_log`
43+
FOR EACH ROW BEGIN
44+
SET NEW.due_date = DATE_ADD(CURRENT_DATE, INTERVAL 7 DAY);
45+
UPDATE member SET balance = balance - (SELECT price FROM book WHERE isbn = NEW.book_isbn) WHERE username = NEW.member;
46+
UPDATE book SET copies = copies - 1 WHERE isbn = NEW.book_isbn;
47+
DELETE FROM pending_book_requests WHERE member = NEW.member AND book_isbn = NEW.book_isbn;
48+
END
49+
//
50+
DELIMITER ;
51+
DELIMITER //
52+
CREATE TRIGGER `return_book` BEFORE DELETE ON `book_issue_log`
53+
FOR EACH ROW BEGIN
54+
UPDATE member SET balance = balance + (SELECT price FROM book WHERE isbn = OLD.book_isbn) WHERE username = OLD.member;
55+
UPDATE book SET copies = copies + 1 WHERE isbn = OLD.book_isbn;
56+
END
57+
//
58+
DELIMITER ;
59+
60+
61+
CREATE TABLE IF NOT EXISTS `librarian` (
62+
`id` int(11) NOT NULL,
63+
`username` varchar(20) NOT NULL,
64+
`password` char(40) NOT NULL
65+
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
66+
67+
INSERT INTO `librarian` (`id`, `username`, `password`) VALUES
68+
(1, 'harry', '93c768d0152f72bc8d5e782c0b585acc35fb0442');
69+
70+
CREATE TABLE IF NOT EXISTS `member` (
71+
`id` int(11) NOT NULL,
72+
`username` varchar(20) NOT NULL,
73+
`password` char(40) NOT NULL,
74+
`name` varchar(80) NOT NULL,
75+
`email` varchar(80) NOT NULL,
76+
`balance` int(4) NOT NULL
77+
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
78+
79+
80+
DELIMITER //
81+
CREATE TRIGGER `add_member` AFTER INSERT ON `member`
82+
FOR EACH ROW DELETE FROM pending_registrations WHERE username = NEW.username
83+
//
84+
DELIMITER ;
85+
DELIMITER //
86+
CREATE TRIGGER `remove_member` AFTER DELETE ON `member`
87+
FOR EACH ROW DELETE FROM pending_book_requests WHERE member = OLD.username
88+
//
89+
DELIMITER ;
90+
91+
92+
CREATE TABLE IF NOT EXISTS `pending_book_requests` (
93+
`request_id` int(11) NOT NULL,
94+
`member` varchar(20) NOT NULL,
95+
`book_isbn` varchar(13) NOT NULL,
96+
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
97+
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
98+
99+
100+
101+
CREATE TABLE IF NOT EXISTS `pending_registrations` (
102+
`username` varchar(20) NOT NULL,
103+
`password` char(40) NOT NULL,
104+
`name` varchar(80) NOT NULL,
105+
`email` varchar(80) NOT NULL,
106+
`balance` int(4) NOT NULL,
107+
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
108+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
109+
110+
INSERT INTO `pending_registrations` (`username`, `password`, `name`, `email`, `balance`, `time`) VALUES
111+
('christine', '9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684', 'Christine', 'christine400eer@gmail.com', 999, '2021-03-21 08:29:00'),
112+
('steeve', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'Steeve Rogers', 'thisissteeve69@gmail.com', 1500, '2021-03-21 12:14:53');
113+
114+
115+
ALTER TABLE `book`
116+
ADD PRIMARY KEY (`isbn`);
117+
118+
119+
ALTER TABLE `book_issue_log`
120+
ADD PRIMARY KEY (`issue_id`);
121+
122+
ALTER TABLE `librarian`
123+
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`);
124+
125+
126+
ALTER TABLE `member`
127+
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`);
128+
129+
ALTER TABLE `pending_book_requests`
130+
ADD PRIMARY KEY (`request_id`);
131+
132+
133+
ALTER TABLE `pending_registrations`
134+
ADD PRIMARY KEY (`username`), ADD UNIQUE KEY `email` (`email`);
135+
136+
137+
ALTER TABLE `book_issue_log`
138+
MODIFY `issue_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
139+
140+
ALTER TABLE `librarian`
141+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
142+
143+
ALTER TABLE `member`
144+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
145+
146+
ALTER TABLE `pending_book_requests`
147+
MODIFY `request_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;

css/custom_checkbox_style.css

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*----------Custom checkbox----------*/
2+
.control-group {
3+
display: inline-block;
4+
width: 200px;
5+
height: 210px;
6+
margin: 10px;
7+
padding: 30px;
8+
text-align: left;
9+
vertical-align: top;
10+
background: #fff;
11+
box-shadow: 0 1px 2px rgba(0,0,0,.1);
12+
}
13+
14+
.control {
15+
font-size: 18px;
16+
position: relative;
17+
display: block;
18+
margin-bottom: 15px;
19+
padding-left: 30px;
20+
cursor: pointer;
21+
}
22+
23+
.control input {
24+
position: absolute;
25+
z-index: -1;
26+
opacity: 0;
27+
}
28+
29+
.control__indicator {
30+
position: absolute;
31+
top: -2px;
32+
left: 0;
33+
width: 20px;
34+
height: 20px;
35+
background: #e6e6e6;
36+
}
37+
38+
/* Hover and focus states */
39+
.control:hover input ~ .control__indicator,
40+
.control input:focus ~ .control__indicator {
41+
background: #cccccc;
42+
}
43+
44+
/* Checked state */
45+
.control input:checked ~ .control__indicator {
46+
-webkit-animation: cd-bounce 0.3s;
47+
-moz-animation: cd-bounce 0.3s;
48+
animation: cd-bounce 0.3s;
49+
background: #d75069;
50+
}
51+
52+
/* Disabled state */
53+
.control input:disabled ~ .control__indicator {
54+
-webkit-animation: cd-bounce 0.3s;
55+
-moz-animation: cd-bounce 0.3s;
56+
animation: cd-bounce 0.3s;
57+
pointer-events: none;
58+
opacity: .6;
59+
background: #e6e6e6;
60+
}
61+
62+
/* Check mark */
63+
.control__indicator:after {
64+
position: absolute;
65+
display: none;
66+
content: '';
67+
}
68+
69+
/* Show check mark */
70+
.control input:checked ~ .control__indicator:after {
71+
display: block;
72+
}
73+
74+
/* Checkbox tick */
75+
.control--checkbox .control__indicator:after {
76+
top: 4px;
77+
left: 8px;
78+
width: 5px;
79+
height: 10px;
80+
transform: rotate(45deg);
81+
border: solid #fff;
82+
border-width: 0 2px 2px 0;
83+
}
84+
85+
@-webkit-keyframes cd-bounce {
86+
0%, 100% {
87+
-webkit-transform: scale(1);
88+
}
89+
50% {
90+
-webkit-transform: scale(0.8);
91+
}
92+
}
93+
@-moz-keyframes cd-bounce {
94+
0%, 100% {
95+
-moz-transform: scale(1);
96+
}
97+
50% {
98+
-moz-transform: scale(0.8);
99+
}
100+
}
101+
@keyframes cd-bounce {
102+
0%, 100% {
103+
-webkit-transform: scale(1);
104+
-moz-transform: scale(1);
105+
-ms-transform: scale(1);
106+
-o-transform: scale(1);
107+
transform: scale(1);
108+
}
109+
50% {
110+
-webkit-transform: scale(0.8);
111+
-moz-transform: scale(0.8);
112+
-ms-transform: scale(0.8);
113+
-o-transform: scale(0.8);
114+
transform: scale(0.8);
115+
}
116+
}

css/custom_radio_button_style.css

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/*----------Custom radio button----------*/
2+
.control-group {
3+
display: inline-block;
4+
width: 200px;
5+
height: 210px;
6+
margin: 10px;
7+
padding: 30px;
8+
text-align: left;
9+
vertical-align: top;
10+
background: #ffffff;
11+
box-shadow: 0 1px 2px rgba(0,0,0,.1);
12+
}
13+
14+
.control {
15+
font-size: 18px;
16+
position: relative;
17+
display: block;
18+
margin-bottom: 15px;
19+
padding-left: 30px;
20+
cursor: pointer;
21+
}
22+
23+
.control input {
24+
position: absolute;
25+
z-index: -1;
26+
opacity: 0;
27+
}
28+
29+
.control__indicator {
30+
position: absolute;
31+
top: 2px;
32+
left: 0;
33+
width: 20px;
34+
height: 20px;
35+
background: #e6e6e6;
36+
}
37+
38+
.control--radio .control__indicator {
39+
border-radius: 50%;
40+
}
41+
42+
/* Hover and focus states */
43+
.control:hover input ~ .control__indicator,
44+
.control input:focus ~ .control__indicator {
45+
background: #cccccc;
46+
}
47+
48+
/* Checked state */
49+
.control input:checked ~ .control__indicator {
50+
-webkit-animation: cd-bounce 0.3s;
51+
-moz-animation: cd-bounce 0.3s;
52+
animation: cd-bounce 0.3s;
53+
background: #d75069;
54+
}
55+
56+
/* Disabled state */
57+
.control input:disabled ~ .control__indicator {
58+
-webkit-animation: cd-bounce 0.3s;
59+
-moz-animation: cd-bounce 0.3s;
60+
animation: cd-bounce 0.3s;
61+
pointer-events: none;
62+
opacity: .6;
63+
background: #e6e6e6;
64+
}
65+
66+
/* Check mark */
67+
.control__indicator:after {
68+
position: absolute;
69+
display: none;
70+
content: '';
71+
}
72+
73+
/* Show check mark */
74+
.control input:checked ~ .control__indicator:after {
75+
display: block;
76+
}
77+
78+
/* Radio button inner circle */
79+
.control--radio .control__indicator:after {
80+
top: 7px;
81+
left: 7px;
82+
width: 6px;
83+
height: 6px;
84+
border-radius: 50%;
85+
background: #ffffff;
86+
}
87+
88+
@-webkit-keyframes cd-bounce {
89+
0%, 100% {
90+
-webkit-transform: scale(1);
91+
}
92+
50% {
93+
-webkit-transform: scale(0.8);
94+
}
95+
}
96+
@-moz-keyframes cd-bounce {
97+
0%, 100% {
98+
-moz-transform: scale(1);
99+
}
100+
50% {
101+
-moz-transform: scale(0.8);
102+
}
103+
}
104+
@keyframes cd-bounce {
105+
0%, 100% {
106+
-webkit-transform: scale(1);
107+
-moz-transform: scale(1);
108+
-ms-transform: scale(1);
109+
-o-transform: scale(1);
110+
transform: scale(1);
111+
}
112+
50% {
113+
-webkit-transform: scale(0.8);
114+
-moz-transform: scale(0.8);
115+
-ms-transform: scale(0.8);
116+
-o-transform: scale(0.8);
117+
transform: scale(0.8);
118+
}
119+
}

0 commit comments

Comments
 (0)