The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by PSN Chanel, 2023-09-06 02:55:47

คู่มือ Line Hackathon27

คู่มือ Line Hackathon27

}, endQuiz: function(){ this.start = false this.submitting = true clearInterval(this.countDown) let totalScore = 0 let tempArray this.selectedQuestions.forEach((q)=>{ if (typeof(q.selected) !== "object"){ tempArray = [q.selected] }else{ tempArray = [... q.selected] } if (tempArray.join() == q.corrects.join()){ console.log(true) q.correct = true totalScore += q.point }else{ console.log(false) q.correct = false } q.disabled = true }) let result = [this.email,totalScore] google.script.run .withSuccessHandler(function(){


this.submitting = false this.message = { type: "Confirmation", message: `ขอบคุณ , ${this.email}, คุณทำคะแแนได ${totalScore}.ขอที่ไมถูกตองจะถูกเนนดวยสีแดง` } this.emails = [...this.emails, this.email] this.email = "" }.bind(this)) .withFailureHandler(function(e){ this.submitting = false this.message = { type: "Error", message: e.message } }.bind(this)) .saveData(result) }, closeMessageBox: function(){ this.message = null } } google.script.run .withSuccessHandler(function(appData){ data.config = appData.config data.questions = appData.questions data.emails = appData.emails


new Vue({ el: "#app", data, computed, methods }) }) .getData() </script> Css.html <style> #app .message { width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; padding: 0px; margin: 0px; z-index: 99; background: rgba(255, 255, 255, 0.6); display: -webkit-box; display: -ms-flexbox; display: flex;


-webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } #app .message > div { max-width: 500px; min-width: 300px; background: #fff; } #app header, #app footer { } #app header{ position: fixed; width: 100%; top: 0px; left: 0px; z-index: 88; }


#app main { display: -ms-grid; display: grid; -ms-grid-columns: 1fr; grid-template-columns: 1fr; grid-gap: 16px; padding: 16px 0px; margin-top: 70px; } #app main table { width: 100%; } #app main td { text-align: center; } #app main td div { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } [v-cloak],


