<?php

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

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

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

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

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

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

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

echo $this->Html->tabStart('contract-basic') .
 $this->Form->input('id') .
 $this->Form->input('customerName', array(
    'label' => __d('croogo', 'Name'),
));

if ($this->request->params['action'] != 'admin_edit') {
    echo $this->Form->input('value', array(
        'label' => __d('croogo', 'value'),
        'type' => 'text'
    ));
    echo $this->Form->input('startDate', array(
        'label' => __d('croogo', 'Start Date'),
        'type' => 'text',
        'class' => 'datepicker input-block-level'
    ));
    echo $this->Form->input('endDate', array(
        'label' => __d('croogo', 'End Date'),
        'type' => 'text',
        'class' => 'datepicker input-block-level'
    ));
}
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();
$this->end();

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