2 ***********************************************************************
4 * Description: An Obstetric Calculator
5 * Author: Agnibho Mondal
6 * Website: http://code.agnibho.com
7 **********************************************************************
8 Copyright (c) 2016 Agnibho Mondal
10 **********************************************************************
11 This file is part of ObsCalc.
13 ObsCalc is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
18 ObsCalc is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with Obscalc. If not, see <http://www.gnu.org/licenses/>.
25 ***********************************************************************
30 <title>ObsCalc
</title>
31 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
32 <link href=
"bootstrap.min.css" rel=
"stylesheet">
33 <link href=
"datepicker/jquery-ui.min.css" rel=
"stylesheet">
34 <link href=
"custom.css" rel=
"stylesheet">
35 <script src=
"jquery.min.js"></script>
36 <script src=
"bootstrap.min.js"></script>
37 <script src=
"angular.js"></script>
38 <script src=
"moment.js"></script>
39 <script src=
"datepicker/jquery-ui.min.js"></script>
42 <div class=
"container">
43 <div class=
"text-primary">
44 <div class=
"jumbotron">
46 <h2>Obstetric Calculator
</h2>
49 <div class=
"row" data-ng-app=
"oc" data-ng-controller=
"oc">
50 <div class=
"col-sm-6">
51 <div class=
"panel panel-default">
52 <div class=
"panel-heading">
53 <p><strong>Calculate by Date
</strong></p>
55 <div class=
"panel panel-body">
56 <ul class=
"nav nav-tabs">
57 <li class=
"active"><a href=
"#panel-lmp" aria-controls=
"panel-lmp" data-toggle=
"tab">Enter L.M.P.
</a></li>
58 <li><a href=
"#panel-edd" aria-controls=
"panel-edd" data-toggle=
"tab">Enter E.D.D.
</a></li>
60 <div class=
"tab-content">
61 <div class=
"panel panel-default tab-pane active" id=
"panel-lmp">
62 <div class=
"panel-body">
63 <form name=
"form_lmp">
64 <div class=
"form-group">
65 <label>Enter L.M.P.:
</label>
67 <div class=
"col-sm-8">
68 <div data-ng-class=
"{'has-error':form_lmp.dt.$invalid}"><input class=
"form-control" type=
"date" id=
"lmp-dt" name=
"dt" data-ng-model=
"lmp_dt" placeholder=
"YYYY-MM-DD" autocomplete=
"off" data-ng-change=
"getEdd()"></div>
70 <div class=
"col-sm-4">
71 <input type=
"reset" class=
"btn">
78 <div class=
"panel panel-default tab-pane" id=
"panel-edd">
79 <div class=
"panel-body">
80 <form name=
"form_edd">
81 <div class=
"form-group">
82 <label>Enter E.D.D.:
</label>
84 <div class=
"col-sm-8">
85 <div data-ng-class=
"{'has-error':form_edd.dt.$invalid}"><input class=
"form-control" type=
"date" id=
"edd-dt" name=
"dt" data-ng-model=
"edd_dt" placeholder=
"YYYY-MM-DD" autocomplete=
"off" data-ng-change=
"getLmp()"></div>
87 <div class=
"col-sm-4">
88 <input type=
"reset" class=
"btn">
96 <table class=
"table table-bordered" data-ng-hide=
"lmp_dt==null">
97 <tr class=
"active"><th>L.M.P.
</th><th>E.D.D.
</th></tr>
98 <tr><th>{{showDate(lmp_dt)}}
</th><th>{{showDate(edd_dt)}}
</th></tr>
101 <table class=
"table" data-ng-show=
"calcDate()">
102 <tr><th class=
"active">Maturation by Date at present
</th><th>{{calcDate()}}
</th></tr>
107 <div class=
"col-sm-6">
108 <div class=
"panel panel-default tab-pane" id=
"panel-usg">
109 <div class=
"panel-heading">
110 <p><strong>Calculate by U.S.G.
</strong></p>
112 <div class=
"panel-body">
113 <form name=
"form_usg">
114 <div class=
"form-group">
115 <label>Enter U.S.G. date:
</label>
116 <div data-ng-class=
"{'has-error':form_usg.dt.$invalid}"><input class=
"form-control" type=
"date" id=
"usg-dt" name=
"dt" data-ng-model=
"usg_dt" placeholder=
"YYYY-MM-DD" autocomplete=
"off"></div>
118 <div class=
"form-group">
119 <label>Enter U.S.G. Maturation:
</label>
121 <div class=
"col-md-6" data-ng-class=
"{'has-error':form_usg.wk.$invalid}"><input class=
"form-control" type=
"number" min=
"0" max=
"52" data-ng-model=
"usg_wk" name=
"wk" placeholder=
"Weeks" autocomplete=
"off"></div>
122 <div class=
"col-md-6" data-ng-class=
"{'has-error':form_usg.dy.$invalid}"><input class=
"form-control" type=
"number" min=
"0" max=
"6" data-ng-model=
"usg_dy" name=
"dy" placeholder=
"Days" autocomplete=
"off"></div>
125 <input type=
"reset" class=
"btn">
128 <table class=
"table" data-ng-show=
"calcUsg()">
129 <tr><th class=
"active">Maturation by U.S.G. at present
</th><th>{{calcUsg()}}
</th></tr>
135 <div class=
"alert alert-info">
136 <h3>Developed by Agnibho Mondal
</h3>
137 <h4><a href=
"http://www.agnibho.com" style=
"text-decoration:none;color:inherit">www.agnibho.com
</a></h4>
141 if(navigator.userAgent.indexOf(
"Chrome")==-
1){
142 $(
"#lmp-dt").datepicker({
143 dateFormat:
"yy-mm-dd",
147 $(
"#edd-dt").datepicker({
148 dateFormat:
"yy-mm-dd",
152 $(
"#usg-dt").datepicker({
153 dateFormat:
"yy-mm-dd",
158 var app=angular.module(
"oc",[]);
159 app.controller(
"oc",function($scope){
160 $scope.showDate=function(date){
164 return dt.format(
"DD/MM/YY");
168 $scope.getEdd=function(){
169 if($scope.lmp_dt!=null){
170 dt=moment($scope.lmp_dt);
174 $scope.edd_dt=dt.toDate();
184 $scope.getLmp=function(){
185 if($scope.edd_dt!=null){
186 dt=moment($scope.edd_dt);
188 dt.subtract(
9,
"months");
189 dt.subtract(
7,
"days");
190 $scope.lmp_dt=dt.toDate();
200 $scope.calcDate=function(){
201 if($scope.lmp_dt!=null){
202 dt=moment($scope.lmp_dt);
205 days=today.diff(dt,
"days");
207 return Math.floor(days/
7)+
" weeks "+days%
7+
" days";
212 $scope.calcUsg=function(){
213 if($scope.usg_dt!=null){
214 dt=moment($scope.usg_dt);
216 if($scope.usg_wk
>=
0 && $scope.usg_wk<=
52 && $scope.usg_dy
>=
0 && $scope.usg_dy<=
6){
218 diff=today.diff(dt,
"days");
219 days=$scope.usg_wk*
7+$scope.usg_dy+diff;
220 return Math.floor(days/
7)+
" weeks "+days%
7+
" days";