Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- // $('#myModal').modal('show');
- $('[data-toggle="tooltip"]').tooltip();
- $('.accordion-body.in').collapse('toggle');
- });
- $(function() {
- $('[data-toggle="popover"]').popover()
- })
- $('#tabListado').click(function(e) {
- e.preventDefault()
- $(this).tab('show');
- });
- var adjustment;
- $(function() {
- var group = $("ul.ordenable").sortable({
- group: "ordenable",
- pullPlaceholder: true,
- handle: 'div.btn-default',
- vertical: true,
- onDragStart: function($item, container, _super) {
- var offset = $item.offset(),
- pointer = container.rootGroup.pointer;
- adjustment = {
- left: pointer.left - offset.left,
- top: pointer.top - offset.top
- };
- _super($item, container);
- },
- onDrop: function($item, container, _super) {
- // Duplicate items of the no drop area
- var data = group.sortable("serialize").get();
- var jsonString = JSON.stringify(data, null, ' ');
- // alert((jsonString));
- var repartidor_id = $('#repartidor_id').val();
- $.ajax({
- data: {ids: jsonString},
- type: 'POST',
- dataType: "json",
- url: 'ajax/guardar_orden.php?repartidor_id=' + repartidor_id
- });
- _super($item, container);
- }
- });
- });
- (function($) {
- var topics = {};
- $.publish = function(topic, args) {
- if (topics[topic]) {
- var currentTopic = topics[topic],
- args = args || {};
- for (var i = 0, j = currentTopic.length; i < j; i++) {
- currentTopic[i].call($, args);
- }
- }
- };
- $.subscribe = function(topic, callback) {
- if (!topics[topic]) {
- topics[topic] = [];
- }
- topics[topic].push(callback);
- return {
- "topic": topic,
- "callback": callback
- };
- };
- $.unsubscribe = function(handle) {
- var topic = handle.topic;
- if (topics[topic]) {
- var currentTopic = topics[topic];
- for (var i = 0, j = currentTopic.length; i < j; i++) {
- if (currentTopic[i] === handle.callback) {
- currentTopic.splice(i, 1);
- }
- }
- }
- };
- })(jQuery);
- $(document).ready(function() {
- // Ejecutar mostrar firma al abrir la modal
- $('.carga').on('shown.bs.modal', function(e) {
- // Primero vaciamos el div por si ha sido cargado previamente
- $("#signature").html('');
- // Tambien la variable
- var $sigdiv = '';
- $tools = '';
- // This is the part where jSignature is initialized.
- var $sigdiv = $("#signature").jSignature({
- 'UndoButton': true
- })
- // All the code below is just code driving the demo.
- , $tools = $('#tools'), $extraarea = $('#displayarea'), pubsubprefix = 'jSignature.demo.'
- var export_plugins = $sigdiv.jSignature('listPlugins', 'export'),
- chops = ['<span><b>Extract signature data as: </b></span><select>', '<option value="">(select export format)</option>'],
- name
- for (var i in export_plugins) {
- if (export_plugins.hasOwnProperty(i)) {
- name = export_plugins[i]
- chops.push('<option value="' + name + '">' + name + '</option>')
- }
- }
- chops.push('</select><span><b> or: </b></span>')
- $(chops.join('')).bind('change', function(e) {
- if (e.target.value !== '') {
- var data = $sigdiv.jSignature('getData', e.target.value)
- $.publish(pubsubprefix + 'formatchanged')
- if (typeof data === 'string') {
- $('textarea', $tools).val(data)
- } else if ($.isArray(data) && data.length === 2) {
- $('textarea', $tools).val(data.join(','))
- $.publish(pubsubprefix + data[0], data);
- } else {
- try {
- $('textarea', $tools).val(JSON.stringify(data))
- } catch (ex) {
- $('textarea', $tools).val('Not sure how to stringify this, likely binary, format.')
- }
- }
- }
- }).appendTo($tools)
- $('<input type="button" value="Reset">').bind('click', function(e) {
- $sigdiv.jSignature('reset')
- }).appendTo($tools)
- $('<div><textarea style="width:100%;height:7em;"></textarea></div>').appendTo($tools)
- $.subscribe(pubsubprefix + 'formatchanged', function() {
- $extraarea.html('')
- })
- $.subscribe(pubsubprefix + 'image/svg+xml', function(data) {
- try {
- var i = new Image()
- i.src = 'data:' + data[0] + ';base64,' + btoa(data[1])
- $(i).appendTo($extraarea)
- } catch (ex) {
- }
- var message = [
- "If you don't see an image immediately above, it means your browser is unable to display in-line (data-url-formatted) SVG.", "This is NOT an issue with jSignature, as we can export proper SVG document regardless of browser's ability to display it.", "Try this page in a modern browser to see the SVG on the page, or export data as plain SVG, save to disk as text file and view in any SVG-capabale viewer."
- ]
- $("<div>" + message.join("<br/>") + "</div>").appendTo($extraarea)
- });
- $.subscribe(pubsubprefix + 'image/svg+xml;base64', function(data) {
- var i = new Image()
- i.src = 'data:' + data[0] + ',' + data[1]
- $(i).appendTo($extraarea)
- var message = [
- "If you don't see an image immediately above, it means your browser is unable to display in-line (data-url-formatted) SVG.", "This is NOT an issue with jSignature, as we can export proper SVG document regardless of browser's ability to display it.", "Try this page in a modern browser to see the SVG on the page, or export data as plain SVG, save to disk as text file and view in any SVG-capabale viewer."
- ]
- $("<div>" + message.join("<br/>") + "</div>").appendTo($extraarea)
- });
- $.subscribe(pubsubprefix + 'image/png;base64', function(data) {
- var i = new Image()
- i.src = 'data:' + data[0] + ',' + data[1]
- $('<span><b>As you can see, one of the problems of "image" extraction (besides not working on some old Androids, elsewhere) is that it extracts A LOT OF DATA and includes all the decoration that is not part of the signature.</b></span>').appendTo($extraarea)
- $(i).appendTo($extraarea)
- });
- $.subscribe(pubsubprefix + 'image/jsignature;base30', function(data) {
- $('<span><b>This is a vector format not natively render-able by browsers. Format is a compressed "movement coordinates arrays" structure tuned for use server-side. The bonus of this format is its tiny storage footprint and ease of deriving rendering instructions in programmatic, iterative manner.</b></span>').appendTo($extraarea)
- });
- if (Modernizr.touch) {
- $('#scrollgrabber').height($('#content').height())
- }
- });
- })
- $(document).ready(function() {
- // INICIO RELOJ /////
- var currentdate = new Date();
- var l = 0;
- function callme() {
- currentdate = new Date();
- $('.hour').html(currentdate.getHours());
- $('.min').html(currentdate.getMinutes());
- $('.second').html(currentdate.getSeconds());
- $('.data').css({
- 'padding-left': l + 'px'
- });
- l = l + 5;
- }
- window.setInterval(callme, 1000);
- // FIN RELOJ /////
- // INICIO GEOLOCALIZACION /////
- function actualizarUbicacion() {
- if (navigator.onLine) {
- navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
- }
- }
- window.setInterval(actualizarUbicacion, 60000);
- function foundLocation(position) {
- var lat = position.coords.latitude;
- var long = position.coords.longitude;
- var repartidor_id = $('#repartidor_id').val();
- //alert(repartidor_id);
- $.get("ajax/guardar_localizacion.php", {
- repartidor_id: repartidor_id,
- lat: lat,
- long: long
- });
- }
- function noLocation() {
- var lat = 0;
- var long = 0;
- var repartidor_id = $('#repartidor_id').val();
- $.get("ajax/guardar_localizacion.php", {
- repartidor_id: repartidor_id,
- lat: lat,
- long: long
- });
- }
- // FIN GEOLOCALIZACION /////
- // DETECTAR FIRMA //
- $(".BtnFirma").click(function(event) {
- var id = $(this).data("id");
- var data = $("#signature_" + id).jSignature('getData', 'image/svg+xml;base64');
- var data_vacio = 'image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMCIgaGVpZ2h0PSIwIj48L3N2Zz4=';
- $extraarea = $('#resultadoFirma');
- if(data != data_vacio){
- var i = new Image()
- i.src = 'data:' + data[0] + ',' + data[1]
- $(i).appendTo($extraarea);
- }
- });
- // DETECTAR FIRMA //
- // DETECTAR QUE LOS KILOS Y UNIDADES MODIFICADOS ESTAN DENTRO DE LOS RANGOS PERMITIDOS //
- $(".cambiarUnidades").change(function(event) {
- var id = $(this).data("id");
- var valor_original = parseInt($(this).data("original"));
- var valor_actual = parseInt($(this).val());
- if(valor_actual > valor_original){
- $( "#warning"+id ).html('<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> No puedes incrementar las unidades, solo reducirlas.');
- $( "#warning"+id ).show( "slow", function() {
- // Animation complete.
- });
- $(this).val(valor_original);
- $(this).focus();
- $('#guardarCambiosUnidadesKilos'+id).attr( "disabled", "disabled");
- return false;
- }
- if(valor_actual <= 0){
- $( "#warning"+id ).html('<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Debes eliminar la línea en vez de poner las unidades a cero.');
- $( "#warning"+id ).show( "slow", function() {
- // Animation complete.
- });
- $(this).val(valor_original);
- $(this).focus();
- $('#guardarCambiosUnidadesKilos'+id).attr( "disabled", "disabled");
- return false;
- }
- $( "#warning"+id ).hide( "slow", function() {
- // Animation complete.
- });
- $('#guardarCambiosUnidadesKilos'+id).removeAttr("disabled");
- return true;
- });
- $(".cambiarPeso").change(function(event) {
- var id = $(this).data("id");
- var valor_original = parseFloat($(this).data("original"));
- var valor_actual = parseFloat($(this).val());
- if(valor_actual > valor_original){
- $( "#warning"+id ).html('<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> No puedes incrementar los kilogramos, solo reducirlos.');
- $( "#warning"+id ).show( "slow", function() {
- // Animation complete.
- });
- $(this).val(valor_original);
- $(this).focus();
- $('#guardarCambiosUnidadesKilos'+id).attr( "disabled", "disabled");
- return false;
- }
- if(valor_actual <= 0){
- $( "#warning"+id ).html('<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Debes eliminar la línea en vez de poner los kilogramos a cero.');
- $( "#warning"+id ).show( "slow", function() {
- // Animation complete.
- });
- $(this).val(valor_original);
- $(this).focus();
- $('#guardarCambiosUnidadesKilos'+id).attr( "disabled", "disabled");
- return false;
- }
- $( "#warning"+id ).hide( "slow", function() {
- // Animation complete.
- });
- $('#guardarCambiosUnidadesKilos'+id).removeAttr("disabled");
- return true;
- });
- // DETECTAR QUE LOS KILOS Y UNIDADES MODIFICADOS ESTAN DENTRO DE LOS RANGOS PERMITIDOS //
- // PULSADO EL BOTON DE ELIMINAR LINEA //
- $(".cseliminarlinea").click(function(event) {
- event.preventDefault();
- alert('aa');
- var id = $(this).data("id");
- // COMPROBAR QUE NO ESTE DESACTIVADO EL BOTON
- var isDisabled = $(this).hasAttr('disabled');
- if (isDisabled){
- alert('desactivado');
- return false;
- }else{
- }
- });
- // PULSADO EL BOTON DE ELIMINAR LINEA //
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement