worked on tickets, invoice and domain

This commit is contained in:
Anjali Ojha 2024-08-28 18:23:43 +05:30
parent 3403ce917a
commit 9e837b6791
21 changed files with 328 additions and 251 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
.env
.htaccess
/writable/session
/writable/logs

View file

@ -31,10 +31,10 @@ class Database extends Config
public array $default = [
'DSN' => '',
'hostname' => 'db_host',
'username' => 'db_user',
'password' => 'db_pass',
'database' => 'db_name',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'whatpanel',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'hd_',
'pConnect' => false,

View file

@ -0,0 +1 @@
Done

View file

@ -120,12 +120,15 @@ class Installer extends MX_Controller
session()->set('key', $apiKey);
$body = [
'action' => 'check_license',
'domain_name' => $trim,
//'domain_name' => "uat.whatpanel.com",
//'domain_name' => $trim,
'domain_name' => "sanyog.com",
'license' => $apiKey
];
try {
$client = new \GuzzleHttp\Client([
'verify' => false, // or use a path to cacert.pem for a more secure approach
]);
// Make the GET request with the Authorization header
$response = $client->post($url, [
'headers' => [
@ -196,8 +199,6 @@ class Installer extends MX_Controller
public function done()
{
// $this->load->view('installed');
// Define the file path
$filePath = APPPATH."/Config/alldone.txt";
@ -234,7 +235,18 @@ class Installer extends MX_Controller
['id' => 29, 'name' => 'Domain Names', 'settings' => '', 'param' => 'faq_39', 'type' => 'Module', 'module' => 'FAQ']
];
$builder->insertBatch($data);
foreach ($data as $row) {
// Check if the record exists
$existingRecord = $builder->where('id', $row['id'])->get()->getRowArray();
if ($existingRecord) {
// Update the existing record
$builder->where('id', $row['id'])->update($row);
} else {
// Insert the new record
$builder->insert($row);
}
}
return view('installed');
}
@ -429,7 +441,7 @@ class Installer extends MX_Controller
$this->clearCache();
// Path to your SQL file
$fileUrl = $baseURL . 'public/sql/whatpanel_' . $version . '.sql';
$fileUrl = $baseURL . '/public/sql/whatpanel_' . $version . '.sql';
$tempFilePath = WRITEPATH . 'temp_sql_file.sql';
// Fetch the SQL file using cURL

View file

@ -19,6 +19,7 @@ use App\Models\App;
use App\Models\Field;
use App\Models\Invoice;
use App\Models\Fields;
use DateTime;
class AppLib
{
@ -903,6 +904,36 @@ class AppLib
}
}
static function timeAgo($timestamp)
{
$now = new DateTime();
$past = new DateTime($timestamp);
$interval = $now->diff($past);
$format = array();
if ($interval->y > 0) {
$format[] = $interval->y . ' year' . ($interval->y > 1 ? 's' : '');
}
if ($interval->m > 0) {
$format[] = $interval->m . ' month' . ($interval->m > 1 ? 's' : '');
}
if ($interval->d > 0) {
$format[] = $interval->d . ' day' . ($interval->d > 1 ? 's' : '');
}
if ($interval->h > 0) {
$format[] = $interval->h . ' hour' . ($interval->h > 1 ? 's' : '');
}
if ($interval->i > 0) {
$format[] = $interval->i . ' minute' . ($interval->i > 1 ? 's' : '');
}
if ($interval->s > 0) {
$format[] = $interval->s . ' second' . ($interval->s > 1 ? 's' : '');
}
// Combine all the parts
return implode(', ', $format) . ' ago';
}
public static function curl_exec_follow($ch, &$maxredirect = null)

View file

@ -91,12 +91,11 @@ class Domain extends Model
->where($type)
->where($array)
->where('o_id', 0)
->distinct('domain')
->orderBy('id', 'desc');
$result = $query->get()->getResult();
// echo $db->getLastQuery();die;
return $result;
}

View file

@ -915,7 +915,6 @@ class Settings extends WhatPanel
return redirect()->to('settings/system');
break;
case 'theme':
echo 343;die;
if ($request->getFile('iconfile')) {
$stat = $this->upload_favicon($request->getPost());
return redirect()->to($stat);
@ -929,9 +928,7 @@ class Settings extends WhatPanel
if ($request->getFile('loginbg')) {
$this->upload_login_bg($request->getPost());
}
echo 132;die;
$this->_update_theme_settings('theme');
echo 123;die;
return redirect()->to('settings/theme');
break;
case 'crons':
@ -1268,7 +1265,7 @@ class Settings extends WhatPanel
$session->setFlashdata('response_status', 'success');
$session->setFlashdata('message', lang('hd_lang.settings_updated_successfully'));
//return redirect()->to('settings/theme');
//$return_url = base_url() . 'settings/theme';
$return_url = base_url() . 'settings/theme';
return $return_url;
}
@ -1599,8 +1596,8 @@ class Settings extends WhatPanel
$this->form_validation->set_rules('email_invoice_message', 'Invoice Message', 'required');
$this->form_validation->set_rules('reminder_message', 'Reminder Message', 'required');
if ($this->form_validation->run() == FALSE) {
$this->session->set_flashdata('response_status', 'error');
$this->session->set_flashdata('message', lang('hd_lang.settings_update_failed'));
session()->setFlashdata('response_status', 'error');
session()->setFlashdata('message', lang('hd_lang.settings_update_failed'));
$_POST = '';
$this->update('email');
} else {
@ -1609,13 +1606,13 @@ class Settings extends WhatPanel
$this->db->where('config_key', $key)->update('config', $data);
}
$this->session->set_flashdata('response_status', 'success');
$this->session->set_flashdata('message', lang('hd_lang.settings_updated_successfully'));
session()->setFlashdata('response_status', 'success');
session()->setFlashdata('message', lang('hd_lang.settings_updated_successfully'));
redirect('settings/update/email');
}
} else {
$this->session->set_flashdata('response_status', 'error');
$this->session->set_flashdata('message', lang('hd_lang.settings_update_failed'));
session()->setFlashdata('response_status', 'error');
session()->setFlashdata('message', lang('hd_lang.settings_update_failed'));
redirect('settings/update/email');
}
}
@ -1640,10 +1637,19 @@ class Settings extends WhatPanel
// Validate the uploaded file
$validationRules = [
'iconfile' => 'uploaded[iconfile]|max_size[iconfile,1024]|is_image[iconfile]|ext_in[iconfile,jpg,jpeg,png,ico,svg]',
'iconfile' => [
'rules' => 'uploaded[iconfile]|is_image[iconfile]|ext_in[iconfile,jpg,jpeg,png,ico]|max_size[iconfile,1024]|max_dims[iconfile,300,300]',
'errors' => [
'uploaded' => 'No file was uploaded.',
'is_image' => 'The file is not a valid image.',
'ext_in' => 'Invalid file extension.',
'max_size' => 'File size exceeds the limit of 1MB.',
'max_dims' => 'Image dimensions exceed the limit of 300x300 pixels.'
]
]
];
//if ($this->validate($validationRules)) {
if ($this->validate($validationRules)) {
// Move the uploaded file to the desired directory
$newName = $file->getRandomName();
@ -1658,10 +1664,10 @@ class Settings extends WhatPanel
// Assuming $db is an instance of the database class
$db->table('hd_config')->where('config_key', 'site_favicon')->update($data);
echo $_POST['return_url'];
return $_POST['return_url'];
//return TRUE;
//}
}
}

