<?php $this->load->view("includes/head"); ?>

<body class="wide">

    <!-- Header -->
    <?php $this->load->view("includes/header"); ?>
    <!-- END: Header -->

    <!--Start breadcrumb Style1-- 
    <section class="breadcrumb-style1">
        <div class="breadcrumb-style1-bg" style="background-image: url(<?php echo base_url() . "public/"; ?>assets/images/breadcrumb/breadcrumb-1.jpg);">
            <div class="breadcrumb-style1-bg__overlay"></div>
        </div>
        <div class="container">
            <div class="inner-content">
                <div class="title">
                    <h2><?php if ($this->session->province == 17) { //for Milton 
                        ?> Milton <?php } ?>
                        <?php if ($this->session->province == 9) { //for Burlington 
                        ?> Burlington <?php } ?>
                        <?php if ($this->session->province == 5) { //for Oakville  
                        ?> Oakville <?php } ?>
                        Packages</h2>
                </div>
                <div class="breadcrumb-menu">
                    <ul class="clearfix">
                        <li><a href="<?php echo base_url(); ?>">Home</a></li>
                        <li><span class="icon-next"></span></li>
                        <li class="active">Packages</li>
                    </ul>
                </div>
            </div>
        </div>
    </section>
    <!--End breadcrumb Style1-->
	
	<div class="page-hd">
	 
		<img src="<?php echo base_url() . "public/"; ?>assets/images/breadcrumb/breadcrumb-1.jpg" alt>
		 
	</div>

    <section class="package-style1">
        <div class="container">
            <div class="sec-title text-center">
                <div class="sub-title">
                    <h4>
                        <?php if ($this->session->province == 17) { //for Milton 
                        ?> Milton <?php } ?>
                        <?php if ($this->session->province == 9) { //for Burlington
                        ?> Burlington <?php } ?>
                        <?php if ($this->session->province == 5) { //for Oakville  
                        ?> Oakville <?php } ?>

                        Packages</h4>
                </div>
                <h2>Select Your Perfect Package</h2>
            </div>


            <!--New -->

            <div class="row">
                <?php
                foreach ($biggerPackages as $biggerPackage) {
                ?>
                    <div class="col-md-4 col-lg-4">
					
					<!--new -->
					
					<div class="package-card  wow fadeInUp" data-wow-delay='500ms'>
	                            <div class="package-card__head">
	                                <div class="package-card__head__item">
	                                    <span class="package-card__head__item__price"> 
										<!-- <?php
                                        if ($biggerPackage->offer_price > 0) {
                                        ?>
                                            <sub><sup>$</sup><?php echo $biggerPackage->offer_price; ?></sub> /
                                        <?php
                                        }
                                        ?>-->
                                        <sup>$</sup><?php echo $biggerPackage->price; ?><span class="package-card__head__item__name">+ HST</span></span>
	                                    <p class="package-card__head__item__name">(Certification fees included)</p>

	                                    <div class="package-card__head__item__shape__one">
	                                        <svg width="90" height="95" viewBox="0 0 90 95" fill="none" xmlns="http://www.w3.org/2000/svg">
	                                            <path d="M90 -0.000350952L0 69.6066L90 94.9996V-0.000350952Z" fill="" fill-opacity="0.06" />
	                                        </svg>
	                                    </div> 
	                                    <div class="package-card__head__item__shape__two">
	                                        <svg width="60" height="64" viewBox="0 0 60 64" fill="none" xmlns="http://www.w3.org/2000/svg">
	                                            <path d="M0.789585 63.2843L59.4571 16.7158L0.00060816 0.747339L0.789585 63.2843Z" fill="" fill-opacity="0.06" />
	                                        </svg>
	                                    </div> 
	                                </div> 
	                                <div class="package-card__head__shape"></div> 
	                            </div> 

	                            <div class="package-card__body">
	                                <h3 class="package-card__body__title"><?php echo $biggerPackage->package_name; ?></h3> 
									
									
									
	                                <ul class="package-card__body__list">
	                                    <?php echo $biggerPackage->description; ?>
	                                </ul> 
	                                <div class="package-card__body__btn text-center">
	                                    <a href="<?php echo base_url() . "registration/" . $biggerPackage->id; ?>" class="drivschol-btn">Register Online</a>
	                                </div> 
	                            </div> 
	                        </div>
					
					
					
					<!--new -->
					
					
					
					
					
					
					
                        <!--<div class="single-package-style1">
                            <div class="title-box">
                                <h3><?php echo $biggerPackage->package_name; ?></h3>
                            </div>
                            <div class="img-box">
                                <div class="inner">
                                    <?php
                                    if ($biggerPackage->image != "") {
                                    ?>
                                        <img src="<?php echo base_url() . "uploads/packages/" . $biggerPackage->image; ?>" alt="<?php echo $biggerPackage->package_name; ?>">
                                    <?php
                                    }
                                    ?>
                                </div>
                                <div class="value-box">
                                    <h2>
                                        <?php
                                        if ($biggerPackage->offer_price > 0) {
                                        ?>
                                            <sub><sup>$</sup><?php echo $biggerPackage->offer_price; ?></sub> /
                                        <?php
                                        }
                                        ?>
                                        <sup>$</sup><?php echo $biggerPackage->price; ?>
                                    </h2>
                                </div>
                            </div>
                            <div class="content-over">
                                <div class="content-box">
                                   
                                        <h5><strong>Plus(+) MTO Certification Fee & HST</strong></h5>
                                    
                                    <ul class="list-item clearfix">
                                        <?php echo $biggerPackage->description; ?>
                                    </ul>
                                    <div class="btn-box">
                                        <a class="btn-one" href="<?php echo base_url() . "registration/" . $biggerPackage->id; ?>">
                                            <span class="txt">
                                                Register Online
                                            </span>
                                        </a>
                                    </div>
                                    <div class="text-box text-center">
                                        <a href="faq">
                                            <h6>Terms & Conditions</h6>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div> -->
						
						
						
						
						
						
						
						
						
                    </div>

                <?php } ?>

            </div>

            <!--New -->

        </div>
    </section>

    <div class="container p-t-40 p-r-40">

        <?php
        if (!empty($general_packages)) {
            foreach ($general_packages as $gpcRecord) {
        ?>
                <div class="row">
                    <h1 style="margin-top:30px;"><?php echo $gpcRecord->category; ?></h1>
                    <div data-example-id="contextual-table" class="bs-example">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th class="no-padding" width="22%">
                                            <div role="alert" class="alert alert-danger"> Package Name</div>
                                        </th>
                                        <th class="no-padding" width="15%">
                                            <div role="alert" class="alert alert-danger"> Price</div>
                                        </th>
                                        <th class="no-padding" width="15%">
                                            <div role="alert" class="alert alert-danger"> Total</div>
                                        </th>
                                        <th class="no-padding" width="15%">
                                            <div role="alert" class="alert alert-danger"> Register</div>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    if (!empty($gpcRecord->packages)) {
                                        foreach ($gpcRecord->packages as $gPckgRecord) {
                                    ?>
                                            <tr class="active">
                                                <td scope="row"><i class="<?php echo ($gPckgRecord->icon_class_name != '') ? $gPckgRecord->icon_class_name : 'fa fa-edit'; ?>"></i> <?php echo $gPckgRecord->package_name; ?></td>
                                                <td><?php if ($gPckgRecord->offer_price > 0) { ?><span class="offer-price">$<?php echo $gPckgRecord->offer_price; ?></span> / <?php }
                                                                                                                                                                            echo "$" . $gPckgRecord->price; ?></td>
                                                <td>$<?php echo number_format(floatval($gPckgRecord->price) + floatval($gPckgRecord->mto_fee) + floatval($gPckgRecord->hst), 2) ?></td>
                                                <td><a href="<?php echo base_url() . "registration/" . $gPckgRecord->id; ?>" class="button small red button-3d rounded no-margin"><span>Register</span></a></td>
                                            </tr>
                                    <?php
                                        }
                                    }
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
        <?php
            }
        }
        ?>

        <!--New design -->

        <div class="row">
            <?php
            if (!empty($private_packages)) {
                foreach ($private_packages as $ppcRecord) {
            ?>
                    <div class="col-lg-6">
                        <h1 style="margin-top:30px;"><?php echo $ppcRecord->category; ?></h1>
                        <div data-example-id="contextual-table" class="bs-example">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th class="no-padding" width="55%">
                                                <div role="alert" class="alert alert-danger"> Package Name</div>
                                            </th>
                                            <th class="no-padding" width="25%">
                                                <div role="alert" class="alert alert-danger"> Price</div>
                                            </th>
                                            <!--<th class="no-padding" width="15%">
                                            <div role="alert" class="alert alert-danger"> Total</div>
                                        </th> -->
                                            <th class="no-padding" width="20%">
                                                <div role="alert" class="alert alert-danger"> Register</div>
                                            </th>
                                        </tr>
                                    </thead>

                                    <tbody>
                                        <?php
                                        if (!empty($ppcRecord->packages)) {
                                            foreach ($ppcRecord->packages as $pPckgRecord) {
                                        ?>
                                                <tr class="active">
                                                    <td scope="row"><i class="<?php echo ($pPckgRecord->icon_class_name != '') ? $pPckgRecord->icon_class_name : 'fa fa-edit'; ?>"></i> <?php echo $pPckgRecord->package_name; ?></td>
                                                    <td><?php if ($pPckgRecord->offer_price > 0) { ?><span class="offer-price">$<?php echo $pPckgRecord->offer_price; ?></span> / <?php }
                                                                                                                                                                                echo "$" . $pPckgRecord->price; ?> + HST</td>
                                                    <!--<td>$<?php echo number_format(floatval($pPckgRecord->price) + floatval($pPckgRecord->mto_fee) + floatval($pPckgRecord->hst), 2) ?></td> -->
                                                    <td><a href="<?php echo base_url() . "registration/" . $pPckgRecord->id; ?>" class="button small red button-3d rounded no-margin"><span>Register</span></a></td>
                                                </tr>
                                        <?php
                                            }
                                        }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            <?php
                }
            }
            ?>
        </div>

        <!--New design end -->

        <br>
        <br>
        <br>
    </div>

    <!-- Schedule Start -->
    <?php
    $newSchedules = $newNextYearSchedule = array();
    foreach ($schedules as $s) {
        $newSchedules[$s->month]["year"] = $s->year;
        $newSchedules[$s->month]["month"] = $s->month;
        $newSchedules[$s->month]["package_id"][] = $s->package_id;
        $newSchedules[$s->month]["date"][] = $s->date;
        $newSchedules[$s->month]["description"][] = $s->description;
        $newSchedules[$s->month]["time"][] = $s->time;
    }

    if (isset($nextYearSchedule) && count($nextYearSchedule) && ((int)date("m") > 9)) {
        foreach ($nextYearSchedule as $s) {
            $newNextYearSchedule[$s->month]["month"] = $s->month;
            $newNextYearSchedule[$s->month]["package_id"][] = $s->package_id;
            $newNextYearSchedule[$s->month]["date"][] = $s->date;
            $newNextYearSchedule[$s->month]["description"][] = $s->description;
            $newNextYearSchedule[$s->month]["time"][] = $s->time;
        }
    }

    if (isset($nextYearSchedule) && count($nextYearSchedule) && ((int)date("m") > 9)) {
        foreach ($nextYearSchedule as $month) {
            $newyearMonths[$month->month] = $month->month;
        }
    }
    ?>
    <div class="container p-t-40 p-b-40">

        <div class="col-md-4 col-md-offset-9">
            <div class="row form-group">
                <div class="col-md-9 schedule-locations-box-style1">
                    <div class="select-box clearfix">
                        <form action="" method="post" id="_form">
                            <select class="form-control p-10 rounded" name="month" onChange="filterMonth();" id="month">
                                <option value="0">All Months</option>
                                <?php foreach ($months as $month) { ?>
                                    <option value="<?php echo $month->month; ?>_<?php echo $month->year; ?>" <?php if ($this->input->post("month") == $month->month . '_' . $month->year) {
                                                                                                                    echo " selected ";
                                                                                                                } ?>><?php echo date('F', mktime(0, 0, 0, $month->month, 10)) . ' ' . $month->year; ?></option>
                                <?php } ?>
                                <?php if (!empty($newyearMonths) && count($newyearMonths)) {
                                    foreach ($newyearMonths as $month) { ?>
                                        <option value="<?php echo $month; ?>_<?php echo (date("Y") + 1); ?>" <?php if ($this->input->post("month") == $month . '_' . (date("Y") + 1)) {
                                                                                                                    echo " selected ";
                                                                                                                } ?>><?php echo date('F', mktime(0, 0, 0, $month, 10)) . ' ' . (date("Y") + 1); ?></option>
                                <?php }
                                } ?>
                            </select>
                        </form>
                    </div>
                </div>
            </div>
        </div>

        <?php foreach ($newSchedules as $newSchedule) { ?>
            <div data-example-id="contextual-table" class="bs-example">
                <h4 class="schedule-hd mb-0"><i class="fa fa-calendar" aria-hidden="true"></i> <?php echo date('F', mktime(0, 0, 0, $newSchedule["month"], 10)) . ' ' . $newSchedule["year"]; ?></h4>
                <div class="table-responsive">
                    <table class="table currentYear">
                        <thead>
                            <tr>
                                <th class="no-padding" width="30%">
                                    <div role="alert" class="alert alert-danger"> Date</div>
                                </th>
                                <th class="no-padding" width="45%">
                                    <div role="alert" class="alert alert-danger"> Days</div>
                                </th>
                                <th class="no-padding" width="15%">
                                    <div role="alert" class="alert alert-danger"> Time</div>
                                </th>
                                <th class="no-padding" width="10%">
                                    <div role="alert" class="alert alert-danger"> Register</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            for ($a = 0; $a < count($newSchedule["date"]); $a++) { ?>
                                <tr class="active">
                                    <th scope="row"><?php echo $newSchedule["date"][$a]; ?></th>
                                    <td><?php echo $newSchedule["description"][$a]; ?></td>
                                    <td><?php echo $newSchedule["time"][$a]; ?></td>
                                    <td><a href="<?php echo base_url() . "registration/" . $newSchedule["package_id"][$a]; ?>" class="button small red button-3d rounded no-margin"><span>Register</span></a></td>
                                </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        <?php } ?>
        <?php
        if (count($newNextYearSchedule) && date("m") >= 9 && $this->input->post("month") == '')
            foreach ($newNextYearSchedule as $newSchedule) { ?>
            <div data-example-id="contextual-table" class="bs-example">
                <h4><i class="fa fa-calendar" aria-hidden="true"></i> <?php echo date('F', mktime(0, 0, 0, $newSchedule["month"], 10)) . ' ' . (date("Y") + 1); ?></h4>
                <div class="table-responsive">
                    <table class="table">
                        <thead>
                            <tr>
                                <th class="no-padding" width="30%">
                                    <div role="alert" class="alert alert-danger"> Date</div>
                                </th>
                                <th class="no-padding" width="45%">
                                    <div role="alert" class="alert alert-danger"> Days</div>
                                </th>
                                <th class="no-padding" width="15%">
                                    <div role="alert" class="alert alert-danger"> Time</div>
                                </th>
                                <th class="no-padding" width="10%">
                                    <div role="alert" class="alert alert-danger"> Register</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            for ($a = 0; $a < count($newSchedule["date"]); $a++) { ?>
                                <tr class="active">
                                    <th scope="row"><?php echo $newSchedule["date"][$a]; ?></th>
                                    <td><?php echo $newSchedule["description"][$a]; ?></td>
                                    <td><?php echo $newSchedule["time"][$a]; ?></td>
                                    <td><a href="<?php echo base_url() . "registration/" . $newSchedule["package_id"][$a]; ?>" class="button small red button-3d rounded no-margin"><span>Register</span></a></td>
                                </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        <?php } ?>
    </div>
    <!-- Schedule End -->

    <!-- Footer -->
    <?php $this->load->view("includes/footer"); ?>
    <!-- End: Footer -->

    <?php $this->load->view("includes/scripts"); ?>
    
    <script>
        function filterMonth() {
            $("#_form").submit();
        }
    </script>

</body>

</html>