diff --git a/application/bootstrap.php b/application/bootstrap.php index 79b18bd..ef50819 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -166,7 +166,7 @@ Route::set('default/media', 'media(/)', array('file' => '.+')) * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ -Route::set('default', '((/(/)))', array('id'=>'[a-zA-Z0-9_.-]+')) +Route::set('default', '((/(/)))', array('id'=>'[a-zA-Z0-9_.:-]+')) ->defaults(array( 'controller' => 'welcome', 'action' => 'index', diff --git a/application/classes/Controller/Director/Account.php b/application/classes/Controller/Director/Account.php index 1eb6f8f..c87ac4c 100644 --- a/application/classes/Controller/Director/Account.php +++ b/application/classes/Controller/Director/Account.php @@ -17,7 +17,7 @@ class Controller_Director_Account extends Controller_Account { ); /** - * Edit a Module Configuration + * Add an Account */ public function action_add() { Block::factory() @@ -36,8 +36,9 @@ class Controller_Director_Account extends Controller_Account { $this->response->headers('Content-Type','application/json'); $this->response->body(json_encode(array_values($result))); } + /** - * Edit a Module Configuration + * List Accounts */ public function action_list() { $output = __METHOD__; @@ -65,10 +66,9 @@ class Controller_Director_Account extends Controller_Account { ->type('file') ->data('media/theme/bootstrap/js/bootstrap.datepicker.js'); - return View::factory('child/user/add_edit') + return View::factory('account/user/add_edit') ->set('o',$co) ->set('so',Company::instance()->so()); - } } ?> diff --git a/application/classes/Controller/Director/Child.php b/application/classes/Controller/Director/Child.php new file mode 100644 index 0000000..12012d5 --- /dev/null +++ b/application/classes/Controller/Director/Child.php @@ -0,0 +1,176 @@ +TRUE, + 'ajaxroomrow'=>FALSE, + 'edit'=>TRUE, + 'list'=>TRUE, + ); + + /** + * Add a Child + */ + public function action_add() { + Block::factory() + ->type('form-horizontal') + ->title('Add/Edit Record') + ->title_icon('fa-wrench') + ->body($this->add_edit()); + } + + public function action_ajaxroomrow() { + $this->response->body( + View::factory('child/director/add_roomrow') + ->set('o',ORM::factory('Child',$this->request->query('cid'))) + ->set('so',Company::instance()->so()) + ->set('rco',ORM::factory('Room_Children')) + ->set('row',$this->request->query('id')) + ->set('type',$this->request->query('type'))); + } + + /** + * Edit a Child + */ + public function action_edit() { + Block::factory() + ->type('form-horizontal') + ->title('Add/Edit Record') + ->title_icon('fa-wrench') + ->body($this->add_edit($this->request->param('id'))); + } + + public function action_list() { + Block::factory() + ->title('Children List') + ->title_icon('fa-list-ol') + ->body(Table::factory() + ->data(ORM::factory('Child')->find_all()) + ->columns(array( + 'id'=>'ID', + 'name()'=>'Name', + 'age()'=>'Age', + "days(NULL,".Site::DateStartOfWeek(time()).",7,'P',TRUE)"=>'Perm Days', + "days(NULL,".Site::DateStartOfWeek(time()).",7,'w',TRUE)"=>'Wait Days', + 'date_orig'=>'Date Registered' + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('director','child/edit/')), + )) + ); + } + + private function add_edit($id=NULL) { + $co = ORM::factory('Child',$id); + + if ($this->request->post()) { + foreach ($this->request->post('room') as $index=>$room) { + $new = FALSE; + + if (! $room['id'] OR ! $rco=$co->subitem_get('id',$room['id'])) { + $new = TRUE; + $rco = $co->room; + $rco->child_id = $co->id; + } + + $rco->values($room); + + if ($new) + $co->subitem_add($rco); + } + + $co->values($this->request->post()); + + if (! $this->save($co)) + $co->reload()->values($this->request->post()); + } + + Style::factory() + ->type('file') + ->data('media/theme/bootstrap/css/bootstrap.datepicker.css'); + + Script::factory() + ->type('file') + ->data('media/theme/bootstrap/js/bootstrap.datepicker.js'); + + Script::factory() + ->type('stdin') + ->data(' +$(document).ready(function() { + var x = '.count($co->subitems()).'; + + $("button[name=add]").click(function() { + // Send the request and get a new room row + $.ajax({ + type: "GET", + data: "cid='.$co->id.'&type="+$(this).val()+"&id="+x++, + dataType: "html", + cache: false, + url: "'.URL::link('director','child/ajaxroomrow',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { + $("table[name=room] tr:last").after(data); + } + }); + }); + + $("#dob").datepicker().on("hide",function(e) { + var x = $("#dob").datepicker("getDate").getTime()/1000; + + // Send the request and update sub category dropdown + $.ajax({ + type: "GET", + data: "date="+x, + dataType: "html", + cache: false, + url: "'.URL::link('user','child/ajaxage',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { + $("div[id=age]").empty().append(data); + } + }); + +// This code has been disabled as it pollutes datepicker. +/* + $.ajax({ + type: "GET", + data: "date="+x, + dataType: "html", + cache: false, + url: "'.URL::link('user','child/ajaxagemax',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { +// $(".date input:not(#dob)").each(function(){$(this).datepicker("setEndDate",new Date(data*1000))}); +// $(".input-daterange input").each(function(){alert(new Date(data*1000));$(this).datepicker("setEndDate",new Date(data*1000))}); + $(".input-daterange").each(function(){alert(data);$(this).datepicker("setEndDate",data)}); + } + }); +*/ + }); +}); + '); + + return View::factory('child/director/add_edit') + ->set('o',$co) + ->set('so',Company::instance()->so()); + } +} +?> diff --git a/application/classes/Controller/Director/Room.php b/application/classes/Controller/Director/Room.php new file mode 100644 index 0000000..c80bd37 --- /dev/null +++ b/application/classes/Controller/Director/Room.php @@ -0,0 +1,96 @@ +TRUE, + 'list'=>TRUE, + ); + + /** + * Show Directory Main Page + */ + public function action_availability() { + $output = ''; + + $t = strtotime($this->request->query('date')); + if (! $t) + $t = time(); + + $so = Company::instance()->so(); + $date = Site::DateStartOfWeek($t); + $days = 7; + + $output .= '
'; + $output .= View::factory('room/availability') + ->set('date',$date) + ->set('days',$days) + ->set('available_places',$so->available_places($date,$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 .= '
'; + + Style::factory() + ->type('file') + ->data('media/theme/bootstrap/css/bootstrap.datepicker.css'); + + Script::factory() + ->type('file') + ->data('media/theme/bootstrap/js/bootstrap.datepicker.js'); + + Block::factory() + ->title(sprintf('Availability for %s',Site::date($date))) + ->title_icon('icon-cog') + ->body($output); + } + + /** + * List Children in a Room + */ + public function action_list() { + $days = 1; + + if (substr_count($this->request->param('id'),':') == 2) + list($id,$date_start,$code) = explode(':',$this->request->param('id')); + elseif (substr_count($this->request->param('id'),':') == 3) + list($id,$date_start,$code,$days) = explode(':',$this->request->param('id')); + else + HTTP::redirect(URL::link('director','welcome')); + + $ro = ORM::factory('Rooms',$id); + + $result = array(); + foreach ($ro->child_list_date($date_start,$days,$code) as $date => $children) + foreach ($children as $co) + if (! Object::in_array('id',$co->id,$result)) + array_push($result,$co); + + Block::factory() + ->title(sprintf('%s Room List for %s',$ro->display('name'),Site::date($date_start).($days > 1 ? ' to '.Site::date($date_start+$days*86400) : ''))) + ->title_icon('fa-list-ol') + ->body(Table::factory() + ->data($result) + ->columns(array( + 'id'=>'ID', + 'name()'=>'Name', + 'age()'=>'Age', + "days($ro->id,$date_start,$days,'$code',TRUE)"=>'Days', + 'date_orig'=>'Register Date', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('director','child/edit/')), + )) + ); + } +} +?> diff --git a/application/classes/Controller/Director/Welcome.php b/application/classes/Controller/Director/Welcome.php index a4951e5..fc0bac5 100644 --- a/application/classes/Controller/Director/Welcome.php +++ b/application/classes/Controller/Director/Welcome.php @@ -15,7 +15,7 @@ class Controller_Director_Welcome extends Controller_Welcome { ); /** - * Edit a Module Configuration + * Show Directory Main Page */ public function action_index() { $output = ''; @@ -32,6 +32,7 @@ class Controller_Director_Welcome extends Controller_Welcome { $output .= View::factory('room/availability') ->set('date',$date) ->set('days',$days) + ->set('available_places',$so->available_places($date,$days)) ->set('open_dates',$so->open_dates($date,$days)) ->set('total_places',$so->total_places($date,$days)) ->set('r',$so->rooms->find_all()) diff --git a/application/classes/Controller/Room.php b/application/classes/Controller/Room.php new file mode 100644 index 0000000..5095616 --- /dev/null +++ b/application/classes/Controller/Room.php @@ -0,0 +1,3 @@ +dob = $this->request->query('date'); - $this->template->content = $x->date_enrol_max(); + $this->template->content = $x->date_enrol_max(TRUE); } public function action_edit() { @@ -50,17 +50,27 @@ class Controller_User_Child extends Controller_Child { $co = ORM::factory('Child',$id); if ($this->request->post()) { - $co->values($this->request->post()); - $co->account_id = (string)$this->ao; + foreach ($this->request->post('room') as $index=>$room) { + $new = FALSE; - if ($co->changed() AND (! $this->save($co))) + if (! $room['id'] OR ! $rco=$co->subitem_get('id',$room['id'])) { + $new = TRUE; + $rco = $co->room; + $rco->child_id = $co->id; + } + + $rco->values($room); + + if ($new) + $co->subitem_add($rco); + } + + $co->values($this->request->post()); + + if (! $this->save($co)) $co->reload()->values($this->request->post()); } - // If there are no room records, we'll create a waitlist one that can be completed. - if (! $co->subitems()) - $co->subitem_add($co->room->values(array('child_id'=>$co->id,'code'=>'W'))); - Style::factory() ->type('file') ->data('media/theme/bootstrap/css/bootstrap.datepicker.css'); @@ -73,48 +83,62 @@ class Controller_User_Child extends Controller_Child { Script::factory() ->type('stdin') ->data(' - $(document).ready(function() { - '.($co->loaded() ? ' - $("#date_stop").datepicker({ - endDate: new Date('.($co->date_enrol_max()*1000).') - }); - ' : '').' +$(document).ready(function() { + var x = '.count($co->subitems()).'; - $("#dob").datepicker().on("hide",function(e) { - var x = $("#dob").datepicker("getDate").getTime()/1000; - - // Send the request and update sub category dropdown - $.ajax({ - type: "GET", - data: "date="+x, - dataType: "html", - cache: false, - url: "'.URL::link('user','child/ajaxage',TRUE).'", - timeout: 2000, - error: function(x) { - alert("Failed to submit"); - }, - success: function(data) { - $("div[id=age]").empty().append(data); - } - }); - - $.ajax({ - type: "GET", - data: "date="+x, - dataType: "html", - cache: false, - url: "'.URL::link('user','child/ajaxagemax',TRUE).'", - timeout: 2000, - error: function(x) { - alert("Failed to submit"); - }, - success: function(data) { - $("#date_stop").datepicker("setEndDate",new Date(data*1000)); - } - }); + $("button[name=add]").click(function() { + // Send the request and get a new room row + $.ajax({ + type: "GET", + data: "cid='.$co->id.'&type="+$(this).val()+"&id="+x++, + dataType: "html", + cache: false, + url: "'.URL::link('director','child/ajaxroomrow',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { + $("table[name=room] tr:last").after(data); + } }); }); + + $("#dob").datepicker().on("hide",function(e) { + var x = $("#dob").datepicker("getDate").getTime()/1000; + + // Send the request and update sub category dropdown + $.ajax({ + type: "GET", + data: "date="+x, + dataType: "html", + cache: false, + url: "'.URL::link('user','child/ajaxage',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { + $("div[id=age]").empty().append(data); + } + }); + + $.ajax({ + type: "GET", + data: "date="+x, + dataType: "html", + cache: false, + url: "'.URL::link('user','child/ajaxagemax',TRUE).'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, + success: function(data) { + $(".date input:not(#dob)").each(function(){$(this).datepicker("setEndDate",data)}); + } + }); + }); +}); '); return View::factory('child/user/add_edit') diff --git a/application/classes/Model/Child.php b/application/classes/Model/Child.php index 3a8d1c3..4a47887 100644 --- a/application/classes/Model/Child.php +++ b/application/classes/Model/Child.php @@ -1,7 +1,7 @@ array( + array('Site::Date',array(':value')), + ), + 'date_last'=>array( + array('Site::Date',array(':value')), + ), 'dob'=>array( array('Site::Date',array(':value')), ), ); protected $_sub_items_load = array( - 'room'=>'date_start,date_stop', + 'room'=>array('date_start','date_stop'), ); private function _dob() { @@ -54,7 +60,7 @@ class Model_Child extends ORM { } public function date($value) { - return is_numeric($value) ? $value : strtotime($value); + return is_numeric($value) ? $value : strtotime($value); } public function date_enrol_min() { @@ -76,27 +82,83 @@ class Model_Child extends ORM { return $format ? $result->format(Company::instance()->date_format()) : $result->format('U'); } + public function days($room_id,$date_start,$days,$code,$markup=FALSE) { + $result = ''; + + $date_end = $date_start+$days*86400; + $open_dates = Company::instance()->so()->open_dates($date_start,$days); + + $o = $this->room->where('code','=',$code); + $o->where_startstop($date_start,$date_end); + if (! is_null($room_id)) + $o->where('room_id','=',$room_id); + + // Set all open dayes to 0 + foreach ($open_dates as $k=>$v) + if ($v === TRUE) + $open_dates[$k] = 0; + + foreach ($o->find_all() as $date => $rco) { + foreach ($open_dates as $day=>$open) { + if ($open === FALSE or $rco->date_start > $day OR $rco->date_stop < $day) + continue; + + $open_dates[$day] = $rco->day(date('w',$day)); + } + } + + foreach ($open_dates as $day=>$open) { + $dayname = substr(date('D',$day),0,1); + + if ($open === FALSE) + $result .= $markup ? sprintf('%s',$dayname) : '-'; + elseif ($open) + $result .= $markup ? sprintf('%s',($code=='P' ? 'fa-circle' : 'fa-circle-o'),($code=='P' ? 'white' : 'black'),$dayname) : $dayname; + else + $result .= $markup ? sprintf('%s',$dayname) : strtolower($dayname); + } + + return $result; + } + + public function name() { + return sprintf('%s, %s',strtoupper($this->family_name),$this->first_name); + } + public function save(Validation $validation=NULL) { $changed = $this->changed(); parent::save($validation); - // Insert into waitlist - $rco = ORM::factory('Room_Children',array('child_id'=>$this,'code'=>$_POST['room']['code'])); + // Process our Sub-Items and Validate them. + Sort::MASort($this->_sub_items,array('code','room_id','date_start','date_stop')); + $last = NULL; + foreach ($this->_sub_items as $rco) { + // If no dates are selected, clear this record. + if (! $rco->have_days()) { + if ($rco->loaded()) + $rco->delete(); - $rco->values($_POST['room']); - $rco->child_id = (string)$this; - - foreach ($_POST['room']['R'] as $k => $v) { - if (! $v OR isset($_POST['room']['d_'.$k])) continue; + } - $rco->{'d_'.$k} = NULL; + // If there is no last item, we'll accept this as is. + if (is_null($last) OR ($last->date_stop <= $rco->date_start)) { + $rco->save($validation); + $last = $rco; + + continue; + } + + // @todo: If our dates overlap, fix that + // @todo: Check that casual days dont overlap with permanent days + // @todo: Check that absent days are attending days + // @todo: Check that waitlist days dont overlap with permanent days + + if ($rco->changed() AND (! $rco->save())) + $rco->reload(); } - if ($rco->changed() AND (! $rco->save())) - $rco->reload()->values($_POST['room']); - return $this->reload(); } } diff --git a/application/classes/Model/Room/Children.php b/application/classes/Model/Room/Children.php index ebd5776..49af1ad 100644 --- a/application/classes/Model/Room/Children.php +++ b/application/classes/Model/Room/Children.php @@ -12,12 +12,19 @@ class Model_Room_Children extends ORM { protected $_belongs_to = array( 'child'=>array(), + 'room'=>array('model'=>'Rooms'), ); public function filters() { return Arr::merge(parent::filters(),array( - 'date_start'=>array(array('strtotime', array(':value'))), - 'date_stop'=>array(array('strtotime', array(':value'))), + 'date_start'=>array( + array('strtotime', array(':value')), + array('ORM::tostring', array(':value')), + ), + 'date_stop'=>array( + array('strtotime', array(':value')), + array('ORM::tostring', array(':value')), + ), )); } @@ -26,7 +33,20 @@ class Model_Room_Children extends ORM { unset($x['id']); - return $x; + return Arr::merge($x,array( + 'date_start'=>array( + array('not_empty'), + ), + 'date_stop'=>array( + array('not_empty'), + array(array($this,'validate_datestop'),array(':validation')), + ), + 'code' => array( + array(array($this,'validate_absentnoshow'),array(':validation',':value')), + array(array($this,'validate_absentnotice'),array(':validation',':value')), + array(array($this,'validate_casualrequest'),array(':validation',':value')), + ), + )); } protected $_display_filters = array( @@ -38,9 +58,58 @@ class Model_Room_Children extends ORM { ), ); - // @todo: Code A (availble) start/end dates cannot overlap with existing records - put in validation that it cannot be saved. public function day($day) { return $this->{'d_'.$day}; } + + /** + * Has a day been selected + */ + public function have_days() { + for ($i=0;$i<7;$i++) + if ($this->day($i)) + return TRUE; + + return FALSE; + } + + /** + * No show date cannot be in the future + */ + public function validate_absentnoshow($array,$code) { + return ($code != 'A') OR ($array['date_start'] < time()); + } + + /** + * Notice date cannot be in the past + */ + public function validate_absentnotice($array,$code) { + return ($code != 'a') OR ($array['date_start'] > time()); + } + + /** + * Casual Request cannot be in the past + */ + public function validate_casualrequest($array,$code) { + return ($code != 'c') OR ($array['date_start'] > time()); + } + + /** + * End date cannot be earlier than start date + */ + public function validate_datestop($array) { + return $array['date_start'] <= $array['date_stop']; + } + + /** + * Since we use checkboxes for dates, we need to unselect dates not selected + */ + public function values(array $values, array $expected = NULL) { + for ($i=0;$i<7;$i++) + if ($this->day($i) AND empty($values['d_'.$i])) + $this->{'d_'.$i} = NULL; + + return parent::values($values,$expected); + } } ?> diff --git a/application/classes/Model/Rooms.php b/application/classes/Model/Rooms.php index 59e2564..ed6b1a1 100644 --- a/application/classes/Model/Rooms.php +++ b/application/classes/Model/Rooms.php @@ -18,6 +18,8 @@ class Model_Rooms extends ORM { 'children'=>array('model'=>'Room_Children','far_key'=>'id','foreign_key'=>'room_id'), ); + protected $_form = array('id'=>'id','value'=>'name'); + public function availability_dates($date,$days=0,$code='A') { $result = array(); $x = $date; diff --git a/application/classes/Model/Setup.php b/application/classes/Model/Setup.php index 0972e22..9ccb574 100644 --- a/application/classes/Model/Setup.php +++ b/application/classes/Model/Setup.php @@ -78,6 +78,21 @@ class Model_Setup extends ORM { return $this; } + public function available_places($date_start,$days=0) { + $result = array(); + + foreach ($this->rooms->find_all() as $ro) { + foreach ($ro->room_availablity($date_start,$days) as $date => $total) { + if (! isset($result[$date])) + $result[$date] = 0; + + $result[$date] += $total; + } + } + + return $result; + } + public function module_config_id($key=NULL) { $result = array(); diff --git a/application/classes/StaticList/Room/Children.php b/application/classes/StaticList/Room/Children.php index 98ed707..aa0c826 100644 --- a/application/classes/StaticList/Room/Children.php +++ b/application/classes/StaticList/Room/Children.php @@ -11,8 +11,16 @@ */ class StaticList_Room_Children extends StaticList { protected function _table() { + // Lowercase items can be seleted by users + // Upper case items can only be selected by Staff return array( - 'W'=>_('Waitlist'), + 'A'=>_('Absent NoShow'), + 'a'=>_('Absent Notice'), + 'C'=>_('Casual Placement'), + 'c'=>_('Casual Request'), + 'r'=>_('Reduce Days'), + 'P'=>_('Permanent'), + 'w'=>_('Waitlist'), ); } diff --git a/application/messages/models/room_children.php b/application/messages/models/room_children.php new file mode 100644 index 0000000..77c20e5 --- /dev/null +++ b/application/messages/models/room_children.php @@ -0,0 +1,27 @@ +array( + 'not_empty'=>'End Date cannot be empty', + ), + 'date_stop'=>array( + 'not_empty'=>'End Date cannot be empty', + 'validate_datestop'=>'End Date cannot be earlier than Start Date', + ), + 'code'=>array( + 'validate_absentnoshow'=>'Absent No Show date cant be in the future', + 'validate_absentnotice'=>'Absent Notice date cant be in the past', + 'validate_casualrequest'=>'Casual Request date cant be in the past', + ), +); +?> diff --git a/application/views/child/director/add_edit.php b/application/views/child/director/add_edit.php new file mode 100644 index 0000000..aeeb436 --- /dev/null +++ b/application/views/child/director/add_edit.php @@ -0,0 +1,65 @@ +
+ id); ?> + +
+ +
+
+ display('first_name'),array('class'=>'form-control','placeholder'=>'First Name','required','nocg'=>TRUE)); ?> +
+
+ display('family_name'),array('class'=>'form-control','placeholder'=>'Family Name','required','nocg'=>TRUE)); ?> +
+
+
+ +
+ +
+
+ display('dob'),array('class'=>'form-control','placeholder'=>'DOB','required','nocg'=>TRUE,'readonly')); ?> + +
+
+
+ Age:
dob ? $o->age() : ''; ?>

