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] 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 @@ </div> </div> </div> + <div class="col-md-6"> + <div class="box box-primary box-solid collapsed-box"> + <div class="box-header with-border"> + <h3 class="box-title">{Lang::T('Additional Information')}</h3> + <div class="box-tools pull-right"> + <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i> + </button> + </div> + </div> + <div class="box-body" style="display: none;"> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('City')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="city" name="city" + value="{$d['city']}"> + <small class="form-text text-muted">{Lang::T('City of Resident')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('District')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="district" name="district" + value="{$d['district']}"> + <small class="form-text text-muted">{Lang::T('District')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('State')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="state" name="state" + value="{$d['state']}"> + <small class="form-text text-muted">{Lang::T('State of Resident')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('Zip')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="zip" name="zip" + value="{$d['zip']}"> + <small class="form-text text-muted">{Lang::T('Zip Code')}</small> + </div> + </div> + </div> + </div> + </div> </div> <center> <button class="btn btn-primary" type="submit"> diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index f0564cb8..ea5da3ff 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -164,6 +164,51 @@ </div> </div> </div> + <div class="col-md-6"> + <div class="box box-primary box-solid collapsed-box"> + <div class="box-header with-border"> + <h3 class="box-title">{Lang::T('Additional Information')}</h3> + <div class="box-tools pull-right"> + <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i> + </button> + </div> + </div> + <div class="box-body" style="display: none;"> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('City')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="city" name="city" + value="{$d['city']}"> + <small class="form-text text-muted">{Lang::T('City of Resident')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('District')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="district" name="district" + value="{$d['district']}"> + <small class="form-text text-muted">{Lang::T('District')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('State')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="state" name="state" + value="{$d['state']}"> + <small class="form-text text-muted">{Lang::T('State of Resident')}</small> + </div> + </div> + <div class="form-group"> + <label class="col-md-3 control-label">{Lang::T('Zip')}</label> + <div class="col-md-9"> + <input type="text" class="form-control" id="zip" name="zip" + value="{$d['zip']}"> + <small class="form-text text-muted">{Lang::T('Zip Code')}</small> + </div> + </div> + </div> + </div> + </div> </div> <center> <button class="btn btn-primary" type="submit"> diff --git a/ui/ui/customers-view.tpl b/ui/ui/customers-view.tpl index 3b96430e..1d5e9ffa 100644 --- a/ui/ui/customers-view.tpl +++ b/ui/ui/customers-view.tpl @@ -22,9 +22,19 @@ <li class="list-group-item"> <b>{Lang::T('Email')}</b> <span class="pull-right">{$d['email']}</span> </li> - </ul> - <p class="text-muted">{Lang::nl2br($d['address'])}</p> - <ul class="list-group list-group-unbordered"> + <li class="list-group-item">{Lang::nl2br($d['address'])}</li> + <li class="list-group-item"> + <b>{Lang::T('City')}</b> <span class="pull-right">{Lang::T($d['city'])}</span> + </li> + <li class="list-group-item"> + <b>{Lang::T('District')}</b> <span class="pull-right">{Lang::T($d['district'])}</span> + </li> + <li class="list-group-item"> + <b>{Lang::T('State')}</b> <span class="pull-right">{Lang::T($d['state'])}</span> + </li> + <li class="list-group-item"> + <b>{Lang::T('Zip')}</b> <span class="pull-right">{Lang::T($d['zip'])}</span> + </li> <li class="list-group-item"> <b>{Lang::T('Password')}</b> <input type="password" value="{$d['password']}" style=" border: 0px; text-align: right;" class="pull-right"