From 4992a109fbb7eef2dfb4b0fc3a598396b36074bc Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 4 Feb 2022 11:37:14 +0530 Subject: [PATCH] final upload from frappesserv01 --- .../__pycache__/hooks.cpython-38.pyc | Bin 1294 -> 1305 bytes .../doctype/app_device/app_device.json | 4 +- .../add_ons/doctype/circular/circular.json | 10 +- .../add_ons/doctype/model_hit/model_hit.json | 10 +- .../doctype/model_usage/model_usage.json | 10 +- .../doctype/teknet_module/teknet_module.json | 10 +- .../feedback_report.cpython-38.pyc | Bin 2108 -> 2196 bytes .../report/feedback_report/feedback_report.py | 6 +- .../model_download_report.cpython-38.pyc | Bin 2586 -> 2524 bytes .../model_download_report.py | 37 +-- .../model_hit_report.cpython-38.pyc | Bin 3990 -> 4185 bytes .../model_hit_report/model_hit_report.js | 15 +- .../model_hit_report/model_hit_report.py | 43 +-- .../apis/__pycache__/addon_api.cpython-38.pyc | Bin 4451 -> 4654 bytes .../__pycache__/app_user_login.cpython-38.pyc | Bin 6585 -> 6763 bytes .../__pycache__/publish_api.cpython-38.pyc | Bin 5974 -> 5974 bytes .../transaction_api.cpython-38.pyc | Bin 1054 -> 1194 bytes .../update_validation.cpython-38.pyc | Bin 8532 -> 9029 bytes smart_service/apis/addon_api.py | 16 +- smart_service/apis/app_user_login.py | 25 +- smart_service/apis/transaction_api.py | 27 +- smart_service/apis/update_validation.py | 29 +- smart_service/hooks.py | 29 +- .../__pycache__/release.cpython-38.pyc | Bin 652 -> 652 bytes .../__pycache__/release_docs.cpython-38.pyc | Bin 431 -> 431 bytes .../_applog_translation.cpython-38.pyc | Bin 1853 -> 2002 bytes .../_applog_translation.py | 27 +- .../_drive_translation.cpython-38.pyc | Bin 2461 -> 2495 bytes .../_drive_translation/_drive_translation.py | 4 +- .../report/_file_structure/_file_structure.js | 212 +++++++------- .../_fuel_translation.cpython-38.pyc | Bin 2386 -> 2426 bytes .../_fuel_translation/_fuel_translation.js | 10 +- .../_fuel_translation/_fuel_translation.py | 4 +- .../_sub_systems_translation.cpython-38.pyc | Bin 2577 -> 2617 bytes .../_sub_systems_translation.py | 4 +- .../_systems_translation.cpython-38.pyc | Bin 2501 -> 2541 bytes .../_systems_translation.py | 4 +- .../_transmission_translation.cpython-38.pyc | Bin 2546 -> 2586 bytes .../_transmission_translation.py | 4 +- .../_variant_translation.cpython-38.pyc | Bin 2489 -> 2536 bytes .../_variant_translation.py | 4 +- ...vehicle_segment_translation.cpython-38.pyc | Bin 2591 -> 2631 bytes .../_vehicle_segment_translation.py | 4 +- .../_vehicle_translation.cpython-38.pyc | Bin 2481 -> 2521 bytes .../_vehicle_translation.py | 4 +- .../installation_report.cpython-38.pyc | Bin 2107 -> 2295 bytes .../installation_report.py | 12 +- .../__pycache__/login_report.cpython-38.pyc | Bin 2120 -> 2486 bytes .../report/login_report/login_report.py | 13 +- .../__pycache__/vehicle.cpython-38.pyc | Bin 2120 -> 2224 bytes .../masters/doctype/vehicle/vehicle.py | 11 +- smart_service/public/css/smart_service.css | 172 ++++++------ .../templates/includes/login/_login.js | 2 +- .../procedure_details/procedure_details.json | 10 +- .../__pycache__/audit_report.cpython-38.pyc | Bin 7386 -> 7923 bytes .../report/audit_report/audit_report.js | 265 +++++++++--------- .../report/audit_report/audit_report.py | 75 +++-- 57 files changed, 622 insertions(+), 490 deletions(-) diff --git a/smart_service/__pycache__/hooks.cpython-38.pyc b/smart_service/__pycache__/hooks.cpython-38.pyc index 4728d9be698a1d79a1cb9f25d2518e4a30cc7826..00905c8a19407c5da126cda3d2080d467d2fd2cf 100644 GIT binary patch delta 332 zcmZusO-sW-5H*_^H8HmJAR-u{;Gq;lMe!$i5xgl<&}GSvacMr5-L#Sv=^v0n*^{6@ z!jo5jNB)6#Paf1=&koGv@!lI|X6`+C!9@^wOS)#4U*vib>{|0h|7?S{5{tHVcb?I( zwRr5WwP{HA5;W|*z7uQKtV^B}d52j>5@=Ql=Qt-B)F(0{qQnx!gvAgM&ZGv8$6CQ@ zk+3}aL!3Ykf|P*EVgz}8{LkE&Qxlkwlxf0>Jfe_-R^sg<donTx9A6X=o@{y>ciRp1v!#z00000 delta 301 zcmbQq)yKsf%FD~e00dheeove`kyn;++C*({u}p?2{uKU9hD^pNffRuh!E{C-OK@U~ zHm6XET#9@;Q8ZCk5(^6A^AdAYZ?S|Hrxx8}%g8S+ z%Bid}D$Y$TDv1XQm1QQU>g6UDm!uXI>!su;msA#{>XoHtWG3ez=#tdplF1vG@^m?Y z4l4pVuZRaoRB=~Bb;KLjx@j^MfuwJ-6_*rcCYKa(PWEOtWE7cP%PhgjHhCKJTxGHR zvecrY%#_r4n6_k~TZ?aT0lD$1WvO{3#gmO#4B6yC7RXP|WQk)8nS6ppNx+YVlZk=p TKZ__66VpGYpDdHVu&4q6k{n+# diff --git a/smart_service/add_ons/doctype/app_device/app_device.json b/smart_service/add_ons/doctype/app_device/app_device.json index 4360a2a..bb85a6b 100644 --- a/smart_service/add_ons/doctype/app_device/app_device.json +++ b/smart_service/add_ons/doctype/app_device/app_device.json @@ -1,6 +1,6 @@ { "actions": [], - "autoname": "I-.####", + "autoname": "AppDev-.####", "creation": "2021-11-08 17:49:56.262550", "doctype": "DocType", "editable_grid": 1, @@ -70,7 +70,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-01-28 12:56:52.746692", + "modified": "2022-02-03 13:10:00.963263", "modified_by": "Administrator", "module": "Add Ons", "name": "App Device", diff --git a/smart_service/add_ons/doctype/circular/circular.json b/smart_service/add_ons/doctype/circular/circular.json index 847733e..6c84461 100644 --- a/smart_service/add_ons/doctype/circular/circular.json +++ b/smart_service/add_ons/doctype/circular/circular.json @@ -11,6 +11,7 @@ "status", "valid_till", "section_break_4", + "circular_image", "description", "amended_from" ], @@ -24,7 +25,7 @@ }, { "fieldname": "description", - "fieldtype": "Text Editor", + "fieldtype": "Small Text", "in_list_view": 1, "label": "Description", "reqd": 1 @@ -58,12 +59,17 @@ "fieldname": "valid_till", "fieldtype": "Date", "label": "Valid Till" + }, + { + "fieldname": "circular_image", + "fieldtype": "Attach", + "label": "Circular Image" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-01-28 12:44:24.971752", + "modified": "2022-02-04 10:27:12.813102", "modified_by": "Administrator", "module": "Add Ons", "name": "Circular", diff --git a/smart_service/add_ons/doctype/model_hit/model_hit.json b/smart_service/add_ons/doctype/model_hit/model_hit.json index 2241dc2..16280e1 100644 --- a/smart_service/add_ons/doctype/model_hit/model_hit.json +++ b/smart_service/add_ons/doctype/model_hit/model_hit.json @@ -14,7 +14,8 @@ "download_vehicle_version", "download_vehicle_date", "download_vehicle_language_id", - "download_vehicle_current_version" + "download_vehicle_current_version", + "device_type" ], "fields": [ { @@ -61,11 +62,16 @@ "fieldname": "download_vehicle_current_version", "fieldtype": "Data", "label": "Download Vehicle Current Version" + }, + { + "fieldname": "device_type", + "fieldtype": "Data", + "label": "Device Type" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-01-28 12:58:06.556118", + "modified": "2022-02-01 13:00:12.216340", "modified_by": "Administrator", "module": "Add Ons", "name": "Model Hit", diff --git a/smart_service/add_ons/doctype/model_usage/model_usage.json b/smart_service/add_ons/doctype/model_usage/model_usage.json index 9b34892..63c0ab1 100644 --- a/smart_service/add_ons/doctype/model_usage/model_usage.json +++ b/smart_service/add_ons/doctype/model_usage/model_usage.json @@ -19,7 +19,8 @@ "procedure_id", "steps_id", "menu_id", - "language" + "language", + "device_type" ], "fields": [ { @@ -91,11 +92,16 @@ "fieldname": "language", "fieldtype": "Data", "label": "Language" + }, + { + "fieldname": "device_type", + "fieldtype": "Data", + "label": "Device Type" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-01-28 12:58:08.631540", + "modified": "2022-02-01 12:59:57.225198", "modified_by": "Administrator", "module": "Add Ons", "name": "Model Usage", diff --git a/smart_service/add_ons/doctype/teknet_module/teknet_module.json b/smart_service/add_ons/doctype/teknet_module/teknet_module.json index f648d5d..66c5b30 100644 --- a/smart_service/add_ons/doctype/teknet_module/teknet_module.json +++ b/smart_service/add_ons/doctype/teknet_module/teknet_module.json @@ -7,7 +7,8 @@ "engine": "InnoDB", "field_order": [ "teknet_module_name", - "active_status" + "active_status", + "flvl_id" ], "fields": [ { @@ -20,11 +21,16 @@ "fieldtype": "Select", "label": "Active Status", "options": "Active\nInactive" + }, + { + "fieldname": "flvl_id", + "fieldtype": "Int", + "label": "Flvl ID" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-01-28 12:56:14.758742", + "modified": "2022-02-02 11:27:22.812375", "modified_by": "Administrator", "module": "Add Ons", "name": "Teknet Module", diff --git a/smart_service/add_ons/report/feedback_report/__pycache__/feedback_report.cpython-38.pyc b/smart_service/add_ons/report/feedback_report/__pycache__/feedback_report.cpython-38.pyc index 1bae9cb74733f1c1a894e71cb722f700cd57aa4a..93471ccf7fbd977fd847fd018ac069b9d3cff1c1 100644 GIT binary patch delta 517 zcmX|-y-piJ6oq$wykjsch$0e2O7KDw8A}N9(?n@OC=E0YDYn3#^_@i~_O6*7E5UfH z)Tt&)Md5vepj444^8jhm>>H#_7l|U*U>ND1x!)YkXzsaM`0~Iz^t@RI*WV}qke?&ZO!)=!OXR1vQTn>JgzxFbz#2Qj~SMky&ifVvEL*j~^(IyQRn>3G|Egg(Dr36TxESNcd`?RH*bhH?8 zrx1$3-V_2HesEN@>uy$hY)oFT)lA)8s`^lJO9E_1L?=Rc_FQOl4=~Ahw!58Bh8yr& zO(+c<#lqu?VuvCM;z1X*AYLKpi(&ntKfd)K1~9_d2u z6l|~{-SsK-Y4n+{&!W$vGkKr5$&TYYK{`eTp-jIPm3%J@CeRwz?|$~qDb6aZhC`Kn zHHs^Z)P~>{{DE~Jgi67;>>r@~RdT%gU-5WVu9=yX()WB%D81o(^3uGcBXT}j`2wdF Bc?JLg diff --git a/smart_service/add_ons/report/feedback_report/feedback_report.py b/smart_service/add_ons/report/feedback_report/feedback_report.py index 715c360..256b482 100644 --- a/smart_service/add_ons/report/feedback_report/feedback_report.py +++ b/smart_service/add_ons/report/feedback_report/feedback_report.py @@ -13,12 +13,12 @@ def execute(filters=None): return columns, data def get_data(filters): + current_db_name = frappe.conf.get("db_name") data = frappe.db.sql("""select uf.name,uf.date,uf.subject,uf.user_name,uf.status,uf.attachments,uf.closure_date,uf.closed_by, uf.description,uf.feedback_type,dealer.dealer_code,dealer.zone,dealer.dealer_name,uf.closure_date,uf.closed_by, - dealer.area,au.user_id,au.first_name from `tabUser Feedback` uf,`tabApp Dealer` dealer,`tabApp Users` au + dealer.area,au.user_id,au.first_name from {0}.`tabUser Feedback` uf,{0}.`tabApp Dealer` dealer,{0}.`tabApp Users` au where uf.user_name = au.name and - (uf.modified between %s and %s) group by uf.name""",(filters.get('from_date'), filters.get('to_date')), as_dict=1) - #frappe.throw("DATA" + str(data)) + (date(uf.modified) between '{1}' and '{2}') group by uf.name""".format(current_db_name,filters.get('from_date'), filters.get('to_date')), as_dict=1) if data: return data else: diff --git a/smart_service/add_ons/report/model_download_report/__pycache__/model_download_report.cpython-38.pyc b/smart_service/add_ons/report/model_download_report/__pycache__/model_download_report.cpython-38.pyc index 89f81915a969074dd2756d6ff304a0ba21263cec..1dbcbb55188ab304a8c30f08f317696ffc242851 100644 GIT binary patch delta 1048 zcmZva&1(}u6u@UTv%5*QyZNfsjcE<^VnGn3CkX}H9!oFvGbmx3H`bJNlTNl3!-jz3 zv8M$OQlvQv-o%T4iUj=wwntHrg6Ny+TBCG^nfHG4KIY@i>*>!W=Z3AX(1iFYvd z-uX#~X+#sp3Xa|noI-L$fR3p6781~0GN33^C^eK6Wh$WC+I9-q5exJ%71B@}G0?#{ z&;~4ItK`v}fn3+YtPz~kE)mQ9Fp0{jD78A$Kp(0wBQzlE60k76kvL8%M?*R(A2T$i z&p=Asm5FUkZ-S$AN9j4G=apVidZ9+{k=!onb$~5vfd30$`pSCWs%H|5whTNt)2lsRMl@ml1x(dHvR==pZpy0bD6-E2|7>xcEl@Wcm5{M240B&AsONTYKKt=}9V)&nnaEkhi*B a-1jVHG@n_Vlb0h}o}SacGbie0-u?zSvJPGV delta 1077 zcmZXS%}X0W6u@WpJKs@bG&a(uP&B28w3>cdp(YA~wNP!gx=bV|3G^x_U&XFf}LUJz2BSn-h90IKJ+dYeijP(5wtJ0 z-`cmpY4{Ir`T%7Z85q@hj1WaFL~t9w!Pb3>2$w(&43Y=Qfy5yB`VAZJbNf6IS_0+U zn21Dr%{2rn5E<58skm|j8F7r5Ihwgg+E0>zYT3tk$LidnS% zp&?P8N+d9cU=AjbbyBBZScpY2Yn$_;WGcIxlQ3*7dwvn-C-;05s;~pPGMaGnHlvVU zAp;Bsm_Eq#A*RQe9-BiO=*3C*CR?Cw!k{9&&@>g-x_29P??%uXO2t<@V#OqSx#Qcl z%u1eUw%(C#lPUFuwZ)ai%(_}RE)jLD%{aZ>4AN>}q$@g(+Lxd9Lr3 z3T0hA+S4svt##?)#LMZ%#DjAv6H4KZtX1=*RItx4pydQNWqssd;Br=dT&h+yyRcU> zic{Kk2=exJPc-RHDb-o#W6nN*;T#J&=S(;owIs;hi4+bkOE>I1*~uGPMNj#huVPZn z@wH{*{1oTMmcR?)AXZrCa2#Y1OE`+1Y3U}GoNX!541*8*SD!$!;qSb{gd>>1zj-eJ zi@*|*d#nKafc@Tj065skA>eQyM}VV!@dLnvz(d{m1rh_pFc{)q!V%!nK289S0kaK@ z{sw%0DBzXVj*xYWCJ<*`o@#c4oN4IRI9!4)X!Sr=*UGx3W}wVg0_^8+Vd|Mz;l->m z*Anp@SImNDmrTP-f;A^)^;)T*=X`|8Jd`b(HIIz4sS(wypEcs9{S4E!x_Wt0&2-BH z&Q=xDI)*Yip8U^iMKg+rT2WV*v(BkDate"), "fieldname": "date", "fieldtype": "Date", "width": 100}, + {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, + {"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, + {"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, + {"label": _("Device Type"), "fieldname": "device_type", "fieldtype": "Data", "width": 130}, + {"label": _("Downloaded Vehicle"), "fieldname": "download_vehicle_id", "fieldtype": "Data", "width": 170}, + {"label": _("Downloaded Version"), "fieldname": "download_vehicle_current_version", "fieldtype": "Data", "width": 250}, + {"label": _("Downloaded Language"), "fieldname": "download_vehicle_language_id", "fieldtype": "Data", "width": 250}, + {"label": _("App Version"), "fieldname": "app_version", "fieldtype": "Data", "width": 150} ] return columns \ No newline at end of file diff --git a/smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc b/smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc index 0a7787af8ea886ebb4b1d0706aaab4b02173c568..7c1b9c72d4b5a70b21c372431573da87a66c4061 100644 GIT binary patch delta 846 zcmZvaJ#W)c6o!3UJGGP8P0|k_rLAd;L>3~3Zc&#YrcxmV7|IacG~*snfrO?Mbjb+ z=_-tF!!I(4ro|c~F9};E!Z(0-E_q*LyHMDh6$X{(+B2=AHEteF zO0C|(T{zQLvv)An@pPv;^7nIbuiQwbKMqFHhg)!lQq##g<~a3v=pF`r8hgPAM}(Wu zGO5jFJ78J1{*O4K!%S?Tuw??@HBLFU^7o#4EFXr-eF&d{^y+sZv-bm*_<43H@4FB! z!&ETbm!aY*Kk@oLN8^BbOhb>3;@o9`4tMFCMKK??Qalwal7Om;D(Sho##QYo>2>EF z73g>n27S(wFx#g*p5bhzPRz%Ve5?si8An)OhTI_?4H7z#v8m|;)ez<1Xa`BQs(4}F cCVS$&y0_J%_TPJ-ShiD?bD<;D%}^2<8)e=;A*^%@pkUnXej83ohzG4 z$04D`T&=*~l+nvjeMIQ?U*neLwOuw;uU|g29vWm}Pz7#(3`-ypbcM(aK_o`xp$t~Q zDvAF&0oDZT;H2ObI4#%!X9UlJ=fLyR`2&)LU_p3b5xgXL8N4Dm2hIy#1+NKS2Nwhv z!6m^P;PS8AE165_LaIqyn}=Mk;(&6Q!1_tpO=@dUm+OvAy#oB2sEhlVD#aG{O8ZU= z2c~0t>(J{bf6|IWsFxR$L)@X>DkOEaO1ox@a*afL(d{H(ZNxOKJO==QXr=m z*9TpCX11(JgU3&>XJR|xdUskx18O}#pdGIH(GF2xuZ5?jpE&J@r_H|>*N!}=MM>yU zo^pRnc&Dz^0_yra0kd3xGB>f0?RJQ>ZORi?R6?axoX`%~p0R_<%r(lfFL{nV7-MwB L?lSMO1r>b*+kVcZ diff --git a/smart_service/add_ons/report/model_hit_report/model_hit_report.js b/smart_service/add_ons/report/model_hit_report/model_hit_report.js index 9e8c13c..f24e839 100644 --- a/smart_service/add_ons/report/model_hit_report/model_hit_report.js +++ b/smart_service/add_ons/report/model_hit_report/model_hit_report.js @@ -43,5 +43,18 @@ frappe.query_reports["Model Hit Report"] = { } } - ] + ], + "formatter": function (value, row, column, data, default_formatter) { + + + if (value === undefined || value === 0 || value === '' || value===null || value==='0' || value==='null' || value==='None'){ + + value = "-" + } + if (data && column.fieldname !== undefined){ + column.align = 'center'; + } + value = default_formatter(value, row, column, data); + return value; + } }; diff --git a/smart_service/add_ons/report/model_hit_report/model_hit_report.py b/smart_service/add_ons/report/model_hit_report/model_hit_report.py index 7034469..cf2ef66 100644 --- a/smart_service/add_ons/report/model_hit_report/model_hit_report.py +++ b/smart_service/add_ons/report/model_hit_report/model_hit_report.py @@ -27,9 +27,9 @@ def get_data(filters): variantfilter=filters['variant'] variantfilter=variantfilter.split(".") - data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language + data = frappe.db.sql("""SELECT date as date, device_id, device_type, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and variant_id='{2}' and (date(date) between '{3}' and '{4}') - GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, variantfilter[1], from_date, to_date), as_dict=1) + GROUP BY date(date), user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, variantfilter[1], from_date, to_date), as_dict=1) for d in data: if d['user_id']: @@ -55,9 +55,9 @@ def get_data(filters): to_date=filters['to_date'] modelfilter=filters['model'] - data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language + data = frappe.db.sql("""SELECT date as date, device_id, device_type, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and (date(date) between '{2}' and '{3}') - GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, from_date, to_date), as_dict=1) + GROUP BY date(date), user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, from_date, to_date), as_dict=1) for d in data: if d['user_id']: @@ -84,9 +84,9 @@ def get_data(filters): to_date=filters['to_date'] variantfilter=filters['variant'] variantfilter=variantfilter.split(".") - data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language + data = frappe.db.sql("""SELECT date as date, device_id, device_type, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and variant_id='{2}' and (date(date) between '{3}' and '{4}') - GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, variantfilter[0], variantfilter[1], from_date, to_date), as_dict=1) + GROUP BY date(date), user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, variantfilter[0], variantfilter[1], from_date, to_date), as_dict=1) for d in data: if d['user_id']: @@ -110,21 +110,22 @@ def get_data(filters): def get_columns(): columns = [ - {"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100}, - {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, - {"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100}, - {"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100}, - {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 100}, - {"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, - {"label": _("Module"), "fieldname": "module_id", "fieldtype": "Data", "width": 150}, - {"label": _("Model"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 100}, - {"label": _("Variant"), "fieldname": "variant_id", "fieldtype": "Data", "width": 100}, - {"label": _("System"), "fieldname": "system_id", "fieldtype": "Data", "width": 100}, - {"label": _("Sub System"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 100}, - {"label": _("Procedure"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 100}, - {"label": _("Steps"), "fieldname": "steps_id", "fieldtype": "Data", "width": 100}, - {"label": _("Language"), "fieldname": "language", "fieldtype": "Data", "width": 100}, - {"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100} + {"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 150}, + {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, + {"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, + {"label": _("Device Type"), "fieldname": "device_type", "fieldtype": "Data", "width": 150}, + {"label": _("Module"), "fieldname": "module_id", "fieldtype": "Data", "width": 150}, + {"label": _("Model"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 150}, + {"label": _("Variant"), "fieldname": "variant_id", "fieldtype": "Data", "width": 150}, + {"label": _("System"), "fieldname": "system_id", "fieldtype": "Data", "width": 150}, + {"label": _("Sub System"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 150}, + {"label": _("Procedure"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 150}, + {"label": _("Steps"), "fieldname": "steps_id", "fieldtype": "Data", "width": 150}, + {"label": _("Language"), "fieldname": "language", "fieldtype": "Data", "width": 150}, + {"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 150} ] return columns diff --git a/smart_service/apis/__pycache__/addon_api.cpython-38.pyc b/smart_service/apis/__pycache__/addon_api.cpython-38.pyc index 1b72664241966fb5b29c76b0ed7a525df66eb217..3535bea54cca08e9afec33cdf61ab5f7e9d37725 100644 GIT binary patch delta 2076 zcmcIkO>f*p81{H~ZLjyko9}M=kxfKPw}euZRw_^xnlxz}(IC-;j|JpIyY^;m z2es^K#Q}*{s#IhN_1IQ$;8H+6Ko9%?5C_E32ZY2=fCEAZc;Cq;O;;ee;E^9a^UnC0 zcl>_*G{7NpTOYr>m;CJim{U7AN>1r^WgV$dqlGK(csmpvRkk-k%Ol6v&Nt&Vx zRjF1}X!?fSA#HM2dTXj9w`H0tN>qpavowRVQ_{v^n%!pZub`HL)en1Wc~CQGs+QQT zQ+-6}`i@X*N2uj~20{f8`auXK=)mn{kh()?h7R^QG}LqGd!aJ~4t+_p(F1bu%tO}? zi4%J}ZxViBd#|gBGvTY7WJ7kx;ncCZ3_E56>9!J0$cskacDNljEN(hYtHz==xkM__ zHThiky-V{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c z`Gr2=0wX$D^eKH}#N`8hiVW>N(r*(I?cFe@NoEFC2nXRL!l?WzF*Y0-HNVY87+H)r zc*sjEs1!0{K>nNg%4U zUyu#6O6K=|GEWm?%g4$0hl=J3Y`E;L^UdU9vpI=YTg=FH>&5M}n5KX*hiMY+PI--2 zLSdto#ADd-8XYcP!Vm)idr_Rj&wAV2;6evlNQeP+zkq=MK@0*E%}!gCR#~~OmKO~) zYiz&j{nA|si_BHdS=p=919>)e<@r~^SD^q0Kim5v{er9Ol-@JKEb|;Q%{bBgTUE9=P7s7+@i@93|JGy&9ztYoQp1f+Gvg{W_d_ zE$}0AiEq>@{K}HNZBLPx}Gx+6WtVQrrve}SVX$RC>z zj|=kU|0qbDIZ7G_L~<2#fu$8o11n_|%>d0RmhBpA1Mnijo3ulfl7noZPsu@+2PKaS zd15(A?F-pydsVKa?47jyEjz>cNFc3GDsFw=4f7TS1 zh}RJ=BH)E8V%KyU9PbET{GzqtiJIq!=$OQ)!$+WKH$_n4tRuMmJ>xb|mB?&(ezk*z zJ_qK1_Q)b;e5Oax_YKVU0>HoYh-_u^mPInEXT+lXBztBByEf7*fxjBX;L(WEm5vY` xDre=A4-Ze2ya9KC{NQeAl5w0Q!s}O@;4&Jju-#{ diff --git a/smart_service/apis/__pycache__/app_user_login.cpython-38.pyc b/smart_service/apis/__pycache__/app_user_login.cpython-38.pyc index 6448e5710696ffdefe77227d65150587985d3622..ee0e18bfaf8e446f7bf3d2a6e7324d41895afb98 100644 GIT binary patch delta 1018 zcma)4O-vI(6y7&&p%k{I(4`bwyKVWgAP53VfP)7kdeTqEOy*_Z_ul*V`*vr2=+m$` zEs8FIt+&s=D%&r`1zXIA`EF+?Slv5$5QofWL$HA12k2wl7jGDQ*HF=8coG5@5<*-q zui5V)vEaE?Jf2k+v>YZ%d8~FFH6R}}LIb$KX>(F=Mar`4G{8feuGirK{ZQWrm&#(p z2EZ15Cyt&lWlI1-M`@dB$6-Ulku_w&Dk6koB2yMM>>A*<`=}VI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>r#$n2;SyN5KZ(3E5?Dir-3R*BW)w`k%Fq?K+%V1Lq|U;>c1_v2uX6!{J@1 zbDDJcHbEMd?WCD4q)cYNVcIJL)Mp%5*Z!>SR`=kEf3`uZ{_uy?ZAs$^fu6vcm+TwgTMz+ Xh98+yG*U23eOMz#SNaGrtC4>I@At1L delta 1113 zcmYjQO=ufO6xK+q^-8iWIks%Ywq!+4?8qiDjUl1Xl>D@&fjEblLQw+Ccz0qg+P}=q zDzR{J3q6!x@-w})rg552j0YGVRKfmn(CFnT>m##xXm$%R;BS zAw0>%#$dQWx_NR|ePg~RYpOf;Y*pulWU=7uP(tiCEQR!xj3 z0ch(+C>al_Kln}kRQ_3gSE-rfnEG5juRH~Hw)EyL96pKB>g%cMiZ1sl_h=~X0Pg06 zd)gHHz&`-W$*%oQ9{w`*7a@B1Y}O@d}uENqxJ} zJ1k>Fj^9Gd$PCh;bR&!t+5D9Ah_~nX3G_}Q%pg<&w6({i?R!GuRIN_65I$#s!3v=rN+0DZaRIp^l~{fR4r4{j{ha>$9%s_>7-IXA5B&p@DE( z9W9r|4piKql7DxZK(U}7o`0R_+CG^Dq z)Ka%OQgyBu2tAHmZI?;v`H+-yDY{frem$kQ+W7GJ#twT8hY&;kzVszIP}|LJ=MILM zoCQ&z@h?DWla96J`3y%r+Vjz}V_YSPp*FLfD2RO~nOh^UUg;CfX2~Qe5|i*lEK=n& zDr_~)bmDi^_pR0;j#B6S$f3SA@Ik^I0qyj4+(l=RJ&bASCW7&liY`3pLPWY8YY;FR n`~gb%lVj}OQ?xz`A~*5b$G|KjaLN`LCl;~P+VV{9wn_d4oS{Vx diff --git a/smart_service/apis/addon_api.py b/smart_service/apis/addon_api.py index 9cd9c34..1164db6 100644 --- a/smart_service/apis/addon_api.py +++ b/smart_service/apis/addon_api.py @@ -9,8 +9,8 @@ current_db_name = frappe.conf.get("db_name") def addon(args): if args == "circular": api = frappe.db.get_list( - "Circular", fields=["name", "title", "status", "description", "valid_till"] - ) + "Circular", fields=["name", "title", "status", "description","circular_image", "valid_till"]) + for i in api: if i["status"] == "Active": i["status"] = True @@ -27,11 +27,7 @@ def addon(args): i["status"] = False elif args == "teknet_group": - api = frappe.db.get_list( - "Teknet Group", - fields=["name", "teknet_group_code", - "teknet_group_description", "active_status"], - ) + api = frappe.db.sql('''SELECT name,teknet_group_code,teknet_group_description,active_status FROM {}.`tabTeknet Group` order by teknet_group_description asc;'''.format(current_db_name),as_dict = True) for i in api: if i["active_status"] == "Active": i["active_status"] = True @@ -146,18 +142,20 @@ def model_hit(args, request): UserID = request["UserID"] AppVersion = request["AppVersion"] DeviceID = request["DeviceID"] + DeviceType = request["DeviceType"] for i in request['VehicleDownloadhits']: model_hit = frappe.new_doc('Model Hit') model_hit.user_id = UserID model_hit.app_version = AppVersion model_hit.device_id = DeviceID + model_hit.device_type = DeviceType model_hit.date = i['Date'] model_hit.download_vehicle_id = i['DownloadVehicleID'] model_hit.download_vehicle_version = i['DownloadVehicleVersion'] model_hit.download_vehicle_date = i['DownloadVehicleDate'] model_hit.download_vehicle_language_id = i['DownloadVehicleLanguageID'] model_hit.download_vehicle_current_version = i['DownloadVehicleCurrentVersion'] - model_hit.save() + model_hit.insert(ignore_if_duplicate=True, ignore_mandatory=True) return {"isSuccessful": True} except: return {"isSuccessful": False} @@ -171,11 +169,13 @@ def model_usage(args, request): UserID = request["UserID"] AppVersion = request["AppVersion"] DeviceID = request["DeviceID"] + DeviceType = request["DeviceType"] for i in request['ModuleUsagehits']: model_usage = frappe.new_doc('Model Usage') model_usage.user_id = UserID model_usage.app_version = AppVersion model_usage.device_id = DeviceID + model_usage.device_type = DeviceType model_usage.date = i['Date'] model_usage.module_id = i['ModuleID'] model_usage.vehicle_id = i['VehicleID'] diff --git a/smart_service/apis/app_user_login.py b/smart_service/apis/app_user_login.py index 92d339b..9f9fa1f 100644 --- a/smart_service/apis/app_user_login.py +++ b/smart_service/apis/app_user_login.py @@ -35,6 +35,7 @@ def app_user_validation(usr, pwd): else: message_to_send={'status':0,'error':'Invalid Credentials'} return message_to_send + elif technician_login==0 and mahindra_login==1: response1 = requests.post("http://www.mahindramile.com/WindowAuth/Service.asmx/ValidateCredential", data=data, headers=headers) decoded1 = response1.content.decode('utf-8') @@ -97,19 +98,19 @@ def app_user_validation(usr, pwd): "FirstName": usr, "LastName": "", "IsActive": "True", - "UserType": "Mahindra User", + "UserType": "", "SkillID": "", "SkillName": "", - "UserTypeDesc": "", + "UserTypeDesc": "Mahindra User", "PasswordChanged": "", "AreaName": "Mahindra", - "Zone": "MAhindra", + "Zone": "Mahindra", "LocationName": "Mahindra", "ChannelNo": "", "ServerDate": "", "ServerTime": "", "DealerName": "Mahindra", - "EmailId": "{}@mahindraemail.com".format(usr), + "EmailId": "{}@mahindra.com".format(usr), "isLDAPAuthenticated": ""} success_msg = None @@ -223,7 +224,7 @@ def grant_user_access(userdata,iid): app_device.os_version = os_version app_device.app_current_version = app_current_version app_device.last_login = now() - app_device.insert(ignore_if_duplicate=True) + app_device.insert() if frappe.db.exists({'doctype':'App Device','device_id' : device_id}): app_user1=frappe.get_last_doc('App Users', filters={"email_id": email}) @@ -251,7 +252,6 @@ def grant_user_access(userdata,iid): else : - frappe.db.sql('''UPDATE {4}.`tabApp Device` set last_logged_in= '{0}', user_name = '{2}', device_type = '{3}' where name = "{1}";'''.format(now(),iid,email,user_type_desc,current_db_name)) frappe.db.commit() app_user2=frappe.get_last_doc('App Users', filters={"email_id": email}) @@ -270,11 +270,12 @@ def grant_user_access(userdata,iid): docu = frappe.get_doc("Fish", None) token = docu.apple user_details['token'] = token - lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True) - lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True) + lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}" order by name desc limit 1;'''.format(current_db_name,device_id), as_list=True) + lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}" order by name desc limit 1;'''.format(current_db_name,email), as_list=True) + try: - user_details['Installation ID'] = lst[-1][0] - user_details['User ID'] = lst1[-1][0] + user_details['Installation ID'] = lst[0][0] + user_details['User ID'] = lst1[0][0] return user_details except: return "Login Failure" @@ -291,8 +292,8 @@ def grant_user_access(userdata,iid): docu = frappe.get_doc("Fish", None) token = docu.apple user_details['token'] = token - lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True) - lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True) + lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}" order by creation asc;'''.format(current_db_name,device_id), as_list=True) + lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}" order by creation asc;'''.format(current_db_name,email), as_list=True) try: user_details['Installation ID'] = lst[-1][0] user_details['User ID'] = lst1[-1][0] diff --git a/smart_service/apis/transaction_api.py b/smart_service/apis/transaction_api.py index ba1986b..d026ec9 100644 --- a/smart_service/apis/transaction_api.py +++ b/smart_service/apis/transaction_api.py @@ -12,13 +12,20 @@ base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public" @frappe.whitelist() def get_technical_manual(args): - manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {1}.`tabVariant Mapping_Assets` where parent='{0}' and category='Technical Manual' and parentfield = 'assets';'''.format(args,current_db_name), as_dict=True) - - for i in manual_out: - file_size = os.path.getsize(base_url+i['file']) - i['file_size']=file_size - if i["active_status"] == "Active": - i["active_status"] = True - else: - i["active_status"] = False - return manual_out \ No newline at end of file + try: + manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {1}.`tabVariant Mapping_Assets` where parent='{0}' and category='Technical Manual' + and parentfield = 'assets';'''.format(args,current_db_name), as_dict=True) + + for i in manual_out: + try: + file_size = os.path.getsize(base_url+i['file']) + i['file_size']=file_size + except: + i['file_size']=0 + if i["active_status"] == "Active": + i["active_status"] = True + else: + i["active_status"] = False + return manual_out + except: + return {"error":"File Not Found"} \ No newline at end of file diff --git a/smart_service/apis/update_validation.py b/smart_service/apis/update_validation.py index 1dbacd9..5d0ee42 100644 --- a/smart_service/apis/update_validation.py +++ b/smart_service/apis/update_validation.py @@ -93,10 +93,10 @@ def check_vehicle_update(vehicle_list): l_id = v['LanguageID'] current_version = v['CurrentVersion'] if publish_type == 'Internal': - publish_data = frappe.db.sql('''select name,CAST(version AS DECIMAL(10,2)) as version from {}.tabPublish where vehicle= '{}' and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active'; + publish_data = frappe.db.sql('''select name,CAST(version AS DECIMAL(10,2)) as version from {}.tabPublish where vehicle= '{}' and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active' and variant_mapping_status= 'Active'; '''.format(current_db_name, vehicle, l_id, publish_type, current_version), as_dict=True) else: - publish_data = frappe.db.sql('''select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active'; + publish_data = frappe.db.sql('''select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active' and variant_mapping_status= 'Active' ; '''.format(current_db_name, vehicle, l_id, publish_type, current_version), as_dict=True) @@ -201,7 +201,7 @@ def check_vehicle_update(vehicle_list): subsys = frappe.db.sql('''select `tabSystem Mapping_Sub System`.idx as subSystemdisplayorder, systems,sub_systems, symptom, component, estimated_time, rts, mat, cover_image, `tabSub Systems`.myid, `tabSystem Mapping_Sub System`.active_status,`tabSystem Mapping_Sub System`.cover_image from {4}.`tabSystem Mapping_Sub System` inner join {4}.`tabSub Systems` on `tabSystem Mapping_Sub System`.sub_systems = `tabSub Systems`.name - where `tabSystem Mapping_Sub System`.parent like '{0}-{3}%' and systems='{1}' and sub_systems='{2}';'''.format( + where `tabSystem Mapping_Sub System`.parent like '{0}-{3}%' and systems='{1}' and sub_systems='{2}' and `tabSystem Mapping_Sub System`.active_status = 'Active';'''.format( d, i, j, l_id, current_db_name), as_dict=True) if len(subsys) > 0: @@ -215,6 +215,13 @@ def check_vehicle_update(vehicle_list): '''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM %s.`tabKilometer Mapping_Items` where sub_systems='%s' order by kilometer_IDX;''' % ( current_db_name, j), as_dict=True) + # kms = frappe.db.sql( + # '''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable,mat FROM {}.`tabKilometer Mapping_Items` where sub_systems='{}' + # and substring(parent,-5,2) = '{}' order by kilometer_IDX;'''.format(current_db_name, j,l_id), as_dict=True) + + # % ( + # current_db_name, j,l_id), as_dict=True) + subsys['Config Kilometer'] = kms for k in appendDict[d][i][j]: @@ -283,4 +290,18 @@ def update_completed(FileName): os.remove(base_url+ FileName) return {'isSuccessful':True} except: - return {'isSuccessful':True} \ No newline at end of file + return {'isSuccessful':True} + +@frappe.whitelist() +def delete_complete(doc=None,method=None): + site_name = cstr(frappe.local.site) + base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public" + path = base_url+'/files/json_files/temp1/' + path_file = os.listdir(path) + if path_file: + for file in path_file: + os.remove(str(path) + str(file)) + + + + \ No newline at end of file diff --git a/smart_service/hooks.py b/smart_service/hooks.py index 5eef174..d816c30 100644 --- a/smart_service/hooks.py +++ b/smart_service/hooks.py @@ -94,24 +94,21 @@ website_context = { # --------------- # Override standard doctype classes -override_doctype_class = { +#override_doctype_class = { # "ToDo": "custom_app.overrides.CustomToDo" - } + #} # Document Events # --------------- # Hook on document methods and events -doc_events = { - "User":{ -# "onload":"smart_service.masters.doctype.vehicle.vehicle.test" - } +#doc_events = { # "*": { # "on_update": "method", # "on_cancel": "method", # "on_trash": "method" # } -} +#} # Scheduled Tasks # --------------- @@ -120,18 +117,18 @@ scheduler_events = { # "all": [ # "smart_service.tasks.all" # ], -# "daily": [ + "daily": [ + "smart_service.apis.app_user_login.login_generate_token" # "smart_service.tasks.daily" -# ], - "hourly": [ + ], +# "hourly": [ #"smart_service.tasks.hourly" - "smart_service.masters.doctype.vehicle.vehicle.test" - #"smart_service.apis.app_user_login.login_generate_token" - #"frappe.website.doctype.web_page.web_page.login" - ] -# "weekly": [ + # "smart_service.apis.app_user_login.login_generate_token", + # ], + "weekly": [ # "smart_service.tasks.weekly" -# ] + "smart_service.apis.update_validation.delete_complete" + ] # "monthly": [ # "smart_service.tasks.monthly" # ] diff --git a/smart_service/mahindra_smart_service/doctype/release/__pycache__/release.cpython-38.pyc b/smart_service/mahindra_smart_service/doctype/release/__pycache__/release.cpython-38.pyc index b73891e97fa086f483aaf6ce5dec794db30b6246..b4d0d4eb33e21cc46ab8ab77e935c6568af287d7 100644 GIT binary patch delta 28 icmeBS?P28&<>lpK0D|HxpA&O8@^UdTGESCYDggjpH3psl delta 28 icmeBS?P28&<>lpK00Q2+>4}dw@^UdTvQCy@Dggjf0R{j7 diff --git a/smart_service/mahindra_smart_service/doctype/release_docs/__pycache__/release_docs.cpython-38.pyc b/smart_service/mahindra_smart_service/doctype/release_docs/__pycache__/release_docs.cpython-38.pyc index c45082ea3c46bfa0bfd727ba790a8a404849a576..723ebc1801ceb06b8e41b002839446e0ed7e9bf2 100644 GIT binary patch delta 20 acmZ3_yq=jml$V!_0SGQ$`Mi;P2_pbCm<8eh delta 20 acmZ3_yq=jml$V!_0SGSl*Kg!r!UzB{#04t= diff --git a/smart_service/mahindra_smart_service/report/_applog_translation/__pycache__/_applog_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_applog_translation/__pycache__/_applog_translation.cpython-38.pyc index b027a7e57acabe8c34117a0778571a130382bcf9..429796fdb14399a2bdba996cc3a64134dbc19356 100644 GIT binary patch delta 673 zcmZ{iJx{_=6o%VUP{HyIeq-ZeG#Xvp2#Jw}#J~VJur!z6D`^64(_V<&Xc(NFn>hI= zjIRC#W1I~Cz}d~o(?X#P_NK{w&U?;#dQSQl|4c|tNs4mt+|Xb2@ht5NyyKh+6%knk zy$pnRKAHmc0$%&esfwl1Dh@x1l*7_JkK;Im#VIF%lL1Zvrvsb;&IULKoDc9C@OpqZ zfH(2h%zqnr2ZxHYKmh`~enCgN<8HY+cOX|;tk^EK44o8D+NH6`;5HV^h@$UD=QMmc z%7a`cs7oyQ(ohlA41JR6j?B_?RW-2Z(TZU&U2y}!gevMSCg>2*j(Cn^ajWG?h#%TPv8j=+(}}THUi144b7OTC2-f#IpTS zqK2&uCd{%RpQ}_GXmltyhURFx7dkY_q6j;hjFZ4{Q>fM>icL|^951_41DNGpH`DaH y$yLMsj#dVlrlR&Oi|BOLIRm*B9UQvd`IaM2Cvv=3aDO==$^UbH#Dw!2dH4h1Ny`cV delta 489 zcmYk(Jxjwt7y#fTO&gjvX|&eQidl;2A_}gBVwNoJ5bKa79Jx~hH3_+Ep+V{3Ai7D` z{t0n*6=%obA8>bY^i8BSfjjQG_v7x!N8?phhKeF{@ICE)BJEk(7x??+R4`v2g*RT- zAaDkQz9+WWor$g zxYYSexT@cBH=M;C?DlQZ4t$b|aXuS}p)Z_R<-?gYq$JW!BbCOma6BAW^PN7rCaHYs zMU*){tmB$N&ERdfn3k#l diff --git a/smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.py b/smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.py index c641f0b..34699f8 100644 --- a/smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.py +++ b/smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.py @@ -15,7 +15,7 @@ def execute(filters=None): return columns, data def get_data(filters): - data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,ad.os,ad.os_version, + data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.area,dealer.dealer_name,ad.os,ad.os_version, al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer where @@ -26,18 +26,19 @@ def get_data(filters): def get_columns(): columns = [ - {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, - {"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 100}, - {"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100}, - {"label": _("Dealer code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100}, - {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 100}, - {"label": _("Device OS"), "fieldname": "os", "fieldtype": "Data", "width": 100}, - {"label": _("OS Version"), "fieldname": "os_version", "fieldtype": "Data", "width": 100}, - {"label": _("Activity Type"), "fieldname": "type", "fieldtype": "Data","width": 100}, - {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, - {"label": _("Activity Date"), "fieldname": "date_time_stamp", "fieldtype": "DateTime","width": 100}, - {"label": _("App Version No"), "fieldname": "app_current_version", "fieldtype": "Data", "width": 100}, - {"label": _("Installation"), "fieldname": "device", "fieldtype": "Data", "width": 100}, + {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Location"), "fieldname": "area", "fieldtype":"Data","width": 150}, + {"label": _("Dealer code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, + {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 300}, + {"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 150}, + {"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 150}, + {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, + {"label": _("Device OS"), "fieldname": "os", "fieldtype": "Data", "width": 150}, + {"label": _("OS Version"), "fieldname": "os_version", "fieldtype": "Data", "width": 150}, + {"label": _("Activity Type"), "fieldname": "type", "fieldtype": "Data","width": 150}, + {"label": _("Activity Date"), "fieldname": "date_time_stamp", "fieldtype": "DateTime","width": 150}, + {"label": _("App Version No"), "fieldname": "app_current_version", "fieldtype": "Data", "width": 150}, + {"label": _("Installation"), "fieldname": "device", "fieldtype": "Data", "width": 150}, ] return columns diff --git a/smart_service/mahindra_smart_service/report/_drive_translation/__pycache__/_drive_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_drive_translation/__pycache__/_drive_translation.cpython-38.pyc index 6c1ccb706ce114c3cebde0ce10c9683193bacefa..de5746624c5ac836aed080a6efcaae76ed31425f 100644 GIT binary patch delta 257 zcmbO$ykD3vl$V!_0SE+heCfj^C1jIi=bN9BnUbk>G64qxv5nwV5ts{NO=p8%OrpV d10xF~6C)P`5dLRlW?>Wo`bdFs66YL7H30lXJSYGF delta 241 zcmdllJXe@6l$V!_0SFGPd6u|EVk6&DX2w&Kw=mZ*b8&KR)@8ZGWXa6J$iXPa$i)Pr zMHso5nS>?YvWN*V6@fG+gEYec3y{GE#LhrmTr}B&-Ah=imbr#;0c#0c4RZ>YBttV} z3isr>?2=YIepTGQ`6-!cnW-rX{&`h=RxXJpsU?}Ysrpt%1_rm-f=d!hN{g$wK;nt| zR)z)!QLHXSnPsVySvmT-qd0RC^U~w<5_3~0ui}W5PXO5{0VEiJ&SYZbVgSPbY(S@r QFmW(SFilqCoWtk`0R8DR=l}o! diff --git a/smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py b/smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py index 2408c11..a6ee3e5 100644 --- a/smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py +++ b/smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py @@ -56,11 +56,11 @@ def get_data(): def get_columns(): columns = [] columns += [ - _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Drive") + ":Data/:220", + _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Drive") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js b/smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js index f398b3c..cf1f7d0 100644 --- a/smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js +++ b/smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js @@ -5,8 +5,8 @@ const pictures = ['jpg','jpeg','png','tif','tiff','ico','bmp','gif','eps','raw'] const videos = ['avi','mp4','mov','wmv','webm','mkv','3gp']; const pdfs = ['pdf']; const documents =['doc','docx','txt','odt','ppt','pptx']; -const spreadsheets=['ods','xls','xlsx']; - +const spreadsheets=['ods','xls','xlsx','csv']; +const zip=['zip','zipx','rar'] frappe.query_reports["_File Structure"] = { "filters": [ @@ -17,72 +17,83 @@ frappe.query_reports["_File Structure"] = { if(data && column.fieldname=="filename" && data.folder==0){ if(data.private==1){ if(pictures.includes(data.fileformat)){ - value = `

