-
Notifications
You must be signed in to change notification settings - Fork 0
/
Edit.php
218 lines (213 loc) · 10.2 KB
/
Edit.php
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
require('db_fetch.php');
// Gets the transaction ID so we know which transacton it is.
$this_trans_id = !empty($_GET['trans']) ? $_GET['trans'] : $_COOKIE['this_tran_id'];;
if ($this_trans_id=="NEW") {
$this_trans_id=0;
}
// Sets cookie.
setcookie('this_tran_id', $this_trans_id);
// Gets data for this transaction from DB.
$tran_info = pg_fetch_all(pg_query($db_connection, "select * from transaction_info where transaction_id= $this_trans_id"))[0];
$format_date = substr($tran_info['transaction_date'], 0, 4).'-'.substr($tran_info['transaction_date'], 4, 2).'-'.substr($tran_info['transaction_date'], 6, 2);
?>
<html>
<!-- This is the page where you can edit each transaction. -->
<style>
.thm-btndel {
position: relative;
background: transparent;
font-size: 14px;
line-height: 46px;
font-weight: 600;
color: #ff5858;
border: 2px solid #f4f4f4;
text-transform: uppercase;
font-family: 'Poppins', sans-serif;
display: inline-block;
padding: 0 38px;
transition: all .5s cubic-bezier(0.4, 0, 1, 1);
}
.thm-btndel:hover {
background: #ff5858;
border-color: #ff5858;
color: #fff;
transition: all .5s cubic-bezier(0.4, 0, 1, 1);
}
</style>
<head>
<title>Edit item</title>
<!-- CSS stylesheet -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
</head>
<body>
<!-- The top UI component that displays a welcome message and the MY ACCOUNT link. -->
<header class="top-bar">
<div class="container">
<div class="clearfix">
<div class="col-left float_left">
<ul class="top-bar-info">
<li>
<h3>Good morning </h3>
</li>
<li><?php echo $name?></li>
</ul>
</div>
<div class="col-right float_right">
<div class="link">
<!-- Page redirection -->
<a href="Account.php" class="thm-btn">My account</a>
</div>
</div>
</div>
</div>
</header>
<!-- The section that diplays the logo under the top bar. -->
<section class="theme_menu stricky slideIn animated">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="main-logo">
<a href="Main.php"><img src="image/logo_small.PNG" alt=""></a>
</div>
</div>
</div>
</div>
</section>
<!-- The container that contains the main content of the page. -->
<section class="contact_us sec-padd-bottom">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12 col-xs-12">
<div class="section-title">
<br>
<h3>Edit your transition record</h3>
</div>
<div class="default-form-area">
<!-- Form for submition. -->
<form id="contact-form" name="contact_form" class="default-form" action="edit_edit.php" method="post"
novalidate="novalidate">
<div class="row clearfix">
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- Date of transaction. -->
<div class="form-group">
<h3>Transition Date</h3>
<input type="date" name="trans_date" class="form-control" value="<?php echo $format_date?>"
placeholder="Transition Date" required="" aria-required="true">
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- Name of transaction. -->
<div class="form-group">
<h3>Transition Name</h3>
<input type="text" name="trans_name" class="form-control" value="<?php echo $tran_info['transaction_name']?>"
placeholder="Name of transaction">
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- Type of transaction. -->
<div class="form-group">
<h3>Transition Type</h3>
<input type="text" name="trans_type" class="form-control" value="<?php echo $tran_info['transaction_type']?>"
placeholder="Type of transaction">
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- Source or destination of transaction. -->
<div class="form-group">
<h3>Source/Destination</h3>
<input type="text" name="source_des" class="form-control" value="<?php echo $tran_info['transaction_dest']?>"
placeholder="To/From ...">
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- In flow of transaction. -->
<div class="form-group">
<h3>In Flow</h3>
<input type="number" name="in_flow" class="form-control" value="<?php echo $tran_info['transaction_inflow']?>"
placeholder="0.0">
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<!-- Out flow of transaction. -->
<div class="form-group">
<h3>Out Flow</h3>
<input type="number" name="out_flow" class="form-control" value="<?php echo $tran_info['transaction_outflow']?>"
placeholder="0.0">
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<!-- Note of transaction. -->
<div class="form-group">
<H3>Note</H3>
<textarea name="form_message" class="form-control textarea required"
placeholder="Your Message...." aria-required="true"><?php echo $tran_info['transaction_note']?></textarea>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="form-group">
<input id="form_botcheck" name="form_botcheck" class="form-control"
type="hidden" value="">
<!-- Save button -->
<button class="thm-btn2" type="submit">Save</button>
<!-- Cancel button -->
<button class="thm-btn2" type="button" onclick="btn_exit()">Cancel</button>
<!-- Delete button -->
<?php if ($this_trans_id!=0) {echo '<button class="thm-btndel" type="button" onclick="btn_del()">Delete</button>';}?>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="col-md-6 col-sm-8 col-xs-12">
<div class="home-google-map">
<div class="google-map" id="contact-google-map" data-map-lat="40.938541"
data-map-lng="-73.904893" data-icon-path="images/logo/map-marker.png"
data-map-title="Chester" data-map-zoom="11">
</div>
</div>
</div>
</div>
</div>
</section>
<!-- The bottom UI section that contains copyright and other info. -->
<section class="footer-bottom">
<div class="container">
<!-- Left section -->
<div class="pull-left copy-text">
<!-- Copyright -->
<p>Copyright © 20XX. Some Company name All rights reserved.</p>
</div>
<!-- Right section -->
<div class="pull-right get-text">
<!-- Support, privacy, terms -->
<ul>
<li><a href="#" onclick="alert('Work in progress')">Support | </a></li>
<li><a href="#" onclick="alert('Work in progress')">Privacy & Policy |</a></li>
<li><a href="#" onclick="alert('Work in progress')"> Terms & Conditions</a></li>
</ul>
</div>
</div>
</section>
</body>
<script>
// Function for cancel button.
function btn_exit() {
var r = confirm("Do you really want to cancel your changes?")
if (r == true) {
window.event.returnValue = false;
window.location.href = "Detail.php";
}
}
// Function for delete button.
function btn_del() {
var r = confirm("Do you really want to delete this record?")
if (r == true) {
window.event.returnValue = false;
window.location.href = "edit_del.php";
}
}
</script>
</html>