-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_donations.php
166 lines (158 loc) · 7.4 KB
/
manage_donations.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
<?php
include 'includes/header.php';
// Initialize form values
$uid = "";
$name = "";
$mail = "";
$mobile = "";
$amount = "";
$type = "";
$message = "";
$txid = "";
$payment_status = "";
$custid = "";
$rid = "";
if (isset($_GET['rid'])) {
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
$rid = $_GET['rid'];
$action = $_GET['action'];
$data2 = get_api_data("https://apis.stmorg.in/logs/manage_donations?rid=" . $rid . "&action=" . $action);
} else {
$rid = $_GET['rid'];
$url = "https://apis.stmorg.in/logs/donations?rid=" . $rid;
$data = get_api_data($url);
$data = json_decode($data, true);
$data = $data['data'];
$rid = $data[0]['id'];
$name = $data[0]['name'];
$mail = $data[0]['mail'];
$mobile = $data[0]['mobile'];
$amount = $data[0]['amount'];
$type = $data[0]['type'];
$message = $data[0]['message'];
$txid = $data[0]['txid'];
$payment_status = $data[0]['payment_status'];
$custid = $data[0]['custid'];
$added_on = $data[0]['added_on'];
}
}
if (isset($_POST['rid'])) {
$rid = $_POST['rid'];
$data2 = get_api_data_post("https://apis.stmorg.in/logs/manage_donations", $_POST);
$data2 = json_decode($data2, true);
echo "<script>window.location.href='manage_donations?rid=" . $rid . "'</script>";
}else {
echo "no";
}
?>
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="page-header">
<h3 class="page-title">
<span class="page-title-icon bg-gradient-danger text-white me-2">
<i class="mdi mdi-home"></i>
</span>
Manage Donations
</h3>
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
</ul>
</nav>
</div>
<!-- form -->
<div class="col-md-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Manage Donations</h4>
<p class="card-description">edit/enter details</p>
<form class="forms-sample" method="POST" action="manage_donations">
<!-- uid -->
<input type="hidden" name="uid" value="<?php echo $uid; ?>">
<div class="form-group">
<label for="exampleInputUsername1">Name</label>
<input type="text" name="name" value="<?php echo $name; ?>" class="form-control"
id="exampleInputUsername1" placeholder="Username">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" name="mail" value="<?php echo $mail; ?>" class="form-control"
id="exampleInputEmail1" placeholder="Email">
</div>
<!-- mobile -->
<div class="form-group">
<label for="exampleInputMobile">Mobile</label>
<input type="number" name="mobile" value="<?php echo $mobile; ?>" class="form-control"
id="exampleInputMobile" placeholder="Mobile">
</div>
<!-- amount -->
<div class="form-group">
<label for="exampleInputAmount">Amount</label>
<input type="number" name="amount" value="<?php echo $amount; ?>" class="form-control"
id="exampleInputAmount" placeholder="Amount">
</div>
<!-- type -->
<div class="form-group">
<label for="exampleSelectGender">Type</label>
<select class="form-control" name="type" id="exampleSelectGender">
<option value="1" <?php if ($type == '1') {
echo "selected";
} ?>>Online</option>
<option value="2" <?php if ($type == '2') {
echo "selected";
} ?>>Cash</option>
</select>
</div>
<!-- message -->
<div class="form-group">
<label for="exampleInputMessage">Message</label>
<input type="text" name="message" value="<?php echo $message; ?>" class="form-control"
id="exampleInputMessage" placeholder="Message">
</div>
<!-- txid -->
<div class="form-group">
<label for="exampleInputTxid">Txid</label>
<input type="text" name="txid" value="<?php echo $txid; ?>" class="form-control"
id="exampleInputTxid" placeholder="Txid">
</div>
<!-- status -->
<div class="form-group">
<label for="exampleSelectGender">Status</label>
<select class="form-control" name="payment_status" id="exampleSelectGender">
<option value="1" <?php if ($payment_status == '1') {
echo "selected";
} ?>>success</option>
<option value="2" <?php if ($payment_status == '2') {
echo "selected";
} ?>>fail</option>
</select>
</div>
<!-- custid -->
<div class="form-group">
<label for="exampleInputCustid">Custid</label>
<input type="text" name="custid" value="<?php echo $custid; ?>" class="form-control"
id="exampleInputCustid" placeholder="Custid">
</div>
<!-- Record id -->
<div class="form-group">
<label for="exampleInputRid">Record id</label>
<input type="text" name="rid" value="<?php echo $rid; ?>" class="form-control"
id="exampleInputRid" placeholder="Record id">
</div>
<!-- date -->
<div class="form-group">
<label for="exampleInputDate">Date</label>
<input type="datetime" name="added_on" value="<?php echo $added_on; ?>" class="form-control"
id="exampleInputDate" placeholder="Date">
</div>
<button type="submit" class="btn btn-gradient-primary me-2">Submit</button>
<a href="donations" class="btn btn-light">Back</a>
</form>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<?php
include 'includes/footer.php';
?>