
<?php $__env->startSection('subtitle'); ?>
Submissions
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<?php if(HelperController::adsEnabled()): ?>
<div class="col-md-8">
    <?php else: ?>
    <div class="col-md-12">
        <?php endif; ?>
        <h2>Submissions</h2>
        <span class="line"> <span class="sub-line"></span></span>
		<?php if(count($loadouts) > 0): ?>
        <table class="table table-striped tablesorter">
            <thead>
                <tr>
                    <th>Game <i class="fa fa-sort"></i></th>
                    <th>Weapon <i class="fa fa-sort"></i></th>
                    <th>Attachments <i class="fa fa-sort"></i></th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($loadouts as $loadout): ?>
                <?php
                $weapon = Weapon::findOrFail($loadout -> weapon_id);
                ?>
                <tr id="loadout-<?php echo $loadout -> id; ?>">
                    <td>
                        <?php echo $weapon -> game_id; ?>
                    </td>
                    <td>
                        <?php echo $weapon -> name; ?>
                    </td>
                    <td>
                        <ul>
                            <?php foreach(Loadout::findOrFail($loadout -> id) -> attachments as $attachment): ?>
                            <li>
                                <?php echo $attachment -> name; ?>
                            </li>
                            <?php endforeach; ?>
                        </ul>
                    </td>
                    <td>
                        <a class="btn btn-default viewLoadout" data-toggle="tooltip" data-placement="top" title="View Loadout" href="<?php echo route('showLoadout', array(urlencode($weapon -> game_id), urlencode($weapon -> name), $loadout -> id)); ?>">
                            <span class="glyphicon glyphicon-search"></span>
                        </a>
                        &nbsp;
                        <a class="clickable btn btn-danger removeVote" href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="Remove Vote" data-game_id="<?php echo $weapon -> game_id; ?>" data-weapon_name="<?php echo $weapon -> name; ?>" data-loadout_id="<?php echo $loadout -> id; ?>">
                            <span class="glyphicon glyphicon-trash"></span>
                        </a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
		<?php else: ?>
		<p>
			You have not submitted any loadouts yet.
		</p>
		<p>
			You can start by searching for a weapon in the search box.
		</p>
		<?php endif; ?>
    </div>
    <?php if(HelperController::adsEnabled()): ?>
    <div class="col-md-4">
        <div class="right-ad-box">
			<style>
				.game-loadouts-responsive-sidebar {
					width: 300px;
					height: 250px;
				}
				@media (min-width: 800px) {
					.game-loadouts-responsive-sidebar {
						width: 300px;
						height: 600px;
					}
				}
			</style>
			<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
			<!-- Game Loadouts Responsive Sidebar -->
			<ins class="adsbygoogle game-loadouts-responsive-sidebar"
			style="display:inline-block"
			data-ad-client="ca-pub-9067954073014278"
			data-ad-slot="2846988777"></ins>
			<script>
				( adsbygoogle = window.adsbygoogle || []).push({});
			</script>
		</div>
    </div>
    <?php endif; ?>
    <?php $__env->stopSection(); ?>

    <?php $__env->startSection('scripts'); ?>
    <script type="text/javascript">
        $('.clickable').click(function() {
            var game_id = $(this).data('game_id');
            var weapon_name = $(this).data('weapon_name');
            var loadout_id = $(this).data('loadout_id');
            $.post('/' + game_id + '/' + weapon_name + '/' + loadout_id + '/detach', function(data) {
                $('#loadout-' + loadout_id).fadeOut();
            }, 'json');
        });
        
        $('.viewLoadout, .removeVote').tooltip();
    </script>
    <script src="<?php echo asset('js/tablesorter/jquery.tablesorter.js'); ?>"></script>
    <script src="<?php echo asset('js/tablesorter/tables.js'); ?>"></script>
    <?php $__env->stopSection(); ?>

<?php echo $__env->make('layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>