]>
Softwares of Agnibho - simpleipd.git/blob - res/script.js
1 $(document
).ready(function(){
2 $("#upload").change(function(){
3 lim
=$("#size-limit").text().split("MB")[0]*1000*1000;
4 if(this.files
[0]["size"]>lim
){
5 $("#upload-error").html(" <span class='text-danger'>[Selected file exceeds size limit]</span>");
7 else if(["image/jpeg", "image/jpg", "image/png", "image/gif", "application/pdf"].indexOf(this.files
[0]["type"])==-1){
8 $("#upload-error").html(" <span class='text-danger'>"+this.files
[0]["type"]+" files are not supported</span>");
11 $("#upload-error").text("");
14 $("[name='date']").each(function(){
15 if($(this).val()==""){
16 $(this).val(moment().format("YYYY-MM-DD"));
19 $("[name='time']").each(function(){
20 if($(this).val()==""){
21 $(this).val(moment().format("HH:MM"));
24 if($("[name='drug']").length
){
25 $(this).prop("autocomplete","off");
26 $.get("autocomplete/drugs.json", function(data
){
27 $("[name='drug']").each(function(){
28 $(this).autocomplete({source
:data
, highlightClass
:'text-danger',treshold
:2});
32 if($("[name='route']").length
){
33 $(this).prop("autocomplete","off");
34 $.get("autocomplete/route.json", function(data
){
35 $("[name='route']").each(function(){
36 $(this).autocomplete({source
:data
, highlightClass
:'text-danger',treshold
:1});
40 if($("[name='frequency']").length
){
41 $(this).prop("autocomplete","off");
42 $.get("autocomplete/frequency.json", function(data
){
43 $("[name='frequency']").each(function(){
44 $(this).autocomplete({source
:data
, highlightClass
:'text-danger',treshold
:1});
48 if($("#discharge-note").length
){
49 $.get("autocomplete/discharge.json", function(data
){
50 $("#discharge-note").val(data
.note
);