@extends('layouts.main')

@section('body')

<style type="text/css">

  /* 
    This controls the appearance of the days of the week header at the top of the calendar.
    It's recommended that you only add styles that effect the visual presentation of the 
    text here, (color, font-size, etc), rather than it's layout.
    */
    #day_runner{
    	font-weight: bold;
    	font-size: 0.8rem;
    }

  /*
  This controls the appearance of the month name at the top of the calendar
  */
  #month_name{
  	color: green;
  	font-size: 24px;
  	font-weight: bold;
  }
  
  /*
    This controls the appearance of the individual days of the month. Bear in mind
    that the width of these boxes can be programatically controlled when you first
    create the calendar, removing the need to figure out appropriate widths here.
    */
    .date_box{
    	height: 20px;
    	border: 1px solid black;
    }

  /*
    This controls the visual appearance of the date box that represents the current 
    date.  It's recommended that you only change basic visual styles for this class,
    (such as background color or text color, etc.)
    */
    .current_day{
    	background-color: #e8d2b0;
    }

  /*
    This controls the style of any boxes that are 'fill in', that is, not representing
    a date, but used to fill out the calendar square.
    */
    .empty_date{
    	background-color: gray;
    }

    .today {
    	background-color: green;
    }


</style>

<div class="panel panel-default">
	<div class="panel-body">
		<div class="row"> 
			<div class="col-md-4">
				{!! $calendar->render() !!}
			</div>
			<div class="col-md-8">
				@if(session()->has('AD'))
				<p>Nepali Date: {{ session('BS')['date'] }} {{ session('BS')['nmonth'] }} {{ session('BS')['year'] }}, {{ session('BS')['day'] }} </p>
				<p>English Date: {{ session('AD')['date'] }} {{ session('AD')['nmonth'] }} {{ session('AD')['year'] }}, {{ session('AD')['day'] }} </p>
				@endif
				<form class="form-inline" action="{{ url('/calendar') }}" method="POST">
					{{ csrf_field() }}
					<input type="hidden" name="from" value="AD">
					<label>English Date:</label>
					<select name="year" class="form-control">
						@for($i=1945;$i<=2033;$i++)
						@if($i==$englishDate['year'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<select name="month" class="form-control">
						@for($i=1;$i<=12;$i++)
						@if($i==$englishDate['month'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<select name="date" class="form-control">
						@for($i=1;$i<=Carbon\Carbon::now()->daysInMonth;$i++)
						@if($i==$englishDate['date'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<input type="submit" name="submit" class="btn btn-success" value="Convert to BS">
				</form>
				<br>
				<form class="form-inline" action="{{ url('/calendar') }}" method="POST">
					{{ csrf_field() }}
					<input type="hidden" name="from" value="BS">
					<label>Nepali Date:</label>
					<select name="year" class="form-control">
						@for($i=2001;$i<=2089;$i++)
						@if($i==$nepaliDate['year'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<select name="month" class="form-control">
						@for($i=1;$i<=12;$i++)
						@if($i==$nepaliDate['month'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<select name="date" class="form-control">
						@for($i=1;$i<=32;$i++)
						@if($i==$nepaliDate['date'])
						<option value="{{ $i }}" selected="selected">{{ $i }}</option>
						@else
						<option value="{{ $i }}">{{ $i }}</option>
						@endif
						@endfor
					</select>
					<input type="submit" name="submit" class="btn btn-success" value="Convert to AD">
				</form>
			</div>
		</div>
	</div>
</div>
@endsection