Alejandro Villanueva avatar Alejandro Villanueva committed 42eaa54

deleting unused link, added more info to sales detail/checkout, adding # id to reservation, fixing datetime js widget

Comments (0)

Files changed (11)

apps/ventas/models.py

         ('MASTERCARD', 'MASTERCARD'),
     )
     SERIE = (
-        ('E','E'), # Fiscal
+        ('C','C'), # Fiscal
         ('D', 'D'), # No fiscal
     )
     auto = models.ForeignKey(Autos)

static/assets/js/admin.js

     
     $('.completeselect').selectToAutocomplete();
     
-    $('.dtp').datetimepicker({ dateFormat: 'dd/mm/yy' });
+    $('.dtp').datetimepicker({ 
+        dateFormat: 'dd/mm/yy',
+        addSliderAccess: true,
+        sliderAccessArgs: { touchonly: false },
+        hourGrid: 4,
+        minuteGrid: 10,
+    });
     
     $('.dp').datepicker({ dateFormat: 'dd/mm/yy' });
     

static/assets/js/sales.js

         });
     }
     
+    /* Calculate the total in case there it is an update */
     calculatePrice();
     
     $("#id_auto, #id_dias, #id_fecha_entrada, #id_fecha_salida, #id_adelanto, #id_preciodia").change(function(){

static/assets/js/sliderAccess.js

+/*
+ * jQuery UI Slider Access
+ * By: Trent Richardson [http://trentrichardson.com]
+ * Version 0.2
+ * Last Modified: 12/02/2011
+ * 
+ * Copyright 2011 Trent Richardson
+ * Dual licensed under the MIT and GPL licenses.
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+ * 
+ */
+ (function($){
+
+	$.fn.extend({
+		sliderAccess: function(options){
+			options = options || {};
+			options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
+
+			if(options.touchonly === true && !("ontouchend" in document))
+				return $(this);
+				
+			return $(this).each(function(i,obj){
+						var $t = $(this),
+							o = $.extend({},{ 
+											where: 'after',
+											step: $t.slider('option','step'), 
+											upIcon: 'ui-icon-plus', 
+											downIcon: 'ui-icon-minus',
+											text: false,
+											upText: '+',
+											downText: '-',
+											buttonset: true,
+											buttonsetTag: 'span'
+										}, options),
+							$buttons = $('<'+ o.buttonsetTag +' class="ui-slider-access">'+
+											'<button data-icon="'+ o.downIcon +'" data-step="-'+ o.step +'">'+ o.downText +'</button>'+
+											'<button data-icon="'+ o.upIcon +'" data-step="'+ o.step +'">'+ o.upText +'</button>'+
+										'</'+ o.buttonsetTag +'>');
+
+						$buttons.children('button').each(function(j, jobj){
+							var $jt = $(this);
+							$jt.button({ 
+											text: o.text, 
+											icons: { primary: $jt.data('icon') }
+										})
+								.click(function(e){
+											var step = $jt.data('step'),
+												curr = $t.slider('value'),
+												newval = curr += step*1,
+												minval = $t.slider('option','min'),
+												maxval = $t.slider('option','max');
+
+											e.preventDefault();
+											
+											if(newval < minval || newval > maxval)
+												return;
+											
+											$t.slider('value', newval);
+
+											$t.slider("option", "slide").call($t, null, { value: newval });
+										});
+						});
+						
+						// before or after					
+						$t[o.where]($buttons);
+
+						if(o.buttonset){
+							$buttons.removeClass('ui-corner-right').removeClass('ui-corner-left').buttonset();
+							$buttons.eq(0).addClass('ui-corner-left');
+							$buttons.eq(1).addClass('ui-corner-right');
+						}
+
+						// adjust the width so we don't break the original layout
+						var bOuterWidth = $buttons.css({
+									marginLeft: (o.where == 'after'? 10:0), 
+									marginRight: (o.where == 'before'? 10:0)
+								}).outerWidth(true) + 5;
+						var tOuterWidth = $t.outerWidth(true);
+						$t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
+					});		
+		}
+	});
+
+})(jQuery);

templates/default.html

         <script src="/static/assets/js/bootstrap.min.js" type="text/javascript"></script>
         <script src="/static/assets/js/sammy.min.js" type="text/javascript"></script>
         <script src="/static/assets/js/admin.js" type="text/javascript"></script>
+        <script src="/static/assets/js/sliderAccess.js" type="text/javascript"></script>
         <script src="/static/assets/js/jquery-ui-1.8.16.min.js"></script>
         <script src="/static/assets/js/jquery-ui-timepicker-addon.js"></script>
         <script src="/static/assets/js/jquery.select-to-autocomplete.js"></script>
                       {% if perms.autos.add_reparaciones %}
                         <li class="nav-header"><a href="{% url apps.autos.views.lista_autos %}"><i class="icon-wrench"></i> Reparaciones</a></li>
                       {% endif %}
-                      {% if user.is_staff %}
-                        <li class="nav-header"><a href="#"><i class="icon-list-alt"></i> Reportes</a></li>
-                        <ul class="nav nav-list">
-                            <li></li>
-                        </ul>
-                      {% endif %}
                     </ul>
                   </div> <!-- /well -->
                 </div>
                     {% block content %}
 
                     {% endblock %}
+
                 </div>
             </div>
             <div class="row-fluid">

templates/ventas/checkout.html

     {% endif %}
     <div class="box">
         <div>
-            <h2>Venta: {{ venta.id }}</h2>
+            <h2>Venta: {{ venta.num_contrato }}</h2>
         </div>
         <table class="table">
             <tr>
                 <td>{{ venta.auto.codigo }} {{ venta.auto.modelo }} {{ venta.auto.placas }}</td>
             </tr>
             <tr>
+                <td>Serie</td>
+                <td>{{ venta.serie }}</td>
+            </tr>
+            <tr>
                 <td>Fecha Salida</td>
                 <td>{{ venta.fecha_salida }}</td>
             </tr>
                 <td>{{ venta.fecha_entrada }}</td>
             </tr>
             <tr>
+                <td>Precio por Dia</td>
+                <td>{{ venta.preciodia }}</td>
+            </tr>
+            <tr>
                 <td>Dias</td>
                 <td>{{ venta.dias }}</td>
             </tr>
             </tr>
             <tr>
                 <td>TOTAL</td>
-                <td>{{ venta.total }}</td>
+                <td><h3>{{ venta.total }}</h3></td>
             </tr>
             <tr>
                 <td>Tipo de pago</td>

templates/ventas/detail_ventas.html

     {% endif %}
             <div class="box">
                 <div>
-                    <h2>Venta: {{ venta.id }}</h2>
+                    <h2>Venta: {{ venta.num_contrato }}</h2>
                 </div>
                 <table class="table">
                     <tr>
                         <td>{{ venta.auto.codigo }} {{ venta.auto.modelo }} {{ venta.auto.placas }}</td>
                     </tr>
                     <tr>
+                        <td>Serie</td>
+                        <td>{{ venta.serie }}</td>
+                    </tr>
+                    <tr>
                         <td>Fecha Salida</td>
                         <td>{{ venta.fecha_salida }}</td>
                     </tr>
                         <td>Fecha Entrada</td>
                         <td>{{ venta.fecha_entrada }}</td>
                     </tr>
+                     <tr>
+                        <td>Precio por Dia</td>
+                        <td>{{ venta.preciodia }}</td>
+                    </tr>
                     <tr>
                         <td>Dias</td>
                         <td>{{ venta.dias }}</td>
                         <td>{{ venta.adelanto }}</td>
                     </tr>
                     <tr>
+                        <td>Deposito Garantia</td>
+                        <td>{{ venta.deposito }}</td>
+                    </tr>
+                    <tr>
                         <td>Octavos Gas Salida</td>
                         <td>{{ venta.gas_octavos_salida }}</td>
                     </tr>
                     </tr>
                     <tr>
                         <td>TOTAL</td>
-                        <td>{{ venta.total }}</td>
+                        <td><h3>{{ venta.total }}</h3></td>
                     </tr>
                     <tr>
                         <td>Comentarios</td>

templates/ventas/reporte_ventas.html

                 </tr>
                 <tr><h5>Fiscales</h5></tr>
                 {% for venta in ventas %}
-                    {% if venta.serie == "E" %}
+                
+                    {% if venta.serie == "C" %}
                         <tr>
-                            <td> {{ venta.num_contrato }}</td>
+                            <td>{{ venta.num_contrato }}</td>
                             <td>{{ venta.auto.codigo }}</td>
                             <td>{{ venta.auto.placas }}</td>
                             <td>{{ venta.cliente.nombre }} {{ venta.cliente.apellidos }}</td>
                             {% endif %}
                         </tr>
                     {% endif %}
+                    
                     {% if forloop.first %}
                         <tr>
                             <td>Total Fiscal</td>

templates/ventas/reservaciones.html

         <div class="table table-striped  table-condensed table-bordered">
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr>
+                    <th>Id</th>
                     <th>Auto</th>
                     <th>Placas</th>
                     <th>Cliente</th>
                 </tr>
                 {% for reservacion in reservaciones.object_list %}
                     <tr>
+                        <td>{{ reservacion.id }}</td>
                         <td>{{ reservacion.auto.codigo }}</td>
                         <td>{{ reservacion.auto.placas }}</td>
                         <td>{{ reservacion.cliente }} </td>

templates/ventas/terminadas.html

                 </tr>
                 <tr><h5>Fiscales</h5></tr>
                 {% for venta in ventas.object_list %}
-                    {% if venta.serie == "E" %}
+                    {% if venta.serie == "C" %}
                         <tr>
                             <td> {{ venta.num_contrato }}</td>
                             <td>{{ venta.auto.codigo }}</td>

templates/ventas/ventas.html

                     <td><h5>Fiscales</h5></td>
                 </tr>
                 {% for venta in ventas.object_list %}
-                    {% if venta.serie == "E" %}
+                    {% if venta.serie == "C" %}
                         <tr>
                             <td>{{ venta.num_contrato }}</td>
                             <td>{{ venta.auto.codigo }}</td>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.