contrepartie.html 3.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
<section id="ajout">
	<check if="{{ @id>0 }}">
	<true>
	<h2>Modification d'une contrepartie</h2>
	</true>
	<false>
	<h2>Ajout d'une contrepartie</h2>
	</false>
	</check>
	<form name="f" method="POST" action="{{ 'edit_counterpart', 'id='+@id | alias }}">
		<input type="hidden" name="taille" id="taille" value="{{ @contrepartie.taille }}" />
		<input type="hidden" name="user_id" id="user_id" value="{{ @contrepartie.user_id }}" />
		<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />

		<label for="quoi">Quoi</label>
		<select id="quoi" name="quoi" onchange="select_span()">
			<option value="piplome" <check if="{{ @contrepartie.quoi=='piplome' }}">selected</check> >piplome</option>
			<option value="pishirt" <check if="{{ @contrepartie.quoi=='pishirt' }}">selected</check> >pishirt</option>
			<option value="hoodie" <check if="{{ @contrepartie.quoi=='hoodie' }}">selected</check> >hoodie</option>
		</select>
		<br />

		<span id="quoi_taille">
			<label for="size">Taille</label>
			<select id="size" name="size" onchange="select_taille()">
				<repeat group="{{ @TAILLES }}" key="{{ @key }}" value="{{ @value }}">
				<option value="{{ @key }}" <check if="{{ @contrepartie.taille==@key }}">selected</check> >{{ @value }}</option>
				</repeat>
			</select>
		</span>
		<span id="quoi_pdf">
			<label for="url">Pdf</label>
			<select id="url" name="url" onchange="select_taille()">
				<repeat group="{{ @pdfs }}" value="{{ @pdf }}">
				<option value="{{ @pdf.id }}" <check if="{{ @contrepartie.taille==@pdf.id }}">selected</check> >{{ @pdf.pdf }} / {{ @pdf.nom }}</option>
				</repeat>
			</select>
		</span>
		<br />

		<label for="nom">Nom</label>
		<input type="text" id="nom" name="nom" size="30" value="{{ @contrepartie.nom }}" />
		<br />

		<label for="adresse">Adresse</label>
		<textarea id="adresse" name="adresse" cols="30" rows="2">{{ @contrepartie.adresse }}</textarea>
		<br />

		<label for="codepostal">Code postal</label>
		<input type="text" id="codepostal" name="codepostal" size="7" value="{{ @contrepartie.codepostal }}" />

		<label for="ville">Ville</label>
		<input type="text" id="ville" name="ville" size="30" value="{{ @contrepartie.ville }}" />
		<br />

		<label for="pays">Pays</label>
		<input type="text" id="pays" name="pays" size="30" value="{{ @contrepartie.pays }}" />
		<br />

		<label for="status">Statut</label>
		<select name="status" id="status">
			<repeat group="{{ @CT_STATUTS }}" key="{{ @key }}" value="{{ @value }}">
			<option value="{{ @key }}" <check if="{{ @contrepartie.status==@key }}">selected</check> >{{ @value }}</option>
			</repeat>
		</select>
		<br />

		<label for=commentaire">Commentaire</label>
		<textarea type="textarea" id="commentaire" name="commentaire" cols="30" rows="2">{{ @contrepartie.commentaire }}</textarea>
		<br />

		<check if="{{ @id>0 }}">
		<true>
		<input type="submit" value="Modifier cette contrepartie" />
		</true>
		<false>
		<input type="submit" value="Ajouter cette contrepartie" />
		</false>
		</check>
	</form>
	<form name="f2" method="POST" action="{{ 'counterparts' | alias }}">
		<input type="hidden" name="texte" id="texte" value="{{ @id }}" />
		<input type="submit" value="Voir cette contrepartie" />
	</form>
	<br />
	<check if="{{ @msg }}">
	<span class="error">{{ @msg }}</span>
	</check>
</section>

<script type="text/javascript">
document.forms['f'].nom.focus();

function select_span() {
	if (document.forms['f'].quoi.value=='piplome') {
		$('#quoi_pdf').show();
		$('#quoi_taille').hide();
	} else {
		$('#quoi_pdf').hide();
		$('#quoi_taille').show();
	}
	select_taille();
}

function select_taille() {
	if (document.forms['f'].quoi.value=='piplome') {
		document.forms['f'].taille.value = document.forms['f'].url.value;
	} else {
		document.forms['f'].taille.value = document.forms['f'].size.value;
	}
}

window.onload = function() {
	select_span();
	select_taille();
};
</script>