Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import {JetView} from "webix-jet";
  2. import {getUser} from "models/users";
  3.  
  4. export default class ContactForm extends JetView{
  5.  
  6. config(){
  7. var count = 0;
  8. var user = {
  9. view:"template",borderless: true,
  10.  
  11. template:function(item){
  12.  
  13. var info = "<h1 class='name'>"+item.FirstName+" "+item.LastName+"</h1>"+
  14. "<div class='info_user'><div style='background:grey; height:160px;'></div><p class='center'>Status: "+item.StatusID+"</p></div>"+
  15. "<div class='info_user'>";
  16.  
  17.  
  18. function addDiv(){
  19. if(count===4){
  20. info+= "</div><div class='info_user'>";
  21. }
  22. count++;
  23. }
  24. function addInfo(icon,value){
  25. if(value){
  26. addDiv();
  27. info+= "<span class ='icons webix_icon fa-"+icon+"'></span>"+value+"<br>";
  28. }
  29. }
  30.  
  31.  
  32. addInfo("envelope",item.Email);
  33.  
  34. addInfo("skype",item.Skype);
  35.  
  36. addInfo("tag",item.Job);
  37.  
  38. addInfo("briefcase",item.Company);
  39.  
  40. addInfo("calendar",item.Birthday);
  41.  
  42. addInfo("map-marker",item.Address);
  43.  
  44.  
  45. info+= "</div>";
  46.  
  47. return info;
  48. }
  49.  
  50. };
  51.  
  52. var userButtons = {
  53. view: "layout",
  54. cols:[
  55. {view:"button", label:"Delete", type:"iconButton", icon:"trash", css:"webix_icon user_button", autowidth: true},
  56. {view:"button", label:"Edit", type:"iconButton", icon:"edit", css:"webix_icon user_button", autowidth: true}
  57. ]
  58. };
  59.  
  60. return {cols:[
  61. user,
  62. {rows:[userButtons,{}]}
  63. ]};
  64.  
  65. }
  66.  
  67. urlChange(view, url){
  68. if(url[0].params.id){
  69. var id = url[0].params.id;
  70. view.queryView({view:"template"}).parse( getUser(id) );
  71. }
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement