 
<?php $__env->startSection('title', 'Form Components'); ?>
<?php $__env->startSection('content'); ?>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css"/>  
  <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">  
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
  <link href='https://fonts.googleapis.com/css?family=Josefin Sans' rel='stylesheet'>
<?php
    $adminuserid = auth()->user()->id;
    $adminstatecode = auth()->user()->state_code;
    $admindistcode = auth()->user()->dist_code;
    $adminname = auth()->user()->name;
    $adminserialno = auth()->user()->serial_number;
    
    $matformdata = DB::table('master_fields_table')->where('form_name','=','mat_form_monthly')->where('section_name','=','main_section')->where('status','=','1')->get();
    
    $getsernodata = DB::table('mat_form_entry')->get();
    
    $ostcnamelist = DB::table('mat_form_monthly_entry')->select('nameostc')->groupBy('nameostc')->get();
    
?>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">
    
    <div class="container-fluid" style="font-family:'Josefin Sans';">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-edit bg-blue"></i>
                        <div class="d-inline">
                            <h5><?php echo e(__('MAT - Monthly Entry')); ?></h5>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="<?php echo e(route('dashboard')); ?>"><i class="ik ik-home"></i></a>
                            </li>
                            <li class="breadcrumb-item"><a href="#"><?php echo e(__('Forms')); ?></a></li>
                        </ol>
                    </nav>
                </div>
                <?php if(session()->has('errormsg')): ?>
                    <div class="alert alert-danger" style='margin-left: 1%;
    margin-top: 25px;'>
                        <?php echo e(session()->get('errormsg')); ?>

                    </div>
                <?php endif; ?>
            </div>
        </div>

        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <!--<div class="card-header"><h3><?php echo e(__('Mat Form2')); ?></h3></div>-->
                    <div class="card-body">
                        <form class="forms-sample" method='POST' <?php if(!empty($showdata)): ?> action='<?php echo e(url('updatematmonthly')); ?>' <?php else: ?> action='<?php echo e(url('matmonthlyinsert')); ?>' <?php endif; ?> name='matmaster'>
                            <?php echo csrf_field(); ?>
                            
                            <?php if(!empty($showdata)): ?>
                            <input type='hidden' name='matformmonthlyid' value='<?php echo e($showdata[0]->id); ?>'>
                            <?php endif; ?>
                            
                            <div class="form-group">
                                <label for="uidnum"><?php echo e($matformdata[1]->questions); ?></label>
                                <select name='uidnum' id='uidnum' class='form-control' required>
                                    <option value=""><?php echo e(__('Select UID No')); ?></option>
                                    <?php $__currentLoopData = $getsernodata; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $getserno): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    
                                    <?php 
                                    $getdeathcount = DB::table('mat_form_entry')->where('state_code',$getserno->state_code)->where('dist_code',$getserno->dist_code)->where('uidnum',$getserno->uidnum)->where('currentostc','Death')->count();
                                    ?>
                                    <?php if($getdeathcount == 0): ?>
                                    <option class='uidnum' value='<?php echo e($getserno->id); ?>' data-uid='<?php echo e($getserno->uidnum); ?>' <?php if(!empty($showdata)): ?> <?php echo e($showdata[0]->uidnum == $getserno->uidnum ? 'selected' : ''); ?>  <?php endif; ?>><?php echo $getserno->state_code.'-'.$getserno->dist_code.'-' ?><?php echo e($getserno->uidnum); ?></option>
                                    <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <input type='hidden' name='clientregdate' id='clientregdate' value=''>
                            <div class="form-group">
                                <label for="dateofentry"><?php echo e($matformdata[0]->questions); ?></label>
                                <div class='input-group date datetimepicker' >
                                    <input type='text' id='matregdate' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->dateofentry); ?>' <?php endif; ?> class="form-control" name="dateofentry" placeholder="yyyy-mm-dd" />
                                    <span class="input-group-addon">
                                      <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                                <span id="check-date" style='color:red;'></span>
                            </div>
                            <div class="form-group">
                                <label for="clientname"><?php echo e($matformdata[2]->questions); ?></label>
                                <input style="text-transform: uppercase" type="text" class="form-control" id="clientname" name='clientname' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->clientname); ?>' <?php } ?> placeholder="Enter Client Name" readonly>
                            </div>
                            <div class="form-group">
                                <label for="ostregno"><?php echo e($matformdata[3]->questions); ?></label>
                                <input style="text-transform: uppercase" type="text" class="form-control" id="ostregno" name='ostregno' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->ostregno); ?>' <?php } ?>  readonly>
                            </div>
                            <div class="form-group">
                                <label for="nameostc"><?php echo e($matformdata[4]->questions); ?></label>
                                <input style="text-transform: uppercase" type='text' list='ostcname' name='nameostc' id='nameostc' class='form-control' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->nameostc); ?>' <?php } ?>>
                                <datalist id="ostcname">
                                    <?php foreach($ostcnamelist as $ostcnl){ ?>
                                        <option value="<?php echo $ostcnl->nameostc; ?>" ><?php echo $ostcnl->nameostc; ?></option>
                                    <?php } ?>
                                </datalist>
                            </div>
                            <div class="form-group">
                                <label for="typemedicine"><?php echo e($matformdata[5]->questions); ?></label>
                                <select style="text-transform: uppercase" name='typemedicine'  class='form-control' value='Select Option'>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php 
                                        $namemedicines = explode('|',$matformdata[5]->answer);
                                    foreach($namemedicines as $namemedicine){ ?>
                                     <option style="text-transform: uppercase" value='<?php echo $namemedicine; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->typemedicine == $namemedicine ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $namemedicine; ?></option>
                                     <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="oststatus"><?php echo e($matformdata[6]->questions); ?></label>
                                <select style="text-transform: uppercase" name='oststatus' class='form-control' id='oststatus' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php 
                                        $oststatuss = explode('|',$matformdata[6]->answer);
                                    foreach($oststatuss as $oststatus){ ?>
                                     <option style="text-transform: uppercase" value='<?php echo $oststatus; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->oststatus == $oststatus ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $oststatus; ?></option>
                                     <?php } ?>
                                </select>
                            </div>
                            <div class="form-group q3a">
                                <label for="lstatusdate"><?php echo e($matformdata[21]->questions); ?></label>
                                <div class='input-group date datetimepicker' >
                                    <input type='text' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->dropoutdate); ?>' <?php endif; ?> class="form-control" id="dropoutdate" name="dropoutdate" placeholder="yyyy-mm-dd" />
                                    <span class="input-group-addon">
                                      <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="form-group q4">
                                <label for="commentoststatus"><?php echo e($matformdata[7]->questions); ?></label>
                                <input style="text-transform: uppercase" type="text" class="form-control" id="commentoststatus" name='commentoststatus' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->commentoststatus); ?>' <?php } ?>>
                            </div>
                            <div class="form-group">
                                <label for="restartost"><?php echo e($matformdata[20]->questions); ?></label><br/>
                               <?php $restartost = explode('|',$matformdata[20]->answer); ?>
                                <?php foreach($restartost as $receivehomeost){ ?>
                                        <input type='radio' class='restartost' id='restartost' value="<?php echo $receivehomeost; ?>"  name="restartost" <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->receivehomeost == $restartost)? "checked" : ""); ?> <?php endif; ?>><?php echo $receivehomeost; ?>
                                <?php } ?>
                            </div>
                            <div class="form-group q5a">
                                <label for="daterestartost"><?php echo e($matformdata[8]->questions); ?></label>
                                <div class='input-group date datetimepicker' >
                                    <input type='text' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->daterestartost); ?>' <?php endif; ?> class="form-control" name="daterestartost" placeholder="yyyy-mm-dd" />
                                    <span class="input-group-addon">
                                      <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="form-group q6">
                                <label for="receivehomeost"><?php echo e($matformdata[9]->questions); ?></label><br/>
                               <?php $receivehomeosts = explode('|',$matformdata[9]->answer); ?>
                                <?php foreach($receivehomeosts as $receivehomeost){ ?>
                                        <input type='radio' class='receivehomeost' value="<?php echo $receivehomeost; ?>"  name="receivehomeost" <?php if(!empty($showdata)): ?><?php echo e(($showdata[0]->receivehomeost == $receivehomeost)? "checked" : ""); ?> <?php endif; ?>><?php echo $receivehomeost; ?>
                                <?php } ?>
                            </div>
                            <div class="form-group totaldaysost q7">
                                <label for="totaldaysost"><?php echo e($matformdata[10]->questions); ?></label>
                                <input style="text-transform: uppercase" type="number" max='30' class="form-control" id="totaldaysost" name='totaldaysost' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->totaldaysost); ?>' <?php } ?>>
                            </div>
                            <div class="form-group q8">
                                <label for="clinicalcond"><?php echo e($matformdata[11]->questions); ?></label>
                                <select style="text-transform: uppercase" name='clinicalcond' id='clinicalcond'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $clinicalconds = explode('|',$matformdata[11]->answer); ?>
                                    
                                    <?php foreach($clinicalconds as $clinicalcond){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $clinicalcond; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->clinicalcond == $clinicalcond ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $clinicalcond; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group q9">
                                <label for="clinicalcond2"><?php echo e($matformdata[12]->questions); ?></label>
                                <select style="text-transform: uppercase" name='clinicalcond2' id='clinicalcond2'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $clinicalconds2 = explode('|',$matformdata[12]->answer); ?>
                                    
                                    <?php foreach($clinicalconds2 as $clinicalcond2){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $clinicalcond2; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->clinicalcond2 == $clinicalcond2 ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $clinicalcond2; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group q10">
                                <label for="clinicalcond3"><?php echo e($matformdata[13]->questions); ?></label>
                                <select style="text-transform: uppercase" name='clinicalcond3' id='clinicalcond3'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $clinicalconds3 = explode('|',$matformdata[13]->answer); ?>
                                    
                                    <?php foreach($clinicalconds3 as $clinicalcond3){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $clinicalcond3; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->clinicalcond3 == $clinicalcond3 ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $clinicalcond3; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="otherclinicalcond"><?php echo e($matformdata[14]->questions); ?></label>
                                <input style="text-transform: uppercase" type="text" class="form-control" id="otherclinicalcond" name='otherclinicalcond' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->otherclinicalcond); ?>' <?php } ?> >
                            </div>
                            <div class="form-group">
                                <label for="commonclinicalissue"><?php echo e($matformdata[15]->questions); ?></label>
                                <select style="text-transform: uppercase" name='commonclinicalissue'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $commonclinicalissues = explode('|',$matformdata[15]->answer); ?>
                                    
                                    <?php foreach($commonclinicalissues as $commonclinicalissue){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $commonclinicalissue; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->commonclinicalissue == $commonclinicalissue ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $commonclinicalissue; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="otherclinicalissue"><?php echo e($matformdata[16]->questions); ?></label>
                                <input style="text-transform: uppercase" type="text" class="form-control" id="otherclinicalissue" name='otherclinicalissue' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->otherclinicalissue); ?>' <?php } ?>  required>
                            </div>
                            <div class="form-group">
                                <label for="creferedformedical"><?php echo e($matformdata[17]->questions); ?></label>
                                <select style="text-transform: uppercase" name='creferedformedical'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $creferedformedicals = explode('|',$matformdata[17]->answer); ?>
                                    
                                    <?php foreach($creferedformedicals as $creferedformedical){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $creferedformedical; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->creferedformedical == $creferedformedical ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $creferedformedical; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="otherharmreduction"><?php echo e($matformdata[18]->questions); ?></label>
                                <select style="text-transform: uppercase" name='otherharmreduction'  class='form-control' value=''>
                                    <option><?php echo e(__('SELECT')); ?></option>
                                    <?php $otherharmreductions = explode('|',$matformdata[18]->answer); ?>
                                    
                                    <?php foreach($otherharmreductions as $otherharmreduction){ ?>
                                            <option style="text-transform: uppercase" value='<?php echo $otherharmreduction; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->otherharmreduction == $otherharmreduction ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $otherharmreduction; ?></option>
                                            
                                        <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="remarks"><?php echo e($matformdata[19]->questions); ?></label>
                                <input style="text-transform: uppercase" type='text' <?php if(!empty($showdata)): ?> value='<?php echo e($showdata[0]->remarks); ?>' <?php endif; ?> class="form-control" name="remarks" />
                            </div>
                            
                            
                            <br><br>
                            <button type="submit" class="btn btn-primary mr-2"><?php echo e(__('Submit')); ?></button>
                            <?php if(empty($showdata)): ?>
                            <a href='<?php echo e('mat-form-monthly-data'); ?>' class="btn btn-light"><?php echo e(__('Cancel')); ?></a>
                            <?php endif; ?>
                          </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>

    <script type="text/javascript">
        $(function() {
            var default_date=  new Date();
            $('.datetimepicker').datetimepicker({  
               format: 'YYYY-MM-DD', 
                useCurrent:false, 
                maxDate: new Date(),
                defaultDate: default_date
            });
            
            $(".q3a").hide();
            var oststatus = $("#oststatus option:selected").val();
            if(oststatus == "3. Dropped out " || oststatus == "5. Transferred out " || oststatus == "6. Imprisonment")
            {
                $(".q3a").show();
            }
            else
            {
                $(".q3a").hide();
            }
            
            if(oststatus == "1. On OST ")
            {
                $(".q4").hide();
                $(".q5a").hide();
            }
            else
            {
                $(".q4").show();
                $(".q5a").show();
            }
            
            var restartost = $('input[name=restartost]:checked').val();
            if(restartost == "1) Yes")
            {
                $(".q5a").show();
                $(".q6").hide();
                $(".q7").hide();
                $(".q8").hide();
                $(".q9").hide();
                $(".q10").hide();
                $(".q11").hide();
            }
            else
            {
                $(".q5a").hide();
                $(".q6").show();
                $(".q7").show();
                $(".q8").show();
                $(".q9").show();
                $(".q10").show();
                $(".q11").show();
            }
        });
        
        $('#uidnum').on("change",function(){
            var uidnumber = $("#uidnum option:selected").val();
            //var uidnumber = $(this).find(':selected').data('uid')
            //alert(uidnumber);
            
            $.ajax({
                type: "POST",
                url: "<?php echo e(url('getuidmatdata')); ?>",
                data: {uidnumber:uidnumber, _token: '<?php echo e(csrf_token()); ?>' },
                dataType: "json",
                success: function(data) { 
                    console.log(data.serialdata);
                    $('#clientname').val(data.serialdata[0]['clientname']);
                    $('#ostregno').val(data.serialdata[0]['ostregno']);
                    $('#nameostc').val(data.serialdata[0]['ostcname']);
                    $('#clientregdate').val(data.serialdata[0]['dateofentry']);
                },
                error: function (jqXHR, exception) {
    
                }
            });
        });
        
        $('#oststatus').on("change",function(){
            var oststatus = $("#oststatus option:selected").val();
            if(oststatus == "3. Dropped out " || oststatus == "5. Transferred out " || oststatus == "6. Imprisonment ")
            {
                $(".q3a").show();
            }
            else
            {
                $(".q3a").hide();
            }
            
            if(oststatus == "1. On OST ")
            {
                $(".q4").hide();
                $(".q5a").hide();
            }
            else
            {
                $(".q4").show();
                $(".q5a").show();
            }
        });
        $(".q5a").hide();
        $("input[name=restartost]").change(function(){
            var restartost = $('input[name=restartost]:checked').val();
            if(restartost == "1) Yes")
            {
                $(".q5a").show();
                $(".q6").hide();
                $(".q7").hide();
                $(".q8").hide();
                $(".q9").hide();
                $(".q10").hide();
                $(".q11").hide();
            }
            else
            {
                $(".q5a").hide();
                $(".q6").show();
                $(".q7").show();
                $(".q8").show();
                $(".q9").show();
                $(".q10").show();
                $(".q11").show();
            }
        });
            
        $('#clinicalcond').on("change",function(){
            $('#clinicalcond2 option').each(function(index,item){
                $(item).css('display','block');
            })
            $('#clinicalcond3 option').each(function(index,item){
                $(item).css('display','block');
            })
            var clinicalcond = $("#clinicalcond option:selected").val();
            var clinicalcond2 = $("#clinicalcond2 option:selected").val();
            var clinicalcond3 = $("#clinicalcond3 option:selected").val();
            $("#clinicalcond2 option[value='"+clinicalcond+"']").css('display','none');
            $("#clinicalcond2 option[value='"+clinicalcond3+"']").css('display','none');
            $("#clinicalcond3 option[value='"+clinicalcond+"']").css('display','none');
            $("#clinicalcond3 option[value='"+clinicalcond3+"']").css('display','none');
        });
        $('#clinicalcond2').on("change",function(){
            $('#clinicalcond3 option').each(function(index,item){
                $(item).css('display','block');
            })
            $('#clinicalcond option').each(function(index,item){
                $(item).css('display','block');
            })
            var clinicalcond = $("#clinicalcond option:selected").val();
            var clinicalcond2 = $("#clinicalcond2 option:selected").val();
            var clinicalcond3 = $("#clinicalcond3 option:selected").val();
            $("#clinicalcond3 option[value='"+clinicalcond2+"']").css('display','none');
            $("#clinicalcond3 option[value='"+clinicalcond+"']").css('display','none');
            $("#clinicalcond option[value='"+clinicalcond2+"']").css('display','none');
            $("#clinicalcond option[value='"+clinicalcond3+"']").css('display','none');
        });
        $('#clinicalcond3').on("change",function(){
            $('#clinicalcond2 option').each(function(index,item){
                $(item).css('display','block');
            })
            $('#clinicalcond option').each(function(index,item){
                $(item).css('display','block');
            })
            var clinicalcond3 = $("#clinicalcond3 option:selected").val();
            var clinicalcond2 = $("#clinicalcond2 option:selected").val();
            var clinicalcond = $("#clinicalcond option:selected").val();
            $("#clinicalcond2 option[value='"+clinicalcond3+"']").css('display','none');
            $("#clinicalcond2 option[value='"+clinicalcond+"']").css('display','none');
            $("#clinicalcond option[value='"+clinicalcond3+"']").css('display','none');
            $("#clinicalcond option[value='"+clinicalcond2+"']").css('display','none');
        });
        $( "#matregdate" ).blur(function() { 
            var regdate = $('#clientregdate').val();
            var matregdate = $('#matregdate').val();
            
            strx   = matregdate.split('-');
            array  = [];
            dateArray = array.concat(strx);
            var year = dateArray[0];
            var month = dateArray[1];
            
            var days = function(month,year) {
                return new Date(year, month, 0).getDate();
            };
      
            var totaldays = days(month, year);
            $('#totaldaysost').attr('max',totaldays);
            
            var d1 = new Date(regdate);
            var d2 = new Date(matregdate);
            
            // console.log(d1.getTime() > d2.getTime())
            if(d1.getTime() > d2.getTime()){
                $('#check-date').text('Data Entry date can not be lesser then client registration date');
                $('#matregdate').val('');
            }else{
                $('#check-date').text('');
            }
            
            var uidnumber = $("#uidnum option:selected").val();
            $.ajax({
                type: "POST",
                url: "<?php echo e(url('checkmatmonthly')); ?>",
                data: {month:month,uidnumber:uidnumber, _token: '<?php echo e(csrf_token()); ?>' },
                dataType: "json",
                success: function(res) { 
                    console.log(res);
                    if(res.exists == true){
                        alert('MAT Monthly Service was Provided');
                    }
                },
                error: function (jqXHR, exception) {
    
                }
            });
        });
        
        $(document).ready(function() {
            $("input[name$='receivehomeost']").click(function() {
                var test = $(this).val();
                if(test == ' 2. No'){
                    $(".totaldaysost").hide();
                }else{
                   $("#totaldaysost").val("");
                   $(".totaldaysost").show();
                }
            });
        });
        
        $(window).load(function(){
            var test1 = $("input[name$='receivehomeost']:checked").val();
                if(test1 == ' 2. No'){
                    $(".totaldaysost").hide();
                } 
        });
        
    </script> 
    
    <!-- push external js -->
    <?php $__env->startPush('script'); ?>
        <script src="<?php echo e(asset('js/form-components.js')); ?>"></script>
    <?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/viruxyz/public_html/ejaf/resources/views/pages/mat-form-monthly.blade.php ENDPATH**/ ?>