Skip to content

Instantly share code, notes, and snippets.

@uyab
Last active November 8, 2019 02:15
Show Gist options
  • Save uyab/7a1bbe0fb676027b146eef824d9ffa94 to your computer and use it in GitHub Desktop.
Save uyab/7a1bbe0fb676027b146eef824d9ffa94 to your computer and use it in GitHub Desktop.
Form Definition SemanticForm
<?php
return [
// Simple form field, translated to input type=text, name=email, label=Email, value=null
'email',
[
'type' => 'custom',
'name' => 'username',
'label' => 'Username',
'hint' => 'Will be prompted on login',
'value' => null,
'validations' => ['required'],
],
[
'type' => 'text',
'name' => 'username',
'label' => 'Username',
'hint' => 'Will be prompted on login',
'value' => null,
'validations' => ['required'],
],
[
'type' => 'segment',
'label' => 'Penghasilan',
'items' => [
[
'type' => 'number',
'name' => 'jumlah_anak',
'label' => 'Jumlah Anak',
'hint' => null,
],
[
'type' => 'rupiah',
'name' => 'gaji',
'label' => 'Gaji/bulan',
],
[
'type' => 'date',
'name' => 'dob',
'label' => 'Tanggal Lahir',
],
[
'type' => 'time',
'name' => 'jam_lahir',
'label' => 'Jam Lahir',
],
],
],
[
'type' => 'radioGroup',
'name' => 'country',
'label' => 'Country',
'options' => [62 => 'Indonesia', 60 => 'Malaysia', 33 => 'Thailand'],
],
[
'type' => 'dropdown',
'name' => 'country',
'label' => 'Country',
'hint' => null,
'options' => ['Asia' => [62 => 'Indonesia', 60 => 'Malaysia', 33 => 'Thailand']],
'value' => null,
'validations' => [],
],
[
'type' => 'dropdownDB',
'name' => 'province',
'label' => 'Provinsi',
'value' => null,
'hint' => null,
'query' => 'SELECT id, name from indonesia_provinces',
'query_key_column' => 'id',
'query_display_column' => 'name',
'validations' => [],
],
[
'type' => 'dropdownDB',
'name' => 'kabupaten',
'label' => 'Kabupaten',
'value' => null,
'hint' => null,
'query' => 'SELECT id, name from indonesia_cities where province_id = %s',
'query_key_column' => 'id',
'query_display_column' => 'name',
'validations' => [],
'dependency' => 'province',
],
// [
// 'type' => 'dropdownApi',
// 'name' => 'country',
// 'label' => 'Country',
// 'hint' => null,
// 'api' => 'https://api.laravolt.dev/v1/countries',
// 'ajax' => false, //if true, API akan dipanggil via Javascript setelah halaman ditampilkan
// 'value' => null,
// ],
[
'type' => 'segment',
'label' => 'Term of Service',
'items' => [
[
'type' => 'html',
'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...</p>',
],
[
'type' => 'checkbox',
'name' => 'is_wni',
'fieldLabel' => '',
'label' => 'Saya setuju persyaratan di atas',
],
],
],
[
'type' => 'action',
'items' => [
[
'type' => 'submit',
'name' => 'submit',
'label' => 'Submit',
],
[
'type' => 'button',
'name' => 'cancel',
'label' => 'Cancel',
],
],
],
];
@uyab
Copy link
Author

uyab commented Nov 6, 2019

Result
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment