text:
smartApp.controller('ChangeIRIDDController', function($scope,
    $filter,
    SystemService,
    $routeParams,
    changeIRIDDService,
    ReasonService,
    AuthenService,
    ValidateMsgService,
    $ngBootbox) {

    $scope.srcPrintPDF = "PDFs/AfterSaleReport.pdf";

    $scope.isSubIDDNo = true;
    $scope.isSubIRNo = true;
    $scope.divID = "changeIRIDDContent";
    $scope.isMatch = true;
    $scope.referralcode = "";
    $scope.CitizenID = "";
    $scope.showAuthorize = false;

    $scope.isNonePartner = true;
    $scope.TrxID = "";
    $scope.isValidateSave = false;
    $scope.isShowApproveRal = false;

    $scope.isCustomerProfile = false;
    $scope.offerGroup = 0;
    $scope.approver = "";

    $scope.showDataDealer = false;

    $scope.checkURL_shop_code = false;

    $scope.isNullSubNo = $routeParams.subno ? false : true;

    //// for send data readcard to page :: 1-08-2016 :: xsam32
    $scope.readCardID_URL = $routeParams["readcard-id"] ? $routeParams["readcard-id"] : 'null';

    //$scope.lspromoType = {
    //    "0": "เลือก",
    //    "1": "PROECT1",
    //    "2": "PROROAM2",
    //    "3": "PROROAM2S",
    //};
    //$scope.promoType = "3";

    $scope.hideReadCardForMobile = function() {
        SystemService.hideReadCardForMobile();
    };

    //Reasons
    $scope.reasons = [];
    $scope.reason = "";
    $scope.selectReason = {};
    $scope.setDefualtReason = function(result, value) {
        if (result) {
            var myArray = result;
            var searchText = value,
                index = -1;
            for (var i = 0, len = myArray.length; i < len; i++) {
                if (myArray[i].id === searchText) {
                    index = i;
                    break;
                }
            }

            console.log(index);

            $scope.reason = $scope.reasons[index];
            $scope.selectReason = $scope.reasons[index];
        }
        if ($scope.shopType == '1' && $scope.getAuthen['isSecondAuthen'] == true) {
            $scope.reason = {
                id: value
            };
        }
    };
    ReasonService.list("78", function(result) {
        //$scope.reasons = result;
        //$scope.reason = $scope.reasons[86];
        //$scope.selectReason = $scope.reasons[86];
        //solution for none fix index
        $scope.reasons = result;
        $scope.setDefualtReason($scope.reasons, "C16");
        //solution for none fix index
    });
    $scope.onReasonChange = function() {
        $scope.selectReason = $scope.reasons[$('#selectReasonId').val()];
        //console.log($scope.reason);
    };
    //end reson

    $scope.shopType = "0";
    //SystemService.genDatePicker();
    $scope.SubNo = "";

    $scope.data = {};
    $scope.data2 = {};
    $scope.orderId = "";
    $scope.isReadCardSuccess = false;

    $scope.printAndSaveOrder = function() {
        //case for PDF Android ::18-05-2016 //xsam32
        SystemService.checkPDFAndroid_printNoneShop();
        $scope.saveOrder();
    };

    $scope.saveOrder = function() {
        SystemService.showLoading();
        $scope.data.orderRequest["target"] = "aftersales/order/submit";
        console.log($scope.data.orderRequest);
        var headers = {
            'WEB_METHOD_CHANNEL': 'WEBUI',
            'E2E_REFID': $scope.data.orderRequest["order"]["order-id"]
        };
        $scope.data.orderRequest['order']['order-items'][0]['user-memo'] = $scope.getAuthen['logInName'] + "(" + $scope.getAuthen['saleCode'] + ": " + $scope.getAuthen['engName'] + ")" + "(" + "Order ID: " + $scope.orderId + ")" + ": " + $scope.data.orderRequest['order']['order-items'][0]['user-memo'];

        //// new requirement :: 08-06-2016 :: xsam32 @by p'kwang
        $scope.data.orderRequest['order']['order-items'][0]['order-data']['OU-HIERARCHYTYPE'] = $scope.data.installedProduct["ou-hierarchytype"];
        $scope.data.orderRequest['order']['order-items'][0]['order-data']['PARENT-OUID'] = $scope.data.installedProduct["parent-ouId"];
        if ($scope.data.installedProduct["parent-ouId"]) {
            //
        } else {
            delete $scope.data.orderRequest['order']['order-items'][0]['order-data']['PARENT-OUID'];
        }
        console.log(JSON.stringify($scope.data.orderRequest));
        if (SystemService.demo) {
            SystemService.showBeforeClose({
                "message": "รายการคำขอเลขที่ " + $scope.orderId,
                "message2": "ได้รับข้อมูลเรียบร้อยแล้ว"
            });
        } else {
            SystemService.callServicePost($scope.data.orderRequest, headers, function(result) {
                //console.log(result);
                //save report to server
                SystemService.saveReportToServer({}, function(resultSaveReport) {});
                if (result.status) {
                    SystemService.showBeforeClose({
                        "message": result.data["display-messages"][0]["th-message"],
                        "message2": ""
                    });
                } else {
                    SystemService.showAlert({
                        "message": result.error,
                        "message-code": "",
                        "message-type": "ERROR",
                        "en-message": result.error,
                        "th-message": "",
                        "technical-message": "changeIRIDDController"
                    });
                }
            });
        }

        //confirm
        //SystemService.showBeforeClose({
        //    "message": "รายการคำขอเลขที่ OR30935 ",
        //    "message2": "ได้รับข้อมูลเรียบร้อยแล้ว",
        //});
        //SystemService.showConfirm().then(function (value) {

        //}, function (reason) {
        //    //cancel

        //});
    };
    $scope.openSSO = function() {
        //var new_window = window.open('', "MsgWindow", "width=320, height=240");
        //new_window.onbeforeunload = function () {
        //    alert('close');
        //}
        //var new_window = window.open("", "MsgWindow", "width=800, height=600");
        //new_window.onbeforeunload = function () { alert('close'); }

        var openDialog = function(uri, name, options, closeCallback) {
            var win = window.open(uri, name, options);
            var interval = window.setInterval(function() {
                try {
                    if (win == null || win.closed) {
                        window.clearInterval(interval);
                        closeCallback(win);
                    }
                } catch (e) {}
            }, 1000);
            return win;
        };

        var url = SystemService.secondAuthenURL + "SecondAuthen.jsp?App=WEBUI&TrxID=" + $scope.TrxID + "&Retry=yes&Goto=";

        if ($scope.getAuthen["isSecondAuthen"]) {

            openDialog(url, "MsgWindow", "width=800, height=600", function(w) {
                //alert('debug : close and call(second_authen?trx_id=' + $scope.TrxID + '&app_id=WEBUI)');

                SystemService.showLoading();
                SystemService.second_authen($scope.TrxID, function(result) {
                    //alert(result["status"]);
                    SystemService.hideLoading();
                    //console.log(result);
                    if (result["display-messages"] === undefined) {
                        var res = result["response-data"][0]['authRes'];
                        if (res['responseCode'] == "200") {
                            $scope.approver = result['response-data'][0]['loginName'];
                            $scope.manualInputReadCard();
                        } else {
                            $.fancybox.close();
                            //unsuccessul

                            setTimeout(function() {
                                SystemService.showAlert({
                                    "message": "",
                                    "message-code": "",
                                    "message-type": "WARNING",
                                    "en-message": res['responseCode'] + ": " + res['responseDesc'],
                                    "th-message": "",
                                    "technical-message": "changeResumeConroller"
                                });
                            }, 1000);
                        }

                    } else {
                        $.fancybox.close();
                        //unsuccessul

                        setTimeout(function() {
                            SystemService.showAlert({
                                "message": result["display-messages"][0]["message"],
                                "message-code": result["display-messages"][0]["message-code"],
                                "message-type": "WARNING",
                                "en-message": result["display-messages"][0]["en-message"],
                                "th-message": result["display-messages"][0]["th-message"],
                                "technical-message": result["display-messages"][0]["technical-message"]
                            });
                        }, 1000);
                    }

                });

            });
        } else {

            $scope.isNonePartner = true;
            $scope.manualInputReadCard();
        }
        $scope.changereqType('ADD_IRIDD');
    };

    ////$scope.nextBillDate = SystemService.getNextBillDate();
    $scope.readCardError = function(msg) {
        $.fancybox.close();
        SystemService.showAlert({
            "message": msg,
            "message-code": "",
            "message-type": "WARNING",
            "en-message": msg,
            "th-message": msg,
            "technical-message": "changeIRIDDController"
        });
    };
    $scope.initModalReadCard = function() {
        if ($scope.shopType == "1" && !$scope.isCustomerProfile) {

            setTimeout(function() {
                $('#CitizenID').val('');
                $('#CitizenID').focus();
                if ($scope.getAuthen["isSecondAuthen"] == false && $scope.getAuthen["shopType"] == "1") {
                    $scope.showDataDealer = true;
                    $('#CitizenID').prop('disabled', false);
                    setTimeout(function() {
                        $('#btnSSO').hide();
                    }, 100);

                } else {
                    if ($scope.getAuthen["isByPassSecondAuthen"] == true) {
                        $('#CitizenID').prop('disabled', false);
                        setTimeout(function() {
                            $('#CitizenID').focus();
                        }, 500);

                    } else {
                        $('#CitizenID').prop('disabled', true);
                    }
                }

                $("#btnReadCardClose").click(function() {
                    if (!$scope.isCustomerProfile) {
                        $('input[type=submit]').hide();
                        $('input[type=reset]').hide();
                    }
                });
                $('#loadingReadCard').hide();
                $('#loadingReadCard2').hide();
                $('#unMatch2').hide();
                $('#unMatch').hide();

                $('input[type=submit]').show();
                $('input[type=reset]').show();
            }, 100);
        } else {
            setTimeout(function() {
                $('#CitizenID').val('');
                $('#CitizenID').focus();
            }, 100);
        }
    }
    $scope.manualInputReadCard = function() {
            $('#loadingReadCard').hide();
            $('#loadingReadCard2').hide();
            $('#unMatch').hide();
            $('#unMatch2').hide();
            $('#CitizenID').prop('disabled', false);

            setTimeout(function() {
                $('#CitizenID').val('');
            }, 500);
            setTimeout(function() {
                $('#CitizenID').select();
            }, 1500);
            $scope.isManualReadCard = false;
        }
        //SystemService.get("0689100006", function (result) {
        //    $scope.data = result.data;
        //    $scope.isReadCardSuccess = true;
        //});
    $scope.isInputSubNo = false;
    $scope.onInputSubNo = function() {
        console.log($('#dataSubNo').val().length, $scope.isInputSubNo);
        var dataSubNo = $('#dataSubNo').val();
        if (dataSubNo.length == 10) {
            if ($scope.isInputSubNo == false) {
                $scope.SubNo = $('#dataSubNo').val();
                $scope.isInputSubNo = true;
                $scope.onLoad();
            }
        } else {
            $scope.isInputSubNo = false;
        }
    };
    $scope.onInputSubNo_reset = function() {
        $scope.isInputSubNo = false;
        $scope.onInputSubNo();
    };
    $scope.isNumberSubNo = false;
    $scope.onKeyUpSubNo = function(charCode) {
        //console.log(charCode);
        var bool = SystemService.checkInputTel(charCode);
        $scope.isNumberSubNo = !bool;
        //setTimeout(function () {
        //    $scope.isNumberSubNo = false;
        //    $('#idBindDataAgain').click();
        //}, 3000);
        $scope.autoHideNumberSubNo = false;
        return bool;
    }

    $scope.SetCardValue = function(result) {
        $('#loadingReadCard').hide();
        $scope.isReadCardSuccess = false;

        $scope.cardInfo = eval(result);
        //console.log($scope.cardInfo.CitizenID);
        $scope.CitizenID = $scope.cardInfo.CitizenID;
        $('#CitizenID').val('' + $scope.cardInfo.CitizenID);

        if ($scope.cardInfo.CitizenID == $scope.data.responseData.customer["id-number"]) {
            localStorage.setItem('cardInfo', result);
            $scope.isCardValueData = true;
            $scope.showDataDealer = false;

            $scope.isReadCardSuccess = true;
            $scope.isCustomerProfile = true;
            $.fancybox.close();

            $scope.changereqType("ADD_IRIDD");
            setTimeout(function() {
                $('#idBindDataAgain').click();
            }, 500);
            $('.isCustomerProfile').prop('disabled', false);
        } else {
            $('#unMatch').show();
            $scope.isMatch = false;
        }
        ///$scope.ReadCardMockUp($scope.cardInfo.CitizenID);
        //console.log(result);
        //console.log(result.CitizenID);

    };

    $scope.isCitizenID2 = true;
    $scope.onInputId2 = function() {
        var cid = $('#CitizenID2').val();
        if (cid.length == 13) {
            if (SystemService.validatePID(cid)) {
                $scope.isCitizenID2 = true;
            } else {
                $scope.isCitizenID2 = false;
                $('#CitizenID2').val('');
            }
            $scope.allValidateSave();
        }
    };
    $scope.SetCardValue2 = function(result) {
        $('#loadingReadCard2').hide();

        $scope.cardInfo2 = eval(result);
        //console.log($scope.cardInfo2);

        $('#CitizenID2').val($scope.cardInfo2.CitizenID);
        $('#authorizeFullName').val($scope.cardInfo2.PrefixTH + "" + $scope.cardInfo2.FirstNameTH + "  " + $scope.cardInfo2.LastNameTH);
        //$scope.CitizenID2 = $scope.cardInfo2.CitizenID;
        //$scope.authorizeFullName = $scope.cardInfo2.PrefixTH + "" + $scope.cardInfo2.FirstNameTH + "  " + $scope.cardInfo2.LastNameTH;
    }

    //$scope.isManualReadCard = true;
    $scope.onInputId = function() {
        //console.log($('#CitizenID').val().length);
        var cid = $('#CitizenID').val();

        if (cid.length >= 3) {
            if (cid == $scope.data2.customerProfile["id-number"]) {
                $scope.showDataDealer = false;
                //document.getElementById('btnReadCardClose2').click();
                //$("#btnForm").fancybox().close();
                $scope.isCustomerProfile = true;
                $.fancybox.close();
                $scope.isReadCardSuccess = false;
                $scope.CitizenID = "";

                $scope.changereqType("ADD_IRIDD");

                $scope.data = $scope.data2;
            } else {
                $('#unMatch').show();
                $scope.isMatch = false;
            }

        }
        //    //    if ($scope.certificateID == "0689100007") {
        //    //        SystemService.get("0689100007", function (result) {
        //    //            $scope.data = result.data;
        //    //           //console.log($scope.data);
        //    //            document.getElementById('btnReadCardClose').click();

        //    //            if ($scope.data["status-code"] == "1") {
        //    //                document.getElementById('btnModalWarning').click();
        //    //            }
        //    //        });

        //    //    }
        //   //console.log($('#CitizenID').val().length);
        //    var cid = $('#CitizenID').val();
        //    if (cid.length == 13) {
        //        if (cid == $scope.data.responseData.customer["id-number"]) {
        //            SystemService.get("0689100006", function (result) {
        //                document.getElementById('btnReadCardClose2').click();

        //                $scope.data = result.data;
        //                $scope.isReadCardSuccess = false;
        //            });

        //        } else {
        //            $('#unMatch').show();
        //            $scope.isMatch = false;
        //        }
        //        //SystemService.get($scope.certificateID, function (result) {
        //        //   //console.log(result);
        //        //    document.getElementById('btnReadCardClose').click();
        //        //    //$scope.data = result.data;
        //        //    //console.log($scope.data);

        //        //    if (result.data["status-code"] == "2") {
        //        //        document.getElementById('btnModalError').click();
        //        //    }
        //        //});

        //    }
    }

    $scope.requestType = "ADD_IRIDD";
    $scope.requestText = "ขอเปิดบริการ";
    $scope.changIDD = false;
    $scope.changIR = false;
    $scope.checkIDD = false;
    //$scope.checkIR = false;

    $scope.requestTypeDB = "";

    $scope.changereqType = function(requestType) {
        if (requestType == 'ADD_IRIDD') {
            $scope.setDefualtReason($scope.reasons, "C16");
        } else {
            $scope.setDefualtReason($scope.reasons, "DDSC");
            if ($scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE']) {
                delete $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'];
                $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-CODE'] = "N";
                if ($scope.dataAutoApprove["auto-approve-reason"]) {
                    delete $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-REASON'];
                }
                $scope.isValidateSave = false;
                $scope.dataAutoApprove["approve-code"] = "";
            }
        }
        setTimeout(function() {
            $('#btnValidatePrint').prop('disabled', true);
        }, 100);
        $scope.requestType = requestType;
        $scope.data.orderRequest['order']['order-items'][0]['name'] = requestType;
        //console.log($scope.data.orderRequest);

        if ($scope.requestType == "REMOVE_IRIDD") { //ยกเลิก บริการ
            if ($scope.requestTypeDB == "IDD") { //สมัคร IDD ไว้แล้ว
                //เปิดให้กด IDD
                $scope.isSubIDDNo = false;
                $scope.changIDD = false;
                //ปิดให้กด IR
                $scope.isSubIRNo = true;
                $scope.changIR = false;
            } else if ($scope.requestTypeDB == "IRIDD") {
                //เปิดให้กด IDD
                $scope.isSubIDDNo = false;
                $scope.changIDD = false;
                //เปิดให้กด IR
                $scope.isSubIRNo = false;
                $scope.changIR = false;
            } else {
                //ไม่ให้กด IDD
                $scope.isSubIDDNo = true;
                $scope.changIDD = false;
                //ไม่ให้กด IR
                $scope.isSubIRNo = true;
                $scope.changIR = false;
            }

            if ($scope.data.installedProduct["account-sub-type"].indexOf('HY') === 0) {
                //ไม่ให้กด IDD
                $scope.isSubIDDNo = true;
                $scope.changIDD = false;
                // //ไม่ให้กด IR
                // $scope.isSubIRNo = true;
                // $scope.changIR = false;
            }
        } else { //สมัคร บริการ
            if ($scope.requestTypeDB == "IDD") { //สมัคร IDD ไว้แล้ว
                //เปิดให้กด IDD
                $scope.isSubIDDNo = true;
                $scope.changIDD = true;
                //ปิดให้กด IR
                $scope.isSubIRNo = false;
                $scope.changIR = false;
            } else if ($scope.requestTypeDB == "IRIDD") {
                //เปิดให้กด IDD
                $scope.isSubIDDNo = true;
                $scope.changIDD = true;
                //เปิดให้กด IR
                $scope.isSubIRNo = true;
                $scope.changIR = true;
            } else {
                //ไม่ให้กด IDD
                $scope.isSubIDDNo = false;
                $scope.changIDD = false;
                //ไม่ให้กด IR
                $scope.isSubIRNo = false;
                $scope.changIR = false;
            }
        }
        //check show offer
        $scope.checkShowOffer();

        //check validate card
        if (!$scope.isCustomerProfile) {
            //ไม่ให้กด IDD
            $scope.isSubIDDNo = true;
            //ไม่ให้กด IR
            $scope.isSubIRNo = true;
        }

    };
    $scope.authorize = function() {
        $scope.isAuthorize = !$scope.isAuthorize;
    };
    $scope.iddChecked = function() {
        if ($scope.changIDD == false) {
            if ($scope.requestType != "ADD_IRIDD" && $scope.changIR == true) {
                $scope.changIR = true;
            } else {
                $scope.changIR = false;
            }
            //$scope.changIR = false;
        } else {
            if ($scope.requestType != "ADD_IRIDD" && $scope.requestTypeDB != "IDD") {
                $scope.changIR = true;
            }
        }
        //check show offer
        $scope.checkShowOffer();

    };
    $scope.offerGroupIR = "";
    $scope.irChecked = function() {
        if ($scope.changIR == true) {
            if ($scope.requestType != "ADD_IRIDD") {

                if ($scope.offerGroup == 0) {
                    $scope.offerGroup = $scope.offerGroupIR;
                };

            } else {
                $scope.changIDD = true;
                //default offer code
                //console.log($scope.data.installedProduct["account-sub-type"]);
                if ($scope.data.installedProduct["account-sub-type"].indexOf('HY') === 0) {
                    //console.log($scope.data.installedProduct["account-sub-type"]);
                    $scope.offerGroup = "PROROAM6";
                } else {
                    //console.log($scope.data.installedProduct["account-sub-type"]);
                    $scope.offerGroup = "PROROAM2S";
                }
                var list = $filter('filter')($scope.data.offerGroupList, {
                    "soc-name": $scope.offerGroup
                });
                if (list.length == 0) {
                    $scope.offerGroup = $scope.data.offerGroupList[0]["soc-name"];
                }
                $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'] = "";

            }
        } else {
            if ($scope.requestType != "ADD_IRIDD") {
                $scope.changIDD = false;
            }
        }

        //check show offer
        $scope.checkShowOffer();
    };
    $scope.dataAutoApprove = {};
    $scope.checkAutoApprove = function() {
        //OPENING
        // return;

        SystemService.showLoading();

        var data = {
            "id-type": $scope.data.responseData["customer"]["id-type"],
            "id-number": $scope.data.responseData["customer"]["id-number"],
            "customer-id": $scope.data.responseData["customer"]["customer-id"],
            "customer-type": $scope.data.responseData["customer"]["installed-products"][0]["account-category"],
            "company-code": $scope.data.responseData["customer"]["installed-products"][0]["company-code"],
            "account-sub-type": $scope.data.responseData["customer"]["installed-products"][0]["account-sub-type"],
            "subscriber-id": $scope.data.responseData["customer"]["installed-products"][0]["subscriber-id"],
            "account-id": $scope.data.responseData["customer"]["installed-products"][0]["ban"],
            "birthdate": SystemService.convertDateENToFomat($scope.data.responseData["customer"]["birthdate"], 'dd/MM/yyyy')
        };
        console.log(data);
        changeIRIDDService.ValidateAutoApproveCode(data, function(result) {
            console.log(result);
            SystemService.hideLoading();
            $scope.dataAutoApprove = result.data["response-data"];

            //16-05-2016 show msg
            //check msg
            var msg = utils.getObject(result.data, 'display-messages');
            var autoApproveCode = utils.getObject(result.data, 'response-data');
            var auto_approve_code = autoApproveCode ? autoApproveCode["auto-approve-code"] : 'N';
            // msg.unshift({
            //         "message": "-",
            //         "message-code": "VCVAPA2010004",
            //         "message-type": "WARNING",
            //         "en-message": " ",
            //         "th-message": " ",
            //         "technical-message": ""
            //     });
            // msg.unshift({
            //         "message": "-",
            //         "message-code": "VCVAPA2010004",
            //         "message-type": "WARNING",
            //         "en-message": "<b>ไม่สามารถทำการขอ Auto Approve code ได้ กรุณาติดต่อ Referral Team เพื่อขอ Approve Code Manual</b>",
            //         "th-message": "<b>ไม่สามารถทำการขอ Auto Approve code ได้ กรุณาติดต่อ Referral Team เพื่อขอ Approve Code Manual</b>",
            //         "technical-message": ""
            //     });
            if (msg && msg.length > 0 && auto_approve_code != "Y") {
                SystemService.showAlertMulti(msg, "WARNING"); //show mulit msg
                //msg[0]['message-type'] = "WARNING"; //show single msg
                //SystemService.showAlert(msg[0]); //show single msg
            }
            if (msg && msg.length > 0 && auto_approve_code == "Y" && !autoApproveCode['approve-code']) {
                SystemService.showAlertMulti(msg, "WARNING"); //show mulit msg
                //msg[0]['message-type'] = "WARNING"; //show single msg
                //SystemService.showAlert(msg[0]); //show single msg
            }

            if ($scope.dataAutoApprove["auto-approve-code"] == "Y") {
                $scope.isShowApproveRal = true;
                if ($scope.dataAutoApprove["approve-code"]) {
                    $scope.isValidateSave = true;
                }
                $scope.allValidateSave();
                $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'] = $scope.dataAutoApprove["approve-code"];
                $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-CODE'] = "Y";
                if ($scope.dataAutoApprove["auto-approve-reason"]) {
                    $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-REASON'] = $scope.dataAutoApprove["auto-approve-reason"];
                }
            } else {
                $scope.isShowApproveRal = true;
            }
        });
    };
    $scope.checkShowOffer = function() {
        if ($scope.changIR == true) {
            //console.log($scope.data);
            //console.log($scope.data.responseData.customer);
            if ($scope.data.responseData.customer["installed-products"][0]["product-properties"]["CVSS-PROCESS-REQUEST-IR"] == "N" && $scope.data.responseData.customer["require-approve-code"] == "Y") {
                if ($scope.changIR == true && $scope.isSubIRNo != true && $scope.requestType != 'REMOVE_IRIDD') {
                    $scope.isShowApproveRal = true;
                    $scope.isValidateSave = false;
                    //CR02 18-04-2016 AutoApprove
                    if ($scope.data.responseData.customer["installed-products"][0]['account-category'] == 'I') {
                        $scope.checkAutoApprove();
                    }
                } else {
                    $scope.isShowApproveRal = false;
                    if ($scope.requestTypeDB == 'IRIDD' && $scope.requestType == 'REMOVE_IRIDD') {
                        $scope.isValidateSave = true;

                    }

                }

            } else {
                $scope.isValidateSave = true;

            }
        } else {
            if ($scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE']) {
                delete $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'];
                $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-CODE'] = "N";
                if ($scope.dataAutoApprove["auto-approve-reason"]) {
                    delete $scope.data.orderRequest['order']['order-items'][0]['order-data']['AUTO-APPROVE-REASON'];
                }
                $scope.isValidateSave = false;
                $scope.dataAutoApprove["approve-code"] = "";
            }
            $scope.isShowApproveRal = false;
            if ($scope.changIDD == true) {
                if ($scope.requestTypeDB == 'IDD' && $scope.requestType == 'REMOVE_IRIDD') {
                    $scope.isValidateSave = true;

                }
                if ($scope.requestTypeDB == '' && $scope.requestType == 'ADD_IRIDD') {
                    $scope.isValidateSave = true;
                }
            } else {
                $scope.isValidateSave = false;
            }

        }
        $scope.allValidateSave();

    };
    $scope.isProcessApproveCode = true;
    $scope.onCheckValidateApproveCode = function() {
        console.log($scope.isProcessApproveCode);
        if ($scope.isProcessApproveCode) {
            $scope.isProcessApproveCode = false;
            setTimeout(function() {
                $scope.isProcessApproveCode = true;
            }, 1000);
            if ($scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE']) {
                SystemService.showLoading();
                changeIRIDDService.ValidateApproveCodeCallback($scope.data.responseData.customer["installed-products"][0]["company-code"],
                    $scope.data.responseData.customer["installed-products"][0]["account-category"],
                    $scope.data.responseData.customer["id-number"],
                    $scope.data.responseData.customer["customer-level"],
                    "IR",
                    $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'],
                    function(resultData) {

                        //console.log(resultData);
                        if (resultData.data.status == "SUCCESSFUL") {
                            $scope.isValidateSave = true;
                            SystemService.hideLoading();
                            //SystemService.showAlert({
                            //    "message": "SUCCESSFUL",
                            //    "message-code": "",
                            //    "message-type": "SUCCESSFUL",
                            //    "en-message": "",
                            //    "th-message": "",
                            //    "technical-message": "changeIRIDDController"
                            //});
                        } else {
                            //$scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'] = "";
                            $scope.isValidateSave = false;
                            //by pass error
                            SystemService.showAlert({
                                "message": resultData.data["display-messages"][0]["message"],
                                "message-code": resultData.data["display-messages"][0]["message-code"],
                                "message-type": "WARNING",
                                "en-message": resultData.data["display-messages"][0]["en-message"],
                                "th-message": resultData.data["display-messages"][0]["th-message"],
                                "technical-message": resultData.data["display-messages"][0]["technical-message"]
                            });

                            /// issue on blur :: 3-10-2016 :: clear data :: xsam32
                            $scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'] = "";
                        }
                        $scope.allValidateSave();
                    });
            }
        }

    };
    ////init();
    //$ngBootbox.customDialog({
    //    templateUrl: 'app/views/ngBootbox-template.html?v=' + runTime,
    //    onEscape: function () {
    //        return false;
    //    },
    //    show: true,
    //    backdrop: false,
    //    closeButton: false,
    //    animate: true
    //});

    //call print
    $scope.attModalVal = "";
    $scope.varPhoto = "";
    var isFocus = false;

    $scope.validateUI = function() {
        var showValidate = function(id, msg) {
            $scope.attModalVal = "";
            if (isFocus) {
                $('#' + id).focus();
                isFocus = false;
                return;
            } else {
                SystemService.showAlert(msg);
                $('#' + id).focus();
            }
        };
        var isNull = function(val) {
            if (val) { // ไม่เป็นค่าว่าง
                return false;
            } else { // เป็นค่าว่าง
                return true;
            }
        }
        var errorAuthorizeID = false;
        var errorAuthorizeName = false;
        if ($('#authorize').prop('checked')) { //กดมอบอำนาจ:
            errorAuthorizeID = isNull($('#CitizenID2').val());
            errorAuthorizeName = isNull($('#authorizeFullName').val());
        }
        var errorFUTURE = false;
        if ($scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-OPTION'] == 'FUTURE') {
            errorFUTURE = isNull($('.dateManual').val());
        }

        console.log(errorAuthorizeID, errorAuthorizeName, errorFUTURE);

        //check error validate
        if (errorAuthorizeID) {
            showValidate("CitizenID2", ValidateMsgService.data.authorizeIdMsg);
        } else if (errorAuthorizeName) {
            showValidate("authorizeFullName", ValidateMsgService.data.authorizeNameMsg);
        } else if (!SystemService.checkObj($scope.reason, ["id"])) {
            showValidate("selectReasonCode", ValidateMsgService.data.msgReasonCodeEmpty);
        } else if (errorFUTURE) {
            showValidate("txtDateManual", ValidateMsgService.data.effectiveDateMsg);
            return false;
        } else {
            if (isFocus) {
                return false;
            } else {
                //$scope.isValidateSave = false;
                return true;
            }
        }
    };
    $scope.prePrintOrder = function() {
        isFocus = false;
        $scope.printOrder();
    };
    $scope.printOrder = function() {
        $scope.data.orderRequest['approver'] = $scope.approver;
        $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-INSTANCE-ID'] = $scope.hybridInstanceID;

        ////new requirement 13-06-2016 :: xsam32
        $scope.data.orderRequest['order']['order-items'][0]['order-data']['CVSS-PROCESS-REQUEST-IDD'] = $scope.data.responseData.customer["installed-products"][0]["product-properties"]["CVSS-PROCESS-REQUEST-IDD"];
        $scope.data.orderRequest['order']['order-items'][0]['order-data']['CVSS-PROCESS-REQUEST-IR'] = $scope.data.responseData.customer["installed-products"][0]["product-properties"]["CVSS-PROCESS-REQUEST-IR"];

        if ($scope.validateUI()) {
            if ($('.dateManual').val()) {
                $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-DATE'] = SystemService.convertDateToEng($('.dateManual').val(), 'ENG');
                $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-OPTION'] = 'FUTURE';
            }
            $scope.data.orderRequest['order']['order-items'][0]['reason-code'] = $scope.reason.id;
            //authen
            if ($('#CitizenID2').val() && $('#authorizeFullName').val()) {
                var authenList = $('#authorizeFullName').val().split(" ");

                //change AUTH_1 to POA :: 02-06-2016 //xsam32
                $scope.data.orderRequest["order"]["customer"]["customer-agents"] = {
                    "POA": {
                        "id-number": $('#CitizenID2').val(),
                        "firstname": $('#authorizeFullName').val(),
                        "lastname": $('#authorizeFullName').val()
                    }
                };
            }
            //check offer
            if ($scope.changIDD && !$scope.isSubIDDNo) {
                var ogl = $filter('filter')($scope.data.offerGroupList, {
                    'offer-group': 'IDD'
                });
                //console.log(ogl);
                $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-GROUP-IDD'] = ogl[0]["soc-name"];
            }
            if ($scope.changIR) {
                //if (!$scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-GROUP-IR']) {
                //    alert('require. OFFER-GROUP-IR');
                //}
                // $scope.irChecked();
                if ($scope.offerGroupIR) {
                    $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-GROUP-IR'] = $scope.offerGroupIR;
                } else {
                    $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-GROUP-IR'] = $scope.offerGroup;
                }

            }

            //call gen PDF
            {

                $scope.isValidateFF = true;
                $scope.attModalVal = "modal";

                var cardValueData = {
                    //NEW---
                    "photoIdCard": "",

                    //SC=Scan
                    //SN=Snap
                    "photoType": "SN",
                    "titleEn": "",
                    "firstnameEn": "",
                    "lastnameEn": "",
                    "expireDay": "",
                    "birthDay": "",
                    "issueDay": "",

                    "titleTh": "",
                    "firstnameTh": "",
                    "lastnameTh": "",

                    //HomeNumber : '91',Moo : '10',Trok : '',Soi : '',Road : '',District : 'กังแอน',Amphur : 'ปราสาท',Province : 'สุรินทร์'"
                    "homeNumber": "",
                    "moo": "",
                    "trok": "",
                    "soi": "",
                    "road": "",
                    "district": "",
                    "amphur": "",
                    "province": ""
                        //NEW---
                };
                if ($scope.isCardValueData) {
                    cardValueData.photoType = "SC";
                    cardValueData.photoIdCard = $scope.cardInfo.CitizenID;
                    cardValueData = {
                        //NEW---
                        "photoIdCard": $scope.cardInfo.Photo,

                        //SC=Scan
                        //SN=Snap
                        "photoType": "SC",
                        "titleEn": $scope.cardInfo.PrefixEN,
                        "firstnameEn": $scope.cardInfo.FirstNameEN,
                        "lastnameEn": $scope.cardInfo.LastNameEN,
                        "expireDay": $scope.cardInfo.ExpireDay,
                        "birthDay": $scope.cardInfo.BirthDay,
                        "issueDay": $scope.cardInfo.IssueDay,

                        "titleTh": $scope.cardInfo.PrefixTH,
                        "firstnameTh": $scope.cardInfo.FirstNameTH,
                        "lastnameTh": $scope.cardInfo.LastNameTH,

                        //HomeNumber : '91',Moo : '10',Trok : '',Soi : '',Road : '',District : 'กังแอน',Amphur : 'ปราสาท',Province : 'สุรินทร์'"
                        "homeNumber": $scope.cardInfo.HomeNumber,
                        "moo": $scope.cardInfo.Moo,
                        "trok": $scope.cardInfo.Trok,
                        "soi": $scope.cardInfo.Soi,
                        "road": $scope.cardInfo.Road,
                        "district": $scope.cardInfo.District,
                        "amphur": $scope.cardInfo.Amphur,
                        "province": $scope.cardInfo.Province
                            //NEW---
                    };

                }

                //check เปิดบริการ ยกเลิกบริการ
                var iddStatus = "N";
                var irStatus = "N";
                if ($scope.requestType == "ADD_IRIDD") {
                    if (!$scope.isSubIDDNo) {
                        iddStatus = $scope.changIDD ? "Y" : "N";
                    }
                    if (!$scope.isSubIRNo) {
                        irStatus = $scope.changIR ? "Y" : "N";
                    }

                } else {
                    iddStatus = $scope.changIDD ? "Y" : "N";
                    irStatus = $scope.changIR ? "Y" : "N";
                }
                var customerType = "N";
                if ($scope.data.priceplan['account-category'] == "B" || $scope.data.priceplan['account-category'] == "C") {
                    customerType = "Y";
                }

                var data = {
                    "func": "IR-IDD",
                    "header": {
                        "title-code": $scope.data.responseData.customer["title-code"] ? $scope.data.responseData.customer["title-code"] : "T5",
                        "title": $scope.data.responseData.customer["title"],
                        "firstname": $scope.data.responseData.customer["firstname"],
                        "lastname": $scope.data.responseData.customer["lastname"],
                        "customerType": customerType,
                        "authorizeFullName": $('#authorizeFullName').val(),
                        "id-number": $scope.data.responseData.customer["id-number"],
                        "product-id-number": $scope.SubNo,
                        "ouId": "",
                        "orderId": $scope.data.orderRequest['order']['order-id'],
                        "photo": $scope.varPhoto,

                        //NEW---
                        "photoIdCard": cardValueData["photoIdCard"],

                        //SC=Scan
                        //SN=Snap
                        "photoType": cardValueData["photoType"],
                        "titleEn": cardValueData["titleEn"],
                        "firstnameEn": cardValueData["firstnameEn"],
                        "lastnameEn": cardValueData["lastnameEn"],

                        "titleTh": cardValueData["titleTh"],
                        "firstnameTh": cardValueData["firstnameTh"],
                        "lastnameTh": cardValueData["lastnameTh"],

                        "expireDay": cardValueData["expireDay"],
                        "birthDay": cardValueData["birthDay"],
                        "issueDay": cardValueData["issueDay"],

                        //HomeNumber : '91',Moo : '10',Trok : '',Soi : '',Road : '',District : 'กังแอน',Amphur : 'ปราสาท',Province : 'สุรินทร์'"
                        "homeNumber": cardValueData["homeNumber"],
                        "moo": cardValueData["moo"],
                        "trok": cardValueData["trok"],
                        "soi": cardValueData["soi"],
                        "road": cardValueData["road"],
                        "district": cardValueData["district"],
                        "amphur": cardValueData["amphur"],
                        "province": cardValueData["province"]
                            //NEW---

                    },
                    "body": {
                        "irIddData": {
                            "irIddType": ($scope.requestType == "ADD_IRIDD" ? "open" : "close"),
                            "iddCheck": iddStatus,
                            "irCheck": irStatus
                        }
                    }
                };
                console.log(data);
                //api generatePDF
                var srcPDF = "";
                var pdfShopCode = ($scope.getAuthen["partnerCodes"].length > 0 ? $scope.getAuthen["partnerCodes"][0] : $scope.getAuthen['saleCode']);
                localStorage.setItem('pdfShopCode', pdfShopCode);
                SystemService.generatePDF(data, function(result) {
                    var url = result;
                    $scope.srcPrintPDF = url;

                    SystemService.printPDF(url);
                    //printObjectPdf();

                    setTimeout(function() {
                        //case for PDF Android ::18-05-2016 //xsam32
                        SystemService.checkPDFAndroid_show(url);
                    }, 500);
                    if ($scope.shopType == "1" && $scope.getAuthen['isSecondAuthen'] == true) {
                        //case for PDF Android ::18-05-2016 //xsam32
                        setTimeout(function() {
                            SystemService.checkPDFAndroid_print(url);
                        }, 2000);
                    }

                });
            }
        }

    };
    $scope.checkHybridStatus = function(accountSubType) {
        setTimeout(function() {
            var x = accountSubType.indexOf('HY');
            if (accountSubType && accountSubType.indexOf('HY') === 0) {
                $scope.onEffectiveDate('NEXT');
                //$('#divEffer').width(250);
                $('#efferNext').removeClass('hidden');
                $('#efferNext').addClass('active');
            } else {
                $('#efferNow').removeClass('hidden');
                $('#efferNext').removeClass('hidden');
                $('#efferManual').removeClass('hidden');
                $('#efferNow').addClass('active');
            }
        }, 1000);
    };
    $scope.checkAccountCategory = function(accountCategory) {
        setTimeout(function() {
            if (accountCategory == 'B' || accountCategory == 'C') {
                $('#efferNow').removeClass('hidden');
                $('#efferManual').removeClass('hidden');
                $('#efferNow').addClass('active');
            } else {
                //$('#divEffer').width(250);
                $('#efferNow').removeClass('hidden');
                $('#efferNow').addClass('active');
            }
        }, 1000);
    };
    $scope.checkCorporate = function(isCorporate) {
        setTimeout(function() {
            $('#divEffer').addClass('divEffer');
            if (isCorporate == true) {
                $('#divEffer').removeClass('divEffer');
                $('#divEffer').addClass('divCorperate');
                $('#efferNow').removeClass('hidden');
                $('#efferManual').removeClass('hidden');
                $('#efferNow').addClass('active');
            } else {
                $('#efferNow').removeClass('hidden');
                $('#efferNow').addClass('active');
            }
        }, 1000);
    };

    $scope.checkEffectivePrepaid = function(mobileServiceType, accountSubType) {
        setTimeout(function() {
            if (mobileServiceType && mobileServiceType == "PREPAID") {
                //$('#divEffer').width(250);
                $('#efferNow').removeClass('hidden');
                $('#efferNow').addClass('active');
            } else {
                $scope.checkHybridStatus(accountSubType);
            }
        }, 1000);
    };
    $scope.onEffectiveDate = function(method) {
        if (method == 'IMMEDIATE') {
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-DATE'] = SystemService.getDateDDMMYYYY("ENG");
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-OPTION'] = method;
        }
        if (method == 'NEXTBILL') {
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-DATE'] = "";
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-OPTION'] = method;
        }
        if (method == 'FUTURE') {
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-DATE'] = "";
            $scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['EFFECTIVE-OPTION'] = method;
        }
        //alert($scope.saveData['EFFECTIVE-DATE']+":"+$scope.saveData['EFFECTIVE-OPTION']);
    };
    $scope.onSelectOffer = function() {
        //console.log($scope.data.orderRequest['order']['order-items'][0]['primary-order-data']['OFFER-GROUP-IR']);
        console.log($scope.offerGroup);
    };

    $scope.SubNo = $routeParams.subno ? $routeParams.subno : 'null';
    setTimeout(function() {
        SystemService.validateNummeric();
    }, 1000);
    $scope.hybridInstanceID = "";
    $scope.onLoad = function() {

        SystemService.showLoading();
        $scope.isAuthorize = false;
        AuthenService.getAuthen(function(result) {
            $scope.getAuthen = result;
            $scope.shopType = result.shopType;

            $scope.checkCorporate($scope.getAuthen['isCorporate']);

            var ch = $scope.getAuthen["channel"] ? $scope.getAuthen["channel"] : "";
            var dl = $scope.getAuthen["shopcodes"] ? $scope.getAuthen["shopcodes"][0] : "";
            if ($scope.getAuthen["isSecondAuthen"] == false && $scope.getAuthen["shopType"] == "1") {
                $scope.showDataDealer = true;
            } else {
                //
            }
            SystemService.getOrderId(ch, dl, function(resultOrder) {

                localStorage.setItem('orderId', resultOrder.orderId);
                $scope.orderId = resultOrder.orderId;
                $scope.TrxID = resultOrder.TrxID;
                setTimeout(function() {

                    if ($scope.SubNo == 'null') {

                        $('#dataSubNo').focus();

                    }

                }, 1200);
                if ($scope.SubNo != 'null') {

                    changeIRIDDService.validateIRIDDCallback($scope.SubNo, function(resultData) {
                        $scope.checkURL_shop_code = true;
                        $scope.data = resultData;
                        console.log($scope.data);

                        if ($scope.data.status) {
                            console.log(resultData.priceplan['product-properties']['OFFER-INSTANCE-ID']);
                            $scope.hybridInstanceID = resultData.priceplan['product-properties']['OFFER-INSTANCE-ID'];

                            $scope.data2 = resultData;
                            //$scope.data.orderRequest['order']['sale-agent']

                            $scope.data.orderRequest['order']['order-id'] = resultOrder.orderId;
                            $scope.data.orderRequest['ref-id'] = resultOrder.orderId;
                            $scope.data.orderRequest['order']['order-items'][0]['name'] = "ADD_IRIDD";
                            $scope.data.orderRequest['order']['creator'] = $scope.getAuthen["logInName"];
                            $scope.data.orderRequest['user-id'] = $scope.getAuthen["logInName"];
                            $scope.data.orderRequest['order']['sale-agent'] = {
                                "name": $scope.getAuthen["engName"],
                                "channel": $scope.getAuthen["channel"],
                                "partner-code": ($scope.getAuthen["partnerCodes"].length > 0 ? $scope.getAuthen["partnerCodes"][0] : $scope.getAuthen['saleCode']),
                                "partner-name": $scope.getAuthen["partnerName"],
                                "sale-code": $scope.getAuthen["saleCode"],
                                "sale-assist-code": "",
                                "partner-type": $scope.getAuthen["partnerType"]
                            }

                            setTimeout(function() {
                                //if ($scope.data.installedProduct['offer-group'] && $scope.data.installedProduct['offer-group'].indexOf('|') >= 0) {
                                //    var ogList = $scope.data.installedProduct['offer-group'].split('|');
                                //    for (var i = 0; i < ogList.length; i++) {
                                //        if (ogList[i] == 'IDD') {
                                //            $scope.isSubIDDNo = true;
                                //            $scope.changIDD = true;
                                //            $scope.requestTypeDB = "IDD";
                                //            $('#chkChangIDD').click();
                                //        }
                                //        if (ogList[i] == 'IR') {
                                //            $scope.isSubIRNo = true;
                                //            $scope.changIR = true;
                                //            $scope.requestTypeDB = "IRIDD";
                                //            $('#chkChangeIR').click();
                                //        }
                                //    }
                                //}
                                if ($scope.data.priceplan['account-category'] == "B" || $scope.data.priceplan['account-category'] == "C") {
                                    $('#divShowAuthorize').show();
                                } else {
                                    $('#divShowAuthorize').hide();
                                }

                                //$scope.checkAccountCategory($scope.data.priceplan['account-category']);

                                var insPro = $scope.data.installedProductList;
                                var all = false;
                                for (var i = 0; i < insPro.length; i++) {
                                    if (insPro[i]['offer-group'] == 'IDD') {
                                        $scope.changereqType("ADD_IRIDD");
                                        $scope.changIDD = true;
                                        $scope.requestTypeDB = "IDD";
                                        $scope.changIR = false;
                                        $scope.isSubIRNo = false;
                                        $scope.isSubIDDNo = true;
                                        //$('#chkChangIDD').click();
                                    }
                                    if (insPro[i]['offer-group'] == 'IR') {
                                        $scope.offerGroupIR = insPro[i]['product-name'];
                                        $scope.changereqType("ADD_IRIDD");
                                        $scope.changIR = true;
                                        $scope.requestTypeDB = "IRIDD";
                                        $scope.isSubIRNo = true;
                                        $scope.changIDD = true;
                                        $scope.isSubIDDNo = true;
                                        all = true;
                                        $('#chkChangIDD').click();
                                        $('#chkChangIR').click();
                                        //$scope.irChecked();
                                        break;
                                    }
                                }

                                if (all) {
                                    $scope.requestTypeDB = "IRIDD";

                                    setTimeout(function() {
                                        $('#chkChangIR').click();
                                    }, 1000);
                                } else {
                                    if ($scope.requestTypeDB == "IDD") {

                                        $('#chkChangIDD').click();
                                    }
                                }
                                $scope.isValidateSave = false;
                                ////check partner
                                if ($scope.getAuthen["shopType"] == "1" && $scope.getAuthen["isSecondAuthen"] == false) {
                                    //$scope.data = {};
                                    $('#CitizenID').focus();
                                    $('#btnSSO').hide();
                                }
                                $scope.changereqType("ADD_IRIDD");
                                $('#idBindDataAgain').click();
                                $('#labelAdd').click();

                            }, 1000);

                            if ($scope.shopType == "1") {

                                setTimeout(function() {
                                    //document.getElementById('modalReadCard').click();
                                    $("#btn-fancy-ReadCard").fancybox({
                                        'type': 'div',
                                        width: '50%',
                                        height: '95%',
                                        openEffect: false,
                                        closeEffect: false,
                                        speedIn: 15000,
                                        speedOut: 15000,
                                        autoScale: false,
                                        centerOnScroll: false, // and not 'true',
                                        autoCenter: false, // and not 'true'
                                        autoDimensions: 'false',
                                        resize: 'Auto',
                                        helpers: {
                                            overlay: {
                                                css: {
                                                    'background': 'transparent',
                                                    'filter': 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#F22a2a2a,endColorstr=#F22a2a2a)',
                                                    'zoom': '1',
                                                    'background': 'rgba(42, 42, 42, 0.95)'
                                                },
                                                locked: true,
                                                closeClick: false,
                                            }

                                        }
                                    });

                                    //$("#btn-fancy-ReadCard").fancybox().trigger('hide');

                                    $scope.initModalReadCard();
                                    SystemService.calendarDatePicker();
                                }, 500);
                                setTimeout(function() {
                                    $("#btn-fancy-ReadCard").fancybox().trigger('click');
                                    // var idx = eval(localStorage.getItem('cardInfo'));
                                    // if ($scope.readCardID_URL == $scope.data.customerProfile["id-number"] && idx.CitizenID == $scope.readCardID_URL) {
                                    //     $scope.SetCardValue(localStorage.getItem('cardInfo'));
                                    // } else {
                                    //     $("#btn-fancy-ReadCard").fancybox().trigger('click');
                                    // }

                                    if ($scope.getAuthen["isSecondAuthen"] == false) {
                                        $scope.isNonePartner = false;
                                        $scope.manualInputReadCard();
                                    }
                                }, 1100);

                            } else {

                                $scope.isCustomerProfile = true;
                                $scope.changereqType("ADD_IRIDD");
                                setTimeout(function() {

                                    $('#loadingReadCard2').hide();
                                    $('#unMatch2').hide();
                                    SystemService.calendarDatePicker();

                                }, 500);

                            }
                        } else {
                            $scope.SubNo = "null";
                        }
                    });

                } else {
                    SystemService.hideLoading();
                }

            });
        });
    };
    var runTime = new Date().getTime();
    $scope.template = {

        "header": "app/views/header.html?" + runTime,
        "customerprofile": "app/views/customerprofile.html?" + runTime,
        "effectivepriceplan": "app/views/effectivepriceplan.html?" + runTime,
        "reasonmemo": "app/views/reasonmemo.html?" + runTime

    }

    //start----------- camera ----------------
    $scope.initWebCam = function() {

        setTimeout(function() {
            $('#btnSavePhoto').hide();
            $('#btnSavePhoto_Mobile').hide();
            var html = webcam.get_html(320, 240);
            $("#dataCamera").html(html);

            webcam.set_api_url(getURL('services/file/upload.service'));
            webcam.set_quality(90); // JPEG quality (1 - 100)
            webcam.set_shutter_sound(true); // play shutter click sound
            webcam.set_hook('onComplete', onCompleteSnap);

        }, 500);

    }

    function onCompleteSnap(msg) {
        $scope.varPhoto = msg;
        var ie_preview_image = $("#ie_preview_image")[0];
        ie_preview_image.src = "data:image/png;base64," + msg;

        webcam.reset();
        $('#btnSavePhoto').show();
    }

    $scope.webcamSnap = function() {
        webcam.snap();
    }
    $scope.mobileCamSnap = function() {
        var msg = $('#varMobileCam').val();
        msg = msg.replace('data:image/png;base64,', '');
        msg = msg.replace('data:image/jpeg;base64,', '');
        //console.log(msg);
        // $('#btnSavePhoto_Mobile').hide();
        $scope.varPhoto = msg;
    };
    //end----------- camera ----------------

    $scope.cancelChanged = function() {
        closeWP();
        //$window.closed();
    };

    ////validate กรณีมอบอำนาจ
    setTimeout(function() {
        $('#authorize').click(function() {
            $scope.isAuthorize = $('#authorize').prop('checked');
            console.log($('#authorize').prop('checked'));
            $scope.allValidateSave();
        });
        $('#CitizenID2').blur(function() {
            $scope.isCitizenID2 = true;
            $scope.allValidateSave();
        });
        $('#authorizeFullName').blur(function() {
            $scope.allValidateSave();
        });

    }, 3000);

    //// validate ปุ่ม พิมพ์
    $scope.allValidateSave = function() {
        if ($scope.isValidateSave == true) { //กรณีที่: validate save = true
            //if ($('#authorize').prop('checked')) {//กดมอบอำนาจ:
            //    if ($('#CitizenID2').val() && $('#authorizeFullName').val() && $scope.isCitizenID2) {// ไม่เป็นค่าว่าง
            //        $('#btnValidatePrint').prop('disabled', false);
            //    } else {// เป็นค่าว่าง
            //        $('#btnValidatePrint').prop('disabled', true);
            //    }
            //} else {//ไม่กดมอบอำนาจ:
            //    $('#btnValidatePrint').prop('disabled', false);
            //}
            $('#btnValidatePrint').prop('disabled', false);
        } else { //กรณีที่: validate save = false
            $('#btnValidatePrint').prop('disabled', true);
        }
    };
    $scope.onBindDataAgain = function() {};
    //// end validate ปุ่ม พิมพ์

    /// for confirmClose modalPDF :: 1-08-2016 :: xsam32
    $scope.showConfirmClosePDF = function() {
        alert('xx');
    };

    $scope.afterCloseWarning = function() {

        if ($scope.isValidateSave == false) {
            //fix case focus  && $scope.SubNo == 'null' :: 17-05-2016 //xsam32
            setTimeout(function() {
                $('#referralcodes').focus();
            }, 500);
            //$scope.data.orderRequest['order']['order-items'][0]['order-data']['IR-APPROVE-CODE'] = "";
            isFocus = false;
        } else {
            isFocus = true;
            $scope.printOrder();
        }

        if ($scope.isNullSubNo && (!$scope.data.data || !$scope.data.data.status) && $scope.SubNo == 'null') { //fix case focus  && $scope.SubNo == 'null' :: 17-05-2016 //xsam32
            $scope.SubNo = 'null';
            // $('#dataSubNo').val('');
            setTimeout(function() {
                $('#dataSubNo').focus();
            }, 1000);

        } else {

            if (!$scope.data.status) {

            }
            //เปิด modal
            if ($scope.shopType == "1" && !$scope.isCustomerProfile) {
                setTimeout(function() {
                    $scope.initModalReadCard();
                }, 500);
                setTimeout(function() {
                    $("#btn-fancy-ReadCard").fancybox().trigger('click');
                    if ($scope.getAuthen["isSecondAuthen"] == false) {
                        $scope.isNonePartner = false;
                        $scope.manualInputReadCard();
                    }
                }, 1000);

            }
        }

        //Fix loading hide in shop_code=%20
        if ($scope.checkURL_shop_code == false) {
            $scope.checkURL_shop_code = true;
            SystemService.showLoading();
        }

    };

});

