Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. oModel.create("/Suppliers", {
  2.                         AddressCity: modelSupplier.Suppliers.AddressCity,
  3.                         CountryDetails: {
  4.                             __deferred: {
  5.                                 uri: "Countrys('" + modelSupplier.Suppliers.AddressCountry + "')"
  6.                             }
  7.                         },
  8.                         AddressNeighborhood: modelSupplier.Suppliers.AddressNeighborhood,
  9.                         AddressRegionUf: modelSupplier.Suppliers.AddressRegionUf,
  10.                         AddressStreet: modelSupplier.Suppliers.AddressStreet,
  11.                         AddressStreetComplement: modelSupplier.Suppliers.AddressStreetComplement,
  12.                         AddressStreetNumber: modelSupplier.Suppliers.AddressStreetNumber,
  13.                         AddressZipCode: modelSupplier.Suppliers.AddressZipCode,
  14.                         Cnpj: modelSupplier.Suppliers.Cnpj,
  15.                         Cpf: modelSupplier.Suppliers.Cpf,
  16.                         Email: modelSupplier.Suppliers.Email,
  17.                         Ie: modelSupplier.Suppliers.Ie,
  18.                         Im: modelSupplier.Suppliers.Im,
  19.                         LanguageDetails: {
  20.                             __deferred: {
  21.                                 uri: "Languages('" + modelSupplier.Suppliers.Language + "')"
  22.                             }
  23.                         },
  24.                         Name: modelSupplier.Suppliers.Name,
  25.                         Phone: modelSupplier.Suppliers.Phone,
  26.                         PhoneExtension: modelSupplier.Suppliers.PhoneExtension,
  27.                         SupplierLegacyNumber: modelSupplier.Suppliers.SupplierLegacyNumber,
  28.                         SupplierTypeDetails: {
  29.                             __deferred: {
  30.                                 uri: "SupplierTypes(" + modelSupplier.Suppliers.Type + ")"
  31.                             }
  32.                         },
  33.                         method: "POST",
  34.                         urlParameters: {
  35.                             "?my-debug=true"
  36.                         },
  37.                         success: function (oResponse) {
  38.                             dialog.close();
  39.                             MessageBox.success(
  40.                                 "O fornecedor " + oResponse.SupplierId + " foi criado com sucesso!", {
  41.                                     onClose: function (sAction) {
  42.                                         var arrayOfIds = ["name", "email", "country", "telephone", "telExtension", "cnpj", "cpf", "ie", "im", "language",
  43.                                             "city",
  44.                                             "uf", "cep", "neighborhood", "street", "streetNumber", "addressComplement", "legacyNumber", "type"
  45.                                         ]; //array of all ids from the Add Supplier Form (Except the dropdown ones)
  46.                                         for (var i = 0; i < arrayOfIds.length; i++) {
  47.                                             oView.byId(arrayOfIds[i]).setValue(""); //this will set id according to arrayOfIds, and then set the value blank to each one
  48.                                             oView.byId(arrayOfIds[i]).setValueState(sap.ui.core.ValueState.None);
  49.                                         }
  50.                                     }
  51.                                 }
  52.                             );
  53.                             //debugger;
  54.                         },
  55.                         error: function (oError) {
  56.                             debugger;
  57.                             dialog.close();
  58.                             MessageBox.error(
  59.                                 "Erro ao salvar o fornecedor!"
  60.                             );
  61.                         }
  62.  
  63.                     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement