<commit_before><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="..\..\bower_components/polymer/polymer.html">

<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../addattendance-item-card/addattendance-item-card.html">
<link rel="import" href="../attendance-service/attendance-service.html">

<dom-module id="addattendence-card">
  <template>
    <style>
      :host {
        display: block;
      }
      .heading-att, .contain-atten{
        @apply(--layout-horizontal);
      }
      .contain-atten{
        background-color: #fefefe;
        padding: 1%;
        font-size: 105%;
      }
      .heading-att{
        background-color: #969696;
        padding: 1%;
        margin-top:2%; 
      }
      .heading-att p{
        font-weight: bold;
        font-size: 115%;
      }
      .sno, .attname, .attencheck, .heading-att p{
        width: 50%;
      }
      .container{
        text-align: center;
        margin: 0 auto;
      }
      .students-atten{
        margin: 2% 0;
        box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px;
      }
      .students-atten:nth-child(even) {background: #CCC};
      .students-atten:nth-child(odd) {background: #FFF};
    </style>
    <div class="container">
      <div id="drop">
        <div class="field">
          <paper-dropdown-menu label="Route">
            <paper-menu   id="sets0sa" class="dropdown-content" on-iron-select="routeid" selected="{{selectroute}}">
              <template  is="dom-repeat" items="{{routes}}" as="view">
                <paper-item value="{{view.route_id}}">{{view.route_name}}</paper-item>
              </template>
            </paper-menu>
          </paper-dropdown-menu>
        </div>
        <br/>
        <div class="trip">
         Pickup <paper-checkbox style="margin-left: 3%" id="pickup"  class="checkbox" on-change="pickupHandler"></paper-checkbox>
         Drop <paper-checkbox style="margin-left: 3%" id="dropp"  class="checkbox" on-change="dropHandler"></paper-checkbox>
       
         <!-- <paper-dropdown-menu label="Select the Trip">
            <paper-menu id="tripsz" class="dropdown-content" on-iron-select="Fntrip" valueattr="value" >
                <paper-item value="1">1</paper-item>
                <paper-item value="2">2</paper-item>
            </paper-menu>
          </paper-dropdown-menu>-->
        </div>
        <br/>
        <div class="drop-down" >
          Trip 1 <paper-checkbox style="margin-left: 3%" id="trip1"  class="checkbox" on-change="trip1Handler"></paper-checkbox>
         Trip 2 <paper-checkbox style="margin-left: 3%" id="trip2"  class="checkbox" on-change="trip2Handler"></paper-checkbox>
         <!-- <paper-dropdown-menu label="Select PickUp or Drop">
            <paper-menu id="pickdropzz" class="dropdown-content" on-iron-select="Fnpickordrop" valueattr="value" >
              <paper-item value="pickup">Pickup</paper-item>
              <paper-item value="drop">Drop</paper-item>
            </paper-menu>
          </paper-dropdown-menu>-->
        </div>
        <br/>
        <div class="button">
          <paper-button on-click="show">Submit</paper-button>
        </div>
      </div>
      <div class="heading-att" id="headatt">
        <p>Student Image  </p>
        <p>Student Name</p>
        <p>Status</p>
      </div>
      <template is="dom-repeat" items="{{attendancearr}}" as="view">
        <div class="students-atten">
          <addattendance-item-card student="{{view.name}}" studentid="{{view.student_id}}" ></addattendance-item-card>
        </div>
      </template>
      <div class="button">
        <paper-button raised id="submitatten" on-click="click">Submit</paper-button>
      </div>
    </div>
    <attendance-service id="service"></attendance-service>
  </template>
  <script>
  (function() {
    'use strict';
    var trip;
    var pickupordrop;
    var routeid;
    var itemarray=[];
    var attendancearr = [];
    Polymer({
      is: 'addattendence-card',
      ready:function(){
        //alert('hi');
       
        this.$.headatt.hidden=true;
        this.$.submitatten.hidden=true;
        this.$.drop.hidden=false;
  

       
      },
      setroute:function()
      {
       if(sessionStorage.getItem("route")!=null)
        {
          
          this.selectroute=sessionStorage.getItem("route");
          //alert(this.selectroute);
        }
         var d = new Date();
    var n = d.getHours();
    if(n>12)
    {
     
       document.querySelector("#dropp").checked=true;
        pickupordrop="Drop";
    }
    else
    {
      
       document.querySelector("#pickup").checked=true;
        pickupordrop="Pickup";
    }
      },
      routeid:function(e)
      {
        routeid = (e.target.selectedItem.textContent).trim();
         sessionStorage.setItem("route",this.selectroute);
        // alert(this.selectroute);

      },
      Fntrip:function(e)
      {
        trip = (e.target.selectedItem.textContent).trim();
      },
      trip1Handler:function(e)
      {
          if(e.target.checked==true)
        {
          document.querySelector("#trip2").checked=false;
          trip="1";
        }

      },
      trip2Handler:function(e)
      {
          if(e.target.checked==true)
        {

          document.querySelector("#trip1").checked=false;
          trip="2";
        }
      },
      Fnpickordrop:function(e)
      {
        pickupordrop =(e.target.selectedItem.textContent).trim();
      },
      pickupHandler:function(e)
      {
          if(e.target.checked==true)
        {
         
          document.querySelector("#dropp").checked=false;
          pickupordrop="Pickup";
        }

      },
      dropHandler:function(e)
      {
       if(e.target.checked==true)
        {
          
          document.querySelector("#pickup").checked=false;
          pickupordrop="Drop";
        }
      },
      show:function(e)
      {
        this.$.service.getstudentsforattendance(routeid,trip,pickupordrop);
        this.$.headatt.hidden=false;
        this.$.submitatten.hidden=false;
        this.$.drop.hidden=true;
        //this.$.service.studentroutereport(routeid,trip,pickupordrop);
      },
      FnGetItemsz:function(studentid, student_name)
           {
            var today = new Date();
            var dd = today.getDate();
            var mm = today.getMonth()+1;
            var yyyy = today.getFullYear();
            if(dd<10) {
              dd='0'+dd
            }
            if(mm<10) {
              mm='0'+mm
            }
            today = dd+'/'+mm+'/'+yyyy;
            var obj={"studentid":"","student_name":"","routeid":"","trip":"","pickupordrop":"","date":"" };
            obj.studentid=studentid;
            obj.student_name = student_name;
            obj.routeid = routeid;
            obj.trip=trip;
            obj.date=today;
            obj.pickupordrop = pickupordrop;
            itemarray.push(obj);
            //alert(JSON.stringify(itemarray));
            //this.$.submitbutton.disabled=false;
            //document.getElementById("submitbutton").style.background="black";
          },
          removestud:function(std){
            for(var i=0;i<itemarray.length;i++){
              if(std==itemarray[i].studentid){
                itemarray.splice(i,1);
              }
            }
          //this.$.submitbutton.disabled=true;
          //document.getElementById("submitbutton").style.background="grey";
           },
          click:function(){
            //alert('call');
            this.$.service.submitattendance(itemarray);
            //itemarray=[];
            //document.querySelector('#gradeselect').selected=-1;
            this.value="";
            // this.$.submitbutton.hidden=true;
          },
          FnClear:function(){
            document.querySelector('#sets0sa').selected=-1;
            document.querySelector('#tripsz').selected=-1;
            document.querySelector('#pickdropzz').selected=-1;
            this.attendancearr=[];
          }
    });
  })();
  </script>
</dom-module>
<commit_msg>alignment<commit_after><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="..\..\bower_components/polymer/polymer.html">

<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../addattendance-item-card/addattendance-item-card.html">
<link rel="import" href="../attendance-service/attendance-service.html">

<dom-module id="addattendence-card">
  <template>
    <style>
      :host {
        display: block;
      }
      .heading-att, .contain-atten{
        @apply(--layout-horizontal);
      }
      .contain-atten{
        background-color: #fefefe;
        padding: 1%;
        font-size: 105%;
      }
      .heading-att{
        background-color: #969696;
        padding: 1%;
        margin-top:2%; 
      }
      .heading-att p{
        font-weight: bold;
        font-size: 115%;
      }
      .sno, .attname, .attencheck, .heading-att p{
        width: 50%;
      }
      .container{
        text-align: center;
        margin: 0 auto;
      }
      .students-atten{
        margin: 2% 0;
        box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px;
      }
      .students-atten:nth-child(even) {background: #CCC};
      .students-atten:nth-child(odd) {background: #FFF};
    </style>
    <div class="container">
      <div id="drop">
        <div class="field">
          <paper-dropdown-menu label="Route">
            <paper-menu   id="sets0sa" class="dropdown-content" on-iron-select="routeid" selected="{{selectroute}}">
              <template  is="dom-repeat" items="{{routes}}" as="view">
                <paper-item value="{{view.route_id}}">{{view.route_name}}</paper-item>
              </template>
            </paper-menu>
          </paper-dropdown-menu>
        </div>
        <br/>
        <div class="trip" style="padding:2%;">
         Pickup <paper-checkbox style="margin-left: 3%" id="pickup"  class="checkbox" on-change="pickupHandler"></paper-checkbox>
         Drop <paper-checkbox style="margin-left: 3%" id="dropp"  class="checkbox" on-change="dropHandler"></paper-checkbox>
       
         <!-- <paper-dropdown-menu label="Select the Trip">
            <paper-menu id="tripsz" class="dropdown-content" on-iron-select="Fntrip" valueattr="value" >
                <paper-item value="1">1</paper-item>
                <paper-item value="2">2</paper-item>
            </paper-menu>
          </paper-dropdown-menu>-->
        </div>
        <br/>
        <div class="drop-down" style="padding:2%;">
          <span>
            Trip 1 <paper-checkbox style="margin-left: 4%" id="trip1"  class="checkbox" on-change="trip1Handler"></paper-checkbox>
          </span>
          <span>
            Trip 2 <paper-checkbox style="margin-left: 3%" id="trip2"  class="checkbox" on-change="trip2Handler"></paper-checkbox>
          </span>
         <!-- <paper-dropdown-menu label="Select PickUp or Drop">
            <paper-menu id="pickdropzz" class="dropdown-content" on-iron-select="Fnpickordrop" valueattr="value" >
              <paper-item value="pickup">Pickup</paper-item>
              <paper-item value="drop">Drop</paper-item>
            </paper-menu>
          </paper-dropdown-menu>-->
        </div>
        <br/>
        <div class="button">
          <paper-button on-click="show">Submit</paper-button>
        </div>
      </div>
      <div class="heading-att" id="headatt">
        <p>Student Image  </p>
        <p>Student Name</p>
        <p>Status</p>
      </div>
      <template is="dom-repeat" items="{{attendancearr}}" as="view">
        <div class="students-atten">
          <addattendance-item-card student="{{view.name}}" studentid="{{view.student_id}}" ></addattendance-item-card>
        </div>
      </template>
      <div class="button">
        <paper-button raised id="submitatten" on-click="click">Submit</paper-button>
      </div>
    </div>
    <attendance-service id="service"></attendance-service>
  </template>
  <script>
  (function() {
    'use strict';
    var trip;
    var pickupordrop;
    var routeid;
    var itemarray=[];
    var attendancearr = [];
    Polymer({
      is: 'addattendence-card',
      ready:function(){
        //alert('hi');
       
        this.$.headatt.hidden=true;
        this.$.submitatten.hidden=true;
        this.$.drop.hidden=false;
  

       
      },
      setroute:function()
      {
       if(sessionStorage.getItem("route")!=null)
        {
          
          this.selectroute=sessionStorage.getItem("route");
          //alert(this.selectroute);
        }
         var d = new Date();
    var n = d.getHours();
    if(n>12)
    {
     
       document.querySelector("#dropp").checked=true;
        pickupordrop="Drop";
    }
    else
    {
      
       document.querySelector("#pickup").checked=true;
        pickupordrop="Pickup";
    }
      },
      routeid:function(e)
      {
        routeid = (e.target.selectedItem.textContent).trim();
         sessionStorage.setItem("route",this.selectroute);
        // alert(this.selectroute);

      },
      Fntrip:function(e)
      {
        trip = (e.target.selectedItem.textContent).trim();
      },
      trip1Handler:function(e)
      {
          if(e.target.checked==true)
        {
          document.querySelector("#trip2").checked=false;
          trip="1";
        }

      },
      trip2Handler:function(e)
      {
          if(e.target.checked==true)
        {

          document.querySelector("#trip1").checked=false;
          trip="2";
        }
      },
      Fnpickordrop:function(e)
      {
        pickupordrop =(e.target.selectedItem.textContent).trim();
      },
      pickupHandler:function(e)
      {
          if(e.target.checked==true)
        {
         
          document.querySelector("#dropp").checked=false;
          pickupordrop="Pickup";
        }

      },
      dropHandler:function(e)
      {
       if(e.target.checked==true)
        {
          
          document.querySelector("#pickup").checked=false;
          pickupordrop="Drop";
        }
      },
      show:function(e)
      {
        this.$.service.getstudentsforattendance(routeid,trip,pickupordrop);
        this.$.headatt.hidden=false;
        this.$.submitatten.hidden=false;
        this.$.drop.hidden=true;
        //this.$.service.studentroutereport(routeid,trip,pickupordrop);
      },
      FnGetItemsz:function(studentid, student_name)
           {
            var today = new Date();
            var dd = today.getDate();
            var mm = today.getMonth()+1;
            var yyyy = today.getFullYear();
            if(dd<10) {
              dd='0'+dd
            }
            if(mm<10) {
              mm='0'+mm
            }
            today = dd+'/'+mm+'/'+yyyy;
            var obj={"studentid":"","student_name":"","routeid":"","trip":"","pickupordrop":"","date":"" };
            obj.studentid=studentid;
            obj.student_name = student_name;
            obj.routeid = routeid;
            obj.trip=trip;
            obj.date=today;
            obj.pickupordrop = pickupordrop;
            itemarray.push(obj);
            //alert(JSON.stringify(itemarray));
            //this.$.submitbutton.disabled=false;
            //document.getElementById("submitbutton").style.background="black";
          },
          removestud:function(std){
            for(var i=0;i<itemarray.length;i++){
              if(std==itemarray[i].studentid){
                itemarray.splice(i,1);
              }
            }
          //this.$.submitbutton.disabled=true;
          //document.getElementById("submitbutton").style.background="grey";
           },
          click:function(){
            //alert('call');
            this.$.service.submitattendance(itemarray);
            //itemarray=[];
            //document.querySelector('#gradeselect').selected=-1;
            this.value="";
            // this.$.submitbutton.hidden=true;
          },
          FnClear:function(){
            document.querySelector('#sets0sa').selected=-1;
            document.querySelector('#tripsz').selected=-1;
            document.querySelector('#pickdropzz').selected=-1;
            this.attendancearr=[];
          }
    });
  })();
  </script>
</dom-module>

{'fraction_non_alphanumeric': 0.16030975496994915, 'fraction_numerical': 0.010402219140083218, 'mean_word_length': 1.9986137584474095, 'pattern_counts': {'":': 12, '<': 181, '<?xml version=': 0, '>': 177, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3431437', 'n_tokens_mistral': 5357, 'n_tokens_neox': 5183, 'n_words': 824}