-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount_details.php
118 lines (90 loc) · 3.91 KB
/
account_details.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
<?include_once 'header.php'?>
<?php
//Get Account Details
$account_id = $_GET['aid'];
$sql = "Select accounts.* , parent.account_name parent_account_name, agency_name
from accounts
left join agencies on agency_id = account_agency_id
left join accounts parent on parent.account_id = accounts.account_parent_id
where accounts.account_id = $account_id
";
//Check for Adding
$action = "nada";
if (isset($_POST['action'])) {
$action = $_POST['action'];
}
switch ($action) {
case "add":
account_add($con);
echo " <span></span>";
echo "<script>toastr.success(\"Added\");</script>";
break;
case "save":
echo " <span></span>";
echo "<script>toastr.success(\"Saved\");</script>";
account_save($con);
break;
case "delete":
account_delete($con);
echo " <span></span>";
echo "<script>toastr.success(\"Removed\");</script>";
break;
case "nada":
break;
}
$res = $con->query($sql);
echo mysqli_error($con);
$account = $res->fetch_object();
?>
<?php
function account_save($con)
{
// echo "Inside Function now";
$ins = $con->prepare("update accounts SET
account_name =? ,account_agency_id=?,account_parent_id=?,
account_phone=?, account_status=?
where account_id = ?
");
$ins->bind_param("siissi", $account_name,$account_agency_id,$account_parent_id, $account_phone, $account_status,$account_id);
$account_name = $_POST['account_name'];
$account_agency_id = $_POST['account_agency_id'];
$account_parent_id = $_POST['account_parent_id'];
$account_phone = $_POST['account_phone'];
$account_status = $_POST['account_status'];
$account_id = $_GET['aid'];
$ins->execute();
}
function account_delete($con) {
$rm = "delete from accounts where account_id=" . $_POST['account_id'];
$con->query($rm);
}
function agency_save($con){
$edt = "update agencies set agency_name='" . $_POST['agency_name'] . "' where agency_id=" . $_POST['agency_id'];
$con->query($edt);
}
?>
<div class="container">
<div width="100%">
<h4>Accounts Details: <?=$account->account_name?> </h4>
</div>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#main" role="#tab" id="main-tab"> Details</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#contacts" role="#tab" id="contacts-tab">Contacts</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#services" role="#tab" id="services-tab">Services</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#logins" role="#tab" id="logins-tab">Logins</a></li>
</ul>
<div class="tab-content" id="mTabContent">
<div id="main" class="tab-pane fade show active" role="tabpanel" aria-labelledby="main-tab">
<?php require_once("./forms/account_detail_edit.php");?>
</div>
<div class="tab-pane fade" id="contacts" role="tabpanel" aria-labelledby="contactss-tab">
<?php require_once("./forms/account_detail_contacts.php");?>
</div>
<div class="tab-pane fade" id="services" role="tabpanel" aria-labelledby="services-tab">
<?php require_once("./forms/account_detail_services.php");?>
</div>
<div class="tab-pane fade" id="logins" role="tabpanel" aria-labelledby="logins-tab">
<?php require_once("./forms/account_detail_logins.php");?>
</div>
</div>
</div>