<div class="content-wrapper"> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col"> <div class="card card-primary card-outline"> <div class="card-header"> <h5 class="m-0"><?php echo $pageTitle; ?></h5> </div> <?php if (isset($_GET['year_selector'])) { $year = $_GET['year_selector']; } else { $year = NepaliYear(); } if (isset($_GET['month_selector'])) { $month = $_GET['month_selector']; } else { $month = NepaliMonth(); } ?> <div class="card-body"> <form class="form"> <div class=" form-group row"> <label for="year_selector">Year</label> <div class="col"> <select name="year_selector" type="year_selector" id="year_selector" class="form-control" required> <option value="<?php echo $year; ?>"><?php echo $year; ?></option> <option value="">Select Year</option> <option value="2077">2077</option> <option value="2078">2078</option> <option value="2079">2079</option> <option value="2080">2080</option> <option value="2081">2081</option> </select> </div> <label for="month_selector">Month</label> <div class="col"> <select name="month_selector" type="month_selector" id="month_selector" class="form-control" required> <option value="<?php echo $month; ?>"><?php echo NepaliMonthNameByNumber($month); ?></option> <option value="">Select Month</option> <option value="1">Baisakh</option> <option value="2">Jestha</option> <option value="3">Ashad</option> <option value="4">Shrawan</option> <option value="5">Bhadra</option> <option value="6">Asoj</option> <option value="7">Kartik</option> <option value="8">Mangsir</option> <option value="9">Poush</option> <option value="10">Magh</option> <option value="11">Falgun</option> <option value="12">Chaitra</option> </select> </div> <div class="col"><input type="submit" class="form-control btn btn-success"></div> </div> </form> <?php $LoggedUser = $this->session->userdata('loggedInUser'); ?> <?php $TableData = $this->db->query("select * from tbl_factorycalendar WHERE day_bs like '%$year-$month-%'")->result(); ?> <table class="table table-bordered table-striped dataTable"> <thead> <tr> <th>Sn</th> <th>AD Date</th> <th>BS Date</th> <th>Weekday</th> <th>Working Day</th> <td>Holiday</th> </tr> </thead> <tbody> <?php $a = 0; foreach ($TableData as $TableRow) : $a++; ?> <?php foreach ($TableRow as $cols) : $id = $cols; break; endforeach; ?><tr> <td><?php echo $a; ?></td> <td><?php echo $TableRow->day_ad; ?></td> <td><?php echo $TableRow->day_bs; ?></td> <td><?php echo $TableRow->day_weekday; ?></td> <td><?php echo $TableRow->day_work; ?></td> <td><?php echo $TableRow->day_holiday; ?></td> <td><?php if ($LoggedUser == "admin") : ?><a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs">Edit</a> <?php endif; ?></td> </tr> <?php endforeach; ?> <tbody> </table> <?php //pre($TableData); ?> <script> function doDelete(id) { if (confirm('Are you sure to delete?')) { window.location = '<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/delete/"); ?>' + id; } } </script> </div> </div> </div> </div> </div> </div> </div> <div class="modal fade" id="showPODetails" tabindex="-1" role="dialog" aria-labelledby="showpoDetails" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="showpoDetails">Setup Factory Calendar</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> </div> <div class="modal-body" id="print_area"> <form method="post" action="<?php echo site_url('ajax/updatefactoryholiday') ?>"> <div class="col"> <div class="form-group"> <label for="po_by">Office Holiday ?</label> <select name="day_work" type="month_selector" id="month_selector" class="form-control" required> <option value="">Select Yes / No</option> <option value="0">Yes</option> <option value="1">No</option> </select> </div> </div> <div class="col"> <div class="form-group"> <label for="po_by">Holiday Name</label> <input type="text" class="form-control" id="billing_name" value="" name="day_holiday"> <input type="hidden" class="form-control" id="day_id" value="" name="day_id"> <input type="hidden" class="form-control" id="a" value="<?php echo $_SERVER['REQUEST_URI']; ?>" name="url"> </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Update</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </form> </div> </div> </div> </div> <script> function showDetails(id) { // alert(poid); $.id = id; $('#day_id').val(id) $('#showPODetails').modal(); // alert($.bill_id); } </script>