41
41
</t-input-group >
42
42
</t-form-section >
43
43
</t-form-content >
44
+ <ssh-pre copy-button =" true" language =" html" label =" Code" >{{sampleCode.html}}</ssh-pre >
45
+ <ssh-pre copy-button =" true" language =" js" label =" JS" >{{sampleCode.js}}</ssh-pre >
44
46
</template >
45
47
</app-layout >
46
48
</template >
@@ -55,9 +57,11 @@ import TInputText from "@/Components/Form/Inputs/TInputText";
55
57
import TInputDropdown from " @/Components/Form/Inputs/TInputDropdown" ;
56
58
import TInputDropdownItem from " @/Components/Form/Inputs/TInputDropdownItem" ;
57
59
import TInputTextArea from " @/Components/Form/Inputs/TInputTextArea" ;
60
+ import SshPre from ' simple-syntax-highlighter'
61
+ import ' simple-syntax-highlighter/dist/sshpre.css'
58
62
export default {
59
63
name: " FormStructure" ,
60
- components: {AppLayout,TButton,TFormSection,TFormContent,TInputGroup,TInputText,TInputDropdown,TInputDropdownItem,TInputTextArea},
64
+ components: {AppLayout,TButton,TFormSection,TFormContent,TInputGroup,TInputText,TInputDropdown,TInputDropdownItem,TInputTextArea,SshPre },
61
65
data () {
62
66
return {
63
67
loading: false ,
@@ -73,7 +77,88 @@ export default {
73
77
status: [
74
78
{name: ' Passive' , value: 0 , icon: ' XIcon' ,class: ' w-5 h-5 text-red-500 mr-2' },
75
79
{name: ' Active' , value: 1 , icon: ' Checked' ,class: ' w-5 h-5 text-green-500 mr-2' }
76
- ]
80
+ ],
81
+ sampleCode: {
82
+ html: ' <t-form-content @submitted="save" @reset="reset">\n ' +
83
+ ' <t-form-section\n ' +
84
+ ' title="Personal Infos"\n ' +
85
+ ' description="This information is subject to personal data protection law.">\n ' +
86
+ ' <!-- Name -->\n ' +
87
+ ' <t-input-group label="Name" labelFor="name" class="col-span-12 md:col-span-6">\n ' +
88
+ ' <t-input-text id="name" v-model="form.name" placeholder="Business mail address"/>\n ' +
89
+ ' </t-input-group>\n ' +
90
+ ' <!-- Tax ID -->\n ' +
91
+ ' <t-input-group label="Tax ID" labelFor="tax_id" class="col-span-12 md:col-span-6">\n ' +
92
+ ' <t-input-text id="tax_id" v-model="form.tax_id"/>\n ' +
93
+ ' </t-input-group>\n ' +
94
+ ' <!-- Phone -->\n ' +
95
+ ' <t-input-group label="Phone" labelFor="phone" class="col-span-12 md:col-span-6">\n ' +
96
+ ' <t-input-text id="phone" name="phone" v-model="form.phone" mask="+99(999) 999-9999" />\n ' +
97
+ ' </t-input-group>\n ' +
98
+ ' <!-- Email -->\n ' +
99
+ ' <t-input-group label="Email" labelFor="email" class="col-span-12 md:col-span-6">\n ' +
100
+ ' <t-input-text id="email" v-model="form.email"/>\n ' +
101
+ ' </t-input-group>\n ' +
102
+ ' <!-- Status -->\n ' +
103
+ ' <t-input-group label="Status" labelFor="status" class="col-span-12 md:col-span-6">\n ' +
104
+ ' <t-input-dropdown v-model="form.status" :clear-button="true">\n ' +
105
+ ' <t-input-dropdown-item value="0"><font-awesome-icon icon="check" class="text-green-500 mr-2"/>Active</t-input-dropdown-item>\n ' +
106
+ ' <t-input-dropdown-item value="1"><font-awesome-icon icon="minus-circle" class="text-red-500 mr-2"/>Passive</t-input-dropdown-item>\n ' +
107
+ ' </t-input-dropdown>\n ' +
108
+ ' </t-input-group>\n ' +
109
+ ' <!-- Address -->\n ' +
110
+ ' <t-input-group label="Address" labelFor="address" class="col-span-12">\n ' +
111
+ ' <t-input-text-area id="address" v-model="form.address" :rows="3" :clear-button="true" :counter="true" placeholder="Full address"/>\n ' +
112
+ ' </t-input-group>\n ' +
113
+ ' </t-form-section>\n ' +
114
+ ' </t-form-content>' ,
115
+ js: ' import TFormSection from "@/Components/Form/TFormSection";\n ' +
116
+ ' import TFormContent from "@/Components/Form/TFormContent";\n ' +
117
+ ' import TInputGroup from "@/Components/Form/TInputGroup";\n ' +
118
+ ' import TInputText from "@/Components/Form/Inputs/TInputText";\n ' +
119
+ ' import TInputDropdown from "@/Components/Form/Inputs/TInputDropdown";\n ' +
120
+ ' import TInputDropdownItem from "@/Components/Form/Inputs/TInputDropdownItem";\n ' +
121
+ ' import TInputTextArea from "@/Components/Form/Inputs/TInputTextArea";\n ' +
122
+ ' export default {\n ' +
123
+ ' name: "FormStructure",\n ' +
124
+ ' components: {TFormSection,TFormContent,TInputGroup,TInputText,TInputDropdown,TInputDropdownItem,TInputTextArea},\n ' +
125
+ ' data() {\n ' +
126
+ ' return {\n ' +
127
+ ' loading: false,\n ' +
128
+ ' form: this.$inertia.form({\n ' +
129
+ ' _method: \' POST\' ,\n ' +
130
+ ' name : null,\n ' +
131
+ ' tax_id : null,\n ' +
132
+ ' email : null,\n ' +
133
+ ' phone : null,\n ' +
134
+ ' status : null,\n ' +
135
+ ' address : null,\n ' +
136
+ ' }),\n ' +
137
+ ' status: [\n ' +
138
+ ' {name: \' Passive\' , value: 0, icon: \' XIcon\' ,class: \' w-5 h-5 text-red-500 mr-2\' },\n ' +
139
+ ' {name: \' Active\' , value: 1, icon: \' Checked\' ,class: \' w-5 h-5 text-green-500 mr-2\' }\n ' +
140
+ ' ],\n ' +
141
+ ' };\n ' +
142
+ ' },\n ' +
143
+ ' methods: {\n ' +
144
+ ' reset: function () {\n ' +
145
+ ' this.form.name = null;\n ' +
146
+ ' this.form.tax_id = null;\n ' +
147
+ ' this.form.email = null;\n ' +
148
+ ' this.form.phone = null;\n ' +
149
+ ' this.form.status = null;\n ' +
150
+ ' this.form.address = null;\n ' +
151
+ ' },\n ' +
152
+ ' save() {\n ' +
153
+ ' this.form.post(route(\' customer.store\' ), {\n ' +
154
+ ' errorBag: \' customer\' ,\n ' +
155
+ ' preserveScroll: true,\n ' +
156
+ ' });\n ' +
157
+ ' this.loading = true;\n ' +
158
+ ' }\n ' +
159
+ ' },\n ' +
160
+ ' }\n '
161
+ },
77
162
};
78
163
},
79
164
methods: {
@@ -99,3 +184,30 @@ export default {
99
184
<style scoped>
100
185
101
186
</style >
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
0 commit comments