<?php 




Route::isJs(function(){
    ob_start();
    ?>
    <div>
		<w-list 
			ng-model="ngModel"
			item-name="$elm"
			label="Planification"
			init-item="item.planification = item.planification || {a:''}"
			hide-panel="false"
		>

		<div class="row">
            <div class="col-xs-6">
                <div class="form-group">
                    <label>Date début</label>
                    <input type="date" class="form-control" mydate="$elm.planification.date_debut"/>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label>Date fin</label>
                    <input type="date" class="form-control" mydate="$elm.planification.date_fin"/>
                </div>
            </div>
            <div class="col-xs-12">
            	<div style="display: flex;flex-wrap: wrap;">
                    <md-switch ng-model="$elm.planification.d1" aria-label="Lundi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Lundi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d2" aria-label="Mardi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Mardi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d3" aria-label="Mercredi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Mercredi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d4" aria-label="Jeudi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Jeudi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d5" aria-label="Vendredi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Vendredi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d6" aria-label="Samedi" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Samedi
                    </md-switch>
                    <md-switch ng-model="$elm.planification.d7" aria-label="Dimanche" style="flex:1;margin:0 15px;min-width: 30%;">
                    	Dimanche
                    </md-switch>
            	</div>
            </div>

        </div>
		</w-list>


    	
    </div>
    <?php
    $code = ob_get_clean();
    ?>
    <script>
 
        app.directive("planificationSmsing",function(){
            return {
            	restrict: 'EA',
                template : <?= json_encode($code) ?>,
                scope : {
                    ngModel:"="
                },
                controller : function($scope){
                    $scope.ngModel = $scope.ngModel || [];
                    $scope.$watch("ngModel",function(){
                        if(!$scope.ngModel){
                            $scope.ngModel = [];
                        }
                    });
                }
            }
        });
    </script>
    <?php
});