- - - - - + value = `

+ + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(pdfs.includes(data.fileformat)){ - value = `

- - - - + value = `

+ + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(spreadsheets.includes(data.fileformat)){ - value = `

- - - - - - - + value = `

+ + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(documents.includes(data.fileformat)){ - value = `

- - - - - - - - - - + value = `

+ + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(videos.includes(data.fileformat)){ - value = `

- - - - - - - + value = `

+ + + + + +       ${value}

` + column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" + }else if(zip.includes(data.fileformat)){ + value = `

+ + + + + + + + + + + + + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else{ - value = `

- - - - - - - + value = `

+ + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" @@ -90,72 +101,83 @@ frappe.query_reports["_File Structure"] = { } else if(data.private==0){ if(pictures.includes(data.fileformat)){ - value = `

- - - - - + value = `

+ + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(pdfs.includes(data.fileformat)){ - value = `

- - - - + value = `

+ + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(spreadsheets.includes(data.fileformat)){ - value = `

- - - - - - - + value = `

+ + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(documents.includes(data.fileformat)){ - value = `

- - - - - - - - - - + value = `

+ + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else if(videos.includes(data.fileformat)){ - value = `

- - - - - - - + value = `

+ + + + + +       ${value}

` + column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" + }else if(zip.includes(data.fileformat)){ + value = `

+ + + + + + + + + + + + + + + + + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" }else{ - value = `

- - - - - - - + value = `

+ + +       ${value}

` column.link_onclick = "frappe.query_reports['_File Structure'].set_route_to_file(" + JSON.stringify(data.filename) + ")" @@ -217,5 +239,5 @@ frappe.query_reports["_File Structure"] = { "tree": true, "name_field": "filename", "parent_field": "", - "initial_depth": 0 + "initial_depth": 4 }; diff --git a/smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc index 0602c88dba07754fd12c0c9cd9fd5e57c296e07b..bb48ca64488e2aa5e4470f8fe2f6a022f324b406 100644 GIT binary patch delta 268 zcmca4^h=00l$V!_0SH#-{7Q`6$ZN)?5XE0unp#xpSWu9fm*SI{mwt;ecp%S=sC@Xxc+PqM4x zvvNr+NiE6DP1UzDGBBv(1*!=yNh~QX21|2+q!ab641rQS+(0?E($pM~%;d@J6U3^R qfg(|yIY8$_Y+wOP>2cUIMorG+P+%0FT*xLoc@c*)qr&8496bQ`Vol!w delta 207 zcmew*bV-Oel$V!_0SNT3eNHsr$ZN)?aErgNG_|PGv7jI|FU2P@FZ~u{$}PsiTg=6& zIky;#ZcR>ROW9cYFTQS7OLhb+n diff --git a/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js b/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js index 3cbf984..176bcf4 100644 --- a/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js +++ b/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js @@ -5,13 +5,5 @@ frappe.query_reports["_Fuel Translation"] = { "filters": [ - ], - "formatter": function (value, row, column, data, default_formatter) { - if(value==null){ - value=' ' - column.align='left'; - } - value = default_formatter(value, row, column, data); - return value; - } + ] }; diff --git a/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py b/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py index 8da4168..b042321 100644 --- a/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py +++ b/smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py @@ -59,11 +59,11 @@ def get_columns(): columns = [] columns += [ - _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Fuel") + ":Data/:220", + _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Fuel") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM {}.`tabCustom Languages` where lang_code <> "en" order by lang_name """.format(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc index 61f911ecf6d3e53afdf577679f0d8e194ea58dcc..0d1cd1c34c23935061dc273bce53c723cab8ca58 100644 GIT binary patch delta 213 zcmbOzvQvaNl$V!_0SIbyey7K5d^K+=i&R)#<+koMrxB!ytE%HopL qT(E-4F&q=bs+fT?QJgu6dFkm9W<^r*KI! zG&81fPv+*3bl~x;;`Yr?$xO>kO;PaAtKzeANi0b%$;?gFw=yy?xWyJ+l2}q&T*U*4lYen2(BzHNzE;uT*)zk`xa+TVqSWDUSe+QWO>eNMv2L@Ip+ZYGL$UX diff --git a/smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py b/smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py index e8c1bfa..130d217 100644 --- a/smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py +++ b/smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py @@ -60,11 +60,11 @@ def get_columns(): columns = [] columns += [ - _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Sub Systems") + ":Data/:300", + _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Sub Systems") + ":Data/:300", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM {0}.`tabCustom Languages` where lang_code <> "en" order by lang_name""".format(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::300") + lang.append(""+cstr(d["lang_name"])+""+ "::300") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc index ccda7dd3958c7956cde99a4e2ca1fea492b3e960..0c3a23076cc982948a72118a6514a86eecc04e2a 100644 GIT binary patch delta 188 zcmX>q{8pGZl$V!_0SIp8{z{D4$m`3_#SY{-195TH

%l$V!_0SKh7e@-;p$m`3_#RlX#195TD

(VdZ}9G8pZ{zC2Td!DO{2a z&5SAB;tUHJ85s)QY8Yx5%^7MLKy(^YFoPzKUlq4+eoAIqW@?Ipe_j=zl}lntYDs2p zs=k$xfx#`d;F83W(&8#Eka(iLl_5}!J-D*CBsCWyXl!6mRT%8*8ysbf5|jNo=K%nG^EQtF diff --git a/smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py b/smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py index c2d3e3e..bddcb85 100644 --- a/smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py +++ b/smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py @@ -57,11 +57,11 @@ def get_columns(): columns = [] columns += [ - _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Systems") + ":Data/:300", + _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Systems") + ":Data/:300", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::300") + lang.append(""+cstr(d["lang_name"])+""+ "::300") columns += lang return columns,lang \ No newline at end of file diff --git a/smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc index b3931dbf23e4304a4df6edb781fe82227d35b490..378d2403d75a6f352c556dd53d81976432ea0c0f 100644 GIT binary patch delta 214 zcmew)JWGT(l$V!_0SKJ(ekGP~P|E(=t<26#VmS z^potW_^ezKOHxZRb5r%Lj0_B_c!6qyOA<>;i^0-dAn8PXD?^}^Fie@+bD$Xm+J#RlX#195TDWag&oTNxP`++qtZNh~QXuHpiT yC+b@n0>yYjiW2jRb2E#JGxPH%Cvfz0-{QModified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Transmission") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc index e9384df2354ebfd57519e4ae1933dd9d7490c985..25ee3eafd8d17a34ae4f81e7fd072707886536fe 100644 GIT binary patch delta 257 zcmdlf{6d&Fl$V!_0SLPDekE?*$UB3LF>3NMHaQ@9lr4da9Vp`r#KkR>_1Qz}m1>!5 z7#Fan@RYFCFsJZJGBh)aGow`%q7G);pm4Gx({=?ocR>cg|5yhF4n3o=(mzbMc#R8U^#^K8-G5HCH8Kc5v NY0fZ4xyePG?g0E9M!Wz3 delta 189 zcmaDMyi=Grl$V!_0SFdf|D4#fk#`0g)@Kh9ma1j0 zVO+pk!dAna!XwGh%$UMEc^C^IpyWU>NBKld%poW#8J_`Jm2)X7IVd>JJt U3v-$=N=)|R3}aN8ypYo!0Hh^2(f|Me diff --git a/smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py b/smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py index 550ef9a..c64438f 100644 --- a/smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py +++ b/smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py @@ -57,11 +57,11 @@ def get_columns(): columns = [] columns += [ - _("Modified On") + ":Data/:240", _("Status") + ":Data/:100", _("Vehicle") + ":Data/:200",_("Variant") + ":Data/:220", + _("Modified On") + ":Data/:240", _("Status") + ":Data/:100", _("Vehicle") + ":Data/:200",_("Variant") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc index b6e0da60580b0a053c9b4033a7299212c707436f..92bccf8c689062b301ff63539170488632dfbe7d 100644 GIT binary patch delta 235 zcmbO)a$JNrl$V!_0SIp7{YqTAkyoCbF>10dyBv`8VNc*<2g*1DadFk;ZR}q4O0~>2 zj0;#(xJuY+m{YhV8JZcz8B%zFm{*)(AtNJ0p<4|@4Wl_jEdz*7V+v-_cp%S=sC@Xxc+PqM4xvvNr+NiE6DP1UzDGBBv(1*!=yNh~QX21|2+q!ab641rQ& zK&i0QjLc-doK%J2)b!lcyb_S2$psw!VpYsQ*;|}BiFxVqd5O8HRV-jBE>1^A$;m#P MCX5P`8#(6z0Fw1T-T(jq delta 174 zcmX>uGGBx@l$V!_0SNqVd`@iM$Scpzcx$pQyBv`8VNc*<1Ijo9adFY)ZR}pcQnk!A zj0;#x*lL(lxFi{x8B@3?OLIuN@c316`{t))re&t4DEQ}9@maYfmZX+s=BDaf85tPd zVhb)wEGaFn;sS{$>RTBa7*z3xrDkL%=cFnGr>5to=9NtD<>=?W#hH_smmZ&&n43D; Th|`f#YH|su38Td1m7MbcTXZu> diff --git a/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py b/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py index 6a0dae9..4e5f1cb 100644 --- a/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py +++ b/smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py @@ -61,11 +61,11 @@ def get_columns(): columns = [] columns += [ - _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Vehicle Segment") + ":Data/:220", + _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Vehicle Segment") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc b/smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc index 13beb396d247ab46d6b451b9b854d5bf3c9d60f7..87dab28bbe08d3136f28b5d5b703e96cfbe8b8e3 100644 GIT binary patch delta 188 zcmdled{dY=l$V!_0SJ`xeKP59QGc`rQKhH)#$*zje$|bQRwInk)Ro}|U zz@Um3s3y21v81#ZEX@UyPSm$D1WNG%rNUA(GLv&sL2{FsIQqq^n1O<~ICB#7(&O_I Ub5pBWz*2KK$`}Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Vehicle") + ":Data/:220", ] lang = [] custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) for d in custom_lang: - lang.append(cstr(d["lang_name"])+ "::220") + lang.append(""+cstr(d["lang_name"])+""+ "::220") columns += lang return columns,lang diff --git a/smart_service/mahindra_smart_service/report/installation_report/__pycache__/installation_report.cpython-38.pyc b/smart_service/mahindra_smart_service/report/installation_report/__pycache__/installation_report.cpython-38.pyc index bdb23da373324dca462725de6eb32a52571e8ef8..e6e01819005ba13422c0cd1b7567f4091b41f227 100644 GIT binary patch delta 690 zcmY*X&ubGw6yBNrm84CYTIxlOV?AtFN>Gmh4^a;lqz7v+f@~*wld$b(H_lEfHCcKP z@uVP&H-+Thi|76k-uLRIB8Yeq?8Uc9Tk61@neY4Fn;E`0N7X-zm928Qq~Z9s{FgUM zUn)PyfsU|%@c<)U$4O~BWK4lfNJ4P0?-)SG=7@|mWcA5xH6~=Dg9+9yGTBqCL<63^INfyG17w>ogV7J!72~x`6cWg za~_4U;z1z5VUfgB&xI$#KbKs_Ltv$1aTT}{d3i4azvByVSxcywLWIm2-btKko-@3g zIBr(#$f)P#1(~g)>E=5@SKTx;Zr!&tt0Q^8FEXPYg`G_A3YAf4WqSM~KrNCzuB4Uc z>oV_Dw$L6(DMIC)I+-3BwZ>&sG%`<0CdJ+rPN+#wEZZOkl|@wAxqLSA%P(O}`+Juf5wi>U2I3Xap^)p{N}`SO#@CKe;d2ur`S6#NCH(+ zo1)xRae1hL8xr6S8W50%BR?op$-Fygje@YSl4poB0w{eBz#%KB+O!2|{Ki zC&fgM7>*q$X_J1gAKPFOJxnUm(6n&^G)>yrkS4K#_HpqgOKW%PNZQU#nb2BQ zh@H?llt@TONNgAW0D?0|uAGn}{s4brCte4b3by?Cc^}92>&MR5+~-1OFP%0OD3hg2 z_q{pF%%BgWxuv1PG*9&jC4Q17eT{0qNlo9PmYXpyB@8u}8$JBpqCDO0dfll|eEkG$9A zq6=y-R>LpqnJsO(>3Z{in>8Cv&g@E!2gjVZD%F$4LABzx7_i%eYS<)q!cSyjXheEL zxSb9-TW_}-k$S*`2(wzGc8@$5YYX2Egfzz1L=ifgt@niBt-$$n6mcC?F(aWYVe$&5 zBr5>O*1ZOxpcGsHR2?f&FR`WLOWh!dU{MI~X=izrk#{6eSm^~~WoEHl_+8_gkQW%P z>WiAlNcK!WdTo?T$=}XYHr8m8#U?pT7M6@B(1gh5Wd;F+xxN47%-NQ61WB-lL$e9lp;cja05aqh)j{@a`vpFv(CQD-W`^Z zfr3;~D6DNM;s>BYa>ENiK})euf~eSaAVRD(GvAD6XXl&Q<@K-4MlT3_L!B?npYaQC z-dKZ|^NsD>HMEhQz=4Mjx+lhgj~@EU){yKQo%;O8jyQ!W1cH#$cb>XmxVj4XK*0rm zMd1PH$e%-$rAnSCDYld9UX>oy7|}dvRBD~sSsXRYcD0GtN2@gO z#(Tgv*3cAz!>F`$4`S*(RIp6OOnh>V+poO~lHt>?^l-&DN>JQ#+v1r!x>-|C{NI4y z*1Gua-d)qE1ACpi^rL84l@(`E#Pz;-OEkTWUESxZVXjmEDYW9G2}pNa4X{etV@r93 PCR|s)pao6hQ@8OOIm(Wn diff --git a/smart_service/mahindra_smart_service/report/login_report/login_report.py b/smart_service/mahindra_smart_service/report/login_report/login_report.py index ed13515..f7136a9 100644 --- a/smart_service/mahindra_smart_service/report/login_report/login_report.py +++ b/smart_service/mahindra_smart_service/report/login_report/login_report.py @@ -5,6 +5,10 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, cint, getdate from frappe import msgprint, _ +from frappe.utils import cstr, flt, cint,TIME_FORMAT,DATE_FORMAT,DATETIME_FORMAT, now_datetime +from datetime import date, time, datetime, timedelta +from frappe.utils import now +import datetime def execute(filters=None): columns, data = [], [] @@ -13,13 +17,16 @@ def execute(filters=None): return columns, data def get_data(filters): + current_db_name = frappe.conf.get("db_name") + from_date = filters.get('from_date') + to_date = filters.get('to_date') data = frappe.db.sql("""select count(al.name) as count,dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version, ad.device_type,ad.device_id,ad.app_current_version,al.type,al.latitude,al.longitude,al.date_time_stamp,al.creation, date(al.date_time_stamp) as date,time(al.date_time_stamp) as time - from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer + from {0}.`tabApp Log` al,{0}.`tabApp Device` ad,{0}.`tabApp Users` au,{0}.`tabApp Dealer` dealer where al.device = ad.name and al.user = au.name and au.dealer = dealer.name and al.type = 'Logged in' and - (al.modified between %s and %s) group by al.user,ad.device_id,date(al.date_time_stamp)""",(filters.get('from_date'), filters.get('to_date')), as_dict=1) + (date(al.modified) between '{1}' and '{2}') group by al.user,ad.device_id,date(al.date_time_stamp)""".format(current_db_name,from_date,to_date), as_dict=1) if data: return data else: @@ -34,8 +41,8 @@ def get_columns(): {"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100}, {"label": _("Dealer code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 150}, - {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("Device"), "fieldname": "device_type", "fieldtype": "Data", "width": 100}, + {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 150}, {"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100}, {"label": _("Latitude"), "fieldname": "latitude", "fieldtype": "Data", "width": 100}, diff --git a/smart_service/masters/doctype/vehicle/__pycache__/vehicle.cpython-38.pyc b/smart_service/masters/doctype/vehicle/__pycache__/vehicle.cpython-38.pyc index 371f92838b7fefbef6570ac06e2b97527e82d2c2..93933534f1f299876b404d01925892c2ccdbf391 100644 GIT binary patch delta 296 zcmX>hutAV7l$V!_0SIP2|B<+fb0VJ%W64DAM2Rex6!sL3Ud9yO6rL7_X2vM?6vki% zO}>qbma^3|f;2z@6Od*FVrL*O)&LSE3|Wj>Oeu^t3?P`soWhjC+{;|cSi@MPPy;k0 zg$0NifM&7!RrwUB=Ax9Slq4pF0!0!O$}>`nQsJ_;s>KTV zMGC3Txrv!MP)=@sQf5wSd|p0~AEL>4i#@S8J}0xdNku{+LKaA9 zG8HL<*ea7ZvI>i90hxwCT+9I^7?>m&Sr}QEG&v@pV0WDSgi(01B8LhyHy0xS(|$)K delta 199 zcmdlWctU_Ll$V!_0SE%`eNVi|F_BM(v1p=pqSykKg$ybDDZD9sEsV{KQ5-3Z!3>%L z8<#9)t7if!hXN3r8Hk;MxR?(}lrSt{OkrHe$jFew0Mx7FDPjR~AOsson587OxWoX+DhAufRHO%F1I_be(&U_M R%HhbUH@S$znwg7@5dh;ID763p diff --git a/smart_service/masters/doctype/vehicle/vehicle.py b/smart_service/masters/doctype/vehicle/vehicle.py index 4246657..9aa6e70 100644 --- a/smart_service/masters/doctype/vehicle/vehicle.py +++ b/smart_service/masters/doctype/vehicle/vehicle.py @@ -45,6 +45,11 @@ def login_user(login,pwd): num.id = login num.pwd = pwd num.save() -@frappe.whitelist() -def test(doc=None,method=None): - frappe.msgprint("called") \ No newline at end of file +###This method called from templates/includes/login/_login.js +@frappe.whitelist(allow_guest=True) +def login_user(login): + user = frappe.db.sql("""select username from `tabUser` where username=%s or email=%s or mobile_no=%s""",(login,login,login),as_list=True) + if user: + return user + else: + return 'None' \ No newline at end of file diff --git a/smart_service/public/css/smart_service.css b/smart_service/public/css/smart_service.css index 1a2060b..5c72dcb 100644 --- a/smart_service/public/css/smart_service.css +++ b/smart_service/public/css/smart_service.css @@ -1,86 +1,86 @@ -.btn.btn-primary { - background-color: #E31A37; - border-color: #E31A37; - outline: 0!important; - box-shadow: none!important; - - - color: var(--white); - white-space: nowrap; - --icon-stroke: #E31A37!important; - --icon-fill-bg: #E31A37!important; -} -.btn.btn-primary:active{ - background-color: #c50000!important; - border-color: #E31A37!important; - outline: 0!important; - box-shadow: 0 0 2px 2px #E31A37!important; - /* h-offset v-offset blur spread colour */ -} - - -.app-logo { - width: 100px !important; -} -.navbar{ - box-shadow: 7px -2px 11px #E31A37; -} - - -.a.nav-link.btn-login-area.active,.navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover { - color: #E31A37!important; -} - - -.btn-primary-light.active { -background-color: #E31A37; -border-color: #E31A37; -outline: 0!important; -box-shadow: 0 0 2px 2px #E31A37!important; - -} -.login-captcha-refresh{ - right: 9px; - top: 9px; - position: absolute; - z-index: 2; - cursor: pointer; - font-size: 12px; -} -.txt-input-captcha{ - margin-left: 60px; - width: 81%; -} -.captcha-txt{ - font-size: 15px; - color: #E31A37; - font-weight: bold; -} -.loadingBlock{ top: 65%; - left: 48%;position: absolute;z-index:9999; } -.gear{width: 80px; height: 80px; border-radius:10%; margin:80px auto; border:5px solid #E31A37 ; position:relative; -} - -.gear:after{content:"";width: 100px; height: 100px;border-radius:100%; display:block; border:5px dashed #E31A37 ;position:absolute; top:-24px; left: -24px; box-shadow: inset 0px 0 0 20px #E31A37; transform:scale(.5) rotate(0deg); - animation:gear 8s linear infinite;} - -.gear:before{content:"";width: 58px; height: 58px;border-radius:100%; - display:block; border:5px dashed #E31A37 ; position:absolute; top:26px; right: -14px; box-shadow: inset 0px 0 0 10px #E31A37; transform:scale(.5) rotate(0deg); - animation:gear2 3s linear infinite;} - -@keyframes gear { - 0%{transform:scale(.5) rotate(0deg);} - 100%{transform:scale(.5) rotate(360deg);} -} -@-webkit-keyframes gear { - 0%{transform:scale(.5) rotate(0deg);} - 100%{transform:scale(.5) rotate(360deg);} -} - -@keyframes gear2 { - 0%{transform:scale(.5) rotate(0deg);} - 100%{transform:scale(.5) rotate(-360deg);} -} - - - +.btn.btn-primary { + background-color: #E31A37; + border-color: #E31A37; + outline: 0!important; + box-shadow: none!important; + + + color: var(--white); + white-space: nowrap; + --icon-stroke: #FFFFFF!important; + --icon-fill-bg: #FFFFFF!important; +} +.btn.btn-primary:active{ + background-color: #c50000!important; + border-color: #E31A37!important; + outline: 0!important; + box-shadow: 0 0 2px 2px #E31A37!important; + /* h-offset v-offset blur spread colour */ +} + + +.app-logo { + width: 100px !important; +} +.navbar{ + box-shadow: 7px -2px 11px #E31A37; +} + + +.a.nav-link.btn-login-area.active,.navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover { + color: #E31A37!important; +} + + +.btn-primary-light.active { +background-color: #E31A37; +border-color: #E31A37; +outline: 0!important; +box-shadow: 0 0 2px 2px #E31A37!important; + +} +.login-captcha-refresh{ + right: 9px; + top: 9px; + position: absolute; + z-index: 2; + cursor: pointer; + font-size: 12px; +} +.txt-input-captcha{ + margin-left: 60px; + width: 81%; +} +.captcha-txt{ + font-size: 15px; + color: #E31A37; + font-weight: bold; +} +.loadingBlock{ top: 65%; + left: 48%;position: absolute;z-index:9999; } +.gear{width: 80px; height: 80px; border-radius:10%; margin:80px auto; border:5px solid #E31A37 ; position:relative; +} + +.gear:after{content:"";width: 100px; height: 100px;border-radius:100%; display:block; border:5px dashed #E31A37 ;position:absolute; top:-24px; left: -24px; box-shadow: inset 0px 0 0 20px #E31A37; transform:scale(.5) rotate(0deg); + animation:gear 8s linear infinite;} + +.gear:before{content:"";width: 58px; height: 58px;border-radius:100%; + display:block; border:5px dashed #E31A37 ; position:absolute; top:26px; right: -14px; box-shadow: inset 0px 0 0 10px #E31A37; transform:scale(.5) rotate(0deg); + animation:gear2 3s linear infinite;} + +@keyframes gear { + 0%{transform:scale(.5) rotate(0deg);} + 100%{transform:scale(.5) rotate(360deg);} +} +@-webkit-keyframes gear { + 0%{transform:scale(.5) rotate(0deg);} + 100%{transform:scale(.5) rotate(360deg);} +} + +@keyframes gear2 { + 0%{transform:scale(.5) rotate(0deg);} + 100%{transform:scale(.5) rotate(-360deg);} +} + + + diff --git a/smart_service/templates/includes/login/_login.js b/smart_service/templates/includes/login/_login.js index da0474a..5778931 100644 --- a/smart_service/templates/includes/login/_login.js +++ b/smart_service/templates/includes/login/_login.js @@ -345,7 +345,7 @@ login.login_handlers = (function () { var usr = ($("#login_email").val() || "").trim(); if (usr){ frappe.call({ - method: "smart_service.masters.doctype.vehi.vehi.login_user", + method: "smart_service.masters.doctype.vehicle.vehicle.login_user", args: {'login':usr, }, callback: function(r){ diff --git a/smart_service/transactions/doctype/procedure_details/procedure_details.json b/smart_service/transactions/doctype/procedure_details/procedure_details.json index 773a34f..4ccb902 100644 --- a/smart_service/transactions/doctype/procedure_details/procedure_details.json +++ b/smart_service/transactions/doctype/procedure_details/procedure_details.json @@ -9,6 +9,7 @@ "step_name", "content_type", "content", + "content1", "file" ], "fields": [ @@ -52,12 +53,19 @@ "fieldtype": "Attach", "in_list_view": 1, "label": "File" + }, + { + "fieldname": "content1", + "fieldtype": "Data", + "label": "Content1", + "options": "URL", + "read_only": 1 } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-12-23 13:42:47.545081", + "modified": "2022-02-04 11:18:15.633049", "modified_by": "Administrator", "module": "Transactions", "name": "Procedure_Details", diff --git a/smart_service/transactions/report/audit_report/__pycache__/audit_report.cpython-38.pyc b/smart_service/transactions/report/audit_report/__pycache__/audit_report.cpython-38.pyc index 68e184d8c81e1973eb640d0fdca737c83851f7a6..7034e3cbe7550df9caf98b3554fb8b4249dd3f75 100644 GIT binary patch delta 3299 zcmZ`*O>Er873OeBE|<&w|J6@yS+UZrEjhJ|x|S>3Y3({mVG9Q2)alx;vDHwnq}A?f zNF}j6#1>F;DPY6~i~giJtbm|JfZh!B(q2*&XiotOv=^QlpobV~PB{cvUSh=> zB)PfGnl|**io>lz+OxMAPjdT?-gNl^p5o3MteN3y?!KWlvpmDIsB=8W^QiN@z>BC0 zyu{0>i@d_Cs7t)Y>!{0ogpZ=G@G(A)x>n^+@qMK5{d@v-o$Cu)WAffd``reMZQcsJ zV0q1pl5Fcp70VAasco^41#C+Tb*W3XgaPld`Gy`RZ+gMGR?vzaC}*R;vG)oVeKNC| z#Y7(3B8x6n>h~Y&p~0*uOm3*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+y{0mnVX5c(3BZ&V+7f=p(VX-CSCHwowFMJ+UO0* zE$&oi&ug#!Jj%%&PuI055AK2&uxv)=F(sWWTZ|?`M;7G->=|skz`Yw*R6@_em~2%G z({NPUX4|Z)k#^rvF7Z)lk@)iu!c{^SY`y~#Eg z&~lsaZ$2NoQU?I4VMbPo%POFfSN-(DTqYP?SqZKOp?@v7M;{{2w%TFm4SyvFTj3y3 ze@HK~d38U1vTSv_fiJ??11v7Jgx?KcY4z15cY01#Xrk5X_x&!9y%E3MJKt%aic>)- z)Q{Xne9>RIFDX6qcKH-W2QPtW%wRdZ1wE&$4>D(%uKt$kJ~vCNVZG&KTMb7{Lm_5J zYxNVyVvaO4PSlA^fyBn;>wOTC^ygMZ~ry7#mXi$O$Ybb z?hU%3I6wmqsbS$-ZUJI!4f+&g*xKiXDQvA=Ji{95TgBFF1Ln2`GJYl?Jb-*t{k~Wm zUXI)~Ey_rfYh3>^00RMHc%#dBxuco-MYe*AW$K=)xJ@TXnWK2X^nb|dEma`FL zH1;+!^(fS>C#SlL-s4kc=Q5Mgji_$=t4iOoe%Ls6BR8>wfWn z#=XjT{{Ih@h26AtlEBE1rOi9i=HAm;z?+Z#5B>dGYAjV!F7r?y5N70~ouc*kA1VnHAunj^FO^>PFvQ=W z1>>rM48X);HK?AeJ`H`tdhBb6IrY2h%d)z)AmM9_Uu`yTsPw@N>X;8DaYgat(S2>3*d1%5Dl-ph|&> zd9`tG*VuywGg3TDe=@hsD8=hzYclphZ#?$YLzfY<34$|~gf2-&5~dqSKMbLZ8^one zUBq`UO)29ghB2A=9gesMw zYLJAFpcoMZc<}@gf}S{`-Z^;shz`sl@+kT&!?hj5Ip93ul$_(vf@3?L - - - - - - - - - - -    ${value}

` - break; - case 2: - value = `

- - - - - - - -   ${value}

` - break; - case 1: - value = `

- - - - - - - - - - - - - - - - - - - - + if(value !== undefined){ + if (data && column.fieldname == "procedure_name") { + switch (data.indent){ + case 3: + value = `

+ + + + + + + + + + +    ${value}

` + break; + case 2: + value = `

+ + + + + + + +   ${value}

` + break; + case 1: + value = `

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + - - - - - - + - - -   ${value}

` - break; - case 0: - value = `

  ${value}

` - break; - default: - value = `

   - - - - - - - -    ${value}

` - break; +   ${value}

` + break; + case 0: + value = `

  ${value}

` + break; + default: + value = `

   + + + + + + + +    ${value}

` + break; + } } - } - - if(data && String(column.fieldname).slice(2) == '_active_status'){ - switch(data.indent){ - case 2: - if(value !== undefined){ + + if(data && String(column.fieldname).slice(2) == '_active_status'){ + switch(data.indent){ + case 2: newValue = "" val = String(value).split(' / '); switch (val[0]) { @@ -117,22 +117,21 @@ frappe.query_reports["Audit Report"] = { break; } value = newValue +" / "+ ` ${val[1]} ` - } - break; - case 3: - column.align= 'center' - if (value !==undefined){ - value = ` ${value}` - } - break; + break; + + case 3: + column.align= 'center' + if (value !==undefined){ + value = ` ${value}` + } + break; + } } - } - if (data && column.fieldname == "active_status") { - column.align = 'center'; - switch(data.indent){ - case 2: - if(value !== undefined){ + if (data && column.fieldname == "active_status") { + column.align = 'center'; + switch(data.indent){ + case 2: newValue = "" val = String(value).split(' / '); switch (val[0]) { @@ -148,32 +147,33 @@ frappe.query_reports["Audit Report"] = { }else{ value = newValue +" / "+ ` ${val[1]} Procedures ` } - } - break; + break; - case 3: - switch (value) { - case 1: - value = ` ${value} Step` - break; - default: - value = ` ${value} Steps` - break; - } - break; + case 3: + switch (value) { + case 1: + value = ` ${value} Step` + break; + default: + value = ` ${value} Steps` + break; + } + break; - case 1: - if(value == 1){ - value = ` ${value} Sub System`} - else{ - value = ` ${value} Sub Systems`} - break; - } - } - + case 1: + if(value == 1){ + value = ` ${value} Sub System`} + else{ + value = ` ${value} Sub Systems`} + break; + case 0: + value = ` ${value} ` + break; + } + } - if(data && String(column.fieldname).slice(2) === '_workflow_state'){ - if (value !== undefined){ + if(data && String(column.fieldname).slice(2) === '_workflow_state'){ + column.align = 'center'; value = `    ${value} ` @@ -181,11 +181,22 @@ frappe.query_reports["Audit Report"] = { var proc = String(data.procedure).slice(0,-2) column.link_onclick = "frappe.query_reports['Audit Report'].set_route(" + JSON.stringify(proc+langCode) + ")" } + + if(data && column.fieldname === 'modified' || String(column.fieldname).slice(2) === '_modified'){ + column.align = 'center'; + var options = { year: 'numeric', month: 'short', day: 'numeric',day: "numeric", hour: "2-digit", minute: "2-digit",second:'2-digit'}; + var date = new Date(value); + value = date.toLocaleDateString("en-US", options); + } + } + + if(data && String(column.fieldname).slice(2) == '_active_status'){ + column.align = 'center'; + if(value === undefined && data.indent === 2){ + value = "-" + } } - // if(data && column.fieldname === 'modified'){ - // value = new Date(value); - // } value = default_formatter(value, row, column, data); return value; }, diff --git a/smart_service/transactions/report/audit_report/audit_report.py b/smart_service/transactions/report/audit_report/audit_report.py index 4371235..8033ac7 100644 --- a/smart_service/transactions/report/audit_report/audit_report.py +++ b/smart_service/transactions/report/audit_report/audit_report.py @@ -4,24 +4,19 @@ from __future__ import unicode_literals import functools import frappe from frappe import _ +from datetime import datetime current_db_name = frappe.conf.get("db_name") custom_lang = frappe.db.sql('''SELECT lang_code,lang_name FROM {}.`tabCustom Languages` where lang_code <> 'en'; '''.format( current_db_name), as_dict=True) - def execute(filters=None): - validate_filters(filters) - data = get_data(filters) - columns = get_columns() + data = getData(filters) + columns = getColumns() return columns, data -def validate_filters(filters): - return - - -def get_data(filters): +def getData(filters): fil = None if filters.variant_mapping != None: fil = filters.variant_mapping + "%" @@ -52,9 +47,16 @@ def modifyData(dataInput, filterParent): list1 = [] inputData = modifyChildData(dataInput, indent=4, header=0) parentAppend = addParent(filterParent, indent=0, header=1) - list1.insert(0, parentAppend[0]) - sMap, sSize = getParentMap(inputData, 'systems') + systemSize="" + if len(sSize)==1: + systemSize = str(len(sMap)) + " System" + else: + systemSize = str(len(sMap)) + " Systems" + + parentAppend[0]['active_status'] = systemSize + list1.insert(0, parentAppend[0]) + for i in sMap: sMap1, sSize1 = getParentMap(sMap[i], 'systems') @@ -83,7 +85,6 @@ def modifyData(dataInput, filterParent): appendData = addDuplicateData(list1) appendData = removeDuplicateAndHeader(appendData) - return appendData @@ -100,7 +101,6 @@ def appendToDic1(mapData, indent, header): 'indent': indent, 'header': header, 'Type' : 'System' - } mapDataAppend.append(keyDict) return mapDataAppend @@ -154,17 +154,22 @@ def appendToDic3(mapData, procSize, j, indent, header, procedure): i = 0 dic1 = {} list1 = [] - for c in custom_lang: list2 = [] procedure = procedure[:-2]+c['lang_code'] + colmodified = c['lang_code'] + '_modified' other_step_count = frappe.db.sql( - '''select count(distinct(step_name)) as count from _d6463952657fa86c.tabProcedure_Details where parent= '{}' group by(procedure_name) order by idx;'''.format(procedure), as_list=True) + '''select count(distinct(step_name)) as count, modified as {} from _d6463952657fa86c.tabProcedure_Details where parent= '{}' group by(procedure_name) order by idx;'''.format(colmodified,procedure), as_list=True) + for l in other_step_count: - list2.append(l[0]) + list2.append(l) list1.append(list2) - - for u in mapData: + + for u in mapData: + dateList = [] + for k in mapData[u]: + dateList.append(str(k['modified'])) + dateList.sort(key=lambda date: datetime.strptime(date, "%Y-%m-%d %H:%M:%S.%f")) procDict = { 'systems': mapData[u][0]['systems'], 'sub_systems': mapData[u][0]['sub_systems'], @@ -173,19 +178,23 @@ def appendToDic3(mapData, procSize, j, indent, header, procedure): 'indent': indent, 'header': header, 'active_status': procSize[i], - 'Type' : 'Procedure' + 'Type' : 'Procedure', + 'modified': dateList[-1] } - + dic2 = {} for cus in range(len(custom_lang)): if len(list1[cus]) > 0: - if list1[cus][i] == 1: + if list1[cus][i][0] == 1: dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str( - list1[cus][i]) + " Step" + list1[cus][i][0]) + " Step" else: dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str( - list1[cus][i]) + " Steps" + list1[cus][i][0]) + " Steps" + # Append modified date + dic1['{}_modified'.format(custom_lang[cus]['lang_code'])] = list1[cus][i][1] + dic2.update(dic1) procDict.update(dic1) i += 1 @@ -193,6 +202,7 @@ def appendToDic3(mapData, procSize, j, indent, header, procedure): return mapDataAppend + def modifyChildData(childData, indent, header): for a in childData: a.update({'indent': indent}) @@ -240,10 +250,11 @@ def removeDuplicateAndHeader(data1): k['workflow_state'] = "" if k['indent'] == 4: k.pop('active_status') + k.pop('modified') return data1 -def get_columns(): +def getColumns(): columns = [ { "fieldname": "procedure_name", @@ -261,7 +272,7 @@ def get_columns(): "fieldname": "modified", "label": _("Last Modified date"), "fieldtype": "Data", - "width": 165 + "width": 200 }, { "fieldname": "active_status", @@ -272,7 +283,7 @@ def get_columns(): }, { "fieldname": "en_workflow_state", - "label": _("English"), + "label": _("Workflow State"), "fieldtype": "Link", "options": "Procedure", "width": 150 @@ -284,19 +295,27 @@ def get_columns(): for i in custom_lang: lang_status = { "fieldname": "{}_active_status".format(i['lang_code']), - "label": _("{}_Status".format(i['lang_code'].upper())), + "label": _("{} Status".format(i['lang_code'].upper())), + "fieldtype": "Data", + "options": "", + "width": 200 + } + lang_modified = { + "fieldname": "{}_modified".format(i['lang_code']), + "label": _("{} Last Modified".format(i['lang_code'].upper())), "fieldtype": "Data", "options": "", "width": 200 } lang_workflow = { "fieldname": "{}_workflow_state".format(i['lang_code']), - "label": _("{}_workflow_state".format(i['lang_code'].upper())), + "label": _("{} Workflow State".format(i['lang_code'].upper())), "fieldtype": "Link", "options": "Procedure", "width": 150 } lang.append(lang_status) lang.append(lang_workflow) + lang.append(lang_modified) columns += lang return columns