Files
CRM/layouts/v7/modules/Accounts/DetailViewHeaderTitle.tpl
BACHIR SOULDI 2794e62571 first commit
2025-09-28 08:49:37 +01:00

134 lines
5.7 KiB
Smarty

{*<!--
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
-->*}
{strip}
<div class="col-sm-6">
<div class="clearfix record-header ">
<div class="hidden-sm hidden-xs recordImage bgAccounts app-{$SELECTED_MENU_CATEGORY}">
{assign var=IMAGE_DETAILS value=$RECORD->getImageDetails()}
{foreach key=ITER item=IMAGE_INFO from=$IMAGE_DETAILS}
{if !empty($IMAGE_INFO.path)}
<img src="{$IMAGE_INFO.path}_{$IMAGE_INFO.orgname}" alt="{$IMAGE_INFO.orgname}" title="{$IMAGE_INFO.orgname}" width="100%" height="100%" align="left"><br>
{else}
<img src="{vimage_path('summary_organizations.png')}" class="summaryImg"/>
{/if}
{/foreach}
{if empty($IMAGE_DETAILS)}
<div class="name"><span><strong>{$MODULE_MODEL->getModuleIcon()}</strong></span></div>
{/if}
</div>
<div class="recordBasicInfo">
<div class="info-row" >
<h4>
<span class="recordLabel pushDown" title="{$RECORD->getName()}">
{foreach item=NAME_FIELD from=$MODULE_MODEL->getNameFields()}
{assign var=FIELD_MODEL value=$MODULE_MODEL->getField($NAME_FIELD)}
{if $FIELD_MODEL->getPermissions()}
<span class="{$NAME_FIELD}">{trim($RECORD->get($NAME_FIELD))}</span>&nbsp;
{/if}
{/foreach}
</span>
</h4>
</div>
{include file="DetailViewHeaderFieldsView.tpl"|vtemplate_path:$MODULE}
<div class="info-row">
<i class="fa fa-map-marker"></i>&nbsp;
<a class="showMap" href="javascript:void(0);" onclick='Vtiger_Index_Js.showMap(this);' data-module='{$RECORD->getModule()->getName()}' data-record='{$RECORD->getId()}'>{vtranslate('LBL_SHOW_MAP', $MODULE_NAME)}</a>
</div>
</div>
</div>
<!-- sophal -->
<button type="button" class="btn btn-danger"" data-toggle="modal" data-target="#myModal" onclick ="getLocation()">
<div class="fa fa-crosshairs" aria-hidden="true"></div>&nbsp;&nbsp;Géolocalisation
</button>
&nbsp;
<button type="button" class="btn btn-danger"" data-toggle="modal" data-target="#myModal" onclick ="showPHPLocation({$RECORD->get('cf_986')},{$RECORD->get('cf_988')})">
<div class="fa fa-crosshairs" aria-hidden="true"></div>&nbsp;&nbsp; Voir sur la carte
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Coordonnées GPS</h4>
</div>
<div class="modal-body">
<form action="Geolocalisation.php" method="POST" accept-charset="utf-8">
<input type="hidden" name="idUser" value="{$RECORD->getId()}">
<input type="hidden" name="Latitude" id="IDLatitude" >
<input type="hidden" name="Longitude" id="IDLongitude" >
<!-- map container -->
<div id="map"></div>
</div>
<div class="modal-footer">
<button type="submit" name="Enregistrer" id='EnregistrerBtn' class="btn addButton btn-success" >Enregistrer</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div></form>
<!-- sophal -->
</div>
{/strip}
<script>
function showPHPLocation(lat, long) {
document.getElementById("EnregistrerBtn").style.visibility = "hidden";
MapCompte(lat, long);
}
function showLocation(position) {
document.getElementById("EnregistrerBtn").style.visibility = "";
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
MapCompte(latitude , longitude);
document.getElementById("IDLatitude").value = latitude;
document.getElementById("IDLongitude").value = longitude;
}
function errorHandler(err) {
if(err.code == 1) {
alert("Erreur: Accès refusé");
} else if( err.code == 2) {
alert("Erreur: Votre position n'est pas disponible");
}
}
function getLocation() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
navigator.geolocation.getCurrentPosition(showLocation, errorHandler, { enableHighAccuracy: true, maximumAge: 1000, timeout: 6000 });
},function(){}, { maximumAge: 0, timeout: 6000 });
} else {
alert("Votre navigateur ne supporte pas la géolocalisation!");
}
}
</script>
<style>
#map {
width: 100%;
height: 400px;
text-align: center;
}
</style>
<script src="jscss/leaflet.js"></script>
<link rel="stylesheet" href="jscss/leaflet.css"/>