+
+
+ +
+ +
+ + + + + + open_days() as $d => $open) : ?> + + + + + + + + subitems() as $rco) echo View::factory('child/director/add_roomrow')->set('o',$o)->set('so',$so)->set('rco',$rco)->set('row',$x++)->set('type',$rco->code); ?> + +
RoomP/C/WStart and End Dates
+
+ + + + + + + +
+
+
+ +
+
+ + +
+
diff --git a/application/views/child/director/add_roomrow.php b/application/views/child/director/add_roomrow.php new file mode 100644 index 0000000..9acc6b2 --- /dev/null +++ b/application/views/child/director/add_roomrow.php @@ -0,0 +1,65 @@ + + id); ?> + + id) ? $rco->room->display('name') : Form::select(sprintf('room[%s][room_id]',$row),ORM::factory('Rooms')->list_select(TRUE),$rco->room_id,array('class'=>'form-control','nocg'=>TRUE)); + } + ?> + + id) ? StaticList_Room_Children::get($rco->code) : StaticList_Room_Children::form(sprintf('room[%s][code]',$row),$rco->code ? $rco->code : $type,FALSE,array('class'=>'form-control','nocg'=>TRUE)); + } + ?> + + open_days() as $d => $open) : ?> + + loaded()) : ?> + + + day($d)): ?> + code,array('a','P','w','c'))) : ?> + day($d) ? TRUE : FALSE,array('nocg'=>TRUE,($open ? '': 'disabled'))); ?> + + + + + code,array('C'))) : ?> + day($d) ? TRUE : FALSE,array('nocg'=>TRUE,($open ? '': 'disabled'))); ?> + +   + + + + + day($d) ? TRUE : FALSE,array('nocg'=>TRUE,($open ? '': 'disabled'))); ?> + + + + + +
loaded()) : ?>data-date-start-date="display('dob'); ?>" data-date-end-date="date_enrol_max(TRUE); ?>" data-date-today-btn="true"> +
+ date_start ? $rco->display('date_start') : Site::Date(time()),array('class'=>'form-control','placeholder'=>'Start','nocg'=>TRUE,'readonly')); ?> + to + date_stop ? $rco->display('date_stop') : '',array('class'=>'form-control','placeholder'=>'End','nocg'=>TRUE,'readonly')); ?> +
+ + diff --git a/application/views/child/user/add_edit.php b/application/views/child/user/add_edit.php index 447dcd1..470a395 100644 --- a/application/views/child/user/add_edit.php +++ b/application/views/child/user/add_edit.php @@ -1,6 +1,8 @@
Register Child + id); ?> +
@@ -27,12 +29,13 @@
- +
- +
- + + open_days() as $d => $open) : ?> @@ -42,32 +45,14 @@ - subitems() as $rco) : ?> - - child_id); ?> - code); ?> - - open_days() as $d => $open) : ?> - - - - - - + subitems() as $rco) echo View::factory('child/user/add_roomrow')->set('o',$o)->set('so',$so)->set('rco',$rco)->set('row',$x++)->set('type',$rco->code); ?>
 RoomP/C/W
code); ?> - day($d) ? TRUE : FALSE,array('nocg'=>TRUE,$open ? '': 'disabled')); ?> - day($d)); ?> - -
- date_start ? $rco->display('date_start') : Site::Date(time()),array('class'=>'form-control','placeholder'=>'Start','required','nocg'=>TRUE,'readonly')); ?> - -
-
- date_stop ? $rco->display('date_stop') : '',array('class'=>'form-control','placeholder'=>'End','required','nocg'=>TRUE,'readonly')); ?> - -
-
+
+ + + +
diff --git a/application/views/child/user/add_roomrow.php b/application/views/child/user/add_roomrow.php new file mode 100644 index 0000000..13fd1e8 --- /dev/null +++ b/application/views/child/user/add_roomrow.php @@ -0,0 +1,66 @@ + + + + code,$allowed_updates) ? $rco->id : NULL); ?> + + id) ? $rco->room->display('name') : Form::select(sprintf('room[%s][room_id]',$row),ORM::factory('Rooms')->list_select(TRUE),$rco->room_id,array('class'=>'form-control','nocg'=>TRUE)); + } + ?> + + id) ? StaticList_Room_Children::get($rco->code) : StaticList_Room_Children::form(sprintf('room[%s][code]',$row),$rco->code,FALSE,array('class'=>'form-control','nocg'=>TRUE)); + } + ?> + + open_days() as $d => $open) : ?> + + loaded()) : ?> + + + day($d)): ?> + code,$allowed_updates)) : ?> + day($d) ? TRUE : FALSE,array('nocg'=>TRUE,($open ? '': 'disabled'))); ?> + + + + +   + + + + day($d) ? TRUE : FALSE,array('nocg'=>TRUE,($open ? '': 'disabled'))); ?> + + + + + +
+ date_start ? $rco->display('date_start') : Site::Date(time()),array('class'=>'form-control','placeholder'=>'Start','nocg'=>TRUE,'readonly')); ?> + + + +
+ date_stop ? $rco->display('date_stop') : '',array('class'=>'form-control','placeholder'=>'End','nocg'=>TRUE,'readonly')); ?> + +
+ + diff --git a/application/views/room/availability.php b/application/views/room/availability.php index 38fa098..b5d37bf 100644 --- a/application/views/room/availability.php +++ b/application/views/room/availability.php @@ -51,12 +51,24 @@   + + + Availability +   + + + + + +   + + - + New Applications   - child_list_date($date,$days,'W')) as $x) : ?> + child_list_date($date,$days,'w')) as $x) : ?> @@ -78,54 +90,48 @@   - - -   - Permanent -   - child_list_date($date,$days)) as $x) : ?> - - -   - + 'Permanent', + 'a'=>'Absent', + 'C'=>'Casual', + ) as $code => $title) : ?> - - -   - Absent -   - child_list_date($date,$days,'a')) as $x) : ?> - - -   - - - - -   - Casual -   - child_list_date($date,$days,'C')) as $x) : ?> - - -   - + +   + id,$date,$code)),$title); ?> +   + child_list_date($date,$days,$code) as $day=>$x) : ?> + id,$day,$code)),count($x)); ?> + +   + +   + +   + id.':'.$date.':w:7'),'Waitlist'); ?> +   + child_list_date($date,$days,'w') as $day=>$x) : ?> + id.':'.$day.':w:1'),count($x)); ?> + +   + +   - Waitlist + id.':'.$date.':w:7'),'Casual Request'); ?>   - child_list_date($date,$days,'W')) as $x) : ?> - + child_list_date($date,$days,'c') as $day=>$x) : ?> + id.':'.$day.':c:1'),count($x)); ?>   - +   Availability