View file

@ -18,36 +18,40 @@
<!-- Custom CSS -->
<link href="<?=base_url("css/stylish-portfolio.css")?>" rel="stylesheet">
<link href="<?=base_url("css/custom.css")?>" rel="stylesheet">
<!-- Custom Fonts -->
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Header -->
<header id="top" class="header">
<div class="text-vertical-center">
<h1>Installed!</h1>
<h3>Thank you for installing WHAT PANEL !</h3>
<br>
<a href="<?= site_url("login") ?>" class="btn btn-dark btn-lg">Check it out</a>
<section id="installedSection">
<div class="installDeskImg">
<img
src="public/images/main-section-bg.png"
alt="Installed Successfully"
class="img-fluid deskImg"
/>
<img
src="public/images/midTab.png"
alt="Installed Successfully"
class="img-fluid midTabImg"
/>
<img
src="public/images/mobBg.png"
alt="Installed Successfully"
class="img-fluid mobImg"
/>
</div>
</header>
<div class="textOverlayBox">
<h1>Installed...!</h1>
<span>Thank you for installing Hosting Billing</span>
<a href="<?= site_url("login") ?>" class="checkBtn">Check it out</a>
</div>
</section>
<!-- jQuery -->
<script src="<?=base_url("js/jquery.min.js")?>"></script>
@ -55,6 +59,8 @@
<!-- Bootstrap Core JavaScript -->
<script src="<?=base_url("js/bootstrap.min.js")?>"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</body>

