190 lines
		
	
	
		
			6.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			6.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /*
 | |
|  * This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | |
|  */
 | |
| 
 | |
| var routes = [
 | |
|     {
 | |
|         path: '/home',
 | |
|         name: 'home',
 | |
|         async: function (routeTo, routeFrom, resolve, reject) {
 | |
|             resolve({
 | |
|                 templateUrl: './pages/home.html'
 | |
|             }, {
 | |
|                 context: {
 | |
|                     pages: [
 | |
|                         {
 | |
|                             title: "Schedule Pickup",
 | |
|                             href: "/schedule",
 | |
|                             icon: "fad fa-calendar-alt"
 | |
|                         },
 | |
|                         {
 | |
|                             title: "Track Package",
 | |
|                             href: "/track",
 | |
|                             icon: "fad fa-search"
 | |
|                         },
 | |
|                         {
 | |
|                             title: "Check Rates",
 | |
|                             href: "/rates",
 | |
|                             icon: "fad fa-calculator"
 | |
|                         }
 | |
|                     ]
 | |
|                 }
 | |
|             });
 | |
|         }
 | |
|     },
 | |
|     {
 | |
|         path: '/track',
 | |
|         url: './pages/track.html',
 | |
|         name: 'track',
 | |
|         on: {
 | |
|             pageBeforeIn: function () {
 | |
|                 addTrackingSuggestions();
 | |
|                 $("#trackingcode").val("0");
 | |
|                 app.input.validate("#trackingcode");
 | |
|                 $("#trackingcode").val("");
 | |
|             }
 | |
|         }
 | |
|     },
 | |
|     {
 | |
|         path: '/addresscode',
 | |
|         name: 'addresscode',
 | |
|         async: function (routeTo, routeFrom, resolve, reject) {
 | |
|             resolve({
 | |
|                 templateUrl: './pages/addresscode.html'
 | |
|             }, {
 | |
|                 context: {
 | |
|                     fields: [
 | |
|                         {label: "Name", id: "name"},
 | |
|                         {label: "Company", id: "company"},
 | |
|                         {label: "Street", id: "street1"},
 | |
|                         {label: "Street (line 2)", id: "street2"},
 | |
|                         {label: "City", id: "city"},
 | |
|                         {label: "State", id: "state"},
 | |
|                         {label: "ZIP", id: "zip"}
 | |
|                     ]
 | |
|                 }
 | |
|             });
 | |
|         }
 | |
|     },
 | |
|     {
 | |
|         path: '/track/:code',
 | |
|         name: 'trackresult',
 | |
|         async: trackOpenAsync
 | |
|     },
 | |
|     {
 | |
|         path: '/credits',
 | |
|         url: './pages/credits.html',
 | |
|         name: 'credits'
 | |
|     },
 | |
|     {
 | |
|         path: '/settings',
 | |
|         name: 'settings',
 | |
|         async: function (routeTo, routeFrom, resolve, reject) {
 | |
|             var settings = [];
 | |
|             settings.push(
 | |
|                     {
 | |
|                         setting: "display",
 | |
|                         title: "Display and Appearance",
 | |
|                         text: "",
 | |
|                         onclick: "router.navigate('/settings/display')",
 | |
|                         link: true
 | |
|                     }
 | |
|             );
 | |
| 
 | |
|             settings.push(
 | |
|                     {
 | |
|                         setting: "versions",
 | |
|                         title: "Helena Express app v" + app_version,
 | |
|                         text: "Copyright © 2019-2021 Netsyms Technologies.",
 | |
|                         onclick: ""
 | |
|                     },
 | |
|                     {
 | |
|                         setting: "opensource",
 | |
|                         title: "Credits and open source info",
 | |
|                         text: "",
 | |
|                         onclick: "router.navigate('/credits')",
 | |
|                         link: true
 | |
|                     },
 | |
|                     {
 | |
|                         setting: "privacy",
 | |
|                         title: "Privacy policy and legal",
 | |
|                         text: "",
 | |
|                         onclick: "openBrowser('https://netsyms.com/legal?mtm_campaign=HelenaExpressApp')",
 | |
|                         link: true
 | |
|                     });
 | |
|             resolve({
 | |
|                 templateUrl: './pages/settings.html'
 | |
|             }, {
 | |
|                 context: {
 | |
|                     page_title: "Settings",
 | |
|                     settings: settings
 | |
|                 }
 | |
|             });
 | |
|         },
 | |
|         routes: [
 | |
|             {
 | |
|                 path: '/display',
 | |
|                 name: 'settings',
 | |
|                 async: function (routeTo, routeFrom, resolve, reject) {
 | |
|                     var settings = [
 | |
|                         {
 | |
|                             setting: "apptheme",
 | |
|                             title: "Color theme",
 | |
|                             select: true,
 | |
|                             options: [
 | |
|                                 {
 | |
|                                     value: "auto",
 | |
|                                     label: "Auto",
 | |
|                                     selected: getStorage("apptheme") == null || getStorage("apptheme") == "auto"
 | |
|                                 },
 | |
|                                 {
 | |
|                                     value: "dark",
 | |
|                                     label: "Dark",
 | |
|                                     selected: getStorage("apptheme") == "dark"
 | |
|                                 },
 | |
|                                 {
 | |
|                                     value: "light",
 | |
|                                     label: "Light",
 | |
|                                     selected: getStorage("apptheme") == "light"
 | |
|                                 }
 | |
|                             ]
 | |
|                         },
 | |
|                         {
 | |
|                             setting: "animation",
 | |
|                             title: "Animations",
 | |
|                             select: true,
 | |
|                             options: [
 | |
|                                 {
 | |
|                                     value: "auto",
 | |
|                                     label: "On",
 | |
|                                     selected: getStorage("animation") == null || getStorage("animation") == "auto" || getStorage("animation") == "on"
 | |
|                                 },
 | |
| //                                {
 | |
| //                                    value: "on",
 | |
| //                                    label: "On",
 | |
| //                                    selected: getStorage("animation") == "on"
 | |
| //                                },
 | |
|                                 {
 | |
|                                     value: "off",
 | |
|                                     label: "Off",
 | |
|                                     selected: getStorage("animation") == "off"
 | |
|                                 }
 | |
|                             ]
 | |
|                         }
 | |
|                     ];
 | |
|                     resolve({
 | |
|                         templateUrl: './pages/settings.html'
 | |
|                     }, {
 | |
|                         context: {
 | |
|                             page_title: "Display Settings",
 | |
|                             settings: settings
 | |
|                         }
 | |
|                     });
 | |
|                 }
 | |
|             }
 | |
|         ]
 | |
|     }
 | |
| ];
 |