From a4569901a9d0bb5459784393665b25b2371e3af9 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 20 May 2024 09:12:13 +0700 Subject: [PATCH 1/8] Add Filter by status in Customer List --- system/controllers/customers.php | 6 +++++- ui/ui/customers.tpl | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/system/controllers/customers.php b/system/controllers/customers.php index b21ffd12..d3f6cd59 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -610,6 +610,7 @@ switch ($action) { run_hook('list_customers'); #HOOK $search = _post('search'); $order = _post('order', 'username'); + $filter = _post('filter', 'Active'); $orderby = _post('orderby', 'asc'); $order_pos = [ 'username' => 0, @@ -621,9 +622,10 @@ switch ($action) { if ($search != '') { $query = ORM::for_table('tbl_customers') ->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' ". - "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' "); + "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' AND status='$filter'"); } else { $query = ORM::for_table('tbl_customers'); + $query->where("status", $filter); } if($orderby=='asc'){ $query->order_by_asc($order); @@ -633,6 +635,8 @@ switch ($action) { $d = $query->findMany(); $ui->assign('xheader', ''); $ui->assign('d', $d); + $ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status")); + $ui->assign('filter', $filter); $ui->assign('search', $search); $ui->assign('order', $order); $ui->assign('order_pos', $order_pos[$order]); diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index 62c5a2e3..ac45892a 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -48,6 +48,16 @@ +
+
+ Status + +
+
@@ -56,14 +66,14 @@
- +
-
From 49ea49ec4a0fb35de7e7039f0bae7d31c6e58524 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 20 May 2024 09:33:37 +0700 Subject: [PATCH 2/8] Export CSV by Filter data --- system/controllers/customers.php | 51 ++++++++++++++++++++++++++++---- system/lan/english.json | 3 +- ui/ui/customers.tpl | 6 +++- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/system/controllers/customers.php b/system/controllers/customers.php index d3f6cd59..082f29d7 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -186,7 +186,7 @@ switch ($action) { } $usings = explode(',', $config['payment_usings']); $usings = array_filter(array_unique($usings)); - if(count($usings)==0){ + if (count($usings) == 0) { $usings[] = Lang::T('Cash'); } $ui->assign('usings', $usings); @@ -621,18 +621,59 @@ switch ($action) { if ($search != '') { $query = ORM::for_table('tbl_customers') - ->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' ". - "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' AND status='$filter'"); + ->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' " . + "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' AND status='$filter'"); } else { $query = ORM::for_table('tbl_customers'); $query->where("status", $filter); } - if($orderby=='asc'){ + if ($orderby == 'asc') { $query->order_by_asc($order); - }else{ + } else { $query->order_by_desc($order); } $d = $query->findMany(); + if (_post('export', '') == 'csv') { + $h = false; + set_time_limit(-1); + header('Pragma: public'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header("Content-type: text/csv"); + header('Content-Disposition: attachment;filename="phpnuxbill_customers_' . $filter . '_' . date('Y-m-d_H_i') . '.csv"'); + header('Content-Transfer-Encoding: binary'); + + $headers = [ + 'id', + 'username', + 'fullname', + 'address', + 'phonenumber', + 'email', + 'balance', + 'service_type', + ]; + $fp = fopen('php://output', 'wb'); + if (!$h) { + fputcsv($fp, $headers, ";"); + $h = true; + } + foreach ($d as $c) { + $row = [ + $c['id'], + $c['username'], + $c['fullname'], + str_replace("\n", " ", $c['address']), + $c['phonenumber'], + $c['email'], + $c['balance'], + $c['service_type'], + ]; + fputcsv($fp, $row, ";"); + } + fclose($fp); + die(); + } $ui->assign('xheader', ''); $ui->assign('d', $d); $ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status")); diff --git a/system/lan/english.json b/system/lan/english.json index fefadfc5..d11024ab 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -591,5 +591,6 @@ "Descending": "Descending", "Created_Date": "Created Date", "Inactive": "Inactive", - "Suspended": "Suspended" + "Suspended": "Suspended", + "Query": "Query" } \ No newline at end of file diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index ac45892a..8a4591ec 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -66,7 +66,11 @@
- + +
From d2c839a11e5ca002791b5dbb490a9364138f639b Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 20 May 2024 09:52:33 +0700 Subject: [PATCH 3/8] Update Readme --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ff80cf01..1c087fe3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Feature - Voucher Generator and Print -- FreeRadius +- [Freeradius](https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius) - Self registration - User Balance - Auto Renewal Package using Balance @@ -51,14 +51,11 @@ The problem with windows is hard to set cronjob, better Linux ## Changelog [CHANGELOG.md](CHANGELOG.md) + ## Installation [Installation instructions](https://github.com/hotspotbilling/phpnuxbill/wiki) -## Docker Version - -[Docker Repository](https://github.com/animegasan/phpnuxbill) - ## Freeradius Support [Freeradius with Database](https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius) @@ -70,21 +67,24 @@ Support [Freeradius with Database](https://github.com/hotspotbilling/phpnuxbill/ ## Technical Support -Start from Rp 500.000 or $50 +This Software is Free and Open Source, Without any Warranty. -If you chat me for any technical support, you need to pay, except for Donors, ask anything for free in the [discussion](/hotspotbilling/phpnuxbill/discussions) page +Even if the software is free, but Technical Support is not, +Technical Support Start from Rp 500.000 or $50 -[Telegram](https://t.me/ibnux) +If you chat me for any technical support, +you need to pay, -[Website](https://ibnux.net/layanan) +ask anything for free in the [discussion](/hotspotbilling/phpnuxbill/discussions) page or [Telegram Group](https://t.me/phpnuxbill) + +Contact me at [Telegram](https://t.me/ibnux) ## License GNU General Public License version 2 or later -see LICENSE file +see [LICENSE](LICENSE) file -## [CHANGELOG](CHANGELOG.md) ## Donate to ibnux From f29e692e819af3db2b515e5b8e24ab294430d364 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Mon, 20 May 2024 13:09:38 +0100 Subject: [PATCH 4/8] update: Added Additional Information City District State Zip --- install/phpnuxbill.sql | 4 +++ system/controllers/customers.php | 18 +++++++++++++ system/updates.json | 3 +++ ui/ui/customers-add.tpl | 45 ++++++++++++++++++++++++++++++++ ui/ui/customers-edit.tpl | 45 ++++++++++++++++++++++++++++++++ ui/ui/customers-view.tpl | 16 +++++++++--- 6 files changed, 128 insertions(+), 3 deletions(-) diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql index a55baa64..30ecd5ad 100644 --- a/install/phpnuxbill.sql +++ b/install/phpnuxbill.sql @@ -24,6 +24,10 @@ CREATE TABLE `tbl_customers` ( `pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'For PPPOE Login', `fullname` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, + `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + `district` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + `state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + `zip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, `phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', `email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1', `coordinates` VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'Latitude and Longitude coordinates', diff --git a/system/controllers/customers.php b/system/controllers/customers.php index dfff613c..926aadb5 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -391,6 +391,11 @@ switch ($action) { //post Customers Attributes $custom_field_names = (array) $_POST['custom_field_name']; $custom_field_values = (array) $_POST['custom_field_value']; + //additional information + $city = _post('city'); + $district = _post('district'); + $state = _post('state'); + $zip = _post('zip'); run_hook('add_customer'); #HOOK $msg = ''; @@ -422,6 +427,10 @@ switch ($action) { $d->phonenumber = Lang::phoneFormat($phonenumber); $d->service_type = $service_type; $d->coordinates = $coordinates; + $d->city = $city; + $d->district = $district; + $d->state = $state; + $d->zip = $zip; $d->save(); // Retrieve the customer ID of the newly created customer @@ -460,6 +469,11 @@ switch ($action) { $service_type = _post('service_type'); $coordinates = _post('coordinates'); $status = _post('status'); + //additional information + $city = _post('city'); + $district = _post('district'); + $state = _post('state'); + $zip = _post('zip'); run_hook('edit_customer'); #HOOK $msg = ''; if (Validator::Length($username, 35, 2) == false) { @@ -522,6 +536,10 @@ switch ($action) { $d->phonenumber = $phonenumber; $d->service_type = $service_type; $d->coordinates = $coordinates; + $d->city = $city; + $d->district = $district; + $d->state = $state; + $d->zip = $zip; $d->save(); diff --git a/system/updates.json b/system/updates.json index aebb6960..d6ac2088 100644 --- a/system/updates.json +++ b/system/updates.json @@ -96,5 +96,8 @@ ], "2024.5.17" : [ "ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;" + ], + "2024.5.20" : [ + "ALTER TABLE `tbl_customers` ADD `city` VARCHAR(255) NULL AFTER `address`, ADD `district` VARCHAR(255) NULL AFTER `city`, ADD `state` VARCHAR(255) NULL AFTER `district`, ADD `zip` VARCHAR(10) NULL AFTER `state`;" ] } \ No newline at end of file diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index db70e9cd..4985dfb5 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -121,6 +121,51 @@ +
+
+
+

{Lang::T('Additional Information')}

+
+ +
+
+ +
+
+ + + + +
+ + + + + + + + +{include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/maintenance.tpl b/ui/ui/maintenance.tpl new file mode 100644 index 00000000..6095f52b --- /dev/null +++ b/ui/ui/maintenance.tpl @@ -0,0 +1,212 @@ + + + + + Site is down for maintenance + + + + + + + + + + +
+
+
+
+
+
+
+

{Lang::T('Site is temporarily unavailable.')}

+

{Lang::T('Scheduled maintenance is currently in progress. Please check back soon.')}

+

{Lang::T('We apologize for any inconvenience.')}
— {Lang::T('The ')} {$companyName} {Lang::T(' + Team.')}

+
+ {if $date}
+

+

+

+

+
+ {/if} +
+
+ {if $date} + + {/if} + + + \ No newline at end of file diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl index 2e8d0219..12ee84fa 100644 --- a/ui/ui/sections/header.tpl +++ b/ui/ui/sections/header.tpl @@ -88,7 +88,7 @@ } {if isset($xheader)} - {$xheader} + {$xheader} {/if} @@ -158,71 +158,71 @@ {$_MENU_AFTER_DASHBOARD} {if !in_array($_admin['user_type'],['Report'])} -
  • - - {Lang::T('Customer')} - - - - - -
  • - {$_MENU_AFTER_CUSTOMERS} -
  • - - {Lang::T('Services')} - - - - - -
  • +
  • + + {Lang::T('Customer')} + + + + + +
  • + {$_MENU_AFTER_CUSTOMERS} +
  • + + {Lang::T('Services')} + + + + + +
  • {/if} {$_MENU_AFTER_SERVICES} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} -
  • - - {Lang::T('Internet Plan')} - - - - - -
  • +
  • + + {Lang::T('Internet Plan')} + + + + + +
  • {/if} {$_MENU_AFTER_PLANS}
  • @@ -260,64 +260,64 @@
  • {$_MENU_AFTER_MESSAGE} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} -
  • - - {Lang::T('Network')} - - - - - -
  • - {$_MENU_AFTER_NETWORKS} - {if $_c['radius_enable']} -
  • - - {Lang::T('Radius')} - - - - - +
  • + + {Lang::T('Network')} + + + + + +
  • + {$_MENU_AFTER_NETWORKS} + {if $_c['radius_enable']} +
  • + + {Lang::T('Radius')} + + + + + +
  • + {/if} + {$_MENU_AFTER_RADIUS} +
  • + + {Lang::T("Static Pages")} + + + + + +
  • {/if} {$_MENU_AFTER_PAGES}