<?php
	// Assets::add( 'jquery.form' );
	Assets::add( 'options.css' );
?>
<?php $__env->startSection( 'content' ); ?>
	<div class="cc ov" id="options">
		<h1><?php echo trans( 'options.admin-title' ); ?></h1>

		<?php echo Form::model( Setting::all(), array( 'id' => 'form-info' ) ); ?>

			<table>
				<?php
					foreach( $fields as $f_name => $f_options ) {
						echo_option_field( $f_name, $f_options );
					}
				?>
			</table>
			<hr>
			<?php echo Form::submit( trans( 'main.save' ) ); ?>

		<?php echo Form::close(); ?>

	</div>
<?php $__env->stopSection(); ?>

<?php
function echo_option_field( $f_name, $f_options, $lang_code = '', $lang = '' ) {
	$field_name = "{$f_name}" . ( $lang_code ? "-{$lang_code}" : '' );
	$label = trans( "options.{$f_name}" ) . ( $lang ? "( {$lang} )" : '' );
	$class = isset( $f_options[ 'class' ] ) ? $f_options[ 'class' ] : '';
?>
	<tr>
		<td><?php echo Form::label( $field_name, $label ); ?></td>
		<td>
			<?php if( $f_options[ 'type' ] == 'text' ): ?>
				<?php echo Form::text( $field_name, null, array( 'class' => "{$class}" ) ); ?>

			<?php elseif( $f_options[ 'type' ] == 'textarea' ): ?>
				<?php echo Form::textarea( $field_name, null, array( 'class' => "textarea-short {$class}" ) ); ?>

			<?php elseif( $f_options[ 'type' ] == 'select' ): ?>
				<?php echo Form::select( $field_name, $f_options[ 'data' ], null, array( 'class' => "{$class}" ) ); ?>

			<?php endif; ?>
		</td>
	</tr>
<?php } ?>