<?php $katao_member = $form->getObject() ?>
<div class="content-add01">
	<div class="heading01"><h1><?php echo $katao_member->isNew() ? 'Ajout' : 'Modification' ?> d'un adhérent</h1></div>
</div>

<form action="<?php echo url_for('kataoMember/update'.(!$katao_member->isNew() ? '?id='.$katao_member->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
  <table>
    <tfoot>
      <tr>
        <td colspan="2">
          <br /><input type="submit" value="Sauver" /> ou <a href="<?php echo url_for('kataoMember/index') ?>">annuler</a>
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?php echo $form->renderGlobalErrors() ?>
  <?php if (!$sf_user->isJustDelegate()): ?>
	  <tr valign="top">
        <th align="left">Noeuds : <?php echo $form['katao_node_id']->renderLabel() ?>/<?php echo $form['next_katao_node_id']->renderLabel() ?></th>
        <td>
          <?php echo $form['katao_node_id'] ?>
          <?php echo $form['next_katao_node_id'] ?>
		  <?php echo $form['katao_node_id']->renderError() ?>
		  <?php echo $form['next_katao_node_id']->renderError() ?>
        </td>
      </tr>
  <?php else: ?>
     <tr valign="top">
        <th align="left"><label>Noeud</label></th>
        <td>
          <?php echo $sf_user->getInstance()->getKataoMember()->getKataoNode()->getCity() ?>
        </td>
      </tr>
  <?php endif ?>
      <tr valign="top">
        <th align="left"><?php echo $form['first_name']->renderLabel() ?></th>
        <td>
          <?php echo $form['first_name'] ?>
		  <?php echo $form['first_name']->renderError() ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><?php echo $form['last_name']->renderLabel() ?></th>
        <td>
          <?php echo $form['last_name'] ?>
		  <?php echo $form['last_name']->renderError() ?>
        </td>
      </tr>
  <?php if (!$katao_member->isNew()): ?>
      <tr valign="top">
        <th align="left"><label>Code comptable (€)</label></th>
        <td>
          <?php echo $katao_member->getAccountingCode() ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><label>Code comptable (<?php echo wpConfig::getAdditionalCurrencyName() ?>)</label></th>
        <td>
          <?php echo $katao_member->getAccountingCodeSol() ?>
        </td>
      </tr>
  <?php endif ?>
  <?php if (!$sf_user->isJustDelegate()): ?>
      <tr valign="top">
        <th align="left"><label>Permissions</label></th>
        <td>
          <?php echo $form['is_admin'] ?><?php echo $form['is_admin']->renderLabel() ?>
		  <?php echo $form['is_admin']->renderError() ?>
          <?php echo $form['is_referer'] ?><?php echo $form['is_referer']->renderLabel() ?>
		  <?php echo $form['is_referer']->renderError() ?>
          <?php echo $form['is_delegate'] ?><?php echo $form['is_delegate']->renderLabel() ?>
		  <?php echo $form['is_delegate']->renderError() ?>
        </td>
      </tr>
  <?php endif ?>
      <tr valign="top">
        <th align="left"><?php echo $form['is_anonymous']->renderLabel() ?></th>
        <td>
          <?php echo $form['is_anonymous'] ?>
		  <?php echo $form['is_anonymous']->renderError() ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><?php echo $form['is_member']->renderLabel() ?></th>
        <td>
          <?php echo $form['is_member'] ?>
		  <?php echo $form['is_member']->renderError() ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><?php echo $form['katao_member_id']->renderLabel() ?></th>
        <td>
          <?php echo $form['katao_member_id'] ?>
		  <?php echo $form['katao_member_id']->renderError() ?>

        <?php echo $form['id'] ?>

        <?php if ($sf_user->isJustDelegate()): ?>
          <?php echo input_hidden_tag('katao_member[katao_node_id]', $form['katao_node_id']->getValue()) ?>
          <?php echo input_hidden_tag('katao_member[next_katao_node_id]', $form['next_katao_node_id']->getValue()) ?>
          <?php echo input_hidden_tag('katao_member[is_admin]', $form['is_admin']->getValue()) ?>
          <?php echo input_hidden_tag('katao_member[is_referer]', $form['is_referer']->getValue()) ?>
          <?php echo input_hidden_tag('katao_member[is_delegate]', $form['is_delegate']->getValue()) ?>
          <?php echo input_hidden_tag('katao_member[card_number_sol]', $form['card_number_sol']->getValue()) ?>
        <?php endif ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><?php echo $form['initial_amount_euro']->renderLabel() ?></th>
        <td>
          <?php echo $form['initial_amount_euro'] ?>
		  <?php echo $form['initial_amount_euro']->renderError() ?>
        </td>
      </tr>
      <tr valign="top">
        <th align="left"><?php echo $form['initial_amount_sol']->renderLabel() ?></th>
        <td>
          <?php echo $form['initial_amount_sol'] ?>
		  <?php echo $form['initial_amount_sol']->renderError() ?>
        </td>
      </tr>
  <?php if (!$sf_user->isJustDelegate()): ?>
      <tr valign="top">
        <th align="left"><?php echo $form['card_number_sol']->renderLabel() ?></th>
        <td>
          <?php echo $form['card_number_sol'] ?>
		  <?php echo $form['card_number_sol']->renderError() ?>
        </td>
      </tr>
  <?php endif ?>
  	  <tr valign="top">
        <th align="left"><?php echo $form['created_at']->renderLabel() ?></th>
        <td>
          <?php echo $form['created_at'] ?>
		  <?php echo $form['created_at']->renderError() ?>
        </td>
      </tr>
	  <?php include_partial('katao/user', array('form' => $form, 'is_member' => true)) ?>
    </tbody>
  </table>
</form>