View file

@ -55,6 +55,16 @@ $session = session();
.edit-link:hover .edit-name {
opacity: 1;
}
.clrBtn{
font-size: 1.6rem !important;
border-radius: 0.5rem !important;
padding: 0.8rem 1.2rem !important;
text-align: center !important;
color: #fff !important;
cursor: pointer !important;
border: 0 !important;
}
</style>
<section id="orders-wrap">

View file

@ -196,6 +196,7 @@ $custom = new custom_name_helper();
</button>
</form>
<?php } ?>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script>
$(document).ready(function() {
@ -222,7 +223,6 @@ $custom = new custom_name_helper();
});
$('#add-new-file').on('click', function() {
alert(1232);
$('#file_container').append(
"<div class='form-group modal-input flex-wrap align-items-center'>" +
"<label class=' col-sm-3 col-12 control-label common-label'> <?= lang('hd_lang.attachment') ?></label>" +
@ -244,8 +244,6 @@ $custom = new custom_name_helper();
}
});
</script>
<?php } ?>
</div>
<?= $this->endSection() ?>
</div>

View file

@ -45,9 +45,9 @@ $db = \Config\Database::connect();
<span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$statuses = $db->table('hd_status')->get()->getResult();
$statuses = $db->table('hd_status')->whereIn('status', ['open', 'in_process', 'on_hold', 'closed', 'resolved', 'pending'])->get()->getResult();
foreach ($statuses as $key => $s) { ?>
<li><a href="<?= base_url() ?>tickets/status/<?= $info->id ?>/<?= $s->status ?>"><?= lang($s->status) ?></a>
<li><a href="<?= base_url() ?>tickets/status/<?= $info->id ?>/<?= $s->status ?>"><?= lang($s->name) ?></a>
</li>
<?php } ?>
</ul>
@ -284,47 +284,6 @@ $db = \Config\Database::connect();
$role = User::get_role($r->replierid);
$role_label = ($role == 'admin') ? 'danger' : 'info';
?>
<!-- <article id="comment-id-1" >
<section class="comment-body panel panel-default">
<header class="bg-white common-h">
<a href="#"><?php echo User::displayName($r->replierid); ?></a>
<label class="label bg-<?= $role_label ?> m-l-xs common-p col-md-1 text-white text-center">
<?php echo ucfirst(User::get_role($r->replierid)) ?></label>
<span class="text-muted m-l-sm pull-right common-span">
<i class="fa fa-clock-o"></i>
<?php echo strftime($custom->getconfig_item('date_format') . " %H:%M:%S", strtotime($r->time)); ?>
<?php
if ($custom->getconfig_item('show_time_ago') == 'TRUE') {
echo ' - ' . AppLib::time_elapsed_string(strtotime($r->time));
}
?>
</span>
</header>
<div class="panel-body">
<div class="small m-t-sm activate_links common-p">
<?= $r->body ?>
</div>
<?php if ($r->attachment != NULL) {
echo '<div class="line line-dashed line-lg pull-in"></div>';
$replyfiles = '';
if (json_decode($r->attachment)) {
$replyfiles = json_decode($r->attachment);
foreach ($replyfiles as $rf) { ?>
<a class="label bg-info" href="<?= base_url() ?>resource/attachments/<?= $rf ?>" target="_blank"><?= $rf ?></a><br>
<?php }
} else { ?>
<a href="<?= base_url() ?>resource/attachments/<?= $r->attachment ?>" target="_blank"><?= $r->attachment ?></a><br>
<?php } ?>
<?php } ?>
</div>
</section>
</article> -->
<tr id="comment-id-1">
<td>
<div class="sender-div">
@ -359,22 +318,20 @@ $db = \Config\Database::connect();
<?php echo strftime($custom->getconfig_item('date_format') . " %H:%M:%S", strtotime($r->time)); ?>
<?php
if ($custom->getconfig_item('show_time_ago') == 'TRUE') {
echo ' - ' . AppLib::time_elapsed_string(strtotime($r->time));
echo ' - ' . AppLib::timeAgo($r->time);
}
?>
</span>
</td>
</tr>
<?php }
} else { ?>
<tr id="comment-id-1">
<td colspan='4'><p class="no-reply common-p"><?= lang('hd_lang.no_ticket_replies') ?></p></td>
<td colspan='4'>
<p class="no-reply common-p"><?= lang('hd_lang.no_ticket_replies') ?></p>
</td>
</tr>
<?php } ?>