.loading{ width: 100%; height: 100%; background: rgba(255, 255, 255, 0.7); position: fixed; display: block; } [v-cloak] * { display: none; } [v-cloak]::before, .loading::before{ content: ''; width: 4em; height: 4em; border: 5px solid #eee; border-top-color: #4CAF50; position: absolute; border-radius: 50%; left: 50%; top: 50%; margin-top: -2em; margin-left: -2em; -webkit-animation: spin 1s linear infinite; animation: spin 1s linear infinite; }


@-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes spin { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @media screen and (max-width: 750px) { #app header{ position: relative; }


#app main{ margin: 0px; } } /*# sourceMappingURL=style.css.map */ </style> Sidebar.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <!-- <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css"> --> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-green.css"> <?!= include("css") ?> </head> <body> <div id="app" v-cloak>


<form @submit.prevent="submit" class="w3-panel"> <label for="quiz-count">จำนวนขอ</label> <input class="w3-input w3-margin-bottom" id="quiz-count" name="quiz-count" v-model="config.count" type="number" min=1 max=50 placeholder="Between 1 and 50" required > <label for="quiz-time">เวลาทำแบบทดสอบ <span class="w3-small">(min)</span></label> <input class="w3-input w3-margin-bottom" id="quiz-time" name="quiz-count" v-model="config.time" type="number" min=1 max=120 placeholder="Between 1 and 120 minutes" required > <input type="submit" class="w3-button w3-theme w3-round" value="Save"> <p class="w3-small w3-text-theme">{{message}}</p>


</form> </div> <script> let data = { title: "Quiz Sheet App", submitting: false, message: "", config: { count: 10, time: 30, } } let methods = { submit: function(){ this.message = "Saving..." this.submitting = true google.script.run .withSuccessHandler(function(){ this.message = "Configuration saved." }.bind(this)) .withFailureHandler(function(e){ this.message = e.message }) .saveConfiguration(this.config) this.submitting = false }


} google.script.run .withSuccessHandler(function(config){ data.config = config data.message = "Configuration loaded." new Vue({ el: "#app", data, methods }) }) .withFailureHandler(function(e){ }) .loadConfiguration() </script> </body> </html>


Line Hackathon27 ระบบตรวจสอบผลคะแนน แสดงผลผาน line Hackathon27 Code


Code.gs var CHANNEL_ACCESS_TOKEN = 'evB1SLCTmIrLqNXrxtnvJPm8cN7BodDODBRAYcjNK7ZcT2mhkNrO2Hm8KDe7PUoYMVZI30lU0uRfV1tGpOpeH+ d0nunif4n9dVFwnEhD20foP64OHgjfzRJWatdw1vlQoDxOxGpd222qZzd/cjyZgAdB04t89/1O/w1cDnyilFU='; var line_endpoint = 'https://api.line.me/v2/bot/message/reply'; function doGet(request) { return ContentService.createTextOutput(JSON.stringify({ post: "ok" })).setMimeType(ContentService.MimeType.JSON); } var ws = SpreadsheetApp.openById('16_hmVgiMJuYpfHL7z6HnCX_YFK-5Oys1klVYUATnnO4') //**********ID Sheet*******// var sheet = ws.getSheetByName("Line"); //*****************ชื่อแผนงาน*****************************// var data = sheet.getRange(2, 1, sheet.getLastRow(), sheet.getLastColumn()).getDisplayValues(); //Logger.log(data) function replyMsg(replyToken, mess, channelToken) { var url = 'https://api.line.me/v2/bot/message/reply'; var opt = { 'headers': { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': 'Bearer ' + channelToken, }, 'method': 'post', 'payload': JSON.stringify({ 'replyToken': replyToken, 'messages': mess }) }; UrlFetchApp.fetch(url, opt); } //************* ปรากฏเมนู หาก ไมมีขอมูล***/ var result={ "type": "text", "text": "ไมเขาใจคำถามหรือความตองการ กรุณาลองดวิธีใชงาน ขอบคุณครับ ",


"quickReply": { "items": [ { "type": "action", "action": { "type": "uri", "label": "สอบถาม", "uri": "https://qr-official.line.me/sid/L/734nsfhp.png" } }, { "type": "action", "action": { "type": "uri", "label": "สงงาน", "uri": "https://script.google.com/macros/s/AKfycbzg7WKij31AJk0iA8swIWsgbahMLRX2HsDmfsmjcbIb31gy52lxX1HS-Xb5xYruV0/exec" } } ] } } //*************End ปรากฏเมนู หาก ไมมีขอมูล***/ function doPost(e) { var json = JSON.parse(e.postData.contents); var reply_token = json.events[0].replyToken; var message = json.events[0].message.text;


//********** LINE FLEX แจงคะแนน แบบมีเงื่อนไข คะแนน,XXXXX ********* var msg = message.split(',') if(msg[0]=='คะแนน'){ var msg1 = msg[1] for (var i = 0; i < data.length; i++) { if (data[i][0] == msg1) { i = i + 2; var data1 = sheet.getRange(i, 1).getDisplayValue(); //รหัส var data2 = sheet.getRange(i, 2).getDisplayValue(); //รหัส var data3 = sheet.getRange(i, 3).getDisplayValue(); //รหัส var data4 = sheet.getRange(i, 4).getDisplayValue(); //รหัส var data5 = sheet.getRange(i, 5).getDisplayValue(); //รหัส var data6 = sheet.getRange(i, 6).getDisplayValue(); //รหัส var data7 = sheet.getRange(i, 7).getDisplayValue(); //รหัส var data8 = sheet.getRange(i, 8).getDisplayValue(); //รหัส var data9 = sheet.getRange(i, 9).getDisplayValue(); //รหัส var data10 = sheet.getRange(i, 10).getDisplayValue(); //รหัส var data11 = sheet.getRange(i, 11).getDisplayValue(); //รหัส var data12 = sheet.getRange(i, 12).getDisplayValue(); //รหัส var data13 = sheet.getRange(i, 13).getDisplayValue(); //รหัส var data14 = sheet.getRange(i, 14).getDisplayValue(); //รหัส var data15 = sheet.getRange(i, 15).getDisplayValue(); //รหัส var data16 = sheet.getRange(i, 16).getDisplayValue(); //รหัส var data17 = sheet.getRange(i, 17).getDisplayValue(); //รหัส var data18 = sheet.getRange(i, 18).getDisplayValue(); //รหัส var data19 = sheet.getRange(i, 19).getDisplayValue(); //รหัส var data20 = sheet.getRange(i, 20).getDisplayValue(); //รหัส var data21 = sheet.getRange(i, 21).getDisplayValue(); //รหัส var data22 = sheet.getRange(i, 22).getDisplayValue(); //รหัส // var data23 = sheet.getRange(i, 23).getDisplayValue(); //รหัส result = //------------------------------- LINE FLEX MESSAGE คะแนน------------------------------------------// { "type": "bubble",


"body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ขอมูลผูเรียน", "weight": "bold", "color": "#1DB446", "size": "lg" }, { "type": "text", "text": data2, "weight": "bold", "size": "xxl", "margin": "md" }, { "type": "text", "text": "โดยแผนกยุทธวิธี", "size": "lg", "color": "#1DB446", "size": "lg", "wrap": true }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "vertical",


"margin": "xxl", "spacing": "sm", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "เลขประจำตัว", "size": "lg", "color": "#555555", "flex": 0 }, { "type": "text", "text": data1, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "สังกัด", "size": "lg", "color": "#555555", "flex": 0 }, {


"type": "text", "text": data3, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "E-mail", "size": "lg", "color": "#555555", "flex": 0 }, { "type": "text", "text": data4, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "horizontal",


"margin": "xxl", "contents": [ { "type": "text", "text": "ปอมสนาม(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data5, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "เครื่องกีดขวาง(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data6, "size": "lg", "color": "#111111", "align": "end" }


] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "รูปขบวนหมู(4) ", "size": "lg", "color": "#555555" }, { "type": "text", "text": data7, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ทัศนสัญญาน(4)", "size": "lg", "color": "#555555" }, { "type": "text",


"text": data8, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "การเคลื่อนที่(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data9, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ระเบียบคำสั่งฯ(6)",


"size": "lg", "color": "#555555" }, { "type": "text", "text": data10, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ตีกลางวัน(6)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data11, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal",


"margin": "xxl", "contents": [ { "type": "text", "text": "ตีกลางคืน(6)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data12, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ตั้งรับ(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data13, "size": "lg", "color": "#111111", "align": "end" }


] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ถอนตัว(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data14, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ยิงปนเคลื่อนที่(8)", "size": "lg", "color": "#555555" }, { "type": "text",


"text": data15, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "แบบฝกการรบ(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data16, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "MOUT(8)",


"size": "lg", "color": "#555555" }, { "type": "text", "text": data17, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "กลางภาค(15)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data18, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal",


"contents": [ { "type": "text", "text": "ปลายภาค(15)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data19, "size": "lg", "color": "#111111", "align": "end" }, ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "รวมคะแนน(100)", "size": "lg", "color": "#1DB446" }, { "type": "text", "text": data20, "size": "lg", "color": "#1DB446", "align": "end" }, ] },


{ "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "เกรด", "size": "lg", "color": "#b41d1d" }, { "type": "text", "text": data21, "size": "lg", "color": "#b41d1d", "align": "end" }, ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "สถานะ", "size": "lg", "color": "#1d22b4" }, { "type": "text", "text": data22, "size": "lg", "color": "#1d22b4", "align": "end"


}, ] } ] }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "horizontal", "margin": "md", "contents": [ { "type": "text", "text": "Tactical Studies Section", "size": "xs", "color": "#1DB446", "flex": 0 }, { "type": "text", "text": "โดย ร.ท.พิษณุ ปนชาติ", "color": "#1DB446", "size": "xs", "align": "end" } ] } ] }, "styles": { "footer": { "separator": true


} } } result = { 'type': 'flex', 'altText': 'This is Flex Message', 'contents': result } break; };//End if };//End for } UrlFetchApp.fetch(line_endpoint, { 'headers': { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': 'Bearer ' + CHANNEL_ACCESS_TOKEN, }, 'method': 'post', 'payload': JSON.stringify({ 'replyToken': reply_token, 'messages': [result], }), }); var replyJSON = ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON); return replyJSON; } //************* End flax คะแนน********/ // *********************************************************************


