Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <title>Задача 3</title>
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
- <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
- <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
- <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
- <style>
- body { font-size: 62.5%; }
- label, input { display:block; }
- label {font-size: 14px;}
- input.text { margin-bottom:12px; width:95%; padding: .4em; }
- fieldset { padding:0; border:0; margin-top:25px; }
- h1 { font-size: 1.2em; margin: .6em 0; }
- div#flights-contain { width: 350px; margin: 20px 0; }
- #reservations { width: 500px; margin: 20px 0; }
- #res {width: 300px; margin-top: 20px;}
- table { margin: 1em 0; border-collapse: collapse; width: 100%; }
- table td, table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
- .ui-dialog .ui-state-error { padding: .3em; }
- .validateTips { border: 1px solid transparent; padding: 0.3em; }
- .ui-autocomplete-category {
- font-weight: bold;
- padding: .2em .4em;
- margin: .8em 0 .2em;
- line-height: 1.5;
- }
- </style>
- <script type="text/javascript">
- $(function() {
- var id = $( "#sifra" ),
- airline = $( "#airline" ),
- flightTo = $( "#flightTo" ),
- category = $("#category");
- allFields = $( [] ).add( id ).add(airline).add(flightTo).add(category),
- tips = $( ".validateTips" );
- function updateTips( t ) {
- tips
- .text( t )
- .addClass( "ui-state-highlight" );
- // setTimeout(function() {
- tips.removeClass( "ui-state-highlight", 1500 );
- // }, 0 );
- }
- function checkRegexp( o, regexp, n ) {
- if ( !( regexp.test( o.val() ) ) ) {
- o.addClass( "ui-state-error" );
- updateTips( n );
- return false;
- } else {
- return true;
- }
- }
- $( "#dialog-form" ).dialog({
- autoOpen: false,
- height: 350,
- width: 350,
- modal: true,
- //$("#date").datepicker(),
- buttons: {
- Додади: function() {
- var bValid = true;
- allFields.removeClass( "ui-state-error" );
- bValid = bValid && checkRegexp( id, /^([0-9])+$/i,"Шифрата треба да биде составена единствено од броеви." );
- if ( bValid ) {
- $( "#flights tbody" ).append( "<tr>" +
- "<td>" + id.val() + "</td>" +
- "<td>" + airline.val() + "</td>" +
- "<td>" + flightTo.val() + "</td>" +
- "<td>" + category.val() + "</td>" +
- "</tr>" );
- // dodadi vo flights listata
- $( this ).dialog( "close" );
- }
- },
- "Откажи": function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
- }
- });
- $( "#create-flight" )
- .button()
- .click(function() {
- $( "#dialog-form" ).dialog( "open" );
- });
- });
- </script>
- </head>
- <body>
- <div id="dialog-form" title="Create new flight">
- <p class="validateTips">Сите полиња се задолжителни.</p>
- <form>
- <fieldset>
- <label for="sifra">Шифра</label>
- <input type="text" name="sifra" id="sifra" class="text ui-widget-content ui-corner-all" />
- <label for="airline">Авиопревозник</label>
- <input type="text" name="airline" id="airline" value="" class="text ui-widget-content ui-corner-all" />
- <label for="flightTo">До</label>
- <input type="text" name="flightTo" id="flightTo" value="" class="text ui-widget-content ui-corner-all" />
- <label for="category">Категорија</label>
- <select id="category">
- <option value="Бизнис">Бизнис</option>
- <option value="Економска">Економска</option>
- <option value="Прва класа">Прва класа</option>
- </select>
- </fieldset>
- </form>
- </div>
- <div id="flights-contain" class="ui-widget">
- <h1>Летови:</h1>
- <table id="flights" class="ui-widget ui-widget-content">
- <thead>
- <tr class="ui-widget-header ">
- <th>Шифра</th>
- <th>Авиопревозник</th>
- <th>До</th>
- <th>Класа</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>12331</td>
- <td>Wizz Air</td>
- <td>London</td>
- <td>Бизнис</td>
- </tr>
- </tbody>
- </table>
- </div>
- <button id="create-flight">Додади нова ставка</button>
- <br/><br/>
- <div id="res">
- <label for="search">Пребарај:</label>
- <input id="search" class="text ui-widget-content ui-corner-all">
- <label for="from">Датум од</label>
- <input type="text" id="from" name="from" class="text ui-widget-content ui-corner-all">
- <label for="to">Датум до</label>
- <input type="text" id="to" name="to" class="text ui-widget-content ui-corner-all">
- <button id="reserve">Резервирај лет</button>
- </div>
- <br/>
- <table id="reservations" class="ui-widget ui-widget-content">
- <thead>
- <tr class="ui-widget-header">
- <th>Шифра</th>
- <th>Авиопревозник</th>
- <th>До</th>
- <th>Класа</th>
- <th>Датум од</th>
- <th>Датум до</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement