/var/www/hkosl.com/m.musiccircle/tutor_profile.php


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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
<?php include('_init.php');

    if (
$_SESSION["is_tutor"] != 1) {
        
header("Location: index.php");
        exit;
    }

    
$sql         "select profile_id,(select id from `tutor_main` where cmsloginid = tb.user_id LIMIT 1) as id
                    from `profile_user` as tb where user_id = ? and deleted = ? LIMIT 1"
;
    
$parameters  = array($_SESSION['cmsloginid'], 0);
    
$row_profile bind_pdo($sql$parameters"selectone");

    
$row get_teacher($row_profile['id']);

    if (
$row) {
        
$action              'Modify'// Add or Modify
        
$sql                 "select * from `tutor_cert` where tutormain_id = ? and deleted = ?";
        
$parameters          = array($row['id'], 0);
        
$count_expstudentage bind_pdo($sql$parameters"selectall");

        
$sql                   "select * from `tutor_instrumentquali` where tutormain_id = ? and deleted = ?";
        
$parameters            = array($row['id'], 0);
        
$count_instrumentquali bind_pdo($sql$parameters"selectall");

        
$sql99        "SELECT * FROM sys_cms_login WHERE cmsloginid=?";
        
$parameters99 = array((int)$row{'cmsloginid'});
        
$row_user     bind_pdo($sql99$parameters99"selectone");
    } else {
        
$action 'Add'// Add or Modify
    
}

    
$sql             "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters      = array('TEACH_VENUS'0);
    
$rows_teachvenus bind_pdo($sql$parameters"selectall");

    
$sql                 "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters          = array('MUSTHEORY_GRADE'0);
    
$rows_mustheorygrade bind_pdo($sql$parameters"selectall");

    
$sql            "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters     = array('TEACH_MODE'0);
    
$rows_teachmode bind_pdo($sql$parameters"selectall");

    
$sql           "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters    = array('TEACH_EXP'0);
    
$rows_teachexp bind_pdo($sql$parameters"selectall");

    
$sql                "select * from master_type_code where typeid = ? and deleted = ? order by sort ASC";
    
$parameters         = array('EXPSTUDENTAGE'0);
    
$rows_expstudentage bind_pdo($sql$parameters"selectall");

    
$sql                  "select * from master_type_code where typeid = ? and deleted = ? order by sort asc";
    
$parameters           = array('INSTRUMENT_TYPE'0);
    
$rows_instrument_type bind_pdo($sql$parameters"selectall");

    
$sql        "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters = array('RESIDENCE_CODE'0);
    
$rows_area2 bind_pdo($sql$parameters"selectall");

    
$sql        "select * from master_type_code where typeid = ? and deleted = ?";
    
$parameters = array('TEACH_AREACODE'0);
    
$rows_area  bind_pdo($sql$parameters"selectall");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <? include('_head.php'); ?>
    <script type="text/javascript" src="js/facebook.js"></script>
    <link href="css/style_k.css?v=<?= time(); ?>" type="text/css" rel="stylesheet">

    <style>
        label {
            font-weight: 100;
            margin-right: 10px;
        }

        label input[type="checkbox"] {
            margin-right: 3px;
        }

        label.col-sm-2 {
            margin-right: 0px;
            font-weight: bold;
        }

        .LiTutorCertClass, .LiInstrumentqualiClass {
            margin-bottom: 5px;
        }

        .LiInstrumentqualiClass .form-control {
            margin-right: 3px;
        }

        input[type=file] {
            margin-right: 3px;
            width: 80%;
        }

        .form-del {
            height: 30px;
            width: auto;
        }

        input[type=file], .form-del {
            display: inline-block;
        }

        .nav-tabs > li > a {
            color: #999;
            border: 1px solid #ededed;
        }

        .box-header .col-md-12 {
            padding: 0;
        }

        .box-body .col-sm-2, .box-body .col-sm-10 {
            padding: 0;
        }
    </style>
    <script type="text/javascript" src="js/facebook.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
    <script>
        function age(dateString) {
            var a = moment(moment(), "YYYY-MM");
            var b = moment(moment(dateString, "YYYY-MM"));
            return a.diff(b, 'years');
        }

        function del(_this) {
            //$(thisform).parent().remove();
            $(_this).closest(".row_container").remove();
            $(_this).parent().remove();
        }

        function add_cert() {
            var html = '<div class="LiTutorCertClass"><input type="file" class="form-control input-sm" name="tutor_cert[file][]"><input type="button" value="X" onClick="del(this)" class="form-del"></div>';
            $('#LiTutorCertBox').append(html);
        }
        function add_instrumentquali() {
            var html = '<div class="LiInstrumentqualiClass"><select class="form-control input-sm" name="instrumentquali[mas_instrument][]" data-value="" style="width:29%; display:inline-block;"><option value="">-樂器-</option><? foreach($rows_instrument_type as $row_instrument_type){?><?
                $sql 
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ? order by sort asc";
                
$parameters = array('INSTRUMENT'$row_instrument_type['code'], 0);
                
$rows_instrument bind_pdo($sql$parameters"selectall");
                
?><optgroup label="<?= $row_instrument_type['name_' get_langcode()] ?>"><? foreach($rows_instrument as $row_instrument){?><option value="<?=$row_instrument['id']?>"><?=$row_instrument['name_' get_langcode()]?></option><? }?></optgroup><? }?></select><select class="form-control input-sm" name="instrumentquali[grade][]" data-value="" style="width:25%; display:inline-block;"><option value=""></option><? foreach($rows_mustheorygrade as $row_mustheorygrade){?><option value="<?=$row_mustheorygrade['id']?>"><?=$row_mustheorygrade['name_' get_langcode()]?></option><? }?></select><select class="form-control input-sm" name="instrumentquali[year][]" data-value="" style="width:25%; display:inline-block;"><option value=""></option><? for($i date('Y');$i >= date('Y') - 100;$i--){?><option value="<?=$i?>"><?=$i?></option><? }?></select><input type="button" value="X" onClick="del(this)" class="form-del"></div>';
            $('#LiInstrumentqualiBox').append(html);
        }
        $(function () {
            $('#sel1_area').change(
                function () {
                    //console.log('#sel1_position'+$(this).val());
                    $('.dropdown-menu').hide();
                    $('#sel1_position' + $(this).val()).show();
                }
            );
        })
    </script>
<body>

