Register Child and Waitlist working
This commit is contained in:
@@ -20,92 +20,34 @@ class Controller_Director_Welcome extends Controller_Welcome {
|
||||
public function action_index() {
|
||||
$output = '';
|
||||
|
||||
$date = Site::DateStartOfWeek(time());
|
||||
$t = strtotime($this->request->query('date'));
|
||||
if (! $t)
|
||||
$t = time();
|
||||
|
||||
$so = Company::instance()->so();
|
||||
$date = Site::DateStartOfWeek($t);
|
||||
$days = 7;
|
||||
|
||||
$open_dates = $so->open_dates($date,$days);
|
||||
$output .= '<table class="table table-striped table-condensed table-hover">';
|
||||
$output .= '<form id="select_date">';
|
||||
$output .= View::factory('room/availability')
|
||||
->set('date',$date)
|
||||
->set('days',$days)
|
||||
->set('open_dates',$so->open_dates($date,$days))
|
||||
->set('total_places',$so->total_places($date,$days))
|
||||
->set('r',$so->rooms->find_all())
|
||||
->set('uri',$this->request->uri());
|
||||
$output .= '</form>';
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= '<th colspan="2"> </th>';
|
||||
foreach (array_keys($open_dates) as $day)
|
||||
$output .= sprintf('<th class="text-right">%s (%s)</th>',Site::date($day),date('D',$day));
|
||||
$output .= '</tr>';
|
||||
Style::factory()
|
||||
->type('file')
|
||||
->data('media/theme/bootstrap/css/bootstrap.datepicker.css');
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= '<th colspan="2">Open</th>';
|
||||
foreach (array_keys($open_dates) as $day)
|
||||
$output .= sprintf('<th class="text-right">%s</th>',StaticList_YesNo::factory()->get(isset($open_dates[$day]) ? $open_dates[$day] : FALSE,TRUE));
|
||||
$output .= '</tr>';
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= '<th colspan="2">Total</th>';
|
||||
foreach (array_keys($open_dates) as $day)
|
||||
$output .= sprintf('<th class="text-right">%s</th>','-');
|
||||
$output .= '</tr>';
|
||||
|
||||
foreach ($so->rooms->find_all() as $ro) {
|
||||
$output .= sprintf('<tr><th colspan="2">%s</th><th colspan="%s"> </th></tr>',$ro->display('name'),$days);
|
||||
|
||||
// Capacity
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Capacity</td>';
|
||||
$output .= sprintf('<td class="text-right">%s</td>',join('</td><td class="text-right">',array_values($ro->availability_dates($date,$days))));
|
||||
$output .= '</tr>';
|
||||
|
||||
// Permanent
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Permanent</td>';
|
||||
foreach (array_values($ro->child_list_date($date,$days)) as $x)
|
||||
$output .= sprintf('<td class="text-right">%s</td>',count($x));
|
||||
$output .= '</tr>';
|
||||
|
||||
// Permanent
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Absent</td>';
|
||||
foreach (array_values($ro->child_list_date($date,$days,'a')) as $x)
|
||||
$output .= sprintf('<td class="text-right">%s</td>',count($x));
|
||||
$output .= '</tr>';
|
||||
|
||||
// Casual
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Casual</td>';
|
||||
foreach (array_values($ro->child_list_date($date,$days,'C')) as $x)
|
||||
$output .= sprintf('<td class="text-right">%s</td>',count($x));
|
||||
$output .= '</tr>';
|
||||
|
||||
// Spacer
|
||||
$output .= sprintf('<tr><td colspan="%s"> </td></tr>',$days+2);
|
||||
|
||||
// Waitlist
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Waitlist</td>';
|
||||
foreach (array_values($ro->child_list_date($date,$days,'W')) as $x)
|
||||
$output .= sprintf('<td class="text-right">%s</td>',count($x));
|
||||
$output .= '</tr>';
|
||||
|
||||
// Availablity
|
||||
$output .= '<tr>';
|
||||
$output .= '<td> </td>';
|
||||
$output .= '<td>Availability</td>';
|
||||
foreach (array_values($ro->room_availablity($date,$days)) as $x)
|
||||
$output .= sprintf('<td class="text-right">%s</td>',$x);
|
||||
$output .= '</tr>';
|
||||
|
||||
// Spacer
|
||||
$output .= sprintf('<tr><td colspan="%s"> </td></tr>',$days+2);
|
||||
}
|
||||
|
||||
$output .= '</table>';
|
||||
Script::factory()
|
||||
->type('file')
|
||||
->data('media/theme/bootstrap/js/bootstrap.datepicker.js');
|
||||
|
||||
Block::factory()
|
||||
->title(sprintf('Site Availability for %s',Site::date($date)))
|
||||
->title(sprintf('Availability for %s',Site::date($date)))
|
||||
->title_icon('icon-cog')
|
||||
->body($output);
|
||||
}
|
||||
|
Reference in New Issue
Block a user