-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-pages-simple-replace-date-attribute-mdx-655340f77fb350a79ee8.js
2 lines (2 loc) · 6.37 KB
/
component---src-pages-simple-replace-date-attribute-mdx-655340f77fb350a79ee8.js
1
2
"use strict";(self.webpackChunkmas_playbook=self.webpackChunkmas_playbook||[]).push([[156],{3624:function(e,t,a){a.d(t,{Z:function(){return w}});var n=a(7294),r=a(8650),l=a.n(r),i=a(1597),o=a(811),s=a(87),m=a(5900),c=a.n(m),d=function(e){var t,a=e.title,r=e.theme,l=e.tabs,i=void 0===l?[]:l;return n.createElement("div",{className:c()("PageHeader-module--page-header--NqfPe",(t={},t["PageHeader-module--with-tabs--vbQ-W"]=i.length,t["PageHeader-module--dark-mode--WCeH8"]="dark"===r,t))},n.createElement("div",{className:"bx--grid"},n.createElement("div",{className:"bx--row"},n.createElement("div",{className:"bx--col-lg-12"},n.createElement("h1",{id:"page-title",className:"PageHeader-module--text--Er2EO"},a)))))},u=function(e){var t=e.relativePagePath,a=e.repository,r=(0,i.useStaticQuery)("1364590287").site.siteMetadata.repository,l=a||r,o=l.baseUrl,s=l.subDirectory,m=o+"/edit/"+l.branch+s+"/src/pages"+t;return o?n.createElement("div",{className:"bx--row EditLink-module--row--BEmSX"},n.createElement("div",{className:"bx--col"},n.createElement("a",{className:"EditLink-module--link--IDrl1",href:m},"Edit this page on GitHub"))):null},p=a(4703),h=a(1721),g=function(e){function t(){return e.apply(this,arguments)||this}return(0,h.Z)(t,e),t.prototype.render=function(){var e=this.props,t=e.title,a=e.tabs,r=e.slug,o=r.split("/").filter(Boolean).slice(-1)[0],s=a.map((function(e){var t,a=l()(e,{lower:!0,strict:!0}),s=a===o,m=new RegExp(o+"/?(#.*)?$"),d=r.replace(m,a);return n.createElement("li",{key:e,className:c()((t={},t["PageTabs-module--selected-item--aBB0K"]=s,t),"PageTabs-module--list-item--024o6")},n.createElement(i.Link,{className:"PageTabs-module--link--Kz-7R",to:""+d},e))}));return n.createElement("div",{className:"PageTabs-module--tabs-container--Cdfzw"},n.createElement("div",{className:"bx--grid"},n.createElement("div",{className:"bx--row"},n.createElement("div",{className:"bx--col-lg-12 bx--col-no-gutter"},n.createElement("nav",{"aria-label":t},n.createElement("ul",{className:"PageTabs-module--list--xLqxG"},s))))))},t}(n.Component),f=g,b=a(7296),v=a(5387),E=a(3732),x=function(e){var t=e.date,a=new Date(t);return t?n.createElement(E.X2,{className:"last-modified-date-module--row--XJoYQ"},n.createElement(E.sg,null,n.createElement("div",{className:"last-modified-date-module--text--ogPQF"},"Page last updated: ",a.toLocaleDateString("en-GB",{day:"2-digit",year:"numeric",month:"long"})))):null},w=function(e){var t=e.pageContext,a=e.children,r=e.location,m=e.Title,c=t.frontmatter,h=void 0===c?{}:c,g=t.relativePagePath,E=t.titleType,w=h.tabs,k=h.title,y=h.theme,N=h.description,D=h.keywords,P=h.date,S=(0,v.Z)().interiorTheme,T=(0,i.useStaticQuery)("2456312558").site.pathPrefix,C=T?r.pathname.replace(T,""):r.pathname,I=w?C.split("/").filter(Boolean).slice(-1)[0]||l()(w[0],{lower:!0}):"",O=y||S;return n.createElement(s.Z,{tabs:w,homepage:!1,theme:O,pageTitle:k,pageDescription:N,pageKeywords:D,titleType:E},n.createElement(d,{title:m?n.createElement(m,null):k,label:"label",tabs:w,theme:O}),w&&n.createElement(f,{title:k,slug:C,tabs:w,currentTab:I}),n.createElement(b.Z,{padded:!0},a,n.createElement(u,{relativePagePath:g}),n.createElement(x,{date:P})),n.createElement(p.Z,{pageContext:t,location:r,slug:C,tabs:w,currentTab:I}),n.createElement(o.Z,null))}},4420:function(e,t,a){a.r(t),a.d(t,{_frontmatter:function(){return o},default:function(){return c}});var n=a(3366),r=(a(7294),a(4983)),l=a(3624),i=["components"],o={},s={_frontmatter:o},m=l.Z;function c(e){var t=e.components,a=(0,n.Z)(e,i);return(0,r.kt)(m,Object.assign({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",null,"About this task"),(0,r.kt)("p",null,"Out of the box Maximo® Mobile Technician application uses and display scheduled finish(SCHEDFINISH). This exercise guides on how to substitute the attribute SCHEDFINISH for TARGCOMPDATE on Work Order List page. It also shows how to overwrite the method used on controllers that use SCHEDFINISH."),(0,r.kt)("h2",null,"Procedure"),(0,r.kt)("h3",null,"Step 1: Include a new attribute “targcompdate” into the existing datasource “dswolist”, in the app.xml."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-xml"},' <maximo-datasource id="dswolist" object-structure="mxapiwodetail" saved-query="uxtechnicianownerfilter" order-by="wopriority" pre-load="false" controller="ScheduleDataController" selection-mode="single" geometry-format="geojson" default="false">\n <schema id="gjw7p">\n [...]\n <attribute name="locationnum" sortable="false" id="n_pxp"/>\n <attribute name="targcompdate" sortable="false" id="trg_n83qg"/>\n </schema>\n [...]\n </maximo-datasource>\n')),(0,r.kt)("h3",null,"Step 2: Replace the references in value and expression to hide the existing field in wo-card-group and to present the new attribute, in wo-card-group.xml file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-xml"},' <date-relative slot="slot4" value="{item.targcompdate}" type="date_full_month" text-prefix="Due" hidden="{item.actfinish || (item.computedIsOverDue || !item.targcompdate)}" id="qj_43"/>\n <icon fill="red" slot="slot3" icon="carbon:warning--alt--filled" hidden="{item.actfinish || (!item.computedIsOverDue || !item.targcompdate)}" id="b38em"/>\n <date-relative slot="slot4" value="{item.targcompdate}" type="date_full_month" text-prefix="Overdue since" theme="error" hidden="{item.actfinish || (!item.computedIsOverDue || !item.targcompdate)}" id="qj_467"/>\n')),(0,r.kt)("h3",null,"Step 3: On AppCustomization.js file, create a computedIsOverDue method. This method already exists in the ScheduleDataController controller, so the new definition in AppCustomization overrides the existing one."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"}," computedIsOverDue(item) {\n if (!item.targcompdate) \n return false;\n let due = new Date(item.targcompdate);\n if (isNaN(due)) \n return false;\n due.setHours(0, 0, 0, 0);\n let today = new Date().setHours(0, 0, 0, 0);\n // DO NOT USE manual calculations ; they fail in DST\n // Use the library tools\n let result = this.app.dataFormatter.getDateDiff(\n due.toISOString(),\n new Date(today).toISOString()\n );\n if (result >= 1) \n return true;\n else return false;\n }\n")))}c.isMDXComponent=!0}}]);
//# sourceMappingURL=component---src-pages-simple-replace-date-attribute-mdx-655340f77fb350a79ee8.js.map