Line Hackathon27 ระบบลงทะเบียน แสดงผลผาน line Hackathon27 Code


Code.gs //********************ลงทะเบียน */ if (message=='ลงทะเบียน'){ result= { "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/29/dWRLn0v.jpeg", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" } }, "body": { "type": "box", "layout": "vertical", "spacing": "md", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" }, "contents": [ {


"type": "text", "text": "ลงทะเบียน", "weight": "bold", "size": "xl", "contents": [] }, { "type": "text", "text": "กรุณาลงทะเบียนกอนใชงาน", "size": "xxs", "color": "#AAAAAA", "wrap": true, "contents": [] } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "spacer", "size": "xxl" }, { "type": "button", "action": { "type": "uri", "label": "Click", "uri": "https://vapidinformalpasswords.psn-chanelchane.repl.co/" }, "color": "#905C44", "style": "primary" } ]


} } } } Index.html https://vapidinformalpasswords.psn-chanelchane.repl.co <!DOCTYPE html> <head> <title>กำลังเขาสู Form</title> <style> .centerScreen { margin-top: 20; margin-right: auto; margin-bottom: 20; margin-left: auto; } </style> </head> <body style="background-color: powderblue;"> <div class="centerScreen"> <center> <img src="https://sv1.picz.in.th/images/2022/11/02/v5V9zI.png " height="150px" , width="150px" /> <h1>