<? include('_header.php'?>


<?php include('_dialog.php'?>

<div class="ProfileContent">
    <div class="Profilecontainer">
        <div class="row">
            <div class="col-md-12">
                <?php
                    
if (!empty($_GET["update"])) {
                        echo 
'<div class="tc msg_text">' _lang("Updated") . '</div>';
                    }
                
?>
                <form action="tutor_process.php" class="myform" id="myform" method="POST" enctype="multipart/form-data">
                    <? if ($row['id']) { ?>
                        <input type="hidden" name="id" value="<?= _h($row['id']) ?>"/>
                    <? ?>
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">

                                </div>

                                <!-- /.box-header -->
                                <div class="box-body">
                                    <br>
                                    <? if ($row["tutor_no"]) { ?>
                                        <div class="row">
                                            <div class="col-md-12 form-group">
                                                <label for="" class="col-sm-2 control-label">
                                                    <?= _lang("Code"?>
                                                </label>
                                                <div class="col-sm-10"><?= $row["tutor_no"?></div>
                                            </div>
                                        </div>
                                    <? ?>

                                    <?php /* ?>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label">
                                                <?= _lang("Facebook") ?>
                                            </label>
                                            <div class="col-sm-10"><? if ($row['facebook_id']) { ?>
                                                    <input type="button" value="<?= _lang("Connected") ?>" id="LiConnectFB" class="btn" style="width:200px;">
                                                <? } else { ?>
                                                    <input type="button" value="<?= _lang("Connect") ?>" id="LiConnectFB" sname="<?= _lang("Connected") ?>" class="btn" style="width:200px;" onclick="statusChangeCallback()">
                                                    <div style="color:#F00; display:none;" class="error" id="fbError">
                                                        <?= _lang('Your facebook acc. have been used') ?>
                                                    </div>
                                                <? } ?></div>
                                        </div>
                                    </div>
                                    <?php */ 
?>

                                    <div class="row">
                                        <div class="col-md-10 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= _lang('Profile Picture'?>
                                            </label>
                                            <div class="col-sm-10">
                                                <div id="image_container" style="width: 100%;">
                                                    <span style="font-size: 12px; color: #0012ff;">請先選擇圖片,在畫板中可移動選擇範圍,選擇合適的範圍後按"確定"裁剪,圖片必須裁剪,否則無法保存</span>
                                                    <div id="image"></div>
                                                </div>

                                                <div class="crop_image_container" style="margin-bottom: 10px;">
                                                    <? if (!empty($row['profilephoto_path'])) { ?>
                                                        <div style="margin-bottom:5px;" class="img ori_image">

                                                            <img src="<?= $site_info["url"?>file/teacher/<?= $row['profilephoto_path'?>" width="150"/>
                                                            <input type="hidden" name="profilephoto_path_on" value="1" class="existed_image"/>
                                                        </div>
                                                    <? ?>

                                                    <div id="cropped_img_container" style="display: none; margin-bottom: 5px;">
                                                        <img src="" id="cropped_img" style="width: 200px;margin-top: 10px; border: 1px #ccc solid;"/>
                                                        <input type="hidden" name="base64_profilephoto_path" id="base64_img" class="base64_img" value="">
                                                    </div>

                                                    <input type="file" class="" id="inputImage" name="profilephoto_path" accept="image/*" style="width: 75px;">
                                                    <? if ($row['profilephoto_path']) { ?>
                                                        <input type="button" value="刪除圖片" onclick="delphoto(this)" style="margin-left: 10px;"/><? ?>

                                                    <button type="button" class="crop_image btn btn-primary" style="margin-left: 15px;">
                                                        確定
                                                    </button>

                                                    <div id="profilephoto_path_Error" style="color:#F00; display:none;" class="error">
                                                        請上載最少一張圖片及按確定
                                                    </div>
                                                    <div style="color:#F00; display:none;" class="error" id="uploadError">
                                                        <?= _lang("Size Limit: 1mb, Format: jpeg, jpg, png, pdf"?>
                                                    </div>
                                                    <div style="color:#F00; display:none;" class="error" id="uploadError2">
                                                        <?= _lang("Uploaded file size cannot over 1 MB."?>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label">
                                                <?= lang('Nick Name'?>
                                            </label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" name="nickname" size="50" maxlength="255" value="<?= $row['nickname'?>">
                                                <div style="color:#F00; display:none;" class="error" id="nicknameError"><?= _lang("Please enter nickname."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= lang('Chinese Name'?>
                                                <br>
                                                <font color="#0012ff" style="font-size:12px; font-weight:100;">(<?= _lang("must same as your identification card"?>
                                                    )</font> </label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" name="name_cn" size="50" maxlength="255" value="<?= $row['name_cn'?>" required>
                                                <div style="color:#F00; display:none;" class="error" id="namecnError"><?= _lang("Please enter chinese name."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= lang('English Name'?>
                                                <br>
                                                <font color="#0012ff" style="font-size:12px; font-weight:100;">(<?= _lang("must same as your identification card"?>
                                                    )</font> </label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" name="name_en" size="50" maxlength="255" value="<?= $row['name_en'?>" required>
                                                <div style="color:#F00; display:none;" class="error" id="nameenError"><?= _lang("Please enter english name."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= lang('Gender'?>
                                            </label>
                                            <div class="col-sm-10"><label>
                                                    <input type="radio" name="gender" value="m" <? if ($row['gender'] == 'm') { ?> checked<? ?> required/>
                                                    <?= lang('Male'?>
                                                </label> <label>
                                                    <input type="radio" name="gender" value="f" <? if ($row['gender'] == 'f') { ?> checked<? ?> required/>
                                                    <?= lang('Female'?>
                                                </label>
                                                <div style="color:#F00; display:none;" class="error" id="genderError"><?= _lang("Please select gender."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= lang('Date of Birth'?>
                                            </label>
                                            <div class="col-sm-10">
                                                <select class="form-control input-sm" name="dob_mon" data-value="" style="width:30%; display:inline-block;" required>
                                                    <option value="">MM</option>
                                                    <? for ($i 1$i <= 12$i++) { ?>
                                                        <option value="<?= $i ?><? if ($i == $row['dob_mon']){ ?>selected<? ?>>
                                                            <?= $i ?>
                                                        </option>
                                                    <? ?>
                                                </select>
                                                <select class="form-control input-sm" name="dob_year" data-value="" style="width:50%; display:inline-block;">
                                                    <option value="">YYYY</option>
                                                    <? for ($i date('Y'); $i >= date('Y') - 100$i--) { ?>
                                                        <option value="<?= $i ?><? if ($i == $row['dob_year']){ ?>selected<? ?>>
                                                            <?= $i ?>
                                                        </option>
                                                    <? ?>
                                                </select>
                                                <div style="color:#F00; display:none;" class="error" id="dobError"><?= _lang("Please enter date of birth."?></div>
                                                <div style="color:#F00; display:none;" class="error" id="dobError2"><?= _lang("Tutor age should be larger than 18."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label">
                                                <?= lang('Email'?>
                                            </label>
                                            <div class="col-sm-10"><? if (aes_crypt($row['email'], 2)) { ?>
                                                    <div style="margin-bottom:7px;">
                                                        <?= aes_crypt($row['email'], 2?>
                                                    </div>
                                                <? } else { ?>
                                                    <input type="text" class="form-control" name="email" size="50" maxlength="255" value="<?= aes_crypt($row['email'], 2?>">
                                                    <div style="color:#F00; display:none;" class="error" id="emailError"><?= _lang("Please enter email."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="emailError2"><?= _lang("Please check email format."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="emailError3"><?= _lang("This email has used by someone."?></div>
                                                <? ?></div>
                                        </div>
                                    </div>


                                        <div class="row">
                                            <div class="col-md-12 form-group">
                                                <label for="" class="col-sm-2 control-label">
                                                    <?= _lang("Password"?>
                                                </label>
                                                <div class="col-sm-10">
                                                    <input type="password" class="form-control" name="password" size="50" maxlength="255" value="">
                                                    <div style="color:#0012ff;" id="passwordBox"><?= _lang('Password should include lower letter, upper letter, number and special characters.'); ?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="passwordError"><?= _lang("Please enter password."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="passwordError3"><?= _lang("Password must contain at least 8 characters."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="passwordError2"><?= _lang("Password and confirm password should be same."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="passwordError4"><?= _lang("Password strength is not enough. Password should include lower letter, upper letter, number and special characters."?></div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label">
                                                <?= _lang("Confirm Password"?>
                                            </label>
                                            <div class="col-sm-10">
                                                <input type="password" class="form-control" name="repassword" size="50" maxlength="255" value="">
                                                <div style="color:#F00; display:none;" class="error" id="repasswordError"><?= _lang("Please enter confirm password."?></div>
                                            </div>
                                        </div>
                                        </div>

                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field">
                                                <?= _lang("Identification Card"?> <br>
                                                <font color="#0012ff" style="font-size:12px; font-weight:100;">(<?= _lang("first 3 numbers"?>
                                                    )</font> </label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" name="idno" size="3" maxlength="3" value="<?= aes_crypt($row['idno'], 2?>">
                                                <div style="color:#F00; display:none;" class="error" id="idnoError"><?= _lang("Please enter identification number."?></div>
                                                <div style="color:#F00; display:none;" class="error" id="idnoError2"><?= _lang("Identification card should be digital number."?></div>
                                                <div style="color:#F00; display:none;" class="error" id="idnoError3"><?= _lang("Must enter 3 digital number."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Mobile'?></label>
                                            <div class="col-sm-10"><? if (($row_profile['profile_id'] == || $row_profile['profile_id'] == 2) && $row['isphoneverified'] == 0) { ?>
                                                    <input type="text" class="form-control" name="mobno" size="8" maxlength="8" value="<?= aes_crypt($row['mobno'], 2?>">
                                                    <div style="color:#F00; display:none;" class="error" id="mobnoError"><?= _lang("Please enter mobile number."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="mobnoError2"><?= _lang("Mobile number should be digital number."?></div>
                                                    <div style="color:#F00; display:none;" class="error" id="mobnoError3"><?= _lang("Mobile number has used by someone."?></div>
                                                <? } else { ?>
                                                    <? if ($row['mobno']) { ?>
                                                        <?= aes_crypt($row['mobno'], 2?>
                                                    <? } else { ?>
                                                        <input type="text" class="form-control" name="mobno" size="8" maxlength="8" value="<?= aes_crypt($row['mobno'], 2?>">
                                                        <div style="color:#F00; display:none;" class="error" id="mobnoError"><?= _lang("Please enter mobile number."?></div>
                                                        <div style="color:#F00; display:none;" class="error" id="mobnoError2"><?= _lang("Mobile number should be digital number."?></div>
                                                        <div style="color:#F00; display:none;" class="error" id="mobnoError3"><?= _lang("Mobile number has used by someone."?></div>
                                                    <? ?>
                                                <? ?>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label"><?= _lang('Home Tel'?></label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" name="hometelno" size="50" maxlength="255" value="<?= aes_crypt($row['hometelno'], 2?>">
                                                <div style="color:#F00; display:none;" class="error" id="hometelnoError2"><?= _lang("Home telephone number should be digital number."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Residence'?></label>
                                            <div class="col-sm-10">
                                                <select class="form-control input-sm" name="mas_residencecode" data-value="">
                                                    <option value=""></option>
                                                    <? foreach ($rows_area2 as $row_area) { ?>
                                                        <?
                                                        $sql           
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ?";
                                                        
$parameters    = array('RESIDENCE_POSITIONCODE'$row_area['code'], 0);
                                                        
$rows_position bind_pdo($sql$parameters"selectall");
                                                        
?>
                                                        <optgroup label="<?= $row_area['name_' get_langcode()] ?>">
                                                            <? foreach ($rows_position as $row_position) { ?>
                                                                <option value="<?= $row_position['id'?><? if ($row_position['id'] == $row['mas_residencecode']){ ?>selected<? ?>>
                                                                    <?= $row_position['name_' get_langcode()] ?>
                                                                </option>
                                                            <? ?>
                                                        </optgroup>
                                                    <? ?>
                                                </select>
                                                <div style="color:#F00; display:none;" class="error" id="residencecodeError"><?= _lang("Please select residence area."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Teaching area'?></label>
                                            <div class="col-sm-10">
                                                <div style="color:#F00; display:none;" class="error" id="areaError"><?= _lang("Please select teaching area."?></div>
                                                <ul class="nav nav-tabs" id="myTab">
                                                    <? foreach ($rows_area as $index => $row_area) { ?>
                                                        <li <? if ($index == 0){ ?>class="active"<? ?> >
                                                            <a data-target="#area<?= $index ?>" data-toggle="tab" style="cursor:pointer; border-radius: 0px;">
                                                                <?= $row_area['name_' get_langcode()] ?>
                                                            </a></li>
                                                    <? ?>
                                                </ul>
                                                <div class="tab-content" style="padding-top:0px;">
                                                    <? foreach ($rows_area as $index => $row_area) { ?>
                                                        <?
                                                        $sql           
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ?";
                                                        
$parameters    = array('TEACH_POSITIONCODE'$row_area['code'], 0);
                                                        
$rows_position bind_pdo($sql$parameters"selectall");
                                                        
?>
                                                        <div class="tab-pane <? if ($index == 0) { ?>active<? ?>" id="area<?= $index ?>" style="border:1px solid #ddd; border-top:0px; padding:15px; ">
                                                            <? foreach ($rows_position as $row_position) { ?>
                                                                <?
                                                                $sql        
"select * from tutor_teachareacode where tutormain_id = ? and mas_teachareacode = ? and deleted = ?";
                                                                
$parameters = array($row['id'], $row_position['id'], 0);
                                                                
$count_area bind_pdo($sql$parameters"selectone");
                                                                
?>
                                                                <span style="float:left; width:100px; margin-bottom:5px; display:block;">
                                                                    <input type="checkbox" name="area<?= $row_area['id'?>[]" class="areabox" value="<?= $row_position['id'?><? if ($count_area['id']) { ?> checked<? ?>>
                                                                    <?= $row_position['name_' get_langcode()] ?>
                                                                    <input type="hidden" name="arearefid<?= $row_area['id'?>[]" value="<?= $count_area['id'?>"/>
                                                                    <input class="form-control" style="width:80px; margin-right:10px;" name="studenhome_addcharge<?= $row_area['id'?>[]" placeholder="$0.00" value="<?= $count_area['studenhome_addcharge'?>">
                                                                </span>
                                                            <? ?>
                                                            <span style="clear:both; display:block;"></span></div>
                                                    <? ?>
                                                    <div style="clear:both;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Teaching Site'?></label>
                                            <div class="col-sm-10"><? foreach ($rows_teachvenus as $row_teachvenus) { ?>
                                                    <?
                                                    $sql              
"select * from tutor_teachvenus where tutormain_id = ? and mas_teachvenus = ? and deleted = ?";
                                                    
$parameters       = array($row['id'], $row_teachvenus['id'], 0);
                                                    
$count_teachvenus bind_pdo($sql$parameters"selectone");
                                                    
?>
                                                    <label>
                                                        <input name="teachvenus_id[]" type="checkbox" value="<?= $row_teachvenus['id'?><? if ($count_teachvenus['id']){ ?>checked<? ?>>
                                                        <?= $row_teachvenus['name_' get_langcode()] ?>
                                                    </label>
                                                <? ?>
                                                <div style="color:#F00; display:none;" class="error" id="teachvenusError"><?= _lang("Please select teaching site."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= _lang("Teaching Experience"?></label>
                                            <div class="col-sm-10">
                                                <select class="form-control input-sm" name="mas_teachexp" data-value="">
                                                    <option value=""></option>
                                                    <? foreach ($rows_teachexp as $row_teachexp) { ?>
                                                        <option value="<?= $row_teachexp['id'?><? if ($row_teachexp['id'] == $row['mas_teachexp']){ ?>selected<? ?>>
                                                            <?= $row_teachexp['name_' get_langcode()] ?>
                                                        </option>
                                                    <? ?>
                                                </select>
                                                <div style="color:#F00; display:none;" class="error" id="teachexpError"><?= _lang("Please select teaching experience."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Teaching Mode'?>
                                                <br>
                                                <font color="#0012ff" style="font-size:12px; font-weight:100;"><?= _lang("Small Classes"?>
                                                    - <?= _lang("Tutor must be able to provide musical instrument rental service"?></font></label>
                                            <div class="col-sm-10"><? foreach ($rows_teachmode as $row_teachmode) { ?>
                                                    <?
                                                    $sql             
"select * from tutor_teachmode where tutormain_id = ? and mas_teachmode = ? and deleted = ?";
                                                    
$parameters      = array($row['id'], $row_teachmode['id'], 0);
                                                    
$count_teachmode bind_pdo($sql$parameters"selectone");
                                                    
?>
                                                    <label>
                                                        <input name="teachmode_id[]" type="checkbox" value="<?= $row_teachmode['id'?><? if ($count_teachmode['id']){ ?>checked<? ?>>
                                                        <?= $row_teachmode['name_' get_langcode()] ?>
                                                    </label>
                                                <? ?>
                                                <div style="color:#F00; display:none;" class="error" id="teachmodeError"><?= _lang("Please select teaching mode."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Provide / Rent Musical Instruments To Student'?></label>
                                            <div class="col-sm-10"><label>
                                                    <input name="cansupplyinstrument" type="checkbox" value="1" <? if ($row['cansupplyinstrument'] == 1){ ?>checked<? ?>>
                                                    <?= lang('Possible'?>
                                                </label>
                                                <div style="color:#F00; display:none;" class="error" id="cansupplyinstrumentError"><?= _lang("If you select Tutor Home, Tutor must be able to provide musical instrument rental service"?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Musical Instruments Curriculum Vitae'?></label>
                                            <div class="col-sm-10">
                                                <div id="LiInstrumentqualiBox">
                                                    <? foreach ($count_instrumentquali as $res_instrumentquali) { ?>
                                                        <div class="row row_container">
                                                            <div class="LiInstrumentqualiClass" style="margin-bottom: 10px;">
                                                                <div class="col-md-4">
                                                                    <select class="form-control input-sm" name="instrumentquali[mas_instrument][]" data-value="" style="width:100%; display:inline-block;">
                                                                        <option value="">
                                                                            -<?= _lang("Musical Instrument"?>
                                                                            -
                                                                        </option>
                                                                        <? foreach ($rows_instrument_type as $row_instrument_type) { ?>
                                                                            <?
                                                                            $sql             
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ? order by sort asc";
                                                                            
$parameters      = array('INSTRUMENT'$row_instrument_type['code'], 0);
                                                                            
$rows_instrument bind_pdo($sql$parameters"selectall");
                                                                            
?>
                                                                            <optgroup label="<?= $row_instrument_type['name_' get_langcode()] ?>">
                                                                                <? foreach ($rows_instrument as $row_instrument) { ?>
                                                                                    <option value="<?= $row_instrument['id'?><? if ($row_instrument['id'] == $res_instrumentquali['mas_instrument']){ ?>selected<? ?>>
                                                                                        <?= str_replace('\n'''$row_instrument['name_' get_langcode()]) ?>
                                                                                    </option>
                                                                                <? ?>
                                                                            </optgroup>
                                                                        <? ?>
                                                                    </select>
                                                                </div>

                                                                <div class="col-md-4">
                                                                    <select class="form-control input-sm" name="instrumentquali[grade][]" data-value="" style="width:100%; display:inline-block;">
                                                                        <option value=""></option>
                                                                        <? foreach ($rows_mustheorygrade as $row_mustheorygrade) { ?>
                                                                            <option value="<?= $row_mustheorygrade['id'?><? if ($row_mustheorygrade['id'] == $res_instrumentquali['grade']){ ?>selected<? ?>>
                                                                                <?= $row_mustheorygrade['name_' get_langcode()] ?>
                                                                            </option>
                                                                        <? ?>
                                                                    </select>
                                                                </div>

                                                                <div class="col-md-4">
                                                                    <div class="row">
                                                                        <div class="col-md-9 col-xs-9">
                                                                            <select class="form-control input-sm" name="instrumentquali[year][]" data-value="" style="width:100%; display:inline-block;">
                                                                                <option value=""></option>
                                                                                <? for ($i date('Y'); $i >= date('Y') - 100$i--) { ?>
                                                                                    <option value="<?= $i ?><? if ($i == $res_instrumentquali['year']){ ?>selected<? ?>>
                                                                                        <?= $i ?>
                                                                                    </option>
                                                                                <? ?>
                                                                            </select>
                                                                        </div>

                                                                        <div class="col-md-3 col-xs-3" style="text-align: right;">
                                                                            <input type="button" value="X" onClick="del(this)" class="form-del">
                                                                        </div>
                                                                    </div>

                                                                </div>

                                                            </div>
                                                        </div>

                                                    <? ?>
                                                </div>

                                                <div style="margin-top: 10px;">
                                                    <input type="button" value="+" class="form-del" onClick="add_instrumentquali()">
                                                </div>
                                                <div style="color:#F00; display:none;" class="error" id="instrumentError"><?= _lang("Please fill musical instruments resume."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label"><?= lang('Upload Music Certificate'?>
                                                <br>
                                                <font color="#0012ff" style="font-size:12px; font-weight:100;">
                                                    可whatsapp後補<br>
                                                    (<?= _lang("Size Limit: 1mb, Format: jpeg, jpg, png, pdf"?>
                                                    )</font></label>
                                            <div class="col-sm-10">
                                                <div id="LiTutorCertBox">
                                                    <? foreach ($count_expstudentage as $res_expstudentage) { ?>
                                                        <div class="LiTutorCertClass row_container" style="margin-bottom: 10px;">
                                                            <? if ($res_expstudentage['cert_path']) { ?>
                                                                <div style="margin-bottom:5px;">
                                                                    <a href="iframe.php?url=<?=$site_info["url"]?>file/teacher/<?= $res_expstudentage['cert_path'?>"><?= _lang("View"?></a>
                                                                </div>
                                                            <? ?>
                                                            <input type="hidden" name="tutor_cert[id][]" value="<?= $res_expstudentage['id'?>"/>
                                                            <input type="file" class="form-control input-sm" name="tutor_cert[file][]">
                                                            <input type="button" value="X" onClick="del(this)" class="form-del">
                                                        </div>
                                                    <? ?>
                                                </div>
                                                <div>
                                                    <input type="button" value="+" class="form-del" onClick="add_cert()">
                                                </div>
                                                <div style="color:#F00; display:none;" class="error" id="certError"><?= _lang("Please upload musical instrument certification."?></div>
                                                <div style="color:#F00; display:none;" class="error" id="certError2"><?= _lang("Size Limit: 1mb, Format: jpeg, jpg, png, pdf"?></div>
                                                <div style="color:#F00; display:none;" class="error" id="certError3"><?= _lang("Uploaded file size cannot over 1 MB."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label"><?= lang('Describe Myself'?>
                                                <br><font color="#0012ff" style="font-size:12px; font-weight:100;">(<?= _lang("Up to 60 characters, content should not include any personal contact information."?>
                                                    )</font></label>
                                            <div class="col-sm-10">
                                                <input class="form-control" name="self_describemyself" type="text" value="<?= $row['self_describemyself'?>" maxlength="60"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Self Introduction'?>
                                                <br><font color="#0012ff" style="font-size:12px; font-weight:100;">(<?= _lang("Up to 500 characters, content should not include any personal contact information."?>
                                                    )</font></label>
                                            <div class="col-sm-10">
                                                <textarea class="form-control" name="self_intro" rows="5" maxlength="500"><?= $row['self_intro'?></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Expect Student Age'?></label>
                                            <div class="col-sm-10"><? foreach ($rows_expstudentage as $row_expstudentage) { ?>
                                                    <?
                                                    $sql                 
"select * from `tutor_expstudentage` where tutormain_id = ? and mas_expstudentage = ? and deleted = ?";
                                                    
$parameters          = array($row['id'], $row_expstudentage['id'], 0);
                                                    
$count_expstudentage bind_pdo($sql$parameters"selectone");
                                                    
?>
                                                    <label>
                                                        <input name="expstudentage_id[]" type="checkbox" value="<?= $row_expstudentage['id'?><? if ($count_expstudentage['id']){ ?>checked<? ?>>
                                                        <?= $row_expstudentage['name_' get_langcode()] ?>
                                                    </label>
                                                <? ?>
                                                <div style="color:#F00; display:none;" class="error" id="expstudentageError"><?= _lang("Please select Expected Students Age."?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label required_field"><?= lang('Select teaching musical instruments'?></label>
                                            <div class="col-sm-10">
                                                <div style="color:#F00; display:none;" class="error" id="expectchargeError"><?= _lang("Please select a teaching musical instruments"?></div>
                                                <ul class="nav nav-tabs" id="myTab">
                                                    <? for ($i 1$i <= 10$i++) { ?>
                                                        <li <? if ($i == 1){ ?>class="active"<? ?>>
                                                            <a data-target="#instrument<?= $i ?>" data-toggle="tab" style="cursor:pointer;" class="instruments_a"><?= _lang("Musical Instrument"?> <?= $i ?>
                                                            </a></li>
                                                    <? ?>
                                                </ul>
                                                <div class="tab-content" style="border:1px solid #ddd; border-top:0px; padding:15px;">
                                                    <!--<div class="scroll_left_right_container">
                                                        <div class="scroll_left_right">
                                                            <img src="../img/scroll_left_right.png">
                                                        </div>
                                                    </div>-->

                                                    <? for ($i 1$i <= 10$i++) { ?>
                                                        <?
                                                        $sql          
"select * from tutor_charge where tutormain_id = ? and instrument_no = ? and deleted = ?";
                                                        
$parameters   = array($row['id'], $i0);
                                                        
$count_charge bind_pdo($sql$parameters"selectone");
                                                        
//print_r($count_charge);
                                                        
?>
                                                        <!-- Tab <?= $i ?> -->

                                                        <div class="tab-pane <? if ($i == 1) { ?>active<? ?>" id="instrument<?= $i ?>" style="overflow:auto;">

                                                            <div class="Expection">
                                                                <div class="HalfLeft">
                                                                    <div class="BoxTitle"><?= _lang("Musical Instrument"?></div>
                                                                    <select name="tutor_expectcharge[mas_instrument<?= $i ?>]" class="form-control">
                                                                        <option value="">
                                                                            -<?= _lang("Musical Instrument"?>
                                                                            -
                                                                        </option>
                                                                        <? foreach ($rows_instrument_type as $row_instrument_type) { ?>
                                                                            <?
                                                                            $sql             
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ? order by sort asc";
                                                                            
$parameters      = array('INSTRUMENT'$row_instrument_type['code'], 0);
                                                                            
$rows_instrument bind_pdo($sql$parameters"selectall");
                                                                            
?>
                                                                            <optgroup label="<?= $row_instrument_type['name_' get_langcode()] ?>">
                                                                                <? foreach ($rows_instrument as $row_instrument) { ?>
                                                                                    <option value="<?= $row_instrument['id'?><? if ($count_charge['mas_instrument'] == $row_instrument['id']){ ?>selected<? ?>>
                                                                                        <?= $row_instrument['name_' get_langcode()] ?>
                                                                                    </option>
                                                                                <? ?>
                                                                            </optgroup>
                                                                        <? ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="ChargeTable">
                                                                <div class="BoxTitle required_field"><?= _lang("Expected Fee"?>
                                                                    ($)
                                                                </div>
                                                                <div style="color:#F00; display:none;" class="error" id="expectchargeError<?= $i ?>"><?= _lang("Please enter at least one expected charge."?></div>
                                                                <table class="table">
                                                                    <thead>
                                                                    <tr>
                                                                        <th><?= _lang("Grade"?></th>
                                                                        <th>30 <?= _lang('mins'?></th>
                                                                        <th>45 <?= _lang('mins'?></th>
                                                                        <th>60 <?= _lang('mins'?></th>
                                                                    </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                    <? for ($a 1$a <= 9$a++) { ?>
                                                                        <?
                                                                        
unset($count_expectcharge);
                                                                        if (
$count_charge['id']) {
                                                                            
$sql                "select * from tutor_expectcharge where charge_id = ? and type = ? and grade = ? and deleted = ?";
                                                                            
$parameters         = array($count_charge['id'], 'fee'$a0);
                                                                            
$count_expectcharge bind_pdo($sql$parameters"selectone");
                                                                        }
                                                                        
?>
                                                                        <tr>
                                                                            <th scope="row"><? if ($a == 9) { ?>
                                                                                    <?= _lang("Over level 8"?>
                                                                                <? } else { ?>
                                                                                    <?= $a ?>
                                                                                <? ?></th>
                                                                            <td>
                                                                                <input name="tutor_expectcharge[charge_30min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_30min'?>">
                                                                            </td>
                                                                            <td>
                                                                                <input name="tutor_expectcharge[charge_45min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_45min'?>">
                                                                            </td>
                                                                            <td>
                                                                                <input name="tutor_expectcharge[charge_60min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_60min'?>">
                                                                            </td>
                                                                        </tr>
                                                                    <? ?>
                                                                    </tbody>
                                                                </table>
                                                                <hr>

                                                                <div class="BoxTitle required_field"><?= _lang("Trial Fee"?>
                                                                    ($)
                                                                    <font color="#0012ff" style="font-size:12px; font-weight:100;">(預設試堂為2堂)</font>
                                                                </div>
                                                                <div style="color:#F00; display:none;" class="error" id="testchargeError<?= $i ?>"><?= _lang("Please enter at least one trial fee."?></div>
                                                                <table class="table" style="margin-bottom:0px;">
                                                                    <thead>
                                                                    <tr>
                                                                        <th><?= _lang("Grade"?></th>
                                                                        <th>30 <?= _lang('mins'?></th>
                                                                        <th>45 <?= _lang('mins'?></th>
                                                                        <th>60 <?= _lang('mins'?></th>
                                                                    </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                    <? for ($a 1$a <= 3$a++) { ?>
                                                                        <?
                                                                        
unset($count_expectcharge);
                                                                        if (
$count_charge['id']) {
                                                                            
$sql                "select * from tutor_expectcharge where charge_id = ? and type = ? and grade = ? and deleted = ?";
                                                                            
$parameters         = array($count_charge['id'], 'tfee'$a0);
                                                                            
$count_expectcharge bind_pdo($sql$parameters"selectone");
                                                                        }
                                                                        
?>
                                                                        <tr>
                                                                            <th scope="row"><? if ($a == 1) { ?>
                                                                                    1 - 2
                                                                                <? } else if ($a == 2) { ?>
                                                                                    3 - 5
                                                                                <? } else if ($a == 3) { ?>
                                                                                    <?= _lang("6 or above 6"?>
                                                                                <? ?></th>
                                                                            <td>
                                                                                <input type="text" name="tutor_expectcharge[t_charge_30min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_30min'?>" class="inputPrice testcharge">
                                                                            </td>
                                                                            <td>
                                                                                <input type="text" name="tutor_expectcharge[t_charge_45min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_45min'?>" class="inputPrice testcharge">
                                                                            </td>
                                                                            <td>
                                                                                <input type="text" name="tutor_expectcharge[t_charge_60min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_60min'?>" class="inputPrice testcharge">
                                                                            </td>
                                                                        </tr>
                                                                    <? ?>
                                                                    <tr>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                        </div>
                                                    <? ?>
                                                    <div style="clear:both;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label"><?= lang('Provide Accompaniment'?></label>
                                            <div class="col-sm-10"><label>
                                                    <input name="canaccompany" type="checkbox" value="1" <? if ($row['canaccompany'] == 1){ ?>checked<? ?>>
                                                    <?= lang('Possible'?>
                                                </label>
                                            </div>
                                        </div>
                                    </div>

                                    <?php if ($row_profile['profile_id'] == || $row_profile['profile_id'] == 2) { ?>

                                        <div class="row">
                                            <div class="col-md-12 form-group">
                                                <label for="" class="col-sm-2 control-label"><?= lang('Recommend'?></label>
                                                <div class="col-sm-10"><label>
                                                        <input name="recommend" type="checkbox" value="1" <? if ($row['recommend'] == 1){ ?>checked<? ?>>
                                                        <?= lang('Yes'?>
                                                    </label></div>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-md-12 form-group">
                                                <label for="" class="col-sm-2 control-label"><?= lang('Youtube'?></label>
                                                <div class="col-sm-10">
                                                    <input name="youtube" type="text" value="<?= $row["youtube"?>">
                                                    <div class="msg">eg: https://www.youtube.com/watch?v=youtubecode
                                                        <br>請複制 "youtubecode",然後貼上。
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php ?>
                                    <!-- End Content -->

                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label for="" class="col-sm-2 control-label"><?= _lang("Registraion Date"?></label>
                                            <div class="col-sm-10"><?= $row['createdate'?></div>
                                        </div>
                                        <div class="col-md-12 form-group" style="color: #F00;">
                                            <label for="" class="col-sm-2 control-label"><?= lang("* Required Field"?></label>
                                            <br><br><br>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-12 tc">
                                            <div class="btn-group">
                                                <? if ($row_profile['profile_id'] != 3) { ?>
                                                    <?
                                                    
if ($row['isemailverified'] == && $row['email']) {
                                                        
$status 3;
                                                    } else if (
$row['status'] > 2) {
                                                        
$status 2;
                                                    } else if (
$row['status'] <= 2) {
                                                        
$status 1;
                                                    }
                                                    
?>

                                                    <? $show '&type=detail"'?>
                                                    <?php if ($row['approved'] != 1) { ?>
                                                        <a href="<?= $page_settings['domain'?>_approved.php?id=<?= $row['id'] . $show ?>" class="btn btn-default btn-warning" style="color:#FFF;">
                                                            <i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
                                                            <?= _lang('Wait to confirm the edit'?>
                                                        </a>
                                                    <?php } else { ?>
                                                        <a href="<?= $page_settings['domain'?>_approved.php?id=<?= $row['id'] . $show ?>" class="btn btn-default btn-success" style="color:#FFF;">
                                                            <i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i>
                                                            <?= _lang('Confirmed'?>
                                                        </a>
                                                    <?php ?>
                                                    <?php if ($row['status'] != 4) { ?>
                                                        <a href="<?= $page_settings['domain'?>_status.php?id=<?= $row['id'] . $show ?>" class="btn btn-default btn-warning" style="color:#FFF;">
                                                            <i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
                                                            <?= _lang('Wait for Approval'?>
                                                        </a>
                                                    <?php } else { ?>
                                                        <a href="<?= $page_settings['domain'?>_status.php?id=<?= $row['id'] . $show ?>" class="btn btn-default btn-success" style="color:#FFF;">
                                                            <i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i>
                                                            <?= _lang('Approved'?>
                                                        </a>
                                                    <?php ?>
                                                <? } else { ?>
                                                    <? if ($row['approved'] == 1) { ?>
                                                        <button type="button" class="btn  btn-success ">
                                                            <i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i><?= _lang('Confirmed'?>
                                                        </button>
                                                    <? } else { ?>
                                                        <button type="button" class="btn  btn-warning ">
                                                            <i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i><?= _lang('Wait to confirm the edit'?>
                                                        </button>
                                                    <? ?>
                                                <? ?>
                                                <? if (($row_profile['profile_id'] == || $row_profile['profile_id'] == 2) && $row['isemailverified'] == && $row['email']) { ?>
                                                    <a href="<?= $page_settings['domain'?>_email.php?id=<?= $row['id'?>&status=<?= $status ?>" class="btn btn-success ">
                                                        <i class="fa fa-envelope-o" aria-hidden="true"></i> <?= _lang('Resend Email Verification'?>
                                                    </a>

                                                    <a href="<?= $page_settings['domain'?>_email_verify.php?id=<?= $row['id'?>&status=<?= $status ?>" class="btn  btn-warning " style="margin-top: 0">
                                                        <i class="fa fa-envelope-o" aria-hidden="true"></i> <?= _lang('Pass Email Verification'?>
                                                    </a>
                                                <? ?>
                                                <? if (($row_profile['profile_id'] == || $row_profile['profile_id'] == 2) && $row['isphoneverified'] == && $row['mobno']) { ?>
                                                    <a href="<?= $page_settings['domain'?>_tel.php?id=<?= $row['id'?>&status=<?= $status ?>" class="btn  btn-warning " style="margin-top: 0">
                                                        <i class="fa fa-mobile" aria-hidden="true"></i> <?= _lang('Pass Tel Verification'?>
                                                    </a>
                                                <? ?>
                                                <button type="button" class="btn btn-primary" id="LiSaveBtn">
                                                    <i class="fa fa-floppy-o" aria-hidden="true"></i> <?= _lang('Save'?>
                                                </button>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                                <!-- /.box-body -->
                            </div>
                            <!-- /.box -->
                        </div>
                        <!-- /.col -->
                    </div>
                    <!-- /.row -->
                </form>
            </div>
        </div>
    </div>
</div>

<? include('_footer.php'?>

<script type="text/javascript">

    $(document).ready(function (e) {
        $('#LiSaveBtn').click(
            function () {
                var thisform = $('#myform');
                $.post('_ajax.php', {
                    ajax: 'checkEmail',
                    email: $('input[name="email"]', thisform).val(),
                    password: $('input[name="password"]', thisform).val(),
                    <? if($row['id']){?>
                    id: <?=$row['id']?>
                    <? }?>
                }, function (json) {
                    var json1 = JSON.parse(json);
                    $.post('_ajax.php', {
                        ajax: 'checkTel',
                        type: 'tutor',
                        mobno: $('input[name="mobno"]', thisform).val()
                    }, function (json) {
                        var json2 = JSON.parse(json);
                        var focus_array = new Array();
                        var error = false;
                        $('.error').hide();
                        <? if(!$row['profilephoto_path']){?>
                        /*if (!$('input[name="profilephoto_path"]', thisform).val()) {
                            focus_array[focus_array.length] = $('input[name="profilephoto_path"]', thisform);
                            $("#photoError").show();
                            error = true;
                        }*/

                        if (!$('#base64_img', thisform).val()) {
                            focus_array[focus_array.length] = $('input[name="profilephoto_path"]', thisform);
                            $("#profilephoto_path_Error").show();
                            error = true;
                        }
                        <? }else{ ?>
                        if($(".ori_image").length <= 0 && !$('#base64_img', thisform).val()){
                            focus_array[focus_array.length] = $('input[name="profilephoto_path"]', thisform);
                            $("#profilephoto_path_Error").show();
                            error = true;
                        }
                        <? ?>
                        if (!$('input[name="nickname"]', thisform).val()) {
                            $("#nicknameError").show();
                            focus_array[focus_array.length] = $('input[name="nickname"]', thisform);
                            error = true;
                        }
                        if (!$('input[name="name_cn"]', thisform).val()) {
                            $("#namecnError").show();
                            focus_array[focus_array.length] = $('input[name="name_cn"]', thisform);
                            error = true;
                        }
                        if (!$('input[name="name_en"]', thisform).val()) {
                            $("#nameenError").show();
                            focus_array[focus_array.length] = $('input[name="name_en"]', thisform);
                            error = true;
                        }
                        if (!$('input[name="gender"]:checked', thisform).val()) {
                            $("#genderError").show();
                            focus_array[focus_array.length] = $('input[name="gender"]', thisform);
                            error = true;
                        }
                        if (!$('select[name="dob_mon"]', thisform).val() || !$('select[name="dob_year"]', thisform).val()) {
                            $("#dobError").show();
                            if (!$('select[name="dob_mon"]', thisform).val()) {
                                focus_array[focus_array.length] = $('select[name="dob_mon"]', thisform);
                            } else if (!$('select[name="dob_year"]', this).val()) {
                                focus_array[focus_array.length] = $('select[name="dob_year"]', thisform);
                            }
                            error = true;
                        } else {
                            if (age($('select[name="dob_year"]', thisform).val() + '-' + $('select[name="dob_mon"]', thisform).val() + '-1') < 18) {
                                focus_array[focus_array.length] = $('select[name="dob_mon"]', thisform);
                                $("#dobError2").show();
                                error = true;
                            }
                        }
                        <? if(!$row['id']){?>
                        if (!$('input[name="email"]', thisform).val()) {
                            $("#emailError", thisform).show();
                            focus_array[focus_array.length] = $('input[name="email"]', thisform);
                            error = true;
                        } else {
                            if (!/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('input[name="email"]', thisform).val())) {
                                $("#emailError2", thisform).show();
                                focus_array[focus_array.length] = $('input[name="email"]', thisform);
                                error = true;
                            } else {
                                if (json1.email_status == true || json1.user_status == true) {
                                    $("#emailError3", thisform).show();
                                    focus_array[focus_array.length] = $('input[name="email"]', thisform);
                                    error = true;
                                }
                            }
                        }
                        <? }?>

                        <? if(!$row['id']){?>
                        if (!$('input[name="password"]', thisform).val()) {
                            $("#passwordError", thisform).show();
                            focus_array[focus_array.length] = $('input[name="password"]', thisform);
                            error = true;
                        } else {
                            <?php } else { ?>
                            if ($('input[name="password"]', thisform).val()) {
                                <?php ?>
                                if (json1.password_status == false) {
                                    $("#passwordBox", thisform).hide();
                                    $("#passwordError4", thisform).show();
                                    focus_array[focus_array.length] = $('input[name="password"]', thisform);
                                    error = true;
                                }
                                if ($('input[name="password"]', thisform).val().length < 8) {
                                    $("#passwordError3", thisform).show();
                                    focus_array[focus_array.length] = $('input[name="password"]', thisform);
                                    error = true;
                                }
                                if (!$('input[name="repassword"]', thisform).val()) {
                                    focus_array[focus_array.length] = $('input[name="password"]', thisform);
                                    $("#repasswordError", thisform).show();
                                    error = true;
                                }
                                if ($('input[name="password"]', thisform).val() && $('input[name="repassword"]', thisform).val()) {
                                    if ($('input[name="password"]', thisform).val() != $('input[name="repassword"]', thisform).val()) {
                                        focus_array[focus_array.length] = $('input[name="password"]', thisform);
                                        $("#passwordError2", thisform).show();
                                        error = true;
                                    }
                                }
                            }

                        if (!$('input[name="idno"]', thisform).val()) {
                            $("#idnoError").show();
                            focus_array[focus_array.length] = $('input[name="idno"]', thisform);
                            error = true;
                        } else {
                            var num = $('input[name="idno"]', thisform).val();
                            if (num.length != 3) {
                                $("#idnoError3").show();
                                focus_array[focus_array.length] = $('input[name="idno"]', thisform);
                                error = true;
                            } else if ($.isNumeric(num) == false) {
                                $("#idnoError2").show();
                                focus_array[focus_array.length] = $('input[name="idno"]', thisform);
                                error = true;
                            }
                        }
                        if (!$('select[name="mas_residencecode"]', thisform).val()) {
                            $("#residencecodeError").show();
                            focus_array[focus_array.length] = $('select[name="mas_residencecode"]', thisform);
                            error = true;
                        }
                        <? if(!$row['mobno'] || (($row_profile['profile_id'] == || $row_profile['profile_id'] == 2) && $row['isphoneverified'] == 0)){?>
                        if (!$('input[name="mobno"]', thisform).val()) {
                            $("#mobnoError").show();
                            focus_array[focus_array.length] = $('input[name="mobno"]', thisform);
                            error = true;
                        } else {
                            var num = $('input[name="mobno"]', thisform).val();
                            if ($.isNumeric(num) == false) {
                                $("#mobnoError2").show();
                                focus_array[focus_array.length] = $('input[name="mobno"]', thisform);
                                error = true;
                            } else if (json2.mobno_status == true) {
                                $("#mobnoError3", thisform).show();
                                focus_array[focus_array.length] = $('input[name="mobno"]', thisform);
                                error = true;
                            }
                        }
                        <? }?>
                        if ($('input[name="teachvenus_id[]"]:checked', thisform).size() <= 0) {
                            $("#teachvenusError").show();
                            focus_array[focus_array.length] = $('input[name="teachvenus_id[]"]', thisform);
                            error = true;
                        }
                        if (!$('select[name="mas_teachexp"]', thisform).val()) {
                            $("#teachexpError").show();
                            focus_array[focus_array.length] = $('select[name="mas_teachexp"]', thisform);
                            error = true;
                        }
                        if ($('input[name="teachmode_id[]"]:checked', thisform).size() <= 0) {
                            $("#teachmodeError").show();
                            focus_array[focus_array.length] = $('input[name="teachmode_id[]"]', thisform);
                            error = true;
                        } else {
                            $('input[name="teachmode_id[]"]:checked', thisform).each(
                                function () {
                                    if ($(this).val() == 2) {
                                        if ($('input[name="cansupplyinstrument"]:checked').val() != 1) {
                                            $("#cansupplyinstrumentError").show();
                                            focus_array[focus_array.length] = $('input[name="cansupplyinstrument"]', this);
                                            error = true;
                                        }
                                    }
                                }
                            );
                        }
                        if ($('#LiInstrumentqualiBox .LiInstrumentqualiClass').size() > 0) {
                            $('#LiInstrumentqualiBox .LiInstrumentqualiClass').each(
                                function () {
                                    if ($(this).parent().attr('id') != 'MusicalCVBox') {
                                        if (!$('select[name="instrumentquali[mas_instrument][]"]', this).val() || !$('select[name="instrumentquali[grade][]"]', this).val()
                                            || !$('select[name="instrumentquali[year][]"]', this).val()) {
                                            $("#instrumentError").show();
                                            error = true;
                                            if (!$('select[name="instrumentquali[mas_instrument][]"]', this).val()) {
                                                focus_array[focus_array.length] = $('select[name="instrumentquali[mas_instrument][]"]', this);
                                            } else if (!$('select[name="instrumentquali[grade][]"]', this).val()) {
                                                focus_array[focus_array.length] = $('select[name="instrumentquali[grade][]"]', this);
                                            } else if (!$('select[name="instrumentquali[year][]"]', this).val()) {
                                                focus_array[focus_array.length] = $('select[name="instrumentquali[year][]"]', this);
                                            }
                                        }
                                    }
                                }
                            );
                        } else {
                            $("#instrumentError").show();
                            error = true;
                        }

                        if ($('#LiTutorCertBox .LiTutorCertClass').size() > 0) {
                            $('#LiTutorCertBox .LiTutorCertClass').each(
                                function () {
                                    if ($(this).parent().attr('id') != 'certBox') {
                                        if (!$('input[name="tutor_cert[id][]"]', this).val()) {
                                            if (!$('input[name="tutor_cert[file][]"]', this).val()) {
                                                $("#certError").show();
                                                focus_array[focus_array.length] = $('input[name="tutor_cert[file][]"]', this);
                                                error = true;
                                            } else {
                                                var check = false;
                                                var str = $('input[name="tutor_cert[file][]"]', this).val();
                                                var checkArray = new Array('PNG', 'png', 'JPEG', 'jpeg', 'JPG', 'jpg', 'pdf', 'PDF');
                                                for (var i = 0; i < checkArray.length; i++) {
                                                    if (str.indexOf(checkArray[i]) > 0) {
                                                        check = true;
                                                    }
                                                }
                                                if (check == false) {
                                                    $("#certError2").show();
                                                    focus_array[focus_array.length] = $('input[name="tutor_cert[id][]"]', this);
                                                    error = true;
                                                } else {
                                                    var total_upload_qualification_file_size = 0;
                                                    if ($('input[name="tutor_cert[file][]"]', this)[0].files[0]) {
                                                        total_upload_qualification_file_size += parseFloat($('input[name="tutor_cert[file][]"]', this)[0].files[0].size / 1048576);
                                                    }
                                                    if (total_upload_qualification_file_size > 1) {
                                                        $("#certError3").show();
                                                        focus_array[focus_array.length] = $('input[name="tutor_cert[id][]"]', this);
                                                        error = true;
                                                    }
                                                }
                                            }
                                        } else {
                                            if ($('input[name="tutor_cert[file][]"]', this).val()) {
                                                var check = false;
                                                var str = $('input[name="tutor_cert[file][]"]', this).val();
                                                var checkArray = new Array('PNG', 'png', 'JPEG', 'jpeg', 'JPG', 'jpg', 'pdf', 'PDF');
                                                for (var i = 0; i < checkArray.length; i++) {
                                                    if (str.indexOf(checkArray[i]) > 0) {
                                                        check = true;
                                                    }
                                                }
                                                if (check == false) {
                                                    $("#certError2").show();
                                                    focus_array[focus_array.length] = $('input[name="tutor_cert[id][]"]', this);
                                                    error = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            );
                        } else {
                            //$("#certError").show();
                            //focus_array[focus_array.length] = $('input[name="tutor_cert[id][]"]',thisform);
                            //error = true;
                        }
                        if (!$('.areabox:checked').size()) {
                            $("#areaError").show();
                            focus_array[focus_array.length] = $('.tab-pane.active .areabox').eq(0);
                            error = true;
                        }
                        if ($('input[name="expstudentage_id[]"]:checked', thisform).size() == 0) {
                            $("#expstudentageError").show();
                            focus_array[focus_array.length] = $('input[name="expstudentage_id[]"]').eq(0);
                            error = true;
                        }
                        var check = 0;
                        for (var i = 1; i <= 10; i++) {
                            var count = 0;
                            var count2 = 0;
                            if ($('select[name="tutor_expectcharge[mas_instrument' + i + ']"]').val()) {
                                check++;
                                $('#instrument' + i + ' .expectcharge').each(
                                    function () {
                                        if ($(this).val()) {
                                            count++;
                                        }
                                    }
                                );
                                if (count == 0) {
                                    $("#expectchargeError" + i).show();
                                    focus_array[focus_array.length] = $('#instrument' + i + ' .expectcharge').eq(0);
                                    error = true;
                                }
                                //
                                $('#instrument' + i + ' .testcharge').each(
                                    function () {
                                        if ($(this).val()) {
                                            count2++;
                                        }
                                    }
                                );
                                if (count2 == 0) {
                                    $("#testchargeError" + i).show();
                                    focus_array[focus_array.length] = $('#instrument' + i + ' .testcharge').eq(0);
                                    error = true;
                                }
                            }
                        }
                        if (check == 0) {
                            $("#expectchargeError").show();
                            focus_array[focus_array.length] = $('.tab-pane.active .form-control').eq(0);
                            error = true;
                        }
                        if (error == false) {
                            $("#myform").submit();
                            //return true;
                        } else {
                            //focus_array[0].focus();
                            console.log(focus_array[0]);
                            /*$('html, body').animate({
                                scrollTop: $(focus_array[0]).offset().top - 150
                            }, 500);*/

                            $('html, body').animate({
                                scrollTop: $(".error:visible").first().offset().top - 150
                            }, 500);

                            //return false;
                        }
                    });
                });
            }
        );
        /*
         $('.instruments_a').click(
         function(){
         var error = false;
         var s_index = 0;
         for(var i = 0; i<$('.instruments_a').index(this);i++){
         var error_s = false;
         var table = $('#instrument'+(i+1));
         var count = 0;
         var count2 = 0;
         if($('select[name="tutor_expectcharge[mas_instrument'+(i+1)+']"]').val()){
         $('.expectcharge',table).each(
         function(){
         if($(this).val()){
         count++;
         }
         }
         );
         if(count == 0){
         error_s = true;
         }
         //
         $('.testcharge',table).each(
         function(){
         if($(this).val()){
         count2++;
         }
         }
         );
         if(count2 == 0){
         error_s = true;
         }
         if(error_s == false){
         s_index = i;
         }else{
         error = true;
         }
         }else{
         error = true;
         }
         }
         $('.instruments_a').eq(0).click();
         console.log(s_index);
         }
         );*/
        $('textarea[name="self_intro"]').keydown(
            function () {
                if ($(this).val().length > 500) {
                    return false;
                }
            }
        );
        $('.inputPrice,.inputCharge').change(
            function () {
                if (isNaN($(this).val())) {
                    $(this).val('');
                }
            }
        );
    });
    /**/
</script>

<!-- crop image -->
<link href="js/cropper/cropper.css" rel="stylesheet">
<script src="js/cropper/cropper.js"></script>

<script type="text/javascript">
    $(function () {
        var $image = $('#image');

        $(".crop_image").on("click", function () {
            var canvas = $image.cropper('getCroppedCanvas');
            var photo = canvas.toDataURL('image/jpeg');

            $(this).closest(".crop_image_container").find("#cropped_img").attr("src", photo);
            $(this).closest(".crop_image_container").find("#base64_img").attr("value", photo);
            $(this).closest(".crop_image_container").find("#cropped_img_container").show();
            $(this).closest(".crop_image_container").find(".ori_image").hide();

            $("#image_container").hide();
            //console.log(photo);
        });

        var options = {
            aspectRatio: 1,
            cropBoxResizable: false,
            cropBoxMovable: false,
            dragMode: 'move',
            viewMode: '1',
            zoomOnTouch: false,
            zoomOnWheel: false,
            /*autoCropArea: 1,
             strict: false,
             guides: false,
             highlight: false,
             dragCrop: false,
             cropBoxMovable: true,
             cropBoxResizable: true,
             zoomOnTouch: true,
             zoomable: true,
             scalable: true,
             responsive: true,*/
            built: function () {
                // Width and Height params are number types instead of string
                $image.cropper("setCropBoxData", { width: 400, height: 400 });
                $image.cropper("zoomTo", 1);
            }
            /*crop: function (e) {

             }*/
        };

        // Cropper
        $image.on({
            'build.cropper': function (e) {
                //console.log(e.type);
            },
            'built.cropper': function (e) {
                //console.log(e.type);
            },
            'cropstart.cropper': function (e) {
                //console.log(e.type, e.action);
            },
            'cropmove.cropper': function (e) {
                //console.log(e.type, e.action);
            },
            'cropend.cropper': function (e) {
                //console.log(e.type, e.action);
            },
            'crop.cropper': function (e) {
                //console.log(e.type, e.x, e.y, e.width, e.height, e.rotate, e.scaleX, e.scaleY);
            },
            'zoom.cropper': function (e) {
                //console.log(e.type, e.ratio);
            }
        }).cropper(options);


        $("#inputImage").on("change", function () {
            $("#image_container").show();
            location.href = "#image_container";
        });

        // Import image
        crop_function($("#inputImage"), $image);

    });

    function crop_function(_this, $image) {
        var $inputImage = _this;
        var URL = window.URL || window.webkitURL;
        var blobURL;

        if (URL) {
            $inputImage.change(function () {
                var files = this.files;
                var file;

                if (!$image.data('cropper')) {
                    return;
                }

                if (files && files.length) {
                    file = files[0];

                    if (/^image\/\w+$/.test(file.type)) {

                        var img = new Image();
                        img.src = window.URL.createObjectURL(file);
                        img.onload = function () {
                            if (parseInt(img.width) > 10000 || parseInt(img.height) > 10000) {
                                //window.alert('The resolution of image is too large. Please resize your image file under 1024px X 1024px.');
                                alert('圖片解析度過高,請將圖片縮放至少於10000px X 10000px。');
                                $image.cropper('reset');
                                $inputImage.val('');
                            } else {
                                $("#image_container").css("height", "400px");
                                $("#image_container").css("margin-bottom", "70px");

                                blobURL = URL.createObjectURL(file);
                                $image.one('built.cropper', function () {

                                    // Revoke when load complete
                                    URL.revokeObjectURL(blobURL);
                                }).cropper('reset').cropper('replace', blobURL);
                                $inputImage.val('');
                            }
                        }
                    } else {
                        alert('請選擇圖片上傳。');
                    }
                }
            });
        } else {
            $inputImage.prop('disabled', true).parent().addClass('disabled');
        }
    }

    function delphoto(thisform) {
        $(thisform).hide();
        $('.img', $(thisform).parent()).remove();
    }
</script>

</body>
</html>