redpajama_set_name: RedPajamaGithub


·Skimming is taking some percentage of fees as a fixed fee and in the case of hedge funds typically 1-2% off the top and an additional performance fee.
·Two of the original practitioners were Warren Buffett and Charlie Munger, who practiced the art with no fees off the top. Buffett once he merged his partnerships was 0-6-25 where he took no fees off the top, and instead received 25% of any return over a 6% annual return hurdle. Mohnish believes Charlie Munger was 1/3 of return over 0% but it was a special kind of operation.
·Practice the art with your own assets. With the power of compounding even a small amount of money will become significant over a few years. If you are compounding at anything north of 15-20-25% which you should be able to do with small amounts of capital, your money will be doubling every 4-7 years. This then gives you the ability to in effect live off that base while the assets are growing.
·An investing team is in many ways an oxymoron. One of the basic reasons is that any two humans are going to have different circle of confidences. If you have an analyst on your team that is very bright and comes up with some investment ideas, you may reject them simply because you just have a different circle of confidence which is not doing justice to the analyst.
·Secondly, you do not need that many stocks in a portfolio. In a year you have plenty of time to research stocks and find two-three-four that fit the bill.
·Finally, the investment analysis is the fun part of the job.
·This is from John Templeton. The investment process is one where we are trying to extrapolate the future of many business and by definition that is a very inexact science. There are many factors that are going to affect business 5-10 years into the future, it is fraught with difficulties and a high error rate.
·Let's say a portfolio is made up of ten stocks. There are at least four of them that will not behave in the future in the way I expect. It doesn't mean 40% of the time you will lose money; it means 40% of the time you will not make as much as you thought, lose money, flatline, or do better.
·This is an exercise in humility and one has to always accept the fact that the future trajectory and predicting that trajectory is an inexact science and you have to be humble enough that even the highest conviction ideas may or may not get to where we expect them to get to.
·Say there are around 50,000 publicly traded companies globally, and I set up a screen for all companies that trade at 40x earnings or less. The odds are that there would be tens of thousands of business that would fit that screen. Same with 30-20-10. As you keep decreasing that noose to a very low P/E, some companies will still get through. What you want to look for are the hidden P/E of 1, which do not show up on the screen.
·They can be a P/E of 1 based on future earnings but not today's earnings. For example, when Mohnish bought Fiat Chrysler it was trading at less than $5 a share and the Company had forecasted that by 2018 they would be making about $5 a share. As we came into 2018, they had spun off Ferrarij but if you include that they exceeded that number. The P/E of 1 materialized in 2018 where the investment increased by 7-8x in that time.
·Example 2: A steel company was trading at 3x earnings, but 1/3 of the market cap was in cash and if you adjusted for that they were trading at 2x earnings, and the earnings in the next two years were expected to increase in two years. There was no visibility of earnings beyond two years and it was possible that earnings would just fall off a cliff. But the thinking is if you hold the stock for two years you get all of your money back and it had to trade for something based on the asset base. One year after purchase the Company announced they had one more year of visibility and earnings were going to continue the same as the last. Two years in someone then bought the company creating a 4x return in less than two years.
·In the last 19 years that I have been running Pabrai Funds, finding P/E of 1 has happened at least 6-7 times. He notes he uses ValueLine. Businesses with P/Es of 2 are quite common and are usually good business to avoid but every once in awhile there is a gem.
·Another example was Stewart Enterprises, a funeral services business. Out of all industry categorization, funeral homes have the lowest rate of business failures. When you have a death in the family most typically don't shop around and defer to the family connection. Most do not negotiate on the phone and try to find the low bid unless you hated that particular relative.
·If you cannot figure it out in your head, it's too hard. The investment process is simple.
·For example. A company with a market cap of a billion dollars and trading at a P/E of 20x, so trailing earnings are $50M (and let's assume those are owner earnings that can be withdrawn to keep it simple). One can only make a judgement of whether it is over or undervalued based on the expected cash flows of the next 10-20 years. If it is trading at 20x and you have high conviction that earnings are going to grow at 10-15% a year for several years, you can run the numbers. $50à$55à etc and discount back. If you use a 20% discount rate that $55M next year is only worth only ~$42M as you are not getting it today. If you discount all cash flows it is very hard to get to one billion dollars. You can lower your discount rate but it is still not a no brainer, especially when you should expect to be wrong at least 1/3 of the time. To get around this, you make the math really simple and go back to a P/E of 1. The math is simple.
·If you find yourself reaching for Excel you take a pass: Apple example – Mohnish assumes a 26% discount rate (at least for this example - Mohnish' license plate is compound26). Apple is trading at 20x earnings and even if you assume a generous growth rate of 20% a year in bottom-line earnings for the next decade he cannot get to the price and can say no and move on immediately. We didn't even need a calculator, nevermind Excel.
·In investing and in life you need a rope to climb out of deep wells.
·In the investment business you are going to have gyrations – periods where performance is great and where performance is not. In the financial crisis – Pabrai Funds from the peak in June 2007 from ~$600M to the bottom in March of 2009 the funds dropped between 65-70%. Going back to rule #1 – The base level required to earn a fee is $636 and the funds are worth only $200M, that is a very deep well. He needed a rope to climb out. He went on to violate rule #5 and fired up Excel. He put in prices for all the stocks in the portfolio and put the prices he thought they would all trade at in 2010 and 2011. When he added up the numbers they were over $600M, partly because he had control over the cells. As Steve Jobs' demonstrated through is ability to distort reality – Mohnish focused on the 2010 and 2011 numbers when he would be back at the fee earning level and it worked. Every once in awhile he looks at the spreadsheet.
·There is an Indian epic about an archer named Arjuna. When he was being trained as an archer, one day his teacher told the class that they would have a practical test. The teacher set up a long pole in water and at the end of the pole he put a fish with blue eyes. He then asked his students to shoot the fish by looking in the water. [Abbreviated} –Finally it is Arjuna's turn and he says he can see the center of the center of the eye of the fish. The teacher says shoot and Arjuna hits the eye of the fish.
·The lesson – We need to be focused like him. When you are looking at business with a P/E of 1, there are usually several clouds hanging over the business and there are always a lot of macro clouds (if not macro clouds then concerns). We have to focus on the business and only the business. To figure out the future of an economy is really hard, if not impossible to predict. We have to simplify the world and focus on the business and don't focus on the noise. Mohnish notes that he just came back from a business trip in Istanbul and there was a lot of noise. If you look past the macro concerns there are a lot of opportunities.
·They key is to buy a good business at a fraction of liquidation value or a small fraction of future earnings. It makes it much easier to be right.
·We don't need to go long or short on Tesla. It is just in the too hard pile. For Mohnish, Tesla stock is there for pure entertainment purposes to watch from the front row seats instead of in the arena.
·#1 The timing can get very painful - Warren Buffett and Charlie Munger have noted that they have always been right on the stocks that they thought should be shorted but have always been wrong about the timing.
Commandment Nine: Thou shall not be leveraged. Neither a lender nor a borrower be.
·Warren Buffet's tweak is – neither a long-term lender or a short-term borrower be.
·You do not want to introduce leverage into your life. To finish first you have to first finish, where you want to get to play the game for a long time.
·Cloning is very good for your health.
·There are many smart people who are great investors. In many cases their portfolios are visible to us because it is required by law and so it is a great shortcut to look at what the highest conviction ideas of some very smart people.
·You can check www.dataroma.com which is tracking a bunch of investors and telling you what their highest conviction bets are.
Circle of confidence is not in the commandments but it is the baseline. The first filter has to be circle of confidence. If something is not in your circle of confidence it should immediately be dropped from consideration regardless of the price. We have to stick to our circle of confidence. Once we find something is within our circle of confidence then we can look at the P/Es of 1. Sometimes the P/Es of 1 make it easy to get something into the circle of confidence.
For example – His previous investment where the next two years of earnings plus cash on hand equaled the market cap. He handicapped of just that statement being true and did not need to understand the business much beyond that. There was no debt and if this was true any fool can see there was still the plants, the management, and all of the pieces that will likely make some money in the future. I did not have to get into the weeds of how strong the moat was, rather just the resilience of the two years of cash flow more than anything else. If you get into these very low priced stocks it can make your life easier.


The 14th-ranked Western Nebraska Community College men's basketball team scored 51 second-half points to come back to top Colby Community College 88-85 Wednesday evening at Cougar Palace in the Cougars' home opener.
"The first half we came out very slow and we weren't playing good defense," Bryce Sanchious, who finished with 16 points including a couple eye-popping, second half dunks, said. "The second half, coach told us to play defense."
"We are a pretty good offensive team right now because that is what we work on in practice," he said. "Right now we have to work on our defense because we can't have teams scoring over 80 points on us."
"We knew going into halftime what we needed to do since they were out-rebounding us," he said. "The second half rebounding was totally different."
The contest stayed close to the end. Colby sliced the lead to one, 84-83, with 22.7 seconds. Kuxhausen hit four free throws in the final 10 seconds to an 88-85 lead. Colby had one last hope of tying the game in the final 3.2 seconds. Carter brought the ball to past half court and shot a desperation 3-pointer that hit the rim but didn't go in as the final buzzer went off.
WNCC, 3-0, will be back in action this weekend for the Region 9/18 Classic when Casper, College of Southern Idaho, and Salt Lake Community College come to WNCC. Friday's schedule has Casper facing Salt Lake at 5:30 p.m. followed by WNCC and No. 3 CSI at 7:30 p.m. Saturday's schedule pits CSI and Casper together at 4 p.m. with WNCC and No. 8 Salt Lake battling at 6 p.m.


text:
JAN. 31 UPDATE: No new COVID-19 cases reported in Nova Scotia
SaltWire Network | Posted: Jan. 31, 2021, 1:28 p.m. | Updated: Jan. 31, 2021, 7:55 p.m. | 3 Min Read
- File
No new cases of COVID-19 were reported in Nova Scotia on Sunday, leaving the province with 10 active cases.
Three new cases were reported Saturday.
One of the new cases was in the western zone, while the other two were in the central zone, the Health Department said Saturday.
All three cases are related to travel outside Atlantic Canada.
"I want to thank Nova Scotians for continuing to follow the public health protocols and for participating in rapid testing clinics," Premier Stephen McNeil said in a news release Sunday.
"Your hard work is helping to contain the virus as we wait for vaccine supply to become more consistent."
Labs operated by the Nova Scotia Health Authority completed 1,408 tests Saturday.
Of the two people in hospital Sunday, one was in intensive care.
There have been 161,747 tests completed in the province since Oct. 1, with 491 positive COVID-19 cases but no deaths. Cases have ranged in age from under 10 to over 70, and 481 cases are now resolved.
"It is encouraging to see another day with no new positive cases being reported," said Dr. Robert Strang, Nova Scotia's chief medical officer of health.
"Our public health measures are making a difference in slowing the spread of this virus and we must continue to follow them with vigilance."
Nova Scotians are strongly encouraged to seek asymptomatic COVID-19 testing, especially if they have had several social interactions, even within their own social circles.
Appointments can be booked at https://covid-self-assessment.novascotia.ca/, by choosing the asymptomatic option. Rapid testing pop-up sites continue to be set up around the province as well and those sites can be found at https://www.nshealth.ca/coronavirustesting.
To do a self-assessment, visit https://covid-self-assessment.novascotia.ca/, if in the past 48 hours you have experienced fever or a new or worsening cough, or if you have two or more of the following symptoms, either new or worsening: sore throat, runny nose/nasal congestion, headache or shortness of breath/difficulty breathing.
Call 811 if you cannot access the online self-assessment or wish to speak with a nurse about your symptoms.
Anyone who has travelled from anywhere except Prince Edward Island or Newfoundland and Labrador must self-isolate for 14 days when returning to Nova Scotia. As always, anyone who develops symptoms of acute respiratory illness should limit their contact with others until they feel better.
South Dakota seniors end up in hospital after accidentally eating weed brownies
British ministers to decide on lifting England's COVID curbs
All-you-can eat sushi lands woman in hospital
Giuliani and other pro-Trump lawyers hit with subpoenas over Jan. 6 attack

redpajama_set_name: RedPajamaCommonCrawl


In 2011 Grantmakers for Education (GFE) partnered with the Monitor Institute to develop the K-12 Education Strategy Landscape Tool—an asset mapping tool that used interactive data visualization to provide a clear picture of the who, what, where, and when of education grantmaking. The prototype launched in January of 2012 with initial support from the Rockefeller Foundation, the William and Flora Hewlett Foundation, the Carnegie Corporation of New York, and the Nellie Mae Education Foundation. Over a dozen funders participated in the launch by sharing their grantmaking data.


text:
Statement: House advances greenest budget in recent memory
The House Appropriations Committee approved funding for a number of important environmental programs Friday as part of the FY21 funding bill for the Environmental Protection Agency (EPA) and Department of the Interior (DOI). Most notably, the budget dedicates emergency funding for many of the infrastructure proposals in the Moving Forward Act (H.R.2), including $10.2 billion for the Clean Water and Drinking Water State Revolving Funds. Additionally, the bill blocks the administration's attempts to: open the Tongass National Forest to logging; drill for oil in the Arctic Refuge; expand offshore drilling; weaken protections on toxic mercury and arsenic emissions; and open the Boundary Waters to toxic pollution from sulfide mining.
Environment Texas Research & Policy Center calls for moratorium on oil infrastructure
AUSTIN -- As the Railroad Commission of Texas (RRC) prepares to hear from Chairman Wayne Christian's Blue Ribbon Task Force for Oil Economic Recovery next Tuesday, June 16, Environment Texas Research and Policy Center has released a new report urging the RRC to address environmental damage from oil and gas production and to pause construction of new oil and gas infrastructure.
The global oil price war, demand reductions resulting from the coronavirus outbreak, and the industry's mountain of debt have left Texas oil and gas companies in crisis. But even before the crisis, oil and gas drilling in Texas posed dangers to the environment and public health. Any response to the current crisis by the Railroad Commission (RRC) and other state leaders should recognize the underlying risks created by oil and gas production and move toward correcting them.
Railroad Commission gives out 16 licenses to pollute
"I know we're all getting used to Zoom, but were the Commissioners watching some other hearing last week?" asked Emma Pabst, Global Warming Solutions Associate with Environment Texas Research and Policy Center. "The proration hearing made strikingly clear that industry and environmentalists are united in calling for flaring cuts. Yet, the Commission voted to give out 16 more licenses to pollute today. It just doesn't make any sense."
Environment Texas Urges the Railroad Commission of Texas to Order Production Cuts
Emma Pabst, Global Warming Solutions Associate with Environment Texas Research and Policy Center, will today deliver the following testimony to the Railroad Commission of Texas (RRC): "I urge you to use the power granted to you by the great state of Texas in order to issue statewide production cuts, prorating cuts to companies with the worst rates of flaring. Such a step will help stabilize the market, while significantly reducing the damage from flaring."


text:
Riot Fest adds Patti Smith, Flaming Lips, Joyce Manor (playing S/T), Alkaline Trio & more
More last-minute additions have been made to Riot Fest, which begins in two weeks.
Listen to Kristeen Young's David Bowie collab, "American Landfill"
"American Landfill" is a reimagined version of "Savior," her 2003 collaboration with Bowie.
What's going on Wednesday?
Tonight's NYC-area shows include Madonna, Eric Andre, Pop Will Eat Itself, Nitzer Ebb, Malcolm Mooney, Becca Mancari, Andrew Bird, Kimya Dawson, Mannequin Pussy, Lingua Ignota, and more.
BrooklynVegan Staff
Wednesday show options include Joanna Newsom, Deerhunter/Dirty Projectors, Willie Nelson, Meek Mill, The Selecter, Koffee, Raphael Saadiq, Sunflower Bean, Mega Bog and more.
Tonight's NYC-area shows include Hot Chip/Holy Fuck, Hatchie, Maria Usbeck, Lina Tullgren, Philip Glass, Joe Jack Talcum (Dead Milkmen), 'Meet Me In The Bathroom: The Art Show,' David Cross, and more.
What's going on Thursday?
Tonight's NYC-area shows include Guns N' Roses, Future Islands, Japanese Breakfast, the Brooklyn Electronic Music Festival, Mike Doughty, Mura Masa/Joey Purp, Frankie Rose, and more.
What's going Saturday? (Screaming Females, Disappears, Behemoth, Gaslight Anthem, Summer Moon & more)
You can browse our full NYC show calendar for all of tonight's shows, but here are some highlights... Disappears, Suuns, Christines @ Rough Trade Chicago's Disappears just released Irreal, the band's darkest, most paranoid/obtuse record yet...
tix on sale: Future Islands, They Might Be Giants, Nick Lowe, Fleetwood Mac, Kristeen Young & more
(photo via @ryanmuir) Tickets for the Future Islands show at Terminal 5 are on AmEx, Artist and Ticketmaster presales now (anyone know the passwo...
What's going on Friday? (Arcade FIre, X, OFF!, Kevin Morby, The Clean, Sidekicks, Earthless, Oddball Comedy & more)
Arcade Fire in Austin in April (more by Tim Griffin) You can browse our full NYC show calendar for all of tonight's shows, but here are some highlights...
Morrissey blamed illness on opener Kristeen Young; petition to keep Moz from canceling again; Cliff Richard still playing?
After Morrissey canceled the remainder of his 2014 North American tour after falling ill in Miami -- including his big NYC show at Barclays Center -- a statement was posted to official Moz mouthpiece True to You, basically pinning his illness on opener Kristeen Young:Difficulties had arisen on May 31st following Kristeen Young's opening set at the Miami Knight Concert Hall, after which Kristeen confessed to "a horrendous cold", the symptoms of which were passed on to Morrissey resulting in the cancellation of the next show in Atlanta...


text: <!DOCTYPE html>


In honor of today's eclipse, I'd like to spotlight this piece on Annie Jump Cannon from the funny and informative site Rejected Princesses. Their tag line?
Hee hee! If you're interested in quick, clever portraits of some of the most interesting women in history, Rejected Princesses is the site for you.
Why Annie Jump Cannon? Because she fell in love with the stars at a time when most women were only expected to fall in love with homemaking, and then she went and did something about it.
Born the same year President Lincoln issued the Emancipation Proclamation, she attended college at a time when few women did, and then worked at the Harvard Observatory as a "computer." (If you've seen Hidden Figures, you know what "computer" meant lo those many years ago. If you haven't seen Hidden Figures, I highly recommend you do, stat!) She excelled at Harvard, classifying stars by the hundreds of thousands and building a spectrographic star classification system still in use today.
If you don't already have eclipse plans but you're interested in a once-in-a-century astronomical event, NASA has a great site. They'll help you enjoy the eclipse with everything from maps, safety, activities, DIY pinhole viewers, what to do if you don't have a viewer but still want to see the event, and more.
Like most people I'll be outside the path of totality, but we'll still get 65% coverage. Well worth putting together a pinhole viewer… Oh look, here's one I just happen to have, hacked together from a shoe box, legal paper, the sticky bits of reusable adhesive you find on the back of various packages, and a phone for easy photo taking:) I'll cut the lid off to better control the distance between pinhole and paper, then hope for clear skies!
If you've ever confused stalactites with stalagmites, here's a hint: mites crawl.
Need something beautiful in your day? Check out NASA's Astronomy Picture of the Day. Click through and mouse over the image for more details, but the photo itself is stunning. Aurora + volcano = Iceland!
It's Monday and I know I could use some inspiration. Have a picture of a National Park, because wow.
Some photos beg to be story prompts, don't you think?


text:
Last Updated: Monday, 14 February, 2005, 07:34 GMT
Alicia's keys to success
US R&B singer-songwriter and pianist Alicia Keys has won four Grammy Awards to go with the five she picked up in 2002.
Alicia Keys' Grammys included best R&B album and best R&B song
Mixing pop star looks, hip-hop attitude, classical training and old-school soul, 24-year-old Alicia Keys has slotted into a highly successful niche.
With two number one US albums, her slick music has enough edge to attract a young urban crowd but also a classic eloquence and emotion that appeals to fans of timeless torch songs.
Perhaps that range is not surprising for someone who names Beethoven, Oscar Peterson, Stevie Wonder and Jay-Z among her inspirations.
Keys is a musical prodigy who was born in Manhattan, where hip-hop was the music most commonly heard on the street corners.
But her mother arranged for her to have piano lessons at an early age.
"My mum didn't force me, " Keys told a newspaper. "I've loved the piano ever since I was young and I begged to learn it.
"My mum just helped me stay focused because you can lose focus as you get older, you want to hang out and meet boys and all that. So I'm thankful for that support."
Her debut album has sold 10 million copies around the world
Keys is also thankful for a teacher at the Professional Performance Arts School in Manhattan who gave her valuable instruction on her voice.
Aged 16, Alicia's outstanding grades allowed her to finish high school early.
She went straight to Columbia University, but soon left to focus on music full-time.
Sony won a bidding war for her signature in 1998, but she disliked the direction in which they wanted to take her.
So she followed record company impresario Clive Davis when he left in 1999 to head a new label J Records, where she had more creative freedom.
There, she continued writing, producing and recording the debut she began aged 14.
Songs in A Minor topped the American charts with 235,000 copies sold in its first week and has gone on to sell 10 million worldwide.
She says she has not let the success go to her head and still has a "very low-key life". So low-key that she still fiercely guards her private life while others parade theirs in the press.
Alicia Keys sung God Bless America before this year's Super Bowl
That does not mean she shies away from the pop scene - a US arena tour with Beyonce Knowles and Missy Elliott saw her hold her own as one of the queens of urban pop.
Far from being a difficult second album, The Diary of Alicia Keys garnered sales, rave reviews and awards to rival those of her debut.
Her achievements at this year's Grammys included best R&B album, best R&B song, best female R&B vocal performance and best R&B vocal performance by a duo or group for her duet with Usher.
If that is not enough, there has been talk of movie roles and books of her poetry and lyrics.
Just another day in the life of one of America's most prodigious talents.
Singing the praises of music stars at the Grammys ceremony
THE WINNER IS...
Honours for soul star Charles
Grammy Awards: Key winners
Led Zeppelin celebrate Grammy
WINNERS IN FOCUS
Ray Charles' lasting influence
Obituary: Ray Charles
Kanye West's shrewd soul
U2's desire to be number one
Your views on the Grammys
RELATED BBC LINKS:
Alicia Keys on Radio 1
Alicia Keys on Top of the Pops
U2 reschedule US and Canada dates
Cheryl 'on the mend' says Simon Cowell
Zsa Zsa Gabor taken to hospital
News Front Page | Africa | Americas | Asia-Pacific | Europe | Middle East | South Asia
UK | Business | Entertainment | Science/Nature | Technology | Health
Have Your Say | In Pictures | Week at a Glance | Country Profiles | In Depth | Programmes


Facebook has quietly moved 1.5 billion of its users out of reach of sweeping new privacy regulations before they have even come into force — and claims that the move is actually in their best interests.
Reuters spotted Facebook's tweak to its terms and conditions, which will mean that users outside the US, Canada, and the EU will not be protected by Europe's new General Data Protection Regulation (GDPR) laws, due to come into force on May 25.
The timing of the story is unhelpful for Facebook. With data protection in the spotlight following Cambridge Analytica harvesting information from 87 million US Facebook users, the company has admitted it must learn from its mistakes. GDPR, by sheer coincidence, offers an opportunity for the firm to put its house in order.
Facebook has already started to implement GDPR changes — and it is doing so for users across the world. But by moving 1.5 billion users in Africa, Asia, Australia, and Latin America out from under the regulation, it suggests that for these people Facebook intends to follow the spirit of the law, but not the letter.
Indeed, CEO Mark Zuckerberg admitted as much in his hearings in front of US Congress last week. "We're still nailing down details on this, but it should directionally be, in spirit, the whole thing," he said.
The change to terms and conditions Facebook is making — which moves responsibility for users not in the US, Canada, or the EU users from its Ireland to California —niftily means that the company won't have to pay fines of up to 4% of its global turnover for data breaches in countries that aren't sheltered by the rules.
But Facebook says this in the best interests of these users.


Lobster rolls are as easy as it gets. The only intimidating part is getting the meat out of tail, and its not that intimidating. I use scissors to cut along the shell and crack it open from there. YMMV.
We don't get the traditional split top buns here in southern california, so i improvise. If you do in your area, use em!
9 Pretend you are in maine and eat!