diff --git a/css/dashboard.css b/css/dashboard.css index 5c6f990fba4e8302e274f453078d4c5245e66d78..264207f3b930218f3584e38933fd7a2f956c2ac7 100644 --- a/css/dashboard.css +++ b/css/dashboard.css @@ -34,6 +34,10 @@ color: #FFF; } +.order-wrapper, .history-wrapper { + display: none; +} + .sub-header { font-size: 0; margin: 10px 0; diff --git a/data/projekers.sql b/data/projekers.sql index f094caa93d284c1265ff91c1af212394f3058199..586cc0b1c8ef31a4a83b554c5a445e4a3551bf0c 100644 --- a/data/projekers.sql +++ b/data/projekers.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.16 Distrib 10.1.21-MariaDB, for Win32 (AMD64) +-- MySQL dump 10.13 Distrib 5.7.14, for Win64 (x86_64) -- --- Host: localhost Database: localhost +-- Host: localhost Database: projekers -- ------------------------------------------------------ --- Server version 10.1.21-MariaDB +-- Server version 5.5.5-10.1.25-MariaDB /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -40,6 +40,40 @@ INSERT INTO `pref_loc` VALUES (1,'Tubagus Ismail'),(1,'Dago Asri'),(1,'Kopo'); /*!40000 ALTER TABLE `pref_loc` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `transaction` +-- + +DROP TABLE IF EXISTS `transaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transaction` ( + `transaction_id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `driver_id` int(11) NOT NULL, + `pickup` varchar(20) NOT NULL, + `destination` varchar(20) NOT NULL, + `rating` int(1) NOT NULL, + `comment` text NOT NULL, + `date` date NOT NULL, + PRIMARY KEY (`transaction_id`) USING BTREE, + KEY `user_id` (`user_id`), + KEY `driver_id` (`driver_id`), + CONSTRAINT `transaction_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`), + CONSTRAINT `transaction_ibfk_2` FOREIGN KEY (`driver_id`) REFERENCES `user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `transaction` +-- + +LOCK TABLES `transaction` WRITE; +/*!40000 ALTER TABLE `transaction` DISABLE KEYS */; +INSERT INTO `transaction` VALUES (1,1,2,'Tubagus Ismail','Cisitu',5,'Oke banget','2017-09-01'); +/*!40000 ALTER TABLE `transaction` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `user` -- @@ -53,11 +87,11 @@ CREATE TABLE `user` ( `name` varchar(20) NOT NULL, `email` varchar(20) NOT NULL, `password` varchar(20) NOT NULL, - `phone` int(11) NOT NULL, + `phone` varchar(12) NOT NULL, `isDriver` tinyint(1) NOT NULL, `image` varchar(20) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -66,7 +100,7 @@ CREATE TABLE `user` ( LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; -INSERT INTO `user` VALUES (1,'pikachu','Pikachu','pikachu@gmail.com','abc123',812345678,0,'pikachu.jpg'); +INSERT INTO `user` VALUES (1,'pikachu','Pikachu','pikachu@gmail.com','abc123','081812341234',0,'pikachu.jpg'),(2,'ratata','Ratata','ratata@gmail.com','12345678','081234563456',1,'ratata.png'); /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -79,4 +113,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2017-09-30 10:55:55 +-- Dump completed on 2017-09-30 11:50:40 diff --git a/js/dashboard.js b/js/dashboard.js new file mode 100644 index 0000000000000000000000000000000000000000..91c4c723b69c41b8327bcfcf2919a53713166835 --- /dev/null +++ b/js/dashboard.js @@ -0,0 +1,24 @@ +function order_clicked() { + document.getElementById('history').classList.remove('selected'); + document.getElementsByClassName('history-wrapper')[0].style.display = 'none'; + document.getElementById('profile').classList.remove('selected'); + document.getElementsByClassName('profile-wrapper')[0].style.display = 'none'; + document.getElementById('order').classList.add('selected'); + document.getElementsByClassName('order-wrapper')[0].style.display = 'block'; +} +function history_clicked() { + document.getElementById('profile').classList.remove('selected'); + document.getElementsByClassName('profile-wrapper')[0].style.display = 'none'; + document.getElementById('order').classList.remove('selected'); + document.getElementsByClassName('order-wrapper')[0].style.display = 'none'; + document.getElementById('history').classList.add('selected'); + document.getElementsByClassName('history-wrapper')[0].style.display = 'block'; +} +function profile_clicked() { + document.getElementById('history').classList.remove('selected'); + document.getElementsByClassName('history-wrapper')[0].style.display = 'none'; + document.getElementById('order').classList.remove('selected'); + document.getElementsByClassName('order-wrapper')[0].style.display = 'none'; + document.getElementById('profile').classList.add('selected'); + document.getElementsByClassName('profile-wrapper')[0].style.display = 'block'; +} \ No newline at end of file diff --git a/js/profile.js b/js/profile.js index 598f8fad8d7ac21f3f0d02ed762dcf019c19f02b..5f4c2ba1ef2bccd998507d0a2efe93ce27f92f57 100644 --- a/js/profile.js +++ b/js/profile.js @@ -3,7 +3,6 @@ function getUserProfile(){ xmlhttp.onreadystatechange = function () { if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ var result = xmlhttp.responseXML; - console.log(result); var username = result.getElementsByTagName('username')[0].childNodes[0].nodeValue; var name = result.getElementsByTagName('name')[0].childNodes[0].nodeValue; var email = result.getElementsByTagName('email')[0].childNodes[0].nodeValue; diff --git a/view/dashboard.php b/view/dashboard.php index d66bca8ae798d301094e66affb233906c7a0f874..f151a5b5a21253fae1a2d1deedd0beeed9d01a3b 100644 --- a/view/dashboard.php +++ b/view/dashboard.php @@ -3,7 +3,9 @@ <title>User Dashboard</title> <link href="../css/primary.css" type="text/css" rel="stylesheet" /> <link href="../css/dashboard.css" type="text/css" rel="stylesheet" /> + <script src="../js/dashboard.js"></script> <script src="../js/profile.js"></script> + <script src="../js/history.js"></script> </head> <body> <div class="container"> @@ -15,33 +17,46 @@ </div> </div> <div class="menu"> - <button class="submenu" id="order">ORDER</button> - <button class="submenu" id="history">HISTORY</button> - <button class="submenu selected" id="profile" onclick="getUserProfile()">PROFILE</button> - </div> - <div class="sub-header"> - <div class="sub-header-heading"><h1>MY PROFILE</h1></div> - <div class="edit-icon"><img src="../img/pencil.png" /></div> - </div> - <div class="user-profile"> - <div id="user-image"></div> - <h1 id="profile-username"></h1> - <div id="name"></div> - <div id="driver-stats"></div> - <img src="../img/mail.png" /><div id="email"></div><br /> - <img src="../img/phone.png" /><div id="phone"></div><br /> - </div> - <div class="sub-header"> - <div class="sub-header-heading"><h1>PREFERRED LOCATION</h1></div> - <div class="edit-icon"><img src="../img/pencil.png" /></div> - </div> - <div class="user-location"> - <ul type="square" id="user-location"> - <li>a</li> - <li>b</li> - <li>c</li> - </ul> + <button class="submenu" id="order" onclick="order_clicked()">ORDER</button> + <button class="submenu" id="history" onclick="history_clicked()">HISTORY</button> + <button class="submenu selected" id="profile" onclick="getUserProfile(); profile_clicked();">PROFILE</button> </div> + + <section class="order-wrapper"> + </section> + + <section class="history-wrapper"> + <div id="content"></div> + <button onclick="getAllTransaction()">get transaction</button> + </section> + + <section class="profile-wrapper"> + <div class="sub-header"> + <div class="sub-header-heading"><h1>MY PROFILE</h1></div> + <div class="edit-icon"><img src="../img/pencil.png" /></div> + </div> + <div class="user-profile"> + <div id="user-image"></div> + <h1 id="profile-username"></h1> + <div id="name"></div> + <div id="driver-stats"></div> + <img src="../img/mail.png" /><div id="email"></div><br /> + <img src="../img/phone.png" /><div id="phone"></div><br /> + </div> + <div class="sub-header"> + <div class="sub-header-heading"><h1>PREFERRED LOCATION</h1></div> + <div class="edit-icon"><img src="../img/pencil.png" /></div> + </div> + <div class="user-location"> + <ul type="square" id="user-location"> + <li>a</li> + <li>b</li> + <li>c</li> + </ul> + </div> + </section> + + </div> </body>