From 177cdef1cdf29ec5740d2d5e048df5d7c7504737 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Fri, 22 Mar 2024 21:21:23 +0700 Subject: [PATCH] Add Location Picker --- CHANGELOG.md | 1 + system/controllers/customers.php | 7 +- system/lan/english.json | 3 +- ui/ui/customers-add.tpl | 105 +++++++++++++++-------- ui/ui/customers-edit.tpl | 137 ++++++++++++++++++++----------- ui/ui/customers-view.tpl | 2 +- ui/ui/map-customer.tpl | 90 +++++++++++--------- version.json | 2 +- 8 files changed, 221 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a67f63c9..f89ef8ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## 2024.3.22 - Fix Broadcast Message by @Focuslinkstech +- Add Location Picker ## 2024.3.20 diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 7baecae0..4a62781d 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -16,6 +16,10 @@ $action = 'list'; } +$leafletpickerHeader = << +EOT; + switch ($action) { case 'list': $search = _post('search'); @@ -89,6 +93,7 @@ if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent', 'Sales'])) { _alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard"); } + $ui->assign('xheader', $leafletpickerHeader); run_hook('view_add_customer'); #HOOK $ui->display('customers-add.tpl'); break; @@ -210,7 +215,6 @@ $customFields = ORM::for_table('tbl_customers_fields') ->where('customer_id', $customer['id']) ->find_many(); - $v = $routes['3']; if (empty ($v)) { $v = 'activation'; @@ -260,6 +264,7 @@ if ($d) { $ui->assign('d', $d); $ui->assign('customFields', $customFields); + $ui->assign('xheader', $leafletpickerHeader); $ui->display('customers-edit.tpl'); } else { r2(U . 'customers/list', 'e', $_L['Account_Not_Found']); diff --git a/system/lan/english.json b/system/lan/english.json index 07f97d1c..68a7fd86 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -534,5 +534,6 @@ "20_Seconds": "20 Seconds", "Use_at_least_5_secs_if_you_are_sending_to_all_customers_to_avoid_being_banned_by_your_message_provider": "Use at least 5 secs if you are sending to all customers to avoid being banned by your message provider", "Testing__if_checked_no_real_message_is_sent_": "Testing [if checked no real message is sent]", - "All_fields_are_required": "All fields are required" + "All_fields_are_required": "All fields are required", + "Personal": "Personal" } \ No newline at end of file diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index 7f9f03c8..806cbda4 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -11,10 +11,10 @@
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if} @@ -38,10 +38,10 @@
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if} @@ -73,17 +73,6 @@
-
- -
- - - {Lang::T('Latitude and Longitude coordinates for map must be separate with comma - ","')} - -
-
@@ -102,7 +91,15 @@ - + +
+
+
+ +
+ +
@@ -132,16 +129,16 @@ {literal} - + + + {/literal} diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index 9269e033..9e3e5d23 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -12,10 +12,10 @@
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if}
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if} @@ -77,16 +77,6 @@
-
- -
- - - {Lang::T('Latitude and Longitude coordinates for map must be separate with comma - ","')} - -
-
@@ -98,15 +88,23 @@
-
+ + +
+
+
+ +
+ +
@@ -118,20 +116,20 @@
{if $customFields} - {foreach $customFields as $customField} -
- -
- -
- -
- {/foreach} + {foreach $customFields as $customField} +
+ +
+ +
+ +
+ {/foreach} {/if} @@ -155,16 +153,16 @@ {literal} - - customFieldsContainer.addEventListener('click', function (event) { - if (event.target.classList.contains('remove-custom-field')) { - var fieldContainer = event.target.parentNode.parentNode; - fieldContainer.parentNode.removeChild(fieldContainer); + + + } + window.onload = function() { + {/literal}{if $d['coordinates']} + setupMap({$d['coordinates']}); + {else} + getLocation(); + {/if}{literal} + } + {/literal} {include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/customers-view.tpl b/ui/ui/customers-view.tpl index 2f969a73..3cd5d421 100644 --- a/ui/ui/customers-view.tpl +++ b/ui/ui/customers-view.tpl @@ -38,7 +38,7 @@ {/if}
  • - {Lang::T('Coordinates')} {Lang::T($d['coordinates'])} + {Lang::T('Coordinates')} {$d['coordinates']}
  • {if $customFields} diff --git a/ui/ui/map-customer.tpl b/ui/ui/map-customer.tpl index b19aebd5..7ecff00c 100644 --- a/ui/ui/map-customer.tpl +++ b/ui/ui/map-customer.tpl @@ -4,42 +4,58 @@
    {literal} - + {/literal} {include file="sections/footer.tpl"} \ No newline at end of file diff --git a/version.json b/version.json index 664e6988..d3f813d5 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.3.22" + "version": "2024.3.22.1" } \ No newline at end of file