-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuefy.html
124 lines (114 loc) · 4.93 KB
/
buefy.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CRUD with Vue.js Buefy PHP MySQL Axios</title>
<link rel="stylesheet" href="https://unpkg.com/buefy/dist/buefy.min.css">
<link rel="stylesheet" href="css/style.css">
<style>
[v-cloak] { display: none; }
.table td.edit { cursor: pointer; }
.table td.edit:hover { text-decoration: underline; }
</style>
</head>
<body>
<section class="hero is-medium is-dark is-bold">
<div class="hero-body">
<div class="container">
<p class="title">
CRUD with Vue.js Axios PHP and Bulma
</p>
<p class="subtitle">
by <a href="http://webcarpehtner.com">Joseph Cowdell</a>
</p>
</div>
</div>
</section>
<section class="section">
<div class="container">
<div v-cloak id="vue_contacts">
<div class="modal" :class="{ 'is-active': isModalOpen }">
<div class="modal-background" @click="closeModal()"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">{{ modalTitle }}</p>
<button class="delete" aria-label="close" @click="closeModal()"></button>
</header>
<section class="modal-card-body">
<form v-on:submit.prevent>
<div class="field">
<label class="label">Name</label>
<input class="input" type="text" name="name" v-model="formData.name" required>
</div>
<div class="field">
<label class="label">Email</label>
<input class="input" type="email" name="email" v-model="formData.email" required>
</div>
<div class="field">
<label class="label">City</label>
<input class="input" type="text" name="city" v-model="formData.city">
</div>
<div class="field">
<label class="label">State</label>
<input class="input" type="text" name="state" v-model="formData.state">
</div>
<div class="field">
<label class="label">Zip</label>
<input class="input" type="text" name="zip" v-model="formData.zip">
</div>
<div class="field">
<label class="label">Phone</label>
<input class="input" type="text" name="phone" v-model="formData.phone">
</div>
</section>
<footer class="modal-card-foot" style="justify-content: flex-end;">
<button v-if="!isEditing" class="button is-primary" @click="createContact()">Add</button>
<button v-if="isEditing" class="button is-primary" @click="changeContact()">Change</button>
</footer>
</form>
</div>
<button class="modal-close is-large" aria-label="close" @click="closeModal()"></button>
</div>
<div>
<div class="field">
<label>Search</label>
<input class="input" type="text" v-model="search" placeholder="Enter your search"/>
</div>
<div class="field">
<button class="button is-white" @click="openCreateModal()">Create Contact</button>
<button class="button is-text is-pulled-right" @click="toggleDisabled()">{{ labelDisabled }}</button>
</div>
<table class="table is-striped is-hoverable">
<tr>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Phone</th>
<th></th>
</tr>
<tr v-for="(contact, index) in filteredContacts" :key="contact.id">
<td class="edit" @click="editContact(contact, index)">{{ contact.name }}</td>
<td class="edit" @click="editContact(contact, index)">{{ contact.email }}</td>
<td class="edit" @click="editContact(contact, index)">{{ contact.city }}</td>
<td class="edit" @click="editContact(contact, index)">{{ contact.state }}</td>
<td class="edit" @click="editContact(contact, index)">{{ contact.zip }}</td>
<td class="edit" @click="editContact(contact, index)">{{ contact.phone }}</td>
<td class="edit">
<span class="delete is-small" @click="deleteContact(contact, index)"></span>
</td>
</tr>
</table>
</div>
</div>
</div>
</section>
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/buefy/dist/buefy.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="./js/buefy.js"></script>
</body>
</html>