Added Mobile Phone to contacts

This commit is contained in:
johnny@pittpc.com 2019-08-12 17:45:51 -04:00
parent 44ac404d17
commit 1514d2ac9f
6 changed files with 53 additions and 18 deletions

View File

@ -31,22 +31,32 @@
</div>
<div class="form-group">
<label>Phone <strong class="text-danger">*</strong></label>
<label>Phone</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
</div>
<input type="text" class="form-control" name="phone" placeholder="Phone Number" data-inputmask="'mask': '999-999-9999'" required>
<input type="text" class="form-control" name="phone" placeholder="Phone Number" data-inputmask="'mask': '999-999-9999'">
</div>
</div>
<div class="form-group">
<label>Email <strong class="text-danger">*</strong></label>
<label>Mobile</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
</div>
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number" data-inputmask="'mask': '999-999-9999'">
</div>
</div>
<div class="form-group">
<label>Email</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
</div>
<input type="email" class="form-control" name="email" placeholder="Email Address" required>
<input type="email" class="form-control" name="email" placeholder="Email Address">
</div>
</div>
<div class="form-group">

View File

@ -87,6 +87,10 @@ $total_pages = ceil($total_found_rows / 10);
if(strlen($contact_phone)>2){
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
}
$contact_mobile = $row['contact_mobile'];
if(strlen($contact_phone)>2){
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
}
$contact_email = $row['contact_email'];
$contact_photo = $row['contact_photo'];
$contact_initials = initials($contact_name);
@ -114,7 +118,7 @@ $total_pages = ceil($total_found_rows / 10);
<td><?php echo $contact_title; ?></td>
<td><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a></td>
<td><?php echo $contact_phone; ?></td>
<td><?php echo $contact_phone; ?><br><?php echo $contact_mobile; ?><br></td>
<td>
<div class="dropdown dropleft text-center">

View File

@ -43,22 +43,32 @@
</div>
<div class="form-group">
<label>Phone <strong class="text-danger">*</strong></label>
<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'" value="<?php echo $contact_phone; ?>" required>
<input type="text" class="form-control" name="phone" placeholder="Phone Number" data-inputmask="'mask': '999-999-9999'" value="<?php echo $contact_phone; ?>">
</div>
</div>
<div class="form-group">
<label>Email <strong class="text-danger">*</strong></label>
<label>Mobile</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-mobile-alt"></i></span>
</div>
<input type="text" class="form-control" name="mobile" placeholder="Mobile Phone Number" data-inputmask="'mask': '999-999-9999'" value="<?php echo $contact_mobile; ?>">
</div>
</div>
<div class="form-group">
<label>Email</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-envelope"></i></span>
</div>
<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $contact_email; ?>" required>
<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $contact_email; ?>">
</div>
</div>
<div class="form-group">

View File

@ -74,6 +74,11 @@
<textarea rows="4" class="form-control" name="purpose" required><?php echo $trip_purpose; ?></textarea>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" <?php if($round_trip == 1){ echo "checked"; } ?> class="custom-control-input" id="customControlAutosizing<?php echo $trip_id; ?>" name="roundtrip" value="1" >
<label class="custom-control-label" for="customControlAutosizing<?php echo $trip_id; ?>">Roundtrip</label>
</div>
</div>
<div class="tab-pane fade" id="pills-link<?php echo $trip_id; ?>" role="tabpanel" aria-labelledby="pills-link-tab">

View File

