Christian Matheus Batista Macedo 6 år sedan
incheckning
17f744a785
6 ändrade filer med 293 tillägg och 0 borttagningar
  1. BIN
      .DS_Store
  2. 48 0
      css/reset.css
  3. 0 0
      css/style.css
  4. 19 0
      index.html
  5. 64 0
      js/functions.js
  6. 162 0
      js/teste.js

BIN
.DS_Store


+ 48 - 0
css/reset.css

@@ -0,0 +1,48 @@
1
+/* http://meyerweb.com/eric/tools/css/reset/ 
2
+   v2.0 | 20110126
3
+   License: none (public domain)
4
+*/
5
+
6
+html, body, div, span, applet, object, iframe,
7
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+a, abbr, acronym, address, big, cite, code,
9
+del, dfn, em, img, ins, kbd, q, s, samp,
10
+small, strike, strong, sub, sup, tt, var,
11
+b, u, i, center,
12
+dl, dt, dd, ol, ul, li,
13
+fieldset, form, label, legend,
14
+table, caption, tbody, tfoot, thead, tr, th, td,
15
+article, aside, canvas, details, embed, 
16
+figure, figcaption, footer, header, hgroup, 
17
+menu, nav, output, ruby, section, summary,
18
+time, mark, audio, video {
19
+	margin: 0;
20
+	padding: 0;
21
+	border: 0;
22
+	font-size: 100%;
23
+	font: inherit;
24
+	vertical-align: baseline;
25
+}
26
+/* HTML5 display-role reset for older browsers */
27
+article, aside, details, figcaption, figure, 
28
+footer, header, hgroup, menu, nav, section {
29
+	display: block;
30
+}
31
+body {
32
+	line-height: 1;
33
+}
34
+ol, ul {
35
+	list-style: none;
36
+}
37
+blockquote, q {
38
+	quotes: none;
39
+}
40
+blockquote:before, blockquote:after,
41
+q:before, q:after {
42
+	content: '';
43
+	content: none;
44
+}
45
+table {
46
+	border-collapse: collapse;
47
+	border-spacing: 0;
48
+}

+ 0 - 0
css/style.css


+ 19 - 0
index.html

@@ -0,0 +1,19 @@
1
+<!DOCTYPE>
2
+<html lang="pt-br">
3
+    <head>
4
+        <meta charset="utf-8">
5
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+        <base href="<?=base_url();?>">
7
+        <title>MKT SUITE</title>
8
+        <meta name="description" content="">
9
+        <meta name="viewport" content="width=device-width, initial-scale=1">
10
+        <link rel="stylesheet" href="css/reset.css">
11
+        <link rel="stylesheet" href="css/style.css">
12
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
13
+        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
14
+        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
15
+        <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800" rel="stylesheet">
16
+        <link href="https://fonts.googleapis.com/css?family=Montserrat:800" rel="stylesheet">
17
+        <script src="js/functions.js"></script>
18
+    </head>
19
+</hmtl>

+ 64 - 0
js/functions.js

@@ -0,0 +1,64 @@
1
+var mktSuite = (function(){
2
+  var actions = {}
3
+  var urlAPIMkt = "http://142.93.247.97:8081"
4
+  var auth = "eyJ1dWlkIjoiNjM2MzJkY2YtNWQzMi00NTJhLTkzMjItYjQ5NGMwNmMwNmQ5NWI4M2Y3NjAyZTZkZiIsImF1dGgiOiI5M2YzZGQzZjBkZmE4NzY5ZjMyNzMxYjFhZmVkMmY5NTZmOWM3Yzg0YzhiODQzYzY5YjE4M2ViZGE2NGQxN2NlIn0="
5
+  var auth2 = "eyJ1dWlkIjoiOWJhZDg3ZDEtMDY3Ny00ZGMxLTllMDAtMDA1ZTZlYTkzYTBiNWI4NTdlNjU1YjE0NyIsImF1dGgiOiJmZDhmODU3NzFhYWRmZmFjZmQ4ZjdiMDI3NWY3YzdjY2RjNDg3MjhiOTM4NGYyNGM1OGViMzE3YzdlM2QwYmNiIn0="
6
+  var account = null
7
+
8
+  function call(method, uri, data, success, process) {
9
+    $.ajax({
10
+        xhr: function() {
11
+            var xhr = new window.XMLHttpRequest();
12
+
13
+            xhr.upload.addEventListener("progress", function(evt) {
14
+                if (evt.lengthComputable) {
15
+                    var percentComplete = evt.loaded / evt.total;
16
+                    percentComplete = parseInt(percentComplete * 100);
17
+                    process(percentComplete)
18
+                }
19
+            }, false);
20
+
21
+            return xhr;
22
+        },
23
+        url: urlAPIMkt + uri,
24
+        data: data,
25
+        type: method,
26
+        contentType: false,
27
+        processData: false,
28
+        crossDomain: true,
29
+        beforeSend: function(xhr){
30
+          xhr.setRequestHeader('Auth', auth)
31
+          xhr.setRequestHeader('Account', account)
32
+        },
33
+        success: function(data) {
34
+           success(data)
35
+        }
36
+     });
37
+  }
38
+
39
+  var accounts = null
40
+
41
+  actions.authenticantion = function() {
42
+    call('GET', '/account', null, function (data) {
43
+      console.log(data);
44
+      accounts = data.accounts;
45
+        if (accounts != null) {
46
+          actions.validation(accounts[0])
47
+          console.log("ok");
48
+        } else {
49
+          alert("Não possui contas")
50
+        }
51
+    })
52
+  }
53
+
54
+  actions.validation = function (account) {
55
+    var token = account.token
56
+    console.log(token);
57
+
58
+  }
59
+
60
+  return actions
61
+
62
+})();
63
+
64
+mktSuite.authenticantion()

