$(function(){
  $(document).on('click','.create-actions', function () {
      var buttons1 = [
        {
          text: '请假类型',
          label: true,
        },
        {
          text: '事假',
          bold: true,
          // onClick: function() {
          //   $.alert("你选择了“事假“");
          // }
        },
        {
          text: '病假',
        },
        {
          text: '年假',
        },
        {
          text: '加班',
        },
        {
          text: '补休',
        },
        {
          text: '其他',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(document).on('click','.create-actionsTwo', function () {
      var buttons1 = [
        {
          text: '其他类型',
          label: true,
        },
        {
          text: '婚假',
          bold: true,
          // onClick: function() {
          //   $.alert("你选择了“事假“");
          // }
        },
        {
          text: '产假',
        },
        {
          text: '丧假',
        },
        {
          text: '工伤假',
        },
        {
          text: '调休',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(document).on('click','.create-actionsFuwu', function () {
      var buttons1 = [
        {
          text: '服务方式',
          label: true,
        },
        {
          text: '上门服务',
          bold: true,
        },
        {
          text: '电话拜访',
        },
        {
          text: '其他',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(document).on('click','.create-actionsJilu', function () {
      var buttons1 = [
        {
          text: '记录类型',
          label: true,
        },
        {
          text: '借出',
          bold: true,
        },
        {
          text: '销售',
        },
        {
          text: '升级',
        },
        {
          text: '更换',
          bold: true,
        },
        {
          text: '收回',
        },
        {
          text: '备注',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(".datetime-picker-star").datetimePicker({
    value: ['2017', '02', '16', '8', '30']
  });

  $(".datetime-picker-end").datetimePicker({
    value: ['2017', '02', '16', '18', '00']
  });

  $(".toast1").on('click',function(e){
    if($(e.target).is('input')){
        return;
      };
    var msg = $(this).children("input[type='checkbox']");
    if (msg.is(':checked')){
      $.toast("您取消上午请假");
    }else{
      $.toast("您选择上午请假");
    };
  });

  $(document).on('click','.confirm-ok', function () {
      $.prompt('填写你的审批意见', function (value) {
          $.alert('你的审批意见： ' + value );
      });
  });
  $(document).on('click','.confirm-cancel', function () {
      $.prompt('不同意原因', function (value) {
          $.alert('你的审批意见：' + value);
      });
  });

  $(document).on('click','.open-about', function () {
    $.popup('.popup-aboutTime');
  });

  $(document).on('click','.itemView',function () {
        $.alert('审批意见审批意见，审批意见');
     });

  $(document).on("pageInit", "#page-city-picker", function(e) {
    $("#city-picker").cityPicker({
        value: ['广东', '珠海','香洲区']
    });
  });
  $.init();

  $("#pickerOffice").picker({
    toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker">确定</button>\
    <h1 class="title">请选择你的办事处</h1>\
    </header>',
    cols: [
      {
        textAlign: 'center',
        values: ['安徽办', '甘肃办', '广东办', '广西办', '江西办', '四川办', '重庆办', '内蒙办', '浙江办', '山东办', '总部', '云南办', '贵州办']
      }
    ]
  });

  $("#pickerInvoice").picker({
    toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker">确定</button>\
    <h1 class="title">请选择开票内容</h1>\
    </header>',
    cols: [
      {
        textAlign: 'center',
        values: ['纵横公路工程造价管理系统V9.0', '纵横公路造价编审软件V9.0', '纵横公路工程设计数量表算量软件V3.1', '纵横公路工程计量支付决算一体化软件V3.1', '建材在线', '服务费', '培训费', '软件升级费', '软件报表定制费', '技术服务费']
      }
    ]
  });

  $(document).on('click','.invoiceType', function () {
      var buttons1 = [
        {
          text: '发票类型',
          label: true,
        },
        {
          text: '增值税普通发票 ',
          bold: true,
        },
        {
          text: '增值税专用发票',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(document).on('click','.invoiceMail', function () {
      var buttons1 = [
        {
          text: '是否邮寄',
          label: true,
        },
        {
          text: '是 ',
          bold: true,
        },
        {
          text: '否',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

  $(document).on('click','.invoiceExpress', function () {
      var buttons1 = [
        {
          text: '选择快递公司',
          label: true,
        },
        {
          text: 'EMS快递 ',
          bold: true,
        },
        {
          text: '顺丰快递',
        }
      ];
      var buttons2 = [
        {
          text: '取消',
        }
      ];
      var groups = [buttons1, buttons2];
      $.actions(groups);
  });

});


$(function(){  
    var t = $('#myinput');
    t.css("color","#A9A9A9");
    t.val("请输入内容"); 
    var default_value = t.val(); 
      
    t.focus(function() { 
        t.css("color","black");  
        if (t.val() == default_value) {  
            t.val('');  
        }  
    });  
    t.blur(function() { 
        t.css("color","black");  
        if (t.val() == '') {  
            t.val(default_value);  
            t.css("color","#A9A9A9");  
        }  
    });  
});

$(function(){  
    var k = $('#myinput1');
    k.css("color","#A9A9A9");
    k.val("请输入内容"); 
    var default_value = k.val(); 
      
    k.focus(function() { 
        k.css("color","black");  
        if (k.val() == default_value) {  
            k.val('');  
        }  
    });  
    k.blur(function() { 
        k.css("color","black");  
        if (k.val() == '') {  
            k.val(default_value);  
            k.css("color","#A9A9A9");  
        }  
    });  
});

$(function(){  
    var p = $('#myinput2');
    p.css("color","#A9A9A9");
    p.val("请输入内容"); 
    var default_value = p.val(); 
      
    p.focus(function() { 
        p.css("color","black");  
        if (p.val() == default_value) {  
            p.val('');  
        }  
    });  
    p.blur(function() { 
        p.css("color","black");  
        if (p.val() == '') {  
            p.val(default_value);  
            p.css("color","#A9A9A9");  
        }  
    }); 

    $(document).on('click','.button-end', function () {
      $.confirm('终止审批', function () {
          $.alert('您终止审批');
      });
    });
    $(document).on('click','.button-return', function () {
      $.confirm('退回审批', function () {
          $.alert('您退回审批');
      });
    });
    $(document).on('click','.button-agree', function () {
      $.confirm('同意审批', function () {
          $.alert('您同意审批');
      });
    });

    $(document).ready(function(){
      //加的效果
      $(".add").click(function(){
      var n=$(this).prev().val();
      var num=parseInt(n)+1;
      if(num==0){ return;}
      $(this).prev().val(num);
      });
      //减的效果
      $(".jian").click(function(){
      var n=$(this).next().val();
      var num=parseInt(n)-1;
      if(num==0){ return}
      $(this).next().val(num);
      });
    });


});