-
Notifications
You must be signed in to change notification settings - Fork 2
/
peachloader.js
169 lines (127 loc) · 4.87 KB
/
peachloader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
var peachuser;
peachuser= {"fullname" : " " };
var peach = {"state":'0',
"greeting": [
{
"question" : "Hello i am Peach, what is your name?", // Peach UI askes
"answerType" : "string", // string || button
"answerContent" : "Firstname Lasname", // Peach UI Answer Element Labeltext || button's intro
"userResponse" : "", // user text storage init empty || button's label
"ResponseAction" : "saveResponse();return false;" // onclick Function Array || set value id
},
{
"question" : "Hello "+peachuser.fullname+" what can I help you with?", // Peach UI askes
"answerType" : "button", // string || button
"answerContent" : "I have a case regarding ...",
"userResponse" : ["Labor law", "Family law", "Traffic law"],
"userResponseAction" : ["laborlaw", "familylaw", "trafficlaw"]
}
] // End "greeting"
};
function nextstep() {
if (peachi != undefined) {
peachi = peachi;
} else {
var peachi = 0;
}
$('#question').append(peach.greeting[peachi].question);
$('#question').append(peach.greeting[peachi].ResponseAction);
if (peach.greeting[peachi].answerType=="string") {
var htmlresponse = '<div class="ui fluid input focus"><input type="bottom attached fluid text" id="response"><button class="ui teal icon button"><i class="ui big chevron circle right icon"></i></button></div>';
} else if(peach.greeting[0].answerType=="button") {
var arrf = peach.greeting[0].answerType;
for (i = 0; i < arrf.length; i++) {
$('img.image').attr(arrf[i], 'return false');
}
for (i = 0; i < arrf.length; i++) {
$('.cpricolb').attr(arrf[i], 'return false');
}
var htmlresponse =
}
.attr('onclick', '');
ResponseAction
$('#answer').append(htmlresponse);
$('#response').attr('placeholder', 'Firstname Lastname');
$('#question').append(peach.greeting[0].answerContent);
}
nextstep();
function saveResponse() {
switch (peach.state) {
case '0':
peachuser.fullname = $('#response').val();
$('#clientname').append(peachuser.fullname);
return false;
break;
case '1':
return false;
break;
case '2':
return false;
break;
}
peach.state++;
return false;
}
onclick="peachtopic(laborlaw)";
function getlaborlaw(){
return
}
$(document).keypress(function(e) {
if (e.which == "13") {
}
});
peachtopic('laborlaw/noticeprotection');
function peachtopic(isofname) {
var navButtonGroup = '<button class="ui right floated ui icon button" onclick="cbtn(\'share\');" id="btnshare"><img class="ui mini circular image" src="/corelaio.new/media/btn-share.svg"></button> <button class="ui right floated ui icon button" onclick="cbtn(\'contact\')" id="btncontact"><img class="ui mini circular image" src="/corelaio.new/media/btn-contact.svg"></button> <button class="ui right floated ui icon button" onclick="cbtn(\'menu\')" id="btnmenu"><img class="ui mini circular image" src="/corelaio.new/media/btn-menu.svg"></button>';
///** TBD Semaint ui button elements
switch (isofname) {
case 'laborlaw':
var prepeach = {varprepeachtopic:isofname};
break;
case 'familylaw':
alert(alertcomment+isofname);
break;
case 'trafficlaw':
alert(alertcomment+isofname);
break;
}
console.log(isofname);
prepeach
}
function peachpackage(isofname) {
var alertcomment = "Please give us a call to schedule a meeting for your inquiry about";
switch (isofname) {
case 'laborlaw/noticeprotection':
var prepeach = {varprepeachtopic:isofname};
break;
case 'laborlaw/parttime':
alert(alertcomment+isofname);
break;
case 'laborlaw/leaveentitlement':
alert(alertcomment+isofname);
break;
case 'familylaw/matrimonialagreement':
alert(alertcomment+isofname);
break;
case 'familylaw/divorce':
alert(alertcomment+isofname);
break;
case 'familylaw/alimony':
alert(alertcomment+isofname);
break;
case 'trafficlaw/trafficaccident':
alert(alertcomment+isofname);
break;
case 'trafficlaw/lossoflicense':
alert(alertcomment+isofname);
break;
case 'trafficlaw/insuranceclaims':
alert(alertcomment+" "+isofname);
break;
}
console.log(isofname);
}
//** load functionality
var prepeach = {url:"/peach.new/js/", file:"/peach.json"};
var peachfile = url+topic+file;
$.getScript(peachfile);