File: //home/awaldron/public_html/archive/teampay/application/views/v_myteams.php
<?php
if (count($teams) == 0) {
echo '<div class="alert alert-warning"><strong>Oh Snap!</strong> You haven\'t created any teams yet! <br><a href="/create_team">Click here to create your first team.</a></div>';
} else {
echo '<h4>'.count($teams).' Teams:</h4>';
//pp($teams);
?>
<div class="awidget">
<div class="awidget-body">
<table class="table table-striped table-hover">
<thead>
<tr>
<th style="text-align:center;">Edit</th>
<th>Team Name</th>
<th style="text-align:center;">Players</th>
<th style="text-align:center;">Fees Collected</th>
<th style="text-align:center;">Progress</th>
<th style="text-align:center;">Fees Due</th>
</tr>
</thead>
<tbody>
<?php
foreach ($teams as $t) {
$pct = floor(($t['collected'] / $t['team_fee'])*100);
echo '<tr>';
echo '<td style="text-align:center;"><a href="#editTeam'.$t['team_id'].'" data-toggle="modal"><i class="fa fa-edit"></a></td>';
echo '<td><a href="/team/'.$t['team_id'].'">'.$t['team_name'].'</a></td>';
echo '<td style="text-align:center;">'.$t['players'].'</td>';
echo '<td style="text-align:center;">$'.number_format($t['collected'],2).' / $'.number_format($t['team_fee'],2).'</td>';
echo '<td style="width:100px;">';
echo '<div style="display:inline-block;width:30px;float:left;">'.$pct.'%</div>';
echo '<div class="progress progress-striped active" style="display:inline-block;width:50px;">';
echo '<div class="progress-bar progress-bar-primary" data-percentage="'.$pct.'" style="width: '.$pct.'%">';
echo '</div></div>';
echo '</td>';
echo '<td style="text-align:center;">'.date("m/d/Y", strtotime($t['team_fees_due'])).'</td>';
echo '</tr>';
}
}
?>
</table>
<div class="awidget-foot">
<div class="clearfix"></div>
</div>
</div>
</div>
<div style="float:right;">
<a href="/create_team" class="btn btn-small btn-primary" data-toggle="modal" ><i class="fa fa-plus-circle"></i> Create Team</a>
</div>
<?php foreach($teams as $t) { ?>
<!-- Modal -->
<div id="editTeam<?=$t['team_id']?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><i class="fa fa-plus-circle color"></i> Edit Team</h3>
</div>
<div class="modal-body">
<form class="form-vertical" id="fEditTeam" role="form" method="post" action="/my_teams/update_team">
<input type="hidden" name="team_id" value="<?=$t['team_id']?>">
<div class="form-group">
<label class="req">Team Name</label>
<div>
<input name="team_name" type="text" class="form-control" value="<?=$t['team_name']?>">
</div>
</div>
<div class="form-group">
<label class="req">Sport</label>
<div>
<select class="form-control" name="sport_id">
<option value="" selected="selected">Select a Sport</option>
<option <?=($t['sport_id']=='1' ? 'selected="selected"' : '')?> value="1">Baseball</option>
<option <?=($t['sport_id']=='5' ? 'selected="selected"' : '')?> value="5">Basketball</option>
<option <?=($t['sport_id']=='2' ? 'selected="selected"' : '')?> value="2">Softball</option>
<option <?=($t['sport_id']=='3' ? 'selected="selected"' : '')?> value="3">Football</option>
<option <?=($t['sport_id']=='4' ? 'selected="selected"' : '')?> value="4">Hockey</option>
<option <?=($t['sport_id']=='6' ? 'selected="selected"' : '')?> value="6">Volleyball</option>
<option <?=($t['sport_id']=='9' ? 'selected="selected"' : '')?> value="9">Soccer</option>
<option <?=($t['sport_id']=='10' ? 'selected="selected"' : '')?> value="10">Rugby</option>
<option <?=($t['sport_id']=='11' ? 'selected="selected"' : '')?> value="11">Other</option>
</select>
</div>
</div>
<div class="form-group">
<label class="req">Team Fee</label>
<div>
<div class="input-prepend">
<input name="team_fee" id="team_fee" type="text" class="form-control" placeholder="$0.00" value="<?=$t['team_fee']?>">
</div>
</div>
</div>
<div class="form-group">
<label class="req">Fees Due</label>
<div>
<div id="datetimepicker1" class="input-append">
<input name="team_fees_due" id="team_fees_due" data-format="MM/dd/yyyy" type="text" class="form-control dtpicker" style="display:inline;" placeholder="<?=date('m/d/Y')?>" value="<?=date('m/d/Y',strtotime($t['team_fees_due']))?>">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div style="float:left;"><button type="button" class="btn btn-default ttip" id="dupteam-<?=$t['team_id']?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Duplicate Team and Roster">Duplicate</button> </div>
<?php
if ($t['team_active'] == 1) echo '<div style="float:left;"><button type="button" class="btn btn-default ttip" id="arcteam-'.$t['team_id'].'" data-toggle="tooltip" data-placement="top" title="" data-original-title="Archive Team">Archive</button></div>';
else echo '<div style="float:left;"><button type="button" class="btn btn-default ttip" id="restoreteam-'.$t['team_id'].'" data-toggle="tooltip" data-placement="top" title="" data-original-title="Restore Team">Restore</button></div>';
?>
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
<input type="submit" class="btn btn-primary" value="Update Team" >
</div>
</form>
</div>
</div>
</div>
<?php } ?>