示例#1
0
function GetPage($res)
{
    $data .= '
	<div id="dialog-form">
	    <fieldset style="width: 430px;  float: left;">
	       <legend>ძირითადი ინფორმაცია</legend>
	       <input id="scenario_id" type="hidden" value="' . $res[scenario_id] . '" />
	       <table class="dialog-form-table">
	           <tr>
	               <td>დამფორმირებელი :</td>
            	   <td>' . $res['main_username'] . '</td>
            	   <td></td>
	           </tr>
    	       <tr>
	               <td style="width: 150px;"><label for="incomming_id">მომართვის №</label></td>
	               <td style="width: 150px;"><label for="incomming_date">შექმნის თარიღი</label></td>
	               <td style="width: 150px;"><label for="incomming_date_up">შევსების თარიღი</label></td>
    	       </tr>
	           <tr>
	               <td><input style="width: 110px;" id="incomming_id" type="text" value="' . $res['id'] . '" disabled></td>
	               <td><input style="width: 125px;" id="incomming_date" type="text" value="' . $res['create_date'] . '" disabled></td>
	               <td><input style="width: 125px;" id="incomming_date_up" type="text" value="' . ($res['update_date'] != '' ? $res['update_date'] : date('Y-m-d H:i:s')) . '" disabled></td>
    	       </tr>
	       </table>
	       <table class="dialog-form-table">	           
    	       <tr>
	               <td style="width: 220px;"><label for="project">პროექტი</label></td>
	               <td style="width: 195px;"><label for="scenario">სცენარი</label></td>
    	       </tr>
	           <tr>
	               <td><input style="width: 185px;" id="project" type="text" value="' . $res['project_name'] . '" disabled></td>
	               <td><input style="width: 185px;" id="scenario" type="text" value="' . $res['scenario_name'] . '" disabled></td>
	           </tr>
	       </table> 
	       <table class="dialog-form-table">
	           <tr>
	               <td style="width: 150px;"><label for="outgoing_status">სტატუსი</label></td>
    	       </tr>
	           <tr>
	               <td><select id="outgoing_status" style="width: 100%;">' . getStatusOut($res['status']) . '</select></td>
	           </tr>	           
    	       <tr>
	               <td style="width: 150px;"><label for="incomming_id">ზარის შესახებ</label></td>
    	       </tr>
	           <tr>
	               <td><textarea style="width: 407px; margin:0;resize:vertical;" id="call_comment" >' . $res['call_comment'] . '</textarea></td>
	           </tr>
	       </table>
	    </fieldset>
	    
        <div id="side_menu" style="float: left;height: 485px;width: 80px;margin-left: 10px; background: #272727; color: #FFF;margin-top: 6px;">
	       <spam class="scenar" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'scenar\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/scenar.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">სცენარი</div></spam>
	       <spam class="info" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'info\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/info.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">ინფო</div></spam>
	       <spam class="task" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'task\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/task.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">დავალება</div></spam>
	       <spam class="sms" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'sms\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/sms.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">SMS</div></spam>
	       <spam class="mail" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'mail\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/mail.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">E-mail</div></spam>
	       <spam class="record" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'record\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/record.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">ჩანაწერი</div></spam>
	       <spam class="file" style="display: block;padding: 10px 5px;  cursor: pointer;" onclick="show_right_side(\'file\')"><img style="padding-left: 22px;padding-bottom: 5px;" src="media/images/icons/file.png" alt="24 ICON" height="24" width="24"><div style="text-align: center;">ფაილი</div></spam>
	    </div>
	    
	    <div style="width: 619px;float: left;margin-left: 10px;" id="right_side">
            <fieldset style="display:none;" id="info">
                <legend>მომართვის ავტორი</legend>
	            <span class="hide_said_menu">x</span>
                
	    
        	    <div id="pers">
	               <table class="margin_top_10">
                           <tr>
                               <td ' . ($res['pid'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_number">პირადი ნომერი</label></td>
                               <td ' . ($res['id_code'] == '' ? 'style="display:none;"' : '') . '><label for="client_number">საიდენტ. ნომერი</label></td>
                           </tr>
                           <tr>
                               <td ' . ($res['pid'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_number" type="text" value="' . $res['pid'] . '"></td>
                               <td ' . ($res['id_code'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_number" type="text" value="' . $res['id_code'] . '"></td>
                           </tr>
                            <tr>
                                <td ' . ($res['firstname'] == '' ? 'style="display:none;"' : '') . '><label for="client_lname">სახელი</label></td>
	                            <td ' . ($res['lastname'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_fname">გვარი</label></td>
                            </tr>
    	                    <tr>
                                <td ' . ($res['firstname'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_lname" type="text" value="' . $res['firstname'] . '"></td>
	                            <td ' . ($res['lastname'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_fname" type="text" value="' . $res['lastname'] . '"></td>
                            </tr>
                        
                            <tr>
                                <td ' . ($res['phone1'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_phone1">ტელეფონი 1</label></td>
        	                    <td ' . ($res['phone2'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_phone2">ტელეფონი 2</label></td>
                            </tr>
    	                    <tr>
                                <td ' . ($res['phone1'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_phone1" type="text" value="' . $res['phone1'] . '"></td>
        	                    <td ' . ($res['phone2'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_phone2" type="text" value="' . $res['phone2'] . '"></td>
                            </tr>
    	                    <tr>
                                <td ' . ($res['mail1'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_mail1">ელ-ფოსტა 1</label></td>
        	                    <td ' . ($res['mail2'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_mail2">ელ-ფოსტა 2</label></td>
                            </tr>
    	                    <tr>
                                <td ' . ($res['mail1'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_mail1" type="text" value="' . $res['mail1'] . '"></td>
        	                    <td ' . ($res['mail2'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_mail2" type="text" value="' . $res['mail2'] . '"></td>
                            </tr>
	                        <tr>
                                <td ' . ($res['address1'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_addres1">მისამართი 1</label></td>
        	                    <td ' . ($res['address2'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_addres2">მისამართი 2</label></td>
                            </tr>
    	                    <tr>
                                <td ' . ($res['address1'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_addres1" type="text" value="' . $res['address1'] . '"></td>
        	                    <td ' . ($res['address2'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_person_addres2" type="text" value="' . $res['address2'] . '"></td>
                            </tr>
                        
        	                <tr>
        	                    <td ' . ($res['note'] == '' ? 'style="display:none;"' : '') . '><label for="client_person_note">შენიშვნა</label></td>
        	                    <td ' . ($res['client_name'] == '' ? 'style="display:none;"' : '') . '><label for="client_name">კლიენტის დასახელება</label></td>
        	                </tr>
        	                <tr>
        	                    <td ' . ($res['note'] == '' ? 'style="display:none;"' : '') . '><textarea id="client_person_note" style="resize: vertical;width: 250px;">' . $res['note'] . '</textarea></td>
        	                    <td ' . ($res['client_name'] == '' ? 'style="display:none;"' : '') . '><input style="width: 250px;" id="client_name" type="text" value="' . $res['client_name'] . '"></td>
        	                </tr>
    	                </table>
        	    </div>
	    
            </fieldset>
        	                        
        	<fieldset style="display:none;height: 465px;" id="scenar">
                <legend>სცენარი</legend>
	            <span class="hide_said_menu">x</span>';
    $my_scenario = $res[scenario_id];
    $query = mysql_query("SELECT \t`question`.id,\r\n                            \t    `question`.`name`,\r\n                            \t    `question`.note,\r\n                            \t    `scenario`.`name`,\r\n                            \t    `scenario_detail`.id AS sc_det_id,\r\n                            \t    `scenario_detail`.`sort`\r\n                    \t    FROM    `scenario`\r\n                    \t    JOIN    scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                    \t    JOIN    question ON scenario_detail.quest_id = question.id\r\n                    \t    WHERE   scenario.id = {$my_scenario} AND scenario_detail.actived = 1\r\n                    \t    ORDER BY scenario_detail.sort ASC");
    $data .= '
	
		            <button who="0" id="show_all_scenario" style="float: right; margin-top: 15px;">ყველას ჩვენება</button><div class="clear"></div>';
    if ($res[id] == '') {
        $inc_id = 0;
        $inc_checker = " AND scenario_results.outgoing_campaign_detail_id = 0";
    } else {
        $inc_id = $res[id];
        $inc_checker = " AND scenario_results.outgoing_campaign_detail_id = {$res['id']}";
    }
    while ($row = mysql_fetch_array($query)) {
        $last_q = mysql_query(" SELECT question_detail.id\r\n                    \t        FROM `question_detail`\r\n                    \t        JOIN scenario_detail ON scenario_detail.quest_id = question_detail.quest_id\r\n                    \t        AND scenario_detail.scenario_id = {$my_scenario}\r\n                    \t        WHERE question_detail.quest_id = {$row['0']}");
        $data .= '<div style="" class="quest_body ' . $row[5] . '" id="' . $row[0] . '">
		            <table class="dialog-form-table">
		    		<tr>
						<td style="font-weight:bold;">' . $row[5] . '. ' . $row[1] . ' <img onclick="imnote(\'' . $row[5] . '\')" style="border: none;padding: 0;margin-left: 8px;margin-top: -7px;cursor: pointer;" src="media/images/icons/kitxva.png" alt="14 ICON" height="24" width="24"></td>
		                </tr><tr style="display:none;" id="imnote_' . $row[5] . '" ><td>' . $row[2] . '</td></tr>
		                    ';
        while ($last_a = mysql_fetch_array($last_q)) {
            $query1 = mysql_query(" SELECT CASE \tWHEN question_detail.quest_type_id = 1 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\" ',IF(scenario_results.outgoing_campaign_detail_id = {$inc_id} && question_detail.id = scenario_results.question_detail_id,'checked','') ,' class=\"check_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"checkbox\" name=\"checkbox', question_detail.quest_id, '\" id=\"checkbox', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"checkbox', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                    \t            WHEN question_detail.quest_type_id = 2 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"',IF(scenario_results.outgoing_campaign_detail_id = {$inc_id} && question_detail.id = scenario_results.question_detail_id,scenario_results.additional_info,''),'\" class=\"inputtext\"style=\"float:left;\"  type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                    \t            WHEN question_detail.quest_type_id = 4 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\" ',IF(scenario_results.outgoing_campaign_detail_id = {$inc_id} && question_detail.id = scenario_results.question_detail_id,'checked','') ,' class=\"radio_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"radio\" name=\"radio', question_detail.quest_id, '\" id=\"radio', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"radio', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                    \t            WHEN question_detail.quest_type_id = 5 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"',IF(scenario_results.outgoing_campaign_detail_id = {$inc_id} && question_detail.id = scenario_results.question_detail_id,scenario_results.additional_info,''),'\" class=\"date_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                    \t            WHEN question_detail.quest_type_id = 6 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"',IF(scenario_results.outgoing_campaign_detail_id = {$inc_id} && question_detail.id = scenario_results.question_detail_id,scenario_results.additional_info,''),'\" class=\"date_time_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                    \t            WHEN question_detail.quest_type_id = 7 THEN question_detail.answer\r\n                            \t            END AS `ans`,\r\n                            \t            question_detail.quest_type_id,\r\n                            \t            scenario_handbook.`name`,\r\n                            \t            scenario_results.additional_info,\r\n                            \t            question_detail.quest_id,\r\n                            \t            question_detail.id,\r\n                            \t            scenario_destination.destination\r\n                    \t            FROM question_detail\r\n                    \t            LEFT JOIN scenario_results ON question_detail.id = scenario_results.question_detail_id {$inc_checker}\r\n                    \t            LEFT JOIN outgoing_campaign_detail ON outgoing_campaign_detail.id = scenario_results.outgoing_campaign_detail_id\r\n                    \t            JOIN scenario_detail ON scenario_detail.scenario_id = {$my_scenario} AND scenario_detail.actived = 1\r\n                            \t    JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = {$last_a['0']}\r\n                    \t            LEFT JOIN scenario_handbook ON question_detail.answer = scenario_handbook.id\r\n                    \t            WHERE question_detail.id = {$last_a['0']}\r\n                    \t            ");
            $g = 0;
            while ($row1 = mysql_fetch_array($query1)) {
                $q_type = $row1[1];
                if ($q_type == 7) {
                    $data .= '  <tr>
                                                    <td style="width:428px; text-align:left;">
                                                    <label style="float:left; padding: 7px 0;width: 428px;" for="">' . $row1[2] . '</label>
                                                    <select class="hand_select" next_quest="' . $row1[6] . '" style="float:left;width: 235px;"  id="hand_select|' . $row1[4] . '|' . $row1[5] . '" >' . gethandbook($row1[0], $row1[3]) . '</select>
                                                    </td>';
                } else {
                    $data .= $row1[0];
                }
            }
        }
        $data .= '</table>
                    <hr class="myhr"><br></div>';
    }
    $data .= '
	    
	    <div style="margin-top: 15px; display: none;" class="last_quest">
        	<table class="dialog-form-table">
        		<tr>
        			<td style="font-weight:bold;">
        				არ დაგავიწყდეთ სტატუსის შეცვლა და შენახვის ღილაკზე დაკლიკება!
        			</td>
        		</tr>
        	</table>
        	<hr>
        	<br>
        </div>
	    
	    <button id="back_quest" back_id="0" style="float:left;">უკან</button><button id="next_quest" style="float:right;" next_id="0">წინ</button>
	
    	    </fieldset>
        	                        
            <fieldset style="display:none;" id="task">
                <legend>დავალების ფორმირება</legend>
	            <span class="hide_said_menu">x</span>
	            <table>
	               <tr>
	                   <td><label for="task_type_id">დავალების ტიპი</label></td>
	               </tr>
	               <tr>
	                   <td colspan=2><select style="width: 595px;" id="task_type_id">' . GetTaskType() . '</select></td>
	               </tr>
	               <tr>
	                   <td><label for="task_start_date">პერიოდი</label></td>
	               </tr>	              
	               <tr>
	                   <td style="width: 350px;"><input style="float: left;" id="task_start_date" type="text" value=""><label for="task_start_date" style="float: left;margin-top: 7px;margin-left: 2px;">-დან</label></td>
	                   <td><input style="float: left;" id="task_end_date" type="text" value=""><label for="task_end_date" style="float: left;margin-top: 7px;margin-left: 2px;">-მდე</label></td>
	               </tr>
	               <tr>
	                   <td><label for="task_departament_id">განყოფილება</label></td>
	               </tr>
	               <tr>
	                   <td colspan=2><select style="width: 595px;" id="task_departament_id">' . GetDepartament() . '</select></td>
	               </tr>
	               <tr>
	                   <td><label for="task_recipient_id">ადრესატი</label></td>
	                   <td><label for="task_controler_id">მაკონტროლებელი</label></td>
	               </tr>	              
	               <tr>
	                   <td><select style="width: 245px;" id="task_recipient_id">' . getUsers() . '</select></td>
	                   <td><select style="width: 245px;" id="task_controler_id">' . getUsers() . '</select></td>
	               </tr>
	               <tr>
	                   <td><label for="task_priority_id">პრიორიტეტი</label></td>
	                   <td><label for="task_status_id">სტატუსი</label></td>
	               </tr>	              
	               <tr>
	                   <td><select style="width: 245px;" id="task_priority_id">' . GetPriority() . '</select></td>
	                   <td><select style="width: 245px;" id="task_status_id">' . getStatusTask() . '</select></td>
	               </tr>
	               <tr>
	                   <td><label for="task_description">აღწერა</label></td>
	               </tr>
	               <tr>
	                   <td colspan=2><textarea style="resize: vertical;width: 589px;" id="task_description"></textarea></td>
	               </tr>
	               <tr>
	                   <td><label for="task_note">შენიშვნა</label></td>
	               </tr>
	               <tr>
	                   <td colspan=2><textarea style="resize: vertical;width: 589px;" id="task_note"></textarea></td>
	               </tr>
	            </table>
            </fieldset>
            
            <fieldset style="display:none;" id="sms">
                <legend>SMS</legend>
	            <span class="hide_said_menu">x</span>	 
	            <div class="margin_top_10">           
	            <div id="button_area">
                    <button id="add_sms">ახალი SMS</button>
                </div>
                <table class="display" id="table_sms" >
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">თარიღი</th>
                            <th style="width: 100%;">ადრესატი</th>
                            <th style="width: 100%;">ტექსტი</th>
                            <th style="width: 100%;">სტატუსი</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                        	   <input type="text" name="search_id" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            </div>
            </fieldset>
            
            <fieldset style="display:none;" id="mail">
                <legend>E-mail</legend>
	            <span class="hide_said_menu">x</span>
	            <div class="margin_top_10">           
	            <div id="button_area">
                    <button id="add_mail">ახალი E-mail</button>
                </div>
                <table class="display" id="table_mail" >
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">თარიღი</th>
                            <th style="width: 100%;">ადრესატი</th>
                            <th style="width: 100%;">გზავნილი</th>
                            <th style="width: 100%;">სტატუსი</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                        	   <input type="text" name="search_id" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            </div>
            </fieldset>
            
            <fieldset style="display:none;" id="record">
                <legend>ჩანაწერები</legend>
	            <span class="hide_said_menu">x</span>
	                ' . show_record($res) . '
            </fieldset>
            
            <fieldset style="display:none;" id="file">
                <legend>ფაილი</legend>
	            <span class="hide_said_menu">x</span>
	                ' . show_file($res) . '
            </fieldset></div>
	       </fieldset>
	    </div>
	</div><input type="hidden" value="' . $res[id] . '" id="hidden_id">';
    return $data;
}
示例#2
0
function GetPage($res = '')
{
    $data = '
        <!-- ID -->
			<input type="hidden" id="quest_id" value="' . $res['scenario_id'] . '" />
			<input type="hidden" id="quest_detail_id" value="' . $_REQUEST['id'] . '" />
			<input type="hidden" id="add_id" value="' . $_REQUEST['add_id'] . '" />
			<input type="hidden" id="dest_checker" value="0" /> <script>$("#cat,#le_cat,#quest_id1").chosen({ search_contains: true });$("#add-edit-form-answer,.add-edit-form-class,.add-edit-form-answer-class").css("overflow","visible")</script>
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>
    
	    	<table class="dialog-form-table" style="margin:0 0 10px 0;">
				<tr>
					<td style="width: 170px;"><label for="name">სახელი</label></td>
					<td>
						<textarea type="text" id="name" style="margin: 0px; width: 226px; resize:vertical;">' . $res['scenario_name'] . '</textarea>
					</td>
				</tr>
                <tr>
					<td style="width: 170px;"><label for="">კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="cat" class="idls object">' . GetCat($res[scenario_cat_id]) . '</select>
					</td>
				</tr>
			    <tr>
					<td style="width: 170px;"><label for="">ქვე-კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="le_cat" class="idls object">' . GetLeCat($res[scenario_cat_id], $res[scenario_le_cat_id]) . '</select>
					</td>
				</tr>
			</table>';
    if ($_REQUEST['id'] != '') {
        if ($_REQUEST['quest_detail_id'] == '') {
            $data .= ' <div id="taab" style="margin: 0 auto; margin-top: 25px;">
                            	<div id="callapp_tab">
                            		<span id="tab1">დიალოგური ფანჯარა</span>
                            		<span id="tab2">კითხვების რიგითობა</span>
    			                    <span id="tab3">შემოწმება</span>
                            	</div>
                            	<div id="tab_content_1">
    			        
    			                <div id="button_area">
                    			    <button id="add_button_detail">დამატება</button>
                    			    <button id="delete_button_detail">წაშლა</button>
                			    </div>
                			    <table class="display" id="table_quest" style="background-color: #FFF;">
                    			    <thead >
                        			    <tr id="datatable_header">
                            			    <th style="display:none;">ID</th>
    			                            <th style="width: 60px;">#</th>
                            			    <th style="width: 100%;">დასახელება</th>
                            			    <th class="check">&nbsp;</th>
                        			    </tr>
                    			    </thead>
                    			    <thead>
                        			    <tr class="search_header">
                            			    <th class="colum_hidden" style="display:none;">
                        			             <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                        			        </th>		    
                            			    <th>
    			                                 <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                            			    </th>
    			                            <th>
                            			         <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                            			    </th>
                            			    <th>
                            			         <div class="callapp_checkbox">
                                                    <input type="checkbox" id="check-all-de" name="check-all" />
                                                    <label for="check-all-de"></label>
                                                </div>
                            			    </th>
                        			    </tr>
                    			    </thead>
                			    </table>
    			             </div>
                        	<div id="tab_content_2">';
            $i = 1;
            $query = mysql_query("SELECT \t    `question`.id,\r\n                                            \t\t\t        `question`.`name`,\r\n                                            \t\t\t        `question`.note,\r\n                                            \t\t\t        `scenario`.`name`\r\n                                \t\t\t        FROM        `scenario`\r\n                                \t\t\t        JOIN        scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                                \t\t\t        JOIN        question ON scenario_detail.quest_id = question.id\r\n                                \t\t\t        WHERE       scenario.id = {$res['scenario_id']} AND scenario_detail.actived = 1\r\n                                \t\t\t        ORDER BY    scenario_detail.sort ASC");
            $query2 = mysql_query(" SELECT \t`destination`,\r\n                                            \t\t            `answer_id`\r\n                                            \t\t    FROM \t`scenario_destination`\r\n                                            \t\t    JOIN \t`scenario_detail` ON scenario_destination.scenario_detail_id = scenario_detail.id\r\n                                            \t\t    JOIN \t`scenario` ON scenario_detail.scenario_id = scenario.id\r\n                                            \t\t    WHERE \t`scenario`.id = {$res['scenario_id']} AND scenario_destination.destination != 0");
            while ($rame = mysql_fetch_array($query2)) {
                $destination .= ', ' . $rame[0];
                $answer_id .= ', ' . $rame[1];
            }
            $destination = substr($destination, 1);
            $answer_id = substr($answer_id, 1);
            //$row_scen = mysql_fetch_array($query);
            $data .= '<div id="dialog-form" style="width:102%; overflow-y:scroll; max-height:400px;">
                                <fieldset>
                                    <legend>კითხვები</legend>';
            while ($row = mysql_fetch_array($query)) {
                if ($answer_id == '') {
                    $answer_id = 0;
                }
                $query1 = mysql_query(" SELECT \tquestion.id as q_id,\r\n                                                                \t\tquestion_detail.quest_type_id,\r\n                \t\t\t    \t\t                                IF(question_detail.id in({$answer_id}) ,question_detail.id,'') AS `checked_quest`,\r\n                \t\t\t    \t\t                                scenario_detail.id as sc_id,\r\n                \t\t\t    \t\t                                question_detail.id as as_id,\r\n                \t\t\t    \t\t                                scenario_destination.destination as dest,\r\n                \t\t\t    \t\t                                question_detail.answer,\r\n                \t\t\t    \t\t                                scenario_handbook.name as seleqti\r\n                                                                FROM `question_detail`\r\n                                                                JOIN  question ON question_detail.quest_id = question.id\r\n                                                                LEFT JOIN scenario_detail ON question.id = scenario_detail.quest_id\r\n                \t\t\t    \t\t                        LEFT JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = question_detail.id\r\n                                                                LEFT JOIN scenario ON scenario_detail.scenario_id = scenario.id \r\n                \t\t\t    \t\t                        LEFT JOIN scenario_handbook ON question_detail.answer = scenario_handbook.id \r\n                                                                WHERE question_detail.quest_id = {$row['0']} AND question_detail.actived = 1 AND scenario.id = {$res['scenario_id']}\r\n                                                                GROUP BY question_detail.id\r\n                                                                ORDER BY question.id, question_detail.quest_type_id ASC");
                $data .= '<textarea style="width: 704px; height:100px; resize: none; background: #EBF9FF;" class="idle">' . $row[2] . '</textarea>
                			    		<table class="dialog-form-table">
                			    		<tr>
                			    		<td style="font-weight:bold;">' . $i++ . '. ' . $row[1] . '</td>
                			    		</tr>
                			    		
                			    		';
                while ($row1 = mysql_fetch_array($query1)) {
                    $q_type = $row1[1];
                    $dest = $row1[5];
                    if ($row1[1] == 1) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input  class="check_input" style="float:left;" type="checkbox" name="checkbox' . $row1[0] . '" value="' . $row1[4] . '"><label style="float:left; padding: 7px;">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 2) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="inputtext" style="float:left;" type="text" id="input' . $row1[0] . '|' . $row1[4] . '" /> <label style=\\"float:left; padding: 7px;\\" for=\\"input|' . $row1[0] . '|' . $row1[4] . '\\">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 4) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input class="radio_input" style="float:left;" type="radio" name="radio' . $row1[0] . '" value="' . $row1[4] . '"><label style=\\"float:left; padding: 7px;\\">' . $row1[6] . '</label></td>';
                    } elseif ($row1[1] == 5) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="date_input" style="float:left;" type="text" id="input|' . $row1[0] . '|' . $row1[4] . '" /> <label style="float:left; padding: 7px;" for="input|' . $row1[0] . '|' . $row1[4] . '">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 6) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="date_time_input" style="float:left;" type="text" id="input|' . $row1[0] . '|' . $row1[4] . '" /> <label style="float:left; padding: 7px;" for="input|' . $row1[0] . '|' . $row1[4] . '">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 7) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><select class="hand_select" style="float:left;"  id="hand_select|' . $row1[0] . '|' . $row1[4] . '" ><option>' . $row1[7] . '</option></select> <label style="float:left; padding: 7px;" for="hand_select|' . $row1[0] . '|' . $row1[4] . '"></label></td>';
                    }
                    //$data .= $row1[0];
                    $data .= '
            			    		                       <td style="float:left; width: 350px;"><select style="width: 231px;" id="scenarquest|' . $row1[3] . '|' . $row1[4] . '" class="idls object scenarquest">' . GetAlScenQuest($res[scenario_id], $dest) . '</select></td>
            			    		                   </tr>';
                }
                $data .= '</table>
                                <hr><br>';
            }
            $data .= '</fieldset>
            		</div>';
            $data .= '</div>
                        	    <div id="tab_content_3">';
            $query = mysql_query("SELECT \t`question`.id,\r\n                                                    \t    `question`.`name`,\r\n                                                    \t    `question`.note,\r\n                                                    \t    `scenario`.`name`,\r\n                                                    \t    `scenario_detail`.id AS sc_det_id,\r\n                                                    \t    `scenario_detail`.`sort`\r\n                                        \t    FROM    `scenario`\r\n                                        \t    JOIN    scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                                        \t    JOIN    question ON scenario_detail.quest_id = question.id\r\n                                        \t    WHERE   scenario.id = {$res['scenario_id']} AND scenario_detail.actived = 1\r\n                                        \t    ORDER BY scenario_detail.sort ASC");
            $data .= '<button who="0" id="show_all_scenario" style="margin-bottom: 10px;float: right; margin-top: 15px;">ყველას ჩვენება</button>';
            while ($row = mysql_fetch_array($query)) {
                $last_q = mysql_query(" SELECT question_detail.id,question_detail.quest_id\r\n                                            \t        FROM `question_detail`\r\n                                            \t        JOIN scenario_detail ON scenario_detail.quest_id = question_detail.quest_id\r\n                                            \t        AND scenario_detail.scenario_id = {$res['scenario_id']}\r\n                                            \t        WHERE question_detail.quest_id = {$row['0']}");
                $data .= '<div style="margin-top: 15px;" class="quest_body ' . $row[5] . '" id="' . $row[0] . '">
		            <table class="dialog-form-table">
		    		<tr>
						<td style="font-weight:bold;">' . $row[5] . '. ' . $row[1] . ' <img onclick="imnote(\'' . $row[5] . '\')" style="border: none;padding: 0;margin-left: 8px;margin-top: -7px;cursor: pointer;" src="media/images/icons/kitxva.png" alt="14 ICON" height="24" width="24"></td>
		                </tr><tr style="display:none;" id="imnote_' . $row[5] . '" ><td>' . $row[2] . '</td></tr>
		                    ';
                while ($last_a = mysql_fetch_array($last_q)) {
                    $query1 = mysql_query(" SELECT CASE \tWHEN question_detail.quest_type_id = 1 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\"  class=\"check_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"checkbox\" name=\"checkbox', question_detail.quest_id, '\" id=\"checkbox', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"checkbox', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 2 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"inputtext\"style=\"float:left;\"  type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 4 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\" class=\"radio_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"radio\" name=\"radio', question_detail.quest_id, '\" id=\"radio', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"radio', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 5 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"date_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 6 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"date_time_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 7 THEN question_detail.answer\r\n                                            \t                    END AS `ans`,\r\n                                                    \t            question_detail.quest_type_id,\r\n                                                    \t            scenario_handbook.`name`,\r\n                                                    \t            question_detail.quest_id,\r\n                                                    \t            question_detail.id,\r\n                                                    \t            scenario_destination.destination\r\n                                            \t            FROM question_detail\r\n                                            \t            JOIN scenario_detail ON scenario_detail.scenario_id = {$res['scenario_id']}\r\n                                            \t            JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = {$last_a['0']}\r\n                                            \t            LEFT JOIN scenario_handbook ON question_detail.answer = scenario_handbook.id\r\n                                            \t            WHERE question_detail.id = {$last_a['0']} AND question_detail.quest_id = {$last_a['1']} AND scenario_detail.actived = 1\r\n                                            \t            ");
                    $g = 0;
                    while ($row1 = mysql_fetch_array($query1)) {
                        $q_type = $row1[1];
                        if ($q_type == 7) {
                            $data .= '  <tr>
                                                    <td style="width:428px; text-align:left;">
                                                    <label style="float:left; padding: 7px 0;width: 428px;" for="">' . $row1[2] . '</label>
                                                    <select class="hand_select" next_quest="' . $row1[5] . '" style="float:left;width: 235px;"  id="hand_select|' . $row1[3] . '|' . $row1[4] . '" >' . gethandbook($row1[0], '') . '</select>
                                                    </td>';
                        } else {
                            $data .= $row1[0];
                        }
                    }
                }
                $data .= '</table>
                    <hr><br></div>';
            }
            $data .= '
	  
	    <div style="margin-top: 15px; display: none;" class="last_quest">
        	<table class="dialog-form-table">
        		<tr>
        			<td style="font-weight:bold;">
        				არ დაგავიწყდეთ სტატუსის შეცვლა და შენახვის ღილაკზე დაკლიკება!
        			</td>
        		</tr>
        	</table>
        	<hr>
        	<br>
        </div>
	  
	    <button id="back_quest" back_id="0" style="float:left;">უკან</button><button id="next_quest" style="float:right;" next_id="0">წინ</button>
                        	
    			                
    			                 </div>
                        	    
                        	    
                        	        			            
                            </div>
    			        ';
        }
    }
    if ($_REQUEST['quest_detail_id'] != '' || $_REQUEST['add_id'] != '') {
        $data .= ' <table class="dialog-form-table">  
			                    <tr>
                					<td style="width: 170px;"><label for="quest_id1">კითხვა</label></td>
                					<td>
                						<select style="width: 231px;" id="quest_id1" class="idls object">' . GetQuest($res['quest_id'], $_REQUEST['id']) . '</select>
                					</td>
                				</tr>                				
                			</table>
                			<script>$("#name, #cat, #le_cat").prop("disabled", true);</script>';
    }
    $data .= '
        </fieldset>
    </div>
    ';
    return $data;
}