public function getForm(array $staff) { if (!$this->form) { $attendanceId = new Element\Hidden(); $attendanceId->setName('attendanceId'); $staffId = new Element\Select(); $staffId->setName('staffId')->setLabel('Staff')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($staff); $type = new Element\Select(); $type->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions(array('I' => 'In', 'O' => 'Out')); $date = new Element\Date(); $date->setName('attendanceDate')->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $workingHours = array(); for ($i = 8; $i < 20; $i++) { $workingHours[$i] = sprintf('%02d', $i); } $hour = new Element\Select(); $hour->setName('hour')->setAttribute('class', 'form-control')->setValueOptions($workingHours); $workingMinutes = array(); for ($i = 0; $i < 12; $i++) { $workingMinutes[$i] = sprintf('%02d', $i * 5); } $minute = new Element\Select(); $minute->setName('minute')->setAttribute('class', 'form-control')->setValueOptions($workingMinutes); $form = new Form(); $form->setAttributes(array('role' => 'form', 'class' => 'form-horizontal')); $form->add($attendanceId); $form->add($staffId); $form->add($type); $form->add($date); $form->add($hour); $form->add($minute); $this->form = $form; } return $this->form; }
public function getLeaveForm(array $leaveList) { $leaveType = new Element\Select(); $leaveType->setName('leaveType')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($leaveList); $date = new Element\Date(); $date->setName('date')->setLabel('Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $description = new Element\Textarea('description'); $description->setLabel('Description')->setAttribute('class', 'form-control'); $form = new Form(); $form->setAttribute('class', 'form'); $form->add($leaveType); $form->add($date); $form->add($description); return $form; }
public function getForm(array $staffList, array $statusList, array $leaveList, $formType = 'W') { if (!$this->form) { $leaveId = new Element\Hidden('leaveId'); $staff = new Element\Select(); $staff->setName('staffId')->setEmptyOption('-- Choose Staff --')->setLabel('Staff')->setAttribute('class', 'form-control')->setValueOptions($staffList); $leaveType = new Element\Select(); $leaveType->setName('leaveType')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($leaveList); $date = new Element\Date(); $date->setName('date')->setLabel('Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $description = new Element\Textarea('description'); $description->setLabel('Description')->setAttribute('class', 'form-control'); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList); if ($formType == 'R' || $formType == 'V') { $staff->setAttribute('disabled', 'disabled'); $leaveType->setAttribute('disabled', 'disabled'); $description->setAttribute('readonly', 'readonly'); } if ($formType == 'V') { $status->setAttribute('disabled', 'disabled'); $date = new Element\Text(); $date->setName('date')->setLabel('Date')->setattributes(array('class' => 'form-control', 'disabled' => 'disabled')); } $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($leaveId); $form->add($staff); $form->add($leaveType); $form->add($date); $form->add($description); $form->add($status); $this->form = $form; } return $this->form; }