|
|
|
@ -30,7 +30,7 @@ function getStartPage(){
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
window.location.href = 'index.html' |
|
|
|
|
window.location.href = 'login.html' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
@ -85,7 +85,7 @@ function getUser(status){
|
|
|
|
|
token = sessionStorage.getItem("token") |
|
|
|
|
var searchText = '' |
|
|
|
|
if (status === 'search'){ |
|
|
|
|
console.log("search") |
|
|
|
|
// console.log("search")
|
|
|
|
|
dataInstrument = [] |
|
|
|
|
searchText = '&search='+document.getElementById("searchId").value |
|
|
|
|
start = 0 |
|
|
|
@ -94,12 +94,12 @@ function getUser(status){
|
|
|
|
|
htmlText = ''; |
|
|
|
|
modalText = ''; |
|
|
|
|
dataInstrument = []; |
|
|
|
|
console.log(' >> end of search button'); |
|
|
|
|
console.log(dataInstrument) |
|
|
|
|
console.log($('#card').html()); |
|
|
|
|
// 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) |
|
|
|
|
// console.log('url = ' + url)
|
|
|
|
|
$.ajax({ |
|
|
|
|
type: "GET", |
|
|
|
|
url: url,
|
|
|
|
@ -120,7 +120,7 @@ function getUser(status){
|
|
|
|
|
function getDataStat(respone){ |
|
|
|
|
getUser('first'); |
|
|
|
|
// console.log(respone)
|
|
|
|
|
document.getElementById("like").innerHTML = '0' |
|
|
|
|
document.getElementById("like").innerHTML = respone.items.completed |
|
|
|
|
document.getElementById("status").innerHTML = '+'+respone.items.recent_update
|
|
|
|
|
document.getElementById("accountActive").innerHTML = respone.users.active |
|
|
|
|
document.getElementById("numAll").innerHTML = respone.items.all |
|
|
|
@ -129,7 +129,9 @@ function getDataStat(respone){
|
|
|
|
|
|
|
|
|
|
function getData(respone) { |
|
|
|
|
// console.log(dataInstrument)
|
|
|
|
|
// console.log(respone)
|
|
|
|
|
console.log(respone) |
|
|
|
|
console.log("---------------- Next") |
|
|
|
|
console.log(respone.next)
|
|
|
|
|
// console.log(respone.results)
|
|
|
|
|
console.log(dataInstrument)
|
|
|
|
|
dataInstrument = dataInstrument.concat(respone.results) |
|
|
|
@ -139,15 +141,31 @@ function getData(respone) {
|
|
|
|
|
var modalText = '' |
|
|
|
|
|
|
|
|
|
for (i=start;i<dataInstrument.length;i++ ){ |
|
|
|
|
console.log('========='+i+'==========') |
|
|
|
|
// console.log('========='+i+'==========')
|
|
|
|
|
// console.log(dataInstrument[i].name)
|
|
|
|
|
var imageInstrument = '' |
|
|
|
|
if (dataInstrument[i].clips.length != 0) { |
|
|
|
|
var cover_img = getCoverImg(dataInstrument[i].clips); |
|
|
|
|
imageInstrument = '<div class="box-left">' |
|
|
|
|
+'<img src="'+cover_img+'" class="cover-img">' |
|
|
|
|
+'</div>' |
|
|
|
|
} |
|
|
|
|
htmlText = htmlText+"<div id='"+i.toString()+"'' class='cardStyle' onclick='modalItem("+i.toString()+")'>" |
|
|
|
|
// Author :: Apirak
|
|
|
|
|
+ imageInstrument |
|
|
|
|
// end of left
|
|
|
|
|
+'<div class="box-right">' |
|
|
|
|
+'<h3 style="font-size:26px;margin-left:20px " >'+dataInstrument[i].name+'</h3>' |
|
|
|
|
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >#'+dataInstrument[i].custom_id+'</h3>' |
|
|
|
|
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >@'+dataInstrument[i].caretaker+'</h3>' |
|
|
|
|
+'</div>'// end of right
|
|
|
|
|
// End
|
|
|
|
|
+'</div>'; |
|
|
|
|
|
|
|
|
|
// console.log(dataInstrument[i].clips.length)
|
|
|
|
|
var backup = dataInstrument[i].clips; |
|
|
|
|
dataInstrument[i].clips = addNullData(dataInstrument[i].clips); |
|
|
|
|
if(dataInstrument[i].clips.length === 0){ |
|
|
|
|
// console.log('========= = 0 =========')
|
|
|
|
|
imageTag = '<div class="flexCenter">' |
|
|
|
|
+'<div class="flexCenter bgImage">' |
|
|
|
|
+'<div class="flexCenter">' |
|
|
|
@ -171,43 +189,50 @@ function getData(respone) {
|
|
|
|
|
+'</div>' |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
if(dataInstrument[i].clips.length > 1){ |
|
|
|
|
var style4 = '' |
|
|
|
|
if(dataInstrument[i].clips.length >= 2){ |
|
|
|
|
// console.log('*********** >= 2 ***********')
|
|
|
|
|
var tagMiniImage = '' |
|
|
|
|
var loopImage = dataInstrument[i].clips.length |
|
|
|
|
var style4 = '' |
|
|
|
|
for(j=1;j<loopImage-1;j++){ |
|
|
|
|
if (loopImage > 4){ |
|
|
|
|
loopImage = 4 |
|
|
|
|
} |
|
|
|
|
for(j=1;j<loopImage;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="'+dataInstrument[i].clips[j].photo+'" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" ></h6>'; |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="'+dataInstrument[i].clips[j].photo+'" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" >ไม่มีรูปภาพ</h6>'; |
|
|
|
|
} |
|
|
|
|
for(j=loopImage-1;j<3;j++){ |
|
|
|
|
for(j=loopImage;j<4;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="" alt=""/>' |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" >ไม่มีรูปภาพ</h6>'; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
// console.log('*********** < 2 ***********')
|
|
|
|
|
var tagMiniImage = '' |
|
|
|
|
for(j=1;j<4;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="" alt=""/>' |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" >ไม่มีรูปภาพ</h6>'; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(dataInstrument) |
|
|
|
|
|
|
|
|
|
imageTag = '<div class="flexCenter">' |
|
|
|
|
+'<div class="flexCenter bgImage">' |
|
|
|
|
+'<div class="flexCenter">' |
|
|
|
|
+'<img id="myImg0'+i+'" src="'+dataInstrument[i].clips[0].photo+'" alt=""/>' |
|
|
|
|
+'<div class="bgImage flexCenter"><h2></h2></div>' |
|
|
|
|
+'<div class="bgImage flexCenter"><h2>ไม่มีรูปภาพ</h2></div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'<div class="column bgMiniImage" style="margin-left:10px">' |
|
|
|
|
+tagMiniImage |
|
|
|
@ -220,16 +245,18 @@ function getData(respone) {
|
|
|
|
|
+'<input type="file" name="upload" onclick="uploadImage('+i.toString()+')"/>' |
|
|
|
|
+'</div>'
|
|
|
|
|
} |
|
|
|
|
var youtube_tag = getYoutubeTag(dataInstrument[i].model,i); |
|
|
|
|
modalText = modalText+'<div id="modal'+i.toString()+'" class="modal" style="max-height: 100%;display: none;padding-top:10px;">' |
|
|
|
|
+'<div class="modal-content cardStyle" >' |
|
|
|
|
+imageTag |
|
|
|
|
+youtube_tag |
|
|
|
|
+'<div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">ชื่อครุภัณฑ์วิทยาศาสตร์</div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="name'+i+'" name="name'+i+'" placeholder="เลขครุภัณฑ์" value="'+dataInstrument[i].name+'"></div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="name'+i+'" name="name'+i+'" placeholder="ชื่อครุภัณฑ์วิทยาศาสตร์" value="'+dataInstrument[i].name+'"></div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'<div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">จุดประสงค์การใช้งาน</div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="note'+i+'" name="note'+i+'" placeholder="เลขครุภัณฑ์" value="'+dataInstrument[i].note+'"></div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">จุดประสงค์และลักษณะการใช้งาน</div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="note'+i+'" name="note'+i+'" placeholder="จุดประสงค์และลักษณะการใช้งาน" value="'+dataInstrument[i].note+'"></div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'<div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">เลขครุภัณฑ์</div>' |
|
|
|
@ -237,7 +264,11 @@ function getData(respone) {
|
|
|
|
|
+'</div>' |
|
|
|
|
+'<div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">ผู้ดูแล</div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="cr'+i+'" name="cr'+i+'" placeholder="เลขครุภัณฑ์" value="'+dataInstrument[i].caretaker+'"></div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="cr'+i+'" name="cr'+i+'" placeholder="ผู้ดูแล" value="'+dataInstrument[i].caretaker+'"></div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'<div>' |
|
|
|
|
+'<div style="font-size:20px;margin-top:20px">วีดีโอ(youtube)</div>' |
|
|
|
|
+'<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" id="yl'+i+'" name="yl'+i+'" placeholder="https://www.youtube.com/watch?v=xxxxx" value="'+dataInstrument[i].model+'"></div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'<div class="flexCenterSpace" style="margin-top:20px">' |
|
|
|
|
+'<input type="button" onclick="updateData('+i+')" class="buttonUpdate" value="Update">' |
|
|
|
@ -246,19 +277,67 @@ function getData(respone) {
|
|
|
|
|
+'</div>' |
|
|
|
|
+'</div>' |
|
|
|
|
+'</div>'; |
|
|
|
|
dataInstrument[i].clips = backup; |
|
|
|
|
} |
|
|
|
|
if(respone.next != null){ |
|
|
|
|
nextUrl = '' |
|
|
|
|
moreText = '' |
|
|
|
|
moreText = "<div class='cardStyle flexCenter' style='margin-bottom:10px;height:60px;background-color: #E0E0E0;' onClick='getNextUrl()'>" |
|
|
|
|
+"<h4>More</h4>" |
|
|
|
|
+"</div>"; |
|
|
|
|
nextUrl = respone.next |
|
|
|
|
document.getElementById("more").innerHTML = moreText; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
nextUrl = '' |
|
|
|
|
moreText = '' |
|
|
|
|
document.getElementById("more").innerHTML = moreText; |
|
|
|
|
} |
|
|
|
|
start = dataInstrument.length |
|
|
|
|
|
|
|
|
|
document.getElementById("modalAll").innerHTML = document.getElementById("modalAll").innerHTML+modalText |
|
|
|
|
document.getElementById("card").innerHTML = document.getElementById("card").innerHTML+htmlText |
|
|
|
|
|
|
|
|
|
/* Apirak */ |
|
|
|
|
$("img[id*='myImg']").each(function(){ |
|
|
|
|
var id = $(this).attr('id'); |
|
|
|
|
var order = id.substring(5,6); |
|
|
|
|
var idInstrument = id.substring(6,7); |
|
|
|
|
if(idInstrument == 'a'){idInstrument='add';} |
|
|
|
|
$("<a id='order"+order+"' class='btn-edit' onclick='uploadWithOrder("+order+",\""+idInstrument+"\")'>Edit</a>").insertAfter( $(this) ); |
|
|
|
|
$(this).parent().css({"position": "relative"}); |
|
|
|
|
$(this).css({"margin-top": "0px"}); |
|
|
|
|
}); |
|
|
|
|
$("iframe").each(function(){ |
|
|
|
|
var index = $(this).attr('id'); |
|
|
|
|
index = index.replace("youtube-",""); |
|
|
|
|
$("img#myImg0"+index).addClass("img-with-youtube"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function uploadWithOrder(order,idInstrument){ |
|
|
|
|
$("#modal"+idInstrument+" input[name='upload']").attr('order',order); |
|
|
|
|
$("#modal"+idInstrument+" input[name='upload']").click(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getYoutubeTag(link,index){ |
|
|
|
|
|
|
|
|
|
//https://www.youtube.com/watch?v=hYgTVD-bxOY
|
|
|
|
|
//http://www.youtube.com/v/hYgTVD-bxOY
|
|
|
|
|
link = link.replace("https","http"); |
|
|
|
|
link = link.replace("watch?v=","v/"); |
|
|
|
|
var youtube_tag = ''; |
|
|
|
|
if( youtube_tag.indexOf("http") < 0 ){return youtube_tag;} |
|
|
|
|
if(link != '') |
|
|
|
|
{ |
|
|
|
|
youtube_tag = '<iframe width="420" height="315" src="'+link+'" frameborder="0" class="youtube" id="youtube-'+index+'" allowfullscreen></iframe>'; |
|
|
|
|
$("iframe").css("margin-left","13%"); |
|
|
|
|
$("iframe").css("margin-top","-13%"); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
youtube_tag=""; |
|
|
|
|
} |
|
|
|
|
return youtube_tag; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getNextUrl(){ |
|
|
|
@ -277,6 +356,29 @@ function getNextUrl(){
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function addNullData(arr){ |
|
|
|
|
var temp_arr = [{content_type:'',id:'',object_id:'',order:'',photo:"",user:''}, |
|
|
|
|
{content_type:'',id:'',object_id:'',order:'',photo:"",user:''}, |
|
|
|
|
{content_type:'',id:'',object_id:'',order:'',photo:"",user:''}, |
|
|
|
|
{content_type:'',id:'',object_id:'',order:'',photo:"",user:''}]; |
|
|
|
|
$.each(arr,function(index,obj){ |
|
|
|
|
temp_arr[obj.order] = obj; |
|
|
|
|
}); |
|
|
|
|
return temp_arr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getCoverImg(arr){ |
|
|
|
|
var link=""; |
|
|
|
|
$.each(arr,function(index,obj){ |
|
|
|
|
|
|
|
|
|
if(obj.order == 0) |
|
|
|
|
{
|
|
|
|
|
link=obj.photo; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return link; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function modalItem(idCard){ |
|
|
|
|
var modal = document.getElementById('modal'+idCard); |
|
|
|
|
// console.log(modal)
|
|
|
|
@ -296,13 +398,16 @@ function modalItem(idCard){
|
|
|
|
|
|
|
|
|
|
function uploadImage(idImage) { |
|
|
|
|
var check = 0 |
|
|
|
|
var order = $("#modal"+idImage+" input[name='upload']").attr('order'); |
|
|
|
|
$(":file").change(function () { |
|
|
|
|
if (this.files && this.files[0] && check===0) { |
|
|
|
|
var reader = new FileReader(); |
|
|
|
|
console.log(reader) |
|
|
|
|
// console.log(reader)
|
|
|
|
|
reader.onload = function(e) { |
|
|
|
|
instrument = dataInstrument[parseInt(idImage)] |
|
|
|
|
var uriAdd = [{'uri':e.target.result}]; |
|
|
|
|
// console.log(instrument)
|
|
|
|
|
// console.log('-------------xxxx-------------')
|
|
|
|
|
var uriAdd = [{'uri':e.target.result,'order':parseInt(order)}]; |
|
|
|
|
dataUri = dataUri.concat(uriAdd); |
|
|
|
|
if(idImage == 'add'){ |
|
|
|
|
loopImage = 0 |
|
|
|
@ -310,24 +415,28 @@ function uploadImage(idImage) {
|
|
|
|
|
else{ |
|
|
|
|
var loopImage = instrument.clips.length |
|
|
|
|
for(idImg=0;idImg<loopImage;idImg++){ |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idData].clips[idImg].photo); |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(idImage) |
|
|
|
|
// console.log(idImage)
|
|
|
|
|
var dataUriSort = dataUri |
|
|
|
|
idloopImage = loopImage |
|
|
|
|
if(loopImage==0){ |
|
|
|
|
loopImage = 1 |
|
|
|
|
idloopImage = 0 |
|
|
|
|
} |
|
|
|
|
var idUri = 0 |
|
|
|
|
console.log(loopImage-1) |
|
|
|
|
for(idImg=loopImage-1;idImg<idloopImage+dataUri.length;idImg++){ |
|
|
|
|
// console.log(dataUri)
|
|
|
|
|
// console.log(loopImage-1)
|
|
|
|
|
// console.log(idloopImage+dataUri.length)
|
|
|
|
|
/*for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){ |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri); |
|
|
|
|
idUri += 1 |
|
|
|
|
} |
|
|
|
|
console.log('---------------------------') |
|
|
|
|
console.log(dataUri) |
|
|
|
|
}*/ |
|
|
|
|
$.each(dataUri,function(index,obj){ |
|
|
|
|
$('#myImg'+obj.order+''+idImage).attr('src', obj.uri); |
|
|
|
|
}); |
|
|
|
|
// console.log('---------------------------')
|
|
|
|
|
// console.log(dataUri)
|
|
|
|
|
check += 1 |
|
|
|
|
}; |
|
|
|
|
reader.readAsDataURL(this.files[0]);
|
|
|
|
@ -341,15 +450,18 @@ function addData(){
|
|
|
|
|
'name':document.getElementById("nameI").value, |
|
|
|
|
'organization': userData.organizations[0].id, |
|
|
|
|
} |
|
|
|
|
if(document.getElementById("noteI").value != ''){ |
|
|
|
|
data.caretaker = document.getElementById("idI").value |
|
|
|
|
if(document.getElementById("CrI").value != ''){ |
|
|
|
|
data.caretaker = document.getElementById("CrI").value |
|
|
|
|
} |
|
|
|
|
if(document.getElementById("noteI").value != ''){ |
|
|
|
|
data.instrument_id = document.getElementById("CrI").value |
|
|
|
|
if(document.getElementById("idI").value != ''){ |
|
|
|
|
data.instrument_id = document.getElementById("idI").value |
|
|
|
|
} |
|
|
|
|
if(document.getElementById("noteI").value != ''){ |
|
|
|
|
data.note = document.getElementById("noteI").value |
|
|
|
|
} |
|
|
|
|
if(document.getElementById("YlI").value != ''){ |
|
|
|
|
data.model = document.getElementById("YlI").value |
|
|
|
|
} |
|
|
|
|
if(dataUri.length != 0){ |
|
|
|
|
data.clips = dataUri |
|
|
|
|
} |
|
|
|
@ -367,7 +479,7 @@ function addData(){
|
|
|
|
|
'Authorization': 'Bearer ' + token, |
|
|
|
|
}, |
|
|
|
|
success: function(respone){ |
|
|
|
|
console.log(respone) |
|
|
|
|
// console.log(respone)
|
|
|
|
|
window.location.reload(true); |
|
|
|
|
}, |
|
|
|
|
dataType: 'json' |
|
|
|
@ -382,8 +494,9 @@ function updateData(idData){
|
|
|
|
|
dataUpdate = { |
|
|
|
|
'name':document.getElementById("name"+idData).value, |
|
|
|
|
'note':document.getElementById("note"+idData).value, |
|
|
|
|
'caretaker':document.getElementById("id"+idData).value, |
|
|
|
|
'instrument_id':document.getElementById("cr"+idData).value, |
|
|
|
|
'caretaker':document.getElementById("cr"+idData).value, |
|
|
|
|
'instrument_id':document.getElementById("id"+idData).value, |
|
|
|
|
'model':document.getElementById("yl"+idData).value, |
|
|
|
|
} |
|
|
|
|
if(dataUri.length != 0){ |
|
|
|
|
dataUpdate.clips = dataUri |
|
|
|
@ -399,7 +512,7 @@ function updateData(idData){
|
|
|
|
|
'Authorization': 'Bearer ' + token, |
|
|
|
|
}, |
|
|
|
|
success: function(respone){ |
|
|
|
|
console.log(respone) |
|
|
|
|
// console.log(respone)
|
|
|
|
|
window.location.reload(true); |
|
|
|
|
}, |
|
|
|
|
dataType: 'json' |
|
|
|
@ -420,7 +533,7 @@ function deleteData(idData){
|
|
|
|
|
'Authorization': 'Bearer ' + token, |
|
|
|
|
}, |
|
|
|
|
success: function(respone){ |
|
|
|
|
console.log(respone) |
|
|
|
|
// console.log(respone)
|
|
|
|
|
window.location.reload(true); |
|
|
|
|
}, |
|
|
|
|
dataType: 'json' |
|
|
|
@ -441,12 +554,18 @@ function removeImage(idData){
|
|
|
|
|
loopImage = 1 |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
var time = new Date() |
|
|
|
|
var loopImage = dataInstrument[idData].clips.length |
|
|
|
|
// console.log(dataInstrument[idData])
|
|
|
|
|
for(j=0;j<loopImage;j++){ |
|
|
|
|
$('#myImg'+j+''+idData).attr('src', loopImage[j]);
|
|
|
|
|
// console.log('#myImg'+j+''+idData)
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
for(j=loopImage-1;j<4;j++){ |
|
|
|
|
for(j=loopImage;j<4;j++){ |
|
|
|
|
$('#myImg'+j+''+idData).attr('src',''); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|