<link href="<?php echo THEME_PATH; ?>css/pipeline.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo THEME_PATH; ?>js/general.js"></script>
<script src="<?php echo VIEWS_PATH; ?>crm/common.js"></script>
<link href="<?php echo THEME_PATH; ?>css/crm-profile.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo THEME_PATH; ?>js/jquery.timeago.min.js"></script>
<link href="<?php echo THEME_PATH; ?>plugins/icheck/icheck.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo THEME_PATH; ?>plugins/icheck/icheck.min.js" type="text/javascript"></script>
<link href='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/core/main.css' rel='stylesheet' />
<link href='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/daygrid/main.css' rel='stylesheet' />
<link href='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/timegrid/main.css' rel='stylesheet' />
<link href='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/list/main.css' rel='stylesheet' />
<script src='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/core/main.js'></script>
<script src='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/interaction/main.js'></script>
<script src='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/daygrid/main.js'></script>
<script src='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/timegrid/main.js'></script>
<script src='<?php echo THEME_PATH; ?>plugins/fullcalendar-4.2.0/packages/list/main.js'></script>
<style>
    input[type=checkbox]{
        display:initial !important;
    }
</style>
<div class="page-inner">
    <div id="main-wrapper">
        <form id="formdeal2">
            <input type="hidden" id="current_contact_id" name="id" value="<?php echo $contact['contact_id'];?>">
            <input type="hidden" id="org_id" name="id" value="<?php echo $contact['organization_id'];?>">
            <input type="hidden" id="current_organization_name"  value="<?php echo $contact['organization_customer_name'];?>">
            <input type="hidden" id="current_origin" name="current_origin" value="cont_prof">
        </form>
        <div class="col-md-12 m-t-lg">
            <div class="row">
                <div class="col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <span class='title bold'><?php print CommonLanguage::getMessage('Person'); ?> </span>
                            <hr>
                            <div ><i class=' fa fa-3x fa-user'></i>  <?php print CommonLanguage::getMessage('Name'); ?>:
                                <a style="color:black;" id="CName" data-type="text"  data-title="Edit address"><?php echo $contact['contact_name'];?></a>
                                <div>
                                <?php print CommonLanguage::getMessage('Phone'); ?>:
                                    <a style="color:black;" id="CMobile" data-type="text"  data-title="Edit address"><?php echo $contact['contact_mobile_phone'];?></a>
                                    <br><?php print CommonLanguage::getMessage('second_phone'); ?>:
                                    <a style="color:black;" id="CWPhone" data-type="text"  data-title="Edit address"><?php echo $contact['contact_work_phone'];?></a>
                                </div>
                                <?php print CommonLanguage::getMessage('Email'); ?>:
                                <a style="color:black;" id="CEmail" data-type="text"  data-title="Edit address"><?php echo $contact['contact_email'];?></a>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <span class="title bold"><?php print CommonLanguage::getMessage('organization'); ?></span>
                            <hr>
                            <div ><i class='fa fa-3x fa-building'></i> <?php print CommonLanguage::getMessage('Name'); ?>:
                                <a style="color:black;" data-type="text" class="customer_profile_name"  data-title="Edit address " href="<?php  echo SITE_LINK.'crm/customerProfile/'.$contact['organization_id'];?>"><?php echo $contact['organization_customer_name'];?></a>
                                <div>
                                <?php print CommonLanguage::getMessage('Phone'); ?>:
                                    <a style="color:black;"  data-type="text" ><?php echo $contact['orgaization_mobile_phone'];?></a>
                                    <br> <?php print CommonLanguage::getMessage('address'); ?>:
                                    <a style="color:black;"  data-type="text" ><?php echo $contact['organization_address'];?></a>
                                    <br><?php print CommonLanguage::getMessage('is_potiential'); ?> :
                                    <a style="color:black;"  data-type="text" ><?php echo CommonLanguage::getMessage($contact['is_potiential'] == 0 ? 'no' : 'yes');?></a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-body" id="dealsdialog"></div>
                    </div>
                </div>
                <div class="col-md-8">
                    <span id="activitylistt2">		
                        <div class='panel panel-default'> 
                            <div class="panel-body">
                                <span>
                                    <a class='btn btn-warning add btn-activity2 ' id="add_activity"  data-toggle="modal" data-target="#activity_modal" data-origin="cont_prof" data-event-name='add'  data-customer-id="<?php echo $contact['organization_id'];?>" data-customer-name="<?php echo $contact['organization_customer_name'];?>"  data-contact-id="<?php echo $contact['contact_id'];?>" data-contact-name="<?php echo $contact['contact_name'];?>">
                                    <?php print CommonLanguage::getMessage('add_activity'); ?>
                                     </a>
                                    <span class="noteseditor btn btn-complete"> <?php print CommonLanguage::getMessage('add_notes'); ?></span>
                                    <a class='btn bg-info-light text-white ' data-toggle="modal" data-target="#current_call_modal" > <?php print CommonLanguage::getMessage('current_call'); ?></a>
                                </span>
                                <div id="noteseditor" class="hidden">
                                    <div class="row"> 
                                        <div class="col-md-12 m-t-10 m-b-10">
                                            <textarea id="overall_note" class="form-control"></textarea>
                                        </div>
                                    </div>
                                    <div class="btn-notes">
                                        <a class='btn btn-primary save'><?php print CommonLanguage::getMessage('Save'); ?></a> 
                                        <a class='btn btn-default cancel'><?php print CommonLanguage::getMessage('cancel'); ?></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </span>
                    <h3 id='planevent'> <?php print CommonLanguage::getMessage('planned'); ?> </h3>
                    <span data-type=plan>
                        <div   id="vertical-timeline" class="vertical-container light-timeline no-margins">
                        </div>
                    </span>
                    <h3 id='over'> <?php print CommonLanguage::getMessage('overdue'); ?></h3>
                    <span data-type=overdue>
                        <div id="vertical-timeline" class="vertical-container light-timeline no-margins">
                        </div>
                    </span>
                    <h3><?php  echo CommonLanguage::getMessage('log');?></h3>
                    <div id="logfilter" class="btn-group">
                        <a data-filter-type=All class="btn btn-default active"><?php  echo CommonLanguage::getMessage('all_log');?></a>
                        <a data-filter-type=activity class="btn btn-default"><?php  echo CommonLanguage::getMessage('activity');?></a>
                        <a data-filter-type=log class="btn btn-default "><?php  echo CommonLanguage::getMessage('log');?></a>
                        <a data-filter-type=statelog class="btn btn-default "><?php  echo CommonLanguage::getMessage('statelog');?></a>
                        <a data-filter-type=notelog class="btn btn-default "><?php  echo CommonLanguage::getMessage('notes');?></a>
                    </div>
                    <span id='past'>
                        <div id="vertical-timeline" class="identify vertical-container light-timeline no-margins">
                        </div>
                    </span>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var filterlogtype='All';
    $(function(){
        getdeals('contact_id',$("#current_contact_id").val());
        loadlog('cont_prof', $("#org_id").val(),$("#current_contact_id").val());
        loadActivities(0,0,$("#current_contact_id").val());

        $(".btn-notes a.cancel").click(function(e) {
            $("#noteseditor").addClass('hidden');
        });
        $(".btn-notes a.save").click(function(e) {
            if ($("#overall_note").val() != "") {
                savenote("crmAjax/addNote", $("#org_id").val(),0,$("#current_contact_id").val(),function(){
                    loadlog('cont_prof', $("#org_id").val(),$("#current_contact_id").val());
                });
                $("#noteseditor").addClass('hidden');
            }
        });
        $(".noteseditor").on("click", function() {
            $("#noteseditor").removeClass('hidden');
        });
        $("#logfilter").on("click", " a", function (event) {
            $("#logfilter a").removeClass("active");
            $(this).addClass("active");
            var currentheight = $(document).height();
            $("body").attr("style", "height:" + currentheight + "px !important");
            event.preventDefault();
            event.stopPropagation();
            switch ($(this).attr("data-filter-type")) {
                case "All":
                    filterlogtype = "All";
                    break;
                case "activity":
                    filterlogtype = "activity";
                    break;
                case "log":
                    filterlogtype = "log";
                    break;
                case "statelog":
                    filterlogtype = "statelog";
                    break;
                case "notelog":
                    filterlogtype = "notelog";
                    break;
                                                    }
            loadlog('cont_prof', $("#org_id").val(),$("#current_contact_id").val());
        });
    });

</script>
<?php include 'Views/crm/deal_modal.php';
include 'Views/crm/activity_modal.php';
include 'Views/crm/current_call_modal.php';