ChrisBAshton/smartresolution

View on GitHub
webapp/core/view/dispute_view--single.html

Summary

Maintainability
Test Coverage
<h1>Dispute: <?php echo $dispute->getTitle(); ?></h1>

<?php
$currentLifespan = $dispute->getCurrentLifespan();
if ($currentLifespan->accepted()) :

    $prettyStartTime = prettyTime($currentLifespan->startTime());
    $prettyEndTime   = prettyTime($currentLifespan->endTime());

    if ($currentLifespan->isEnded()) {
        $className = 'bg-danger';
        $status    = 'Dispute has ended. Lifespan was: ' . $prettyStartTime . ' until ' . $prettyEndTime;
    }
    elseif ($currentLifespan->isCurrent()) {
        $className = 'bg-success';
        $status    = 'Current dispute lifespan: ' . $prettyStartTime . ' until ' . $prettyEndTime;
    }
    else {
        $className = 'bg-warning';
        $status    = 'The dispute is currently on hold until the new lifespan comes into effect. If this is taking too long, you can always re-negotiate a new lifespan.';
    }
?>
    <div class="row">
        <p class="text-center <?php echo $className; ?>">
            <?php
                echo $status;
            ?>
        </p>
    </div>
<?php
endif;
?>

<div class="row">

    <div class="col-sm-6">

        <?php
        $mediationState = $dispute->getMediationState();
        if ($mediationState->inMediation()) :
        ?>

        <div class="row">
            <div class="col-sm-12">

                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h3 class="panel-title">In Mediation</h3>
                    </div>
                    <div class="panel-body">
                        Being mediated by <?php echo $mediationState->getMediator(); ?> of <?php echo $mediationState->getMediationCentre(); ?>.
                    </div>
                </div>

            </div>
        </div>

        <?php endif; ?>

        <div class="row">

            <div class="col-sm-6">
                <p>
                    <?php if ($dispute->getPartyA()->getLawFirm()) : ?>
                        Initiatiated by company: <?php echo $dispute->getPartyA()->getLawFirm(); ?>

                        <br />

                        <?php
                            if ($dispute->getPartyA()->getAgent()) {
                                echo 'Represented by: ' . $dispute->getPartyA()->getAgent();
                            } else {
                                echo 'Waiting for ' . $dispute->getPartyA()->getLawFirm()->getName() . ' to assign an agent to the dispute.';
                            }
                        ?>
                    <?php endif; ?>
                </p>

                <p><em>
                    <?php
                        if ($dispute->getPartyA()->getSummary()) {
                            echo $dispute->getPartyA()->getSummary();
                        }
                        else {
                            echo 'Awaiting summary.';
                        }
                    ?>
                </em></p>
            </div>

            <div class="col-sm-6">
                <p>
                    <?php if ($dispute->getPartyB()->getLawFirm()) : ?>
                        Opened against company: <?php echo $dispute->getPartyB()->getLawFirm(); ?>

                        <br />

                        <?php
                            if ($dispute->getPartyB()->getAgent()) {
                                echo 'Represented by: ' . $dispute->getPartyB()->getAgent();
                            } else {
                                echo 'Waiting for ' . $dispute->getPartyB()->getLawFirm()->getName() . ' to assign an agent to the dispute.';
                            }
                        ?>
                    <?php else: ?>
                        Still need to open the dispute against another law firm.
                    <?php endif; ?>
                </p>

                <p><em>
                    <?php
                        if ($dispute->getPartyB()->getSummary()) {
                            echo $dispute->getPartyB()->getSummary();
                        }
                        else {
                            echo 'Awaiting summary.';
                        }
                    ?>
                </em></p>
            </div>

        </div>
    </div>

    <div class="col-sm-6">
        <?php echo $this->render('dashboard.html'); ?>
    </div>
</div>