diff --git a/KAA-JSP/build/web/catalog.jsp b/KAA-JSP/build/web/catalog.jsp index de004adf246654b2290fdbb5843eaa4e6a0a4c44..604e7be95fa2012001bad979e21691896d3bd703 100644 --- a/KAA-JSP/build/web/catalog.jsp +++ b/KAA-JSP/build/web/catalog.jsp @@ -407,9 +407,16 @@ <div class="popup-head-right" ng-click="setReceiver('')"><a href="">✕</a></div> <div style="clear: both"></div> </div> - <div class="popup-messages">Tes</div> + <div class="popup-messages"> + <ul> + <li ng-repeat="message in messages" style="list-style-type:none"> + <div class="chatbubble" ng-if="message.name===receiver" style="float:left">{{message.text}}</div> + <div class="chatbubble" ng-if="message.name===user" style="float:right">{{message.text}}</div> + </li> + </div> <div class="popup-input"> - <input type="text" style="height: 100%" name="chat" class="auto-style1" hidefocus="hidefocus" /> + <input type="text" style="height: 100%; width:80%" name="chat" class="auto-style1" hidefocus="hidefocus" ng-model="newmessage"/> + <button ng-click="sendMessage()">Send</button> </div> </div> diff --git a/KAA-JSP/build/web/css/style.css b/KAA-JSP/build/web/css/style.css index b9ac050343e238a609c528ef23c3a5a4f26856c4..56b269fb3a26a4df0fb018b8a7346bd68258852b 100644 --- a/KAA-JSP/build/web/css/style.css +++ b/KAA-JSP/build/web/css/style.css @@ -6,6 +6,12 @@ } } +.chatbubble{ + width:70%; + border:2px; + +} + .popup-box { display: none; diff --git a/KAA-JSP/build/web/login.jsp b/KAA-JSP/build/web/login.jsp index 2db4b934eb10a7a5be792e56c3153c93ff3963e1..c29577b374c28a081ffc749aef016bcc5b850233 100644 --- a/KAA-JSP/build/web/login.jsp +++ b/KAA-JSP/build/web/login.jsp @@ -49,7 +49,7 @@ <title>Sale Project - Login</title> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> - <body> + <body onload="getChatToken()"> <div class="content"> <div class="logo"> <span id="red">Sale</span><span id="blue">Project</span> @@ -66,7 +66,7 @@ <div class="input_field"> Password<br><input type="password" name="password"><br> </div> - <input type="hidden" name="chattoken" id="chattoken" value="getChatToken()"> + <input type="hidden" name="chattoken" id="chattoken" value=""> <div class="submit_button_add"> <input type="submit" name ="submit" value="LOGIN"> </div> @@ -168,11 +168,10 @@ console.log(chattoken); - var getChatToken=function(){ - return chattoken; - }; - - document.getElementById("chattoken").value = chattoken; + var getChatToken=function(){ + console.log(chattoken); + document.getElementById("chattoken").value = chattoken; + }; </script> </body> </html> diff --git a/KAA-JSP/build/web/scripts/app.js b/KAA-JSP/build/web/scripts/app.js index 3698a5f52fe5e47b4f2527562c85a5932228f51c..bed643362b6b79889f8fd78115e49bb52a02df16 100644 --- a/KAA-JSP/build/web/scripts/app.js +++ b/KAA-JSP/build/web/scripts/app.js @@ -8,11 +8,11 @@ var app = angular.module('chatApp', []); app.controller('chatController', ['$scope','Message', function($scope,Message){ - $scope.user = "testst"; + $scope.user = "a"; $scope.receiver = ""; - $scope.messages= ""; + $scope.messages= Message.all; $scope.insert = function(message){ //Message.create(message); @@ -30,6 +30,11 @@ app.controller('chatController', ['$scope','Message', function($scope,Message){ return !($scope.receiver === ""); }; + $scope.sendMessage = function(){ + //kirim post/get request ke sendmessage + + }; + var config = { apiKey: "AIzaSyAQ2WIB6GWOxmtwMdGd8eHawL4PWxK8evU", authDomain: "tugas-besar-wbd.firebaseapp.com", @@ -58,11 +63,23 @@ app.controller('chatController', ['$scope','Message', function($scope,Message){ app.factory('Message', function() { var messages = [{'name':'Pippo','text':'Hello'}, - {'name':'Pluto','text':'Hello'}, - {'name':'Pippo','text':'how are you ?'}, - {'name':'Pluto','text':'fine thanks'}, - {'name':'Pippo','text':'Bye'}, - {'name':'Pluto','text':'Bye'}]; + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}, + {'name':'Pippo','text':'Hello'}, + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}, + {'name':'Pippo','text':'Hello'}, + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}]; var Message= { all:messages diff --git a/KAA-JSP/web/catalog.jsp b/KAA-JSP/web/catalog.jsp index de004adf246654b2290fdbb5843eaa4e6a0a4c44..604e7be95fa2012001bad979e21691896d3bd703 100644 --- a/KAA-JSP/web/catalog.jsp +++ b/KAA-JSP/web/catalog.jsp @@ -407,9 +407,16 @@ <div class="popup-head-right" ng-click="setReceiver('')"><a href="">✕</a></div> <div style="clear: both"></div> </div> - <div class="popup-messages">Tes</div> + <div class="popup-messages"> + <ul> + <li ng-repeat="message in messages" style="list-style-type:none"> + <div class="chatbubble" ng-if="message.name===receiver" style="float:left">{{message.text}}</div> + <div class="chatbubble" ng-if="message.name===user" style="float:right">{{message.text}}</div> + </li> + </div> <div class="popup-input"> - <input type="text" style="height: 100%" name="chat" class="auto-style1" hidefocus="hidefocus" /> + <input type="text" style="height: 100%; width:80%" name="chat" class="auto-style1" hidefocus="hidefocus" ng-model="newmessage"/> + <button ng-click="sendMessage()">Send</button> </div> </div> diff --git a/KAA-JSP/web/css/style.css b/KAA-JSP/web/css/style.css index b9ac050343e238a609c528ef23c3a5a4f26856c4..56b269fb3a26a4df0fb018b8a7346bd68258852b 100644 --- a/KAA-JSP/web/css/style.css +++ b/KAA-JSP/web/css/style.css @@ -6,6 +6,12 @@ } } +.chatbubble{ + width:70%; + border:2px; + +} + .popup-box { display: none; diff --git a/KAA-JSP/web/login.jsp b/KAA-JSP/web/login.jsp index 2db4b934eb10a7a5be792e56c3153c93ff3963e1..c29577b374c28a081ffc749aef016bcc5b850233 100644 --- a/KAA-JSP/web/login.jsp +++ b/KAA-JSP/web/login.jsp @@ -49,7 +49,7 @@ <title>Sale Project - Login</title> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> - <body> + <body onload="getChatToken()"> <div class="content"> <div class="logo"> <span id="red">Sale</span><span id="blue">Project</span> @@ -66,7 +66,7 @@ <div class="input_field"> Password<br><input type="password" name="password"><br> </div> - <input type="hidden" name="chattoken" id="chattoken" value="getChatToken()"> + <input type="hidden" name="chattoken" id="chattoken" value=""> <div class="submit_button_add"> <input type="submit" name ="submit" value="LOGIN"> </div> @@ -168,11 +168,10 @@ console.log(chattoken); - var getChatToken=function(){ - return chattoken; - }; - - document.getElementById("chattoken").value = chattoken; + var getChatToken=function(){ + console.log(chattoken); + document.getElementById("chattoken").value = chattoken; + }; </script> </body> </html> diff --git a/KAA-JSP/web/scripts/app.js b/KAA-JSP/web/scripts/app.js index 3698a5f52fe5e47b4f2527562c85a5932228f51c..bed643362b6b79889f8fd78115e49bb52a02df16 100644 --- a/KAA-JSP/web/scripts/app.js +++ b/KAA-JSP/web/scripts/app.js @@ -8,11 +8,11 @@ var app = angular.module('chatApp', []); app.controller('chatController', ['$scope','Message', function($scope,Message){ - $scope.user = "testst"; + $scope.user = "a"; $scope.receiver = ""; - $scope.messages= ""; + $scope.messages= Message.all; $scope.insert = function(message){ //Message.create(message); @@ -30,6 +30,11 @@ app.controller('chatController', ['$scope','Message', function($scope,Message){ return !($scope.receiver === ""); }; + $scope.sendMessage = function(){ + //kirim post/get request ke sendmessage + + }; + var config = { apiKey: "AIzaSyAQ2WIB6GWOxmtwMdGd8eHawL4PWxK8evU", authDomain: "tugas-besar-wbd.firebaseapp.com", @@ -58,11 +63,23 @@ app.controller('chatController', ['$scope','Message', function($scope,Message){ app.factory('Message', function() { var messages = [{'name':'Pippo','text':'Hello'}, - {'name':'Pluto','text':'Hello'}, - {'name':'Pippo','text':'how are you ?'}, - {'name':'Pluto','text':'fine thanks'}, - {'name':'Pippo','text':'Bye'}, - {'name':'Pluto','text':'Bye'}]; + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}, + {'name':'Pippo','text':'Hello'}, + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}, + {'name':'Pippo','text':'Hello'}, + {'name':'a','text':'Hello'}, + {'name':'azkaimtiyaz','text':'how are you ?'}, + {'name':'a','text':'fine thanks'}, + {'name':'a','text':'Bye'}, + {'name':'azkaimtiyaz','text':'Bye'}]; var Message= { all:messages