<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="/javascripts/jquery-3.4.1.js"></script>
<style type="text/css">
body {
  background-color: #d6d6d3;
  height: 100vh;
  width: 100vw;
  display: flex;
     flex-direction:column;
	 justify-content: flex-start;
     align-items:center;
  	margin: 0;
}
.navbar{background:#ddedf8;}
.nav-link, .navbar-brand{color: #f4f4f4;cursor:pointer;}
.nav-link{margin-right:1em !important;}
.nav-link:hover{background: #f4f4f4;color:#f97300;}
.navbar-collapse{justify-content:flex-end;}
.navbar-toggler{background:#fff !important;}
</style>

  <title>填寫建言處</title>
  </head>
  <body>
    <div id="show_div">
      <bander></bander>
        <inputer></inputer>        
    </div>
 
    <template id="banderUI">
      <nav class="navbar navbar-expand-lg navbar-light">
        <a class="navbar-brand" href="#">{{brand}}</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarText">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item">
                <a class="nav-link" href="/deep1/innerweb">{{lastpage}}</a>
              </li>
            <li class="nav-item active">
              <a class="nav-link" href="#">{{input1}}<span class="sr-only">(current)</span></a>
            </li>
          </ul>
          <span class="navbar-text">
            <font size="1">{{statusreport}}</font>
          </span>
        </div>
      </nav>
    </template>
    
    <template id="inputerUI" ">
      <div class="card" style="width: 36rem;" >
        <div class="card-body">
          <h5 class="card-title">{{card_title}}</h5>
          <h6 class="card-subtitle mb-2 text-muted">{{card_subtitle}}</h6>
          <form action="/deep1/idea/add1" method="post">
            <div class="form-group" :key="inputerUIkey">              
            
              <label for="formGroupExampleInput2">{{items.item1}}</label>
              <input type="text" name="a10writer" class="form-control" id="formGroupExampleInput1" :placeholder="holders.holder1">
            
              <label for="formGroupExampleInput2">{{items.item3}}</label>
              <input type="text" name="a20titleofidea" class="form-control" id="formGroupExampleInput3" :placeholder="holders.holder3">
            
              <label for="formGroupExampleInput2">{{items.item4}}</label>
              <input type="text" name="a25idea" class="form-control" id="formGroupExampleInput4" :placeholder="holders.holder4">
            

              <label for="formGroupExampleInput">{{items.item99}}</label>
              <input type="text" name="a99footnote" class="form-control" id="formGroupExampleInput99" :placeholder="holders.holder99">
            
              <input type="hidden" name="statusreport" class="form-control" id="msg1" value="由員工填寫idea後進入本頁">
            
              <input type="submit" id="button1" value="確定送出" class="btn btn-info">
            </div>
          </form>
          <input type="submit" id="button2" value="重新輸入" class="btn btn-info" @click="rerender()">
            <!-- <a href="#" class="card-link">Card link</a>
            <a href="#" class="card-link">Another link</a> -->
        </div>
      </div> 
    </template>

<!-- Vue CDN-->
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<script>
Vue.component("bander",{
    
    data(){
      return {
        brand:"Deep內部功能",
        lastpage:"回本員工首頁",
        input1:"填寫建言",
        inputbatch:"批次輸入",
        crawl:"從網路抓取",
        statusreport:'<%- statusreport %>'
      }
    },
    
    template:"#banderUI"
  });
  Vue.component("inputer",{
    
    data(){
      return {
        card_title:"新增1則建言",
        card_subtitle:"請輸入以下各項資料:",
        items:{
            item0:"建言者IP：",
            item1:"您的稱呼",
            item2:"建言日期時間：",
            item3:"建言標題：",
            item4:"建言內容：",
            item5:"同人前則建言代碼：",
            item6:"本則建言代碼：",
            item7:"回應者：",
            item8:"回應內容：",
            item9:"後續追踪：",
            item99:"特別註記："
      },
        holders:{
            holder0:"字串,",
            holder1:"字串,",
            holder2:"日期時間,",
            holder3:"字串,",
            holder4:"字串,",
            holder5:"字串,由本資料表搜尋",
            holder6:"字串,",
            holder7:"物件識別碼,由staffinfo選取",
            holder8:"字串,",
            holder9:"字串,如名詞字典選項",
            holder99:"字串"
        },
        termlist:JSON.parse(decodeURIComponent('<%=termlist%>')),       
        staffinfolist:JSON.parse(decodeURIComponent('<%=staffinfolist%>')),
        idealist:JSON.parse(decodeURIComponent('<%=idealist%>')),
        followacts:[],  
      inputerUIkey:0
      } 
    },
    mounted:function(){
        for(term of this.termlist){
            if(term.a20field=="a50followact"){
                this.followacts.push(term)
            }
        }
    },
    methods:{
        rerender:function() {
      this.inputerUIkey += 1;
      console.log("inputerUIkey:"+this.inputerUIkey)  
    }
    }, 
    
    template:"#inputerUI"
  });
  
    new Vue({
        el:'#show_div',
        data:{
          testdata:'有執行到此。。。。'
        },
        /* computed:{

        },
        watch:{

        },
        filters:{

        },
        mixins:[

        ],
        template:" ",
        components:{

        },*/
        beforeCreate:function(){
          console.log("before create...")
        },created:function(){
          console.log("created...")
        },
        beforeMount:function(){
          console.log("before mount...")
        },
        mounted:function(){
          console.log("mounted...")
        },
        beforeUpdate:function(){
          console.log("before update...")
        },
        updated:function(){
          console.log("updated...")
        },
        beforeDestroy:function(){

        } 
    })
</script>


  </body>
</html>