Browse Source

Closes #50

* works for Up, Down, Update
* Close works when etherpad isn't open, otherwise scrolls to top
devel
Jonathan Rosenbaum 6 years ago
parent
commit
91e11655d8
  1. 75
      include_header_shop.html
  2. 20
      shop_log_iframe.php

75
include_header_shop.html

@ -19,7 +19,7 @@ function resetTimer()
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>YBDB</title>
<link href="css/transactions.css" rel="stylesheet" type="text/css" />
<link href="css/contacts.css" rel="stylesheet" type="text/css" />
@ -38,19 +38,74 @@ function resetTimer()
<script src="js/jquery.liblink.js"></script>
<script src="js/wNumb.js"></script>
<script>
/*
$( window ).on( "load", function() {
var page_y = $( document ).scrollTop();
window.location.href = window.location.href + '?page_y=' + page_y;
// scroll back to same location when up or down are selected
$(function() {
$(".down").on("click keypress", function(e) {
var hash = document.body.scrollTop + 25;
var query = window.location.search;
query = query.split("&");
var visit_id = query[1].split("=")[1] - 1;
var new_query = query[0] + "&visit_id=" + visit_id;
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
});
$(".up").on("click keypress", function(e) {
var hash = document.body.scrollTop - 25;
var query = window.location.search;
query = query.split("&");
var visit_id = parseInt(query[1].split("=")[1]) + 1;
var new_query = query[0] + "&visit_id=" + visit_id;
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
if ( window.location.href.indexOf('page_y') != -1 ) {
var match = window.location.href.split('?')[1].split("&")[0].split("=");
$('html, body').scrollTop( match[1] );
}
});
$(".close").on("click keypress", function(e) {
var hash = document.body.scrollTop;
var query = window.location.search;
query = query.split("&");
var new_query = query[0];
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
});
// have to do this a little differently because it is a submit, not a button
$(".update_changes").on("click keypress", function(e) {
var hash = parseInt(document.body.scrollTop);
var query = window.location.search;
query = query.split("&");
var visit_id = parseInt(query[1].split("=")[1]);
var add_hash = "&#" + hash;
var action = $("[name=FormUpdate_" + visit_id).attr("action");
$("[name=FormUpdate_" + visit_id).attr("action", action + add_hash);
});
});
$( window ).on( "load", function() {
if(window.location.hash != "") {
document.body.scrollTop = window.location.hash.replace("#", "") * 1;
}
});
*/
</script>
</head>

20
shop_log_iframe.php

@ -102,6 +102,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_new") && ($_PO
//Update Record isset($_POST["MM_update"])
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) {
$updateSQL = sprintf("UPDATE shop_hours SET time_out=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['time_out'], "date"),
GetSQLValueString($_POST['shop_visit_id'], "int"));
@ -115,6 +116,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) {
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) {
$updateSQL = sprintf("UPDATE shop_hours SET contact_id=%s, shop_user_role=%s, project_id=%s, time_in=%s, time_out=%s, comment=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['contact_id'], "int"),
GetSQLValueString($_POST['user_role'], "text"),
@ -235,18 +237,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) {
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Update Changes" />
<input type="button" value="Close"
onclick="location.href='<?php echo "/shop_log_iframe.php?shop_id={$shop_id}";?>';" /></td>
<td>
<input type="button" value="Up"
onclick="location.href='<?php
$prev = $visit_id + 1;
echo "/shop_log_iframe.php?shop_id={$shop_id}&visit_id={$prev}";?>';"/>
<input type="button" value="Down"
onclick="location.href='<?php
$prev = $visit_id - 1;
echo "/shop_log_iframe.php?shop_id={$shop_id}&visit_id={$prev}";?>';" />
<td><input class="update_changes" type="submit" name="Submit" value="Update Changes" />
<input class="close" type="button" value="Close" />
</td>
<td>
<input class="up" type="button" value="Up" />
<input class="down" type="button" value="Down" />
</td>
</tr>
<?php //if(current_shop_by_ip()>=$shop_id & (current_shop_by_ip()-5)<=$shop_id ) {

Loading…
Cancel
Save