Validation and conditional rendering of Generated Code section

This commit is contained in:
rockstardev
2018-08-16 21:55:24 +02:00
parent f0f4247c5d
commit ec59980e6f

View File

@@ -17,8 +17,10 @@
<div class="form-row">
<div class="form-group col-md-8">
<label>Price</label>
<input type="text" class="form-control"
v-model="srvModel.price" v-on:change="inputChanges">
<input name="price" type="text" class="form-control"
v-model="srvModel.price" v-on:change="inputChanges"
v-validate="'required|decimal|min_value:0'" :class="{'is-invalid': errors.has('price') }">
<small class="text-danger">{{ errors.first('price') }}</small>
</div>
<div class="form-group col-md-4">
<label>&nbsp;</label>
@@ -73,21 +75,25 @@
<div class="col-lg-6">
<div class="form-group">
<label>Server IPN</label>
<input type="text" class="form-control" placeholder="(optional)"
v-model="srvModel.serverIpn" v-on:change="inputChanges">
<input name="serverIpn" type="text" class="form-control" placeholder="(optional)"
v-model="srvModel.serverIpn" v-on:change="inputChanges"
v-validate="'email'" :class="{'is-invalid': errors.has('serverIpn') }">
<small class="text-danger">{{ errors.first('serverIpn') }}</small>
</div>
<div class="form-group">
<label>Send Email Notifications to</label>
<input type="text" name="emailToNotify" class="form-control" placeholder="(optional)"
<input name="emailToNotify" type="text" class="form-control" placeholder="(optional)"
v-model="srvModel.emailToNotify" v-on:change="inputChanges"
v-validate="'email'" :class="{'is-invalid': errors.has('emailToNotify') }">
<small class="text-danger">{{ errors.first('emailToNotify') }}</small>
</div>
<div class="form-group">
<label>Browser Redirect</label>
<input type="text" class="form-control" placeholder="(optional)"
v-model="srvModel.browserRedirect" v-on:change="inputChanges">
<input name="browserRedirect" type="text" class="form-control" placeholder="(optional)"
v-model="srvModel.browserRedirect" v-on:change="inputChanges"
v-validate="'url'" :class="{'is-invalid': errors.has('browserRedirect') }">
<small class="text-danger">{{ errors.first('browserRedirect') }}</small>
</div>
</div>
<div class="col-lg-6">
@@ -100,7 +106,7 @@
</div>
<hr />
<h3>Generated code</h3>
<div class="row">
<div class="row" v-show="!errors.any()">
<div class="col-lg-8">
<pre><code id="mainCode" class="html"></code></pre>
<i class="fa fa-copy"></i> <a href="#">Copy Code</a>
@@ -109,6 +115,11 @@
<img id="previewButton" src="~/img/paywithbtcpay.png" />
</div>
</div>
<div class="row" v-show="errors.any()">
<div class="col-lg-12">
Please fix errors shown in order for code generation to successfully execute.
</div>
</div>
<br />
</div>
</section>