-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
221 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
## 2024.3.22 | ||
|
||
- Fix Broadcast Message by @Focuslinkstech | ||
- Add Location Picker | ||
|
||
## 2024.3.20 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ | |
$action = 'list'; | ||
} | ||
|
||
$leafletpickerHeader = <<<EOT | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"> | ||
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']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ | |
<div class="col-md-9"> | ||
<div class="input-group"> | ||
{if $_c['country_code_phone']!= ''} | ||
<span class="input-group-addon" id="basic-addon1">+</span> | ||
<span class="input-group-addon" id="basic-addon1">+</span> | ||
{else} | ||
<span class="input-group-addon" id="basic-addon1"><i | ||
class="glyphicon glyphicon-phone-alt"></i></span> | ||
<span class="input-group-addon" id="basic-addon1"><i | ||
class="glyphicon glyphicon-phone-alt"></i></span> | ||
{/if} | ||
<input type="text" class="form-control" name="username" required | ||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}"> | ||
|
@@ -38,10 +38,10 @@ | |
<div class="col-md-9"> | ||
<div class="input-group"> | ||
{if $_c['country_code_phone']!= ''} | ||
<span class="input-group-addon" id="basic-addon1">+</span> | ||
<span class="input-group-addon" id="basic-addon1">+</span> | ||
{else} | ||
<span class="input-group-addon" id="basic-addon1"><i | ||
class="glyphicon glyphicon-phone-alt"></i></span> | ||
<span class="input-group-addon" id="basic-addon1"><i | ||
class="glyphicon glyphicon-phone-alt"></i></span> | ||
{/if} | ||
<input type="text" class="form-control" name="phonenumber" | ||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}"> | ||
|
@@ -73,17 +73,6 @@ | |
<textarea name="address" id="address" class="form-control"></textarea> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label> | ||
<div class="col-md-9"> | ||
<input name="coordinates" id="coordinates" class="form-control" value="" | ||
placeholder="6.465422, 3.406448"> | ||
<span class="help-block"> | ||
<small>{Lang::T('Latitude and Longitude coordinates for map must be separate with comma | ||
","')}</small> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label> | ||
<div class="col-md-9"> | ||
|
@@ -102,7 +91,15 @@ | |
<option value="Personal">Personal | ||
</option> | ||
<option value="Business">Business</option> | ||
</select> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label> | ||
<div class="col-md-9"> | ||
<input name="coordinates" id="coordinates" class="form-control" value="" | ||
placeholder="6.465422, 3.406448"> | ||
<div id="map" style="width: '100%'; height: 200px; min-height: 150px;"></div> | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -132,16 +129,16 @@ | |
</center> | ||
</form> | ||
{literal} | ||
<script type="text/javascript"> | ||
document.addEventListener("DOMContentLoaded", function () { | ||
var customFieldsContainer = document.getElementById('custom-fields-container'); | ||
var addCustomFieldButton = document.getElementById('add-custom-field'); | ||
<script type="text/javascript"> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
var customFieldsContainer = document.getElementById('custom-fields-container'); | ||
var addCustomFieldButton = document.getElementById('add-custom-field'); | ||
addCustomFieldButton.addEventListener('click', function () { | ||
var fieldIndex = customFieldsContainer.children.length; | ||
var newField = document.createElement('div'); | ||
newField.className = 'form-group'; | ||
newField.innerHTML = ` | ||
addCustomFieldButton.addEventListener('click', function() { | ||
var fieldIndex = customFieldsContainer.children.length; | ||
var newField = document.createElement('div'); | ||
newField.className = 'form-group'; | ||
newField.innerHTML = ` | ||
<div class="col-md-4"> | ||
<input type="text" class="form-control" name="custom_field_name[]" placeholder="Name"> | ||
</div> | ||
|
@@ -152,17 +149,53 @@ | |
<button type="button" class="remove-custom-field btn btn-danger btn-sm">-</button> | ||
</div> | ||
`; | ||
customFieldsContainer.appendChild(newField); | ||
}); | ||
customFieldsContainer.appendChild(newField); | ||
}); | ||
|
||
customFieldsContainer.addEventListener('click', function (event) { | ||
if (event.target.classList.contains('remove-custom-field')) { | ||
var fieldContainer = event.target.parentNode.parentNode; | ||
fieldContainer.parentNode.removeChild(fieldContainer); | ||
} | ||
customFieldsContainer.addEventListener('click', function(event) { | ||
if (event.target.classList.contains('remove-custom-field')) { | ||
var fieldContainer = event.target.parentNode.parentNode; | ||
fieldContainer.parentNode.removeChild(fieldContainer); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</script> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | ||
<script> | ||
function getLocation() { | ||
if (navigator.geolocation) { | ||
navigator.geolocation.getCurrentPosition(showPosition); | ||
} else { | ||
setupMap(51.505, -0.09); | ||
} | ||
} | ||
|
||
function showPosition(position) { | ||
setupMap(position.coords.latitude, position.coords.longitude); | ||
} | ||
|
||
function setupMap(lat, lon) { | ||
var map = L.map('map').setView([lat, lon], 13); | ||
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', { | ||
attribution: | ||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>', | ||
subdomains: 'abcd', | ||
maxZoom: 20 | ||
}).addTo(map); | ||
var marker = L.marker([lat, lon]).addTo(map); | ||
map.on('click', function(e){ | ||
var coord = e.latlng; | ||
var lat = coord.lat; | ||
var lng = coord.lng; | ||
var newLatLng = new L.LatLng(lat, lng); | ||
marker.setLatLng(newLatLng); | ||
$('#coordinates').val(lat + ',' + lng); | ||
}); | ||
} | ||
window.onload = function() { | ||
getLocation(); | ||
} | ||
</script> | ||
{/literal} | ||
|
||
|
||
|
Oops, something went wrong.