1+ < div id ='sepiaFW-frame-carousel ' class ="sepiaFW-inner-container sepiaFW-carousel ">
2+ < div class ='sepiaFW-carousel-pane-container '>
3+ <!-- Page 1 -->
4+ < div id ="sepiaFW-frame-page-1 " class ='sepiaFW-frames-page sepiaFW-carousel-pane '>
5+ < h3 > Device Local Site</ h3 >
6+ < p > Here you can configure the local site (location) data for this device. Note that this data will be stored independently from user logins.</ p >
7+ < div id ="sepiaFW-device-site-settings " class ="group-container ">
8+ < div class ="group ">
9+ < label > Location:</ label >
10+ < div id ="sepiaFW-device-site-location-box " data-device-site ="location "> </ div >
11+ </ div >
12+ < div class ="group ">
13+ < label > Type:</ label >
14+ < div id ="sepiaFW-device-site-type-box " data-device-site ="type "> </ div >
15+ </ div >
16+ < div class ="group ">
17+ < label > Name:</ label >
18+ < div id ="sepiaFW-device-site-name-box " data-device-site ="name "> </ div >
19+ </ div >
20+ < div class ="group ">
21+ < label > Index:</ label >
22+ < div id ="sepiaFW-device-site-index-box " data-device-site ="index "> </ div >
23+ </ div >
24+ < div class ="group ">
25+ < label > Updates:</ label >
26+ < div id ="sepiaFW-device-site-updates-box " data-device-site ="updates "> </ div >
27+ </ div >
28+ < div class ="group " style ="justify-content: center; ">
29+ < button id ="SepiaFW-device-site-store " onclick ="SepiaFW.frames.currentScope.store() "> Store settings</ button >
30+ </ div >
31+ </ div >
32+ </ div >
33+ </ div >
34+ </ div >
35+ < div id ="sepiaFW-frames-nav-bar " class ='sepiaFW-layer-header '>
36+ < button id ="sepiaFW-frames-close " class ='entry '>
37+ < i class ="material-icons md-btn2 "> </ i >
38+ </ button >
39+ <!--<button id="sepiaFW-frames-show-prev-page" class='entry'>
40+ <i class="material-icons md-btn2">keyboard_arrow_left</i><span data-localize="back">back</span>
41+ </button>
42+ <button id="sepiaFW-frames-show-next-page" class='entry'>
43+ <span data-localize="next">next</span><i class="material-icons md-btn2">keyboard_arrow_right</i>
44+ </button>-->
45+ < div id ="sepiaFW-frames-nav-bar-page-indicator "> < div > </ div > </ div >
46+ </ div >
47+ < script >
48+ $ ( '#sepiaFW-frame-carousel' ) . find ( '[data-localize]' ) . each ( function ( ) {
49+ $ ( this ) . html ( SepiaFW . local . g ( this . dataset . localize ) ) ;
50+ } ) ;
51+
52+ //Data
53+ SepiaFW . config . deviceLocalSiteOptions = {
54+ location : [
55+ { "value" : "" , "name" : "Not assigned" } ,
56+ { "value" : "home" , "name" : "Home" }
57+ //,{ "value": "mobile", "name": "Mobile" }
58+ ] ,
59+ type : [
60+ { "value" : "" , "name" : "Not assigned" } ,
61+ { "value" : "room" , "name" : "Room" }
62+ ] ,
63+ name : [
64+ { "value" : "unassigned" , "name" : "Not assigned" } ,
65+ { "value" : "livingroom" , "name" : "Living room" } ,
66+ { "value" : "diningroom" , "name" : "Dining room" } ,
67+ { "value" : "kitchen" , "name" : "Kitchen" } ,
68+ { "value" : "bedroom" , "name" : "Bedroom" } ,
69+ { "value" : "bath" , "name" : "Bath" } ,
70+ { "value" : "study" , "name" : "Study room" } ,
71+ { "value" : "office" , "name" : "Office" } ,
72+ { "value" : "childsroom" , "name" : "Child's room" } ,
73+ { "value" : "garage" , "name" : "Garage" } ,
74+ { "value" : "basement" , "name" : "Basement" } ,
75+ { "value" : "garden" , "name" : "Garden" } ,
76+ { "value" : "shack" , "name" : "Shack" } ,
77+ { "value" : "hallway" , "name" : "Hallway" } ,
78+ { "value" : "other" , "name" : "Other" }
79+ ] ,
80+ updates : [
81+ { "value" : "off" , "name" : "Off" }
82+ //, { "value": "auto", "name": "Automatic" }
83+ ]
84+ //, index: undefined, //free input, e.g. numbers: 1, 2, 212, ...
85+ } ;
86+ //TODO: we should load this data from server
87+
88+ //Define scope
89+ SepiaFW . frames . currentScope = {
90+
91+ onFinishSetup : function ( ) {
92+ $ ( '#sepiaFW-device-site-settings' ) . find ( '[data-device-site]' ) . each ( function ( ) {
93+ var tag = this . dataset . deviceSite ;
94+ var options = SepiaFW . config . deviceLocalSiteOptions [ tag ] ;
95+ var eleId = "sepiaFW-device-site-settings-" + tag ;
96+ if ( options ) {
97+ this . appendChild ( SepiaFW . ui . build . optionSelector ( eleId , options , options [ 0 ] , function ( ele ) { } ) ) ; //console.log(ele.value);
98+ } else {
99+ this . innerHTML = "<input id='" + eleId + "' style='max-width: 100px;' placeholder='" + tag + "'>" ;
100+ }
101+ } ) ;
102+ } ,
103+
104+ onOpen : function ( ) {
105+ var siteData = SepiaFW . config . getDeviceLocalSiteData ( ) ;
106+ $ ( '#sepiaFW-device-site-settings-location' ) . val ( siteData . location ) ;
107+ $ ( '#sepiaFW-device-site-settings-type' ) . val ( siteData . type ) ;
108+ $ ( '#sepiaFW-device-site-settings-name' ) . val ( siteData . name ) ;
109+ $ ( '#sepiaFW-device-site-settings-index' ) . val ( siteData . index ) ;
110+ $ ( '#sepiaFW-device-site-settings-updates' ) . val ( siteData . updates ) ;
111+ } ,
112+
113+ store : function ( ) {
114+ var siteData = {
115+ location : $ ( '#sepiaFW-device-site-settings-location' ) . val ( ) ,
116+ type : $ ( '#sepiaFW-device-site-settings-type' ) . val ( ) ,
117+ name : $ ( '#sepiaFW-device-site-settings-name' ) . val ( ) ,
118+ index : $ ( '#sepiaFW-device-site-settings-index' ) . val ( ) || "" ,
119+ updates : $ ( '#sepiaFW-device-site-settings-updates' ) . val ( )
120+ } ;
121+ //console.log(siteData);
122+ SepiaFW . config . setDeviceLocalSiteData ( siteData ) ;
123+ SepiaFW . ui . showPopup ( SepiaFW . local . g ( "done" ) ) ;
124+ }
125+ }
126+ </ script >
0 commit comments