merge_ui
This commit is contained in:
@@ -1,62 +1,71 @@
|
||||
<template>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<form id="add_form" @submit.prevent="add()">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<form id="add_form" @submit.prevent="add()">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Nama</label>
|
||||
<input type="text" name="name" class="form-control" required/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="name">Nama</label>
|
||||
<input type="text" name="name" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" class="form-control" required/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control" required/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">Confirm Password</label>
|
||||
<input type="password" name="confirm_password" class="form-control" required/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">Confirm Password</label>
|
||||
<input type="password" name="confirm_password" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-info"/>
|
||||
<router-link :to="{name: 'Manage Account'}" class="btn btn-default">Back</router-link>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="role">Role</label>
|
||||
<select class="form-control" id="role" name="role"
|
||||
value="" required>
|
||||
<option value="1">Admin</option>
|
||||
<option value="2">Jawatankuasa Audit</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-info" />
|
||||
<router-link :to="{ name: 'Manage Account' }" class="btn btn-default">Back</router-link>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
export default {
|
||||
data: () => ({
|
||||
loading: false
|
||||
}),
|
||||
|
||||
methods:{
|
||||
methods: {
|
||||
add: function () {
|
||||
if (this.loading || !this.isPasswordMatch()) return;
|
||||
var vm = this;
|
||||
this.loading = true;
|
||||
this.util.notify('Adding Admin', 'loading');
|
||||
axios.post(config.API+'admin', $('#add_form').serialize())
|
||||
.then(response=>{
|
||||
axios.post(config.API + 'admin', $('#add_form').serialize())
|
||||
.then(response => {
|
||||
vm.loading = false;
|
||||
$.notifyClose();
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
vm.$router.push({name: 'Manage Account'});
|
||||
vm.$router.push({ name: 'Manage Account' });
|
||||
}
|
||||
})
|
||||
.catch(error=>{
|
||||
.catch(error => {
|
||||
vm.loading = false;
|
||||
$.notifyClose();
|
||||
vm.util.showResult(error, 'error')
|
||||
vm.util.showResult(error, 'error')
|
||||
})
|
||||
},
|
||||
|
||||
@@ -65,6 +74,6 @@ export default{
|
||||
if (!isMatch) this.util.notify('Password not match', 'error');
|
||||
return isMatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,118 +1,142 @@
|
||||
<template>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h4>Undian terkini </h4>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-success" v-if="data.election.status == 1" @click="util.showModal('#start-election-modal')">Start Election</button>
|
||||
|
||||
<router-link :to="{name: 'Current Result'}" class="btn btn-info" v-if="data.election.status == 2">
|
||||
View Results
|
||||
</router-link>
|
||||
|
||||
<button class="btn btn-danger" v-if="data.election.status == 2" @click="util.showModal('#stop-election-modal')">End Election</button>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h4> Recent Elections</h4>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-success" v-if="data.election.status == 1 && data.user.role==1"
|
||||
@click="util.showModal('#start-election-modal')">Start Election</button>
|
||||
|
||||
<label v-if="data.election.status == 2">Undian telah bermula {{ start_date }}</label>
|
||||
<router-link :to="{ name: 'Current Result' }" class="btn btn-info" v-if="data.election.status == 2">
|
||||
View Results
|
||||
</router-link>
|
||||
|
||||
<button class="btn btn-danger" v-if="data.election.status == 2"
|
||||
@click="util.showModal('#stop-election-modal')">End Election</button>
|
||||
|
||||
<label v-if="data.election.status == 2">Election has Started {{ start_date }}</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Election Name</th>
|
||||
<th>Election Start</th>
|
||||
<th>Election End</th>
|
||||
<th>View</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="election in data.elections">
|
||||
<td>{{ election.id }}</td>
|
||||
<td>{{ election.name }}</td>
|
||||
<td>{{ election.start }}</td>
|
||||
<td>{{ election.end }}</td>
|
||||
<td>
|
||||
<router-link :to="{ name: 'Election Result', params: { election_id: election.id } }"
|
||||
class="btn btn-info">View Result</router-link>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="data.elections.length < 1">
|
||||
<td colspan="5">No elections yet</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="start" id="start_form">
|
||||
<div class="modal fade" id="start-election-modal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="start-election-modal" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Start Election</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="name">Election Name</label>
|
||||
<input type="text" name="name" autocomplete="on" class="form-control" placeholder="(Optional)" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Confirm Password</label>
|
||||
<input type="password" name="password" class="form-control" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" class="btn btn-info" value="Start" />
|
||||
<input type="button" data-dismiss="modal" class="btn btn-default" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form @submit.prevent="stop" id="stop_form">
|
||||
<div class="modal fade" id="stop-election-modal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="stop-election-modal" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Stop Election</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="name">Election Name</label>
|
||||
<input type="text" name="name" :value="data.election.name" autocomplete="on" class="form-control" placeholder="(Optional)" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Confirm Password</label>
|
||||
<input type="password" name="password" autocomplete="on" class="form-control" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" class="btn btn-info" value="Stop Election" />
|
||||
<input type="button" data-dismiss="modal" class="btn btn-default" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nama Pengundi</th>
|
||||
<th>Undian Mula </th>
|
||||
<th>Undian Tamat</th>
|
||||
<th>Papar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="election in data.elections">
|
||||
<td>{{ election.id }}</td>
|
||||
<td>{{ election.name }}</td>
|
||||
<td>{{ election.start}}</td>
|
||||
<td>{{ election.end}}</td>
|
||||
<td>
|
||||
<router-link :to="{name: 'Election Result', params:{election_id:election.id}}" class="btn btn-info">View Result</router-link></td>
|
||||
</tr>
|
||||
<tr v-if="data.elections.length < 1">
|
||||
<td colspan="5">No elections yet</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="start" id="start_form">
|
||||
<modal id="start-election-modal">
|
||||
<modal-header>Start Election</modal-header>
|
||||
<modal-body>
|
||||
<div class="form-group">
|
||||
<label for="name">Election Name</label>
|
||||
<input type="text" name="name" class="form-control" placeholder="(Optional)"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Confirm Password</label>
|
||||
<input type="password" name="password" class="form-control" required/>
|
||||
</div>
|
||||
</modal-body>
|
||||
<modal-footer>
|
||||
<input type="submit" class="btn btn-info" value="Start"/>
|
||||
<input type="button" data-dismiss="modal" class="btn btn-default" value="Cancel"/>
|
||||
</modal-footer>
|
||||
</modal>
|
||||
</form>
|
||||
|
||||
<form @submit.prevent="stop" id="stop_form">
|
||||
<modal id="stop-election-modal">
|
||||
<modal-header>Stop Election</modal-header>
|
||||
<modal-body>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Election Name</label>
|
||||
<input type="text" name="name" :value="data.election.name" class="form-control" placeholder="(Optional)"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Sahkan Kata Laluan</label>
|
||||
<input type="password" name="password" class="form-control" required/>
|
||||
</div>
|
||||
</modal-body>
|
||||
<modal-footer>
|
||||
<input type="submit" class="btn btn-danger" value="Stop Election"/>
|
||||
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel"/>
|
||||
</modal-footer>
|
||||
</modal>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
data: ()=>({
|
||||
export default {
|
||||
data: () => ({
|
||||
start_date: null
|
||||
}),
|
||||
created: function () {
|
||||
this.refreshElection();
|
||||
var vm = this;
|
||||
setInterval(()=>{
|
||||
setInterval(() => {
|
||||
vm.start_date = moment(vm.data.election.start).fromNow();
|
||||
},1000);
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
stop: function () {
|
||||
var vm = this;
|
||||
this.util.hideModal('#stop-election-modal');
|
||||
// this.util.hideModal('#stop-election-modal');
|
||||
this.util.notify('Stopping Election', 'loading');
|
||||
axios.post(config.API+'election/stop', $('#stop_form').serialize())
|
||||
.then(response=>{
|
||||
axios.post(config.API + 'election/stop', $('#stop_form').serialize())
|
||||
.then(response => {
|
||||
$.notifyClose();
|
||||
if (vm.util.showResult(response,'success')) {
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
vm.refreshElection();
|
||||
vm.data.election =response.data.election;
|
||||
vm.data.election = response.data.election;
|
||||
vm.data.positions = [];
|
||||
vm.data.partylists = [];
|
||||
vm.data.voters = [];
|
||||
@@ -120,7 +144,7 @@ export default{
|
||||
vm.data.results = [];
|
||||
}
|
||||
})
|
||||
.catch(error=>{
|
||||
.catch(error => {
|
||||
$.notifyClose();
|
||||
vm.util.showResult(error, 'error');
|
||||
})
|
||||
@@ -128,31 +152,32 @@ export default{
|
||||
|
||||
start: function () {
|
||||
var vm = this;
|
||||
this.util.hideModal('#start-election-modal');
|
||||
// this.util.hideModal('#start-election-modal');
|
||||
console.log('this');
|
||||
this.util.notify('Loading please wait', 'loading');
|
||||
axios.post(config.API+'election/start', $('#start_form').serialize())
|
||||
.then(response=>{
|
||||
axios.post(config.API + 'election/start', $('#start_form').serialize())
|
||||
.then(response => {
|
||||
$.notifyClose();
|
||||
if(vm.util.showResult(response, 'success')){
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
vm.refreshElection();
|
||||
vm.data.election = response.data.election;
|
||||
}
|
||||
})
|
||||
.catch(error=>{
|
||||
.catch(error => {
|
||||
$.notifyClose();
|
||||
vm.util.showResult(error, 'error');
|
||||
})
|
||||
},
|
||||
|
||||
refreshElection: function(){
|
||||
refreshElection: function () {
|
||||
this.util.notify('Refreshing Election', 'loading');
|
||||
var vm = this;
|
||||
axios.get(config.API+'election')
|
||||
.then(response=>{
|
||||
axios.get(config.API + 'election')
|
||||
.then(response => {
|
||||
$.notifyClose();
|
||||
vm.data.elections = response.data;
|
||||
})
|
||||
.catch(error=>{
|
||||
.catch(error => {
|
||||
$.notifyClose();
|
||||
vm.util.showResult(error, 'error');
|
||||
})
|
||||
|
||||
@@ -14,22 +14,21 @@
|
||||
<div class="collapse navbar-collapse" id="myNavbar">
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<!-- {{ users }} -->
|
||||
<router-link :to="{name: 'Admin Home'}" tag="li" exact><a href="#">Home</a></router-link>
|
||||
|
||||
<router-link :to="{name: 'Kemaskini Jawatan'}" tag="li">
|
||||
<router-link :to="{name: 'Kemaskini Jawatan'}" v-if="data.user.role==1" tag="li">
|
||||
<a href="#">Jawatan</a>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{name: 'Manage Partylist'}" tag="li">
|
||||
<router-link :to="{name: 'Manage Partylist'}" v-if="data.user.role==1" tag="li">
|
||||
<a href="#">Manage Partylist</a>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{name: 'Manage Voter'}" tag="li">
|
||||
<router-link :to="{name: 'Manage Voter'}" v-if="data.user.role==1" tag="li">
|
||||
<a href="#">Anggota Koperasi</a>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{name: 'Maklumat Calon'}" tag="li">
|
||||
<router-link :to="{name: 'Maklumat Calon'}" v-if="data.user.role==1" tag="li">
|
||||
<a href="#">Calon</a>
|
||||
</router-link>
|
||||
|
||||
@@ -75,9 +74,10 @@
|
||||
<script>
|
||||
export default{
|
||||
|
||||
data: () =>({
|
||||
loading: true
|
||||
}),
|
||||
// data: () =>({
|
||||
// loading: true,
|
||||
// users:{'roles' : 1},
|
||||
// }),
|
||||
|
||||
created: function () {
|
||||
this.util.setTitle('Voting System - Administrator');
|
||||
|
||||
@@ -34,6 +34,16 @@
|
||||
<input type="text" name="telefon" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="saham">Saham</label>
|
||||
<input type="text" name="saham" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="yuran">Yuran</label>
|
||||
<input type="text" name="yuran" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<router-link :to="{name: 'Manage Voter'}" class="btn btn-default">Back</router-link>
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<th>No. Kad Pengenalan</th>
|
||||
<th>No. Anggota</th>
|
||||
<th>Unit</th>
|
||||
<th>Saham</th>
|
||||
<th>Yuran</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -29,6 +31,8 @@
|
||||
<td>{{ voter.no_kp }}</td>
|
||||
<td>{{ voter.no_anggota }}</td>
|
||||
<td>{{ voter.unit }}</td>
|
||||
<td>{{ voter.saham }}</td>
|
||||
<td>{{ voter.yuran }}</td>
|
||||
<td>
|
||||
<button class="btn btn-info" @click="edit(i)">
|
||||
<i class="fa fa-edit"></i> Edit
|
||||
|
||||
Reference in New Issue
Block a user