mirror of https://github.com/itflow-org/itflow
Clean up Logic for Client Add and Client Edit Modals, same for trip add copy edit
This commit is contained in:
parent
40b6723fac
commit
eb01e4b4d5
|
|
@ -9,6 +9,8 @@
|
|||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="lead" value="0">
|
||||
<input type="hidden" name="net_terms" value="0">
|
||||
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
|
|
@ -21,9 +23,11 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact" id="contactNavPill">Contact</a>
|
||||
</li>
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-billing">Billing</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-more">More</a>
|
||||
</li>
|
||||
|
|
@ -231,66 +235,63 @@
|
|||
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-billing">
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hourly Rate</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00" value="<?php echo "$config_default_hourly_rate"; ?>">
|
||||
<div class="form-group">
|
||||
<label>Hourly Rate</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00" value="<?php echo "$config_default_hourly_rate"; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Payment Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($config_default_net_terms == $net_term_value) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label>Payment Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($config_default_net_terms == $net_term_value) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tax ID</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="tax_id_number" placeholder="Tax ID Number">
|
||||
<div class="form-group">
|
||||
<label>Tax ID</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="tax_id_number" placeholder="Tax ID Number">
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
|
||||
<input type="hidden" name="net_terms" value="0">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-more">
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -12,20 +12,25 @@
|
|||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="lead" value="0">
|
||||
<input type="hidden" name="currency_code" value="<?php if (empty($currency_code)) {
|
||||
echo $session_company_currency;
|
||||
} else {
|
||||
echo $currency_code;
|
||||
} ?>">
|
||||
<input type="hidden" name="net_terms" value="<?php echo $client_net_terms; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill"
|
||||
href="#pills-client-details<?php echo $client_id; ?>">Details</a>
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-client-details<?php echo $client_id; ?>">Details</a>
|
||||
</li>
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill"
|
||||
href="#pills-client-billing<?php echo $client_id; ?>">Billing</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-billing<?php echo $client_id; ?>">Billing</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill"
|
||||
href="#pills-client-more<?php echo $client_id; ?>">More</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-more<?php echo $client_id; ?>">More</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -113,82 +118,75 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-billing<?php echo $client_id; ?>">
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="tab-pane fade" id="pills-client-billing<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hourly Rate</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric"
|
||||
pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00"
|
||||
value="<?php echo number_format($client_rate, 2, '.', ''); ?>">
|
||||
<div class="form-group">
|
||||
<label>Hourly Rate</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric"
|
||||
pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00"
|
||||
value="<?php echo number_format($client_rate, 2, '.', ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($client_currency_code == $currency_code) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $currency_code; ?>">
|
||||
<?php echo "$currency_code - $currency_name"; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($client_currency_code == $currency_code) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $currency_code; ?>">
|
||||
<?php echo "$currency_code - $currency_name"; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Invoice Net Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<option value="">- Net Terms -</option>
|
||||
<?php foreach ($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($net_term_value == $client_net_terms) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $net_term_value; ?>">
|
||||
<?php echo $net_term_name; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label>Invoice Net Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<option value="">- Net Terms -</option>
|
||||
<?php foreach ($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($net_term_value == $client_net_terms) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $net_term_value; ?>">
|
||||
<?php echo $net_term_name; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tax ID</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="tax_id_number"
|
||||
placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
|
||||
<div class="form-group">
|
||||
<label>Tax ID</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="tax_id_number"
|
||||
placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="currency_code" value="<?php if (empty($currency_code)) {
|
||||
echo $session_company_currency;
|
||||
} else {
|
||||
echo $currency_code;
|
||||
} ?>">
|
||||
<input type="hidden" name="net_terms" value="<?php echo $net_term_value; ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-more<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -217,25 +215,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (mysqli_num_rows($sql_tags_select) == 0) { ?>
|
||||
|
||||
<div class='my-3 text-center'>
|
||||
<i class='fa fa-fw fa-6x fa-tags text-secondary'></i>
|
||||
<h3 class='text-secondary mt-3'>No Tags Found!</h3>
|
||||
<a href="settings_tags.php">Try adding a few <b>Settings > Tags</b></a>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i
|
||||
class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i
|
||||
class="fa fa-times mr-2"></i>Cancel</button>
|
||||
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,12 +13,6 @@ $('.select2').select2({
|
|||
theme: 'bootstrap4'
|
||||
});
|
||||
|
||||
// Initialize Select2 Elements
|
||||
$('.select2Tag').select2({
|
||||
theme: 'bootstrap4',
|
||||
tags: true
|
||||
});
|
||||
|
||||
// Initialize TinyMCE
|
||||
tinymce.init({
|
||||
selector: '.tinymce',
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2Tag" name="destination" required>
|
||||
<option value="">- Select or Input Destination Address -</option>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option value=""></option>
|
||||
<?php
|
||||
|
||||
$sql_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
|
|
|
|||
|
|
@ -54,13 +54,32 @@
|
|||
<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" placeholder="Enter a purpose" name="destination" value="<?php echo $trip_destination; ?>" required>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
$sql_locations_select = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_locations_select)) {
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
$location_address = nullable_htmlentities($row['location_address']);
|
||||
$location_city = nullable_htmlentities($row['location_city']);
|
||||
$location_state = nullable_htmlentities($row['location_state']);
|
||||
$location_zip = nullable_htmlentities($row['location_zip']);
|
||||
$location_full_address = "$location_address $location_city $location_state $location_zip";
|
||||
|
||||
?>
|
||||
<option><?php echo $location_full_address; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<textarea rows="4" class="form-control" placeholder="Enter a purpose" name="purpose" required><?php echo $trip_purpose; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-arrow-right"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2Tag" name="destination" required>
|
||||
<select class="form-control select2" name="destination" data-tags="true" data-placeholder="- Select / Input Destination -" required>
|
||||
<option><?php echo $trip_destination; ?></option>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue