<?php

/** @var \RedDevil\ViewModels\LectureViewModel $model */
?>
<div class="btn-group-xs" role="group" aria-label="">
    <?php 
use RedDevil\ViewHelpers\ActionLink;
ActionLink::create()->setAttribute('href', '/conferences/' . $model->getConferenceId() . '/lectures/' . $model->getId() . '/invite')->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setData('Invite Speaker')->render();
ActionLink::create()->setAttribute('href', '/lectures/' . $model->getId() . '/halls')->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setData('Select Hall')->render();
ActionLink::create()->setAttribute('href', '/lectures/' . $model->getId() . '/addbreak')->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setData('Add Break')->render();
ActionLink::create()->setAttribute('href', '/lectures/' . $model->getId() . '/delete/confirm')->setAttribute('class', 'btn btn-danger')->setNewLineAfter(true)->setData('Delete Lecture')->render();
?>
    <br/>
</div>
<?php

use RedDevil\ViewHelpers\ActionLink;
use RedDevil\ViewHelpers\CSFRToken;
use RedDevil\ViewHelpers\Form;
use RedDevil\ViewHelpers\SubmitButton;
use RedDevil\ViewHelpers\TextField;
?>
<div class="col-md-9">
    <h2>Add hall</h2>

    <?php 
$form = new Form('add-hall-form', '/venues/createhall');
$form->setAttribute('method', 'post');
$form->setAttribute('action', '/venues/createhall');
$form->addTextField(TextField::create()->setAttribute('id', 'id')->setAttribute('name', 'venueId')->setAttribute('value', $model)->setAttribute('hidden', 'hidden'));
$form->addTextField(TextField::create()->setAttribute('class', 'form-control')->setAttribute('id', 'title')->addLabel('Name', true)->setAttribute('name', 'title'));
$form->addTextField(TextField::create()->setAttribute('class', 'form-control')->setAttribute('id', 'capacity')->addLabel('Capacity', true)->setAttribute('name', 'capacity'));
$form->addSubmitButton(SubmitButton::create()->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setAttribute('value', 'Create'));
$form->addActionLink(ActionLink::create()->setNewLineBefore(false)->setAttribute('id', 'cancel')->setAttribute('href', '/venues/own')->setData('Cancel')->setAttribute('class', 'btn btn btn-primary'));
$form->addCSRFToken(CSFRToken::create()->setAttribute('name', 'ValidationToken'));
$form->render();
?>
</div>
                 <?php 
 echo $lecture->getTitle();
 ?>
             </h3>
         </div>
         <div class="panel-body">
             <div class="media">
                 <div class="media-body">
                     <strong>Speaker: </strong>
                     <?php 
 if ($lecture->getSpeakerId() != null && $lecture->getSpeakerRequestStatus() == 1) {
     ActionLink::create()->setAttribute('href', '/users/' . $lecture->getSpeakerUsername() . '/info')->setNewLineAfter(false)->setData($lecture->getSpeakerUsername())->render();
     echo " <span class='label label-success'>confirmed</span>";
 } else {
     if ($lecture->getSpeakerId() != null && $lecture->getSpeakerRequestStatus() == 0) {
         ActionLink::create()->setAttribute('href', '/users/' . $lecture->getSpeakerUsername() . '/info')->setNewLineAfter(false)->setData($lecture->getSpeakerUsername())->render();
         echo " <span class='label label-warning'>not confirmed</span>";
     } else {
         echo '(not available)';
     }
 }
 ?>
                     <br/>
                     <strong>At hall: </strong>
                     <?php 
 echo $lecture->getHallTitle();
 ?>
                     <br/>
                     <strong>Start: </strong>
                     <?php 
 echo $lecture->getStartDate();
    <?php 