View file

@ -1,25 +1,17 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /WHATPanel/public/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Rewrite "index.php" Out Of The URL...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# Ensure Authorization Header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Disable Directory Listing
Options -Indexes
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 /index.php
</IfModule>

View file

@ -168,3 +168,91 @@ font-size: 2.6rem !important;
color: white;
padding-right: 19px;
}
/* Installed CSS starts here */
#installedSection {
position: relative;
}
.installDeskImg {
position: relative;
width: 100%;
height: 100vh;
overflow: hidden;
}
.installDeskImg img {
width: 100%;
height: 100%;
object-fit: cover;
}
.textOverlayBox {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
}
.textOverlayBox h1 {
font-size: 42px;
font-weight: 600;
color: #fff;
margin: 0;
line-height: 1;
}
.textOverlayBox span {
font-size: 18px;
font-weight: 400;
color: #d1d7e2;
}
.checkBtn {
height: 45px;
display: flex;
align-items: center;
justify-content: center;
width: 140px;
background: #5479f7;
border-radius: 5rem;
border: 0;
font-family: "Work Sans", sans-serif;
font-weight: 500;
font-style: normal;
font-size: 16px;
color: #fff;
text-decoration: none;
}
.checkBtn:hover {
background-color: #1b4ff9;
color: #fff;
}
@media screen and (min-width: 1025px) {
.midTabImg {
display: none;
}
}
@media screen and (max-width: 1024px) {
.deskImg {
display: none;
}
}
@media screen and (max-width: 767px) {
.deskImg {
display: none;
}
.midTabImg {
display: none;
}
.textOverlayBox{
width: 100%;
}
.textOverlayBox h1{
font-size: 32px;
}
.textOverlayBox span{
font-size: 14px;
}
}
/* Installed CSS ends here */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 MiB

BIN
public/images/midTab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
public/images/mobBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 KiB

View file

@ -512,8 +512,8 @@ INSERT INTO `hd_config` (`config_key`, `value`) VALUES
('stop_timer_logout', 'FALSE'),
('stripe_active', 'TRUE'),
('stripe_live', 'TRUE'),
('stripe_private_key', 'sk_test_51HJfXiJY2WLlJEcK37q619s4WVHrxgPfoBzAAErMyTcmTz4ukYWRLhxcD8mbKSrNaESrEPRiwTbrS7KP171r83Lk00wpmfay55'),
('stripe_public_key', 'pk_test_51HJfXiJY2WLlJEcKunmHNmN59bEKRBmgFQzGIVQIIRlFENDSYlgYX5LmsX7QKbuG3hgX417rU3rGCN1hyzykX3rX00fqZh75gd'),
('stripe_private_key', ''),
('stripe_public_key', ''),
('support_email', 'support@whatpanel.com'),
('support_email_name', ' WHAT PANEL Support'),
('suspend_after', '3'),
@ -2190,6 +2190,8 @@ INSERT INTO `hd_status` (`id`, `name`, `status`) VALUES
(15, 'Expired', 'expired'),
(16, 'Transferred Away', 'transferred_away'),
(17, 'Fraud', 'fraud');
(17, 'In Process', 'in_process');
(17, 'On Hold', 'on_hold');
-- --------------------------------------------------------
@ -2706,35 +2708,6 @@ CREATE TABLE `hd_resellerclub_customer_details` (
`updated_at` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `hd_status` (
`id` int(11) NOT NULL,
`name` varchar(35) DEFAULT NULL,
`status` varchar(200) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
--
-- Dumping data for table `hd_status`
--
INSERT INTO `hd_status` (`id`, `name`, `status`) VALUES
(1, 'Resolved', 'resolved'),
(2, 'Closed', 'closed'),
(3, 'Open', 'open'),
(5, 'Pending', 'pending'),
(6, 'Active', 'active'),
(7, 'Cancelled', 'cancelled'),
(8, 'Deleted', 'deleted'),
(9, 'Suspended', 'suspended'),
(10, 'Status', 'status'),
(11, 'Pending Registration', 'pending_registration'),
(12, 'Pending Transfer', 'pending_transfer'),
(13, 'Grace Period(Expired)', 'grace_period'),
(14, 'Redemption Period(Expired)', 'redemption_period'),
(15, 'Expired', 'expired'),
(16, 'Transferred Away', 'transferred_away'),
(17, 'Fraud', 'fraud');
--
-- Dumping data for table `hd_user_autologin`
--

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB