<?php $__env->startSection('content'); ?>
    
    <div class="container-fluid">
        <div class="page-titles">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(URL::to('/facility')); ?>">Facility</a></li>
                <li class="breadcrumb-item active"><a href="javascript:void(0)">Layout</a></li>
            </ol>
        </div>
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-primary">
                        <div class="card-body">
                            <form id="organisation_form" class="form-horizontal" action="<?php echo e(URL::to('/seat_layout_post')); ?>" method="post" onsubmit="return validation();" autocomplete="off" enctype="multipart/form-data">
                                <?php echo e(csrf_field()); ?>

                                <div class="card bg-light">
                                    <div class="card-header">
                                        <h5 class="card-title"><?php echo e($facilities->facility_name); ?></h5>
                                    </div>
                                    <div class="card-body mb-0">
                                        <p class="card-text">
                                            <b>Organisation Name :</b> <?php echo e($facilities->organisation->organisation_name); ?><br>
                                            <b>Number of Seats :</b> <?php echo e($facilities->noofseats); ?><br>
                                        </p>
                                        <input type="hidden" name="facility_id" id="facility_id" value="<?php echo e($facilities->id); ?>">
                                        <input type="hidden" name="layout_id" id="layout_id" value="<?php echo e($layout_id); ?>">
                                    </div>
                                </div>

                                <?php if(isset($layouts)): ?>
                                    <?php
                                        $total_row = $layouts->total_row;
                                        $maxinarow = $layouts->maxinarow;
                                        $maxseats = $layouts->maxseats;
                                    ?>
                                <?php endif; ?>
                                <div class="card-body">
                                <?php
                                
                                for($i=1;$i<=$total_row;$i++)
                                {
                                    $row_name_save ="";
                                    if($i%2==0)
                                    {
                                        $color = "#ccc";
                                    }
                                    else
                                    {
                                        $color = "#edf5ef";
                                    }
                                    if(isset($rowname[$i]))
                                    {
                                        if($rowname[$i]!="")
                                        {
                                            $row_name_save = $rowname[$i];
                                        }
                                        else
                                        {
                                            $row_name_save = "";
                                        }
                                    }
                                    ?>
                                    
                                        <div class="row" style="background-color: <?php echo e($color); ?> ">
                                            <div class="col-0.5" style="margin:10px;">Row # : <?php echo e($i); ?>

                                                <input type="hidden" name="total_row" id="total_row" value="<?php echo e($total_row); ?>">
                                                <input type="hidden" name="maxinarow" id="maxinarow" value="<?php echo e($maxinarow); ?>">
                                            </div>
                                            <div class="col-2" style="margin:10px;">
                                                <input type="text" style="height: 30px !important;" class="form-control input-xs mb-1" name="row_name<?php echo e($i); ?>" id="row_name<?php echo e($i); ?>" placeholder="Row Name" value="<?php echo e($row_name_save); ?>">
                                            </div>
                                            <?php
                                                for($seat=1;$seat<=$maxinarow;$seat++)
                                                {   
                                                    $seat_number= "";
                                                    $seat_name ="";
                                                    $spl_flag ="";
                                                    $seatlayoutid ="";
                                                    if(isset($seatname[$i][$seat]))
                                                    {
                                                        if($seatname[$i][$seat]!="")
                                                        {
                                                            $seat_name = $seatname[$i][$seat];
                                                        }
                                                        else
                                                        {
                                                            $seat_name = "";
                                                        }
                                                    }
                                                    if(isset($seatno[$i][$seat]))
                                                    {
                                                        if($seatno[$i][$seat]!="")
                                                        {
                                                            $seat_number = $seatno[$i][$seat];
                                                        }
                                                        else
                                                        {
                                                            $seat_number = "";
                                                        }
                                                    }
                                                    if(isset($special_flag[$i][$seat]))
                                                    {
                                                        if($special_flag[$i][$seat]!="")
                                                        {
                                                            $spl_flag = $special_flag[$i][$seat];
                                                        }
                                                        else
                                                        {
                                                            $spl_flag = "";
                                                        }
                                                    }
                                                    if(isset($seat_layout_id[$i][$seat]))
                                                    {
                                                        if($seat_layout_id[$i][$seat]!="")
                                                        {
                                                            $seatlayoutid = $seat_layout_id[$i][$seat];
                                                        }
                                                        else
                                                        {
                                                            $seatlayoutid = "";
                                                        }
                                                    }
                                                    ?> 
                                                                                                             
                                                    <div class="col-2" style="margin:10px;">
                                                        <input type="text" style="height: 30px !important;" class="form-control input-xs mb-1" name="<?php echo e($i); ?>seat_number<?php echo e($seat); ?>" id="<?php echo e($i); ?>seat_number<?php echo e($seat); ?>" placeholder="Seat Number" value="<?php echo e($seat_number); ?>">
                                                        <input type="text" style="height: 30px !important;" class="form-control input-xs mb-1" name="<?php echo e($i); ?>seat_name<?php echo e($seat); ?>" id="<?php echo e($i); ?>seat_name<?php echo e($seat); ?>" placeholder="Seat Name" value="<?php echo e($seat_name); ?>">
                                                        <?php if($spl_flag!=""): ?>
                                                            <input type="checkbox" checked="checked" name="<?php echo e($i); ?>special_flag<?php echo e($seat); ?>" id="<?php echo e($i); ?>special_flag<?php echo e($seat); ?>" data-toggle="toggle" data-on="Special" data-off="Normal" data-onstyle="success" data-offstyle="danger" data-size="xs" data-style="ios" value="1">
                                                        <?php elseif($spl_flag==""): ?>
                                                            <input type="checkbox" name="<?php echo e($i); ?>special_flag<?php echo e($seat); ?>" id="<?php echo e($i); ?>special_flag<?php echo e($seat); ?>" data-toggle="toggle" data-on="Special" data-off="Normal" data-onstyle="success" data-offstyle="danger" data-size="xs" data-style="ios" value="1">
                                                        <?php endif; ?>
                                                        <input type="hidden" style="height: 30px !important;" class="form-control input-xs mb-1" name="<?php echo e($i); ?>seat_layout_id<?php echo e($seat); ?>" id="<?php echo e($i); ?>seat_layout_id<?php echo e($seat); ?>" value="<?php echo e($seatlayoutid); ?>">
                                                    </div>
                                                    
                                                    <?php
                                                }
                                            ?>
                                        </div>
                                        <div class="card-footer d-sm-flex justify-content-between align-items-center"></div>
                                <?php
                                }
                                ?>
                                </div>
                                <div class="card-footer">
                                    <button type="submit" class="btn btn-primary">Submit</button>
                                </div>
                            </form>
                        </div> 
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="application/javascript">
        $(document).ready(function() {
            toastr.options.timeOut = 10000;
            <?php if(Session::has('error')): ?>
                toastr.error('<?php echo e(Session::get('error')); ?>');
            <?php elseif(Session::has('success')): ?>
                toastr.success('<?php echo e(Session::get('success')); ?>');
            <?php endif; ?>
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.default', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/ksstmprod/resources/views/Facility/seat_layout.blade.php ENDPATH**/ ?>