]> Softwares of Agnibho - pdosage.git/blob - src/main.js
Typo correction
[pdosage.git] / src / main.js
1 /**********************************************************************
2 * Title: PDosage
3 * Description: Pediatric Dose Calculator
4 * Author: Agnibho Mondal
5 * Website: http://code.agnibho.com
6 **********************************************************************
7 Copyright (c) 2016 Agnibho Mondal
8 All rights reserved
9 **********************************************************************
10 This file is part of PDosage.
11
12 PDosage is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 PDosage is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with PDosage. If not, see <http://www.gnu.org/licenses/>.
24 **********************************************************************/
25
26 //Icon
27 import "./assets/logo.png"
28
29 //CSS
30 import "bootstrap/dist/css/bootstrap.css";
31 import "./custom.css";
32
33 //JS libs
34 import "jquery";
35 import "bootstrap";
36 import "bootstrap-validator";
37
38 //Backend files
39 import Dosage from "./Dosage.js";
40 import data from "./data.json";
41
42 //Vue Components
43 import Vue from "vue";
44 import DataInput from "./DataInput.vue";
45 import QuickView from "./QuickView.vue";
46 import ListView from "./ListView.vue";
47 import CalculatorView from "./CalculatorView.vue";
48 import AboutView from "./AboutView.vue";
49
50 //Start app
51 new Vue({
52 el: "#app",
53 components: {
54 "data-input": DataInput,
55 "quick-view": QuickView,
56 "list-view": ListView,
57 "calculator-view": CalculatorView,
58 "about-view": AboutView
59 },
60 data: {
61 patient: {age: {y:30, m:null, d:null}, wt:50},
62 dosage: "",
63 favs: "[]"
64 },
65 created:function(){
66 try{
67 this.favs=JSON.parse(localStorage.getItem("pdosage_favs"));
68 }
69 finally{
70 if(this.favs==null){
71 this.favs=["Paracetamol", "Levosalbutamol", "Domperidone", "Drotaverine", "Ranitidine"];
72 }
73 }
74 try{
75 var loc=JSON.parse(localStorage.getItem(STORAGE));
76 if(loc.version>data.version){
77 this.dosage=new Dosage(loc.dosage);
78 }
79 else{
80 this.dosage=new Dosage(data.dosage);
81 localStorage.setItem(STORAGE, JSON.stringify(data));
82 }
83 }
84 catch(e){
85 if(!this.dosage){
86 this.dosage=new Dosage(data.dosage);
87 localStorage.setItem(STORAGE, JSON.stringify(data));
88 }
89 }
90 }
91 });
92
93 //Routine jobs
94 import "./routine.js";
95
96 //Source Map
97 //#sourceMappingURL=dist/bundle.js.map