Files
itflow/admin/modals/canned_response/canned_response_edit.php

43 lines
2.1 KiB
PHP

<?php
/*
* Edit a canned response, shared or an agent's own - the fields are includes/canned_response_form.php.
*/
require_once '../../includes/modal_header.php';
$response = cannedResponseRow($_GET['id'] ?? 0);
ob_start();
if (!$response) { ?>
<div class="modal-body text-center text-secondary py-5">That canned response is gone - it may have been deleted.</div>
<?php } else {
$canned_response_id = intval($response['canned_response_id']);
$response_category_ids = cannedResponseCategoryIds($canned_response_id); ?>
<div class="modal-header bg-dark">
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-comment-dots me-2"></i>Edit Canned Response <span class="fw-normal text-white-50 ms-1"><?= escapeHtml($response['canned_response_name']) ?></span></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="canned_response_id" value="<?= $canned_response_id ?>">
<div class="modal-body">
<?php if (intval($response['canned_response_user_id'])) {
$owner_name = getFieldById('users', intval($response['canned_response_user_id']), 'user_name'); ?>
<div class="small text-body-secondary mb-3"><i class="fas fa-fw fa-user me-1"></i><?= $owner_name !== null && $owner_name !== '' ? escapeHtml($owner_name) . "'s own" : "A removed agent's own" ?> - offered to them alone. Share it with everyone from its menu in the list.</div>
<?php } ?>
<?php require __DIR__ . '/../../../includes/canned_response_form.php'; ?>
</div>
<div class="modal-footer">
<button type="submit" name="edit_canned_response" class="btn btn-primary fw-bold"><i class="fas fa-check me-2"></i>Save</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Cancel</button>
</div>
</form>
<?php }
require_once '../../../includes/modal_footer.php';