diff --git a/web/css/stdb.css b/web/css/stdb.css index c1fbe5f..9f24d85 100644 --- a/web/css/stdb.css +++ b/web/css/stdb.css @@ -116,6 +116,14 @@ img{ background-color: #FFF; border: 1px solid navy; } +.cardSearch{ + border-radius: 5px; + width: auto; + height: 40px; + margin-top: 5px; + background-color: #F0F0F0; + border: 1px solid navy; +} .cardAdd{ width: auto; background-color:unset; @@ -194,4 +202,13 @@ img{ .addStyle{ position: fixed; +} +.buttonSearch{ + background-color: #263238; + color:#000; + width: 80px; + height: 40px; + border-radius: 5px; + border: 0px; + } \ No newline at end of file diff --git a/web/js/stdb.js b/web/js/stdb.js index db35479..790fb49 100644 --- a/web/js/stdb.js +++ b/web/js/stdb.js @@ -64,7 +64,7 @@ function getStat(){ } } -function getUser(){ +function getUser(status){ token = sessionStorage.getItem("token") // console.log(token) // console.log('======== 2 ======') @@ -80,11 +80,29 @@ function getUser(){ // console.log(respone) userData = respone organ = '
'+respone.organizations[0].name+'
' + document.getElementById("nameOrgan").innerHTML = organ token = sessionStorage.getItem("token") + var searchText = '' + if (status === 'search'){ + console.log("search") + dataInstrument = [] + searchText = '&search='+document.getElementById("searchId").value + start = 0 + $('#modalAll').html(''); + $('#card').html(""); + htmlText = ''; + modalText = ''; + dataInstrument = []; + console.log(' >> end of search button'); + console.log(dataInstrument) + console.log($('#card').html()); + } + var url = 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id+searchText; + console.log('url = ' + url) $.ajax({ type: "GET", - url: 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id, + url: url, headers :{ Authorization: 'Bearer '+ token, Accept: 'application/json, text/javascript', @@ -100,7 +118,7 @@ function getUser(){ } function getDataStat(respone){ - getUser(); + getUser('first'); // console.log(respone) document.getElementById("like").innerHTML = '0' document.getElementById("status").innerHTML = '+'+respone.items.recent_update @@ -113,17 +131,20 @@ function getData(respone) { // console.log(dataInstrument) // console.log(respone) // console.log(respone.results) - dataInstrument = dataInstrument.concat(respone.results) - // console.log('****************') console.log(dataInstrument) - var cardText = '' + dataInstrument = dataInstrument.concat(respone.results) + console.log('*******ฬฬฬฬฬฬฬฬฬ*********') + console.log(respone.results) + var htmlText = '' var modalText = '' + for (i=start;i" +'

'+dataInstrument[i].name+'

' +'

#'+dataInstrument[i].custom_id+'

' - +'

@'+dataInstrument[i].location+'

' + +'

@'+dataInstrument[i].caretaker+'

' +''; if(dataInstrument[i].clips.length === 0){ @@ -198,33 +219,33 @@ function getData(respone) { +'Upload' +'' +'' - } - modalText = modalText+'