<?php
$this->extend('/Common/admin_edit');
$this->Croogo->adminScript('Sfdec.admin');
$this->Html
        ->addCrumb('', '/admin', array('icon' => $this->Theme->getIcon('home')))
        ->addCrumb(__d('croogo', 'Allies'), array('controller' => 'Allies', 'action' => 'index'));

if ($this->request->params['action'] == 'admin_edit') {
    $this->Html->addCrumb($this->request->data['Ally']['label']);
}

if ($this->request->params['action'] == 'admin_add') {
    $this->Html->addCrumb(__d('croogo', 'Add'), '/' . $this->request->url);
}

$this->append('form-start', $this->Form->create('Ally'));

$inputDefaults = $this->Form->inputDefaults();
$inputClass = isset($inputDefaults['class']) ? $inputDefaults['class'] : null;

$this->append('tab-heading');
echo $this->Croogo->adminTab(__d('croogo', 'Ally'), '#ally-basic');
echo $this->Croogo->adminTabs();
$this->end();

$this->append('tab-content');

echo $this->Html->tabStart('ally-basic') .
 $this->Form->input('id') .
 $this->Form->input('label', array(
    'label' => __d('croogo', 'Name'),
));
echo $this->Form->input('base_value', array(
    'label' => __d('croogo', 'Base Value'),
));
echo $this->Form->input('ult_value', array(
    'label' => __d('croogo', 'Ultimate Value'),
));
echo $this->Html->tabEnd();

echo $this->Croogo->adminTabs();
$this->end();

$this->append('panels');
echo $this->Html->beginBox(__d('croogo', 'Publishing')) .
 $this->Form->button(__d('croogo', 'Apply'), array('name' => 'apply')) .
 $this->Form->button(__d('croogo', 'Save'), array('button' => 'success')) .
 $this->Html->link(
        __d('croogo', 'Cancel'), array('action' => 'index'), array('button' => 'danger')
);

echo $this->Html->endBox();

echo $this->Croogo->adminBoxes();
if ($this->request->params['action'] == 'admin_edit') {
    ?>
    <div class="box">
        <div class="box-title">Fodder Info</div>
        <div class="box-content">
            <?php
            echo "<p>";
            if (isset($fodder) && !empty($fodder)) {
                //echo debug($fodder);
                echo "<ul>";
                foreach ($fodder as $i => $ally) {
                    echo "<li>" . $ally['Fodder']['label'] . "</li>";
                }
                echo "</ul>";
            }
            echo $this->Html->link(
                    __d('croogo', 'Add Fodder Allies'), array('controller' => 'chords', 'action' => 'add', $this->request->data['Ally']['id']), array('button' => 'blue')
            );
            echo "</p>";
            ?>
        </div>
    </div>

    <?php
}
$this->end();

$this->append('form-end', $this->Form->end());