กำลังเขาสู หนาลงทะเบียน กรุณารอซักครู </h1> </center> </div> </body> <footer> <script charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script> <script> const liffId = "1660767634-xwmnRmDe"; //LIFF ID 1660767634-xwmnRmDe เปลี่ยน liff.ready .then(() => { if (liff.isLoggedIn()) { return liff.getProfile(); } else { liff.login({ redirectUri: "https://vapidinformalpasswords.psn-chanelchane.repl.co", //เปลี่ยน URL }); } }) .then((profile) => { window.location.replace( `https://docs.google.com/forms/d/e/1FAIpQLSexbIgUWxZtj9btFFrWkqPdQG_khuybsTWJ8UbDFqquFygcg/viewform? usp=pp_url&entry.770307915=${profile.userId}&entry.556942949=${profile.displayName}&entry.1893071909= ${profile.pictureUrl}&entry.499102859=${profile.statusMessage}`


); }); liff.init( { liffId: liffId, }, () => {}, (err) => { window.alert(err); } ); </script> </footer>


Line Hackathon27 ระบบตำรา คูมือ ประกอบการเรียน การสอน แสดงผลผาน line Hackathon27 Code


Code.gs //https://anyflip.com/center/flips/book.php?cid=2832797 //**********LINE FLEX MESSAGE ตำรา ********* if (message=='ตำรา'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "carousel", "contents": [ { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQbKP.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คูมือวิชายุทวิธี เลม 1", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสิบทหารบก", "margin": "md"


} ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/11JLcxCV3zZygm_GOtFLfIWiek_PkTtFt/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#F2DB4D", "margin": "xl" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQHmg.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical",


