<?php require_once 'header.php'; ?> <div class="container theme-showcase" role="main"> <div class="jumbotron"> <h1>Cadastro de novos clientes</h1> <p>Preencha o formulário para adicionar um novo cliente.</p> </div> <?php if ($_POST) { if ($_POST['action'] == 'update') { if (update_client($_POST['id'], $_POST['name'], $_POST['email'], $_POST['tel'], $connection) == 'true') { echo '<div class="row"><div class="alert alert-success" role="alert"><strong>Sucesso! </strong>Seu cliente foi atualizado.</div></div>'; } else { echo '<div class="alert alert-danger" role="alert"><strong>Ops... </strong> Houve um erro, tente novamente.</div>'; } } else { if (add_client($_POST['name'], $_POST['email'], $_POST['tel'], $connection) == 'true') { echo '<div class="row"><div class="alert alert-success" role="alert"><strong>Sucesso! </strong>Seu cliente foi adicionado.</div></div>'; } else { echo '<div class="alert alert-danger" role="alert"><strong>Ops... </strong> Houve um erro, tente novamente.</div>'; } } } ?> <div class="row"> <div class="col-md-8"> <?php if ($_GET && is_numeric($_GET['id'])) { $object = get_data('cliente', $_GET['id'], $connection);
if ($action = hesk_REQUEST('a')) { if ($action == 'reset_form') { $_SESSION['edit_userdata'] = TRUE; header('Location: ./manage_users.php'); } elseif ($action == 'edit' || $action == 'editb') { edit_user(); } elseif ($action == 'editc') { edit_clients(); } elseif (defined('HESK_DEMO')) { hesk_process_messages($hesklang['ddemo'], 'manage_users.php', 'NOTICE'); } elseif ($action == 'new') { new_user(); } elseif ($action == 'save') { update_user(); } elseif ($action == 'update_client') { update_client(); } elseif ($action == 'remove') { remove(); } elseif ($action == 'removec') { remove_clients(); } elseif ($action == 'autoassign') { toggle_autoassign(); } else { hesk_error($hesklang['invalid_action']); } } else { /* If one came from the Edit page make sure we reset user values */ if (isset($_SESSION['save_userdata'])) { $_SESSION['userdata'] = $default_userdata; unset($_SESSION['save_userdata']); }