foreach ($model as $venue) {
    ?>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <?php 
    \RedDevil\ViewHelpers\ActionLink::create()->setAttribute('href', '/venues/details/' . $venue->getId())->setData($venue->getTitle())->render();
    ?>
                </h3>
            </div>
            <div class="panel-body">
                <div class="media">
                    <div class="media-body">
                        <strong>Address: </strong>
                        <?php 
    echo $venue->getAddress();
    ?>
                        <br />
                        <strong>Owner:</strong>
                        <?php 
    \RedDevil\ViewHelpers\ActionLink::create()->setAttribute('href', '/users/' . $venue->getOwnerUsername() . '/info')->setData($venue->getOwnerUsername())->render();
    ?>
                    </div>
                </div>
            </div>
        </div>
    <?php 
}
?>
</div>
                        <br/>
                        <strong>Starts on: </strong>
                        <?php 
    echo $request->getStartDate();
    ?>
                        <br/>
                        <strong>Ends on: </strong>
                        <?php 
    echo $request->getEndDate();
    ?>
                        <br/>
                        <br/>
                        <?php 
    ActionLink::create()->setAttribute('href', '/venues/approverequest/' . $request->getId())->setAttribute('class', 'btn btn-success')->setNewLineAfter(false)->setData('Approve')->render();
    ?>
                        <?php 
    ActionLink::create()->setAttribute('href', '/venues/rejectrequest/' . $request->getId())->setAttribute('class', 'btn btn-danger')->setNewLineAfter(false)->setData('Reject')->render();
    ?>
                    </div>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <?php 
if (count($model) == 0) {
    echo "You don't have any pending venue requests at the moment.";
}
?>
</div>
<?php

/** @var \RedDevil\ViewModels\NotificationViewModel[] $model */
use RedDevil\ViewHelpers\ActionLink;
?>

<div class="col-md-9">
    <h2>Notifications</h2>
        <?php 
ActionLink::create()->setAttribute('href', '/notifications/markAllAsRead')->setAttribute('class', 'btn btn-warning')->setData('Mark all as read')->render();
?>
    <br/>
    <?php 
foreach ($model as $notification) {
    ?>
        <div class="panel panel-default">
            <div class="panel-body">
                <strong>Date: </strong>
                <?php 
    echo $notification->getCreatedOn();
    ?>
 <br/>
                <strong>Text: </strong>
                <?php 
    echo $notification->getContent();
    ?>
            </div>
        </div>
    <?php 
}
?>
<div class="col-md-7">
    <h2>Add Lecture</h2>
    <ul>
        <?php 
foreach ($model->getErrors() as $error) {
    ?>
            <li>
                <?php 
    echo $error->getMessage();
    ?>
            </li>
        <?php 
}
?>
    </ul>
    <?php 
