vue naming changes

This commit is contained in:
faiqahzaman
2024-02-29 16:36:11 +08:00
parent b67f7f4948
commit 0a05b23cac
10 changed files with 140 additions and 100 deletions
@@ -11,7 +11,7 @@
<th width="10%">No. Anggota</th> <th width="10%">No. Anggota</th>
<th width="30%">Name</th> <th width="30%">Name</th>
<th width="20%">Partylist</th> <th width="20%">Partylist</th>
<th width="20%">Course</th> <th width="20%">Unit</th>
<th width="20%">Votes</th> <th width="20%">Votes</th>
</tr> </tr>
</thead> </thead>
@@ -20,14 +20,14 @@
<td>{{ getNominee(result.nominee_id)['student_id'] }}</td> <td>{{ getNominee(result.nominee_id)['student_id'] }}</td>
<td>{{ getNominee(result.nominee_id)['name'] }}</td> <td>{{ getNominee(result.nominee_id)['name'] }}</td>
<td>{{ getPartylist(getNominee(result.nominee_id)['partylist_id']) }}</td> <td>{{ getPartylist(getNominee(result.nominee_id)['partylist_id']) }}</td>
<td>{{ getNominee(result.nominee_id)['course'] }}</td> <td>{{ getNominee(result.nominee_id)['Unit'] }}</td>
<td>{{ result.votes}}</td> <td>{{ result.votes}}</td>
</tr> </tr>
<tr v-for="no_vote in no_votes" v-if="no_vote.position_id==position.id"> <tr v-for="no_vote in no_votes" v-if="no_vote.position_id==position.id">
<td>{{ no_vote.student_id }}</td> <td>{{ no_vote.student_id }}</td>
<td>{{ no_vote.name }}</td> <td>{{ no_vote.name }}</td>
<td>{{ getPartylist(no_vote.partylist_id) }}</td> <td>{{ getPartylist(no_vote.partylist_id) }}</td>
<td>{{ no_vote.course }}</td> <td>{{ no_vote.unit }}</td>
<td>0</td> <td>0</td>
</tr> </tr>
</tbody> </tbody>
@@ -1,76 +1,72 @@
<template> <template>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
<form <form class="row" method="POST" id="add_form" :action="data.API + 'nominee'" enctype="mutlipart/formdata"
class="row" @submit.prevent="add()">
method="POST" <div class="col-md-8">
id="add_form"
:action="data.API+'nominee'"
enctype="mutlipart/formdata"
@submit.prevent="add()">
<div class="col-md-4">
<uploader file-name="image" />
</div>
<div class="col-md-8"> <div class="form-group">
<label for="name">Nama Calon</label>
<input type="text" name="name" class="form-control" required />
</div>
<div class="form-group"> <div class="form-group">
<label for="name">Nama</label> <label for="student_id">No. Anggota</label>
<input type="text" name="name" class="form-control" required/> <input type="text" name="student_id" class="form-control" required />
</div>
<div class="form-group">
<label for="Unit">Unit</label>
<input type="text" name="Unit" class="form-control" required />
</div>
<div class="form-group">
<label for="motto">Motto</label>
<input type="text" name="motto" class="form-control" placeholder="(Optional)" />
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea name="description" class="form-control" placeholder="(Optional)"></textarea>
</div>
<div class="form-group">
<label for="position_id">Position</label>
<select class="form-control" v-model="position_id" name="position_id" required>
<option value="0" disabled>--- Select Position ---</option>
<option v-for="position in data.positions" :value="position.id">{{ position.name }}</option>
</select>
</div>
<div class="form-group">
<label for="partylist_id">Partylist</label>
<select class="form-control" name="partylist_id">
<option value="">--- Select Partylist (Optional) ---</option>
<option v-for="partylist in data.partylists" :value="partylist.id">{{ partylist.name }}</option>
</select>
</div>
<div>
<label for="image">Masukkan Gambar</label>
<input type="file" accept="image/*" @change="uploadImage($event)" id="file-input">
</div>
<div class="form-group pull-right">
<input type="submit" value="Submit" class="btn btn-info">
<router-link :to="{ name: 'Maklumat Calon', query: { position_id: position_id } }"
class="btn btn-default">
Submit
</router-link>
</div>
</div> </div>
</form>
<div class="form-group"> </div>
<label for="student_id">No. Anggota</label>
<input type="text" name="student_id" class="form-control" required/>
</div>
<div class="form-group">
<label for="course">Course</label>
<input type="text" name="course" class="form-control" required/>
</div>
<div class="form-group">
<label for="motto">Motto</label>
<input type="text" name="motto" class="form-control" placeholder="(Optional)" />
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea name="description" class="form-control" placeholder="(Optional)"></textarea>
</div>
<div class="form-group">
<label for="position_id">Position</label>
<select class="form-control" v-model="position_id" name="position_id" required>
<option value="0" disabled>--- Select Position ---</option>
<option v-for="position in data.positions" :value="position.id">{{ position.name }}</option>
</select>
</div>
<div class="form-group">
<label for="partylist_id">Partylist</label>
<select class="form-control" name="partylist_id">
<option value="">--- Select Partylist (Optional) ---</option>
<option v-for="partylist in data.partylists" :value="partylist.id">{{ partylist.name}}</option>
</select>
</div>
<div class="form-group pull-right">
<input type="submit" value="Submit" class="btn btn-info">
<router-link
:to="{name:'Maklumat Calon', query:{position_id:position_id}}"
class="btn btn-default">
Submit
</router-link>
</div>
</div>
</form>
</div> </div>
</div>
</template> </template>
<script> <script>
export default{ export default {
data: function () { data: function () {
return { return {
loading: false loading: false
@@ -88,7 +84,7 @@ export default{
$.notifyClose(); $.notifyClose();
vm.loading = false; vm.loading = false;
if (vm.util.showResult(response, 'success', 'ajax')) if (vm.util.showResult(response, 'success', 'ajax'))
vm.$router.push({name: 'Maklumat Calon'}); vm.$router.push({ name: 'Maklumat Calon' });
}, },
error: function (error) { error: function (error) {
$.notifyClose(); $.notifyClose();
@@ -99,6 +95,31 @@ export default{
vm.util.notify('Adding Nominee', 'progress', progress); vm.util.notify('Adding Nominee', 'progress', progress);
} }
}) })
},
uploadImage(event) {
const URL = 'http://foobar.com/upload';
let data = new FormData();
data.append('name', 'my-picture');
data.append('file', event.target.files[0]);
let config = {
header: {
'Content-Type': 'image/png'
}
}
axios.put(
URL,
data,
config
).then(
response => {
console.log('image upload response > ', response)
}
)
} }
}, },
@@ -109,7 +130,7 @@ export default{
}, },
set: function (id) { set: function (id) {
this.$router.replace({query: {position_id: id}}); this.$router.replace({ query: { position_id: id } });
} }
} }
} }
@@ -27,8 +27,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="course">Course</label> <label for="Unit">Unit</label>
<input type="text" name="course" class="form-control" :value="nominee.course" required/> <input type="text" name="unit" class="form-control" :value="nominee.Unit" required/>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -34,7 +34,7 @@
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>No. Anggota</th> <th>No. Anggota</th>
<th>Course</th> <th>Unit</th>
<th>Position</th> <th>Position</th>
<th>Partylist</th> <th>Partylist</th>
<th>Action</th> <th>Action</th>
@@ -47,7 +47,7 @@
</td> </td>
<td>{{ nominee.name}}</td> <td>{{ nominee.name}}</td>
<td>{{ nominee.student_id}}</td> <td>{{ nominee.student_id}}</td>
<td>{{ nominee.course}}</td> <td>{{ nominee.unit}}</td>
<td>{{ nominee.position}}</td> <td>{{ nominee.position}}</td>
<td>{{ nominee.partylist}}</td> <td>{{ nominee.partylist}}</td>
<td> <td>
@@ -4,18 +4,34 @@
<h4>Tambah Pengundi</h4> <h4>Tambah Pengundi</h4>
<form @submit.prevent="add()" id="add-form"> <form @submit.prevent="add()" id="add-form">
<div class="form-group"> <div class="form-group">
<label for="name">Nama</label> <label for="name">Nama Anggota</label>
<input type="text" name="name" class="form-control" required> <input type="text" name="name" class="form-control" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="student_id">No. Anggota</label> <label for="no_kp">No. Kad Pengenalan</label>
<input type="text" name="student_id" class="form-control" required> <input type="text" name="no_kp" class="form-control" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="course">Course</label> <label for="no_anggota">No. Anggota</label>
<input type="text" name="course" class="form-control" required> <input type="text" name="no_anggota" class="form-control" required>
</div>
<div class="form-group">
<label for="unit">Unit</label>
<input type="text" name="unit" class="form-control" required>
</div>
<div class="form-group">
<label for="alamat">Alamat</label>
<input type="text" name="alamat" class="form-control" required>
</div>
<div class="form-group">
<label for="telefon">No. Telefon</label>
<input type="text" name="telefon" class="form-control" required>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -9,13 +9,13 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="student_id">No. Anggota</label> <label for="no_kp">No. Kad Pengenalan</label>
<input type="text" name="student_id" class="form-control" :value="data.voter.student_id" required/> <input type="text" name="no_kp" class="form-control" :value="data.voter.no_kp" required/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="course">Course</label> <label for="Unit">Unit</label>
<input type="text" name="course" class="form-control" :value="data.voter.course" required/> <input type="text" name="unit" class="form-control" :value="data.voter.unit" required/>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -16,17 +16,19 @@
<table class="table table-hover" id="position_table"> <table class="table table-hover" id="position_table">
<thead> <thead>
<tr> <tr>
<th>Nama</th> <th>Nama Anggota</th>
<th>No. Kad Pengenalan</th>
<th>No. Anggota</th> <th>No. Anggota</th>
<th>Course</th> <th>Unit</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(voter,i) in data.voters.data"> <tr v-for="(voter,i) in data.voters.data">
<td>{{ voter.name }}</td> <td>{{ voter.name }}</td>
<td>{{ voter.student_id }}</td> <td>{{ voter.no_kp }}</td>
<td>{{ voter.course }}</td> <td>{{ voter.no_anggota }}</td>
<td>{{ voter.unit }}</td>
<td> <td>
<button class="btn btn-info" @click="edit(i)"> <button class="btn btn-info" @click="edit(i)">
<i class="fa fa-edit"></i> Edit <i class="fa fa-edit"></i> Edit
@@ -1,13 +1,14 @@
<template> <template>
<div class="row col-md-10 col-md-offset-1"> <div class="row col-md-10 col-md-offset-1">
<div class="col-md-4"> <div class="col-md-4">
<h4>Voter's Information</h4><hr/> <h4>Maklumat Anggota</h4><hr/>
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item"><b>No. Anggota : </b>{{ data.user.student_id }}</li> <li class="list-group-item"><b>No. Kad Pengenalan : </b>{{ data.user.no_kp }}</li>
<li class="list-group-item"><b>No. Anggota : </b>{{ data.user.no_anggota }}</li>
<li class="list-group-item"><b>Nama : </b>{{ data.user.name }}</li> <li class="list-group-item"><b>Nama : </b>{{ data.user.name }}</li>
<li class="list-group-item"><b>Course : </b>{{ data.user.course }}</li> <li class="list-group-item"><b>Unit : </b>{{ data.user.unit }}</li>
<li class="list-group-item" v-if="data.election.status==1"> <li class="list-group-item" v-if="data.election.status==1">
<center>Election hasn't started yet</center> <center>Undian belum bermula</center>
</li> </li>
<li class="list-group-item" v-if="data.election.status==2"> <li class="list-group-item" v-if="data.election.status==2">
<center> <center>
@@ -32,7 +33,7 @@
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<h4>Candidates Information</h4><hr/> <h4>Maklumat Calon</h4><hr/>
<small>Click Picture to see details</small> <small>Click Picture to see details</small>
<div class="panel panel-primary" v-for="position in data.positions"> <div class="panel panel-primary" v-for="position in data.positions">
<div class="panel-heading">{{ position.name }}</div> <div class="panel-heading">{{ position.name }}</div>
@@ -43,7 +44,7 @@
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>Partylist</th> <th>Partylist</th>
<th>Course</th> <th>Unit</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -56,7 +57,7 @@
</td> </td>
<td>{{ nominee.name }}</td> <td>{{ nominee.name }}</td>
<td>{{ getPartylist(nominee.partylist_id) }}</td> <td>{{ getPartylist(nominee.partylist_id) }}</td>
<td>{{ nominee.course }}</td> <td>{{ nominee.unit }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -73,7 +74,7 @@
<div class="col-md-9" style="margin-left: 5px;"> <div class="col-md-9" style="margin-left: 5px;">
<h3><strong><em>"{{ x.motto }}"</em></strong></h3> <h3><strong><em>"{{ x.motto }}"</em></strong></h3>
<b> Name : </b>{{ x.name }}<br/> <b> Name : </b>{{ x.name }}<br/>
<b> Course : </b>{{ x.course }}<br/> <b> Unit : </b>{{ x.unit }}<br/>
<b> Partylist : </b>{{ getPartylist(x.partylist_id) }}<br/><hr/> <b> Partylist : </b>{{ getPartylist(x.partylist_id) }}<br/><hr/>
{{ x.description }} {{ x.description }}
</div> </div>
@@ -33,7 +33,7 @@
<td><input type="radio" :name="position.id" :id="nominee.id"/></td> <td><input type="radio" :name="position.id" :id="nominee.id"/></td>
<td>{{ nominee.name }}</td> <td>{{ nominee.name }}</td>
<td>{{ getPartylist(nominee.partylist_id) }}</td> <td>{{ getPartylist(nominee.partylist_id) }}</td>
<td>{{ nominee.course }}</td> <td>{{ nominee.unit }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -2,15 +2,15 @@
<div class="col-md-5 col-md-offset-3"> <div class="col-md-5 col-md-offset-3">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4>Voter Login</h4> <h4>Selamat Datang!</h4>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<form @submit.prevent="login" id="login_form"> <form @submit.prevent="login" id="login_form">
<div class="form-group"> <div class="form-group">
<label for="email">Masukkan No. Anggota</label> <label for="no_kp">Masukkan No. Kad Pengenalan</label>
<input type="text" name="student_id" class="form-control" required/> <input type="text" name="no_kp" class="form-control" required/>
</div> </div>
<div class="form-group"> <div class="form-group">