+ 162 - 0
js/teste.js

@@ -0,0 +1,162 @@
1
+var mktSuite = {}
2
+mktSuite.list = []
3
+
4
+var urlAPIMkt = "https://mkt.sprinta.com.br:8082"
5
+
6
+
7
+mktSuite.call = function(method, uri, data, success, process) {
8
+
9
+    $.ajax({
10
+        xhr: function() {
11
+            var xhr = new window.XMLHttpRequest();
12
+
13
+            xhr.upload.addEventListener("progress", function(evt) {
14
+                if (evt.lengthComputable) {
15
+                    var percentComplete = evt.loaded / evt.total;
16
+                    percentComplete = parseInt(percentComplete * 100);
17
+                    process(percentComplete)
18
+                }
19
+            }, false);
20
+
21
+            return xhr;
22
+        },
23
+        url: urlAPIMkt + uri,
24
+        data: data,
25
+        type: method,
26
+        contentType: false,
27
+        processData: false,
28
+        crossDomain: true,
29
+        beforeSend: function(xhr){xhr.setRequestHeader('Auth', mktSuite.getAuthorization())},
30
+        success: function(data) {
31
+           success(data)
32
+        }
33
+     });
34
+}
35
+
36
+
37
+mktSuite.calltest = function(method, uri, data, success, process) {
38
+
39
+    $.ajax({
40
+        xhr: function() {
41
+            var xhr = new window.XMLHttpRequest();
42
+
43
+            xhr.upload.addEventListener("progress", function(evt) {
44
+                if (evt.lengthComputable) {
45
+                    var percentComplete = evt.loaded / evt.total;
46
+                    percentComplete = parseInt(percentComplete * 100);
47
+                    process(percentComplete)
48
+                }
49
+            }, false);
50
+
51
+            return xhr;
52
+        },
53
+        url: "http://localhost:8081" + uri,
54
+        data: data,
55
+        type: method,
56
+        contentType: false,
57
+        processData: false,
58
+        crossDomain: true,
59
+        beforeSend: function(xhr){xhr.setRequestHeader('Auth', mktSuite.getAuthorization())},
60
+        success: function(data) {
61
+           success(data)
62
+        }
63
+     });
64
+}
65
+
66
+mktSuite.getAuthorization = function() {
67
+   var cname = 'authorization'
68
+   var name = cname + "=";
69
+   var decodedCookie = decodeURIComponent(document.cookie);
70
+   var ca = decodedCookie.split(';');
71
+   for(var i = 0; i <ca.length; i++) {
72
+       var c = ca[i];
73
+       while (c.charAt(0) == ' ') {
74
+           c = c.substring(1);
75
+       }
76
+       if (c.indexOf(name) == 0) {
77
+           return c.substring(name.length, c.length);
78
+       }
79
+   }
80
+   return "";
81
+}
82
+
83
+mktSuite.load = function() {
84
+   mktSuite.call("GET", "/contactlist/r", "", function(resp) {
85
+       mktSuite.list = resp.result
86
+       mktSuite.renderList()
87
+   })
88
+}
89
+
90
+mktSuite.goToSave = function() {
91
+    mktSuite.boxCreateNew()
92
+
93
+    scroll('mktSuite-save')
94
+}
95
+
96
+mktSuite.fileChoosen = function(e) {
97
+	$('#fileNameDescription').html(
98
+		'<b>' + e.files[0].name + '</b><br/>' +
99
+		'Tipo: ' + e.files[0].type
100
+	)
101
+}
102
+
103
+mktSuite.boxCreateNew = function() {
104
+    if(mktSuite.list.length === 0) {
105
+        alert("Você não tem mktSuite cadastradas")
106
+        return
107
+    }
108
+    tpl = tmpl('form-save-item', {mktSuite: mktSuite.list})
109
+    $('#mktSuite-save').html(tpl)
110
+}
111
+
112
+mktSuite.renderList = function() {
113
+    tpl = tmpl('mktSuite-items', {mktSuite: mktSuite.list})
114
+    $('#mktSuite-list').html(tpl)
115
+}
116
+
117
+mktSuite.uploadFile = function(evt) {
118
+    evt.preventDefault()
119
+    evt.stopPropagation()
120
+
121
+
122
+    if(validation.form(evt)) {
123
+        validation.clearAllErrors()
124
+        form.attr('data-status', 'loading')
125
+
126
+        formData = new FormData( form[0] )
127
+
128
+        var listid = form[0].contactListId.value
129
+
130
+        var item = mktSuite.list.find(function(item) {
131
+            return item.id == listid
132
+        })
133
+
134
+        var inx = mktSuite.list.indexOf(item)
135
+
136
+        mktSuite.call("POST", "/upload/r", formData, function(resp) {
137
+
138
+            form.attr('data-status', 'done')
139
+            if(resp.errors) {
140
+                alert(resp.errors[0].message)
141
+            } else {
142
+                mktSuite.list[inx].pendingFiles = mktSuite.list[inx].pendingFiles + 1
143
+                mktSuite.renderList()
144
+
145
+                alert("Importação efetuada e processando")
146
+                mktSuite.boxCreateNew()
147
+            }
148
+        },
149
+        function(progress) {
150
+            $('.btn-submit-progress-bar').css('width', progress+'%');
151
+        })
152
+    }
153
+}
154
+
155
+
156
+window.onload = function() {
157
+   mktSuite.load()
158
+}
159
+
160
+
161
+
162
+Collapse