<!--/MODAL-->
</div>
</div>
</main>

<script src="tpl/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>

<script src="tpl/js/jquery.tablesorter.js"></script>
<!--
<script src="tpl/js/jquery.inputmask.bundle.js"></script>
-->
<style>
.select2+label {
    position: absolute;
    top: -26px;
    font-size: .8rem;
}
.dfdff .helper-text {
       margin-top: 8px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    
    top: 7px;
}
.select2 .selection .select2-selection--single, .select2-container--default .select2-search--dropdown .select2-search__field {
    border-width: 0 0 1px 0 !important;
    border-radius: 0 !important;
    height: 3.05rem;background: transparent;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #444;
    line-height: 39px;
}

.select2-container--default .select2-selection--multiple, .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-width: 0 0 1px 0 !important;
    border-radius: 0 !important;
}

.select2-results__option {
    color: #26a69a;
    padding: 8px 16px;
    font-size: 16px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #eee !important;
    color: #26a69a !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e1e1e1 !important;
}

.select2-dropdown {
    border: none !important;
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
}

.select2-container--default .select2-results__option[role=group] .select2-results__group {
    background-color: #333333;
    color: #fff;
}

.select2-container .select2-search--inline .select2-search__field {
    margin-top: 0 !important;
}

.select2-container .select2-search--inline .select2-search__field:focus {
    border-bottom: none !important;
    box-shadow: none !important;
}

.select2-container .select2-selection--multiple {
    min-height: 2.05rem !important;
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: #ddd !important;
    color: rgba(0,0,0,0.26);
    border-bottom: 1px dotted rgba(0,0,0,0.26);
}
.select2 input.select-dropdown {
    position: relative;
    cursor: pointer;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #9e9e9e;
    outline: none;
    height: 3rem;
    line-height: 3rem;
    width: 100%;
    font-size: 16px;
    margin: 0 0 8px 0;
    padding: 0;
    display: block;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    z-index: 1;
}
}



.select2-container--default .select2-selection--multiple {
    background-color: transparent;
    max-height: 43px;    overflow: auto;
}
.select2-selection--multiple::before{
	   font-family: "Font Awesome 5 Free"; font-weight: 900; content: "\f002";    top: 15px;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;    right: 20px;    position: absolute;
}
.JColResizer > tbody > tr > td, .JColResizer > tbody > tr > th {  
    padding-left: 6px!important;
}
.select-wrapper input.select-dropdown , input:not([type]), input[type=text]:not(.browser-default), input[type=password]:not(.browser-default), input[type=email]:not(.browser-default), input[type=url]:not(.browser-default), input[type=time]:not(.browser-default), input[type=date]:not(.browser-default), input[type=datetime]:not(.browser-default), input[type=datetime-local]:not(.browser-default), input[type=tel]:not(.browser-default), input[type=number]:not(.browser-default), input[type=search]:not(.browser-default), textarea.materialize-textarea {
	margin: 0 0 0px 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
   
    margin-top: 13px;
}
</style> 

