fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [16058]


From: nelson . guerra
Subject: [Fmsystem-commits] [16058]
Date: Thu, 8 Dec 2016 10:20:14 +0000 (UTC)

Revision: 16058
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16058
Author:   nelson224
Date:     2016-12-08 10:20:14 +0000 (Thu, 08 Dec 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/js/portico/import_components.js

Modified: branches/dev-syncromind-2/property/js/portico/import_components.js
===================================================================
--- branches/dev-syncromind-2/property/js/portico/import_components.js  
2016-12-08 10:19:59 UTC (rev 16057)
+++ branches/dev-syncromind-2/property/js/portico/import_components.js  
2016-12-08 10:20:14 UTC (rev 16058)
@@ -5,8 +5,8 @@
        $('.processing-sheet').hide();
        $('.processing-start-line').hide();
        $('.processing-columns').hide();
-       $('.processing-import-relations').hide();
-       $('.processing-preview-relations').hide();
+       //$('.processing-import-relations').hide();
+       $('.processing-relations').hide();
        $('.processing-save').hide();
        $('.get-profile').hide();
        
@@ -95,17 +95,25 @@
                );                              
        });
        
-       $('#preview_components_files').on('click', function ()
+       $('#relations_step_1').on('click', function ()
        {
+               if ($('input:radio[name=with_components_check]:checked').val() 
== 1)
+               {
+                       if ($('#excel_files').val() == '')
+                       {
+                               alert('no file selected');
+                               return false;
+                       }
+               }
+               
+               $('#responsiveTabsRelations').responsiveTabs('activate', 1);
+       });
+       
+       $('#relations_step_2').on('click', function ()
+       {
                var oArgs = {menuaction: 
'property.uiimport_components.import_component_files'};
                var requestUrl = phpGWLink('index.php', oArgs, true);
                
-               /*if ($('#excel_files').val() === '')
-               {
-                       alert('no file selected');
-                       return false;
-               }*/
-               
                if ($('#location_item_id').val() === '')
                {
                        alert('Choose Location');
@@ -118,29 +126,33 @@
                        return false;
                }
                
-               if (isSendingData())
-               {
-                       return false;
-               }
-               
                var form = document.forms.namedItem("form_files");
                var form_data = new FormData(form);
                
-               if ($('#excel_files').val() !== '')
+               if ($('input:radio[name=with_components_check]:checked').val() 
== 1)
                {
+                       if ($('#excel_files').val() == '')
+                       {
+                               alert('no file selected');
+                               return false;
+                       }
                        var file_data = $('#excel_files').prop('files')[0];     
                        form_data.append('file', file_data);
                }
                
+               if (isSendingData())
+               {
+                       return false;
+               }
                //form_data.append('attribute_name_component_id', 
$('#attribute_name_component_id').val());
                form_data.append('location_code', $('#location_code').val());
                form_data.append('location_item_id', 
$('#location_item_id').val());
                form_data.append('compressed_file_check', 
$('input:radio[name=compressed_file_check]:checked').val());
-               form_data.append('with_components_check', 
$('input:radio[name=with_components_check"]:checked').val());
+               form_data.append('with_components_check', 
$('input:radio[name=with_components_check]:checked').val());
                form_data.append('compressed_file_name', 
$('#compressed_file_name').val());
                form_data.append('preview', 1);
 
-               $('.processing-import-relations').show();
+               $('.processing-relations').show();
                
                $.ajax({
                        url: requestUrl,
@@ -149,18 +161,24 @@
                        processData: false,
                        data: form_data,
                        type: 'post',
-                       dataType: 'json',
-                       success: function (result)
-                       {
-                               statusSend = false;
-                               $('.processing-import-relations').hide();
-                               JqueryPortico.show_message(5, result);
-                               
//$('#import_components_files').prop('disabled', true);
-                       }
+                       dataType: 'json'
+               })
+               .done(function(result) {
+                       JqueryPortico.show_message(5, result);
+                       $('#responsiveTabsRelations').responsiveTabs('enable', 
2);
+                       
$('#responsiveTabsRelations').responsiveTabs('activate', 2);
+                       //$('#import_components_files').prop('disabled', true);
+               })
+               .fail(function() {
+                   alert( "error" );
+               })
+               .always(function() {
+                       statusSend = false;
+                       $('.processing-relations').hide();
                });
        });
        
-       $('#import_components_files').on('click', function ()
+       $('#save_relations').on('click', function ()
        {
                var oArgs = {menuaction: 
'property.uiimport_components.import_component_files'};
                var requestUrl = phpGWLink('index.php', oArgs, true);
@@ -176,22 +194,7 @@
                        alert('Choose Location');
                        return false;
                }       
-       
-               if ($('input:radio[name=with_components_check"]:checked').val())
-               {
-                       if ($('#attribute_name_component_id').val() === '')
-                       {
-                               alert('Choose attribute name for Component ID');
-                               return false;
-                       }
-               }
                
-               if ($('input:radio[name=compressed_file_check]:checked').val() 
== 1 && $('#compressed_file_name').val() == '')
-               {
-                       alert('Enter the name of the compressed file');
-                       return false;
-               }
-               
                if (isSendingData())
                {
                        return false;
@@ -200,20 +203,11 @@
                var form = document.forms.namedItem("form_files");
                var form_data = new FormData(form);
                
-               if ($('#excel_files').val() !== '')
-               {
-                       var file_data = $('#excel_files').prop('files')[0];     
-                       form_data.append('file', file_data);
-               }
-               
                form_data.append('attribute_name_component_id', 
$('#attribute_name_component_id').val());
                form_data.append('location_code', $('#location_code').val());
                form_data.append('location_item_id', 
$('#location_item_id').val());
-               form_data.append('compressed_file_check', 
$('input:radio[name=compressed_file_check]:checked').val());
-               form_data.append('with_components_check', 
$('input:radio[name=with_components_check"]:checked').val());
-               form_data.append('compressed_file_name', 
$('#compressed_file_name').val());
 
-               $('.processing-import-relations').show();
+               $('.processing-relations').show();
                
                $.ajax({
                        url: requestUrl,
@@ -222,14 +216,18 @@
                        processData: false,
                        data: form_data,
                        type: 'post',
-                       dataType: 'json',
-                       success: function (result)
-                       {
-                               statusSend = false;
-                               $('.processing-import-relations').hide();
-                               JqueryPortico.show_message(4, result);
-                               
//$('#import_components_files').prop('disabled', true);
-                       }
+                       dataType: 'json'
+               })
+               .done(function(result) {
+                       JqueryPortico.show_message(4, result);
+                       //$('#import_components_files').prop('disabled', true);
+               })
+               .fail(function() {
+                   alert( "error" );
+               })
+               .always(function() {
+                       statusSend = false;
+                       $('.processing-relations').hide();
                });
        });
        




reply via email to

[Prev in Thread] Current Thread [Next in Thread]