File tree Expand file tree Collapse file tree 6 files changed +31
-1
lines changed
static/src/js/widgets/gis_edit_map Expand file tree Collapse file tree 6 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 14
14
"g2p_programs" ,
15
15
# "spp_helpdesk",
16
16
"product" ,
17
+ "stock" ,
17
18
],
18
19
"data" : [
19
20
"data/users_data.xml" ,
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ class MainController(http.Controller):
6
6
@http .route ("/get_maptiler_api_key" , type = "json" , auth = "user" )
7
7
def get_maptiler_api_key (self ):
8
8
map_tiler_api_key = request .env ["ir.config_parameter" ].sudo ().get_param ("spp_base_gis.map_tiler_api_key" )
9
- return {"mapTilerKey" : map_tiler_api_key }
9
+ web_base_url = request .env ["ir.config_parameter" ].sudo ().get_param ("web.base.url" )
10
+ return {"mapTilerKey" : map_tiler_api_key , "webBaseUrl" : web_base_url }
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export class FieldGisEditMap extends Component {
63
63
const response = await this . rpc ( "/get_maptiler_api_key" ) ;
64
64
if ( response . mapTilerKey ) {
65
65
this . mapTilerKey = response . mapTilerKey ;
66
+ this . webBaseUrl = response . webBaseUrl ;
66
67
} else {
67
68
console . log ( "Error: Api Key not found." ) ;
68
69
}
@@ -202,6 +203,22 @@ export class FieldGisEditMap extends Component {
202
203
203
204
this . map . on ( "draw.create" , updateArea ) ;
204
205
this . map . on ( "draw.update" , updateArea ) ;
206
+
207
+ const model = this . props . record . _config . resModel ;
208
+ const url = `${ this . webBaseUrl } /web/image?model=${ model } &id=${ this . props . record . _config . resId } &field=geo_img_file` ;
209
+
210
+ this . map . on ( "click" , `${ this . sourceId } -polygon-layerid` , ( e ) => {
211
+ new maptilersdk . Popup ( )
212
+ . setLngLat ( e . lngLat )
213
+ . setHTML ( `<img src="${ url } " height="200" width="300" alt="Placeholder Image">` )
214
+ . addTo ( this . map ) ;
215
+ } ) ;
216
+ this . map . on ( "click" , `${ this . sourceId } -point-layerid` , ( e ) => {
217
+ new maptilersdk . Popup ( )
218
+ . setLngLat ( e . lngLat )
219
+ . setHTML ( `<img src="${ url } " height="200" width="300" alt="Placeholder Image">` )
220
+ . addTo ( this . map ) ;
221
+ } ) ;
205
222
}
206
223
207
224
addDrawInteractionStyle ( ) {
Original file line number Diff line number Diff line change 11
11
width : 100% ;
12
12
height : 100% ;
13
13
}
14
+
15
+ /* Increasing specificity */
16
+ .maplibregl-popup .maplibregl-popup-content {
17
+ width : 320px !important ; /* Custom width */
18
+ height : 220px !important ; /* Custom height */
19
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ class Farmer(models.Model):
14
14
("married_polygamous" , "Married Polygamous" ),
15
15
]
16
16
)
17
+ geo_img_file = fields .Binary (string = "Geometry Image File" )
18
+ geo_img_file_filename = fields .Char (string = "File Name" )
17
19
18
20
19
21
class TempFarmer (models .Model ):
Original file line number Diff line number Diff line change 65
65
<field name =" land_geo_polygon" />
66
66
</page >
67
67
</xpath >
68
+ <xpath expr =" //field[@name='disabled_reason']" position =" after" >
69
+ <field name =" geo_img_file" filename =" geo_img_file_filename" />
70
+ </xpath >
68
71
</field >
69
72
</record >
70
73
You can’t perform that action at this time.
0 commit comments