|
|
@@ -0,0 +1,91 @@
|
|
|
+<div class="portlet-body form form-horizontal">
|
|
|
+ <div class="form-body">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <p style="margin-top:0px;">
|
|
|
+ <%= hidden_field_tag 'product_id', @product_for_return.id %>
|
|
|
+ <%= hidden_field_tag 'sale_id', @sale.id %>
|
|
|
+ <%= hidden_field_tag 'quantity', @object_totals['quantity'] %>
|
|
|
+
|
|
|
+ Producto: <strong> <%= @product_for_return.name %> </strong> <br>
|
|
|
+ Cantidad: <strong> <%= @object_totals['quantity'] %> </strong> <br>
|
|
|
+ Importe: <strong> <%= number_to_currency(@object_totals['total'], precision: 2) %> MXN </strong>
|
|
|
+ </p>
|
|
|
+ <h4 class="form-section"></h4>
|
|
|
+ <div class="note note-success">
|
|
|
+ <p> <strong>NOTA: </strong>Solo se puede aplicar descuento de una manera, ya sea en porcentaje o cantidad fija.</p>
|
|
|
+
|
|
|
+ <p>* Las cantidades recomendadas que se muestran son en base al porcentaje establecido en la configuración.</p>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <%= label_tag :haggle, {:class=>"col-md-4 control-label"} do %>Porcentaje a aplicar <% end %>
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="input-group">
|
|
|
+ <%= number_field_tag :haggle_percent, '', class: "form-control input-mask_decimal", min:0, max:100 %>
|
|
|
+ <span class="input-group-addon"> % </span>
|
|
|
+ </div>
|
|
|
+ <span class="help-block">Recomendado: <strong><%= @pos_config.haggle_in_sale_percent %></strong> %</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <%= label_tag :haggle, {:class=>"col-md-4 control-label"} do %>Cantidad a descontar <% end %>
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="input-group">
|
|
|
+ <span class="input-group-addon"> $ </span>
|
|
|
+ <%= number_field_tag :haggle_quantity, '', class: "form-control input-mask_decimal" %>
|
|
|
+ <span class="input-group-addon"> MXN </span>
|
|
|
+ </div>
|
|
|
+ <span class="help-block">Recomendado: <strong><%= number_to_currency(@suggested_haggle, precision: 2) %></strong></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<div class="form-actions">
|
|
|
+ <h4 class="form-section"> </h4>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <button type="button" class="btn green disabled" onclick="submit()" id="submit_btn">Aplicar descuento</button>
|
|
|
+ <button type="button" class="btn default" onclick="cerrarDialog()">Cerrar</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<script>
|
|
|
+
|
|
|
+ $('#haggle_quantity, #haggle_percent').on('input', function() {
|
|
|
+ if($(this).val()) {
|
|
|
+ if($(this).attr('id') == 'haggle_percent') {
|
|
|
+ $('#haggle_quantity').val('');
|
|
|
+ } else {
|
|
|
+ $('#haggle_percent').val('');
|
|
|
+ }
|
|
|
+ $('#submit_btn').removeClass('disabled');
|
|
|
+ } else {
|
|
|
+ $('#submit_btn').addClass('disabled');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function submit() {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "/create_products_return_haggle",
|
|
|
+ dataType: "script",
|
|
|
+ data: {
|
|
|
+ product_id: $('#product_id').val(),
|
|
|
+ sale_id: $('#sale_id').val(),
|
|
|
+ haggle_percent: $('#haggle_percent').val(),
|
|
|
+ haggle_quantity: $('#haggle_quantity').val(),
|
|
|
+ quantity: $('#quantity').val()
|
|
|
+
|
|
|
+ },
|
|
|
+ success: function(xhr, status, error) {}
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function cerrarDialog() {
|
|
|
+ $('#dialog').modal('toggle');
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+
|