Advertisement
Guest User

Code for kanban

a guest
Aug 8th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.79 KB | None | 0 0
  1. @section SampleHeading{
  2. <span class="sampleName">KanbanBoard-Dialog-ASP.NET MVC-SYNCFUSION</span>}
  3. @section MetaTags{
  4. <meta name="description" content="This example demonstrates how to edit data using a dialog box and insert, update, and delete cards in the Syncfusion ASP.NET MVC Kanban component.">
  5. }
  6. @using Syncfusion.JavaScript.Models;
  7. @section ScriptReferenceSection{
  8. <script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
  9. <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
  10. }
  11. @section ControlsSection{
  12. @(Html.EJ().Kanban("Kanban")
  13. .DataSource(ds => ds.URL("GetData").CrudURL("Crud").Adaptor(AdaptorType.UrlAdaptor))
  14. .Columns(col =>
  15. {
  16. col.HeaderText("Backlog").Key("Backlog").ShowAddButton(true).Add();
  17. col.HeaderText("Doing").Key("Doing").ShowAddButton(true).Add();
  18. col.HeaderText("Done").Key("Done").ShowAddButton(true).Add();
  19. col.HeaderText("Testing").Key("Testing").Add();
  20. col.HeaderText("Release Braking").Key("ReleaseBraking").Add();
  21. col.HeaderText("Deployed").Key("Deployed").Add();
  22. col.HeaderText("User Testing").Key("UAT").Add();
  23. col.HeaderText("Completed").Key("Completed").Add();
  24. }).AllowTitle(true)
  25. .AllowSelection(true)
  26. .AllowScrolling(true)
  27. .ScrollSettings(sSettings => { sSettings.Width(700).Height(800); })
  28. .AllowToggleColumn(true)
  29.  
  30. .KeyField("Status")
  31. .Fields(field =>
  32. {
  33.  
  34. field.PrimaryKey("Id");
  35. field.Content("Summary");
  36. field.Tag("Status");
  37. field.CollapsibleCards(collapsibleCards =>
  38. {
  39. collapsibleCards.Field("Status").Key("Close");
  40. });
  41. })
  42. .CustomToolbarItems(cus =>
  43. {
  44. collapsibleCards.Field("Status").Key("Close");
  45. });
  46. })
  47. .CustomToolbarItems(cus =>
  48. {
  49. cus.Template("#Delete").Add();
  50. })
  51. .EnableTouch(true)
  52.  
  53. .EditSettings(edit =>
  54. {
  55. edit.AllowAdding(true)
  56. .AllowEditing(true)
  57.  
  58. .EditItems(e =>
  59. {
  60. edit.AllowAdding(true)
  61. .AllowEditing(true)
  62.  
  63.  
  64. e.Field("Status").EditType(KanbanEditingType.Dropdown).Add();
  65. e.Field("Assignee").EditType(KanbanEditingType.Dropdown).Add();
  66. e.Field("Progress").EditType(KanbanEditingType.Dropdown).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2 }).ValidationRules(rule => { rule.AddRule("range", "[0,100]"); }).Add();
  67. e.Field("Estimate").EditType(KanbanEditingType.Numeric).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2 }).ValidationRules(rule => { rule.AddRule("range", "[0,100]"); }).Add();
  68. e.Field("Summary").EditType(KanbanEditingType.TextArea).ValidationRules(rule => { rule.AddRule("required", true); }).Add();
  69. }).EditMode(KanbanEditMode.DialogTemplate);
  70. })
  71. .AllowTitle(true)
  72. .AllowSelection(true)
  73. .KeyField("Status")
  74. .ClientSideEvents(eve =>
  75. {
  76. eve
  77. .ToolBarClick("toolbarClick")
  78. .ActionComplete("complete");
  79. })
  80.  
  81. .Fields(field =>
  82. {
  83. field.Color("Type")
  84. .Content("Summary")
  85. .ImageUrl("ImgUrl")
  86. .PrimaryKey("Id");
  87.  
  88. })
  89. .FilterSettings(filter =>
  90. {
  91. filter.Text("Janet Issues").Query("new ej.Query().where('Assignee', 'equal', 'Janet')").Description("Displays issues which matches the assignee as 'Janet").Add();
  92. filter.Text("Closed Issues").Query("new ej.Query().where('Status', 'equal', 'Close')").Description("Display the 'Closed' issues").Add();
  93. })
  94.  
  95. .CardSettings(card =>
  96. {
  97.  
  98. card.ColorMapping(color =>
  99. {
  100. color.Add("#cb2027", "Backlog")
  101. .Add("#67ab47", "Doing")
  102. .Add("#fbae19", "Done")
  103. .Add("#fbae19", "ReleaseBraking")
  104. .Add("#fbae19", "Deployed")
  105. .Add("#fbae19", "UAT")
  106. .Add("#fbae19", "Completed")
  107. .Add("#6a5da8", "Testing");
  108. });
  109. card.Template("#cardTemplate");
  110. })
  111. )
  112.  
  113. }
  114. @section PropertiesSection{
  115. <div class="row">
  116. <div class="col-md-3">
  117. Edit mode
  118. </div>
  119. <div id="ddl1">
  120. <ul>
  121. <li value="dialog">Dialog Mode</li>
  122. <li value="dialogtemplate">Template Mode</li>
  123. </ul>
  124. </div>
  125. <div class="col-md-3">
  126. @(Html.EJ().DropDownList("kanbanEditMode")
  127. .TargetID("ddl1")
  128. .Width("120px")
  129. .SelectedItemIndex(0)
  130. .ClientSideEvents(eve => { eve.Change("selectChange"); })
  131. )
  132. </div>
  133. </div>
  134. }
  135. @section ScriptSection{
  136. <script id="Delete" type="text/template">
  137. <a class="e-customdelete e-icon" />
  138. </script>
  139. <script id="template" style="display: none" type="text/template">
  140.  
  141. <table cellspacing="10" style="border-spacing: 11px;">
  142. <tr>
  143. <td style="text-align: right;">
  144. Id
  145. </td>
  146. <td style="text-align: left">
  147. <input id="Id" name="Id" value="{{: Id}}" class="e-field e-ejinputtext valid e-disable" style="text-align: right; width: 175px; height: 28px" disabled="disabled" />
  148. </td>
  149. <td style="text-align: right;">
  150. Status
  151. </td>
  152. <td style="text-align: left">
  153. <select id="Status" name="Status">
  154. <option value="Doing">BackLog</option>
  155. <option value="Doing">Doing</option>
  156. <option value="Done">Done</option>
  157. <option value="Completed">Completed</option>
  158. <option value="Testing">Testing</option>
  159. </select>
  160. </td>
  161. </tr>
  162.  
  163. <tr>
  164. <td style="text-align: right;">
  165. SOP Number:
  166. </td>
  167. <td style="text-align: left">
  168. <input type="text" id="SopNumber" name="SopNumber" value="{{:SopNumber}}" />
  169. </td>
  170.  
  171.  
  172. </tr>
  173.  
  174. <tr>
  175. <td style="text-align: right;">
  176. Days Consumed
  177. </td>
  178. <td style="text-align: left">
  179. <label>{{:DaysLeft}}</label>
  180.  
  181. </td>
  182. <td style="text-align: right;">
  183. Days Left
  184. </td>
  185. <td style="text-align: left">
  186. <input type="text" id="DaysLeft" name="DaysLeft" value="{{:DaysLeft}}" />
  187.  
  188. </td>
  189. </tr>
  190. <tr>
  191. <td style="text-align: right;">
  192. Progress
  193. </td>
  194. <td style="text-align: left">
  195. <input type="text" id="Progress" name="Progress" value="{{:Progress}}" />
  196. </td>
  197.  
  198. </tr>
  199.  
  200. <tr>
  201. <td style="text-align: right;">
  202. Estimate
  203. </td>
  204. <td style="text-align: left">
  205. <input type="text" id="Estimate" name="Estimate" value="{{:Estimate}}" />
  206. </td>
  207. <td style="text-align: right;">
  208. Assignee
  209. </td>
  210. <td style="text-align: left">
  211. <select id="Assignee" name="Assignee">
  212. <option value="Nancy Davloio">Nancy Davloio</option>
  213. <option value="Andrew Fuller">Andrew Fuller</option>
  214. <option value="Janet Leverling">Janet Leverling</option>
  215. <option value="Margaret hamilt">Margaret hamilt</option>
  216. <option value="Steven walker">Steven walker</option>
  217. <option value="Michael Suyama">Michael Suyama</option>
  218. <option value="Robert King">Robert King</option>
  219. <option value="Laura Callahan">Laura Callahan</option>
  220. </select>
  221. </td>
  222. </tr>
  223. <tr>
  224.  
  225. <td style="text-align: right;">
  226. Tasks
  227. </td>
  228. <td style="text-align: left">
  229. Add Task
  230. </td>
  231. <td style="text-align: right;">
  232. Assignee
  233. </td>
  234. <td style="text-align: left">
  235. <select id="Assignee" name="Assignee">
  236. <option value="Nancy Davloio">Nancy Davloio</option>
  237. <option value="Andrew Fuller">Andrew Fuller</option>
  238. <option value="Janet Leverling">Janet Leverling</option>
  239. <option value="Margaret hamilt">Margaret hamilt</option>
  240. <option value="Steven walker">Steven walker</option>
  241. <option value="Michael Suyama">Michael Suyama</option>
  242. <option value="Robert King">Robert King</option>
  243. <option value="Laura Callahan">Laura Callahan</option>
  244. </select>
  245. </td>
  246.  
  247. </tr>
  248. <tr>
  249. <td style="text-align: right;">
  250. Tags
  251. </td>
  252. <td style="text-align: left">
  253. <input id="Tags" name="Tags" value="{{: Tags}}" class="e-field e-ejinputtext valid" style="width: 175px; height: 28px" />
  254. </td>
  255. <td style="text-align: right;">
  256. Priority
  257. </td>
  258. <td style="text-align: left">
  259. <select id="Priority" name="Priority">
  260. <option value="Low">Low</option>
  261. <option value="High">High</option>
  262. <option value="Critical">Critical</option>
  263. <option value="Normal">Normal</option>
  264. <option value="Release Breaker">Release Breaker</option>
  265. </select>
  266. </td>
  267. </tr>
  268. <tr>
  269.  
  270. <td style="text-align: right;">
  271. Location
  272. </td>
  273. <td style="text-align: left">
  274. <div>
  275. <label>
  276. @Html.RadioButton("onsite", "On-Site")
  277. On-Site
  278. </label>
  279. </div>
  280. <div>
  281. <label>
  282. @Html.RadioButton("Remote", "Remote")
  283. Remote
  284. </label>
  285. </div>
  286.  
  287. </td>
  288. <td style="text-align: right;">
  289. Type
  290. </td>
  291. <td style="text-align: left">
  292. <select id="Priority" name="Priority">
  293. <option value="Support">Support</option>
  294. <option value="Hardware">Hardware</option>
  295. <option value="Development">Development</option>
  296.  
  297.  
  298. </select>
  299. </td>
  300. </tr>
  301. <tr>
  302. <td style="text-align: right;">
  303. Assigned To
  304. </td>
  305. <td style="text-align: left">
  306. <input id="Tags" name="Tags" value="{{: Tags}}" class="e-field e-ejinputtext valid" style="width: 175px; height: 28px" />
  307. </td>
  308.  
  309.  
  310. </tr>
  311. <tr>
  312. <td style="text-align: right;">
  313. Summary
  314. </td>
  315. <td style="text-align: left">
  316. <textarea id="Summary" name="Summary" class="e-ejinputtext" value="{{: Summary}}" style="width: 270px; height: 95px">{{: Summary}}</textarea>
  317. </td>
  318. </tr>
  319. </table>
  320.  
  321. </script>
  322.  
  323. <script type="text/javascript">
  324. $(function () {
  325. $("#sampleProperties").ejPropertiesPanel();
  326. });
  327. function selectChange(args) {
  328. if (this.getSelectedValue() == "dialogtemplate")
  329. $("#Kanban").ejKanban("option", { "editSettings": { editMode: this.getSelectedValue(), dialogTemplate: "#template" } });
  330. else
  331. $("#Kanban").ejKanban("option", { "editSettings": { editMode: this.getSelectedValue() } });
  332. }
  333. function complete(args) {
  334. if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialogtemplate") {
  335. $("#Progress").ejNumericTextbox({ value: parseFloat($("#Progress").val()), width: "175px", height: "34px", decimalPlaces: 2 });
  336. $("#DaysLeft").ejNumericTextbox({ value: parseFloat($("#DaysLeft").val()), width: "175px", height: "34px", decimalPlaces: 2 });
  337.  
  338.  
  339. $("#Estimate").ejNumericTextbox({ value: parseFloat($("#Estimate").val()), width: "175px", height: "34px", decimalPlaces: 2 });
  340. $("#Assignee").ejDropDownList({ width: '175px' });
  341. $("#Status").ejDropDownList({ width: '175px' });
  342. $("#Priority").ejDropDownList({ width: '175px' });
  343. if (args.requestType == "beginedit" || args.requestType == "add") {
  344. $("#Assignee").ejDropDownList("setSelectedValue", args.data['Assignee']);
  345. $("#Priority").ejDropDownList("setSelectedValue", args.data['Priority']);
  346. $("#Status").ejDropDownList("setSelectedValue", args.data['Status']);
  347. }
  348. $(".e-field").css({ 'width': '175px', 'text-align': 'left' });
  349. }
  350. }
  351.  
  352. function toolbarClick(args) {
  353. if (args.itemName == "Delete" && this.element.find(".e-kanbancard").hasClass("e-cardselection")) {
  354. var selectedcard = this.element.find(".e-cardselection");
  355. this.KanbanEdit.deleteCard(selectedcard.attr("id"));
  356. }
  357.  
  358. }
  359. </script>
  360. <script id="cardtemplate" type="text/x-jsrender">
  361. <table class="e-templatetable">
  362. <tbody>
  363. <tr>
  364. <td class="photo">
  365. <img class="e-imgCard" src="{{:ImageUrl}}" .png">
  366. </td>
  367. <td class="details">
  368. <table>
  369. <tbody>
  370. <tr>
  371. <td class="CardHeader"> Assignee: </td>
  372. <td>{{:Assignee}}</td>
  373. </tr>
  374. <tr>
  375. <td class="CardHeader"> Summary: </td>
  376. <td>{{:Summary}}</td>
  377. </tr>
  378. <tr>
  379. <td class="CardHeader"> Type: </td>
  380. <td>{{:Type}}</td>
  381. </tr>
  382. </tbody>
  383. </table>
  384. </td>
  385. </tr>
  386. <tr>
  387. <td></td>
  388. <td class="e-trianglecell">
  389. " // You need to define td for applycolor
  390. <div class="e-bottom-triangle {{:Type}}"></div>
  391. </td>
  392. </tr>
  393. </tbody>
  394. </table>
  395. </script>
  396. <style type="text/css">
  397. .e-kanban .e-kanbancard .Improvement {
  398. border-bottom-color: #67ab47;
  399. }
  400.  
  401. .e-kanban .e-kanbancard .Bug {
  402. border-bottom-color: #cb2027;
  403. }
  404.  
  405. .e-kanban .e-kanbancard .Story {
  406. border-bottom-color: #179bd7;
  407. }
  408.  
  409. .e-kanban .e-kanbancard .Epic {
  410. border-bottom-color: #fbae19;
  411. }
  412.  
  413. .e-kanban .e-kanbancard .Others {
  414. border-bottom-color: #6a5da8;
  415. }
  416.  
  417. .e-trianglecell {
  418. padding: 0;
  419. }
  420.  
  421. .e-templatetable {
  422. width: 100%;
  423. border-collapse: collapse;
  424. }
  425.  
  426. .details > table {
  427. margin-left: 2px;
  428. border-collapse: separate;
  429. border-spacing: 2px;
  430. width: 100%;
  431. }
  432.  
  433. .details td {
  434. vertical-align: top;
  435. }
  436.  
  437. .details {
  438. padding: 8px 8px 10px 0;
  439. }
  440.  
  441. .photo {
  442. padding: 8px 6px 10px 6px;
  443. text-align: center;
  444. }
  445.  
  446. .CardHeader {
  447. font-weight: bolder;
  448. padding-right: 10px;
  449. }
  450. </style>
  451. }
  452. @section StyleSection{
  453. <style type="text/css" class="cssStyles">
  454. .e-customdelete:before {
  455. content: "\e800";
  456. line-height: 26px;
  457. min-height: 26px;
  458. min-width: 14px;
  459. display: inline-block;
  460. }
  461. </style>
  462. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement