Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2.  
  3. <html lang="en">
  4. <head>
  5.     <meta charset="utf-8" />
  6.     <title>Задача 3</title>
  7.     <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  8.     <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  9.     <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
  10.     <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  11.     <style>
  12.         body { font-size: 62.5%; }
  13.         label, input { display:block; }
  14.         label {font-size: 14px;}
  15.         input.text { margin-bottom:12px; width:95%; padding: .4em; }
  16.         fieldset { padding:0; border:0; margin-top:25px; }
  17.         h1 { font-size: 1.2em; margin: .6em 0; }
  18.         div#flights-contain { width: 350px; margin: 20px 0; }
  19.         #reservations { width: 500px; margin: 20px 0; }
  20.         #res {width: 300px; margin-top: 20px;}
  21.         table { margin: 1em 0; border-collapse: collapse; width: 100%; }
  22.         table td, table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
  23.         .ui-dialog .ui-state-error { padding: .3em; }
  24.         .validateTips { border: 1px solid transparent; padding: 0.3em; }
  25.         .ui-autocomplete-category {
  26.             font-weight: bold;
  27.             padding: .2em .4em;
  28.             margin: .8em 0 .2em;
  29.             line-height: 1.5;
  30.           }
  31.     </style>
  32.     <script type="text/javascript">
  33.         $(function() {
  34.         var id = $( "#sifra" ),
  35.             airline = $( "#airline" ),
  36.             flightTo = $( "#flightTo" ),
  37.             category = $("#category");
  38.             allFields = $( [] ).add( id ).add(airline).add(flightTo).add(category),
  39.             tips = $( ".validateTips" );
  40.  
  41.         function updateTips( t ) {
  42.             tips
  43.                 .text( t )
  44.                 .addClass( "ui-state-highlight" );
  45.            // setTimeout(function() {
  46.                 tips.removeClass( "ui-state-highlight", 1500 );
  47.            // }, 0 );
  48.         }
  49.  
  50.         function checkRegexp( o, regexp, n ) {
  51.             if ( !( regexp.test( o.val() ) ) ) {
  52.                 o.addClass( "ui-state-error" );
  53.                 updateTips( n );
  54.                 return false;
  55.             } else {
  56.                 return true;
  57.             }
  58.         }
  59.  
  60.         $( "#dialog-form" ).dialog({
  61.             autoOpen: false,
  62.             height: 350,
  63.             width: 350,
  64.             modal: true,    
  65.             //$("#date").datepicker(),
  66.             buttons: {
  67.                 Додади: function() {
  68.                    
  69.                     var bValid = true;
  70.                     allFields.removeClass( "ui-state-error" );
  71.                     bValid = bValid && checkRegexp( id, /^([0-9])+$/i,"Шифрата треба да биде составена единствено од броеви." );
  72.                    
  73.                     if ( bValid ) {
  74.                    
  75.                         $( "#flights tbody" ).append( "<tr>" +
  76.                             "<td>" + id.val() + "</td>" +
  77.                             "<td>" + airline.val() + "</td>" +
  78.                             "<td>" + flightTo.val() + "</td>" +
  79.                             "<td>" + category.val() + "</td>" +
  80.                         "</tr>" );
  81.            
  82.                         // dodadi vo flights listata
  83.  
  84.                         $( this ).dialog( "close" );
  85.                     }
  86.                 },
  87.                 "Откажи": function() {
  88.                     $( this ).dialog( "close" );
  89.                 }
  90.             },
  91.             close: function() {
  92.                 allFields.val( "" ).removeClass( "ui-state-error" );
  93.             }
  94.         });
  95.  
  96.         $( "#create-flight" )
  97.             .button()
  98.             .click(function() {
  99.                 $( "#dialog-form" ).dialog( "open" );
  100.             });
  101.        
  102.  
  103. });
  104.  
  105.  
  106.     </script>
  107. </head>
  108. <body>
  109.  
  110. <div id="dialog-form" title="Create new flight">
  111.     <p class="validateTips">Сите полиња се задолжителни.</p>
  112.  
  113.     <form>
  114.     <fieldset>
  115.         <label for="sifra">Шифра</label>
  116.         <input type="text" name="sifra" id="sifra" class="text ui-widget-content ui-corner-all" />
  117.         <label for="airline">Авиопревозник</label>
  118.         <input type="text" name="airline" id="airline" value="" class="text ui-widget-content ui-corner-all" />
  119.         <label for="flightTo">До</label>
  120.         <input type="text" name="flightTo" id="flightTo" value="" class="text ui-widget-content ui-corner-all" />
  121.         <label for="category">Категорија</label>
  122.         <select id="category">
  123.             <option value="Бизнис">Бизнис</option>
  124.             <option value="Економска">Економска</option>
  125.             <option value="Прва класа">Прва класа</option>
  126.         </select>
  127.     </fieldset>
  128.     </form>
  129. </div>
  130.  
  131.  
  132. <div id="flights-contain" class="ui-widget">
  133.     <h1>Летови:</h1>
  134.     <table id="flights" class="ui-widget ui-widget-content">
  135.         <thead>
  136.             <tr class="ui-widget-header ">
  137.                 <th>Шифра</th>
  138.                 <th>Авиопревозник</th>
  139.                 <th>До</th>
  140.                 <th>Класа</th>
  141.             </tr>
  142.         </thead>
  143.         <tbody>
  144.             <tr>
  145.                 <td>12331</td>
  146.                 <td>Wizz Air</td>
  147.                 <td>London</td>
  148.                 <td>Бизнис</td>
  149.             </tr>
  150.         </tbody>
  151.     </table>
  152. </div>
  153. <button id="create-flight">Додади нова ставка</button>
  154.  
  155. <br/><br/>
  156.  
  157. <div id="res">
  158.     <label for="search">Пребарај:</label>
  159.     <input id="search" class="text ui-widget-content ui-corner-all">
  160.  
  161.     <label for="from">Датум од</label>
  162.     <input type="text" id="from" name="from" class="text ui-widget-content ui-corner-all">
  163.     <label for="to">Датум до</label>
  164.     <input type="text" id="to" name="to" class="text ui-widget-content ui-corner-all">    
  165.     <button id="reserve">Резервирај лет</button>
  166. </div>
  167.  
  168.  
  169. <br/>
  170. <table id="reservations" class="ui-widget ui-widget-content">
  171.     <thead>
  172.         <tr class="ui-widget-header">
  173.             <th>Шифра</th>
  174.             <th>Авиопревозник</th>
  175.             <th>До</th>
  176.             <th>Класа</th>
  177.             <th>Датум од</th>
  178.             <th>Датум до</th>
  179.         </tr>
  180.     </thead>
  181.     <tbody>
  182.        
  183.     </tbody>
  184. </table>
  185.  
  186. </body>
  187. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement