-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddcase_controller
461 lines (387 loc) · 16.4 KB
/
addcase_controller
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<?php echo Section::start('page-header');?>
<div id="page-content" class="clearfix">
<div class="page-header position-relative">
<h1>
Cases
<small>
<i class="icon-double-angle-right"></i>
Add Case
<?php
$caseno=libautocomplete::case_no();
?>
</small>
</h1>
</div>
</div>
<?php Section::stop();?>
<?php echo Section::start('contentWrapper');?>
<?php $status=Session::get('status');
if(isset($status)){ ?>
<div class="alert-success">
<span><?php echo $status; ?></span>
</div>
<?php }?>
<script>
$(function(){
var case_no=<?php $cas=array();
foreach($caseno as $case)
{
array_push($cas,$case->case_no);
}
echo json_encode($cas);
?>;
$('#case_type').on('focus',function(e){
var msg="case_type";
myfunc(msg,e);
});
$('#case_subject').on('focus',function(e)
{
var msg="case_subject";
myfunc(msg,e);
});
function myfunc(msg,e)
{
var ew=msg;
<?php $value='<script>document.write(this.ew)</script>'?>
var cases1=<?php $cas=array();
foreach($caseno as $case)
{
array_push($cas,$case->$value);
}
echo json_encode($cas);
?>;
$('#'+msg).autocomplete({
source:cases1,
minLength:1
})
}
$('#case_number').autocomplete({
source:case_no,
minLength:1
})
$('#case_name').autocomplete({
source:case_no,
minLength:1
})
});
</script>
<div class="row-fluid">
<div class="span12">
<div class="row-fluid">
<div id="fuelux-wizard" class="row-fluid">
<ul class="wizard-steps">
<li data-target="#step1" class="active" style="min-width: 25%; max-width: 25%;">
<span class="step">1</span>
<span class="title">Case Detail</span>
</li>
<li data-target="#step2" style="min-width: 25%; max-width: 25%;">
<span class="step">2</span>
<span class="title">Advocate Detail</span>
</li>
<li data-target="#step3" style="min-width: 25%; max-width: 25%;">
<span class="step">3</span>
<span class="title">Brief Description</span>
</li>
<li data-target="#step4" style="min-width: 25%; max-width: 25%;">
<span class="step">4</span>
<span class="title">Other Info</span>
</li>
</ul>
</div>
<hr>
<div class="step-content row-fluid position-relative">
<div class="step-pane active" id="step1">
<!-- Case Form-->
<form action="<?php echo URL::to_route('AddCases'); ?>" method="post" class="form-horizontal" id="case-form">
<div class="control-group">
<label class="control-label" for="case_number">Case Number:</label>
<div class="controls">
<input type="text" name="case_no" id="case_number" data-error="Please give a correct login."/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="case_name">Case Name:</label>
<div class="controls">
<input type="text" name="case_name" id="case_name"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="case_type">Case Type:</label>
<div class="controls">
<input type="text" name="case_type" id="case_type"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="case_subject">Case Subject:</label>
<div class="controls">
<input type="text" name="case_subject" id="case_subject">
</div>
</div>
<div class="control-group">
<label class="control-label" for="client_name">Client Name:</label>
<div class="controls">
<select name="client_id" value="" id="client_name" >
<option value="">Client Name</option>
</select>
<span><a href="#">New Client</a></span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="brief_given_by">Brief Given By:</label>
<div class="controls">
<input type="text" name="brief_given_by" value="" id="brief_given_by"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="date_of_filling">Date of Filling:</label>
<div class="controls">
<input type="text" name="date_of_filling" value="" id="date_of_filling" class="date-picker">
</div>
</div>
</form>
</div>
<!-- case Form End-->
<!-- Lawyer Assignment Begins -->
<div class="step-pane" id="step2">
<div class="row-fluid">
<form class="form-horizontal" action="<?php echo URL::to_route('AddCases'); ?>" method="post" id="assign-form" >
<div class="control-group">
<label class="control-label" for="advocate">Advocate:</label>
<div class="controls">
<select name="lawyer_id" id="advocate">
<option value="">Select Advocate</option>
</select>
<span><a href="#">Add New Advocates</a></span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="opp_advocate">Opp. Advocate:</label>
<div class="controls">
<input type="text" name="opp_advocate" id="opp_advocate"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="opp_party_name">Opp.Party Name:</label>
<div class="controls">
<input type="text" id="opp_party_name" name="opp_party_name"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="party_type">Party Type:</label>
<div class="controls">
<input type="text" name="party_type" id="party_type"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="opp_party_type">Opp.Party Type:</label>
<div class="controls">
<input type="text" name="opp_party_type" id="opp_party_type">
</div>
</div>
<div class="control-group">
<label class="control-label" for="court_name">CourtName:</label>
<div class="controls">
<input type="text" name="court_id" id="court_name">
</div>
</div>
</form>
</div>
</div>
<!-- Lawyer Assignment End-->
<!-- Profile Form Begin-->
<div class="step-pane" id="step3">
<div class="row-fluid">
<form action="<?php echo URL::to_route('AddCases'); ?>" method="post" class="form-horizontal" id="description-form">
<div class="control-group">
<label for="claim" class="control-label">Claim</label>
<div class="controls">
<input type="text" name="claim" id="claim"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="citation">Citation Referred/ Title</label>
<div class="controls">
<textarea name="citation_referred" id="citation" rows="2"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="case_description">Case description</label>
<div class="controls">
<textarea name="case_description" id="case_description" rows="2"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="case_color">Select Color</label>
<div class="controls">
<select name="case_color" id="case_color">
<option value="red">Red</option>
<option value="green">Green</option>
<option value="yellow">Yellow</option>
</select>
</div>
</div>
</form>
</div>
</div>
<div class="step-pane" id="step4">
<div class="center">
<h3 class="green">Confirmation!</h3>
Your Client detail add to! Click finish to continue!
<div style="display: none">
<form action="<?php echo URL::to_route('AddCases'); ?>" method="post" id="submit-form" name="toSubmit">
</form>
</div>
</div>
</div>
</div>
<hr>
<div class="row-fluid wizard-actions">
<button class="btn btn-prev">
<i class="icon-arrow-left"></i>
Prev
</button>
<button class="btn btn-success btn-next" data-last="Finish ">
Next
<i class="icon-arrow-right icon-on-right"></i>
</button>
<button class="btn btn-success" style="display: none" id="addNew">
AddNew
</button>
</div>
</div>
</div>
</div>
<?php Section::stop();?>
<?php echo Section::start('javascript-footer'); ?>
<script type="text/javascript">
$('.date-picker').datepicker();
$(function() {
$('[data-rel=tooltip]').tooltip();
$(".chzn-select").css('width','150px').chosen({allow_single_deselect:true , no_results_text: "No such state!"})
.on('change', function(){
$(this).closest('form').validate().element($(this));
});
var $validation = false;
$('#fuelux-wizard').ace_wizard().on('change' , function(e, info){
if(info.step == 1 && $validation) {
if(!$('#validation-form').valid()) return false;
}
}).
on('finished' , function(e, info){
var a=$("#case-form").serialize();
var b=$("#assign-form").serialize();
var c=$("#description-form").serialize();
var tot=a+b+c;
$.post("<?php echo URL::to_route('AddCases') ?>",tot)
});
$('#btnAddNew').click(function(){
alert("ewdfew");
})
$('#skip-validation').removeAttr('checked').on('click', function(){
$validation = this.checked;
if(this.checked) {
$('#case-form').show();
$('#profile-form').show();
}
else {
$('#validation-form').hide();
$('#sample-form').show();
}
});
//documentation : http://docs.jquery.com/Plugins/Validation/validate
$.mask.definitions['~']='[+-]';
$('#phone').mask('(999) 999-9999');
$('#mobile').mask('9999999999');
jQuery.validator.addMethod("phone", function (value, element) {
return this.optional(element) || /^\(\d{3}\) \d{3}\-\d{4}( x\d{1,6})?$/.test(value);
}, "Enter a valid phone number.");
jQuery.validator.addMethod("mobile",function (value,element){
return this.optional(element) || /^d{10}?$/.test(value);
},"Enter Valid Mobile number");
$('#profile-form').validate({
errorElement: 'span',
errorClass: 'help-inline',
focusInvalid: false,
rules: {
email: {
required: true,
email:true
},
password: {
required: true,
minlength: 5
},
password2: {
required: true,
minlength: 5,
equalTo: "#password"
},
name: {
required: true
},
phone: {
required: true,
phone: 'required'
},
url: {
required: true,
url: true
},
comment: {
required: true
},
state: {
required: true
},
platform: {
required: true
},
subscription: {
required: true
},
gender: 'required',
agree: 'required'
},
messages: {
email: {
required: "Please provide a valid email.",
email: "Please provide a valid email."
},
password: {
required: "Please specify a password.",
minlength: "Please specify a secure password."
},
subscription: "Please choose at least one option",
gender: "Please choose gender",
agree: "Please accept our policy"
},
invalidHandler: function (event, validator) { //display error alert on form submit
$('.alert-error', $('.login-form')).show();
},
highlight: function (e) {
$(e).closest('.control-group').removeClass('info').addClass('error');
},
success: function (e) {
$(e).closest('.control-group').removeClass('error').addClass('info');
$(e).remove();
},
errorPlacement: function (error, element) {
if(element.is(':checkbox') || element.is(':radio')) {
var controls = element.closest('.controls');
if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
else error.insertAfter(element.nextAll('.lbl').eq(0));
}
else if(element.is('.chzn-select')) {
error.insertAfter(element.nextAll('[class*="chzn-container"]').eq(0));
}
else error.insertAfter(element);
},
submitHandler: function (form) {
},
invalidHandler: function (form) {
}
});
});
</script>
<?php Section::stop(); ?>
<?php echo render('admin::template.main'); ?>