只有第一行显示datepicker

时间:2016-08-08 16:46:33

标签: javascript jquery html css codeigniter

只有第一行显示日期选择器,后续行不显示datepicker。我已经阅读了其他一些参考文献但似乎没有任何帮助。附图也可供参考。我正在研究codeigniter框架。enter image description here不知道为什么会发生这种情况。我的观看代码是

<?php global $USER; ?>
<style>
    .dataTables_filter
    {
        padding:10px;
    }
    .caption
    {
        margin-left:10px;
    }
    .dataTables_paginate 
    {
        float:right;
        margin-right:10px;
    }
    td,th{
        padding-left: 10px!important;
        padding-right: 10px!important;
    }
    .dashboard-stat
    {
        padding:0px!important;;
    }
    .hidden_fields {
position: absolute;
width: 400px;
height: 255px;
background: #fff;
border: 1px solid #ccc;
margin-top: 10px;

display: none;
padding-top:10px;
}

.hidden_fields  ul
{
    width:170px;
    float:left;
}
.minimize {
display: none;
}
ol, ul {
list-style: none;
}
.right_mey a
{
    color:#000;
}
</style>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/plugins/select2/select2_metro.css" />
<input type="hidden" id="page_name" value="requests">   
<section class="content-header">
          <h1>
          My Resignation Requests<small> <span class="">
                        </small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="<?php base_url(); ?>"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="#">My Requests</a></li>
            <li>Resignation Requests</li>
          </ol>
    </section>

    <input type="hidden" id="page_name" value="requests">
 <div class="container-fluid">
                    <div class="row"> 
                        <!-- Thought Day-->
                        <div class="panel wrapper clearfix m-b-none">
                        <?php
                        $total = count($rows);
                        if($total == 0)
                        { ?>
                        <div class="panel-header"><a href="<?php echo base_url(); ?>exits/my_resignation_request" class="btn btn-info">Add New</a></div>
                        <?php }
                        ?>
                            <div class="">

                    <!-- BEGIN DASHBOARD STATS -->
                    <table  cellpadding="10px" border="1" style="background:none;width:75%;" RULES="ROWS" class="tab_data">
          <thead>

            <th>Employee Name</th>

            <th>Absconding Since</th>


            <th>Absconding Days</th>
            <th>Date and Time of Phone call</th>
            <th>Date of Email Sent</th>
            <th>Supervisor Comments</th>
            <th>Trigger Absconding Alert</th>




          </thead>
         <tbody>

             <?php 

                    $serial_no = 1;
                    $i = 0;
                    foreach($rows as $row){ 
                    $i++;


             ?>
                <tr>

                          <td style="width:10%">
                    <?php echo $row['firstname']; ?>
                  </td>



                    <td><div class="date" data-date="12-02-2012" data-date-format="mm-dd-yyyy" data-date-viewmode="years">
<input placeholder="Requested Last working day" class="col-md-4 form-control " id="startdt" type="text" name="requested_date" value="" required/></td>
          <td style="width:10%">
          <?php echo $row['requested_date']; ?>

                  </td>

                      <td style="width:10%">
                      <?php echo $row['last_status']; ?>

                  </td>

              <td style="width:10%">
              <?php echo $row['date_last_status']; ?>

                  </td>

              <td style="width:10%">
                <?php echo $row['agreed_date']; ?>

                  </td>



<td style="width:10%">
<?php

echo anchor('exits/raise_absconding_trigger/'.$row['userid'],"<button type='button' class='btn btn-primary'>Trigger</button>",array('rel'=>$row->id,'class'=>'edit_row'));
?>
</td>




                 </tr>
            <?php               
                } ?>

        </tbody>
        </table>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/data-tables/DT_bootstrap.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/select2/select2.min.js"></script>

<script>
            $(document).ready(function(){
                $(document).click(function(e){

                    if(($(e.target).parent().attr("class") == 'choose_field_column ') || ($(e.target).parent().hasClass('txt')))
                    {
                    } else {

                        if($(".hidden_fields").is(":visible"))
                        {
                            $(".maximize").show();
                            $(".minimize").hide();
                            $(".hidden_fields").hide();

                        }
                    }
                });
                $(".selectfunction").select2({
                    placeholder: "Select Function",
                    allowClear: true
                });
                    $(".maximize").click(function(){
                        $(this).parent().find(".hidden_fields").show();

                        $('.hidden_fields').click(function(e){
                            e.stopPropagation();
                        })
                            $(this).hide();
                            $(".minimize").show();
                    });
                    $(".minimize").click(function(){

                        $(this).parent().find(".hidden_fields").hide();
                        $('.hidden_fields').click(function(e){
                            e.stopPropagation();
                        })
                            $(this).hide();
                            $(".maximize").show();
                    });

                    function filcheck(chkval){
    if($('#'+chkval).is(':checked')){
        $("#"+chkval).removeAttr('checked');    
    }
    else
    {
        $("#"+chkval).attr ( "checked" ,"checked" );
    }

}
                $(".selectlevel").select2({
                    placeholder: "Select Level",
                    allowClear: true
                });
                $(".selectlocation").select2({
                    placeholder: "Select Location",
                    allowClear: true
                });
                $(".selectsuper").select2({
                    placeholder: "Select Supervisor",
                    allowClear: true
                });
                $(".selectyear").select2({
                    placeholder: "Select Year",
                    allowClear: true
                });


    });
</script>


<script>
/*$(document).ready(function(){
$('#reservation').daterangepicker();
})*/
</script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>


<script>
function parseDate(str) {
var mdy = str.split('/')
return new Date(mdy[2], mdy[0]-1, mdy[1]);
}

function daydiff(first, second) {
return Math.round((second-first)/(1000*60*60*24));
}
$(document).ready(function(){
$("#startdt").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
showButtonPanel: true,
yearRange: "-90:+0",
startDate: new Date(),
autoclose: true
}).on('changeDate', function (selected) {
var minDate = new Date(selected.date.valueOf());
$('#enddt').datepicker('setStartDate', minDate);
});
$("#enddt").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
showButtonPanel: true,
yearRange: "-90:+0"
});
$("#enddt").change(function(){
if($("#startdt").val()!='' && $("#enddt").val()!='')
{
var startdt = $("#startdt").val();
var enddt = $("#enddt").val();
$("#daysleave").val(daydiff(parseDate(startdt), parseDate(enddt)));
if($("#grievance_type").val()!='0')
{

var day_diff_today = daydiff(parseDate($("#today_dt").val()), parseDate($("#startdt").val()));

if(((parseInt($("#daysleave").val()) > parseInt($("#grievance_type option:selected").attr("data-min"))) &&  (parseInt($("#daysleave").val()) < parseInt($("#grievance_type option:selected").attr("data-max"))))&&(day_diff_today > parseInt($("#grievance_type option:selected").attr("data-approvaldays"))))
{ } else {
$("#leaveAllowedModal").modal("show");
}

}
}
})
$("#grievance_type").change(function(){
if($("#startdt").val()!='' && $("#enddt").val()!='' && $("#grievance_type").val()!='0')
{
var day_diff_today = daydiff(parseDate($("#today_dt").val()), parseDate($("#startdt").val()));

if(((parseInt($("#daysleave").val()) > parseInt($("#grievance_type option:selected").attr("data-min"))) &&  (parseInt($("#daysleave").val()) < parseInt($("#grievance_type option:selected").attr("data-max"))))&&(day_diff_today > parseInt($("#grievance_type option:selected").attr("data-approvaldays"))))
{ } else {
$("#leaveAllowedModal").modal("show");
}
}
})
$(".date-picker").datepicker();
$("#optionsRadios1").click(function(){
$("#myLTAModal").modal("show");
})
$('#leaveAllowedModal').on('shown.bs.modal', function() {
var msg = '';
if((parseInt($("#daysleave").val()) > parseInt($("#grievance_type option:selected").attr("data-min"))) &&  (parseInt($("#daysleave").val()) < parseInt($("#grievance_type option:selected").attr("data-max"))))
{ } else {
msg = msg + "You wish you apply "+$("#daysleave").val()+" day of "+$("#grievance_type option:selected").text()+". Minimum and Maximum no. of Leaves allowed to take at a time are "+$("#grievance_type option:selected").attr("data-min")+" and "+$("#grievance_type option:selected").attr("data-max")+" respectively.";
}
var day_diff_today = daydiff(parseDate($("#today_dt").val()), parseDate($("#startdt").val()));
if((day_diff_today < parseInt($("#grievance_type option:selected").attr("data-approvaldays"))))
{
msg = msg + " No. of days of prior approval needed is  " + $("#grievance_type option:selected").attr("data-approvaldays") + " days";
}
$(".allowed_text").html(msg);

})
});


</script>

0 个答案:

没有答案