diff --git a/docs/mockup_measurer.html b/docs/mockup_measurer.html index ab9a7b1..7712af5 100644 --- a/docs/mockup_measurer.html +++ b/docs/mockup_measurer.html @@ -277,6 +277,51 @@ function render(id) { } } +// ── GPS: прибытие на объект замера ──────────────────────────────────────────── +var _MSR_GPS_RADIUS = 300; // метров +var _MSR_JOBS = { + 'З-1042': {addr:'ул. Рубинштейна, 7, кв. 18', lat:59.9295, lng:30.3426} +}; +window._MSR_GPS = {}; +window._MSR_GPS_DEMO = 'near'; + +function _msrGpsDist(la1,lo1,la2,lo2){ + var R=6371000,dL=(la2-la1)*Math.PI/180,dG=(lo2-lo1)*Math.PI/180; + var a=Math.sin(dL/2)*Math.sin(dL/2)+Math.cos(la1*Math.PI/180)*Math.cos(la2*Math.PI/180)*Math.sin(dG/2)*Math.sin(dG/2); + return Math.round(R*2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))); +} +function _msrFmt(m){ return m<1000?(m+' м'):(m/1000).toFixed(1)+' км'; } +function _msrGpsResult(jobId,dist){ + var ok=dist<=_MSR_GPS_RADIUS; + window._MSR_GPS[jobId]={ok:ok,dist:dist}; + document.getElementById('screen').innerHTML=render('order_detail'); +} +function _msrGpsRequest(jobId){ + window._MSR_GPS[jobId]='loading'; + document.getElementById('screen').innerHTML=render('order_detail'); + var job=_MSR_JOBS[jobId]; + function onGot(lat,lng){ _msrGpsResult(jobId,_msrGpsDist(lat,lng,job.lat,job.lng)); } + function onFail(){ _msrGpsResult(jobId, window._MSR_GPS_DEMO==='near'?54:1510); } + var tg=window.Telegram&&Telegram.WebApp; + if(tg&&tg.LocationManager&&tg.LocationManager.isInited){ + tg.LocationManager.getLocation(function(r){ r&&r.latitude?onGot(r.latitude,r.longitude):onFail(); }); + } else if(navigator.geolocation){ + navigator.geolocation.getCurrentPosition( + function(p){ onGot(p.coords.latitude,p.coords.longitude); }, + onFail,{timeout:8000,maximumAge:15000} + ); + } else { onFail(); } +} +function _msrGpsForce(jobId){ + var prev=window._MSR_GPS[jobId]; + window._MSR_GPS[jobId]={ok:false,dist:prev&&prev.dist||0,forced:true}; + document.getElementById('screen').innerHTML=render('order_detail'); +} +function _msrGpsCancelCheck(jobId){ + window._MSR_GPS[jobId]=null; + document.getElementById('screen').innerHTML=render('order_detail'); +} + /* ─── HOME ─── */ function screenHome() { return `
@@ -415,13 +460,39 @@ function screenOrderDetail() {
${stepBar('order_detail')} -
- -
-
В процессе · начато в 10:35
-
Прошло 47 минут
-
-
+ ${(function(){ + var jobId='З-1042'; + var gst=window._MSR_GPS[jobId]; + if(!gst){ + return '
' + +'
📍 Подтвердите прибытие на объект
' + +'
ул. Рубинштейна, 7, кв. 18 · Смирнова Ольга
' + +'' + +'
Демо: ' + +'Рядом · ' + +'Далеко
' + +'
'; + } else if(gst==='loading'){ + return '
' + +'Определяем местоположение…
'; + } else if(gst&&!gst.ok&&!gst.forced){ + return '
' + +'
⚠️ Вы в '+_msrFmt(gst.dist)+' от объекта
' + +'
ул. Рубинштейна, 7 · Допустимый радиус: 300 м
' + +'
' + +'' + +'' + +'
'; + } else { + var chip=gst.forced + ?'⚡ вручную' + :'GPS ✓'; + return '
' + +'' + +'
В процессе · начато в 10:35'+chip+'
' + +'
Прошло 47 минут
'; + } + })()}
@@ -442,6 +513,21 @@ function screenOrderDetail() {
СостояниеПосле ремонта
+ +
+
Документы
+
+ + +
Бриф клиента
PDF · 0.8 МБ
+
+ + +
Планировка
PDF · 3 листа
+
+
+
+
Примечание менеджера
Клиент хочет угловую кухню 2,8×3,8 м. Уточнить расположение розеток и вентиляции. Есть ниша под холодильник — обязательно замерить.