Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
🔒 NordVPN Premium – 3 Months
hrdilshan
Updated:
Thursday at 8:29 PM
🚀 Microsoft Office 365 Pro Plus – Lifetime Access! 🚀
hrdilshan
Updated:
Thursday at 8:28 PM
Linkedin Premium Business / Careere /Sales Navigator - 1/2/3/6/9/12 Months - Reddem Link
hrdilshan
Updated:
Thursday at 8:27 PM
Colombo
YEYE 3 in 1 Instant Coffee Mix 50 Sachet
Romeshka
Updated:
Wednesday at 12:16 AM
Colombo
Red Hat Certified System Administrator (RHCSA) - RHEL 10
Sanjeewani95
Updated:
Jul 3, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Laravel & Vue Js Awulak
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="isurutmv" data-source="post: 24117087" data-attributes="member: 470006"><p>[CODE]</p><p><template></p><p> <div class="container"></p><p></p><p> <div class="card"></p><p> <div class="card-header"></p><p> <h3 class="card-title">Active Gamers</h3></p><p> <div class="card-tools"></p><p> <button class="btn btn-success" @click="newModel">Add New Gamer</button></p><p> </div></p><p> </div></p><p> <!-- /.card-header --></p><p> <div class="card-body"></p><p> <table id="example1" class="table table-bordered table-striped"></p><p> <thead></p><p> <tr></p><p> <th>Number</th></p><p> <th>Name</th></p><p> <th>PC/PS4</th></p><p> <th>Start Time</th></p><p> <th>Modify</th></p><p> </tr></p><p> </thead></p><p> <tbody></p><p> <tr v-for="gamer in gamers" :key="gamer.id"></p><p> <td>{{gamer.id}}</td></p><p> <td>{{gamer.name}}</td></p><p> <td>{{gamer.pc}}</td></p><p> <td>{{gamer.time}}</td></p><p> <td></p><p> <a href="#"></p><p> <i class="fa fa-edit blue"></i></p><p> </a></p><p></p><p> <a href="#"></p><p> <i class="fa fa-trash red"></i></p><p> </a></p><p></p><p> </td></p><p> </tr></p><p> </tbody></p><p> <tfoot></p><p> <tr></p><p> <th>Number</th></p><p> <th>Name</th></p><p> <th>PC/PS4</th></p><p> <th>Start Time</th></p><p> <th>Modify</th></p><p> </tr></p><p> </tfoot></p><p> </table></p><p> </div></p><p> <!-- /.card-body --></p><p> </div></p><p> <!--add new model--></p><p> <div class="modal fade" id="addNewProduct" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"></p><p> <div class="modal-dialog modal-dialog-centered" role="document"></p><p> <div class="modal-content"></p><p> <div class="modal-header"></p><p> <h5 class="modal-title" v-show="!isEdite">Add New Gamer</h5></p><p> <h5 class="modal-title" v-show="isEdite">Update PC/PS4</h5></p><p> <button type="button" class="close" data-dismiss="modal" aria-label="Close"></p><p> <span aria-hidden="true">×</span></p><p> </button></p><p> </div></p><p> <form @submit.prevent="isEdite ? updateUser() :createUser()"></p><p> <div class="modal-body"></p><p></p><p> <div class="form-group"></p><p> <label>Name</label></p><p> <input v-model="form.name" type="text" name="name"</p><p> class="form-control" :class="{ 'is-invalid': form.errors.has('name') }"></p><p> <has-error :form="form" field="name"></has-error></p><p> </div></p><p></p><p> <div class="form-group"></p><p> <label>Time</label></p><p> <input type="text" class="form-control" id="time" name="time"/></p><p> </div></p><p></p><p></p><p></p><p> <div class="form-group"></p><p> <label>PC/PS4</label></p><p> <select v-model="form.pc" type="text" name="pc"</p><p> class="form-control" :class="{ 'is-invalid': form.errors.has('pc') }"></p><p> <option value="">Select PC/PS4</option></p><p> <option v-for="pc in pcs" :key="pc.id" v-bind:value="pc.name"></p><p> {{pc.name}}</p><p> </option></p><p></p><p> </select></p><p> <has-error :form="form" field="pc"></has-error></p><p> </div></p><p></p><p></p><p></p><p></p><p> </div></p><p> <div class="modal-footer"></p><p> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button></p><p> <button v-show="!isEdite" type="submit" class="btn btn-primary">Create PC/PS4</button></p><p> <button v-show="isEdite" type="submit" class="btn btn-primary">Update PC/PS4</button></p><p> </div></p><p> </form></p><p> </div></p><p> </div></p><p> </div></p><p></p><p></p><p></p><p> </div></p><p></template></p><p></p><p><script></p><p> </p><p> export default {</p><p> data() {</p><p> return {</p><p> isEdite: true,</p><p> pcs:{},</p><p> // today:new Date(),</p><p> gamers:{},</p><p> form: new Form({</p><p> id:'',</p><p> name:'',</p><p> pc:'',</p><p> time: ''</p><p> })</p><p> }</p><p> },</p><p> methods: {</p><p></p><p> editeModel(pc){</p><p> this.isEdite = true;</p><p> this.form.reset();</p><p> this.form.fill(pc);</p><p> $('#addNewProduct').modal('show');</p><p> },</p><p> newModel(){</p><p> this.isEdite = false;</p><p> this.form.reset();</p><p> var today = new Date();</p><p> $('#addNewProduct').modal('show');</p><p></p><p> $(document).ready(function(){</p><p> $('#time').timepicker({ timeFormat: 'h:mm',</p><p> interval: 60,</p><p> minTime: '1',</p><p> maxTime: '11',</p><p> defaultTime: today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(),</p><p> startTime: '1:00',</p><p> dynamic: false,</p><p> dropdown: true,</p><p> scrollbar: true});</p><p> });</p><p> },</p><p> createUser(){</p><p> this.$Progress.start();</p><p> this.form.post('api/active')</p><p> .then(()=>{</p><p> Fire.$emit('AfterCreated');</p><p> //close model</p><p> $('#addNewProduct').modal('hide');</p><p></p><p> this.$Progress.finish();</p><p> toast({</p><p> type: 'success',</p><p> title: 'Gamer Created successfully'</p><p> })</p><p> })</p><p> .catch(()=>{</p><p> this.$Progress.finish();</p><p> toast({</p><p> type: 'error',</p><p> title: 'Sorry We Can not create Gamer'</p><p> })</p><p> })</p><p></p><p></p><p> },</p><p></p><p> deleteUser(id){</p><p> Swal({</p><p> title: 'Are you sure?',</p><p> text: "You won't be able to revert this!",</p><p> type: 'warning',</p><p> showCancelButton: true,</p><p> confirmButtonColor: '#3085d6',</p><p> cancelButtonColor: '#d33',</p><p> confirmButtonText: 'Yes, delete it!'</p><p> }).then((result) => {</p><p></p><p> // send request</p><p> if(result.value)</p><p> {</p><p> this.form.delete('api/pc/' + id).then(()=>{</p><p> Fire.$emit('AfterCreated');</p><p></p><p> if (result.value) {</p><p> Swal(</p><p> 'Deleted!',</p><p> 'Your file has been deleted.',</p><p> 'success'</p><p> )</p><p> }</p><p> })</p><p> }</p><p></p><p></p><p> })</p><p> },</p><p></p><p> updateUser(){</p><p> this.$Progress.start();</p><p> this.form.put('api/pc/' + this.form.id)</p><p> .then(()=>{</p><p> //success</p><p> $('#addNewProduct').modal('hide');</p><p> Fire.$emit('AfterCreated');</p><p></p><p> Swal(</p><p> 'Updated!',</p><p> 'Your file has been Updated.',</p><p> 'success'</p><p> )</p><p> })</p><p> .catch(()=>{</p><p> this.$Progress.fail();</p><p> //failed</p><p> toast({</p><p> type: 'error',</p><p> title: 'Sorry We Can not Update user'</p><p> })</p><p> })</p><p> this.$Progress.finish();</p><p> },</p><p> loadUsers(){</p><p> axios.get("api/pc").then(({data})=>(this.pcs = data.data));</p><p> axios.get("api/active").then(({data})=>(this.gamers = data.data));</p><p> }</p><p> },</p><p> created() {</p><p> this.$Progress.start();</p><p> this.loadUsers();</p><p> this.$Progress.finish();</p><p></p><p> Fire.$on('AfterCreated',() => {</p><p> this.loadUsers();</p><p> });</p><p> // setInterval(() => this.loadUsers(),3000);</p><p> }</p><p> }</p><p></p><p></script></p><p></p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="isurutmv, post: 24117087, member: 470006"] [CODE] <template> <div class="container"> <div class="card"> <div class="card-header"> <h3 class="card-title">Active Gamers</h3> <div class="card-tools"> <button class="btn btn-success" @click="newModel">Add New Gamer</button> </div> </div> <!-- /.card-header --> <div class="card-body"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Number</th> <th>Name</th> <th>PC/PS4</th> <th>Start Time</th> <th>Modify</th> </tr> </thead> <tbody> <tr v-for="gamer in gamers" :key="gamer.id"> <td>{{gamer.id}}</td> <td>{{gamer.name}}</td> <td>{{gamer.pc}}</td> <td>{{gamer.time}}</td> <td> <a href="#"> <i class="fa fa-edit blue"></i> </a> <a href="#"> <i class="fa fa-trash red"></i> </a> </td> </tr> </tbody> <tfoot> <tr> <th>Number</th> <th>Name</th> <th>PC/PS4</th> <th>Start Time</th> <th>Modify</th> </tr> </tfoot> </table> </div> <!-- /.card-body --> </div> <!--add new model--> <div class="modal fade" id="addNewProduct" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" v-show="!isEdite">Add New Gamer</h5> <h5 class="modal-title" v-show="isEdite">Update PC/PS4</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form @submit.prevent="isEdite ? updateUser() :createUser()"> <div class="modal-body"> <div class="form-group"> <label>Name</label> <input v-model="form.name" type="text" name="name" class="form-control" :class="{ 'is-invalid': form.errors.has('name') }"> <has-error :form="form" field="name"></has-error> </div> <div class="form-group"> <label>Time</label> <input type="text" class="form-control" id="time" name="time"/> </div> <div class="form-group"> <label>PC/PS4</label> <select v-model="form.pc" type="text" name="pc" class="form-control" :class="{ 'is-invalid': form.errors.has('pc') }"> <option value="">Select PC/PS4</option> <option v-for="pc in pcs" :key="pc.id" v-bind:value="pc.name"> {{pc.name}} </option> </select> <has-error :form="form" field="pc"></has-error> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> <button v-show="!isEdite" type="submit" class="btn btn-primary">Create PC/PS4</button> <button v-show="isEdite" type="submit" class="btn btn-primary">Update PC/PS4</button> </div> </form> </div> </div> </div> </div> </template> <script> export default { data() { return { isEdite: true, pcs:{}, // today:new Date(), gamers:{}, form: new Form({ id:'', name:'', pc:'', time: '' }) } }, methods: { editeModel(pc){ this.isEdite = true; this.form.reset(); this.form.fill(pc); $('#addNewProduct').modal('show'); }, newModel(){ this.isEdite = false; this.form.reset(); var today = new Date(); $('#addNewProduct').modal('show'); $(document).ready(function(){ $('#time').timepicker({ timeFormat: 'h:mm', interval: 60, minTime: '1', maxTime: '11', defaultTime: today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(), startTime: '1:00', dynamic: false, dropdown: true, scrollbar: true}); }); }, createUser(){ this.$Progress.start(); this.form.post('api/active') .then(()=>{ Fire.$emit('AfterCreated'); //close model $('#addNewProduct').modal('hide'); this.$Progress.finish(); toast({ type: 'success', title: 'Gamer Created successfully' }) }) .catch(()=>{ this.$Progress.finish(); toast({ type: 'error', title: 'Sorry We Can not create Gamer' }) }) }, deleteUser(id){ Swal({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { // send request if(result.value) { this.form.delete('api/pc/' + id).then(()=>{ Fire.$emit('AfterCreated'); if (result.value) { Swal( 'Deleted!', 'Your file has been deleted.', 'success' ) } }) } }) }, updateUser(){ this.$Progress.start(); this.form.put('api/pc/' + this.form.id) .then(()=>{ //success $('#addNewProduct').modal('hide'); Fire.$emit('AfterCreated'); Swal( 'Updated!', 'Your file has been Updated.', 'success' ) }) .catch(()=>{ this.$Progress.fail(); //failed toast({ type: 'error', title: 'Sorry We Can not Update user' }) }) this.$Progress.finish(); }, loadUsers(){ axios.get("api/pc").then(({data})=>(this.pcs = data.data)); axios.get("api/active").then(({data})=>(this.gamers = data.data)); } }, created() { this.$Progress.start(); this.loadUsers(); this.$Progress.finish(); Fire.$on('AfterCreated',() => { this.loadUsers(); }); // setInterval(() => this.loadUsers(),3000); } } </script> [/CODE] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom