mirror of https://github.com/itflow-org/itflow
Added the ability to upload a client contact photo
This commit is contained in:
parent
13c330d3b1
commit
4b3c2c8c2a
|
|
@ -7,7 +7,7 @@
|
|||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
|
|
@ -49,6 +49,10 @@
|
|||
<input type="email" class="form-control" name="email" placeholder="Email Address" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Photo</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th class="text-center">Name</th>
|
||||
<th>Title</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
|
|
@ -28,13 +28,17 @@
|
|||
$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'];
|
||||
$client_contact_photo = $row['client_contact_photo'];
|
||||
|
||||
?>
|
||||
<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 class="text-center">
|
||||
<img height="48" width="48" class="img-fluid rounded-circle" src="<?php echo $client_contact_photo; ?>">
|
||||
<div class="text-secondary"><?php echo $client_contact_name; ?></div>
|
||||
</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>
|
||||
<div class="dropdown dropleft text-center">
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_contact_id" value="<?php echo $client_contact_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<center><img class="img-fluid rounded-circle" src="<?php echo $client_contact_photo; ?>" height="256" width="256"></center>
|
||||
<div class="form-group">
|
||||
<label>Name</label>
|
||||
<div class="input-group">
|
||||
|
|
|
|||
9
post.php
9
post.php
|
|
@ -1640,7 +1640,14 @@ if(isset($_POST['add_client_contact'])){
|
|||
$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");
|
||||
if($_FILES['file']['tmp_name']!='') {
|
||||
$path = "uploads/client_contact_photos/";
|
||||
$path = $path . time() . basename( $_FILES['file']['name']);
|
||||
$file_name = basename($path);
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $path);
|
||||
}
|
||||
|
||||
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_contact_photo = '$path', client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Contact added";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue