Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function searchBuyingAccounts(searchText) {
- var eventName = "";
- var venueId = "";
- var venueName = "";
- checkCameFrom();
- if (vm.cameFrom === vm.from.purchase) {
- if (vm.item.Event) {
- eventName = vm.item.Event.Name;
- }
- venueId = vm.item.Venue.Id;
- venueName = vm.item.Venue.Name;
- } else {
- eventName = vm.item.LookUpPurchase.EventName;
- venueId = vm.item.LookUpPurchase.VenueId;
- venueName = vm.item.LookUpPurchase.Venue;
- }
- var list = purchaseService.searchBuyingAccount(venueId, venueName, eventName, searchText, vm.item.PlatformId, vm.item.DeliveryMethodId).then(function (result) {
- var buyingaccountList = [];
- $.each(result, function (index, value) {
- var item = {
- FormattedName: value.Email,
- Email: value.Email,
- BuyingAccountLogin: {
- Password: "123455669",
- Id: 1
- },
- Name: "Buying Account Name",
- CreditCard: {
- CreditCard: value.CardNumber,
- Id: value.CreditCardId,
- ExpDate: value.ExpDate,
- Type: value.CreditCardType
- }
- }
- buyingaccountList.push(item);
- });
- return buyingaccountList;
- });
- //todo:v implement it
- //var list = [
- // {
- // FormattedName: 'some@email.com ****1234 (3)',
- // //FormattedName: 'Create Buying Account for ',//+ (vm.item.VenueId ? vm.item.Venue : getPlatformNameById(1)),
- // //Id: 1,
- // Phone: "(555) 555",
- // Address: {
- // Id: 1,
- // Address: "Address"
- // },
- // Email: "Email.1234@some.my.email.com",
- // EmailId: 1,
- // Name: "Buying Account Name",
- // CreditCard: {
- // CreditCard: "1234589933234",
- // Id: 123413,
- // ExpDate: "03/02",
- // Type: "Amex CC"
- // },
- // BuyingAccountLogin: {
- // Password: "123455669",
- // Id: 1
- // },
- // // Notes: "Notes ... ... ... ",
- // // Username: "test",
- // // CreatedOn: new Date()
- // },
- // //{
- // // FormattedName: "some2@email.com 4321 (5)"
- // //},
- // //{
- // // FormattedName: "some2@email.com 9921 (4)"
- // //}, {
- // // FormattedName: "some2@email.com 4300 (6)"
- // //}, {
- // // FormattedName: "some2@email.com 4311 (7)"
- // //}, {
- // // FormattedName: "some2@email.com 4355 (8)"
- // //}
- //];
- vm.item.buyingAccounts = !searchText ? list : _.filter(list, function (i) { return i.FormattedName.toLowerCase().includes(searchText.toLowerCase()) });
- return !searchText ? list : vm.item.buyingAccounts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement