mirror of https://github.com/itflow-org/itflow
UI Update on Trip Forms contact forms and location forms also Contact / Location under add /edit contact now add or edit the primary location and contact
This commit is contained in:
parent
4412b7f084
commit
3b3e6a0166
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" name="notes"></textarea>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@
|
|||
<div class="tab-pane fade" id="pills-notes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Notes"></textarea>
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<label>Title / Primary Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<div class="tab-pane fade show active" id="pills-details">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location Name <strong class="text-danger">*</strong></label>
|
||||
<label>Location Name / Primary Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="number" step="0.1" min="0" class="form-control" name="miles" value="<?php echo $trip_miles; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if($round_trip == 1){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -49,7 +54,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="destination" value="<?php echo $trip_destination; ?>" required>
|
||||
<input type="text" class="form-control" placeholder="Enter a purpose" name="destination" value="<?php echo $trip_destination; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -88,11 +93,6 @@
|
|||
|
||||
<?php } ?>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" <?php if($round_trip == 1){ echo "checked"; } ?> class="custom-control-input" id="customControlAutosizingCopy<?php echo $trip_id; ?>" name="roundtrip" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizingCopy<?php echo $trip_id; ?>">Round Trip</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label>Date <strong class="text-danger">*</strong></label>
|
||||
|
|
@ -23,12 +22,17 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group col">
|
||||
<label>Miles <strong class="text-danger">*</strong></label>
|
||||
<label>Miles / Roundtrip<strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="number" step="0.1" min="0" class="form-control" name="miles" placeholder="Enter miles" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -54,7 +58,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<textarea rows="4" class="form-control" name="purpose" required></textarea>
|
||||
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" required></textarea>
|
||||
</div>
|
||||
|
||||
<?php if(isset($_GET['client_id'])){ ?>
|
||||
|
|
@ -86,11 +90,6 @@
|
|||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="roundtrip" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizing">Round Trip</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_type = $row['client_type'];
|
||||
$location_id = $row['location_id'];
|
||||
$location_country = $row['location_country'];
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
|
|
@ -177,6 +178,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
}else{
|
||||
$location_address_display = "$location_address<br>$location_city $location_state $location_zip";
|
||||
}
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" name="notes"><?php echo $account_notes; ?></textarea>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||||
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
|
|
@ -131,7 +133,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="address" placeholder="Address" value="<?php echo $client_address; ?>">
|
||||
<input type="text" class="form-control" name="address" placeholder="Address" value="<?php echo $location_address; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -141,7 +143,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-city"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="city" placeholder="City" value="<?php echo $client_city; ?>">
|
||||
<input type="text" class="form-control" name="city" placeholder="City" value="<?php echo $location_city; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -154,7 +156,7 @@
|
|||
<select class="form-control select2" name="state">
|
||||
<option value="">- State -</option>
|
||||
<?php foreach($states_array as $state_abbr => $state_name) { ?>
|
||||
<option <?php if($client_state == $state_abbr) { echo "selected"; } ?> value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
<option <?php if($location_state == $state_abbr) { echo "selected"; } ?> value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -166,7 +168,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fab fa-fw fa-usps"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="zip" placeholder="Postal Code" value="<?php echo $client_zip; ?>">
|
||||
<input type="text" class="form-control" name="zip" placeholder="Postal Code" value="<?php echo $location_zip; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -179,7 +181,7 @@
|
|||
<select class="form-control select2" name="country">
|
||||
<option value="">- Country -</option>
|
||||
<?php foreach($countries_array as $country_name) { ?>
|
||||
<option <?php if($client_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
|
||||
<option <?php if($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -195,7 +197,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="contact" placeholder="Primary contact name" value="<?php echo $client_contact; ?>">
|
||||
<input type="text" class="form-control" name="contact" placeholder="Primary contact name" value="<?php echo $contact_name; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -207,12 +209,12 @@
|
|||
<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" value="<?php echo $client_phone; ?>" data-inputmask="'mask': '999-999-9999'" data-mask>
|
||||
<input type="text" class="form-control" name="phone" placeholder="Phone Number" value="<?php echo $contact_phone; ?>" data-inputmask="'mask': '999-999-9999'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension" value="<?php echo $client_extension; ?>">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Extension" value="<?php echo $contact_extension; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -222,7 +224,7 @@
|
|||
<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 Number" value="<?php echo $client_mobile; ?>" data-inputmask="'mask': '999-999-9999'" data-mask>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile Number" value="<?php echo $contact_mobile; ?>" data-inputmask="'mask': '999-999-9999'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -232,7 +234,7 @@
|
|||
<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" value="<?php echo $client_email; ?>">
|
||||
<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $contact_email; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -251,7 +253,7 @@
|
|||
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes"><?php echo $client_notes; ?></textarea>
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $client_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<label>Title / Primary Contact</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-id-badge"></i></span>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<div class="tab-pane fade show active" id="pills-details<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location Name <strong class="text-danger">*</strong></label>
|
||||
<label>Location Name / Primary Location <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-bicycle"></i></span>
|
||||
</div>
|
||||
<input type="number" step="0.1" min="0" class="form-control" name="miles" value="<?php echo $trip_miles; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="roundtrip" value="1" <?php if($round_trip == 1){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -56,12 +61,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>Purpose <strong class="text-danger">*</strong></label>
|
||||
<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="customControlAutosizingEdit<?php echo $trip_id; ?>" name="roundtrip" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizingEdit<?php echo $trip_id; ?>">Round Trip</label>
|
||||
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php if(isset($_GET['client_id'])){ ?>
|
||||
|
|
|
|||
19
post.php
19
post.php
|
|
@ -740,6 +740,8 @@ if(isset($_POST['add_client'])){
|
|||
if(isset($_POST['edit_client'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$location_id = intval($_POST['location_id']);
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['type'])));
|
||||
$support = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['support'])));
|
||||
|
|
@ -764,6 +766,23 @@ if(isset($_POST['edit_client'])){
|
|||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Client', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), client_id = $client_id, company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
//Edit Primary Location
|
||||
if($location_id > 0){
|
||||
mysqli_query($mysqli,"UPDATE locations SET location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_country = '$country', location_updated_at = NOW() WHERE location_id = $location_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Location', log_action = 'Modified', log_description = 'Primary Location $address', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
}
|
||||
|
||||
//Edit Primary Contact
|
||||
if($contact_id > 0){
|
||||
mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$contact', contact_title = '$title', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_email = '$email', contact_updated_at = NOW() WHERE contact_id = $contact_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Modified', log_description = 'Primary Contact $contact', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
}
|
||||
|
||||
$_SESSION['alert_message'] = "Client $name updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue