mirror of https://github.com/itflow-org/itflow
Added start_page function in config, Added Contacts and Locations, seperated client nav and page routes out
This commit is contained in:
parent
baef3b2462
commit
c394e927b1
|
|
@ -8,6 +8,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Name</label>
|
||||
|
|
@ -50,7 +51,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_client" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="add_client_contact" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
<div class="modal fade" id="addClientLocationModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-map-marker"></i> New Location</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Location Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of location" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="address" placeholder="Address" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" class="form-control" name="city" placeholder="City" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<select class="form-control" name="state" required>
|
||||
<option value="">Select a state...</option>
|
||||
<?php foreach($states_array as $state_abbr => $state_name) { ?>
|
||||
<option value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<input type="text" class="form-control" name="zip" placeholder="Zip" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Phone</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" data-inputmask="'mask': '999-999-9999'" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_client_location" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
68
client.php
68
client.php
|
|
@ -31,7 +31,18 @@ if(isset($_GET['client_id'])){
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editinvoiceModal<?php echo $invoice_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientContactModal">New Contact</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientLocationModal">New Location</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAssetModal">New Asset</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientVendorModal">New Vendor</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientPasswordModal">New Password</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceModal">New Invoice</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addPaymentModal">New Payment</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addQuoteModal">New Quote</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAttachmentModal">New Attachment</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNoteModal">New Note</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $invoice_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -41,63 +52,20 @@ if(isset($_GET['client_id'])){
|
|||
<div class="col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<ul class="nav nav-pills">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="?client_id=<?php echo $client_id; ?>&tab=details">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=contacts">Contacts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Locations</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Assets</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Vendors</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Passwords</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Invoices</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Payments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Quotes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Attachments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php include("client_nav.php"); ?>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<?php
|
||||
if(isset($_GET['tab'])){
|
||||
if($_GET['tab'] == "details") {
|
||||
include("client_details.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "contacts") {
|
||||
include("client_contacts.php");
|
||||
}
|
||||
}
|
||||
else{
|
||||
include("client_details.php");
|
||||
}
|
||||
|
||||
?>
|
||||
<?php include("client_routes.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("edit_client_modal.php"); ?>
|
||||
<?php include("add_client_contact_modal.php"); ?>
|
||||
<?php include("add_client_location_modal.php"); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php include("footer.php");
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_contact_contacts ORDER BY client_contact_contact_id DESC"); ?>
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_contacts WHERE client_id = $client_id ORDER BY client_contact_id DESC"); ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
|
||||
|
|
@ -18,18 +18,18 @@
|
|||
$client_contact_id = $row['client_contact_id'];
|
||||
$client_contact_name = $row['client_contact_name'];
|
||||
$client_contact_title = $row['client_contact_title'];
|
||||
$client_contact_email = $row['client_contact_email'];
|
||||
$client_contact_phone = $row['client_contact_phone'];
|
||||
if(strlen($client_contact_phone)>2){
|
||||
$client_contact_phone = substr($row['client_contact_phone'],0,3)."-".substr($row['client_contact_phone'],3,3)."-".substr($row['client_contact_phone'],6,4);
|
||||
}
|
||||
$client_contact_email = $row['client_contact_email'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo "$client_contact_name"; ?></td>
|
||||
<td><?php echo "$client_contact_title"; ?></td>
|
||||
<td><a href="mailto:<?php echo $client_contact_email; ?>"><?php echo "$client_contact_email"; ?></a></td>
|
||||
<td><?php echo "$client_contact_phone"; ?></td>
|
||||
<td><a href="mailto:<?php echo $client_contact_email; ?>"><?php echo "$client_contact_email"; ?></a></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
|
|
@ -50,6 +50,4 @@
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php include("add_client_contact_modal.php"); ?>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_locations WHERE client_id = $client_id ORDER BY client_location_id DESC"); ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Address</th>
|
||||
<th>Phone</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_location_id = $row['client_location_id'];
|
||||
$client_location_name = $row['client_location_name'];
|
||||
$client_location_address = $row['client_location_address'];
|
||||
$client_location_city = $row['client_location_city'];
|
||||
$client_location_state = $row['client_location_state'];
|
||||
$client_location_zip = $row['client_location_zip'];
|
||||
$client_location_phone = $row['client_location_phone'];
|
||||
if(strlen($client_location_phone)>2){
|
||||
$client_location_phone = substr($row['client_location_phone'],0,3)."-".substr($row['client_location_phone'],3,3)."-".substr($row['client_location_phone'],6,4);
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo "$client_location_name"; ?></td>
|
||||
<td><a href="https://maps.google.com?q=<?php echo "$client_location_address $client_location_zip"; ?>" target="_blank"><?php echo "$client_location_address"; ?></td>
|
||||
<td><?php echo "$client_location_phone"; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientLocationModal<?php echo $client_location_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
include("edit_client_location_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<ul class="nav nav-pills">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="?client_id=<?php echo $client_id; ?>&tab=details">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=contacts">Contacts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=locations">Locations</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=assets">Assets</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=vendors">Vendors</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=passwords">Passwords</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=invoices">Invoices</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=payments">Payments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=quotes">Quotes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=attachments">Attachments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=notes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
if(isset($_GET['tab'])){
|
||||
if($_GET['tab'] == "details"){
|
||||
include("client_details.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "contacts"){
|
||||
include("client_contacts.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "locations"){
|
||||
include("client_locations.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "assets"){
|
||||
include("client_assets.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "vendors"){
|
||||
include("client_vendors.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "passwords"){
|
||||
include("client_passwords.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "invoices"){
|
||||
include("client_invoices.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "payments"){
|
||||
include("client_payments.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "quotes"){
|
||||
include("client_quotes.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "attachments"){
|
||||
include("client_attachements.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "notes"){
|
||||
include("client_notes.php");
|
||||
}
|
||||
}
|
||||
else{
|
||||
include("client_details.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -10,6 +10,8 @@
|
|||
$config_time_format = "h:ia";
|
||||
$config_no_records = "There is nothing here!";
|
||||
|
||||
$config_start_page = "clients.php";
|
||||
|
||||
$config_company_name = "PittPC";
|
||||
$config_company_address = "";
|
||||
$config_company_city = "";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if(isset($_POST['login'])){
|
|||
$_SESSION['user_id'] = $row['user_id'];
|
||||
$_SESSION['name'] = $row['name'];
|
||||
|
||||
header("Location: index.php");
|
||||
header("Location: $config_start_page");
|
||||
}else{
|
||||
$response = "
|
||||
<div class='alert alert-danger'>
|
||||
|
|
|
|||
36
post.php
36
post.php
|
|
@ -362,6 +362,42 @@ if(isset($_GET['delete_invoice_payment'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_client_contact'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$title = strip_tags(mysqli_real_escape_string($mysqli,$_POST['title']));
|
||||
$phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone']));
|
||||
$phone = preg_replace("/[^0-9]/", '',$phone);
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO client_contacts SET client_contact_name = '$name', client_contact_title = '$title', client_contact_phone = '$phone', client_contact_email = '$email', client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Contact added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_client_location'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['address']));
|
||||
$city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['city']));
|
||||
$state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['state']));
|
||||
$zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['zip']));
|
||||
$phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone']));
|
||||
$phone = preg_replace("/[^0-9]/", '',$phone);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO client_locations SET client_location_name = '$name', client_location_address = '$address', client_location_city = '$city', client_location_state = '$state', client_location_zip = '$zip', client_location_phone = '$phone', client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Location added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_user'])){
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$password = mysqli_real_escape_string($mysqli,$_POST['password']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue