%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<div id="content-wrapper"> <div class="container-fluid"> <!-- Breadcrumbs--> <ol class="breadcrumb"> <li class="breadcrumb-item"> <a href="<?php echo site_url('admin/dashboard'); ?>"><i class="fas fa-fw fa-tachometer-alt"></i> Dashboard</a> </li> <li class="breadcrumb-item"> <a href="<?php echo site_url('admin/managesurvey'); ?>"> Survey</a> </li> <li class="breadcrumb-item active"><?php if($sd['id']>0) { echo 'Edit'; } else { echo 'Add'; }?> Question</li> </ol> <!-- Page Content --> <div class="card mb-3 fomr-news"> <div class="card-header card-header-new"> <h3><?php if($sd['id']>0) { echo 'Edit'; } else { echo 'New'; }?> Question</h3></div> </div> <!---- Success Message ----> <div class="card-body "> <!---- Success Message ----> <?php if ($this->session->flashdata('success')) { ?> <p style="color:green; font-size:18px;"><?php echo $this->session->flashdata('success'); ?></p> </div> <?php } ?> <!---- Error Message ----> <?php if ($this->session->flashdata('error')) { ?> <p style="color:red; font-size:18px;"><?php echo $this->session->flashdata('error');?></p> <?php } ?> <?php echo form_open('admin/managesurvey/addquestion'); ?> <div class="form-group"> <div class="form-row"> <div class="container-fluid"> <?php if(!empty($sd)) { $type = $sd['type']; $id = $sd['id']; $frm_option = $sd['frm_option']; $frm_hindi_option = $sd['frm_hindi_option']; } ?> <div class="col-lg-12"> <div class="row"> <div class="col-sm-4 border-right"> <input type="hidden" class="form-control" name="id" id="id" value="<?=$sd['id']?>" /> <input type="hidden" name="sid" value="<?php echo isset($_GET['sid']) ? $_GET['sid'] : '' ?>"> <div class="form-group"> <label for="" class="control-label">Question (English)</label> <input type="text" name="question" id="" class="form-control" value="<?=$sd['question']?>" /> <?php echo form_error('question',"<div style='color:red'>","</div>");?> </div> <div class="form-group"> <label for="" class="control-label">Question (हिन्दी)</label> <input type="text" name="hindi_question" id="" class="form-control" value="<?=$sd['hindi_question']?>" /> <?php echo form_error('hindi_question',"<div style='color:red'>","</div>");?> </div> <div class="form-group"> <label for="" class="control-label">Question Answer Type</label> <select name="type" id="type" class="custom-select "> <option value="" disabled="" selected="">Please Select here</option> <option value="radio_opt" <?php echo isset($type) && $type == 'radio_opt' ? 'selected':'' ?>>Single Answer/Radio Button</option> <option value="check_opt" <?php echo isset($type) && $type == 'check_opt' ? 'selected':'' ?>>Multiple Answer/Check Boxes</option> <option value="textfield_s" <?php echo isset($type) && $type == 'textfield_s' ? 'selected':'' ?>>Text Field/ Text Area</option> <option value="textfield_b" <?php echo isset($type) && $type == 'textfield_b' ? 'selected':'' ?>>Text Area</option> </select> </div> <div class="form-group"> <label for="" class="control-label">Display Order</label> <input type="text" name="order_by" onkeyup="this.value=this.value.replace(/[^\d]/,'')" id="order_by" class="form-control" value="<?=$sd['order_by']?>" /> <?php echo form_error('order_by',"<div style='color:red'>","</div>");?> </div> <div class="form-group"> <label for="" class="control-label">Status</label> <select name="status" id="status" class="custom-select "> <option value="" disabled="" selected="">Please Select status</option> <option value="1" <?php if($sd['status']=='1'){ echo 'selected'; } ?>>Active</option> <option value="0" <?php if($sd['status']=='0'){ echo 'selected'; } ?>>Inactive</option> </select> <?php echo form_error('status',"<div style='color:red'>","</div>");?> </div> <div class="form-group text-left"> <br /> <a href="<?=base_url('admin/managesurvey')?>" class="btn btn-secondary"> Cancel</a> <?php if ($_POST['id']) {?> <input type="hidden" name='id' value="<?=$_POST['id']?>" /> <?php echo form_submit(['name'=>'addrecord','value'=>'Update Record','class'=>'button2']); ?> <?php } else { ?> <?php echo form_submit(['name'=>'addrecord','value'=>'Save Record','class'=>'button2']);?> <?php } ?> </div> </div> <div class="col-sm-8"> <b>Preview</b> <div class="preview"> <?php if(!isset($id)): ?> <center><b>Select Question Answer type first.</b></center> <?php else: ?> <div class="callout callout-info"> <?php if(!in_array($type, array('textfield_s','textfield_b'))): $opt= $type =='radio_opt' ? 'radio': 'checkbox'; ?> <table width="100%" class="table"> <colgroup> <col width="10%"> <col width="80%"> <col width="10%"> </colgroup> <thead> <tr class=""> <th class="text-center"></th> <th class="text-center"> <label for="" class="control-label">Label</label> </th> <th class="text-center"></th> </tr> </thead> <tbody> <?php $i = 0; $frm_option = $sd['frm_option']; $frm_hindi_option = $sd['frm_hindi_option']; foreach(json_decode($frm_option) as $k => $v): $i++; ?> <tr class=""> <td class="text-center"> <div class="icheck-primary d-inline" data-count = '<?php echo $i ?>'> <input type="<?php echo $opt ?>" id="<?php echo $opt ?>Primary<?php echo $i ?>" name="<?php echo $opt ?>" checked=""> <label for="<?php echo $opt ?>Primary<?php echo $i ?>"> </label> </div> </td> <td class="text-center"> <input type="text" class="form-control form-control-sm check_inp" name="label[]" value="<?php echo $v ?>"> </td> <td class="text-center"></td> </tr> <?php endforeach; ?> </tbody> </table> <div class="row"> <div class="col-sm-12 text-center"> <button class="btn btn-sm btn-flat btn-default" type="button" onclick="<?php echo $type ?>($(this))"><i class="fa fa-plus"></i> Add</button> </div> </div> </div> </div> <?php else: ?> <?php if(trim($type)=='textfield_s'): ?> <input type="text" name="frm_opt" id="" cols="30" rows="10" class="form-control" disabled="" placeholder="Write Something here..."> <?php else: ?> <?php if(trim($type)=='textfield_b'): ?> <?php if(!empty(base64_decode($frm_option))){ ?> <p> <label>English</label> <br/> <textarea name="frm_textarea_opt_value" id="frm_textarea_opt_div" cols="30" rows="10" class="form-control" placeholder="Write Something here..."><?php echo base64_decode($frm_option); ?></textarea> </p> <p> <label>Hindi</label> <br/> <textarea name="frm_hindi_option" id="frm_hindi_option" cols="30" rows="10" class="form-control" placeholder="Write Hindi Ans here..."><?php echo base64_decode($sd['frm_hindi_option']); ?></textarea> </p> <?php } ?> <?php endif; ?> <?php endif; ?> <?php endif; ?> <?php endif; ?> </div> </div> </div> </div> </div> <div id="check_opt_clone" style="display: none"> <div class="callout callout-info"> <table width="100%" class="table"> <tbody> <tr class=""> <td class="text-center"> <div class="icheck-primary d-inline" data-count = '1'> <input type="checkbox" id="checkboxPrimary1" checked=""> <label for="checkboxPrimary1"> </label> </div> </td> <td class="text-center"> <input type="text" class="form-control form-control-sm check_inp" name="label[]"> </td> <td class="text-center"></td> </tr> <tr class=""> <td class="text-center"> <div class="icheck-primary d-inline" data-count = '2'> <input type="checkbox" id="checkboxPrimary2" > <label for="checkboxPrimary2"> </label> </div> </td> <td class="text-center"> <input type="text" class="form-control form-control-sm check_inp" name="label[]"> </td> <td class="text-center"></td> </tr> </tbody> </table> <div class="row"> <div class="col-sm-12 text-center"> <button class="btn btn-sm btn-flat btn-default" type="button" onclick="new_check($(this))"><i class="fa fa-plus"></i> Add</button> </div> </div> </div> </div> <div id="radio_opt_clone" style="display: none"> <div class="callout callout-info"> <table width="100%" class="table"> <tbody> <tr class=""> <td class="text-center"> <div class="icheck-primary d-inline" data-count = '1'> <input type="radio" id="radioPrimary1" name="radio" checked=""> <label for="radioPrimary1"> </label> </div> </td> <td class="text-center"> <input type="text" class="form-control form-control-sm check_inp" name="label[]"> </td> <td class="text-center"></td> </tr> <tr class=""> <td class="text-center"> <div class="icheck-primary d-inline" data-count = '2'> <input type="radio" id="radioPrimary2" name="radio" > <label for="radioPrimary2"> </label> </div> </td> <td class="text-center"> <input type="text" class="form-control form-control-sm check_inp" name="label[]"> </td> <td class="text-center"></td> </tr> </tbody> </table> <div class="row"> <div class="col-sm-12 text-center"> <button class="btn btn-sm btn-flat btn-default" type="button" onclick="new_radio($(this))"><i class="fa fa-plus"></i> Add</button> </div> </div> </div> </div> <div id="textfield_s_clone" style="display: none"> <div class="callout callout-info"> <input type="text" name="frm_opt" id="" cols="30" rows="10" class="form-control" disabled="" placeholder="Write Something here..."> </div> </div> <div id="textfield_b_clone" style="display: none"> <div class="callout callout-info"> <?php if(empty($frm_option)){ ?> <textarea name="frm_textarea_opt" id="frm_textarea_opt" cols="30" rows="10" class="form-control1" placeholder="Write Something here..."></textarea> <script> CKEDITOR.replace( 'frm_textarea_opt' ); </script> <?php } ?> </div> </div> </form> </div> </div> </div> </div> <script> function new_check(_this){ var tbody=_this.closest('.row').siblings('table').find('tbody') var count = tbody.find('tr').last().find('.icheck-primary').attr('data-count') count++; console.log(count) var opt = ''; opt +='<td class="text-center pt-1"><div class="icheck-primary d-inline" data-count = "'+count+'"><input type="checkbox" id="checkboxPrimary'+count+'"><label for="checkboxPrimary'+count+'"> </label></div></td>'; opt +='<td class="text-center"><input type="text" class="form-control form-control-sm check_inp" name="label[]"></td>'; opt +='<td class="text-center"><a href="javascript:void(0)" onclick="$(this).closest(\'tr\').remove()"><span class="fa fa-times" ></span></a></td>'; var tr = $('<tr></tr>') tr.append(opt) tbody.append(tr) } function new_radio(_this){ var tbody=_this.closest('.row').siblings('table').find('tbody') var count = tbody.find('tr').last().find('.icheck-primary').attr('data-count') count++; console.log(count) var opt = ''; opt +='<td class="text-center pt-1"><div class="icheck-primary d-inline" data-count = "'+count+'"><input type="radio" id="radioPrimary'+count+'" name="radio"><label for="radioPrimary'+count+'"> </label></div></td>'; opt +='<td class="text-center"><input type="text" class="form-control form-control-sm check_inp" name="label[]"></td>'; opt +='<td class="text-center"><a href="javascript:void(0)" onclick="$(this).closest(\'tr\').remove()"><span class="fa fa-times" ></span></a></td>'; var tr = $('<tr></tr>') tr.append(opt) tbody.append(tr) } function check_opt(){ var check_opt_clone = $('#check_opt_clone').clone() $('.preview').html(check_opt_clone.html()) } function radio_opt(){ var radio_opt_clone = $('#radio_opt_clone').clone() $('.preview').html(radio_opt_clone.html()) } function textfield_s(){ var textfield_s_clone = $('#textfield_s_clone').clone() $('.preview').html(textfield_s_clone.html()) } function textfield_b(){ var textfield_b_clone = $('#textfield_b_clone').clone() $('.preview').html(textfield_b_clone.html()) } $('[name="type"]').change(function(){ window[$(this).val()]() }) $(function () { $('#manage-question').submit(function(e){ e.preventDefault() start_load() // $('#msg').html('') $.ajax({ url:'ajax.php?action=save_question', data: new FormData($(this)[0]), cache: false, contentType: false, processData: false, method: 'POST', type: 'POST', success:function(resp){ if(resp == 1){ alert_toast('Data successfully saved.',"success"); setTimeout(function(){ location.reload() },1500) } } }) }) }) </script>