Browse Source

0.0.7.30.6

master
racha.non 9 years ago
parent
commit
0890729679
  1. 2
      css/stdb.css
  2. 52
      js/stdb.js
  3. 4
      stat.html

2
css/stdb.css

@ -68,7 +68,7 @@ img{
width: 100%; width: 100%;
color:#FFF; color:#FFF;
font-size:30px; font-size:30px;
z-index:10; z-index:1;
} }
.container{ .container{
margin-right: auto; margin-right: auto;

52
js/stdb.js

@ -85,7 +85,7 @@ function getUser(status){
token = sessionStorage.getItem("token") token = sessionStorage.getItem("token")
var searchText = '' var searchText = ''
if (status === 'search'){ if (status === 'search'){
console.log("search") // console.log("search")
dataInstrument = [] dataInstrument = []
searchText = '&search='+document.getElementById("searchId").value searchText = '&search='+document.getElementById("searchId").value
start = 0 start = 0
@ -94,12 +94,12 @@ function getUser(status){
htmlText = ''; htmlText = '';
modalText = ''; modalText = '';
dataInstrument = []; dataInstrument = [];
console.log(' >> end of search button'); // console.log(' >> end of search button');
console.log(dataInstrument) // console.log(dataInstrument)
console.log($('#card').html()); // console.log($('#card').html());
} }
var url = 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id+searchText; var url = 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id+searchText;
console.log('url = ' + url) // console.log('url = ' + url)
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
@ -141,7 +141,7 @@ function getData(respone) {
var modalText = '' var modalText = ''
for (i=start;i<dataInstrument.length;i++ ){ for (i=start;i<dataInstrument.length;i++ ){
console.log('========='+i+'==========') // console.log('========='+i+'==========')
// console.log(dataInstrument[i].name) // console.log(dataInstrument[i].name)
var imageInstrument = '' var imageInstrument = ''
if (dataInstrument[i].clips.length != 0) { if (dataInstrument[i].clips.length != 0) {
@ -160,9 +160,9 @@ function getData(respone) {
+'</div>'// end of right +'</div>'// end of right
// End // End
+'</div>'; +'</div>';
console.log(dataInstrument[i].clips.length) // console.log(dataInstrument[i].clips.length)
if(dataInstrument[i].clips.length === 0){ if(dataInstrument[i].clips.length === 0){
console.log('========= = 0 =========') // console.log('========= = 0 =========')
imageTag = '<div class="flexCenter">' imageTag = '<div class="flexCenter">'
+'<div class="flexCenter bgImage">' +'<div class="flexCenter bgImage">'
+'<div class="flexCenter">' +'<div class="flexCenter">'
@ -188,7 +188,7 @@ function getData(respone) {
else{ else{
var style4 = '' var style4 = ''
if(dataInstrument[i].clips.length >= 2){ if(dataInstrument[i].clips.length >= 2){
console.log('*********** >= 2 ***********') // console.log('*********** >= 2 ***********')
var tagMiniImage = '' var tagMiniImage = ''
var loopImage = dataInstrument[i].clips.length var loopImage = dataInstrument[i].clips.length
if (loopImage > 4){ if (loopImage > 4){
@ -212,7 +212,7 @@ function getData(respone) {
} }
} }
else{ else{
console.log('*********** < 2 ***********') // console.log('*********** < 2 ***********')
var tagMiniImage = '' var tagMiniImage = ''
for(j=1;j<4;j++){ for(j=1;j<4;j++){
if (j==3){ if (j==3){
@ -328,11 +328,11 @@ function uploadImage(idImage) {
$(":file").change(function () { $(":file").change(function () {
if (this.files && this.files[0] && check===0) { if (this.files && this.files[0] && check===0) {
var reader = new FileReader(); var reader = new FileReader();
console.log(reader) // console.log(reader)
reader.onload = function(e) { reader.onload = function(e) {
instrument = dataInstrument[parseInt(idImage)] instrument = dataInstrument[parseInt(idImage)]
console.log(instrument) // console.log(instrument)
console.log('-------------xxxx-------------') // console.log('-------------xxxx-------------')
var uriAdd = [{'uri':e.target.result}]; var uriAdd = [{'uri':e.target.result}];
dataUri = dataUri.concat(uriAdd); dataUri = dataUri.concat(uriAdd);
if(idImage == 'add'){ if(idImage == 'add'){
@ -344,22 +344,22 @@ function uploadImage(idImage) {
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo); $('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo);
} }
} }
console.log(idImage) // console.log(idImage)
var dataUriSort = dataUri var dataUriSort = dataUri
idloopImage = loopImage idloopImage = loopImage
if(loopImage==0){ if(loopImage==0){
idloopImage = 0 idloopImage = 0
} }
var idUri = 0 var idUri = 0
console.log(dataUri) // console.log(dataUri)
console.log(loopImage-1) // console.log(loopImage-1)
console.log(idloopImage+dataUri.length) // console.log(idloopImage+dataUri.length)
for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){ for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){
$('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri); $('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri);
idUri += 1 idUri += 1
} }
console.log('---------------------------') // console.log('---------------------------')
console.log(dataUri) // console.log(dataUri)
check += 1 check += 1
}; };
reader.readAsDataURL(this.files[0]); reader.readAsDataURL(this.files[0]);
@ -399,7 +399,7 @@ function addData(){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -431,7 +431,7 @@ function updateData(idData){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -452,7 +452,7 @@ function deleteData(idData){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -475,12 +475,12 @@ function removeImage(idData){
else{ else{
var time = new Date() var time = new Date()
var loopImage = dataInstrument[idData].clips.length var loopImage = dataInstrument[idData].clips.length
console.log(dataInstrument[idData]) // console.log(dataInstrument[idData])
for(j=0;j<loopImage;j++){ for(j=0;j<loopImage;j++){
console.log('#myImg'+j+''+idData) // console.log('#myImg'+j+''+idData)
document.getElementById("myImg"+j+''+idData).src = dataInstrument[idData].clips[j].photo+'?'+time; document.getElementById("myImg"+j+''+idData).src = dataInstrument[idData].clips[j].photo+'?'+time;
console.log(document.getElementById("myImg"+j+''+idData).src) // console.log(document.getElementById("myImg"+j+''+idData).src)
console.log(document.getElementById("myImg"+j+''+idData)) // console.log(document.getElementById("myImg"+j+''+idData))
} }
} }

4
stat.html

@ -68,7 +68,7 @@
<script language="javascript"> <script language="javascript">
function getStatAll(){ function getStatAll(){
urlStat = 'http://expert.traffy.xyz/api/v2/organization/stats/' urlStat = 'http://expert.traffy.xyz/api/v2/organization/stats/'
console.log(urlStat) // console.log(urlStat)
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: urlStat, url: urlStat,
@ -78,7 +78,7 @@
} }
function getData(respone){ function getData(respone){
console.log(respone) // console.log(respone)
var htmlText = '' var htmlText = ''
for (i=0;i<respone.length;i++ ){ for (i=0;i<respone.length;i++ ){
htmlText = htmlText+"<div class='cardStyle' style='width:800px;height:200px'>" htmlText = htmlText+"<div class='cardStyle' style='width:800px;height:200px'>"

Loading…
Cancel
Save