$form = new Form('add-lecture-form', 'lectures/add/' . $model->getConferenceId());
$form->setAttribute('method', 'post');
$form->setAttribute('action', '/lectures/add/' . $model->getConferenceId());
$form->addTextField(TextField::create()->setAttribute('class', 'form-control')->setAttribute('id', 'title')->addLabel('Title', true)->setAttribute('name', 'title'));
$form->addLabel(Label::create()->setNewLineAfter(false)->setData("Description")->setAttribute('class', 'control-label')->setAttribute('for', 'description'));
$form->addTextArea(TextArea::create()->setAttribute('class', 'form-control')->setAttribute('id', 'description')->setAttribute('name', 'description'));
$form->addDateTimeField(DateTimeField::create()->setAttribute('class', 'form-control')->setAttribute('id', 'startDate')->addLabel('Start date', true)->setAttribute('name', 'startDate'));
$form->addDateTimeField(DateTimeField::create()->setAttribute('class', 'form-control')->setAttribute('id', 'endDate')->addLabel('End date', true)->setAttribute('name', 'endDate'));
$form->addTextField(TextField::create()->setAttribute('hidden', 'hidden')->setAttribute('name', 'conferenceId')->setAttribute('value', $model->getConferenceId()));
$form->addSubmitButton(SubmitButton::create()->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setAttribute('value', 'Create'));
$form->addActionLink(ActionLink::create()->setNewLineBefore(false)->setAttribute('id', 'cancel')->setAttribute('href', '/conferences/details/' . $model->getConferenceId())->setData('Cancel')->setAttribute('class', 'btn btn btn-primary'));
$form->addCSRFToken(CSFRToken::create()->setAttribute('name', 'ValidationToken'));
$form->render();
?>
</div>
    ?>
                        <br/>
                        <strong>Participants: </strong>
                        <?php 
    echo $lecture->getParticipantsCount();
    ?>
                        <br/>
                        <?php 
    if ($model->getOwnerId() == HttpContext::getInstance()->getIdentity()->getUserId()) {
        new View("Conferences", "_LectureMenu", $lecture, null);
    }
    ?>
                        <?php 
    if ($lecture->getHallId() !== '') {
        if ($lecture->getIsParticipating() == false && $lecture->getCanParticipate() == true) {
            ActionLink::create()->setAttribute('href', '/lectures/' . $lecture->getId() . '/participate')->setAttribute('class', 'btn btn-success pull-right')->setNewLineAfter(false)->setData('Join')->render();
        } else {
            echo "<a class='btn btn-success pull-right' disabled>Join</a>";
        }
    }
    ?>
                    </div>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <?php 
if (count($model->getLectures()) == 0) {
    echo 'This conference have no lectures at the moment.';
<?php

/** @var \RedDevil\ViewModels\ConferenceDetailsViewModel $model */
?>
<div class="btn-group" role="group" aria-label="">
    <?php 
use RedDevil\ViewHelpers\ActionLink;
ActionLink::create()->setAttribute('href', '/lectures/add/' . $model->getId())->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setData('Add Lecture')->render();
ActionLink::create()->setAttribute('href', '/conferences/' . $model->getId() . '/requestvenue')->setAttribute('class', 'btn btn-default')->setNewLineAfter(false)->setData('Book Venue')->render();
ActionLink::create()->setAttribute('href', '/conferences/' . $model->getId() . '/delete/confirm')->setAttribute('class', 'btn btn-danger')->setNewLineAfter(false)->setData('Delete Conference')->render();
?>
</div>
                        <br/>
                        <strong>Starts on: </strong>
                        <?php 
    echo $invitation->getStartDate();
    ?>
                        <br/>
                        <strong>Ends on: </strong>
                        <?php 
    echo $invitation->getEndDate();
    ?>
                        <br/>
                        <br/>
                        <?php 
    ActionLink::create()->setAttribute('href', '/users/approveinvitation/' . $invitation->getId())->setAttribute('class', 'btn btn-success')->setNewLineAfter(false)->setData('Approve')->render();
    ?>
                        <?php 
    ActionLink::create()->setAttribute('href', '/users/rejectinvitation/' . $invitation->getId())->setAttribute('class', 'btn btn-danger')->setNewLineAfter(false)->setData('Reject')->render();
    ?>
                    </div>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <?php 
if (count($model) == 0) {
    echo "You don't have any pending venue requests at the moment.";
}
?>
</div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <?php 
    echo $hall->getTitle();
    ?>
                </h3>
            </div>
            <div class="panel-body">
                <div class="media">
                    <div class="media-body">
                        <strong>Capacity: </strong>
                        <?php 
    echo $hall->getCapacity();
    if ($model->getOwnerUsername() == HttpContext::getInstance()->getIdentity()->getUsername()) {
        ActionLink::create()->setAttribute('href', '/venues/' . $model->getId() . '/deletehall/' . $hall->getId() . '/confirm')->setAttribute('class', 'btn btn-danger pull-right')->setData('Delete')->render();
    }
    ?>
                    </div>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <?php 
if (count($model->getHalls()) == 0) {
    echo 'No halls for this venue are available at the moment.';
}
?>
</div>