first commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
$link = 'profile/create';
|
||||
if (!$isNewRecord) {
|
||||
$link = 'profile/update';
|
||||
}
|
||||
$key = 'secret-key-in-config';
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Create Menu</h3>
|
||||
</div>
|
||||
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<div class="row" style="padding: 12px">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-outline card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
Akun User
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="row" style="padding: 20px">
|
||||
<div style="width: 100%">
|
||||
<div class="form-group row">
|
||||
<label for="input_username" class="col-sm-2 col-form-label">Username</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="username"
|
||||
name="User[username]"
|
||||
value="<?= (!$isNewRecord) ? $data->username : '' ?>"
|
||||
placeholder="Username" <?= (!$isNewRecord) ? 'readOnly' : '' ?> >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($isNewRecord): ?>
|
||||
<div class="form-group row">
|
||||
<label for="input_password"
|
||||
class="col-sm-2 col-form-label">Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="password"
|
||||
name="User[password]"
|
||||
value="<?= (!$isNewRecord) ? $data->password : '' ?>"
|
||||
placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="card-body">
|
||||
<!-- HIDDEN FORM -->
|
||||
<div class="form-group row">
|
||||
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord"
|
||||
value="<?= (!$isNewRecord) ? 'false' : 'true' ?>"
|
||||
placeholder="isNewRecord">
|
||||
|
||||
<input type="hidden" class="form-control" id="user_id" name="user_id"
|
||||
value="<?= (!$isNewRecord) ? $data->user_id : '' ?>"
|
||||
placeholder="User ID">
|
||||
</div>
|
||||
</div>
|
||||
<!-- HIDDEN FORM -->
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="input_name" class="col-sm-2 col-form-label">Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="name" name="name"
|
||||
value="<?= (!$isNewRecord) ? $data->name : '' ?>"
|
||||
placeholder="Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="input_email" class="col-sm-2 col-form-label">Email</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="email" class="form-control" id="email" name="email"
|
||||
value="<?= (!$isNewRecord) ? $data->email : '' ?>"
|
||||
placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="input_phone" class="col-sm-2 col-form-label">Phone</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" id="phone" name="phone"
|
||||
value="<?= (!$isNewRecord) ? $data->phone : '' ?>"
|
||||
placeholder="Phone">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="input_parent" class="col-sm-2 col-form-label">Typeuser</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<select class="form-control select2" id="typeuser_id" name="typeuser_id"
|
||||
style="width: 100%;">
|
||||
<?php if ($isNewRecord) : ?>
|
||||
<option value="">-- Select Typeuser --</option>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($typeuser as $item): ?>
|
||||
<option value="<?= $item->id ?>" <?= (!$isNewRecord) ? $item->id == $data->typeuser_id ? "Selected" : "" : '' ?>><?= $item->value ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="input_foto" class="col-sm-2 col-form-label">Foto</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="file" class="form-control" id="foto" name="foto" placeholder="Foto">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-footer">
|
||||
<button type="submit"
|
||||
class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Profile' : 'Update Profile' ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<div class="modal fade" id="modal-reset">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Reset Password</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="form-reset" autocomplete="off">
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="password" class="col-sm-2 col-form-label">Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="password" name="password"
|
||||
placeholder="New Password">
|
||||
<input type="hidden" class="form-control" id="user_id" name="user_id"
|
||||
value="<?= $user_id ?>"
|
||||
placeholder="User ID">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="btn-reset-password">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("body").off("click", "#btn-reset-password").on("click", "#btn-reset-password", function (e) {
|
||||
var data = $('#form-reset').serializeArray();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: baseUrl + '/profile/reset_password',
|
||||
data: data,
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
location.reload();
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,84 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h3 class="card-title">List Profile</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-header">
|
||||
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[C]']))) : ?>
|
||||
<a href="<?= base_url('profile/create') ?>" class="btn btn-success btn-sm float-right">Create Profile</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if ($this->session->flashdata('success')): ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
<?php echo $this->session->flashdata('success'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->session->flashdata('failed')): ?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<?php echo $this->session->flashdata('failed'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table id="example1" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Typeuser</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (!empty($data)): ?>
|
||||
<?php foreach ($data as $item) : ?>
|
||||
<tr>
|
||||
<td><?= $item['name'] ?></td>
|
||||
<td><?= $item['username'] ?></td>
|
||||
<td><?= $item['email'] ?></td>
|
||||
<td><?= $item['typeuser'] ?></td>
|
||||
<td>
|
||||
<?php if ($item['status'] == 1): ?>
|
||||
<span class="right badge badge-success">Active</span>
|
||||
<?php else: ?>
|
||||
<span class="right badge badge-danger">Blocked</span>
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[R]']))) : ?>
|
||||
<a href="<?= base_url('profile/view/' . encrypt_url($item['user_id'])) ?>"
|
||||
class="btn btn-warning btn-xs"><i class="fas fa-eye"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($item['status'] == 1) : ?>
|
||||
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[U]']))) : ?>
|
||||
<a href="<?= base_url('profile/update/' . encrypt_url($item['user_id'])) ?>"
|
||||
class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($item['typeuser_id'] != 1) : ?>
|
||||
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[D]']))) : ?>
|
||||
<a href="<?= base_url('profile/blocked/' . encrypt_url($item['user_id'])) ?>"
|
||||
class="btn btn-danger btn-xs"><i class="fas fa-ban"> Block</i></a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<td colspan="6" style="text-align: center; font-style: italic">Data is empty!</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body box-profile">
|
||||
<div class="text-center">
|
||||
<img class="profile-user-img img-fluid img-circle"
|
||||
src="<?= (!empty($data->foto)) ? base_url('assets/img/upload/' . $data->foto) : base_url('assets/img/system/no_img.jpg') ?>"
|
||||
alt="User profile picture">
|
||||
</div>
|
||||
<h3 class="profile-username text-center"><?= $data->name ?></h3>
|
||||
<p class="text-muted text-center"><?= $data->typeuser ?></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="card">
|
||||
<div class="card-header p-2">
|
||||
<ul class="nav nav-pills">
|
||||
<li class="nav-item"><a class="nav-link active" href="#detail"
|
||||
data-toggle="tab">Detail</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="tab-content">
|
||||
<div class="active tab-pane" id="detail">
|
||||
<strong><i class="fas fa-user-check"></i> Username</strong>
|
||||
<p class="text-muted"><?= $data->username ?></p>
|
||||
<hr>
|
||||
<strong><i class="fas fa-envelope"></i> Email</strong>
|
||||
<p class="text-muted"><?= $data->email ?></p>
|
||||
<hr>
|
||||
<strong><i class="fas fa-phone-square"></i> Phone</strong>
|
||||
<p class="text-muted"><?= $data->phone ?></p>
|
||||
<hr>
|
||||
<strong><i class="fas fa-toggle-on"></i> Status</strong>
|
||||
<p class="text-muted">
|
||||
<?php if ($data->status == 1): ?>
|
||||
<span class="right badge badge-success">Active</span>
|
||||
<?php else: ?>
|
||||
<span class="right badge badge-danger">Blocked</span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="tab-pane" id="setting">
|
||||
<div id="div-setting"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user