@ -563,11 +563,7 @@ if(isset($_POST['add_trip'])){
$location_id = intval($_POST['location']);
$vendor_id = intval($_POST['vendor']);
mysqli_query($mysqli,"INSERT INTO trips SET trip_date = '$date', trip_starting_location = '$starting_location', trip_destination = '$destination', trip_miles = $miles, trip_purpose = '$purpose', trip_created_at = NOW(), client_id = $client_id, invoice_id = $invoice_id, location_id = $location_id, vendor_id = $vendor_id");
if($roundtrip == 1){
mysqli_query($mysqli,"INSERT INTO trips SET trip_date = '$date', trip_starting_location = '$destination', trip_destination = '$starting_location', trip_miles = $miles, trip_purpose = '$purpose', trip_created_at = NOW(), client_id = $client_id, invoice_id = $invoice_id, location_id = $location_id, vendor_id = $vendor_id");
}
mysqli_query($mysqli,"INSERT INTO trips SET trip_date = '$date', trip_starting_location = '$starting_location', trip_destination = '$destination', trip_miles = $miles, round_trip = $round_trip, trip_purpose = '$purpose', trip_created_at = NOW(), client_id = $client_id, invoice_id = $invoice_id, location_id = $location_id, vendor_id = $vendor_id");
$_SESSION['alert_message'] = "Trip added";
@ -582,13 +578,14 @@ if(isset($_POST['edit_trip'])){
$starting_location = strip_tags(mysqli_real_escape_string($mysqli,$_POST['starting_location']));
$destination = strip_tags(mysqli_real_escape_string($mysqli,$_POST['destination']));
$miles = intval($_POST['miles']);
$roundtrip = intval($_POST['roundtrip']);
$purpose = strip_tags(mysqli_real_escape_string($mysqli,$_POST['purpose']));
$client_id = intval($_POST['client']);
$invoice_id = intval($_POST['invoice']);
$location_id = intval($_POST['location']);
$vendor_id = intval($_POST['vendor']);
mysqli_query($mysqli,"UPDATE trips SET trip_date = '$date', trip_starting_location = '$starting_location', trip_destination = '$destination', trip_miles = $miles, trip_purpose = '$purpose', trip_updated_at = NOW(), client_id = $client_id, invoice_id = $invoice_id, location_id = $location_id, vendor_id = $vendor_id WHERE trip_id = $trip_id");
mysqli_query($mysqli,"UPDATE trips SET trip_date = '$date', trip_starting_location = '$starting_location', trip_destination = '$destination', trip_miles = $miles, trip_purpose = '$purpose', round_trip = $round_trip, trip_updated_at = NOW(), client_id = $client_id, invoice_id = $invoice_id, location_id = $location_id, vendor_id = $vendor_id WHERE trip_id = $trip_id");
$_SESSION['alert_message'] = "Trip modified";
@ -2259,6 +2256,8 @@ if(isset($_POST['add_contact'])){
$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);
$mobile = strip_tags(mysqli_real_escape_string($mysqli,$_POST['mobile']));
$mobile = preg_replace("/[^0-9]/", '',$mobile);
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
if($_FILES['file']['tmp_name']!='') {
@ -2268,7 +2267,7 @@ if(isset($_POST['add_contact'])){
move_uploaded_file($_FILES['file']['tmp_name'], $path);
}
mysqli_query($mysqli,"INSERT INTO contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_email = '$email', contact_photo = '$path', contact_created_at = NOW(), client_id = $client_id");
mysqli_query($mysqli,"INSERT INTO contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_mobile = '$mobile', contact_email = '$email', contact_photo = '$path', contact_created_at = NOW(), client_id = $client_id");
$_SESSION['alert_message'] = "Contact added";
@ -2284,6 +2283,8 @@ if(isset($_POST['edit_contact'])){
$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);
$mobile = strip_tags(mysqli_real_escape_string($mysqli,$_POST['mobile']));
$mobile = preg_replace("/[^0-9]/", '',$mobile);
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
$path = strip_tags(mysqli_real_escape_string($mysqli,$_POST['current_avatar_path']));
@ -2295,7 +2296,7 @@ if(isset($_POST['edit_contact'])){
move_uploaded_file($_FILES['file']['tmp_name'], $path);
}
mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_email = '$email', contact_photo = '$path', contact_updated_at = NOW() WHERE contact_id = $contact_id");
mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_mobile = '$mobile', contact_email = '$email', contact_photo = '$path', contact_updated_at = NOW() WHERE contact_id = $contact_id");
$_SESSION['alert_message'] = "Contact updated";

View File

@ -86,18 +86,23 @@
$trip_starting_location = $row['trip_starting_location'];
$trip_destination = $row['trip_destination'];
$trip_miles = $row['trip_miles'];
$round_trip = $row['round_trip'];
$client_id = $row['client_id'];
$invoice_id = $row['invoice_id'];
$location_id = $row['location_id'];
$vendor_id = $row['vendor_id'];
if($round_trip == 1){
$round_tip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
}
?>
<tr>
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>"><?php echo $trip_date; ?></a></td>
<td><?php echo $trip_purpose; ?></td>
<td><?php echo $trip_starting_location; ?></td>
<td><?php echo $trip_destination; ?></td>
<td><?php echo $trip_miles; ?></td>
<td><?php echo "$trip_miles $round_tip_display"; ?></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">