"contents": [ { "type": "text", "text": "คูมือวิชายุทวิธี เลม 2", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสิบทหารบก", "margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1r4YOQdJFhc0V9Yg1-MDeZYQKuLQ4YTgy/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#f69988", "margin": "xl" }


}, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQG4y.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คูมือวิชายุทวิธี เลม 3", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสิบทหารบก", "margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download",


"align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1dNg-430U-v6mEzfqI3RyWXfzXl_wUsRP/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#ce93d8", "margin": "xl" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQJQD.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คูมือวิชายุทวิธี ", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสิบทหารบก",


"margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1ZvZOxt5RrCd7kyt9T-NtyBnu15EU3pAP/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#42bd41", "margin": "xl" } } ] } } } //********** END LINE FLEX MESSAGE ตำรา *********


Line Hackathon27 ระบบนิเทศผูสอน แสดงผลผาน line Hackathon27 Code


Code.gs function doGet() { return HtmlService.createTemplateFromFile('index').evaluate() .addMetaTag('viewport', 'width=device-width, initial-scale=1') .setTitle('ระบบการนิเทศการสอน') .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) .setFaviconUrl('https://sv1.picz.in.th/images/2023/08/11/MMBDPI.png') } // *** ประกาศตัวแปรใชงานรวมกัน **** // var ss = SpreadsheetApp.getActiveSpreadsheet(); var idsetting = SpreadsheetApp.getActive().getSheetByName("setting").getRange('B2').getValues(); //ไอดี รหัสตั้ง คา var id_Folder = SpreadsheetApp.getActive().getSheetByName("setting").getRange('B3').getValues(); //ไอดี เก็บ ไฟล var id_Sheet = SpreadsheetApp.getActive().getSheetByName("setting").getRange('B4').getValues(); //ไอดี ชีต var id_Slide = SpreadsheetApp.getActive().getSheetByName("setting").getRange('B5').getValues(); //ไอดี สไลด var id_Token = SpreadsheetApp.getActive().getSheetByName("setting").getRange('B6').getValues(); //ไอดี ไลน var sheetName = ss.getSheetByName("data");// ชื่อชีต ฐานขอมูล var datasheet = ss.getSheetByName("dataTable");// ชื่อชีต ฐานขอมูล var sheetName2 = ss.getSheetByName("pass");// ชื่อชีต กำหนดรหัสครูประจำชั้น var sheetName4 = ss.getSheetByName("setting");// ชื่อชีต ตั้งคา function include(fh) { return HtmlService.createHtmlOutputFromFile(fh).getContent() } /** @ดึงขอคำถามมาแสดง */ function searchData1(sh){ return data = SpreadsheetApp.getActive().getSheetByName(sh).getDataRange().getDisplayValues().slice(1) } /** @ดึงขอมูลจาก sheet เพื่อแสดงลงในชองแกไข */ function findRecord(record) { var ss = SpreadsheetApp.getActive().getSheetByName('data') var data = ss.getDataRange().getValues()


var id = data.map(r => r[1]) // ตำแหนงที่ใชดึงคา var index = id.indexOf(record) var output = {} if (index >= 1) { data = ss.getRange(index + 1, 1, 1, ss.getLastColumn()).getValues()[0] output.result = true output.data = data } else { output.result = false } return output } /** @บันทึกขอมูลรายบุคคล */ function saveData(obj) { const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('data') const datasheet = sheet.getDataRange().getDisplayValues() const index = datasheet.findIndex(r => r[1] == obj.stdID) const rowID = index == -1 ? 0 : index+1 sheet.getRange(rowID,4).setValue(obj.pakrean); sheet.getRange(rowID,5).setValue(obj.pee); sheet.getRange(rowID,6).setValue(obj.chan); sheet.getRange(rowID,8).setValue(obj.rahaswicha); sheet.getRange(rowID,9).setValue(obj.wicha); sheet.getRange(rowID,10).setValue(obj.neay); sheet.getRange(rowID,11).setValue(obj.reing); sheet.getRange(rowID,12).setValue(obj.kab); sheet.getRange(rowID,13).setValue(obj.jamnuen); sheet.getRange(rowID,14).setValue(obj.date); sheet.getRange(rowID,15).setValue(obj.sanernea); sheet.getRange(rowID,16).setValue(obj.nitest); sheet.getRange(rowID,17).setValue(obj.checked); console.log(rowID) runPDF(rowID) }; /** บันทึกการตั้งคาของระบบ */


function saveData4(obj) { var sheet = sheetName4 if (obj.set_pi.length > 0) { sheet.getRange('B3').setValue(obj.set_pi); } else { obj.set_pi = "" } if (obj.set_sheet.length > 0) { sheet.getRange('B4').setValue(obj.set_sheet); } else { obj.set_sheet = "" } if (obj.set_slide.length > 0) { sheet.getRange('B5').setValue(obj.set_slide); } else { obj.set_slide = "" } if (obj.set_token.length > 0) { sheet.getRange('B6').setValue(obj.set_token); } else { obj.set_token = "" } if (obj.set_lo.length > 0) { sheet.getRange('B7').setValue(obj.set_lo); } else { obj.set_lo = "" } if (obj.set_sch.length > 0) { sheet.getRange('B8').setValue(obj.set_sch); }


else { obj.set_sch = "" } if (obj.set_dev.length > 0) { sheet.getRange('B9').setValue(obj.set_dev); } else { obj.set_dev = "" } if (obj.set_pssall.length > 0) { sheet.getRange('B2').setValue(obj.set_pssall); } else { obj.set_pssall = "" } }; function getURL() { return ScriptApp.getService().getUrl(); } /** คนหาขอมูลตามระดับชั้นนำมาแสดงในตาราง */ function searchdata(user) { var ss = datasheet.getDataRange().getDisplayValues(); var ar = []; ss.forEach(function (f) { if (~f.indexOf(user.searchtext1)) { ar.push(f); } }); Logger.log(ar) return ar; } /** แสดงตารางตามระดับชั้น */ function getDatatable_Std1() { return ss = datasheet.getDataRange().getDisplayValues().slice(1) }


function loginform(pass) { var data = sheetName2.getDataRange().getDisplayValues().slice(1) let rowID = data.find(r => { return r[0] == pass }) return rowID } let selectgroup = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('setting') .getRange('C2:C').getValues().filter(d => d[0] !== "") .map(d => '<option>'+ d[0] +'</option>' ).join(""); /** คนหาขอมูลนำไปแสดงคาที่กำหนด เชน ชื่อหนวยงานและโลโก */ function readDatasetting() { var celldata = sheetName4.getRange('B1').getValue() var data = sheetName4.getRange(2, 2, celldata,1).getDisplayValues() // Logger.log(data) return JSON.stringify(data) } function getDBshow() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("DBshow"); var data = ss.getDataRange().getDisplayValues().slice(1); return data; } function sendNotify(msg,token,image){ let payloadJson = { "message": msg, "imageFile": image }; let options = { "method": "post", "payload": payloadJson, "headers": { "Authorization": "Bearer " + token } };


UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options); } function getDBshow() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("DBshow"); var data = ss.getDataRange().getDisplayValues().slice(1); return data; } Topmenu.html <!-- /*********************************************** แถบเมนูดานบน ***************************************/ --> <style> .topmenu { position: relative; top: 2%; width: 350px; padding: 20px; background-color: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 15px; z-index: 10; backdrop-filter: blur(25px); box-shadow: 10px 10px 40px rgba(0, 0, 0, 0.2), -10px -10px 40px rgba(0, 0, 0, 0.2); } </style> <!-- /*********************************************** แถบเมนูดานบน *********************************************/ --> <section id="drop" style="background-color: #00000099; display:none"> <nav id="nav1" class="navbar navbar-light fixed-top nav-box shadow col-md-12"> <div class="container" style="vertical-align: middle; color:#fff; font-size:2.0rem"> <!-- /*********************************************** แถบเมนูดานบน *********************************************/ -->


Click to View FlipBook Version