My file

{{extend 'layout.html'}}
{{include 'web2py_ajax.html'}}
<script>
$(function(){
$('.activateButton').click(function(){
turnusId = $(this).val();
 $.ajax({
type: 'POST',
url: '{{=URL('settings', 'activateTurnus.json')}}',
data: {value: turnusId},
    dataType: 'json',
success: function(result){
//console.log("OK");
location.reload(true);
//$('#tablediv').load(document.URL +  ' #thisdiv');
},
error: function(){
// console.log("Ni OK");
// TODO ERROR MSG v kolkor se ni nč zgodivo
}
});

 });
$('.deleteButton').click(function(){
        turnusId = $(this).val();
        $.ajax({
            type: 'POST',
            url: '{{=URL('settings', 'deleteTurnus.json')}}',
            data: {value: turnusId},
            dataType: 'json',
            success: function(result){
                //console.log("OK");
                location.reload(true);
                //$('#tablediv').load(document.URL +  ' #thisdiv');
            },
            error: function(){
            //  console.log("Ni OK");
            // TODO ERROR MSG v kolkor se ni nč zgodivo
            }
        });
    });
});

var ColorPicker = function(){
var picker = $('input[name=sh_color]');
    picker.ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
    $(el).val(hex);
    $(el).ColorPickerHide();
    $(el).parent().css('background', '#'+hex);
},
onBeforeShow: function () {
    $(this).ColorPickerSetColor(this.value);
}
})
.bind('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
picker.each(function() {
if (this.value) {
    $(this).parent().css('background', '#' + this.value);

}
});
};
function compareTime(start, end) {

   var s1 = start.split(":")[0] * 3600 + start.split(":")[1] * 60;
   var s2 = end.split(":")[0] * 3600 + end.split(":")[1] * 60;
   //console.log(s1,s2);
   if (s1 > s2) {
   result = (86400 - s1) + s2;

   }
   else {
   result = Math.abs(s1 - s2);// Gets difference in seconds
   }
   return result
}
//alert(dateCompare("12:40:13","20:01:01"));
 $(document).ready(function() {
$('.time').clockpicker({
donetext: doneText,
autoclose: true
});
ColorPicker();
jQuery.timeEntry.setDefaults({showSeconds: false});
 ///Pogledamo če je kje vv gruidu None da se ne kaže
//console.log($('.web2py_htmltable'));
 //nastavimo polje lenght da je read only ker se vrednost zračuna
//$('#shift_sh_length1').attr("disabled", true)
$('#shift_sh_code').prop('readonly', true);
$('#shift_sh_code').css( 'background-color', 'DarkGray');
 $('#shift_sh_length1').prop('readonly', true);
$('#shift_sh_length1').css( 'background-color', 'DarkGray');
 $('#shift_sh_length2').prop('readonly', true);
$('#shift_sh_length2').css( 'background-color', 'DarkGray');
$('#shift_sh_duration').prop('readonly', true);
 //polja turnus code in duration se računjo tako za dur1 in dur2
$( ".time" ).change(function() {
//length1
start  = $('#shift_sh_start1').val(),
end = $('#shift_sh_end1').val();
var dur = compareTime(start,end)/ 60;
$('#shift_sh_length1').val(dur);
  //length2
start2  = $('#shift_sh_start2').val(),
end2 = $('#shift_sh_end2').val();
 if (start2){
 var codeBeg1 = start.split(":")[0] + start.split(":")[1];
var codeEnd1 = end.split(":")[0] + end.split(":")[1];
 var codeBeg2 = start2.split(":")[0] + start2.split(":")[1];
var codeEnd2 = end2.split(":")[0] + end2.split(":")[1];
 var tCodeL = codeBeg1 +'-' + codeEnd1 + '&' + codeBeg2 + '-' + codeEnd2;
$('#shift_sh_code').val(tCodeL);
var dur2 = compareTime(start2,end2)/ 60;
$('#shift_sh_length2').val(dur2);
$('#shift_sh_duration').val(dur + dur2);
 }
else  {
$('#shift_sh_length2').val(null);
//code
var beg = start.split(":")[0] + start.split(":")[1];
var ed = end.split(":")[0] + end.split(":")[1];
var tCode = beg +"-" + ed;
$('#shift_sh_code').val(tCode);
$('#shift_sh_duration').val(dur);
 }
});
});

</script>
<style>

.web2py_form {
width: 100%;
}

.w2p_fw {
width: 70%;
}

.generic-widget {
height : 110%;
}

.affix {
top: 60px;
}
.input-group {
width: 100%;
}
.row {
margin-bottom: 10px;
}
.sectionHeader {
margin-bottom: 0;
}
</style>
<head>

<title>{{ =response.title + " - " +T('Shifts')}} </title>
</head>


<h1>{{=T('Edit shifts')}}</h1>
<h3>{{=T('Active shifts')}}</h3>
<div class="col-md-12">
{{=grid_shifts}}
</div>

<!-- Ful grd if ampak dela -->
<!-- In  nimam pojma zakaj OR operator ne dela-->
{{if ((str((request.url, request.env.query_string)).find("new") < 0)):}}
    {{if ((str((request.url, request.env.query_string)).find("edit") <
0)):}}
<div class="col-md-12" id = "inactiveShifts">
<h3>{{=T('Inactive shitfs')}}</h3>
<div class="col-md-12">
<div class="table-responsive">
    <table class="table table-striped table-bordered">
    <thead>
    <th>{{=T('Code')}}</th>
    <th>{{=T('Name')}}</th>
    <th>{{=T('Start')}}</th>
    <th>{{=T('End')}}</th>
    <th>{{=T('Length 1')}}</th>
    <th>{{=T('Start 2')}}</th>
    <th>{{=T('End 2')}}</th>
    <th>{{=T('Length 2')}}</th>
   <th>{{=T('Note')}}</th>
   <th>{{=T('Activate')}}</th>
   <th>{{=T('Delete')}}</th>
   </tr>
   </thead>
   <tbody>
   {{for rec in query_inactive:}}
   <tr>
    <td>{{=rec['sh_code']}}</td>
    <td>{{=rec['sh_name']}}</td>
    <td>{{=rec['sh_start1']}}</td>
    <td>{{=rec['sh_end1']}}</td>
    <td>{{=rec['sh_length1']}}</td>
    <td>{{=rec['sh_start2']}}</td>
    <td>{{=rec['sh_end2']}}</td>
    <td>{{=rec['sh_length2']}}</td>
    <td>{{=rec['sh_note']}}</td>
    <td><button type="button" id = "activateButton" class="activateButton
glyphicon glyphicon-ok" value="{{=rec['id']}}"></button></td>
    <td><button type="button" id = "deleteButton" class="deleteButton
glyphicon glyphicon-trash" value="{{=rec['id']}}"></button></td>
   </tr>
  {{pass}}
  {{pass}}
  </tbody>
</table>
</div>
</div>
</div>
{{pass}}


2014-12-30 14:23 GMT+01:00 Jim S <j...@qlf.com>:

> Can you show your view file where the grid is included?
>
> -Jim
>
>
> On Monday, December 29, 2014 8:30:31 AM UTC-6, Yebach wrote:
>
>> Hello
>>
>> My navbar user button does not show dropdown options when I am in a view
>> where SQLFORM.grid is?
>>
>> Any suggestions why?
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/sjQoTm-XHgw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to