<style>
.container {
    width: 100%;
}
main {
    padding: 0 5px;
}
.dhv {
    position: absolute;
    left: 0;
    bottom: 0;
    text-align: center;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid #000;
	cursor:pointer;
}
.dhv:hover{
	background: rgb(45, 178, 0);
}
.dhv a{
	display: block;
    color: #fff;
}
.dhv span{
	font-size: 24px;
}
.dhv a:hover{
	
}
</style>         
<script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>          
<script>
    $(document).ready(function () {
		$("a[data-target='readfile']").click(function(){
			$(".dhv").remove();
			var str = $(this).attr('ref'); 
			var res = str.replace("https://view.officeapps.live.com/op/embed.aspx?src=", "");
			res = res.replace("https://drive.google.com/viewerng/viewer?url=", "");
			//var res = res.replace("http://htlservice.net", "");
			res = res.replace("?pid=explorer&efh=false&a=v&chrome=false&embedded=true", "");
			res = decodeURI(res);
			res = res.replace(/\s/g,"%20");
			res = res.replace(/\+/g,"%20");
			
			$("#readfile").append("<div class='dhv'><a target='_blank' download href='"+res+"' ><span>Download/下载</span> <i class='material-icons ' style='margin-left: 10px;line-height:1.5;'>cloud_download</i></a></div>");
		});   
        $('.modal').modal();
        $('select:not(.exclude):not(#status)').formSelect();
		$('select.exclude:not(.exclude2)').select2({width: "100%"});  
        $('.tooltipped').tooltip();
        $('.datepicker').datepicker({format: '<?php echo $PICK; ?>'});

function toLetters(num) {
    "use strict";
    var mod = num % 26,
        pow = num / 26 | 0,
        out = mod ? String.fromCharCode(64 + mod) : '';
    return pow ? toLetters(pow) + out : out;
}
$.tablesorter.addParser({ 
    id: 'grades', 
    is: function(s) { 
	 return false; 
    }, 
    format: function(s) {        
	if(s == ''){
		s = 'Z';
	}else{
		s = s.split("-");
		s = s[0]+toLetters(s[1]);
	}	
        return s; 
    }, 
    // set type, either numeric or text 
    type: 'text' 
}); 

$(".tab-content:not(.excludethistable)").tablesorter({headers: {17: {sorter: 'grades'}}});
		/*
		
		$('input#date, input#name, textarea#text').characterCounter();
        $('#receivable').inputmask('decimal', {
            'groupSeparator': ',',
            'autoGroup': true,
            'digits': 2,
            'radixPoint': ".",
            'digitsOptional': false,
            'allowMinus': true,
            'prefix': '',
            'placeholder': '0'
        });
        $('#amount').inputmask('decimal', {
            'groupSeparator': ',',
            'autoGroup': true,
            'digits': 2,
            'radixPoint': ".",
            'digitsOptional': false,
            'allowMinus': true,
            'prefix': '',
            'placeholder': '0'
        });
        $('#profit').inputmask('decimal', {
            'groupSeparator': ',',
            'autoGroup': true,
            'digits': 2,
            'radixPoint': ".",
            'digitsOptional': false,
            'allowMinus': true,
            'prefix': '',
            'placeholder': '0'
        });
        $('input[name="receivable"]').on("keypress keyup blur", function (event) {
         $(this).val($(this).val().replace(/[^\d].+/, ""));
         if ((event.which < 48 || event.which > 57)) {
         event.preventDefault();
         }
         //console.log(event.type);
         if (event.type == 'keyup') {                
         cal_auto_data();
         }
         });
         $('input[name="amount"]').on("keypress keyup blur", function (event) {
         $(this).val($(this).val().replace(/[^\d].+/, ""));
         if ((event.which < 48 || event.which > 57)) {
         event.preventDefault();
         }
         //console.log(event.type);
         if (event.type == 'keyup') {
         cal_auto_data();
         }
         });
        $('input[name="receivable"]').on("keyup", function (event) {
            cal_auto_data();
        });
        $('input[name="amount"]').on("keyup", function (event) {
            cal_auto_data();
        });
		*/
    });
    function cal_auto_data() {
        var receivable = $('input[name="receivable"]').val();
        var amount = $('input[name="amount"]').val();
        if (amount === "") {
            amount = 0;
        }
        if (receivable === "") {
            receivable = 0;
        }
        amount = replace_dots(amount);
        receivable = replace_dots(receivable);
        amount = format_number(amount);
        receivable = format_number(receivable);
        console.log(receivable + '-' + amount);
        var profit = receivable - amount;
        console.log(receivable+'-'+amount+'='+profit);
        $('input[name="profit"]').val(profit);
        if (!$('label[for="profit"]').hasClass('active')) {
            $('label[for="profit"]').addClass('active');
        }
    }
    function replace_dots(mystring) {
        for (var i = 0; i < 5; i++) {
            mystring = mystring.toString().replace(',','');
        }
        return mystring;
    }

    function format_number(s) {
        var i = parseFloat(s);
        return (isNaN(i)) ? 0 : i;
    }
    function addNew(){
        var $show_menu = $('.toggle');
        $show_menu.on('click',function(){
           $('.show-table').toggle('slow');
        });
    }
    function addUser(){
        var $show_fromUser = $('.btnCreate-user');
        $show_fromUser.on('click',function(){
            $('.create-user').toggle('show');
        });
    }
    //$('.modal').modal();
    //$('#tab-0').addClass('current');
    //$('.tab-link:first-child').addClass('current');
    
    
    function changeTab(){
        $('ul.tabs li').click(function(){
          
            var tab_id = $(this).attr('data-tab');
            $('ul.tabs li').removeClass('current');
            $('.tab-content').removeClass('current');
            $(this).addClass('current');
            $("#" + tab_id).addClass('current');
        });
    }
/*
    $(window).load(function(){
        $("#overlay").modal('open');
    });
    setTimeout(function() {
        $('#overlay').modal('close');
    },5000);
*/




    addNew();
    changeTab();
<?php
    if (@$_GET['msg'] != '') {
        echo "M.toast({html: '" . $_GET['msg'] . "'});";
    }
$Notis = json_decode(file_get_contents('data/Noti.json'),true);$checkdd = 0;
$Notis = array_reverse($Notis);
foreach ($Notis as $Noti){  
	
    if ( $_GET['onlyform'] != 1 && $_SESSION['solan'] < 3 && strtotime(str_replace('.', '-', $Noti['Start'])) < time() &&  strtotime(str_replace('.', '-', $Noti['End']).' 23:59:59') > time() && ( $Noti['Role'] == 'All' || $Noti['Role'] == $currentuser->role ) && ( $Noti['location'] == 'All' || $Noti['location'] == $currentuser->location )  ){
          
		  if($Noti['Start'] == date('Y.m.d')){
			  if($_SESSION['HTTP_ACCEPT_LANGUAGE'] != 'cn'){
				echo "M.toast({html: '" . str_replace(array("\r\n", "\r", "\n",'"',"'"),'',nl2br($Noti['Content'])) . "', displayLength: 6000 , inDuration:500, classes:'translate noti".$Noti['color']."' });";
			  }else{
				echo "M.toast({html: '" . str_replace(array("\r\n", "\r", "\n",'"',"'"),'',nl2br($Noti['Content'])) . "', displayLength: 6000 , inDuration:500, classes:'noti".$Noti['color']."' });";
			  }
		  }
		  $checkdd = 1; break;
    }
}
if($checkdd){
	$_SESSION['solan'] = $_SESSION['solan'] + 1;
}

//if(  $currentuser->gm  == '1'  || $currentuser->reminder == 1 ){ 
	$reminder = json_decode(file_get_contents('data/reminder.json'),true);
	foreach ($reminder as $rem){ 
		if ( $_SESSION['solanreminder'] < 2  
		&& strtotime(str_replace('.', '-', $rem['start'])) <= time() 
		//&& ( strtotime(str_replace('.', '-', $currentuser->{'end'})) >= time() || $currentuser->gm  == '1' )
		&& strtotime(str_replace('.', '-', $rem['end']).' 23:59:59') >= time()
		&& in_array(date('d'),$rem['dayofmonth'])
		&& ( $currentuser->gm  == '1'  || $rem['location'] == 'All' || $rem['location'] == $currentuser->location || $currentuser->location == "总公司"  )
		){
			echo "M.toast({html: '<table><tr><td>".$rem['type']."</td><td>" . str_replace(array("\r\n", "\r", "\n",'"',"'"),'',nl2br($rem['content'])) . "</td><td>".$rem['method']."</td><td>".$rem['amount'].' '.$rem['currency']."</td></tr></table>', displayLength: 6000 , inDuration:500, classes:'' });";
			$checksolanreminder = 1;
		}
	}
	if($checksolanreminder){
		$_SESSION['solanreminder'] = $_SESSION['solanreminder'] + 1;
	}
//}
?>


</script>


<style>
.skiptranslate , #google_translate_element2 {
	
}
.notiBlue {
	background:rgba(3, 155, 229, 0.9)!important; 	Color:#fff;    min-width: 300px;    font-weight: bold;
    font-size: 16px;    width: 55%;float:right;
}
.notiGreen {
	background:rgba(102, 187, 106, 0.9)!important; Color:#fff;    min-width: 300px;    font-weight: bold;
    font-size: 16px;    width: 55%;float:right;
}
.notiYellow {
	background:rgba(230, 162, 0, 0.95) !important; Color:#fff;    min-width: 300px;    font-weight: bold;
    font-size: 16px;    width: 55%;float:right;
}
.notiRed {
	background:rgba(198, 40, 40, 0.9)!important; Color:#fff;    min-width: 300px;    font-weight: bold;
    font-size: 16px;    width: 55%;float:right;
}

</style>

</body>
</html>
