mirror of https://github.com/itflow-org/itflow
Let AJAX handle the model header
This commit is contained in:
parent
5f7b297cf1
commit
3cf33afac4
|
|
@ -40,12 +40,15 @@ if ($email_status == 0) {
|
|||
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-fw fa-envelope-open mr-2'></i><strong>$email_subject</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-fw fa-envelope-open mr-2'></i><strong><?php echo $email_subject; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
|
|
|
|||
|
|
@ -38,17 +38,19 @@ $asset_vendor_id = intval($row['asset_vendor_id']);
|
|||
$asset_location_id = intval($row['asset_location_id']);
|
||||
$asset_contact_id = intval($row['asset_contact_id']);
|
||||
$asset_network_id = intval($row['interface_network_id']);
|
||||
|
||||
$device_icon = getAssetIcon($asset_type);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-$device_icon mr-2'></i>Copying asset: <strong>$asset_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-<?php echo $device_icon; ?> mr-2'></i>Copying asset: <strong><?php echo $asset_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
|
|
|
|||
|
|
@ -48,13 +48,15 @@ $sql_asset_history = mysqli_query($mysqli, "SELECT * FROM asset_history
|
|||
DESC LIMIT 10"
|
||||
);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-$device_icon mr-2'></i>Editing asset: <strong>$asset_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-<?php echo $device_icon; ?> mr-2'></i>Editing asset: <strong><?php echo $asset_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||
|
|
|
|||
|
|
@ -45,13 +45,15 @@ if ($link_row = mysqli_fetch_assoc($sql_link)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-ethernet mr-2'></i>Editing Interface: $asset_name - <strong>$interface_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-ethernet mr-2'></i>Editing Interface: <?php echo $asset_name; ?> - <strong><?php echo $interface_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
|
||||
<input type="hidden" name="interface_id" value="<?php echo $interface_id; ?>">
|
||||
|
|
|
|||
|
|
@ -29,12 +29,16 @@ while ($row = mysqli_fetch_array($sql_client_tags)) {
|
|||
$client_tag_id_array[] = $client_tag_id;
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-user-edit mr-2'></i>Editing Client: <strong>$client_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-user-edit mr-2'></i>Editing Client: <strong><?php echo $client_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,15 @@ while ($row = mysqli_fetch_array($sql_contact_tags)) {
|
|||
$contact_tag_id_array[] = $contact_tag_id;
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-user-edit mr-2'></i>Editing Contact: <strong>$contact_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-user-edit mr-2'></i>Editing Contact: <strong><?php echo $contact_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
|
|
|||
|
|
@ -8,12 +8,17 @@ $sql = mysqli_query($mysqli, "SELECT contact_name FROM contacts WHERE contact_id
|
|||
$row = mysqli_fetch_array($sql);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-sticky-note mr-2'></i>Creating note: <strong>$contact_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-sticky-note mr-2'></i>Creating note: <strong><?php echo $contact_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,17 @@ while ($row = mysqli_fetch_array($sql_login_tags)) {
|
|||
$login_tag_id_array[] = $login_tag_id;
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-fw fa-key mr-2'></i>Editing credential: <strong>$login_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-fw fa-key mr-2'></i>Editing credential: <strong><?php echo $login_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="login_id" value="<?php echo $login_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
|
|
|||
|
|
@ -19,12 +19,17 @@ $expense_category_id = intval($row['expense_category_id']);
|
|||
$expense_account_id = intval($row['expense_account_id']);
|
||||
$expense_client_id = intval($row['expense_client_id']);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-fw fa-copy mr-2'></i>Copying expense";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-fw fa-copy mr-2'></i>Copying expense</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-row">
|
||||
|
|
|
|||
|
|
@ -19,12 +19,17 @@ $expense_category_id = intval($row['expense_category_id']);
|
|||
$expense_account_id = intval($row['expense_account_id']);
|
||||
$expense_client_id = intval($row['expense_client_id']);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-fw fa-shopping-cart mr-2'></i>Editing expense";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-fw fa-shopping-cart mr-2'></i>Editing expense</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="expense_id" value="<?php echo $expense_id; ?>">
|
||||
|
|
|
|||
|
|
@ -19,12 +19,17 @@ $expense_category_id = intval($row['expense_category_id']);
|
|||
$expense_account_id = intval($row['expense_account_id']);
|
||||
$expense_client_id = intval($row['expense_client_id']);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-fw fa-undo mr-2'></i>Refunding expense";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-fw fa-undo mr-2'></i>Refunding expense</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="account" value="<?php echo $expense_account_id; ?>">
|
||||
|
|
|
|||
|
|
@ -10,12 +10,17 @@ $sql = mysqli_query($mysqli, "SELECT * FROM notifications
|
|||
|
||||
$num_notifications = mysqli_num_rows($sql);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-bell mr-2'></i>Notifications<span class='badge badge-secondary badge-pill px-3 ml-3'>$num_notifications<span>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fas fa-bell mr-2'></i>Notifications<span class='badge badge-secondary badge-pill px-3 ml-3'><?php echo $num_notifications; ?><span></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
<?php if ($num_notifications) { ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$client_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $client_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
$client_is_lead = intval($row['client_lead']);
|
||||
$client_type = nullable_htmlentities($row['client_type']);
|
||||
$client_website = nullable_htmlentities($row['client_website']);
|
||||
$client_referral = nullable_htmlentities($row['client_referral']);
|
||||
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
|
||||
$client_net_terms = intval($row['client_net_terms']);
|
||||
$client_tax_id_number = nullable_htmlentities($row['client_tax_id_number']);
|
||||
$client_abbreviation = nullable_htmlentities($row['client_abbreviation']);
|
||||
$client_rate = floatval($row['client_rate']);
|
||||
$client_notes = nullable_htmlentities($row['client_notes']);
|
||||
$client_created_at = nullable_htmlentities($row['client_created_at']);
|
||||
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||
|
||||
// Client Tags
|
||||
$client_tag_id_array = array();
|
||||
$sql_client_tags = mysqli_query($mysqli, "SELECT tag_id FROM client_tags WHERE client_id = $client_id");
|
||||
while ($row = mysqli_fetch_array($sql_client_tags)) {
|
||||
$client_tag_id = intval($row['tag_id']);
|
||||
$client_tag_id_array[] = $client_tag_id;
|
||||
}
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class='fa fa-fw fa-user-check mr-2'></i>Assigning Ticket: <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong> - <?php echo $client_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
<input type="hidden" name="ticket_status" value="<?php echo $ticket_status_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Assign to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="assigned_to">
|
||||
<option value="0">Not Assigned</option>
|
||||
<?php
|
||||
$sql_users_select = mysqli_query($mysqli, "SELECT users.user_id, user_name FROM users
|
||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||
WHERE user_type = 1
|
||||
AND user_archived_at IS NULL
|
||||
ORDER BY user_name DESC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql_users_select)) {
|
||||
$user_id_select = intval($row['user_id']);
|
||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $user_id_select; ?>" <?php if ($user_id_select == $ticket_assigned_to) { echo "selected"; } ?>><?php echo $user_name_select; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="assign_ticket" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Assign</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -38,7 +38,7 @@ if (str_contains(basename($_SERVER["PHP_SELF"]), "admin_")) { ?>
|
|||
<!-- AdminLTE App -->
|
||||
<script src="plugins/adminlte/js/adminlte.min.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/generic_modal_loader.js"></script>
|
||||
<script src="js/ajax_modal.js"></script>
|
||||
<script src="js/confirm_modal.js"></script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Generic Ajax Modal Load Script
|
||||
// Ajax Modal Load Script
|
||||
//
|
||||
/* Example Triggering -->
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||
}
|
||||
|
||||
// Create a modal ID by appending the ajaxId.
|
||||
var modalId = 'dynamicAjaxModal_' + ajaxId;
|
||||
var modalId = 'ajaxModal_' + ajaxId;
|
||||
|
||||
// Remove any existing modal with this ID.
|
||||
$('#' + modalId).remove();
|
||||
|
|
@ -44,14 +44,8 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||
var modalHtml =
|
||||
'<div class="modal text-sm" id="' + modalId + '" tabindex="-1">' +
|
||||
' <div class="modal-dialog modal-'+ modalSize +'">' +
|
||||
' <div class="modal-content bg-dark">' +
|
||||
' <div class="modal-header">' +
|
||||
' <h5 class="modal-title" id="' + modalId + 'Label">' + response.title + '</h5>' +
|
||||
' <button type="button" class="close text-white" data-dismiss="modal">' +
|
||||
' <span>×</span>' +
|
||||
' </button>' +
|
||||
' </div>' +
|
||||
response.content +
|
||||
' <div class="modal-content bg-dark">'
|
||||
+ response.content +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
Loading…
Reference in New Issue