<?php
/*----include header file----*/
require_once APPPATH."/views/common/header.php"; ?>


<?php //debug($list_costcenter,1); ?>
    <div class="boxLwd">
        <h2>Filters</h2>        
        <div class="row LwdButtons">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 addNewButton">
                <button class="btn thumbnail" type="button" onclick="return add_costcenter_modal()">Add New</button>
                <button class="btn btn-default" type="button"  data-toggle="modal" data-target="#lightboxPopup">Export</button>
            </div>
        </div>
        
        
        <div class="row tableLWD">
            <table id="example" class="table table-striped table-bordered" width="98%" cellpadding="1" cellspacing="1">
                <thead>
                    <tr>
                        <th>Number</th>
                        <th>Cost Center</th>
                        <th style="display: none"></th>
                        <th>Contract Area</th>
                        <th>Office</th>
                        <th>No. of LWD's</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                <?php
                    if( !empty( $list_costcenter ) ):
                        for( $i=0; $i<count($list_costcenter); $i++ ):
                ?>
                    <tr>
                        <td><?= $list_costcenter[$i]['costcenter_id']; ?></td>
                        <td><?= ucfirst( $list_costcenter[$i]['costcenter_name'] ); ?></td>
                        <td style="display: none;"><?= $list_costcenter[$i]['create_date']; ?></td>
                        <td><?= $list_costcenter[$i]['costcenter_count']; ?></td>
                        <td>0</td>
                        <td>0</td>
                        <td>
                            <select data-cost_id="<?= $list_costcenter[$i]['costcenter_id']; ?>" name="status" class="status custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left ui-autocomplete-input">
                                <option value="0" <?php if( $list_costcenter[$i]['status'] == 0 ) { echo 'selected'; } ?> >Pending</option>
                                <option value="1" <?php if( $list_costcenter[$i]['status'] == 1 ) { echo 'selected'; } ?>>Inactive</option>
                                <option value="2" <?php if( $list_costcenter[$i]['status'] == 2 ) { echo 'selected'; } ?>>Active</option>
                            </select>
                        </td>
                        <td><a href="javascript:void(0)" onclick="return editing_costcenter('<?= $list_costcenter[$i]['costcenter_id']; ?>','<?=  $list_costcenter[$i]['costcenter_name']  ?>');" >Edit</a> <!--<a href="#">View</a>--></td>
                    </tr>

                        <?php 
                        endfor;
                    endif;
                ?>  
                </tbody>
            </table>
            
        </div>        
   </div>
</div>
</div>

<!-- modal for adding cost center -->
<div id="lightbox" class="modal fade lightboxCost" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <button type="button" class="close cancel" aria-hidden="true">×</button>
		<button type="button" class="close closepopup" style="display:none;" data-dismiss="modal" aria-hidden="true">×</button>
        <div class="modal-content">
            <div class="modal-body">
            
            <div class="row">
            <div class="col-lg-12">
                <h2>Cost Service</h2>
            </div>
            </div>
           
            <form id="add_costcenter">
            <div class="ajax_msg"></div>
             <div class="row lighboxInner">
            	<div class="col-lg-12">
                    <div class="form-group label-floating">
                            <label class="control-label">Cost Service Name</label>
                            <input type="hidden" name="costcenterID" id="costcenterID">
                            <input type="text" class="form-control fullNameField" id="cc_name" name="cc_name[]" required="">
                    </div>
                     <a href="javascript:void(0);" data-form="costcenter" class="addMoreDiv"><img src="/img/addIcon.svg"></a>
                </div>
                
             </div>
             <div class="add_more_fields"></div>
 
             <div class="row lighboxInner">
	              	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 pull-right">
                        <button class="btn btn-default cancel" type="cancel" value="Cancel">Cancel</button>
                        <button class="btn btn-default" type="submit" value="Save">Save</button>
                        
		            </div>
	         </div>
	       </form>
            </div>
        </div>
    </div>
</div>

<div id="lightboxPopup" class="modal fade lightboxCost lightboxPopup" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <button type="button" class="close cancel" data-dismiss="modal" aria-hidden="true">×</button>
		<button type="button" class="close closepopup" style="display:none;" data-dismiss="modal" aria-hidden="true">×</button>
        <div class="modal-content">
            <div class="modal-body">
           
            <form id="add_costcenter2">
            <div class="ajax_msg"></div>
            <div class="row lighboxInner">
                <div class="col-lg-12">
                    <img src="http://54.218.78.31:50//img/TickGif.gif">
                </div>
            </div>
            
             <div class="row lighboxInner">
                <div class="col-lg-12">
                    <p>Lorem Ipsum Dolor</p>
                </div>
            </div>
            
             <div class="add_more_fields"></div>
 
           
	       </form>
            </div>
        </div>
    </div>
</div>

<?php require_once APPPATH."/views/common/footer.php"; ?>