form_extended.js 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. // form
  2. QUnit.test('form checks', assert => {
  3. // use unsorted order to check if the frontend is sorting correctly
  4. App.TicketPriority.refresh([
  5. {
  6. id: 2,
  7. name: '2 normal',
  8. note: 'some note 2',
  9. active: false,
  10. created_at: '2014-06-10T10:17:34.000Z',
  11. },
  12. {
  13. id: 3,
  14. name: '3 high',
  15. note: 'some note 3',
  16. active: true,
  17. created_at: '2014-06-10T10:17:44.000Z',
  18. },
  19. {
  20. id: 4,
  21. name: '4 very high',
  22. note: 'some note 4',
  23. active: true,
  24. created_at: '2014-06-10T10:17:54.000Z',
  25. },
  26. {
  27. id: 5,
  28. name: '5 xxx very high',
  29. note: 'some note 5',
  30. active: false,
  31. created_at: '2014-06-10T10:17:56.000Z',
  32. },
  33. {
  34. id: 1,
  35. name: '1 low',
  36. note: 'some note 1',
  37. active: true,
  38. created_at: '2014-06-10T11:17:34.000Z',
  39. },
  40. ])
  41. App.TicketState.refresh([
  42. {
  43. id: 1,
  44. name: 'new',
  45. note: 'some note 1',
  46. active: true,
  47. created_at: '2014-06-10T11:17:34.000Z',
  48. },
  49. {
  50. id: 2,
  51. name: 'open',
  52. note: 'some note 2',
  53. active: true,
  54. created_at: '2014-06-10T10:17:34.000Z',
  55. },
  56. {
  57. id: 3,
  58. name: 'should not be shown',
  59. note: 'some note 3',
  60. active: false,
  61. created_at: '2014-06-10T10:17:34.000Z',
  62. },
  63. ])
  64. App.User.refresh([
  65. {
  66. id: 47,
  67. login: 'bod@example.com',
  68. email: 'bod@example.com',
  69. firstname: 'Bob',
  70. lastname: 'Smith',
  71. active: true,
  72. created_at: '2014-06-10T11:17:34.000Z',
  73. },
  74. ])
  75. App.Organization.refresh([
  76. {
  77. id: 12,
  78. name: 'Org 1',
  79. active: true,
  80. created_at: '2014-06-10T11:19:34.000Z',
  81. },
  82. ])
  83. App.ObjectManagerAttribute.refresh([{"name":"number","object":"Ticket","display":"#","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","readonly":1,"null":true,"maxlength":60,"width":"68px"},"screens":{"create_top":{},"edit":{}},"position":5,"id":1},{"name":"title","object":"Ticket","display":"Title","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":200,"null":false,"translate":false},"screens":{"create_top":{"-all-":{"null":false}},"edit":{}},"position":8,"id":2},{"name":"customer_id","object":"Ticket","display":"Customer","active":true,"editable":false,"data_type":"user_autocompletion","data_option":{"relation":"User","autocapitalize":false,"multiple":false,"guess":true,"null":false,"limit":200,"placeholder":"Enter Person or Organization/Company","minLengt":2,"translate":false,"permission":["ticket.agent"]},"screens":{"create_top":{"-all-":{"null":false}},"edit":{}},"position":10,"id":3},{"name":"organization_id","object":"Ticket","display":"Organization","active":true,"editable":false,"data_type":"autocompletion_ajax_customer_organization","data_option":{"relation":"Organization","autocapitalize":false,"multiple":false,"null":true,"translate":false,"permission":["ticket.agent","ticket.customer"]},"screens":{"create_top":{"-all-":{"null":false}},"edit":{}},"position":12,"id":4},{"name":"type","object":"Ticket","display":"Type","active":false,"editable":true,"data_type":"select","data_option":{"default":"","options":{"Incident":"Incident","Problem":"Problem","Request for Change":"Request for Change"},"nulloption":true,"multiple":false,"null":true,"translate":true,"maxlength":255},"screens":{"create_middle":{"-all-":{"null":false,"item_class":"column"}},"edit":{"ticket.agent":{"null":false}}},"position":20,"id":5},{"name":"group_id","object":"Ticket","display":"Group","active":true,"editable":false,"data_type":"select","data_option":{"default":"","relation":"Group","relation_condition":{"access":"full"},"nulloption":true,"multiple":false,"null":false,"translate":false,"only_shown_if_selectable":true,"permission":["ticket.agent","ticket.customer"],"maxlength":255},"screens":{"create_middle":{"-all-":{"null":false,"item_class":"column"}},"edit":{"ticket.agent":{"null":false}}},"position":25,"id":6},{"name":"owner_id","object":"Ticket","display":"Owner","active":true,"editable":false,"data_type":"select","data_option":{"default":"","relation":"User","relation_condition":{"roles":"Agent"},"nulloption":true,"multiple":false,"null":true,"translate":false,"permission":["ticket.agent"],"maxlength":255},"screens":{"create_middle":{"-all-":{"null":true,"item_class":"column"}},"edit":{"-all-":{"null":true}}},"position":30,"id":7},{"name":"state_id","object":"Ticket","display":"State","active":true,"editable":false,"data_type":"select","data_option":{"relation":"TicketState","nulloption":true,"multiple":false,"null":false,"default":2,"translate":true,"filter":[2,1,3,4,6,7],"maxlength":255},"screens":{"create_middle":{"ticket.agent":{"null":false,"item_class":"column","filter":[2,1,3,4,7]},"ticket.customer":{"item_class":"column","nulloption":false,"null":true,"filter":[1,4],"default":1}},"edit":{"ticket.agent":{"nulloption":false,"null":false,"filter":[2,3,4,7]},"ticket.customer":{"nulloption":false,"null":true,"filter":[2,4],"default":2}}},"position":40,"id":8},{"name":"pending_time","object":"Ticket","display":"Pending till","active":true,"editable":false,"data_type":"datetime","data_option":{"future":true,"past":false,"diff":null,"null":true,"translate":true,"permission":["ticket.agent"]},"screens":{"create_middle":{"-all-":{"null":false,"item_class":"column"}},"edit":{"-all-":{"null":false}}},"position":41,"id":9},{"name":"priority_id","object":"Ticket","display":"Priority","active":true,"editable":false,"data_type":"select","data_option":{"relation":"TicketPriority","nulloption":false,"multiple":false,"null":false,"default":2,"translate":true,"maxlength":255},"screens":{"create_middle":{"ticket.agent":{"null":false,"item_class":"column"}},"edit":{"ticket.agent":{"null":false}}},"position":80,"id":10},{"name":"login","object":"User","display":"Login","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":100,"null":true,"autocapitalize":false,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{},"view":{"-all-":{"shown":false}}},"position":100,"id":17},{"name":"type_id","object":"TicketArticle","display":"Type","active":true,"editable":false,"data_type":"select","data_option":{"relation":"TicketArticleType","nulloption":false,"multiple":false,"null":false,"default":10,"translate":true,"maxlength":255},"screens":{"create_middle":{},"edit":{"ticket.agent":{"null":false}}},"position":100,"id":12},{"name":"firstname","object":"User","display":"First name","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":150,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{"-all-":{"null":true}},"invite_agent":{"-all-":{"null":true}},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":200,"id":18},{"name":"internal","object":"TicketArticle","display":"Visibility","active":true,"editable":false,"data_type":"select","data_option":{"options":{"true":"internal","false":"public"},"nulloption":false,"multiple":false,"null":true,"default":false,"translate":true,"maxlength":255},"screens":{"create_middle":{},"edit":{"ticket.agent":{"null":false}}},"position":200,"id":13},{"name":"name","object":"Group","display":"Name","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":150,"null":false},"screens":{"create":{"-all-":{"null":false}},"edit":{"-all-":{"null":false}},"view":{"-all-":{"shown":true}}},"position":200,"id":44},{"name":"name","object":"Organization","display":"Name","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":150,"null":false,"item_class":"formGroup--halfSize"},"screens":{"edit":{"-all-":{"null":false}},"create":{"-all-":{"null":false}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":true}}},"position":200,"id":38},{"name":"assignment_timeout","object":"Group","display":"Assignment Timeout","active":true,"editable":false,"data_type":"integer","data_option":{"maxlength":150,"null":true,"note":"Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.","min":0,"max":999999},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}}},"position":300,"id":45},{"name":"lastname","object":"User","display":"Last name","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":150,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{"-all-":{"null":true}},"invite_agent":{"-all-":{"null":true}},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":300,"id":19},{"name":"to","object":"TicketArticle","display":"To","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":1000,"null":true},"screens":{"create_middle":{},"edit":{"ticket.agent":{"null":true}}},"position":300,"id":14},{"name":"cc","object":"TicketArticle","display":"CC","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":1000,"null":true},"screens":{"create_top":{},"create_middle":{},"edit":{"ticket.agent":{"null":true}}},"position":400,"id":15},{"name":"email","object":"User","display":"Email","active":true,"editable":false,"data_type":"input","data_option":{"type":"email","maxlength":150,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{"-all-":{"null":true}},"invite_agent":{"-all-":{"null":true}},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":400,"id":20},{"name":"follow_up_possible","object":"Group","display":"Follow-up possible","active":true,"editable":false,"data_type":"select","data_option":{"default":"yes","options":{"yes":"yes","new_ticket":"do not reopen Ticket but create new Ticket"},"null":false,"note":"Follow-up for closed ticket possible or not.","translate":true,"nulloption":true,"maxlength":255},"screens":{"create":{"-all-":{"null":false}},"edit":{"-all-":{"null":false}}},"position":400,"id":46},{"name":"follow_up_assignment","object":"Group","display":"Assign Follow-Ups","active":true,"editable":false,"data_type":"select","data_option":{"default":"true","options":{"true":"yes","false":"no"},"null":false,"note":"Assign follow-up to latest agent again.","translate":true,"nulloption":true,"maxlength":255},"screens":{"create":{"-all-":{"null":false}},"edit":{"-all-":{"null":false}}},"position":500,"id":47},{"name":"web","object":"User","display":"Web","active":true,"editable":false,"data_type":"input","data_option":{"type":"url","maxlength":250,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":500,"id":21},{"name":"body","object":"TicketArticle","display":"Text","active":true,"editable":false,"data_type":"richtext","data_option":{"type":"richtext","maxlength":150000,"upload":true,"rows":8,"null":true},"screens":{"create_top":{"-all-":{"null":false}},"edit":{"-all-":{"null":true}}},"position":600,"id":16},{"name":"email_address_id","object":"Group","display":"Email","active":true,"editable":false,"data_type":"select","data_option":{"default":"","multiple":false,"null":true,"relation":"EmailAddress","nulloption":true,"do_not_log":true,"maxlength":255},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}}},"position":600,"id":48},{"name":"phone","object":"User","display":"Phone","active":true,"editable":false,"data_type":"input","data_option":{"type":"tel","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":600,"id":22},{"name":"signature_id","object":"Group","display":"Signature","active":true,"editable":false,"data_type":"select","data_option":{"default":"","multiple":false,"null":true,"relation":"Signature","nulloption":true,"do_not_log":true,"maxlength":255},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}}},"position":600,"id":49},{"name":"mobile","object":"User","display":"Mobile","active":true,"editable":false,"data_type":"input","data_option":{"type":"tel","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":700,"id":23},{"name":"fax","object":"User","display":"Fax","active":true,"editable":false,"data_type":"input","data_option":{"type":"tel","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":800,"id":24},{"name":"organization_id","object":"User","display":"Organization","active":true,"editable":false,"data_type":"autocompletion_ajax","data_option":{"multiple":false,"nulloption":true,"null":true,"relation":"Organization","item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":900,"id":25},{"name":"tags","object":"Ticket","display":"Tags","active":true,"editable":false,"data_type":"tag","data_option":{"type":"text","null":true,"translate":false},"screens":{"create_bottom":{"ticket.agent":{"null":true}},"edit":{}},"position":900,"id":11},{"name":"organization_ids","object":"User","display":"Secondary organizations","active":true,"editable":false,"data_type":"autocompletion_ajax","data_option":{"multiple":true,"nulloption":true,"null":true,"relation":"Organization","item_class":"formGroup--halfSize","display_limit":3},"screens":{"signup":{},"invite_agent":{},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":901,"id":26},{"name":"test_text","object":"Ticket","display":"test_text","active":true,"editable":true,"data_type":"input","data_option":{"default":"","type":"text","maxlength":120,"linktemplate":"","null":true,"options":{},"relation":""},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":901,"id":61},{"name":"test_textarea","object":"Ticket","display":"test_textarea","active":true,"editable":true,"data_type":"textarea","data_option":{"default":"","maxlength":500,"rows":4,"null":true,"options":{},"relation":""},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":902,"id":62},{"name":"test_integer","object":"Ticket","display":"test_integer","active":true,"editable":true,"data_type":"integer","data_option":{"default":null,"min":0,"max":999999999,"null":true,"options":{},"relation":""},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":903,"id":63},{"name":"test_date","object":"Ticket","display":"test_date","active":true,"editable":true,"data_type":"date","data_option":{"diff":null,"default":null,"null":true,"options":{},"relation":""},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":904,"id":64},{"name":"test_datetime","object":"Ticket","display":"test_datetime","active":true,"editable":true,"data_type":"datetime","data_option":{"future":true,"past":true,"diff":null,"default":null,"null":true,"options":{},"relation":""},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":905,"id":65},{"name":"test_select","object":"Ticket","display":"test_select","active":true,"editable":true,"data_type":"select","data_option":{"options":{"a":"A","b":"B","c":"C"},"linktemplate":"","default":"","null":true,"relation":"","nulloption":true,"maxlength":255,"historical_options":{"a":"A","b":"B","c":"C"}},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":906,"id":66},{"name":"test_multiselect","object":"Ticket","display":"test_multiselect","active":true,"editable":true,"data_type":"multiselect","data_option":{"options":{"a":"A","b":"B","c":"C"},"linktemplate":"","default":[],"null":true,"relation":"","nulloption":true,"maxlength":255,"multiple":true,"historical_options":{"a":"A","b":"B","c":"C"}},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":907,"id":67},{"name":"test_tree_select","object":"Ticket","display":"test_tree_select","active":true,"editable":true,"data_type":"tree_select","data_option":{"options":[{"name":"a","value":"a","children":[{"name":"b","value":"a::b","children":[{"name":"c","value":"a::b::c"}]}]}],"default":"","null":true,"relation":"","nulloption":true,"maxlength":255,"historical_options":{"a":"a","a::b":"b","a::b::c":"c"}},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":908,"id":68},{"name":"test_multi_tree_select","object":"Ticket","display":"test_multi_tree_select","active":true,"editable":true,"data_type":"multi_tree_select","data_option":{"options":[{"name":"a","value":"a","children":[{"name":"b","value":"a::b","children":[{"name":"c","value":"a::b::c"}]}]}],"default":null,"null":true,"relation":"","multiple":true},"screens":{"create_middle":{"ticket.customer":{"shown":true,"required":false,"item_class":"column"},"ticket.agent":{"shown":true,"required":false,"item_class":"column"}},"edit":{"ticket.customer":{"shown":true,"required":false},"ticket.agent":{"shown":true,"required":false}}},"position":909,"id":69},{"name":"department","object":"User","display":"Department","active":true,"editable":true,"data_type":"input","data_option":{"type":"text","maxlength":200,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1000,"id":27},{"name":"street","object":"User","display":"Street","active":false,"editable":true,"data_type":"input","data_option":{"type":"text","maxlength":100,"null":true},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1100,"id":28},{"name":"zip","object":"User","display":"Zip","active":false,"editable":true,"data_type":"input","data_option":{"type":"text","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1200,"id":29},{"name":"city","object":"User","display":"City","active":false,"editable":true,"data_type":"input","data_option":{"type":"text","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1300,"id":30},{"name":"country","object":"User","display":"Country","active":false,"editable":true,"data_type":"input","data_option":{"type":"text","maxlength":100,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1325,"id":31},{"name":"address","object":"User","display":"Address","active":true,"editable":true,"data_type":"textarea","data_option":{"type":"text","maxlength":500,"rows":4,"null":true,"item_class":"formGroup--halfSize"},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1350,"id":32},{"name":"password","object":"User","display":"Password","active":true,"editable":false,"data_type":"input","data_option":{"type":"password","maxlength":1001,"null":true,"autocomplete":"new-password","item_class":"formGroup--halfSize"},"screens":{"signup":{"-all-":{"null":false}},"invite_agent":{},"invite_customer":{},"edit":{"admin.user":{"null":true}},"create":{"-all-":{"null":true}},"view":{}},"position":1400,"id":33},{"name":"shared","object":"Organization","display":"Shared organization","active":true,"editable":false,"data_type":"boolean","data_option":{"null":true,"default":true,"note":"Customers in the organization can view each other's items.","item_class":"formGroup--halfSize","options":{"true":"yes","false":"no"},"translate":true,"permission":["admin.organization"]},"screens":{"edit":{"-all-":{"null":false}},"create":{"-all-":{"null":false}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":false}}},"position":1400,"id":39},{"name":"shared_drafts","object":"Group","display":"Shared Drafts","active":true,"editable":false,"data_type":"active","data_option":{"null":false,"default":true,"permission":["admin.group"]},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":false}},"view":{"-all-":{"shown":false}}},"position":1400,"id":50},{"name":"domain_assignment","object":"Organization","display":"Domain based assignment","active":true,"editable":false,"data_type":"boolean","data_option":{"null":true,"default":false,"note":"Assign users based on user domain.","item_class":"formGroup--halfSize","options":{"true":"yes","false":"no"},"translate":true,"permission":["admin.organization"]},"screens":{"edit":{"-all-":{"null":false}},"create":{"-all-":{"null":false}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":false}}},"position":1410,"id":40},{"name":"domain","object":"Organization","display":"Domain","active":true,"editable":false,"data_type":"input","data_option":{"type":"text","maxlength":150,"null":true,"item_class":"formGroup--halfSize"},"screens":{"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":false}}},"position":1420,"id":41},{"name":"vip","object":"User","display":"VIP","active":true,"editable":false,"data_type":"boolean","data_option":{"null":true,"default":false,"item_class":"formGroup--halfSize","options":{"false":"no","true":"yes"},"translate":true,"permission":["admin.user","ticket.agent"]},"screens":{"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":false}}},"position":1490,"id":34},{"name":"note","object":"Group","display":"Note","active":true,"editable":false,"data_type":"richtext","data_option":{"type":"text","maxlength":250,"null":true,"note":"Notes are visible to agents only, never to customers."},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1500,"id":51},{"name":"note","object":"Organization","display":"Note","active":true,"editable":false,"data_type":"richtext","data_option":{"type":"text","maxlength":5000,"null":true,"note":"Notes are visible to agents only, never to customers."},"screens":{"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":false}}},"position":1500,"id":42},{"name":"note","object":"User","display":"Note","active":true,"editable":false,"data_type":"richtext","data_option":{"type":"text","maxlength":5000,"null":true,"note":"Notes are visible to agents only, never to customers."},"screens":{"signup":{},"invite_agent":{},"invite_customer":{"-all-":{"null":true}},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":true}}},"position":1500,"id":35},{"name":"role_ids","object":"User","display":"Permissions","active":true,"editable":false,"data_type":"user_permission","data_option":{"null":false,"item_class":"checkbox","permission":["admin.user"]},"screens":{"signup":{},"invite_agent":{"-all-":{"null":false,"default":[2]}},"invite_customer":{},"edit":{"-all-":{"null":true}},"create":{"-all-":{"null":true}},"view":{"-all-":{"shown":false}}},"position":1600,"id":36},{"name":"active","object":"Organization","display":"Active","active":true,"editable":false,"data_type":"active","data_option":{"null":true,"default":true,"permission":["admin.organization"]},"screens":{"edit":{"-all-":{"null":false}},"create":{"-all-":{"null":false}},"view":{"ticket.agent":{"shown":true},"ticket.customer":{"shown":false}}},"position":1800,"id":43},{"name":"active","object":"User","display":"Active","active":true,"editable":false,"data_type":"active","data_option":{"null":true,"default":true,"permission":["admin.user","ticket.agent"]},"screens":{"signup":{},"invite_agent":{},"invite_customer":{},"edit":{"-all-":{"null":false}},"create":{"-all-":{"null":false}},"view":{"-all-":{"shown":false}}},"position":1800,"id":37},{"name":"active","object":"Group","display":"Active","active":true,"editable":false,"data_type":"active","data_option":{"null":true,"default":true,"permission":["admin.group"]},"screens":{"create":{"-all-":{"null":true}},"edit":{"-all-":{"null":false}},"view":{"-all-":{"shown":false}}},"position":1800,"id":52}])
  84. /* working hours and escalation_times */
  85. $('#forms').append('<hr><h1>form condition check #1</h1><form id="form1"></form>')
  86. var el = $('#form1')
  87. var defaults = {
  88. priority1_id: '1',
  89. priority2_id: ['1', '2'],
  90. priority3_id: '2',
  91. priority4_id: '2',
  92. priority5_id: '1',
  93. working_hours: {
  94. mon: {
  95. active: true,
  96. timeframes: [
  97. ['09:00','17:00']
  98. ]
  99. },
  100. tue: {
  101. active: true,
  102. timeframes: [
  103. ['00:00','22:00']
  104. ]
  105. },
  106. wed: {
  107. active: true,
  108. timeframes: [
  109. ['09:00','17:00']
  110. ]
  111. },
  112. thu: {
  113. active: true,
  114. timeframes: [
  115. ['09:00','12:00'],
  116. ['13:00','17:00']
  117. ]
  118. },
  119. fri: {
  120. active: true,
  121. timeframes: [
  122. ['09:00','17:00']
  123. ]
  124. },
  125. sat: {
  126. active: false,
  127. timeframes: [
  128. ['10:00','14:00']
  129. ]
  130. },
  131. sun: {
  132. active: false,
  133. timeframes: [
  134. ['10:00','14:00']
  135. ]
  136. },
  137. },
  138. first_response_time: 150,
  139. solution_time: '',
  140. update_time: 45,
  141. }
  142. new App.ControllerForm({
  143. el: el,
  144. model: {
  145. configure_attributes: [
  146. { name: 'priority1_id', display: 'Priroity1 (with active selection)', tag: 'select', relation: 'TicketPriority', null: true, options: {} },
  147. { name: 'priority2_id', display: 'Priroity2 (with active and inactive selection)', tag: 'select', multiple: true, relation: 'TicketPriority', null: true, options: {} },
  148. { name: 'priority3_id', display: 'Priroity3 (with inactive selection)', tag: 'select', relation: 'TicketPriority', null: true, options: {} },
  149. { name: 'priority4_id', display: 'Priroity4 (with inactive selection)', tag: 'select', multiple: true, relation: 'TicketPriority', null: true, options: {} },
  150. { name: 'priority5_id', display: 'Priroity5 (with active selection)', tag: 'select', multiple: true, relation: 'TicketPriority', null: true, options: {} },
  151. { name: 'escalation_times', display: 'Times', tag: 'sla_times', null: true },
  152. { name: 'working_hours', display: 'Hours', tag: 'business_hours', null: true },
  153. ]
  154. },
  155. params: defaults,
  156. autofocus: true
  157. })
  158. var params = App.ControllerForm.params(el)
  159. var test_params = {
  160. priority1_id: '1',
  161. priority2_id: ['1', '2'],
  162. priority3_id: '2',
  163. priority4_id: ['2'],
  164. priority5_id: ['1'],
  165. first_response_time: '150',
  166. first_response_time_enabled: 'on',
  167. first_response_time_in_text: '02:30',
  168. response_time: '',
  169. response_time_in_text: '',
  170. solution_time: '',
  171. solution_time_enabled: undefined,
  172. solution_time_in_text: '',
  173. update_time: '45',
  174. update_time_enabled: 'on',
  175. update_time_in_text: '00:45',
  176. update_type: 'update',
  177. working_hours: {
  178. mon: {
  179. active: true,
  180. timeframes: [
  181. ['09:00','17:00']
  182. ]
  183. },
  184. tue: {
  185. active: true,
  186. timeframes: [
  187. ['00:00','22:00']
  188. ]
  189. },
  190. wed: {
  191. active: true,
  192. timeframes: [
  193. ['09:00','17:00']
  194. ]
  195. },
  196. thu: {
  197. active: true,
  198. timeframes: [
  199. ['09:00','12:00'],
  200. ['13:00','17:00']
  201. ]
  202. },
  203. fri: {
  204. active: true,
  205. timeframes: [
  206. ['09:00','17:00']
  207. ]
  208. },
  209. sat: {
  210. active: false,
  211. timeframes: [
  212. ['10:00','14:00']
  213. ]
  214. },
  215. sun: {
  216. active: false,
  217. timeframes: [
  218. ['10:00','14:00']
  219. ]
  220. },
  221. },
  222. }
  223. assert.deepEqual(params, test_params, 'form param check #1')
  224. // check possible options
  225. assert.equal(el.find('[name="priority1_id"] option').length, 3)
  226. assert.equal(el.find('[name="priority2_id"] option').length, 4)
  227. assert.equal(el.find('[name="priority3_id"] option').length, 4)
  228. assert.equal(el.find('[name="priority4_id"] option').length, 4)
  229. assert.equal(el.find('[name="priority5_id"] option').length, 3)
  230. // check priority1_id selection order
  231. assert.equal(el.find('[name="priority1_id"] option:nth-child(1)').text(), '1 low')
  232. assert.equal(el.find('[name="priority1_id"] option:nth-child(2)').text(), '3 high')
  233. assert.equal(el.find('[name="priority1_id"] option:nth-child(3)').text(), '4 very high')
  234. // check priority2_id selection order
  235. assert.equal(el.find('[name="priority2_id"] option:nth-child(1)').text(), '1 low')
  236. assert.equal(el.find('[name="priority2_id"] option:nth-child(2)').text(), '2 normal')
  237. assert.equal(el.find('[name="priority2_id"] option:nth-child(3)').text(), '3 high')
  238. assert.equal(el.find('[name="priority2_id"] option:nth-child(4)').text(), '4 very high')
  239. // check priority3_id selection order
  240. assert.equal(el.find('[name="priority3_id"] option:nth-child(1)').text(), '1 low')
  241. assert.equal(el.find('[name="priority3_id"] option:nth-child(2)').text(), '2 normal')
  242. assert.equal(el.find('[name="priority3_id"] option:nth-child(3)').text(), '3 high')
  243. assert.equal(el.find('[name="priority3_id"] option:nth-child(4)').text(), '4 very high')
  244. // check priority4_id selection order
  245. assert.equal(el.find('[name="priority4_id"] option:nth-child(1)').text(), '1 low')
  246. assert.equal(el.find('[name="priority4_id"] option:nth-child(2)').text(), '2 normal')
  247. assert.equal(el.find('[name="priority4_id"] option:nth-child(3)').text(), '3 high')
  248. assert.equal(el.find('[name="priority4_id"] option:nth-child(4)').text(), '4 very high')
  249. // check priority5_id selection order
  250. assert.equal(el.find('[name="priority5_id"] option:nth-child(1)').text(), '1 low')
  251. assert.equal(el.find('[name="priority5_id"] option:nth-child(2)').text(), '3 high')
  252. assert.equal(el.find('[name="priority5_id"] option:nth-child(3)').text(), '4 very high')
  253. // change sla times
  254. el.find('[name="first_response_time_in_text"]').val('0:30').trigger('blur')
  255. el.find('#update_time').trigger('click')
  256. var params = App.ControllerForm.params(el)
  257. var test_params = {
  258. priority1_id: '1',
  259. priority2_id: ['1', '2'],
  260. priority3_id: '2',
  261. priority4_id: ['2'],
  262. priority5_id: ['1'],
  263. working_hours: {
  264. mon: {
  265. active: true,
  266. timeframes: [
  267. ['09:00','17:00']
  268. ]
  269. },
  270. tue: {
  271. active: true,
  272. timeframes: [
  273. ['00:00','22:00']
  274. ]
  275. },
  276. wed: {
  277. active: true,
  278. timeframes: [
  279. ['09:00','17:00']
  280. ]
  281. },
  282. thu: {
  283. active: true,
  284. timeframes: [
  285. ['09:00','12:00'],
  286. ['13:00','17:00']
  287. ]
  288. },
  289. fri: {
  290. active: true,
  291. timeframes: [
  292. ['09:00','17:00']
  293. ]
  294. },
  295. sat: {
  296. active: false,
  297. timeframes: [
  298. ['10:00','14:00']
  299. ]
  300. },
  301. sun: {
  302. active: false,
  303. timeframes: [
  304. ['10:00','14:00']
  305. ]
  306. },
  307. },
  308. first_response_time: '30',
  309. first_response_time_enabled: 'on',
  310. first_response_time_in_text: '00:30',
  311. response_time: '',
  312. response_time_in_text: '',
  313. solution_time: '',
  314. solution_time_enabled: undefined,
  315. solution_time_in_text: '',
  316. update_time: '',
  317. update_time_enabled: undefined,
  318. update_time_in_text: '',
  319. update_type: undefined,
  320. }
  321. assert.deepEqual(params, test_params, 'form param check')
  322. // change sla times
  323. el.find('#update_time').attr('checked', false)
  324. el.find('[value=response]').trigger('click')
  325. el.find('[name="response_time_in_text"]').val('4:30').trigger('blur')
  326. var params = App.ControllerForm.params(el)
  327. var test_params = {
  328. priority1_id: '1',
  329. priority2_id: ['1', '2'],
  330. priority3_id: '2',
  331. priority4_id: ['2'],
  332. priority5_id: ['1'],
  333. working_hours: {
  334. mon: {
  335. active: true,
  336. timeframes: [
  337. ['09:00','17:00']
  338. ]
  339. },
  340. tue: {
  341. active: true,
  342. timeframes: [
  343. ['00:00','22:00']
  344. ]
  345. },
  346. wed: {
  347. active: true,
  348. timeframes: [
  349. ['09:00','17:00']
  350. ]
  351. },
  352. thu: {
  353. active: true,
  354. timeframes: [
  355. ['09:00','12:00'],
  356. ['13:00','17:00']
  357. ]
  358. },
  359. fri: {
  360. active: true,
  361. timeframes: [
  362. ['09:00','17:00']
  363. ]
  364. },
  365. sat: {
  366. active: false,
  367. timeframes: [
  368. ['10:00','14:00']
  369. ]
  370. },
  371. sun: {
  372. active: false,
  373. timeframes: [
  374. ['10:00','14:00']
  375. ]
  376. },
  377. },
  378. first_response_time: '30',
  379. first_response_time_enabled: 'on',
  380. first_response_time_in_text: '00:30',
  381. response_time: '270',
  382. response_time_in_text: '04:30',
  383. solution_time: '',
  384. solution_time_enabled: undefined,
  385. solution_time_in_text: '',
  386. update_time: '',
  387. update_time_enabled: 'on',
  388. update_time_in_text: '',
  389. update_type: 'response'
  390. }
  391. assert.deepEqual(params, test_params, 'form param check post response')
  392. /* empty params or defaults */
  393. $('#forms').append('<hr><h1>form condition check #2</h1><form id="form2"></form>')
  394. var el = $('#form2')
  395. new App.ControllerForm({
  396. el: el,
  397. model: {
  398. configure_attributes: [
  399. { name: 'condition', display: 'Conditions', tag: 'ticket_selector', null: true },
  400. { name: 'executions', display: 'Executions', tag: 'ticket_perform_action', null: true, notification: true },
  401. ]
  402. },
  403. autofocus: true
  404. })
  405. var params = App.ControllerForm.params(el)
  406. var test_params = {
  407. condition: {
  408. 'ticket.state_id': {
  409. operator: 'is',
  410. value: [],
  411. },
  412. },
  413. executions: {
  414. 'ticket.state_id': {
  415. value: "4",
  416. },
  417. },
  418. }
  419. assert.deepEqual(params, test_params, 'form param check #2');
  420. /* with params or defaults */
  421. $('#forms').append('<hr><h1>form 3</h1><form id="form3"></form>')
  422. var el = $('#form3')
  423. var defaults = {
  424. condition: {
  425. 'ticket.title': {
  426. operator: 'contains',
  427. value: 'some title',
  428. },
  429. 'ticket.priority_id': {
  430. operator: 'is',
  431. value: [1,2,3],
  432. },
  433. 'ticket.created_at': {
  434. operator: 'before (absolute)',
  435. value: '2015-09-20T03:41:00.000Z',
  436. },
  437. 'ticket.updated_at': {
  438. operator: 'within last (relative)',
  439. range: 'year',
  440. value: 2,
  441. },
  442. 'ticket.organization_id': {
  443. operator: 'is not',
  444. pre_condition: 'specific',
  445. value: 12,
  446. },
  447. 'ticket.owner_id': {
  448. operator: 'is',
  449. pre_condition: 'specific',
  450. value: 47,
  451. },
  452. 'ticket.created_by_id': {
  453. operator: 'is',
  454. pre_condition: 'current_user.id',
  455. value: '',
  456. },
  457. },
  458. executions: {
  459. 'ticket.title': {
  460. value: 'some title new',
  461. },
  462. 'ticket.priority_id': {
  463. value: 3,
  464. },
  465. 'ticket.owner_id': {
  466. pre_condition: 'specific',
  467. value: 47,
  468. },
  469. 'ticket.tags': {
  470. operator: 'remove',
  471. value: 'tag1, tag2',
  472. },
  473. 'notification.email': {
  474. recipient: 'ticket_customer',
  475. subject: 'some subject',
  476. body: "some<br>\nbody",
  477. internal: 'false',
  478. include_attachments: 'false',
  479. },
  480. },
  481. }
  482. new App.ControllerForm({
  483. el: el,
  484. model: {
  485. configure_attributes: [
  486. { name: 'condition', display: 'Conditions', tag: 'ticket_selector', null: true },
  487. { name: 'executions', display: 'Executions', tag: 'ticket_perform_action', null: true, notification: true },
  488. ]
  489. },
  490. params: defaults,
  491. autofocus: true
  492. })
  493. var params = App.ControllerForm.params(el)
  494. var test_params = {
  495. condition: {
  496. 'ticket.title': {
  497. operator: 'contains',
  498. value: 'some title',
  499. },
  500. 'ticket.priority_id': {
  501. operator: 'is',
  502. value: ['1', '2', '3'], // show also invalid proirity, because it's selected
  503. },
  504. 'ticket.created_at': {
  505. operator: 'before (absolute)',
  506. value: '2015-09-20T03:41:00.000Z',
  507. },
  508. 'ticket.updated_at': {
  509. operator: 'within last (relative)',
  510. range: 'year',
  511. value: '2',
  512. },
  513. 'ticket.organization_id': {
  514. operator: 'is not',
  515. pre_condition: 'specific',
  516. value: ['12'],
  517. value_completion: '',
  518. },
  519. 'ticket.owner_id': {
  520. operator: 'is',
  521. pre_condition: 'specific',
  522. value: ['47'],
  523. value_completion: '',
  524. },
  525. 'ticket.created_by_id': {
  526. operator: 'is',
  527. pre_condition: 'current_user.id',
  528. value: [],
  529. value_completion: ''
  530. },
  531. },
  532. executions: {
  533. 'ticket.title': {
  534. value: 'some title new',
  535. },
  536. 'ticket.owner_id': {
  537. pre_condition: 'specific',
  538. value: '47',
  539. value_completion: "Bob Smith <bod@example.com>"
  540. },
  541. 'ticket.priority_id': {
  542. value: '3',
  543. },
  544. 'ticket.tags': {
  545. operator: 'remove',
  546. value: 'tag1, tag2',
  547. },
  548. 'notification.email': {
  549. recipient: ['ticket_customer'],
  550. subject: 'some subject',
  551. body: "some<br>\nbody",
  552. internal: 'false',
  553. include_attachments: 'false',
  554. },
  555. },
  556. }
  557. assert.deepEqual(params, test_params, 'form param check')
  558. // change selector
  559. el.find('[name="condition::ticket.priority_id::value"]').closest('.js-filterElement').find('.js-remove').trigger('click')
  560. el.find('[name="executions::ticket.title::value"]').closest('.js-filterElement').find('.js-remove').trigger('click')
  561. var params = App.ControllerForm.params(el)
  562. var test_params = {
  563. condition: {
  564. 'ticket.title': {
  565. operator: 'contains',
  566. value: 'some title',
  567. },
  568. 'ticket.created_at': {
  569. operator: 'before (absolute)',
  570. value: '2015-09-20T03:41:00.000Z',
  571. },
  572. 'ticket.updated_at': {
  573. operator: 'within last (relative)',
  574. range: 'year',
  575. value: '2',
  576. },
  577. 'ticket.organization_id': {
  578. operator: 'is not',
  579. pre_condition: 'specific',
  580. value: ['12'],
  581. value_completion: '',
  582. },
  583. 'ticket.owner_id': {
  584. operator: 'is',
  585. pre_condition: 'specific',
  586. value: ['47'],
  587. value_completion: '',
  588. },
  589. 'ticket.created_by_id': {
  590. operator: 'is',
  591. pre_condition: 'current_user.id',
  592. value: [],
  593. value_completion: ''
  594. },
  595. },
  596. executions: {
  597. 'ticket.priority_id': {
  598. value: '3',
  599. },
  600. 'ticket.owner_id': {
  601. pre_condition: 'specific',
  602. value: '47',
  603. value_completion: "Bob Smith <bod@example.com>"
  604. },
  605. 'ticket.tags': {
  606. operator: 'remove',
  607. value: 'tag1, tag2',
  608. },
  609. 'notification.email': {
  610. recipient: ['ticket_customer'],
  611. subject: 'some subject',
  612. body: "some<br>\nbody",
  613. internal: 'false',
  614. include_attachments: 'false',
  615. },
  616. },
  617. }
  618. assert.deepEqual(params, test_params, 'form param check')
  619. // change selector
  620. el.find('[name="executions::notification.email::subject"]').closest('.js-filterElement').find('.js-remove').trigger('click')
  621. var params = App.ControllerForm.params(el)
  622. var test_params = {
  623. condition: {
  624. 'ticket.title': {
  625. operator: 'contains',
  626. value: 'some title',
  627. },
  628. 'ticket.created_at': {
  629. operator: 'before (absolute)',
  630. value: '2015-09-20T03:41:00.000Z',
  631. },
  632. 'ticket.updated_at': {
  633. operator: 'within last (relative)',
  634. range: 'year',
  635. value: '2',
  636. },
  637. 'ticket.organization_id': {
  638. operator: 'is not',
  639. pre_condition: 'specific',
  640. value: ['12'],
  641. value_completion: '',
  642. },
  643. 'ticket.owner_id': {
  644. operator: 'is',
  645. pre_condition: 'specific',
  646. value: ['47'],
  647. value_completion: '',
  648. },
  649. 'ticket.created_by_id': {
  650. operator: 'is',
  651. pre_condition: 'current_user.id',
  652. value: [],
  653. value_completion: ''
  654. },
  655. },
  656. executions: {
  657. 'ticket.priority_id': {
  658. value: '3',
  659. },
  660. 'ticket.owner_id': {
  661. pre_condition: 'specific',
  662. value: '47',
  663. value_completion: "Bob Smith <bod@example.com>"
  664. },
  665. 'ticket.tags': {
  666. operator: 'remove',
  667. value: 'tag1, tag2',
  668. },
  669. },
  670. }
  671. assert.deepEqual(params, test_params, 'form param check')
  672. // change selector
  673. el.find('.js-attributeSelector').last().find('select').val('notification.email').trigger('change')
  674. el.find('[name="executions::notification.email::subject"]').val('some subject')
  675. el.find('[data-name="executions::notification.email::body"]').html('lala')
  676. el.find('[data-name="executions::notification.email::recipient"] .js-select.js-option[data-value="ticket_owner"]').trigger('click')
  677. var params = App.ControllerForm.params(el)
  678. var test_params = {
  679. condition: {
  680. 'ticket.title': {
  681. operator: 'contains',
  682. value: 'some title',
  683. },
  684. 'ticket.created_at': {
  685. operator: 'before (absolute)',
  686. value: '2015-09-20T03:41:00.000Z',
  687. },
  688. 'ticket.updated_at': {
  689. operator: 'within last (relative)',
  690. range: 'year',
  691. value: '2',
  692. },
  693. 'ticket.organization_id': {
  694. operator: 'is not',
  695. pre_condition: 'specific',
  696. value: ['12'],
  697. value_completion: '',
  698. },
  699. 'ticket.owner_id': {
  700. operator: 'is',
  701. pre_condition: 'specific',
  702. value: ['47'],
  703. value_completion: '',
  704. },
  705. 'ticket.created_by_id': {
  706. operator: 'is',
  707. pre_condition: 'current_user.id',
  708. value: [],
  709. value_completion: ''
  710. },
  711. },
  712. executions: {
  713. 'ticket.priority_id': {
  714. value: '3',
  715. },
  716. 'ticket.owner_id': {
  717. pre_condition: 'specific',
  718. value: '47',
  719. value_completion: "Bob Smith <bod@example.com>"
  720. },
  721. 'notification.email': {
  722. recipient: ['ticket_owner'],
  723. subject: 'some subject',
  724. body: 'lala',
  725. internal: 'false',
  726. include_attachments: 'false',
  727. },
  728. },
  729. }
  730. assert.deepEqual(params, test_params, 'form param check')
  731. /* with params or defaults */
  732. $('#forms').append('<hr><h1>form 4</h1><form id="form4"></form>')
  733. var el = $('#form4')
  734. var defaults = {
  735. condition: {
  736. 'ticket.title': {
  737. operator: 'contains',
  738. value: 'some title',
  739. },
  740. },
  741. executions: {
  742. 'notification.email': {
  743. recipient: 'ticket_customer',
  744. subject: 'some subject',
  745. body: "some<br>\nbody",
  746. internal: 'false',
  747. include_attachments: 'false',
  748. },
  749. },
  750. }
  751. new App.ControllerForm({
  752. el: el,
  753. model: {
  754. configure_attributes: [
  755. { name: 'condition', display: 'Conditions', tag: 'ticket_selector', null: true },
  756. { name: 'executions', display: 'Executions', tag: 'ticket_perform_action', null: true, notification: true },
  757. ]
  758. },
  759. params: defaults,
  760. autofocus: true
  761. })
  762. var params = App.ControllerForm.params(el)
  763. var test_params = {
  764. condition: {
  765. 'ticket.title': {
  766. operator: 'contains',
  767. value: 'some title',
  768. },
  769. },
  770. executions: {
  771. 'notification.email': {
  772. recipient: ['ticket_customer'],
  773. subject: 'some subject',
  774. body: "some<br>\nbody",
  775. internal: 'false',
  776. include_attachments: 'false',
  777. },
  778. },
  779. }
  780. assert.deepEqual(params, test_params, 'form param check')
  781. $('#forms').append('<hr><h1>form 5</h1><form id="form5"></form>')
  782. var el = $('#form5')
  783. var defaults = {
  784. condition: {
  785. 'article.body': {
  786. operator: 'contains',
  787. value: 'some body',
  788. },
  789. },
  790. executions: {
  791. 'notification.email': {
  792. recipient: 'ticket_customer',
  793. subject: 'some subject',
  794. body: "some<br>\nbody",
  795. internal: 'false',
  796. include_attachments: 'true',
  797. },
  798. },
  799. }
  800. new App.ControllerForm({
  801. el: el,
  802. model: {
  803. configure_attributes: [
  804. { name: 'condition', display: 'Conditions', tag: 'ticket_selector', null: true },
  805. { name: 'executions', display: 'Executions', tag: 'ticket_perform_action', null: true, notification: true },
  806. ]
  807. },
  808. params: defaults,
  809. autofocus: true
  810. })
  811. var params = App.ControllerForm.params(el)
  812. var test_params = {
  813. condition: {
  814. 'article.body': {
  815. operator: 'contains',
  816. value: 'some body',
  817. },
  818. },
  819. executions: {
  820. 'notification.email': {
  821. recipient: ['ticket_customer'],
  822. subject: 'some subject',
  823. body: "some<br>\nbody",
  824. internal: 'false',
  825. include_attachments: 'true',
  826. },
  827. },
  828. }
  829. assert.deepEqual(params, test_params, 'form article body param check')
  830. App.User.refresh([
  831. {
  832. id: 44,
  833. login: 'bod@example.com',
  834. email: 'bod@example.com',
  835. firstname: 'Bob',
  836. lastname: 'Smith',
  837. active: true,
  838. created_at: '2014-06-10T11:17:34.000Z',
  839. },
  840. {
  841. id: 45,
  842. login: 'john@example.com',
  843. email: 'john@example.com',
  844. firstname: 'John',
  845. lastname: 'Doe',
  846. active: true,
  847. created_at: '2014-07-10T11:17:34.000Z',
  848. },
  849. {
  850. id: 46,
  851. login: 'sam@example.com',
  852. email: 'sam@example.com',
  853. firstname: 'Sam',
  854. lastname: 'Bond',
  855. active: true,
  856. created_at: '2014-08-10T11:17:34.000Z',
  857. },
  858. {
  859. id: 30,
  860. login: 'clark@example.com',
  861. email: 'clark@example.com',
  862. firstname: 'Clark',
  863. lastname: 'Olsen',
  864. active: true,
  865. created_at: '2016-02-10T11:17:34.000Z',
  866. },
  867. {
  868. id: 31,
  869. login: 'james@example.com',
  870. email: 'james@example.com',
  871. firstname: 'James',
  872. lastname: 'Puth',
  873. active: true,
  874. created_at: '2016-03-10T11:17:34.000Z',
  875. },
  876. {
  877. id: 32,
  878. login: 'charles@example.com',
  879. email: 'charles@example.com',
  880. firstname: 'Charles',
  881. lastname: 'Kent',
  882. active: true,
  883. created_at: '2016-04-10T11:17:34.000Z',
  884. },
  885. ])
  886. App.Organization.refresh([
  887. {
  888. id: 9,
  889. name: 'Org 1',
  890. active: true,
  891. created_at: '2018-06-10T11:19:34.000Z',
  892. },
  893. {
  894. id: 10,
  895. name: 'Org 2',
  896. active: true,
  897. created_at: '2018-06-10T11:19:34.000Z',
  898. },
  899. {
  900. id: 11,
  901. name: 'Org 3',
  902. active: true,
  903. created_at: '2018-06-10T11:19:34.000Z',
  904. },
  905. ])
  906. /* with params or defaults */
  907. $('#forms').append('<hr><h1>form condition check for multiple user and organisation selection</h1><form id="form6"></form>')
  908. var el = $('#form6')
  909. var defaults = {
  910. condition: {
  911. 'ticket.title': {
  912. operator: 'contains',
  913. value: 'some title',
  914. },
  915. 'ticket.organization_id': {
  916. operator: 'is',
  917. pre_condition: 'specific',
  918. value: [9, 10, 11],
  919. },
  920. 'ticket.owner_id': {
  921. operator: 'is not',
  922. pre_condition: 'specific',
  923. value: [44, 45, 46],
  924. },
  925. 'ticket.customer_id': {
  926. operator: 'is',
  927. pre_condition: 'specific',
  928. value: [30, 31, 32],
  929. },
  930. },
  931. executions: {
  932. 'ticket.title': {
  933. value: 'some title new',
  934. },
  935. 'ticket.owner_id': {
  936. pre_condition: 'specific',
  937. value: 44,
  938. },
  939. },
  940. }
  941. new App.ControllerForm({
  942. el: el,
  943. model: {
  944. configure_attributes: [
  945. { name: 'condition', display: 'Conditions', tag: 'ticket_selector', null: true },
  946. { name: 'executions', display: 'Executions', tag: 'ticket_perform_action', null: true, notification: true },
  947. ]
  948. },
  949. params: defaults,
  950. autofocus: true
  951. })
  952. var params = App.ControllerForm.params(el)
  953. var test_params = {
  954. condition: {
  955. 'ticket.title': {
  956. operator: 'contains',
  957. value: 'some title',
  958. },
  959. 'ticket.organization_id': {
  960. operator: 'is',
  961. pre_condition: 'specific',
  962. value: ['9', '10', '11'],
  963. value_completion: ''
  964. },
  965. 'ticket.owner_id': {
  966. operator: 'is not',
  967. pre_condition: 'specific',
  968. value: ['44', '45', '46'],
  969. value_completion: ''
  970. },
  971. 'ticket.customer_id': {
  972. operator: 'is',
  973. pre_condition: 'specific',
  974. value: ['30', '31', '32'],
  975. value_completion: ''
  976. },
  977. },
  978. executions: {
  979. 'ticket.title': {
  980. value: 'some title new',
  981. },
  982. 'ticket.owner_id': {
  983. pre_condition: 'specific',
  984. value: '44',
  985. value_completion: "Bob Smith <bod@example.com>"
  986. },
  987. },
  988. }
  989. assert.deepEqual(params, test_params, 'form param condition check for multiple users and organisation')
  990. // https://github.com/zammad/zammad/issues/4153
  991. $('#forms').append('<hr><h1>Trigger Attribute "action > is > updated" is not working after Zammad 5.2 update #4153</h1><form id="form7"></form>')
  992. var el = $('#form7')
  993. var defaults = {
  994. condition: {
  995. 'ticket.action': {
  996. operator: 'is',
  997. value: 'update',
  998. },
  999. 'ticket.state_id': {
  1000. operator: 'is',
  1001. pre_condition: 'specific',
  1002. value: [1],
  1003. },
  1004. },
  1005. cw_condition: {
  1006. 'ticket.test_select': {
  1007. operator: 'is',
  1008. pre_condition: 'specific',
  1009. value: ['a'],
  1010. },
  1011. 'ticket.test_multiselect': {
  1012. operator: 'is',
  1013. pre_condition: 'specific',
  1014. value: ['a'],
  1015. },
  1016. 'ticket.test_tree_select': {
  1017. operator: 'is',
  1018. pre_condition: 'specific',
  1019. value: ['a'],
  1020. },
  1021. 'ticket.test_multi_tree_select': {
  1022. operator: 'is',
  1023. pre_condition: 'specific',
  1024. value: ['a'],
  1025. },
  1026. },
  1027. cw_perform: {
  1028. 'ticket.test_select': {
  1029. operator: ['select', 'set_fixed_to'],
  1030. select: 'a',
  1031. set_fixed_to: ['a'],
  1032. },
  1033. 'ticket.test_multiselect': {
  1034. operator: ['select', 'set_fixed_to'],
  1035. select: ['a'],
  1036. set_fixed_to: ['a'],
  1037. },
  1038. 'ticket.test_tree_select': {
  1039. operator: ['select', 'set_fixed_to'],
  1040. select: 'a',
  1041. set_fixed_to: ['a'],
  1042. },
  1043. 'ticket.test_multi_tree_select': {
  1044. operator: ['select', 'set_fixed_to'],
  1045. select: ['a'],
  1046. set_fixed_to: ['a'],
  1047. },
  1048. },
  1049. }
  1050. new App.ControllerForm({
  1051. el: el,
  1052. model: {
  1053. configure_attributes: [
  1054. { name: 'condition', display: 'ticket_selector', tag: 'ticket_selector', null: true, action: true },
  1055. { name: 'cw_condition', display: 'core_workflow_condition', tag: 'core_workflow_condition', null: true },
  1056. { name: 'cw_perform', display: 'core_workflow_perform', tag: 'core_workflow_perform', null: true },
  1057. ]
  1058. },
  1059. params: defaults,
  1060. autofocus: true
  1061. })
  1062. assert.equal(undefined, $("#form7 select[name='condition::ticket.action::value']").attr('multiple'), 'ticket action is not multiple')
  1063. assert.equal('multiple', $("#form7 select[name='condition::ticket.state_id::value']").attr('multiple'), 'state id is multiple')
  1064. // https://github.com/zammad/zammad/issues/4193
  1065. assert.equal('multiple', $("#form7 select[name='cw_condition::ticket.test_select::value']").attr('multiple'), 'cw_condition test_select is multiple')
  1066. assert.equal('multiple', $("#form7 select[name='cw_condition::ticket.test_multiselect::value']").attr('multiple'), 'cw_condition test_multiselect is multiple')
  1067. assert.equal('multiple', $("#form7 select[name='cw_condition::ticket.test_tree_select::value']").attr('multiple'), 'cw_condition test_tree_select is multiple')
  1068. assert.equal('multiple', $("#form7 select[name='cw_condition::ticket.test_multi_tree_select::value']").attr('multiple'), 'cw_condition test_multi_tree_select is multiple')
  1069. // check perform select operator
  1070. assert.equal(undefined, $("#form7 select[name='cw_perform::ticket.test_select::select']").attr('multiple'), 'cw_perform for action select -> test_select is multiple')
  1071. assert.equal('multiple', $("#form7 select[name='cw_perform::ticket.test_multiselect::select']").attr('multiple'), 'cw_perform for action select -> test_multiselect is multiple')
  1072. assert.equal(true, $("#form7 [name='cw_perform::ticket.test_tree_select::select'].js-shadow").is("input"), 'cw_perform for action select -> test_tree_select is multiple')
  1073. assert.equal(false, $("#form7 [name='cw_perform::ticket.test_multi_tree_select::select'].js-shadow").is("input"), 'cw_perform for action select -> test_multi_tree_select is multiple')
  1074. // check perform set_fixed_to operator
  1075. assert.equal('multiple', $("#form7 select[name='cw_perform::ticket.test_select::set_fixed_to']").attr('multiple'), 'cw_perform for action set_fixed_to -> test_select is multiple')
  1076. assert.equal('multiple', $("#form7 select[name='cw_perform::ticket.test_multiselect::set_fixed_to']").attr('multiple'), 'cw_perform for action set_fixed_to -> test_multiselect is multiple')
  1077. assert.equal(false, $("#form7 [name='cw_perform::ticket.test_tree_select::set_fixed_to'].js-shadow").is("input"), 'cw_perform for action set_fixed_to -> test_tree_select is multiple')
  1078. assert.equal(false, $("#form7 [name='cw_perform::ticket.test_multi_tree_select::set_fixed_to'].js-shadow").is("input"), 'cw_perform for action set_fixed_to -> test_multi_tree_select is multiple')
  1079. });
  1080. QUnit.test('check permission tag', assert => {
  1081. App.Permission.refresh([{"name":"admin","note":"Admin Interface","active":true,"preferences":{},"id":1},{"name":"admin.user","note":"Manage %s","active":true,"preferences":{"translations":["Users"]},"id":2},{"name":"admin.group","note":"Manage %s","active":true,"preferences":{"translations":["Groups"]},"id":3},{"name":"admin.role","note":"Manage %s","active":true,"preferences":{"translations":["Roles"]},"id":4},{"name":"admin.organization","note":"Manage %s","active":true,"preferences":{"translations":["Organizations"]},"id":5},{"name":"admin.overview","note":"Manage %s","active":true,"preferences":{"translations":["Overviews"]},"id":6},{"name":"admin.text_module","note":"Manage %s","active":true,"preferences":{"translations":["Text Modules"]},"id":7},{"name":"admin.time_accounting","note":"Manage %s","active":true,"preferences":{"translations":["Time Accounting"]},"id":8},{"name":"admin.macro","note":"Manage %s","active":true,"preferences":{"translations":["Macros"]},"id":9},{"name":"admin.tag","note":"Manage %s","active":true,"preferences":{"translations":["Tags"]},"id":10},{"name":"admin.calendar","note":"Manage %s","active":true,"preferences":{"translations":["Calendar"]},"id":11},{"name":"admin.sla","note":"Manage %s","active":true,"preferences":{"translations":["SLA"]},"id":12},{"name":"admin.trigger","note":"Manage %s","active":true,"preferences":{"translations":["Triggers"]},"id":13},{"name":"admin.scheduler","note":"Manage %s","active":true,"preferences":{"translations":["Scheduler"]},"id":14},{"name":"admin.report_profile","note":"Manage %s","active":true,"preferences":{"translations":["Report Profiles"]},"id":15},{"name":"admin.channel_web","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Web"]},"id":16},{"name":"admin.channel_formular","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Form"]},"id":17},{"name":"admin.channel_email","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Email"]},"id":18},{"name":"admin.channel_twitter","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Twitter"]},"id":19},{"name":"admin.channel_facebook","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Facebook"]},"id":20},{"name":"admin.channel_telegram","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Telegram"]},"id":21},{"name":"admin.channel_google","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Google"]},"id":22},{"name":"admin.channel_microsoft365","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Microsoft 365"]},"id":23},{"name":"admin.channel_sms","note":"Manage %s","active":true,"preferences":{"translations":["Channel - SMS"]},"id":24},{"name":"admin.channel_chat","note":"Manage %s","active":true,"preferences":{"translations":["Channel - Chat"]},"id":25},{"name":"admin.branding","note":"Manage %s","active":true,"preferences":{"translations":["Branding"]},"id":26},{"name":"admin.setting_system","note":"Manage %s Settings","active":true,"preferences":{"translations":["System"]},"id":27},{"name":"admin.security","note":"Manage %s Settings","active":true,"preferences":{"translations":["Security"]},"id":28},{"name":"admin.ticket","note":"Manage %s Settings","active":true,"preferences":{"translations":["Ticket"]},"id":29},{"name":"admin.package","note":"Manage %s","active":true,"preferences":{"translations":["Packages"]},"id":30},{"name":"admin.integration","note":"Manage %s","active":true,"preferences":{"translations":["Integrations"]},"id":31},{"name":"admin.api","note":"Manage %s","active":true,"preferences":{"translations":["API"]},"id":32},{"name":"admin.object","note":"Manage %s","active":true,"preferences":{"translations":["Objects"]},"id":33},{"name":"admin.translation","note":"Manage %s","active":true,"preferences":{"translations":["Translations"]},"id":34},{"name":"admin.monitoring","note":"Manage %s","active":true,"preferences":{"translations":["Monitoring"]},"id":35},{"name":"admin.data_privacy","note":"Manage %s","active":true,"preferences":{"translations":["Data Privacy"]},"id":36},{"name":"admin.maintenance","note":"Manage %s","active":true,"preferences":{"translations":["Maintenance"]},"id":37},{"name":"admin.session","note":"Manage %s","active":true,"preferences":{"translations":["Sessions"]},"id":38},{"name":"admin.webhook","note":"Manage %s","active":true,"preferences":{"translations":["Webhooks"]},"id":39},{"name":"admin.core_workflow","note":"Manage %s","active":true,"preferences":{"translations":["Core Workflow"]},"id":40},{"name":"admin.public_links","note":"Manage %s","active":true,"preferences":{"translations":["Public Links"]},"id":41},{"name":"user_preferences","note":"User Preferences","active":true,"preferences":{},"id":42},{"name":"user_preferences.password","note":"Change %s","active":true,"preferences":{"translations":["Password"]},"id":43},{"name":"user_preferences.notifications","note":"Manage %s","active":true,"preferences":{"translations":["Notifications"],"required":["ticket.agent"]},"id":44},{"name":"user_preferences.access_token","note":"Manage %s","active":true,"preferences":{"translations":["Token Access"]},"id":45},{"name":"user_preferences.language","note":"Change %s","active":true,"preferences":{"translations":["Language"]},"id":46},{"name":"user_preferences.linked_accounts","note":"Manage %s","active":true,"preferences":{"translations":["Linked Accounts"]},"id":47},{"name":"user_preferences.device","note":"Manage %s","active":true,"preferences":{"translations":["Devices"]},"id":48},{"name":"user_preferences.avatar","note":"Manage %s","active":true,"preferences":{"translations":["Avatar"]},"id":49},{"name":"user_preferences.calendar","note":"Access to %s","active":true,"preferences":{"translations":["Calendars"],"required":["ticket.agent"]},"id":50},{"name":"user_preferences.out_of_office","note":"Change %s","active":true,"preferences":{"translations":["Out of Office"],"required":["ticket.agent"]},"id":51},{"name":"user_preferences.overview_sorting","note":"Change %s","active":true,"preferences":{"translations":["Order of Overviews"],"required":["ticket.agent"]},"id":52},{"name":"report","note":"Report Interface","active":true,"preferences":{},"id":53},{"name":"ticket","note":"Ticket Interface","active":true,"preferences":{"disabled":true},"id":54},{"name":"ticket.agent","note":"Access to Agent Tickets based on Group Access","active":true,"preferences":{"plugin":["groups"]},"id":55},{"name":"ticket.customer","note":"Access to Customer Tickets based on current_user and organization","active":true,"preferences":{},"id":56},{"name":"chat","note":"Access to %s","active":true,"preferences":{"translations":["Chat"],"disabled":true},"id":57},{"name":"chat.agent","note":"Access to %s","active":true,"preferences":{"translations":["Chat"]},"id":58},{"name":"cti","note":"CTI","active":true,"preferences":{"disabled":true},"id":59},{"name":"cti.agent","note":"Access to %s","active":true,"preferences":{"translations":["CTI"]},"id":60},{"name":"admin.knowledge_base","note":"Create and set up %s","active":true,"preferences":{"translations":["Knowledge Base"]},"id":61},{"name":"knowledge_base","note":"Manage %s","active":true,"preferences":{"translations":["Knowledge Base"],"disabled":true},"id":62},{"name":"knowledge_base.editor","note":"Manage %s","active":true,"preferences":{"translations":["Knowledge Base Editor"]},"id":63},{"name":"knowledge_base.reader","note":"Manage %s","active":true,"preferences":{"translations":["Knowledge Base Reader"]},"id":64}])
  1082. App.Group.refresh([{"name_last":"Users","assignment_timeout":null,"follow_up_possible":"yes","follow_up_assignment":true,"email_address_id":1,"signature_id":1,"note":"Standard Group/Pool for Tickets.","active":true,"shared_drafts":true,"updated_at":"2022-09-19T13:19:56.314Z","id":1},{"name_last":"some group1","assignment_timeout":null,"follow_up_possible":"yes","follow_up_assignment":true,"email_address_id":null,"signature_id":null,"note":null,"active":true,"shared_drafts":true,"updated_at":"2022-09-19T13:19:56.273Z","id":2}])
  1083. /* permission tag with groups */
  1084. $('#forms').append('<hr><h1>form permission tag check</h1><form id="form8"></form>')
  1085. var el = $('#form8')
  1086. new App.ControllerForm({
  1087. el: el,
  1088. model: {
  1089. configure_attributes: [
  1090. { name: 'group_ids', display: __('Group Permissions'), tag: 'group_permissions', item_class: 'checkbox' },
  1091. ]
  1092. },
  1093. autofocus: true
  1094. })
  1095. el.find('.js-groupListNewItemRow .js-input').trigger('click')
  1096. el.find('.js-groupListNewItemRow .js-option[data-value=2]').trigger('click')
  1097. el.find('.js-groupListNewItemRow input[value="full"]').trigger('click')
  1098. el.find('.js-groupListNewItemRow .js-add').trigger('click')
  1099. assert.notOk(el.find('.js-groupListNewItemRow .js-option[data-value=2]').length, 'option gone from the dropdown after added')
  1100. assert.notOk(el.find('input[name="group_ids::"][value="full"]').prop('checked'), 'checkbox is cleared in new option row')
  1101. assert.ok(el.find('tr[data-id=2]')[0], 'Group row is present')
  1102. assert.ok(el.find('input[name="group_ids::2"][value="full"]').prop('checked'), 'checkbox is moved to the permanent row')
  1103. el.find('.js-remove').trigger('click')
  1104. assert.notOk(el.find('tr[data-id=2]')[0], 'Group row is removed')
  1105. });