238 Commits

Author SHA1 Message Date
Almira
dd8a793ec4 Merge branch 'development' into 'master'
Update number of packages per page

See merge request saburly/wiaas/new-wiaas!94
2019-01-07 23:55:51 +00:00
Almira Krdzic
21b52b7086 update constant 2019-01-08 00:54:40 +01:00
Almira
5fd4beafe4 Merge branch 'development' into 'master'
Fixes

See merge request saburly/wiaas/new-wiaas!93
2019-01-07 23:35:51 +00:00
Almira
77ba75ab6c Merge branch 'fixes' into 'development'
Fixes

See merge request saburly/wiaas/new-wiaas!92
2019-01-07 23:18:34 +00:00
Almira Krdzic
81207c40ab fixes 2019-01-07 21:32:48 +01:00
Almira Krdzic
1c5a808a69 fixes 2019-01-07 21:21:43 +01:00
Almira Krdzic
423bb18b29 update shop page size 2019-01-07 21:17:55 +01:00
Almira Krdzic
e3392a9da7 Fixes 2019-01-07 21:15:06 +01:00
Almira
9043a45ed7 Merge branch 'development' into 'master'
Rename pricing options

See merge request saburly/wiaas/new-wiaas!91
2019-01-07 11:12:15 +00:00
Nedim Uka
b1230e5111 Merge branch 'rename-pricing' into 'development'
Rename pricing options

See merge request saburly/wiaas/new-wiaas!90
2019-01-07 10:31:04 +00:00
Almira Krdzic
b9ad9f2a34 Rename pricing options 2019-01-07 11:23:44 +01:00
Almira
8b3908782d Merge branch 'development' into 'master'
Bugfixes

See merge request saburly/wiaas/new-wiaas!89
2018-12-13 12:25:17 +00:00
Almira
395a60b1cf Merge branch 'abbrevations' into 'development'
Extra commision column now split into 3 , and tooltip added

See merge request saburly/wiaas/new-wiaas!84
2018-12-06 11:08:25 +00:00
Nedim Uka
85d21322a0 improved redability of cl-package prices table 2018-12-06 11:54:20 +01:00
Nedim Uka
c133374159 removed other abbervations 2018-12-06 11:43:16 +01:00
Almira
a3761f3c71 Merge branch 'max-cost-margin-tooltip' into 'development'
show tooltip for max cost margin

See merge request saburly/wiaas/new-wiaas!83
2018-12-05 19:39:28 +00:00
Bilal Catic
e4da6c7d45 use woocommerce help tip 2018-12-05 19:52:33 +01:00
Bilal Catic
4aed08a96b use wordpress icons for consistency 2018-12-05 19:52:33 +01:00
Bilal Catic
bb9dc470d4 show tooltip for max cost margin 2018-12-05 19:52:33 +01:00
Bilal Catic
017838cd6a Merge branch 'cherry-pick-392b1134' into 'master'
Remove Co-Market from customer interface

See merge request saburly/wiaas/new-wiaas!88
2018-12-05 18:45:14 +00:00
Almira
6a9211f84a Merge branch 'fix-image-style' into 'development'
Fix banner image style (Remove Co-Market from customer interface)

See merge request saburly/wiaas/new-wiaas!87

(cherry picked from commit 392b113427)

3ce531ca Fix banner image style
d15cb6a2 fix image size
2018-12-05 18:24:14 +00:00
Almira
392b113427 Merge branch 'fix-image-style' into 'development'
Fix banner image style (Remove Co-Market from customer interface)

See merge request saburly/wiaas/new-wiaas!87
2018-12-05 18:21:33 +00:00
Almira Krdzic
d15cb6a225 fix image size 2018-12-05 19:04:45 +01:00
Almira Krdzic
3ce531ca4e Fix banner image style 2018-12-05 14:54:31 +01:00
Nedim Uka
ba0549b9fb Mooved tooltip 2018-12-05 14:44:38 +01:00
Bilal Catic
b7a5f075b1 Merge branch 'cherry-pick-f33c6aa6' into 'master'
Remove Co-Market from customer interface

See merge request saburly/wiaas/new-wiaas!86
2018-12-05 13:28:06 +00:00
Bilal Catic
2cdef7c31e Merge branch 'remove-co-market' into 'development'
Remove Co-Market from customer interface

See merge request saburly/wiaas/new-wiaas!85

(cherry picked from commit f33c6aa6e2)

1726c3d7 Remove Co-Market from customer interface
2018-12-05 13:20:43 +00:00
Bilal Catic
f33c6aa6e2 Merge branch 'remove-co-market' into 'development'
Remove Co-Market from customer interface

See merge request saburly/wiaas/new-wiaas!85
2018-12-05 11:57:01 +00:00
Almira Krdzic
1726c3d7f7 Remove Co-Market from customer interface 2018-12-04 20:34:23 +01:00
Nedim Uka
4f057b8338 Extra commision column now split into 3 , and tooltip added 2018-12-04 10:26:32 +01:00
Bilal Catic
89080780ed Merge branch 'dashboard' into 'development'
Dashboard

See merge request saburly/wiaas/new-wiaas!82
2018-12-03 15:04:27 +00:00
Almira Krdzic
17d4dfe3d7 Merge branch 'development' into dashboard 2018-12-03 16:03:29 +01:00
Almira Krdzic
103fc53c1d display instructions if any 2018-12-03 16:02:53 +01:00
Almira
d800f44b8d Merge branch 'backoffice-package-details' into 'development'
Added pricing to quickedit

See merge request saburly/wiaas/new-wiaas!78
2018-12-03 13:04:44 +00:00
Almira Krdzic
8476529bb4 Add timeline 2018-12-03 13:13:03 +01:00
Almira Krdzic
c5f590c3fe Use custom capability to manage access to order delivery process 2018-12-03 12:20:47 +01:00
Almira Krdzic
2c0e217a49 Handle access to order delivery process page 2018-12-03 01:59:24 +01:00
Almira Krdzic
5d5ab87595 Merge branch 'development' into dashboard 2018-12-03 00:52:04 +01:00
Almira
6c6612c7c6 Merge branch 'backend-add-missing-details-order-view' into 'development'
Backend add missing details order view

See merge request saburly/wiaas/new-wiaas!77
2018-12-02 23:08:34 +00:00
Almira Krdzic
a2c088ba52 Fix order details display 2018-12-03 00:02:23 +01:00
Bilal Catic
397a0ed831 add wiaas prefix 2018-12-03 00:02:23 +01:00
Bilal Catic
a0b7faa90f show delivery details 2018-12-03 00:02:23 +01:00
Bilal Catic
29fb07205e Remove custom class 2018-12-03 00:02:23 +01:00
Bilal Catic
00a1ef7da5 add order payment details to order preview 2018-12-03 00:02:23 +01:00
Bilal Catic
2f18e1e47c remove obsolete info from order preview 2018-12-03 00:02:23 +01:00
Bilal Catic
8b5ea356e7 show item prices in order preview 2018-12-03 00:02:23 +01:00
Bilal Catic
434d0ab6b3 add commercial lead name to order preview 2018-12-03 00:02:23 +01:00
Bilal Catic
a5419e2f3c add custom columns to order list view 2018-12-03 00:02:23 +01:00
Bilal Catic
00f9d5cafa Merge branch 'fix-order-assigment-bug' into 'development'
Fix assigment order issues

See merge request saburly/wiaas/new-wiaas!81
2018-12-02 22:59:08 +00:00
Almira Krdzic
670eb53da1 Fix countries 2018-12-02 22:59:20 +01:00
Almira Krdzic
e87d1521dd Fix assigment order issues 2018-12-02 22:18:09 +01:00
Almira Krdzic
3dfe06bc76 Fix process navigation 2018-12-02 10:59:32 +01:00
Nedim Uka
fa4a792134 Hide pricing from quick edit, for unsupported product types 2018-11-29 13:15:41 +01:00
Nedim Uka
1f74fd9c23 Added pricing to quickedit 2018-11-29 13:08:28 +01:00
Almira Krdzic
71d615907d Dashboards widgets 2018-11-29 11:13:15 +01:00
Bilal Catic
3dbdb657c9 Merge branch 'forms-filtering' into 'development'
Show countries for delivery process forms. Refactor countries.

See merge request saburly/wiaas/new-wiaas!76
2018-11-27 12:08:22 +00:00
Almira Krdzic
2b688e8a5e Remove unused code 2018-11-27 11:22:01 +01:00
Almira Krdzic
95d162578f Add timestamp script to composer 2018-11-27 01:47:01 +01:00
Almira Krdzic
798ad20534 Show countries for delivery process forms. Refactor countries. 2018-11-27 00:57:35 +01:00
Almira
61ff7dbc60 Merge branch 'add-phone-number-field-in-backoffice-profile' into 'development'
Add phone number field in backoffice profile

See merge request saburly/wiaas/new-wiaas!75
2018-11-22 12:24:42 +00:00
Bilal Catic
09fc3f8018 Rename class 2018-11-22 13:22:05 +01:00
Bilal Catic
217dfb1889 add validation functions class 2018-11-22 12:08:41 +01:00
Bilal Catic
8d954469ee use woocommerce validation 2018-11-22 11:27:30 +01:00
Bilal Catic
68c760a426 validate phone number from frontend 2018-11-21 12:26:23 +01:00
Bilal Catic
35854d1367 add phone number field 2018-11-21 12:26:23 +01:00
Bilal Catic
f51d9f5512 Merge branch 'development' into 'master'
Bugfixes

See merge request saburly/wiaas/new-wiaas!73
2018-11-19 15:42:25 +00:00
Almira
3db4b71c3f Merge branch 'fix-location-details-field' into 'development'
Fix location details field

See merge request saburly/wiaas/new-wiaas!74
2018-11-19 15:32:55 +00:00
Bilal Catic
3df6397280 remove comment 2018-11-19 16:30:04 +01:00
Bilal Catic
e548e2a31c break project name and location details if too long 2018-11-19 16:29:22 +01:00
Almira
3d37a88247 Merge branch 'ticketing-integration' into 'development'
add helpdesk module

See merge request saburly/wiaas/new-wiaas!66
2018-11-19 12:44:16 +00:00
Bilal Catic
30e5d594ad highlight helpdesk when selected 2018-11-19 13:38:12 +01:00
Bilal Catic
dd93677def add helpdesk module 2018-11-19 13:38:12 +01:00
Nedim Uka
4de01d93d1 Merge branch 'fix-bundle-link-in-order-details' into 'development'
set commercial id to real id, not object

See merge request saburly/wiaas/new-wiaas!72
2018-11-19 12:37:09 +00:00
Bilal Catic
2fdae06a59 set commercial id to real id, not object 2018-11-19 13:30:07 +01:00
Almira
d0533b3d6e Merge branch 'support-email' into 'development'
Added support for sending customer emails

See merge request saburly/wiaas/new-wiaas!69
2018-11-19 12:24:10 +00:00
Nedim Uka
35e670fa52 removved debug log 2018-11-19 13:15:50 +01:00
Nedim Uka
f56377f606 Handled proper endpoint naming 2018-11-19 12:35:04 +01:00
Almira
95a9fd2110 Merge branch 'fix-additional-days-bug' into 'development'
add only working days

See merge request saburly/wiaas/new-wiaas!70
2018-11-19 11:11:34 +00:00
Nedim Uka
752df56d4a Fixed bug where order note text is saved as order ID 2018-11-19 11:31:46 +01:00
Bilal Catic
e1594f3a7f Merge branch 'fixes' into 'development'
Fixes

See merge request saburly/wiaas/new-wiaas!71
2018-11-19 10:15:26 +00:00
Almira Krdzic
4f97df5b45 Merge branch 'development' into fixes 2018-11-18 22:10:24 +01:00
Almira Krdzic
ef5cf00983 Fix hidden metadata 2018-11-18 22:10:01 +01:00
Bilal Catic
ca0fed674f add only working days 2018-11-16 20:30:47 +01:00
Bilal Catic
fb66d56d9c Merge branch 'installation-fix' into 'development'
Fix installation selection

See merge request saburly/wiaas/new-wiaas!68
2018-11-16 19:20:35 +00:00
Nedim Uka
a07c0e4584 Added support for sending customer emails 2018-11-16 17:16:28 +01:00
Almira Krdzic
3708c9fb30 Fix installation selection 2018-11-16 15:59:16 +01:00
Bilal Catic
c630452d0b Merge branch 'fix-tests' into 'development'
Fix and remove broken tests

See merge request saburly/wiaas/new-wiaas!67
2018-11-16 09:38:51 +00:00
Almira Krdzic
a62de78172 fix and remove broken tests 2018-11-15 23:40:58 +01:00
Almira
14550d2ea9 Merge branch 'allign-order-table' into 'development'
break long words

See merge request saburly/wiaas/new-wiaas!65
2018-11-15 15:23:51 +00:00
Bilal Catic
56c171df3e break long words 2018-11-15 14:50:02 +01:00
Bilal Catic
337f031705 Merge branch 'documents-fix' into 'development'
Handle documents upload

See merge request saburly/wiaas/new-wiaas!64
2018-11-15 13:44:55 +00:00
Almira Krdzic
b7be6fde42 Merge branch 'development' into documents-fix 2018-11-15 14:33:15 +01:00
Almira Krdzic
6c656a0b26 Handle order documents 2018-11-15 11:29:15 +01:00
Bilal Catic
c4d539f549 Merge branch 'documents-fix' into 'development'
Documents fix

See merge request saburly/wiaas/new-wiaas!63
2018-11-07 10:17:46 +00:00
Almira Krdzic
0ba27b2f1d documents fix 2018-11-07 03:05:54 +01:00
Bilal Catic
e6b372f5d0 Merge branch 'cart-validation' into 'development'
Validate that items are from the same country and catalogue

See merge request saburly/wiaas/new-wiaas!61
2018-11-06 20:13:13 +00:00
Almira Krdzic
16b51c87bb Merge branch 'development' into cart-validation 2018-11-06 21:11:38 +01:00
Almira
47b2214a99 Merge branch 'terms-and-conditions-link' into 'development'
update terms and conditions file and link

See merge request saburly/wiaas/new-wiaas!62
2018-11-06 15:17:21 +00:00
Almira Krdzic
c7bf4e8c03 Merge branch 'development' into cart-validation 2018-11-06 15:41:18 +01:00
Bilal Catic
15db815d01 update terms and conditions file and link 2018-11-06 15:38:09 +01:00
Almira Krdzic
c555571607 Text change 2018-11-06 15:33:33 +01:00
Almira Krdzic
a1997a813d Validate that items are from the same country and catalogue 2018-11-06 14:03:58 +01:00
Bilal Catic
a77a97b922 Merge branch 'hide-order-item-metadata' into 'master'
Hide metadata for order item

See merge request saburly/wiaas/new-wiaas!60
2018-11-06 12:47:43 +00:00
Almira Krdzic
99c203b920 Hide metadata for order item 2018-11-06 10:38:08 +01:00
Bilal Catic
053675b478 Merge branch 'add-customer-order-url-merge-tag' into 'master'
Add merge tag for customer order url

See merge request saburly/wiaas/new-wiaas!59
2018-11-06 06:42:26 +00:00
Almira Krdzic
f34ce98655 Merge branch 'master' into add-customer-order-url-merge-tag 2018-11-06 07:18:53 +01:00
Almira Krdzic
6ef9936403 add merge tag for customer order url 2018-11-06 02:04:34 +01:00
Bilal Catic
e0060dd69d Merge branch 'fix-order-organizations-data' into 'master'
Fix order organization info

See merge request saburly/wiaas/new-wiaas!58
2018-11-05 19:57:44 +00:00
Almira Krdzic
d6528e75cf Merge branch 'master' into fix-order-organizations-data 2018-11-05 20:54:08 +01:00
Almira Krdzic
c9b04dac1e Fix order organization info 2018-11-05 20:33:11 +01:00
Bilal Catic
09b5779056 Merge branch 'add-installation-date-action' into 'master'
Add installation date action

See merge request saburly/wiaas/new-wiaas!57
2018-11-05 19:17:18 +00:00
Almira Krdzic
fcbddcb22a fix form import 2018-11-05 19:00:07 +01:00
Almira Krdzic
dd53584d20 Enable admin to enter installation date on delivery process:
:
2018-11-05 18:18:44 +01:00
Bilal Catic
c23e570399 Merge branch 'cart-number' into 'master'
Display * instead of cart count

See merge request saburly/wiaas/new-wiaas!56
2018-11-05 13:05:54 +00:00
Nedim Uka
f5e9aa7495 Renamed Co-Market to Wiaas Market on frontend 2018-11-05 13:55:10 +01:00
Nedim Uka
aef8347df3 Display * instead of cart count 2018-11-05 13:37:47 +01:00
Bilal Catic
75141b6bd1 Merge branch 'bundle-units' into 'master'
Added wiaas_units selection to bundle products

See merge request saburly/wiaas/new-wiaas!52
2018-11-05 11:41:53 +00:00
Nedim Uka
e2952a240c Added wiaas_units selection to bundle products 2018-11-05 12:27:39 +01:00
Bilal Catic
afa370f403 Merge branch 'persist-workflow-documents' into 'master'
Persist workflow fields for order

See merge request saburly/wiaas/new-wiaas!55
2018-11-05 10:24:58 +00:00
Almira Krdzic
b02f0881d3 Fix customer acceptance flow 2018-11-05 10:53:54 +01:00
Almira Krdzic
0d62e7da4b Merge branch 'master' into persist-workflow-documents 2018-11-05 08:52:41 +01:00
Almira Krdzic
3dcef84709 Persist workflow entry fields to order 2018-11-05 08:48:25 +01:00
Almira
0600bbee9f Merge branch 'set-default-status-to-open' into 'master'
Set default status to open

See merge request saburly/wiaas/new-wiaas!54
2018-11-04 23:03:09 +00:00
Bilal Catic
75a574279b change order status to processing when process is assigned 2018-11-04 23:59:54 +01:00
Bilal Catic
9e599617c4 remove wiaas from method name 2018-11-04 23:40:52 +01:00
Bilal Catic
bc310ed738 change order status to open 2018-11-04 23:26:30 +01:00
Bilal Catic
5d872a33da register and display custom order statuses 2018-11-04 23:26:30 +01:00
Bilal Catic
cedd4bf9e9 Merge branch 'order-delivery-flow' into 'master'
Order delivery flow integration with order fields and order organization participants

See merge request saburly/wiaas/new-wiaas!53
2018-11-04 22:16:39 +00:00
Almira Krdzic
4e8b04fa8d Handle order files download separately from delivery process files 2018-11-04 22:13:52 +01:00
Almira Krdzic
1d097eda6f Get supplier organization from order item 2018-11-04 19:54:43 +01:00
Almira Krdzic
b7e4f7f49b Update db migration and remove unused files 2018-11-04 17:57:48 +01:00
Almira Krdzic
5e55d296e5 fix retrieval of process step action entries 2018-11-04 17:06:42 +01:00
Almira Krdzic
27795387df add dependencies 2018-11-04 14:50:54 +01:00
Almira Krdzic
3011c49474 remove error logs 2018-11-04 14:14:55 +01:00
Almira Krdzic
0b54ce54f8 remove procurement order 2018-11-04 13:25:19 +01:00
Almira Krdzic
a6640548ef Update delivery process fields and sample form 2018-11-04 13:20:13 +01:00
Almira Krdzic
e8a3668c25 Merge branch 'master' into order-delivery-flow 2018-11-04 11:17:42 +01:00
Almira
388f7df8a8 Merge branch 'schedule-installation-new' into 'master'
Schedule installation

See merge request saburly/wiaas/new-wiaas!49
2018-11-03 10:24:43 +00:00
Almira Krdzic
8d4f75cc41 Handle process navigation better 2018-11-03 11:15:52 +01:00
Bilal Catic
24e8515b30 show link to delivery process page 2018-11-03 07:35:39 +01:00
Bilal Catic
01b35dbac5 rename 2018-11-03 07:35:39 +01:00
Bilal Catic
93e17817dc move date selection to workflow 2018-11-03 07:35:39 +01:00
Bilal Catic
2a3f2f8245 fix formatting 2018-11-03 07:35:39 +01:00
Bilal Catic
a059f4b83d save items related to supplier in supplier list 2018-11-03 07:35:39 +01:00
Bilal Catic
c08c393b2d use taxonomy for supplier id 2018-11-03 07:35:39 +01:00
Bilal Catic
f8e3cc5875 move formatting to view 2018-11-03 07:35:39 +01:00
Bilal Catic
3af91a71d7 use acf field for additional days prior installation 2018-11-03 07:35:39 +01:00
Bilal Catic
8eeb3b9927 use order update meta 2018-11-03 07:35:39 +01:00
Bilal Catic
3e4324546b rename files and classes 2018-11-03 07:35:39 +01:00
Bilal Catic
b3ba1889b6 use existing function to get supplier name 2018-11-03 07:35:39 +01:00
Bilal Catic
9e4ee644a0 change style 2018-11-03 07:35:39 +01:00
Bilal Catic
d6c5a36e94 handle delivery schedule dates 2018-11-03 07:35:39 +01:00
Bilal Catic
e6b6f6c136 add additional fields to order 2018-11-03 07:35:39 +01:00
Bilal Catic
9956a94c7c remove debugging output 2018-11-03 07:35:39 +01:00
Bilal Catic
f8dd5f1d9f add additional days prior installation field to bundle 2018-11-03 07:35:39 +01:00
Bilal Catic
1f03563d2e replace buttons with dropdown 2018-11-03 07:35:39 +01:00
Bilal Catic
9aa3b3d044 temporarily remove additional delivery process 2018-11-03 07:35:39 +01:00
Bilal Catic
dbddcd47d3 add delivery process 2018-11-03 07:35:39 +01:00
Bilal Catic
b91341c5df add missing file 2018-11-03 07:35:39 +01:00
Bilal Catic
69c74d9340 order delivery process 2018-11-03 07:35:39 +01:00
Bilal Catic
1ae60eb6eb Merge branch 'disable-email' into 'master'
Disabled processing order email for customer

See merge request saburly/wiaas/new-wiaas!51
2018-11-02 12:33:09 +00:00
Nedim Uka
00076b89fd Disabled processing order email for customer 2018-11-02 11:26:41 +01:00
Almira Krdzic
26f997abbc Import new forms 2018-11-02 11:20:40 +01:00
Almira Krdzic
cdbefc7ef0 Handle assigment for order delivery flow 2018-11-02 10:30:25 +01:00
Nedim Uka
8ffa5ddd3a Merge branch 'quantity-limit-fix' into 'master'
increase quantity limit in cart

See merge request saburly/wiaas/new-wiaas!50
2018-11-01 10:18:59 +00:00
Almira Krdzic
4b0fc6c61d Merge branch 'master' into order-delivery-flow 2018-11-01 11:00:21 +01:00
Almira Krdzic
3d16d5027b Handle process visualization and going from one step to another 2018-11-01 10:43:15 +01:00
Almira
165eb808b8 Merge branch 'suppliers-order' into 'master'
Give order access to suppliers , when order is created

See merge request saburly/wiaas/new-wiaas!48
2018-11-01 09:36:55 +00:00
Nedim Uka
281f71d853 Removed error logs 2018-11-01 10:18:37 +01:00
Bilal Catic
1a33593cbe add more validation 2018-11-01 00:28:33 +01:00
Bilal Catic
46e2259359 increase quantity limit in cart 2018-10-31 21:31:44 +01:00
Nedim Uka
26353f0d80 Show supplier orders, and preview 2018-10-31 15:04:23 +01:00
Almira
683cc68bb7 Merge branch 'fix-total-cost' into 'master'
Fix total cost bug

See merge request saburly/wiaas/new-wiaas!47
2018-10-31 10:24:37 +00:00
Almira Krdzic
308c836460 handle order actions 2018-10-31 10:23:59 +01:00
Almira Krdzic
5aca4e8572 delivery step actions 2018-10-30 17:20:56 +01:00
Nedim Uka
51cb2af438 Give order access to suppliers , when order is created 2018-10-30 15:04:42 +01:00
Bilal Catic
d2ce84b3fb refactor 2018-10-29 16:02:01 +01:00
Bilal Catic
bc39a69b7a fix bug with software cost 2018-10-29 16:02:01 +01:00
Nedim Uka
f5766cda99 Fixed taxonomy search in simple product 2018-10-29 15:18:49 +01:00
Almira
45090fa05f Merge branch 'organisation-bug' into 'master'
Add supplier for organisation only if it has supplier role

See merge request saburly/wiaas/new-wiaas!44
2018-10-26 07:50:32 +00:00
Almira
42c9f07195 Merge branch 'template-category-in-simple-product-search' into 'master'
Connected template category to product in bundle product search

See merge request saburly/wiaas/new-wiaas!43
2018-10-26 07:41:57 +00:00
Nedim Uka
06e7461245 Use roles from hook methods 2018-10-25 14:15:05 +02:00
Nedim Uka
0926030133 Use wiaas edit and create methods for organisations when adding supplier 2018-10-25 13:25:19 +02:00
Nedim Uka
a94afea151 Better format of template category in template search box 2018-10-25 13:05:43 +02:00
Nedim Uka
ef020f57e5 Include empty template category in search 2018-10-25 11:15:32 +02:00
Bilal Catic
892571b179 Merge branch 'optimize-docker' into 'master'
Optimize docker and solve memory issues

See merge request saburly/wiaas/new-wiaas!46
2018-10-24 13:37:32 +00:00
Almira Krdzic
1b5b8e2595 Merge branch 'master' into optimize-docker 2018-10-24 14:17:47 +02:00
Almira
0b4243e368 Merge branch 'fix-env' into 'master'
fix env and docker build

See merge request saburly/wiaas/new-wiaas!45
2018-10-24 12:15:59 +00:00
Bilal Catic
d1a6d1a4d8 Update .dockerignore 2018-10-24 12:14:23 +00:00
Almira Krdzic
59e60bef4d handle order projects 2018-10-24 13:47:16 +02:00
Almira Krdzic
e524e6d0d5 handle only order project with radio buttons 2018-10-24 12:43:02 +02:00
Almira Krdzic
29ccb136d0 Remove unused db updates 2018-10-24 12:40:50 +02:00
Almira Krdzic
e41b643fc5 Handle order number and product ui fields 2018-10-24 12:13:07 +02:00
Bilal Catic
aec480d110 fix env and docker build 2018-10-24 12:09:35 +02:00
Nedim Uka
b0e6cbd9b2 Add supplyer for organisation only if it has supplier role 2018-10-24 11:15:04 +02:00
Almira Krdzic
e1589ee561 optimize docker 2018-10-24 02:15:48 +02:00
Nedim Uka
66452eee86 Connected template category to product in bundle product search 2018-10-23 15:48:56 +02:00
Nedim Uka
18f40d9403 Merge branch 'template-creation-fix' into 'master'
Template creation fix

See merge request saburly/wiaas/new-wiaas!42
2018-10-23 10:37:49 +00:00
Almira Krdzic
69773c77a7 validate country 2018-10-23 12:17:25 +02:00
Almira Krdzic
e3869e720b Fix template creation 2018-10-23 11:28:11 +02:00
Bilal Catic
00999122a2 Merge branch 'role-access' into 'master'
Enable login by role both on frontend and backend

See merge request saburly/wiaas/new-wiaas!40
2018-10-22 09:26:56 +00:00
Almira Krdzic
09aac81276 allow admin on frontend 2018-10-22 11:00:48 +02:00
Almira Krdzic
790d24a1f6 forbid admin user on frontend 2018-10-22 10:58:45 +02:00
Almira Krdzic
3d6f15dd4f return error status on login 2018-10-22 10:35:25 +02:00
Almira Krdzic
5570cf7f91 transform auth user last 2018-10-22 09:53:40 +02:00
Almira Krdzic
e420953c39 do not set cart cookies 2018-10-22 09:52:01 +02:00
Almira Krdzic
21fafc5a43 Enable login by role both on frontend and backend 2018-10-22 09:47:48 +02:00
Almira
87f408125d Merge branch 'preserve-uploads-dir' into 'master'
preserve user uploaded content

See merge request saburly/wiaas/new-wiaas!38
2018-10-22 06:46:38 +00:00
Almira Krdzic
37916e4931 fixes 2018-10-22 08:46:07 +02:00
Bilal Catic
a07b3fb7d9 preserve user uploaded content 2018-10-21 19:18:54 +02:00
Bilal Catic
f76e102bf3 Merge branch 'package-reference' into 'master'
Package reference

See merge request saburly/wiaas/new-wiaas!36
2018-10-21 13:22:49 +00:00
Almira Krdzic
5a6f876c69 Merge branch 'master' into package-reference 2018-10-19 21:01:05 +02:00
Nedim Uka
9b5cc3a978 Merge branch 'bundle-cost-summary' into 'master'
Bundle cost summary

See merge request saburly/wiaas/new-wiaas!35
2018-10-19 10:28:24 +00:00
Almira Krdzic
038b622eca Update product properties field 2018-10-19 12:27:25 +02:00
Almira Krdzic
e4ed26de7d add missing comma 2018-10-19 10:27:33 +02:00
Almira Krdzic
094a7bd56c Merge branch 'master' into package-reference 2018-10-19 10:19:45 +02:00
Almira Krdzic
67dc8d7d69 Hide unused tabs and render only edit link for package prices 2018-10-18 20:02:12 +02:00
Almira Krdzic
3ccea1804e Merge branch 'master' into bundle-cost-summary 2018-10-18 19:01:18 +02:00
Almira
315ac70484 Merge branch 'simple-product-details' into 'master'
Added manufacturer and supplyer product numbers

See merge request saburly/wiaas/new-wiaas!30
2018-10-18 17:00:28 +00:00
Nedim Uka
c4cddf8ace Added comment to save post method 2018-10-18 17:30:42 +02:00
Nedim Uka
00e853ae6b Fixed product status issue 2018-10-18 17:28:31 +02:00
Nedim Uka
071c549726 Impleneted search by country, and added mesurment unit 2018-10-18 16:45:26 +02:00
Almira Krdzic
d22ea58568 Import reference ui field 2018-10-18 13:36:45 +02:00
Almira Krdzic
d3c280548b customize column name for reference 2018-10-18 13:28:41 +02:00
Almira Krdzic
1ed7310994 handle package reference 2018-10-18 13:10:55 +02:00
Almira Krdzic
76e9b10235 Merge branch 'master' into bundle-cost-summary 2018-10-18 09:58:15 +02:00
Almira Krdzic
6b0dd0b5a9 handle bundle product prices editor and prices summary 2018-10-18 09:57:44 +02:00
Almira Krdzic
6d65a5f30c handle bundle product prices editor and prices summary 2018-10-18 09:57:38 +02:00
Bilal Catic
c8ed5f7ff8 Merge branch 'resseler-to-customer' into 'master'
Link customers to their respective (commercial leads/ resellers /shops)

See merge request saburly/wiaas/new-wiaas!34
2018-10-17 20:27:03 +00:00
Almira Krdzic
49281f02be remove error logs 2018-10-17 19:40:25 +02:00
Almira Krdzic
b7ab761a25 Handle bundle pricing on separate page 2018-10-17 19:38:41 +02:00
Almira Krdzic
0238f9140e Fixes 2018-10-17 17:45:33 +02:00
Almira Krdzic
4d13ee40bc Add descriptive comments 2018-10-17 14:02:35 +02:00
Almira Krdzic
6c27afabfc Merge branch 'master' into resseler-to-customer 2018-10-17 13:44:15 +02:00
Almira Krdzic
755fc75ae9 Filter linked organizations as customer 2018-10-17 11:31:09 +02:00
Nedim Uka
ecde654ae9 Merge branch 'commercial-lead-prices' into 'master'
Commercial lead prices

See merge request saburly/wiaas/new-wiaas!33
2018-10-17 09:29:54 +00:00
Almira Krdzic
8769606a4b Implement shop search and refactor 2018-10-17 00:36:19 +02:00
Almira Krdzic
afab22a30b reseller to customer 2018-10-16 06:45:28 +02:00
223 changed files with 14350 additions and 5239 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
# Added to prevent permission problems when building without using super user privileges
./database/volume
./docker/backend/uploads
./log/backend
./log/frontend

View File

@@ -18,6 +18,9 @@ ARG WP_SECURE_AUTH_SALT
ARG WP_LOGGED_IN_SALT
ARG WP_NONCE_SALT
ARG WP_JWT_AUTH_SECRET_KEY
ARG WP_SENDGRID_API_KEY
ARG WP_SENDGRID_FROM_EMAIL
ARG WP_SENDGRID_FROM_NAME
ENV WP_ENV ${WP_ENV}
ENV WP_HOME ${API_URL}
@@ -37,9 +40,13 @@ ENV WP_LOGGED_IN_SALT ${WP_LOGGED_IN_SALT}
ENV WP_NONCE_SALT ${WP_NONCE_SALT}
ENV WP_JWT_AUTH_SECRET_KEY ${WP_JWT_AUTH_SECRET_KEY}
ENV WP_SENDGRID_API_KEY ${WP_SENDGRID_API_KEY}
ENV WP_SENDGRID_FROM_EMAIL ${WP_SENDGRID_FROM_EMAIL}
ENV WP_SENDGRID_FROM_NAME ${WP_SENDGRID_FROM_NAME}
ENV WIAAS_CUSTOMER_INTERFACE ${WIAAS_CUSTOMER_INTERFACE}
RUN apt-get update && apt-get install -y git unzip gnupg mysql-client sudo
RUN apt-get update && apt-get install -y git unzip gnupg mysql-client sudo libpng-dev
COPY docker/php/composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer
@@ -50,8 +57,9 @@ RUN chmod +x /usr/local/bin/wp
COPY docker/php/setup.sh /init-scripts/
RUN chmod +x /init-scripts/setup.sh
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN a2enmod rewrite ssl
RUN docker-php-ext-install pdo pdo_mysql mysqli opcache gd zip mbstring
RUN a2enmod rewrite
COPY docker/php/000-default.conf /etc/apache2/sites-available
COPY backend /home/wiaas/backend
@@ -59,13 +67,17 @@ WORKDIR /home/wiaas/backend/
RUN composer install --no-dev
WORKDIR /home/wiaas
RUN rm -rf backend/app/uploads
RUN cp -r backend/* /var/www/html/
WORKDIR home
RUN rm -rf wiaas
WORKDIR /var/www/html
RUN ln -s ../html api
COPY docker/php/.htaccess /var/www/html/
COPY docker/php/.htaccess /var/www/html/
COPY docker/backend/TaC.pdf /var/www/html/
RUN chown -R www-data:www-data /var/www/html

File diff suppressed because one or more lines are too long

View File

@@ -15,3 +15,169 @@
#createuser .acf-taxonomy-field, #your-profile .acf-taxonomy-field {
width: 25em;
}
.wc-order-preview footer {
display: none;
}
.gravityflow-discussion-item{
margin-bottom:10px;
padding: 6px;
}
.gravityflow-dicussion-item-name {
color:black;
font-weight:bold;
}
.gravityflow-dicussion-item-date {
color: #9b9b9b;
margin-left:8px;
font-size:90%;
}
.rtl .gravityflow-dicussion-item-date {
margin-right:8px;
margin-left: 0;
}
.gravityflow-dicussion-item-toggle-display {
float: right;
}
.rtl .gravityflow-dicussion-item-toggle-display {
float: left;
}
@media print {
.gravityflow-dicussion-item-hidden {
display:block !important;
}
.gravityflow-dicussion-item-toggle-display {
display: none;
}
}
.gravityflow-dicussion-item-value {
padding: 10px;
}
.woocommerce-help-tip{
color:#666;
display:inline-block;
font-size:1.1em;
font-style:normal;
height:16px;
line-height:16px;
position:relative;
vertical-align:middle;
width:16px}
.woocommerce-help-tip::after{
font-family:Dashicons;
speak:none;
font-weight:400;
font-variant:normal;
text-transform:none;
line-height:1;
-webkit-font-smoothing:antialiased;
margin:0;
text-indent:0;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
text-align:center;
content:"";
cursor:help
}
h2 .woocommerce-help-tip{
margin-top:-5px;
margin-left:.25em
}
/**
* Tooltips
*/
.tips {
cursor: help;
text-decoration: none;
}
img.tips {
padding: 5px 0 0;
}
#tiptip_holder {
display: none;
z-index: 8675309;
position: absolute;
top: 0;
/*rtl:ignore*/
left: 0;
}
#tiptip_holder.tip_top {
padding-bottom: 5px;
}
#tiptip_holder.tip_top #tiptip_arrow_inner {
margin-top: -7px;
margin-left: -6px;
border-top-color: #333;
}
#tiptip_holder.tip_bottom {
padding-top: 5px;
}
#tiptip_holder.tip_bottom #tiptip_arrow_inner {
margin-top: -5px;
margin-left: -6px;
border-bottom-color: #333;
}
#tiptip_holder.tip_right {
padding-left: 5px;
}
#tiptip_holder.tip_right #tiptip_arrow_inner {
margin-top: -6px;
margin-left: -5px;
border-right-color: #333;
}
#tiptip_holder.tip_left {
padding-right: 5px;
}
#tiptip_holder.tip_left #tiptip_arrow_inner {
margin-top: -6px;
margin-left: -7px;
border-left-color: #333;
}
#tiptip_content,
.chart-tooltip,
.wc_error_tip {
color: #fff;
font-size: 0.8em;
max-width: 150px;
background: #333;
text-align: center;
border-radius: 3px;
padding: 0.618em 1em;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
#tiptip_content code,
.chart-tooltip code,
.wc_error_tip code {
padding: 1px;
background: #888;
}
#tiptip_arrow,
#tiptip_arrow_inner {
position: absolute;
border-color: transparent;
border-style: solid;
border-width: 6px;
height: 0;
width: 0;
}

View File

@@ -4,4 +4,8 @@
#menu-posts-product .wp-submenu li:last-child {
display: none;
}
.woocommerce-BlankState .button {
display: none !important
}

View File

@@ -0,0 +1,25 @@
.wiaas-dashboard-table {
width: 100%;
}
.wiaas-dashboard-table thead td {
padding: .5em 1em
}
.wiaas-dashboard-table tbody td {
border-top: 1px solid #f5f5f5;
vertical-align: middle;
padding: 1em
}
.wiaas-dashboard-table-empty {
width: 100%;
}
.wiaas-dashboard-table-empty p {
text-align: center;
}
time.wiaas-order-date {
color: #999;
}

View File

@@ -0,0 +1,90 @@
#wiaas_delivery_process_order_notes .note_content {
background: #a7cedc;
padding: 10px;
position: relative;
}
#wiaas_delivery_process_order_notes .note_content:after {
content: '';
display: block;
position: absolute;
bottom: -10px;
left: 20px;
width: 0;
height: 0;
border-width: 10px 10px 0 0;
border-style: solid;
border-color: #a7cedc transparent;
}
#wiaas_delivery_process_order_notes .note_content p {
margin: 0;
padding: 0;
word-wrap: break-word;
}
#wiaas_delivery_process_order_notes p.meta {
padding: 10px;
color: #999;
margin: 0;
font-size: 11px;
}
#wiaas_delivery_process_order_notes .add-note {
border-top: 1px solid #ddd;
padding: 10px 10px 0;
}
#wiaas_delivery_process_order_notes .add-note textarea {
width: 100%;
height: 50px;
}
.wiaas-delivery-process-timeline-note {
margin: 20px 0 30px;
clear: both;
width: 100%;
}
.wiaas-delivery-process-timeline-note > div.wiaas-delivery-process-timeline-note-body-wrap {
border: 1px solid #E0E0E0;
margin-left: 100px;
padding: 10px;
display: block;
}
.wiaas-delivery-process-timeline-note > div .wiaas-delivery-process-timeline-note-body {
overflow-y: hidden;
display: block;
line-height: 1.3em;
width: 100%;
word-wrap: break-word;
}
.wiaas-delivery-process-timeline-note-title {
float: left;
margin-bottom: 0.5em;
font-size: 1.2em;
color: #939FA5;
}
.wiaas-delivery-process-timeline-note-date {
color: #939FA5;
float: right;
font-size: 11px;
text-align: right;
display: block;
}
.wiaas-delivery-process-timeline-note-avatar {
float: left;
width: 84px;
text-align: center;
padding-right: 10px;
}
.wiaas-delivery-process-step-instructions {
padding: 10px 50px;
border-bottom: 1px solid #eee;
}

View File

@@ -30,19 +30,9 @@
}
#wiaas_package_pricing_rules > .wiaas-pricing-rule {
border-color:#dfdfdf;
border-width:1px;
border-style:solid;
-moz-border-radius:3px;
-khtml-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
padding: 0;
border-style:solid;
border-spacing:0;
background-color:#F9F9F9;
margin-bottom: 12px;
margin-left: 12px;
border:1px #dfdfdf solid;
background-color:#fff;
width: 95%;
}
#wiaas_package_pricing_rules > .wiaas-pricing-rule .section {
@@ -133,4 +123,12 @@
#adminmenu #toplevel_page_wiaas-cl-packages div.wp-menu-image::before {
font-family: WooCommerce!important;
content: '\e006';
}
.wiaas-package-error {
color: #a00 !important;
}
table.wp-list-table .column-price {
width: auto !important;
}

View File

@@ -0,0 +1,3 @@
.wc-order-preview-address {
display: none;
}

View File

@@ -0,0 +1,37 @@
mark.wiaas-order-status {
display: inline-flex;
padding: 0 1em;
line-height: 2.5em;
color: #777;
background: #e5e5e5;
border-radius: 4px;
border-bottom: 1px solid rgba(0, 0, 0, .05);
margin: -.5em 0;
cursor: inherit !important;
font-size: 13px;
}
mark.wiaas-order-status-completed {
background: #c8d7e1;
color: #2e4453
}
mark.wiaas-order-status-on-hold {
background: #f8dda7;
color: #94660c
}
mark.wiaas-order-status-failed {
background: #eba3a3;
color: #761919
}
mark.wiaas-order-status-processing {
background: #c6e1c6;
color: #5b841b
}
mark.wiaas-order-status-trash {
background: #eba3a3;
color: #761919
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

View File

@@ -0,0 +1,180 @@
/*
* This combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#dt/dt-1.10.18
*
* Included libraries:
* DataTables 1.10.18
*/
/*!
DataTables 1.10.18
©2008-2018 SpryMedia Ltd - datatables.net/license
*/
(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(E){return h(E,window,document)}):"object"===typeof exports?module.exports=function(E,H){E||(E=window);H||(H="undefined"!==typeof window?require("jquery"):require("jquery")(E));return h(H,E,E.document)}:h(jQuery,window,document)})(function(h,E,H,k){function Z(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
d[c]=e,"o"===b[1]&&Z(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||Z(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Ca(a){var b=n.defaults.oLanguage,c=b.sDecimal;c&&Da(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&(d&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(d&&"Loading..."===b.sLoadingRecords)&&F(a,
a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&c!==a&&Da(a)}}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":
"");"boolean"===typeof a.scrollX&&(a.scrollX=a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&J(n.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"===typeof b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){if(!n.__browser){var b={};n.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:-1*h(E).scrollLeft(),height:1,width:1,
overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,n.__browser);a.oScroll.iBarWidth=n.__browser.barWidth}
function hb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ea(a,b){var c=n.defaults.column,d=a.aoColumns.length,c=h.extend({},n.models.oColumn,c,{nTh:b?b:H.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},n.models.oSearch,c[d]);ka(a,d,h(b).data())}function ka(a,b,c){var b=a.aoColumns[b],
d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var f=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),J(n.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),h.extend(b,c),F(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,"aDataSort"));var g=b.mData,j=S(g),i=b.mRender?
S(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return N(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,
b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function $(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Fa(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&la(a);r(a,null,"column-sizing",[a])}function aa(a,b){var c=ma(a,"bVisible");return"number"===
typeof c[b]?c[b]:null}function ba(a,b){var c=ma(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function V(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function ma(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ga(a){var b=a.aoColumns,c=a.aoData,d=n.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<
j;g++){i=0;for(h=c.length;i<h;i++){t[i]===k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function ib(a,b,c,d){var e,f,g,j,i,m,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){m=b[e];var q=m.targets!==k?m.targets:m.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Ea(a);d(q[f],m)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],m);else if("string"===
typeof q[f]){j=0;for(i=l.length;j<i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&d(j,m)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function O(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},n.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ha(a,e,c,d);return e}function na(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,
e){c=Ia(a,e);return O(a,c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(K(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function jb(a,
b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}function Ja(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function S(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=S(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||
-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ja(f);for(var i=0,m=j.length;i<m;i++){f=j[i].match(ca);g=j[i].match(W);if(f){j[i]=j[i].replace(ca,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(m=a.length;i<m;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(W,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}
function N(a){if(h.isPlainObject(a))return N(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ja(e),f;f=e[e.length-1];for(var g,j,i=0,m=e.length-1;i<m;i++){g=e[i].match(ca);j=e[i].match(W);if(g){e[i]=e[i].replace(ca,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(m=d.length;j<m;j++)f={},b(f,d[j],g),
a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(W,""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(W))a[f.replace(W,"")](d);else a[f.replace(ca,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ka(a){return D(a.aoData,"_aData")}function oa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function pa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,
1)}function da(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ia(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;La(a,e)}}function Ia(a,b,c,d){var e=[],f=b.firstChild,g,
j,i=0,m,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),N(a)(d,b.getAttribute(c)))}},G=function(a){if(c===k||c===i)j=l[i],m=h.trim(a.innerHTML),j&&j._bAttrSrc?(N(j.mData._)(d,m),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=N(j.mData)),j._setter(d,m)):d[i]=m;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)G(f),e.push(f);f=f.nextSibling}else{e=b.anCells;
f=0;for(g=e.length;f<g;f++)G(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&N(a.rowId)(d,b);return{data:d,cells:e}}function Ha(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,m,l,q;if(null===e.nTr){j=c||H.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;La(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){m=a.aoColumns[l];i=c?d[l]:H.createElement(m.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||m.mRender||m.mData!==l)&&(!h.isPlainObject(m.mData)||m.mData._!==l+".display"))i.innerHTML=
B(a,b,l,"display");m.sClass&&(i.className+=" "+m.sClass);m.bVisible&&!c?j.appendChild(i):!m.bVisible&&c&&i.parentNode.removeChild(i);m.fnCreatedCell&&m.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}r(a,"aoRowCreatedCallback",null,[j,f,b,g])}e.nTr.setAttribute("role","row")}function La(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?qa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));
d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===h("th, td",g).length,m=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Ma(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Na(a,"header")(a,d,
f,m);i&&ea(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(m.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(m.sFooterTH);if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function fa(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,m;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=
0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(m=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+m]!==k&&g[d][f].cell==g[d][f+m].cell;){for(c=0;c<i;c++)j[d+c][f+m]=1;m++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",m)}}}}function P(a){var b=r(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=
d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);var g=a._iDisplayStart,m=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!lb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:m;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ha(a,l);var t=q.nTr;if(0!==e){var G=d[c%e];q._sRowStripe!=G&&(h(t).removeClass(q._sRowStripe).addClass(G),
q._sRowStripe=G)}r(a,"aoRowCallback",null,[t,q._aData,c,j,l]);b.push(t);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:V(a),"class":a.oClasses.sRowEmpty}).html(c))[0];r(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ka(a),g,m,i]);r(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ka(a),g,m,i]);d=h(a.nTBody);d.children().detach();
d.append(h(b));r(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function T(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&mb(a);d?ga(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;P(a);a._drawHold=!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=
a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,m,l,q,k=0;k<f.length;k++){g=null;j=f[k];if("<"==j){i=h("<div/>")[0];m=f[k+1];if("'"==m||'"'==m){l="";for(q=2;f[k+q]!=m;)l+=f[k+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(m=l.split("."),i.id=m[0].substr(1,m[0].length-1),i.className=m[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;k+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if("f"==j&&
d.bFilter)g=pb(a);else if("r"==j&&d.bProcessing)g=qb(a);else if("t"==j)g=rb(a);else if("i"==j&&d.bInfo)g=sb(a);else if("p"==j&&d.bPaginate)g=tb(a);else if(0!==n.ext.feature.length){i=n.ext.feature;q=0;for(m=i.length;q<m;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function ea(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,m,l,q,k;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<
i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;m=g;k=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][m+j]={cell:e,unique:k},a[f+g].nTr=d}e=e.nextSibling}}}function ra(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],ea(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||
!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function sa(a,b,c){r(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){r(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var m="function"===typeof f?f(b,a):f,b="function"===typeof f&&m?m:h.extend(!0,b,m);delete g.data}m={data:b,success:function(b){var c=
b.error||b.sError;c&&K(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=r(a,null,"xhr",[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?K(a,0,"Invalid JSON response",1):4===b.readyState&&K(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;r(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(m,{url:g||a.sAjaxSource})):
"function"===typeof g?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(m,g)),g.data=f)}function lb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,!0),sa(a,ub(a),function(b){vb(a,b)}),!1):!0}function ub(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,m,l,k=X(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var t=function(a,b){j.push({name:a,value:b})};t("sEcho",a.iDraw);t("iColumns",c);t("sColumns",D(b,"sName").join(","));t("iDisplayStart",g);t("iDisplayLength",
i);var G={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)m=b[g],l=f[g],i="function"==typeof m.mData?"function":m.mData,G.columns.push({data:i,name:m.sName,searchable:m.bSearchable,orderable:m.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),t("mDataProp_"+g,i),d.bFilter&&(t("sSearch_"+g,l.sSearch),t("bRegex_"+g,l.bRegex),t("bSearchable_"+g,m.bSearchable)),d.bSort&&t("bSortable_"+g,m.bSortable);d.bFilter&&(t("sSearch",e.sSearch),t("bRegex",
e.bRegex));d.bSort&&(h.each(k,function(a,b){G.order.push({column:b.col,dir:b.dir});t("iSortCol_"+a,b.col);t("sSortDir_"+a,b.dir)}),t("iSortingCols",k.length));b=n.ext.legacy.ajax;return null===b?a.sAjaxSource?j:G:b?j:G}function vb(a,b){var c=ta(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}oa(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,
10);d=0;for(e=c.length;d<e;d++)O(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;P(a);a._bInitComplete||ua(a,b);a.bAjaxDataGet=!0;C(a,!1)}function ta(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?S(c)(b):b}function pb(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",
g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?"":this.value;b!=e.sSearch&&(ga(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,P(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Oa(f,g):f).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",
c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==H.activeElement&&i.val(e.sSearch)}catch(d){}});return b[0]}function ga(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ga(a);if("ssp"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)xb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,
e[b].bSmart,e[b].bCaseInsensitive);yb(a)}else f(b);a.bFiltered=!0;r(a,null,"search",[a])}function yb(a){for(var b=n.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,m=c.length;i<m;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function xb(a,b,c,d,e,f){if(""!==b){for(var g=[],j=a.aiDisplay,d=Pa(b,d,e,f),e=0;e<j.length;e++)b=a.aoData[j[e]]._aFilterData[c],d.test(b)&&g.push(j[e]);a.aiDisplay=g}}function wb(a,b,c,d,e,f){var d=Pa(b,
d,e,f),f=a.oPreviousSearch.sSearch,g=a.aiDisplayMaster,j,e=[];0!==n.ext.search.length&&(c=!0);j=zb(a);if(0>=b.length)a.aiDisplay=g.slice();else{if(j||c||f.length>b.length||0!==b.indexOf(f)||a.bSorted)a.aiDisplay=g.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)d.test(a.aoData[b[c]]._sFilterRow)&&e.push(b[c]);a.aiDisplay=e}}function Pa(a,b,c,d){a=b?a:Qa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',
"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function zb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=n.ext.type.search;c=!1;d=0;for(f=a.aoData.length;d<f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(va.innerHTML=i,i=Wb?va.textContent:va.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);
h._aFilterData=j;h._sFilterRow=j.join(" ");c=!0}return c}function Ab(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}function Bb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function sb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Cb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",
b+"_info"));return d[0]}function Cb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Db(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Db(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,
c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ha(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){nb(a);kb(a);fa(a,a.aoHeader);fa(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Fa(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=v(f.sWidth));r(a,null,"preInit",[a]);T(a);e=
y(a);if("ssp"!=e||g)"ajax"==e?sa(a,[],function(c){var f=ta(a,c);for(b=0;b<f.length;b++)O(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ua(a,c)},a):(C(a,!1),ua(a))}else setTimeout(function(){ha(a)},200)}function ua(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&$(a);r(a,null,"plugin-init",[a,b]);r(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);r(a,null,"length",[a,c])}function ob(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=
e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],f[g]);var i=h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).on("change.DT",function(){Ra(a,h(this).val());P(a)});h(a.nTable).on("length.dt.DT",function(b,c,d){a===
c&&h("select",i).val(d)});return i[0]}function tb(a){var b=a.sPaginationType,c=n.ext.pager[b],d="function"===typeof c,e=function(a){P(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Na(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,
e)},sName:"pagination"}));return b}function Ta(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:K(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(r(a,null,"page",[a]),c&&P(a));return b}function qb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}
function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");r(a,null,"processing",[a,b])}function rb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),m=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",
position:"relative",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:v(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",
{"class":f.sScrollFootInner}).append(m.removeAttr("id").css("margin-left",0).append("bottom"===j?g:null).append(b.children("tfoot")))));var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:la,sName:"scrolling"});return i[0]}function la(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,
f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,m=j.children("table"),j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),n=t.children("table"),o=h(a.nTHead),p=h(a.nTable),s=p[0],r=s.style,u=a.nTFoot?h(a.nTFoot):null,x=a.oBrowser,U=x.bScrollOversize,Xb=D(a.aoColumns,"nTh"),Q,L,R,w,Ua=[],y=[],z=[],A=[],B,C=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};L=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==
L&&a.scrollBarVis!==k)a.scrollBarVis=L,$(a);else{a.scrollBarVis=L;p.children("thead, tfoot").remove();u&&(R=u.clone().prependTo(p),Q=u.find("tr"),R=R.find("tr"));w=o.clone().prependTo(p);o=o.find("tr");L=w.find("tr");w.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(ra(a,w),function(b,c){B=aa(a,b);c.style.width=a.aoColumns[B].sWidth});u&&I(function(a){a.style.width=""},R);f=p.outerWidth();if(""===c){r.width="100%";if(U&&(p.find("tbody").height()>j.offsetHeight||
"scroll"==l.css("overflow-y")))r.width=v(p.outerWidth()-b);f=p.outerWidth()}else""!==d&&(r.width=v(d),f=p.outerWidth());I(C,L);I(function(a){z.push(a.innerHTML);Ua.push(v(h(a).css("width")))},L);I(function(a,b){if(h.inArray(a,Xb)!==-1)a.style.width=Ua[b]},o);h(L).height(0);u&&(I(C,R),I(function(a){A.push(a.innerHTML);y.push(v(h(a).css("width")))},R),I(function(a,b){a.style.width=y[b]},Q),h(R).height(0));I(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+z[b]+"</div>";a.childNodes[0].style.height=
"0";a.childNodes[0].style.overflow="hidden";a.style.width=Ua[b]},L);u&&I(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+A[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=y[b]},R);if(p.outerWidth()<f){Q=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(U&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(Q-b);(""===c||""!==d)&&K(a,1,"Possible column misalignment",6)}else Q="100%";q.width=v(Q);
g.width=v(Q);u&&(a.nScrollFoot.style.width=v(Q));!e&&U&&(q.height=v(s.offsetHeight+b));c=p.outerWidth();m[0].style.width=v(c);i.width=v(c);d=p.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+(x.bScrollbarLeft?"Left":"Right");i[e]=d?b+"px":"0px";u&&(n[0].style.width=v(c),t[0].style.width=v(c),t[0].style[e]=d?b+"px":"0px");p.children("colgroup").insertBefore(p.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function I(a,b,c){for(var d=0,e=0,
f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Fa(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,f=d.sX,g=d.sXInner,j=c.length,i=ma(a,"bVisible"),m=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,n,o,p=a.oBrowser,d=p.bScrollOversize;(n=b.style.width)&&-1!==n.indexOf("%")&&(l=n);for(n=0;n<i.length;n++)o=c[i[n]],null!==o.sWidth&&(o.sWidth=Eb(o.sWidthOrig,k),t=!0);if(d||
!t&&!f&&!e&&j==V(a)&&j==m.length)for(n=0;n<j;n++)i=aa(a,n),null!==i&&(c[i].sWidth=v(m.eq(n).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var s=h("<tr/>").appendTo(j.find("tbody"));j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");m=ra(a,j.find("thead")[0]);for(n=0;n<i.length;n++)o=c[i[n]],m[n].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?v(o.sWidthOrig):
"",o.sWidthOrig&&f&&h(m[n]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(n=0;n<i.length;n++)t=i[n],o=c[t],h(Fb(a,t)).clone(!1).append(o.sContentPadding).appendTo(s);h("[name]",j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):
l&&j.width(l);for(n=e=0;n<i.length;n++)k=h(m[n]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(m[n].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[n]].sWidth=v(k-g);b.style.width=v(e);o.remove()}l&&(b.style.width=v(l));if((l||f)&&!a._reszEvt)b=function(){h(E).on("resize.DT-"+a.sInstance,Oa(function(){$(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Eb(a,b){if(!a)return 0;var c=h("<div/>").css("width",v(a)).appendTo(b||H.body),d=c[0].offsetWidth;c.remove();return d}function Fb(a,
b){var c=Gb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Gb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace(Yb,""),c=c.replace(/&nbsp;/g," "),c.length>d&&(d=c.length,e=f);return e}function v(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function X(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var m=[];f=function(a){a.length&&
!h.isArray(a[0])?m.push(a):h.merge(m,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<m.length;a++){i=m[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||"string",m[a]._idx===k&&(m[a]._idx=h.inArray(m[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:m[a][1],index:m[a]._idx,type:j,formatter:n.ext.type.order[j+"-pre"]})}return d}function mb(a){var b,c,d=[],e=n.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Ga(a);h=X(a);b=0;for(c=h.length;b<
c;b++)j=h[b],j.formatter&&g++,Hb(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,n=f[b]._aSortData;for(g=0;g<i;g++)if(j=h[g],c=k[j.col],e=n[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,n=f[a]._aSortData,o=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=n[i.col],g=o[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],
c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Ib(a){for(var b,c,d=a.aoColumns,e=X(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Va(a,
b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,D(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);T(a);"function"==
typeof d&&d(a)}function Ma(a,b,c,d){var e=a.aoColumns[c];Wa(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Va(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Va(a,c,b.shiftKey,d))})}function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=X(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(D(a.aoData,"anCells",g)).addClass(c+
(2>e?e+1:3))}a.aLastSort=d}function Hb(a,b){var c=a.aoColumns[b],d=n.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,ba(a,b)));for(var f,g=n.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),
columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Jb(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&
(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==k&&h.extend(a.oPreviousSearch,Bb(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Bb(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=
a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=n.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function K(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=n.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==
typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Xa(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).on("click.DT",b,function(b){h(a).blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",
function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=n.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===
typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ia(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=Y(0,b):a<=d?(c=Y(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=Y(b-(c-2),b):(c=Y(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function Da(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Ya)},"html-num":function(b){return za(b,
a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Ya)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=[ya(this[n.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return n.ext.internal[a].apply(this,b)}}var n=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new s(ya(this[x.iApiIndex])):new s(this)};
this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):(""!==d.sX||""!==d.sY)&&la(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,
b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():
c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};
this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return ya(this[x.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();
(d===k||d)&&h.draw();return 0};this.fnVersionCheck=x.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=x.internal;for(var e in n.ext.internal)e&&(this[e]=Lb(e));this.each(function(){var e={},g=1<d?Xa(e,a,!0):a,j=0,i,e=this.getAttribute("id"),m=!1,l=n.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())K(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);fb(l.column);J(l,l,!0);J(l.column,l.column,!0);J(l,h.extend(g,q.data()));var t=n.settings,
j=0;for(i=t.length;j<i;j++){var o=t[j];if(o.nTable==this||o.nTHead&&o.nTHead.parentNode==this||o.nTFoot&&o.nTFoot.parentNode==this){var s=g.bRetrieve!==k?g.bRetrieve:l.bRetrieve;if(c||s)return o.oInstance;if(g.bDestroy!==k?g.bDestroy:l.bDestroy){o.oInstance.fnDestroy();break}else{K(o,0,"Cannot reinitialise DataTable",3);return}}if(o.sTableId==this.id){t.splice(j,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+n.ext._unique++;var p=h.extend(!0,{},n.models.oSettings,{sDestroyWidth:q[0].style.width,
sInstance:e,sTableId:e});p.nTable=this;p.oApi=b.internal;p.oInit=g;t.push(p);p.oInstance=1===b.length?b:q.dataTable();eb(g);Ca(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=h.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=Xa(h.extend(!0,{},l),g);F(p.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));F(p,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod",
"aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);F(p.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);F(p.oLanguage,g,"fnInfoCallback");
z(p,"aoDrawCallback",g.fnDrawCallback,"user");z(p,"aoServerParams",g.fnServerParams,"user");z(p,"aoStateSaveParams",g.fnStateSaveParams,"user");z(p,"aoStateLoadParams",g.fnStateLoadParams,"user");z(p,"aoStateLoaded",g.fnStateLoaded,"user");z(p,"aoRowCallback",g.fnRowCallback,"user");z(p,"aoRowCreatedCallback",g.fnCreatedRow,"user");z(p,"aoHeaderCallback",g.fnHeaderCallback,"user");z(p,"aoFooterCallback",g.fnFooterCallback,"user");z(p,"aoInitComplete",g.fnInitComplete,"user");z(p,"aoPreDrawCallback",
g.fnPreDrawCallback,"user");p.rowIdFn=S(g.rowId);gb(p);var u=p.oClasses;h.extend(u,n.ext.classes,g.oClasses);q.addClass(u.sTable);p.iInitDisplayStart===k&&(p.iInitDisplayStart=g.iDisplayStart,p._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(p.bDeferLoading=!0,e=h.isArray(g.iDeferLoading),p._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,p._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var v=p.oLanguage;h.extend(!0,v,g.oLanguage);v.sUrl&&(h.ajax({dataType:"json",url:v.sUrl,success:function(a){Ca(a);
J(l.oLanguage,a);h.extend(true,v,a);ha(p)},error:function(){ha(p)}}),m=!0);null===g.asStripeClasses&&(p.asStripeClasses=[u.sStripeOdd,u.sStripeEven]);var e=p.asStripeClasses,x=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(e,function(a){return x.hasClass(a)}))&&(h("tbody tr",this).removeClass(e.join(" ")),p.asDestroyStripes=e.slice());e=[];t=this.getElementsByTagName("thead");0!==t.length&&(ea(p.aoHeader,t[0]),e=ra(p));if(null===g.aoColumns){t=[];j=0;for(i=e.length;j<i;j++)t.push(null)}else t=
g.aoColumns;j=0;for(i=t.length;j<i;j++)Ea(p,e?e[j]:null);ib(p,g.aoColumnDefs,t,function(a,b){ka(p,a,b)});if(x.length){var w=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(x[0]).children("th, td").each(function(a,b){var c=p.aoColumns[a];if(c.mData===a){var d=w(b,"sort")||w(b,"order"),e=w(b,"filter")||w(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ka(p,a)}}})}var U=p.oFeatures,
e=function(){if(g.aaSorting===k){var a=p.aaSorting;j=0;for(i=a.length;j<i;j++)a[j][1]=p.aoColumns[j].asSorting[0]}wa(p);U.bSort&&z(p,"aoDrawCallback",function(){if(p.bSorted){var a=X(p),b={};h.each(a,function(a,c){b[c.src]=c.dir});r(p,null,"order",[p,a,b]);Ib(p)}});z(p,"aoDrawCallback",function(){(p.bSorted||y(p)==="ssp"||U.bDeferRender)&&wa(p)},"sc");var a=q.children("caption").each(function(){this._captionSide=h(this).css("caption-side")}),b=q.children("thead");b.length===0&&(b=h("<thead/>").appendTo(q));
p.nTHead=b[0];b=q.children("tbody");b.length===0&&(b=h("<tbody/>").appendTo(q));p.nTBody=b[0];b=q.children("tfoot");if(b.length===0&&a.length>0&&(p.oScroll.sX!==""||p.oScroll.sY!==""))b=h("<tfoot/>").appendTo(q);if(b.length===0||b.children().length===0)q.addClass(u.sNoFooter);else if(b.length>0){p.nTFoot=b[0];ea(p.aoFooter,p.nTFoot)}if(g.aaData)for(j=0;j<g.aaData.length;j++)O(p,g.aaData[j]);else(p.bDeferLoading||y(p)=="dom")&&na(p,h(p.nTBody).children("tr"));p.aiDisplay=p.aiDisplayMaster.slice();
p.bInitialised=true;m===false&&ha(p)};g.bStateSave?(U.bStateSave=!0,z(p,"aoDrawCallback",xa,"state_save"),Jb(p,g,e)):e()}});b=null;return this},x,s,o,u,Za={},Mb=/[\r\n]/g,Aa=/<.*?>/g,Zb=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,$b=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Ya=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,M=function(a){return!a||!0===a||"-"===a?!0:!1},Nb=function(a){var b=parseInt(a,10);return!isNaN(b)&&
isFinite(a)?b:null},Ob=function(a,b){Za[b]||(Za[b]=RegExp(Qa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Za[b],"."):a},$a=function(a,b,c){var d="string"===typeof a;if(M(a))return!0;b&&d&&(a=Ob(a,b));c&&d&&(a=a.replace(Ya,""));return!isNaN(parseFloat(a))&&isFinite(a)},Pb=function(a,b,c){return M(a)?!0:!(M(a)||"string"===typeof a)?null:$a(a.replace(Aa,""),b,c)?!0:null},D=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<
f;e++)a[e]&&d.push(a[e][b]);return d},ja=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},Y=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Qb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},qa=function(a){var b;a:{if(!(2>a.length)){b=a.slice().sort();for(var c=b[0],d=1,e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();
b=[];var e=a.length,f,g=0,d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};n.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,j=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=k;a.apply(b,j)},c)):(d=g,a.apply(b,j))}},escapeRegex:function(a){return a.replace($b,"\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ca=/\[.*?\]$/,W=/\(\)$/,Qa=n.util.escapeRegex,va=h("<div>")[0],Wb=va.textContent!==k,Yb=
/<.*?>/g,Oa=n.util.throttle,Rb=[],w=Array.prototype,ac=function(a){var b,c,d=n.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};s=function(a,b){if(!(this instanceof
s))return new s(a,b);var c=[],d=function(a){(a=ac(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=qa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};s.extend(this,this,Rb)};n.Api=s;h.extend(s.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=
this.context;return b.length>a?new s(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new s(this.context,b)},flatten:function(){var a=[];return new s(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,j,h,m,l=this.context,
n,o,u=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(j=l.length;g<j;g++){var r=new s(l[g]);if("table"===b)f=c.call(r,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(r,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){o=this[g];"column-rows"===b&&(n=Ba(l[g],u.opts));h=0;for(m=o.length;h<m;h++)f=o[h],f="cell"===b?c.call(r,l[g],f.row,f.column,g,h):c.call(r,l[g],f,g,h,n),f!==k&&e.push(f)}}return e.length||d?(a=new s(l,a?
e.concat.apply([],e):e),b=a.selector,b.rows=u.rows,b.cols=u.cols,b.opts=u.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new s(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return hb(this,a,b,0,this.length,
1)},reduceRight:w.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,slice:function(){return new s(this.context,this)},sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},unique:function(){return new s(this.context,qa(this))},unshift:w.unshift});s.extend=function(a,b,c){if(c.length&&b&&(b instanceof s||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=
b.apply(a,arguments);s.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,s.extend(a,b[f.name],f.propExt)}};s.register=o=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<d;c++)s.register(a[c],b);else for(var e=a.split("."),f=Rb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var m=f.length;i<m;i++)if(f[i].name===g){i=
f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};s.registerPlural=u=function(a,b,c){s.register(a,c);s.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof s?a.length?h.isArray(a[0])?new s(a.context,a[0]):a[0]:k:a})};o("tables()",function(a){var b;if(a){b=s;var c=this.context;if("number"===typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,
d);return c[a]}).toArray();b=new b(a)}else b=this;return b});o("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new s(b[0]):a});u("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});u("tables().body()","table().body()",function(){return this.iterator("table",function(a){return a.nTBody},1)});u("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});u("tables().footer()",
"table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});u("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});o("draw()",function(a){return this.iterator("table",function(b){"page"===a?P(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),T(b,!1===a))})});o("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});o("page.info()",function(){if(0===
this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,serverSide:"ssp"===y(a)}});o("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator("table",function(b){Ra(b,a)})});var Sb=function(a,b,c){if(c){var d=new s(a);
d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))T(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();sa(a,[],function(c){oa(a);for(var c=ta(a,c),d=0,e=c.length;d<e;d++)O(a,c[d]);T(a,b);C(a,!1)})}};o("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});o("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});o("ajax.reload()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});o("ajax.url()",function(a){var b=
this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});o("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});var ab=function(a,b,c,d,e){var f=[],g,j,i,m,l,n;i=typeof b;if(!b||"string"===i||"function"===i||b.length===k)b=[b];i=0;for(m=b.length;i<m;i++){j=b[i]&&b[i].split&&!b[i].match(/[\[\(:]/)?b[i].split(","):
[b[i]];l=0;for(n=j.length;l<n;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=x.selector[a];if(a.length){i=0;for(m=a.length;i<m;i++)f=a[i](d,e,f)}return qa(f)},bb=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",page:"all"},a)},cb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,
d,e,f=[],g=a.aiDisplay;e=a.aiDisplayMaster;var j=b.search;c=b.order;d=b.page;if("ssp"==y(a))return"removed"===j?[]:Y(0,e.length);if("current"==d){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==c||"applied"==c)if("none"==j)f=e.slice();else if("applied"==j)f=g.slice();else{if("removed"==j){var i={};c=0;for(d=g.length;c<d;c++)i[g[c]]=null;f=h.map(e,function(a){return!i.hasOwnProperty(a)?a:null})}}else if("index"==c||"original"==c){c=0;for(d=a.aoData.length;c<d;c++)"none"==
j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};o("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=bb(b),c=this.iterator("table",function(c){var e=b,f;return ab("row",a,function(a){var b=Nb(a),i=c.aoData;if(b!==null&&!e)return[b];f||(f=Ba(c,e));if(b!==null&&h.inArray(b,f)!==-1)return[b];if(a===null||a===k||a==="")return f;if(typeof a==="function")return h.map(f,function(b){var c=i[b];return a(b,c._aData,c.nTr)?b:null});if(a.nodeName){var b=
a._DT_RowIndex,m=a._DT_CellIndex;if(b!==k)return i[b]&&i[b].nTr===a?[b]:[];if(m)return i[m.row]&&i[m.row].nTr===a?[m.row]:[];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){b=c.aIds[a.replace(/^#/,"")];if(b!==k)return[b.idx]}b=Qb(ja(c.aoData,f,"nTr"));return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});o("rows().nodes()",function(){return this.iterator("row",
function(a,b){return a.aoData[b].nTr||k},1)});o("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ja(a.aoData,b,"_aData")},1)});u("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});u("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){da(b,c,a)})});u("rows().indexes()","row().index()",function(){return this.iterator("row",
function(a,b){return b},1)});u("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new s(c,b)});u("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,m,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(m=
l.length;i<m;i++)l[i]._DT_CellIndex.row=g}pa(b.aiDisplayMaster,c);pa(b.aiDisplay,c);pa(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Sa(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});o("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(na(b,c)[0]):h.push(O(b,c));return h},
1),c=this.rows(-1);c.pop();h.merge(c,b);return c});o("row()",function(a,b){return cb(this.rows(a,b))});o("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;var c=b[0].aoData[this[0]];c._aData=a;h.isArray(a)&&c.nTr.id&&N(b[0].rowId)(a,c.nTr.id);da(b[0],this[0],"data");return this});o("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});o("row.add()",function(a){a instanceof h&&
a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?na(b,a)[0]:O(b,a)});return this.row(b[0])});var db=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Tb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new s(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");
0<D(g,"_details").length&&(f.on("draw.dt.DT_details",function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=V(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&db(f,c)}))}}};o("row().child()",function(a,b){var c=
this.context;if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)db(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=V(d),e.push(c[0]))};f(a,b);c._details&&c._details.detach();c._details=h(e);
c._detailsShow&&c._details.insertAfter(c.nTr)}return this});o(["row().child.show()","row().child().show()"],function(){Tb(this,!0);return this});o(["row().child.hide()","row().child().hide()"],function(){Tb(this,!1);return this});o(["row().child.remove()","row().child().remove()"],function(){db(this);return this});o("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var bc=/^([^:]+):(name|visIdx|visible)$/,Ub=function(a,b,
c,d,e){for(var c=[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));return c};o("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=bb(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return ab("column",e,function(a){var b=Nb(a);if(a==="")return Y(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Ub(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(bc):
"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],10);if(b<0){var n=h.map(g,function(a,b){return a.bVisible?b:null});return[n[n.length+b]]}return[aa(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},
1);c.selector.cols=a;c.selector.opts=b;return c});u("columns().header()","column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});u("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});u("columns().data()","column().data()",function(){return this.iterator("column-rows",Ub,1)});u("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},
1)});u("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ja(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});u("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ja(a.aoData,e,"anCells",b)},1)});u("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,
i,m,l;if(a!==k&&g.bVisible!==a){if(a){var n=h.inArray(!0,D(f,"bVisible"),c+1);i=0;for(m=j.length;i<m;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[n]||null)}else h(D(b.aoData,"anCells",c)).detach();g.bVisible=a;fa(b,b.aoHeader);fa(b,b.aoFooter);b.aiDisplay.length||h(b.nTBody).find("td[colspan]").attr("colspan",V(b));xa(b)}});a!==k&&(this.iterator("column",function(c,e){r(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});u("columns().indexes()","column().index()",
function(a){return this.iterator("column",function(b,c){return"visible"===a?ba(b,c):c},1)});o("columns.adjust()",function(){return this.iterator("table",function(a){$(a)},1)});o("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return aa(c,b);if("fromData"===a||"toVisible"===a)return ba(c,b)}});o("column()",function(a,b){return cb(this.columns(a,b))});o("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));
h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=bb(c),f=b.aoData,g=Ba(b,e),j=Qb(ja(f,g,"anCells")),i=h([].concat.apply([],j)),l,m=b.aoColumns.length,n,o,u,s,r,v;return ab("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){n=[];o=0;for(u=g.length;o<u;o++){l=g[o];for(s=0;s<m;s++){r={row:l,column:s};if(c){v=f[l];a(r,B(b,l,s),v.anCells?v.anCells[s]:null)&&n.push(r)}else n.push(r)}}return n}if(h.isPlainObject(a))return a.column!==
k&&a.row!==k&&h.inArray(a.row,g)!==-1?[a]:[];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||!a.nodeName)return c;v=h(a).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},b,e)});var d=this.columns(b),e=this.rows(a),f,g,j,i,m;this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(m=d[b].length;i<m;i++)f.push({row:e[b][g],column:d[b][i]})}},1);var l=this.cells(f,
c);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});u("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&a.anCells?a.anCells[c]:k},1)});o("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});u("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});u("cells().render()","cell().render()",
function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});u("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:ba(a,c)}},1)});u("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){da(b,c,a,d)})});o("cell()",function(a,b,c){return cb(this.cells(a,b,c))});o("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],
c[0].row,c[0].column):k;jb(b[0],c[0].row,c[0].column,a);da(b[0],c[0].row,"data",c[0].column);return this});o("order()",function(a,b){var c=this.context;if(a===k)return 0!==c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});o("order.listener()",function(a,b,c){return this.iterator("table",function(d){Ma(d,a,b,c)})});o("order.fixed()",function(a){if(!a){var b=
this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});o(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});o("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&ga(e,
h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});u("columns().search()","column().search()",function(a,b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),ga(e,e.oPreviousSearch,1))})});o("state()",function(){return this.context.length?this.context[0].oSavedState:
null});o("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});o("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});o("state.save()",function(){return this.iterator("table",function(a){xa(a)})});n.versionCheck=n.fnVersionCheck=function(a){for(var b=n.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};n.isDataTable=
n.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;if(a instanceof n.Api)return!0;h.each(n.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?h("table",e.nScrollFoot)[0]:null;if(e.nTable===b||f===b||g===b)c=!0});return c};n.tables=n.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(n.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new s(c):c};n.camelToHungarian=J;o("$()",function(a,b){var c=
this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){o(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0]=h.map(a[0].split(/\s/),function(a){return!a.match(/\.dt\b/)?a+".dt":a}).join(" ");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});o("clear()",function(){return this.iterator("table",function(a){oa(a)})});o("settings()",function(){return new s(this.context,this.context)});o("init()",function(){var a=
this.context;return a.length?a[0].oInit:null});o("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});o("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),o;b.bDestroying=!0;r(b,"aoDestroyCallback","destroy",[b]);a||(new s(b)).columns().visible(!0);k.off(".DT").find(":not(tbody *)").off(".DT");
h(E).off(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));b.aaSorting=[];b.aaSortingFixed=[];wa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),
(o=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%o])}));c=h.inArray(b,n.settings);-1!==c&&n.settings.splice(c,1)})});h.each(["column","row","cell"],function(a,b){o(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,m){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,m)})})});o("i18n()",function(a,b,c){var d=this.context[0],a=S(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:
a._);return a.replace("%d",c)});n.version="1.10.18";n.settings=[];n.models={};n.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};n.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};n.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,
sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};n.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,
bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+
a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},
oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},
n.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};Z(n.defaults);n.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};
Z(n.defaults.column);n.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],
aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",
iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:
this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};n.ext=x={buttons:{},
classes:{},build:"dt/dt-1.10.18",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:n.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:n.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});
h.extend(n.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",
sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
sJUIHeader:"",sJUIFooter:""});var Kb=n.ext.pager;h.extend(Kb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ia(a,b)]},simple_numbers:function(a,b){return["previous",ia(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ia(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ia(a,b),"last"]},_numbers:ia,numbers_length:7});h.extend(!0,n.ext.renderer,{pageButton:{_:function(a,b,c,d,e,
f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},m,l,n=0,o=function(b,d){var k,s,u,r,v=function(b){Ta(a,b.data.action,true)};k=0;for(s=d.length;k<s;k++){r=d[k];if(h.isArray(r)){u=h("<"+(r.DT_el||"div")+"/>").appendTo(b);o(u,r)}else{m=null;l="";switch(r){case "ellipsis":b.append('<span class="ellipsis">&#x2026;</span>');break;case "first":m=j.sFirst;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":m=j.sPrevious;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":m=
j.sNext;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":m=j.sLast;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:m=r+1;l=e===r?g.sPageButtonActive:""}if(m!==null){u=h("<a>",{"class":g.sPageButton+" "+l,"aria-controls":a.sTableId,"aria-label":i[r],"data-dt-idx":n,tabindex:a.iTabIndex,id:c===0&&typeof r==="string"?a.sTableId+"_"+r:null}).html(m).appendTo(b);Wa(u,{action:r},v);n++}}}},s;try{s=h(b).find(H.activeElement).data("dt-idx")}catch(u){}o(h(b).empty(),d);s!==k&&h(b).find("[data-dt-idx="+
s+"]").focus()}}});h.extend(n.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return $a(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&!Zb.test(a))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||M(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return $a(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c,!0)?"html-num-fmt"+c:null},function(a){return M(a)||
"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(n.ext.type.search,{html:function(a){return M(a)?a:"string"===typeof a?a.replace(Mb," ").replace(Aa,""):""},string:function(a){return M(a)?a:"string"===typeof a?a.replace(Mb," "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Ob(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(x.type.order,{"date-pre":function(a){a=Date.parse(a);return isNaN(a)?-Infinity:a},"html-pre":function(a){return M(a)?
"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return M(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});Da("");h.extend(!0,n.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:
c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]==
"asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Vb=function(a){return"string"===typeof a?a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):a};n.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Vb(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
a)+f+(e||"")}}},text:function(){return{display:Vb}}};h.extend(n.ext.internal,{_fnExternApiFunc:Lb,_fnBuildAjax:sa,_fnAjaxUpdate:lb,_fnAjaxParameters:ub,_fnAjaxUpdateDraw:vb,_fnAjaxDataSrc:ta,_fnAddColumn:Ea,_fnColumnOptions:ka,_fnAdjustColumnSizing:$,_fnVisibleToColumnIndex:aa,_fnColumnIndexToVisible:ba,_fnVisbleColumns:V,_fnGetColumns:ma,_fnColumnTypes:Ga,_fnApplyColumnDefs:ib,_fnHungarianMap:Z,_fnCamelToHungarian:J,_fnLanguageCompat:Ca,_fnBrowserDetect:gb,_fnAddData:O,_fnAddTr:na,_fnNodeToDataIndex:function(a,
b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:jb,_fnSplitObjNotation:Ja,_fnGetObjectDataFn:S,_fnSetObjectDataFn:N,_fnGetDataMaster:Ka,_fnClearTable:oa,_fnDeleteIndex:pa,_fnInvalidate:da,_fnGetRowElements:Ia,_fnCreateTr:Ha,_fnBuildHead:kb,_fnDrawHead:fa,_fnDraw:P,_fnReDraw:T,_fnAddOptionsHtml:nb,_fnDetectHeader:ea,_fnGetUniqueThs:ra,_fnFeatureHtmlFilter:pb,_fnFilterComplete:ga,_fnFilterCustom:yb,
_fnFilterColumn:xb,_fnFilter:wb,_fnFilterCreateSearch:Pa,_fnEscapeRegex:Qa,_fnFilterData:zb,_fnFeatureHtmlInfo:sb,_fnUpdateInfo:Cb,_fnInfoMacros:Db,_fnInitialise:ha,_fnInitComplete:ua,_fnLengthChange:Ra,_fnFeatureHtmlLength:ob,_fnFeatureHtmlPaginate:tb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:qb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:rb,_fnScrollDraw:la,_fnApplyToChildren:I,_fnCalculateColumnWidths:Fa,_fnThrottle:Oa,_fnConvertToWidth:Eb,_fnGetWidestNode:Fb,_fnGetMaxLenString:Gb,_fnStringToCss:v,
_fnSortFlatten:X,_fnSort:mb,_fnSortAria:Ib,_fnSortListener:Va,_fnSortAttachListener:Ma,_fnSortingClasses:wa,_fnSortData:Hb,_fnSaveState:xa,_fnLoadState:Jb,_fnSettingsFromNode:ya,_fnLog:K,_fnMap:F,_fnBindAction:Wa,_fnCallbackReg:z,_fnCallbackFire:r,_fnLengthOverflow:Sa,_fnRenderer:Na,_fnDataSource:y,_fnRowAttributes:La,_fnExtend:Xa,_fnCalculateEnd:function(){}});h.fn.dataTable=n;n.$=h;h.fn.dataTableSettings=n.settings;h.fn.dataTableExt=n.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};
h.each(n,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});

View File

@@ -1,5 +1,15 @@
jQuery(document).ready(function ($) {
$( document.body ).on( 'init_tooltips', function() {
$( '.woocommerce-help-tip' ).tipTip( {
'attribute': 'data-tip',
'fadeIn': 50,
'fadeOut': 50,
'delay': 200,
'defaultPosition': 'top'
} );
} ).trigger( 'init_tooltips' );
$('#tabs').each(function() {
var disabled = $( this ).data('disabled') || '';

View File

@@ -0,0 +1,14 @@
jQuery(document).ready(function($) {
$('#wiaas_order_central_table').DataTable({
"paging": false,
"info": false,
"filter": false,
"order": [[ 0, "desc" ]]
});
$('#wiaas_next_actions_table').DataTable({
"info": false,
"filter": false,
"order": [[ 0, "desc" ]]
});
} );

View File

@@ -0,0 +1,38 @@
jQuery(document).ready(function ($) {
$('.wiaas_delivery_step_nav').click(function (e) {
var action = $(this).data('step');
$('#wiaas_delivery_process_navigation_action').val(action);
});
$('#wiaas_delivery_process_add_note').click(function(e) {
if ( ! $( 'textarea#wiaas_add_order_note' ).val() ) {
return;
}
$( '#wiaas_delivery_process_order_notes' ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action: 'wiaas_add_order_note',
post_id: $( 'textarea#wiaas_add_order_note' ).data('order-id'),
note: $( 'textarea#wiaas_add_order_note' ).val(),
security: $( 'textarea#wiaas_add_order_note' ).data('nonce'),
};
$.post( ajaxurl, data, function( response ) {
$( '#delivery_process_order_notes_list' ).prepend( response );
$( '#wiaas_delivery_process_order_notes' ).unblock();
$( '#wiaas_add_order_note' ).val( '' );
});
return false;
});
});

View File

@@ -0,0 +1,150 @@
jQuery(document).ready(function ($) {
$("#wiaas-add-pricing").click(function (event) {
event.preventDefault();
var pay_type = $('#wiaas_pay_types').val();
if (! pay_type) {
return;
}
var set_index = $("#wiaas_package_pricing_rules").data('setindex') + 1;
$("#wiaas_package_pricing_rules").data('setindex', set_index);
var data = {
'pay_type': pay_type,
action: 'create_empty_pricing_rule'
};
$.post(ajaxurl, data, function (response) {
$('#wiaas_package_pricing_rules').append(response);
$(`#wiaas_pay_type_${pay_type}`).prop( 'disabled', true );
$('#wiaas_pay_types').val('0');
});
});
//Remove Pricing Type
$('#wiaas_package_pricing_rules').delegate('.delete_wiaas_pricing_rule', 'click', function (event) {
event.preventDefault();
if (confirm('Are you sure you would like to remove this pay type?')) {
var name = $(this).data('name');
$('#wiaas-pricing-rule-' + name).slideUp().remove();
// append new option to controls
$(`#wiaas_pay_type_${name}`).prop( 'disabled', false );
}
});
$('#wiaas_package_pricing_rules').delegate('.wiaas_minimal_services_price', 'change', function (event) {
event.preventDefault();
var minimal_services_price = parseFloat($(this).val()) || 0;
var principal_amount = 0;
var name = $(this).data('name');
var principal_amount_input = $(`#wiaas_principal_amount_${name}`).first();
if (principal_amount_input) {
principal_amount = parseFloat(principal_amount_input.val() / principal_amount_input.data('period')) || 0;
}
$(`#wiaas_minimal_recurrent_price_${name}`).text((minimal_services_price + principal_amount).toFixed(2));
var services_contract_period = $(this).data('period');
if (services_contract_period > 0) {
var final_services_price = minimal_services_price * services_contract_period;
$(`#wiaas_minimal_services_price_${name}_final`).text(final_services_price.toFixed(2));
}
});
$('#wiaas_package_pricing_rules').delegate('.wiaas_principal_amount', 'change', function (event) {
event.preventDefault();
var value = parseFloat($(this).val());
var period = parseFloat($(this).data('period'));
var interestRate = 0.58;
var principal_amount = wiaasCalculateFinancing(interestRate, period, value);
var minimal_services_price = 0;
var name = $(this).data('name');
var minimal_services_price_input = $(`#wiaas_minimal_services_price_${name}`).first();
if (minimal_services_price_input) {
minimal_services_price = parseFloat(minimal_services_price_input.val()) || 0;
}
$(`#wiaas_minimal_recurrent_price_${name}`).text((minimal_services_price + principal_amount).toFixed(0));
$(`#wiaas_minimal_recurrent_package_price_${name}`).text(principal_amount.toFixed(0));
});
$('#wiaas_package_pricing_editor').delegate('#wiaas_pricing_rules_commision', 'change', function(event) {
event.preventDefault();
var value = parseInt($(this).val());
$('#wiaas_pricing_rules_commission_details').text('Commercial lead: ' + (100 - value) + ' %');
});
$('#wiaas_package_pricing_editor').delegate('#wiaas_pricing_rules_max_cost_margin', 'change', function(event) {
event.preventDefault();
var value = parseFloat($(this).val());
var total = parseFloat($(this).data('total'));
if (value > 0 && value < total) {
$('#wiaas_pricing_rules_max_cost_margin_error').show();
} else {
$('#wiaas_pricing_rules_max_cost_margin_error').hide();
}
});
/**
* Copy of Excel's PMT function.
* Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js
*
* @param ratePerPeriod The interest rate for the loan.
* @param numberOfPayments The total number of payments for the loan in months.
* @param presentValue The present value, or the total amount that a series of future payments is worth now;
* Also known as the principal.
* @param futureValue The future value, or a cash balance you want to attain after the last payment is made.
* If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
* @param type Optional, defaults to 0. The number 0 (zero) or 1 and indicates when payments are due.
* 0 = At the end of period
* 1 = At the beginning of the period
* @returns {number}
*/
function wiaasCalculateFinancing(ratePerPeriod, numberOfPayments, presentValue, futureValue = 0, type = 0) {
/*var q = 0;
var c = 0;
const monthlyRatePerPeriod = ratePerPeriod / 12;
if (monthlyRatePerPeriod !== 0.0) {
// Interest rate exists
q = Math.pow(1 + monthlyRatePerPeriod, numberOfPayments);
c = (monthlyRatePerPeriod * (futureValue + (q * presentValue))) / ((-1 + q) * (1 + monthlyRatePerPeriod * (type)));
return c.toFixed(2);
} else if (numberOfPayments !== 0.0) {
// No interest rate, but number of payments exists
return -(futureValue + presentValue) / numberOfPayments;
}
return 0;*/
const rates = {
24 : 4.282,
30 : 3.451,
36 : 2.896,
42 : 2.500,
48 : 2.223,
54 : 2.025,
60 : 1.834
};
const interest = rates[numberOfPayments] || 10;
return presentValue * (interest / 100);
}
});

View File

@@ -0,0 +1,57 @@
jQuery(document).ready(function($) {
if ($('#product-type').val() === 'simple') {
$('#general_product_data').find('.pricing').show();
} else {
$('#general_product_data').find('.pricing').hide();
}
$('#general_product_data').find('.pricing').addClass('hide_if_wiaastemplate hide_if_bundle');
$('#general_product_data').find('.pricing').removeClass('show_if_bundle show_if_wiaastemplate');
$( '.wiaas-search-documents' ).each(function() {
var element = $( this );
var searchTarget = $('#' + element.data('target'));
element.autocomplete({
source: function(request, response) {
$.get( window.ajaxurl, {
action: 'wiaas_json_search_documents',
query: request.term,
_ajax_nonce: element.data('search-nonce')
} ).done( function( documents ) {
response( documents || []);
}
);
},
select: function(event, ui) {
if (!searchTarget || $('#wiaas_attached_document_' + ui.item.id).length) {
return;
}
$.get(window.ajaxurl, {
action: 'wiaas_link_document',
_ajax_nonce: element.data('link-nonce'),
id: ui.item.id
}).done( function (document) {
searchTarget.find('tbody').append(document);
});
}
})
.autocomplete( 'instance' )._renderItem = function( ul, item ) {
return $( '<li role="option" id="wiaas-document-autocomplete-' + item.id + '">' )
.text( item.name )
.appendTo( ul );
};
});
$('#wiaas_attached_documents').delegate('.wiaas-remove-attached-document', 'click', function (e) {
e.preventDefault();
var id = $(this).data('id');
$('#wiaas_attached_document_' + id).remove();
});
});

View File

@@ -0,0 +1,32 @@
/*global inlineEditPost, woocommerce_admin, woocommerce_quick_edit */
jQuery(function( $ ) {
$('#the-list').on('click', '.editinline', function(){
/**
* Extract metadata and put it as the value for the custom field form
*/
inlineEditPost.revert();
var post_id = jQuery(this).closest('tr').attr('id');
post_id = post_id.replace("post-", "");
var $cfd_inline_data = jQuery('#package_additional_fields_inline_' + post_id),
$wc_inline_data = jQuery('#woocommerce_inline_' + post_id );
jQuery('textarea[name="_package_pricing"]', '.inline-edit-row').val($cfd_inline_data.find("#_package_prices").text());
/**
* Only show custom field for appropriate types of products (simple)
*/
var product_type = $wc_inline_data.find('.product_type').text();
if (product_type==='bundle') {
jQuery('#wiaas_pricing_quick_edit', '.inline-edit-row').show();
} else {
jQuery('#wiaas_pricing_quick_edit', '.inline-edit-row').hide();
}
});
});

View File

@@ -0,0 +1,7 @@
jQuery(document).ready(function($) {
$( document.body )
.on( 'wc_backbone_modal_loaded', function () {
$(".wc-order-preview-address").remove();
} );
});

View File

@@ -0,0 +1,14 @@
jQuery(document).bind('gform_load_field_settings', function (event, field, form) {
var isBundleDoc = field.type === 'wiaas_order_bundle_document';
var isOrderDoc = field.type === 'wiaas_order_document';
if (isBundleDoc || isOrderDoc) {
jQuery('#wiaas-doc-type-filter').val(field.wiaasDocTypeFilter);
}
jQuery('#wiaas-installation-organization-filter').prop('checked', !!field.wiaasOnlyInstallationOrg);
});

View File

@@ -0,0 +1,79 @@
<?php
/**
* Class Wiaas_Admin_CL_Customers
*/
class Wiaas_Admin_CL_Customers {
/**
* Displays table list of customers that are linked to commercial lead
*
* Enables commercial lead to update default order type for his shop
*
* Enables commercial lead to update order type for specific shop customer
*
*/
public static function init() {
add_action( 'admin_menu', array( __CLASS__, 'add_customers_page' ), 9 );
}
/**
* Add customer menu page for commercial lead
*/
public static function add_customers_page() {
add_menu_page(
__( 'Customers', 'wiaas' ),
__( 'Customers', 'wiaas' ),
'manage_wiaas_cl_customers',
'wiaas-cl-customers',
array(__CLASS__, 'output_customers'),
'dashicons-groups',
'66.0' );
}
/**
* Render content for customer menu page
*/
public static function output_customers() {
$organization_id = wiaas_get_current_user_organization_id();
// handle default order type update if needed
if (! empty($_POST['wiaas_update_cl_default_order_type_nonce']) &&
! empty($_POST['default_order_type']) &&
wp_verify_nonce(
$_POST['wiaas_update_cl_default_order_type_nonce'],
'wiaas_update_cl_default_order_type')
) {
$default_order_type = sanitize_key($_POST['default_order_type']);
Wiaas_Shop::update_default_order_type($organization_id, $default_order_type);
}
// handle customer order type update if needed
if (! empty($_POST['wiaas_update_cl_customer_order_type_nonce']) &&
! empty($_POST['customer_order_type']) &&
wp_verify_nonce(
$_POST['wiaas_update_cl_customer_order_type_nonce'],
'wiaas_update_cl_customer_order_type')
) {
$customer_id = absint($_POST['customer_order_type']['customer_id']);
$order_type = sanitize_key($_POST['customer_order_type']['order_type']);
Wiaas_Shop::update_shop_customer_order_type(
$organization_id,
$customer_id,
$order_type);
}
$customers = Wiaas_Shop::get_shop_customers($organization_id);
require 'views/html-admin-cl-customers-page.php';
}
}
Wiaas_Admin_CL_Customers::init();

View File

@@ -0,0 +1,133 @@
<?php
/**
* Class Wiaas_Admin_CL_Orders
*/
class Wiaas_Admin_CL_Orders {
/**
* Displays list of orders from commercial lead owned shop
*
* Enables quick preview of each order
*
* This list of orders is achieved with customization of default order list for `shop_order` post
* by using hooks and filters to allow only data that commercial lead should be able to see
*
*/
public static function init() {
add_filter( 'bulk_actions-edit-shop_order', array( __CLASS__, 'remove_bulk_actions_for_list_table_orders' ), 999 );
add_filter('woocommerce_admin_order_preview_actions', array(__CLASS__, 'remove_actions_from_order_preview'));
add_filter('woocommerce_admin_order_preview_line_items', array(__CLASS__, 'filter_order_items_for_order_preview'), 10, 2);
add_filter('manage_shop_order_posts_columns', array(__CLASS__, 'columns_for_list_table_orders'), 999);
add_filter( 'manage_edit-shop_order_sortable_columns', array( __CLASS__, 'define_sortable_columns_for_list_table_orders' ) );
add_action('manage_shop_order_posts_custom_column', array(__CLASS__, 'render_columns_for_list_table_orders'), 999, 2);
}
/**
* Remove all bulk actions for commercial lead
*
* @return array
*/
public static function remove_bulk_actions_for_list_table_orders() {
return array();
}
/**
* Remove actions from shop order preview modal so only data info is visible
*
* @return array
*/
public static function remove_actions_from_order_preview() {
return array();
}
/**
* Show only packages on order preview
*
* @param $order_items
* @param $order
*
* @return array
*/
public static function filter_order_items_for_order_preview($order_items, $order) {
$items = array();
foreach ($order_items as $order_item) {
if (isset($order_item['wiaas_standard_package'])) {
$items[] = $order_item;
}
}
return $items;
}
/**
* Override default table columns so only commercial lead specific columns are visible
*
* @param $columns
*
* @return array
*/
public static function columns_for_list_table_orders($columns) {
$show_columns = array();
$show_columns['cb'] = $columns['cb'];
$show_columns['_wiaas_order_number'] = __( 'Order', 'wiaas' );
$show_columns['order_date'] = $columns['order_date'];
$show_columns['wiaas_reference'] = __( 'Location', 'wiaas' );
$show_columns['wiaas_customer'] = __( 'Customer', 'wiaas' );
$show_columns['order_status'] = $columns['order_status'];
$show_columns['billing_address'] = $columns['billing_address'];
$show_columns['shipping_address'] = $columns['shipping_address'];
$show_columns['order_total'] = $columns['order_total'];
return $show_columns;
}
/** Append commercial lead columns to table sortable columns
*
* @param $sortable_columns
*
* @return mixed
*/
public static function define_sortable_columns_for_list_table_orders($sortable_columns) {
$sortable_columns['_wiaas_order_number'] = 'ID';
return $sortable_columns;
}
/**
* Render commercial lead specific columns
*
* @param $column
* @param $order_id
*/
public static function render_columns_for_list_table_orders($column, $order_id) {
if ($column === '_wiaas_order_number') {
$order = wc_get_order($order_id);
$order_url = $entry_url = admin_url('admin.php?page=wiaas-order-delivery&id=' . $order->get_id());
if ( $order->get_status() !== 'trash' ) {
echo '<strong><a href="' . esc_url($order_url) . '">#' . esc_attr( $order->get_order_number() ) . '</a></strong>';
echo '<a href="#" class="order-preview" data-order-id="' . absint( $order->get_id() ) . '" title="' . esc_attr( __( 'Preview', 'wiaas' ) ) . '">' . esc_html( __( 'Preview', 'wiaas' ) ) . '</a>';
} else {
echo '<strong>#' . esc_attr( $order->get_order_number() ) . '</strong>';
}
}
}
}
Wiaas_Admin_CL_Orders::init();

View File

@@ -40,6 +40,7 @@ class Wiaas_Admin_CL_Packages {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_style( 'wiaas_admin_menu', $plugin_url . '/assets/css/menu.css' );
}
public static function add_cl_packages_menu() {
@@ -60,8 +61,6 @@ class Wiaas_Admin_CL_Packages {
if ($screen->id === 'admin_page_wiaas-cl-product') {
error_log('set parent');
$parent_file = 'edit.php?post_type=product';
}
}
@@ -150,6 +149,7 @@ class Wiaas_Admin_CL_Packages {
$cl_columns['thumb'] = $columns['thumb'];
$cl_columns['wiaas_cl_name'] = $columns['name'];
$cl_columns['taxonomy-product_tag'] = __( 'Reference', 'wiaas' );
$cl_columns['taxonomy-package_type'] = __('Type', 'wiaas');
$cl_columns['taxonomy-package_status'] = __('Status', 'wiaas');
$cl_columns['taxonomy-product_country'] = $columns['taxonomy-product_country'];

View File

@@ -0,0 +1,126 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
select {
width: 300px;
max-width: 100%;
}
</style>
<div class="wrap">
<h1><?php esc_html_e( 'Customers', 'wiaas' ); ?> </h1>
<br class="clear" />
<div id="col-container">
<div id="col-right">
<div class="col-wrap">
<table class="widefat wp-list-table striped" style="width:100%">
<thead>
<tr>
<th scope="col"><?php esc_html_e( 'Name', 'wiaas' ); ?></th>
<th scope="col"><?php esc_html_e( 'Order type', 'wiaas' ); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($customers as $customer) {
$name = wiaas_get_organization_name($customer['customer_id']);
?>
<tr>
<td>
<h2><?php esc_html_e($name, 'wiaas') ?></h2>
</td>
<td>
<?php
esc_html_e(
$customer['order_type']=== 'commercial_lead' ? 'Commercial Lead' : 'Reseller',
'wiaas'
)
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div id="col-left">
<div class="col-wrap">
<div class="inside">
<div class="form-wrap">
<h2><?php esc_html_e('Default order type:', 'wiaas') ?></h2>
<form class="form" action="" method="post">
<input type="hidden" name="page" value="wiaas-cl-customers"/>
<div class="form-field">
<select class="form-control" name="default_order_type">
<option
value="commercial_lead"
<?php selected('commercial_lead', Wiaas_Shop::get_default_order_type($organization_id), true) ?>
>
<?php esc_html_e('Commercial Lead', 'wiaas') ?>
</option>
<option
value="reseller"
<?php selected('reseller', Wiaas_Shop::get_default_order_type($organization_id), true) ?>
>
<?php esc_html_e('Reseller', 'wiaas') ?>
</option>
</select>
</div>
<input class="button button-primary button-large" type="submit" value="Change"/>
<?php wp_nonce_field( 'wiaas_update_cl_default_order_type', 'wiaas_update_cl_default_order_type_nonce' ); ?>
</form>
</div>
<hr style="margin: 30px 0;" />
<div class="form-wrap">
<h2><?php esc_html_e('Update order type for customer', 'wiaas') ?></h2>
<form class="form" action="" method="post">
<div class="form-field">
<label><?php esc_html_e('Customer:', 'wiaas') ?> </label>
<select class="form-control" name="customer_order_type[customer_id]">
<?php
foreach ($customers as $customer) {
$name = wiaas_get_organization_name($customer['customer_id']);
?>
<option
value="<?php esc_html_e($customer['customer_id'], 'wiaas') ?>"
>
<?php esc_html_e($name, 'wiaas') ?>
</option>
<?php
}
?>
</select>
</div>
<div class="form-field">
<label><?php esc_html_e('Order type:', 'wiaas') ?> </label>
<select class="form-control" name="customer_order_type[order_type]">
<option value="commercial_lead">
<?php esc_html_e('Commercial Lead', 'wiaas') ?>
</option>
<option value="reseller">
<?php esc_html_e('Reseller', 'wiaas') ?>
</option>
</select>
</div>
<input class="button button-large" type="submit" value="Update"/>
<?php wp_nonce_field( 'wiaas_update_cl_customer_order_type', 'wiaas_update_cl_customer_order_type_nonce' ); ?>
</form>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -149,25 +149,6 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="inside">
<div class="panel-wrap">
<div class="panel">
<div class="wrap">
<div>
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
<strong><?php esc_html_e('EPR', 'wiaas') ?></strong>
<span><?php esc_html_e('= Extra package recurrent commission', 'wiaas') ?></span>
</div>
<div>
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
<strong><?php esc_html_e('ESR') ?></strong>
<span><?php esc_html_e('= Extra services and support recurrent commission', 'wiaas') ?></span>
</div>
<div>
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
<strong><?php esc_html_e('Extra commission', 'wiaas') ?></strong>
<span><?php esc_html_e('= EPR + ESR', 'wiaas') ?></span>
</div>
</div>
<div id="tabs" data-disabled="<?php echo $has_default_cl_extras ? '' : '1' ; ?>">
<ul id="tabs-navigation">
<li><a href="#tabs-1"><?php esc_html_e('Default prices', 'wiaas') ?></a> | </li>

View File

@@ -20,7 +20,13 @@ $id = isset($customer_id) ? 'extras_customer_'.$customer_id : 'extras_default';
?>
</td>
<td><?php esc_html_e('Minimal sell price', 'wiaas') ?></td>
<td><?php esc_html_e('Extra commision', 'wiaas') ?></td>
<td><?php esc_html_e('Margin', 'wiaas') ?></td>
<td><?php esc_html_e('Margin services', 'wiaas') ?>
<?php echo wc_help_tip( __( 'Extra services and support recurrent commission', 'wiaas' ) );?>
</td>
<td><?php esc_html_e('Margin recurrent', 'wiaas') ?>
<?php echo wc_help_tip( __( 'Extra package recurrent commission', 'wiaas' ) );?>
</td>
<td><?php esc_html_e('Default price', 'wiaas') ?></td>
<td><?php esc_html_e('Visible?', 'wiaas') ?>
<?php
@@ -81,48 +87,81 @@ $id = isset($customer_id) ? 'extras_customer_'.$customer_id : 'extras_default';
</div>
</td>
<td class="form-group">
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
data-target="wiaas_cl_fixed_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="fixed"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][fixed]"
value="<?php esc_attr_e($cl_extras[$extra_type]['fixed'], 'wiaas') ?>"
type="text"
>
</div>
<?php
if($configured_price['package_pay_period'] > 0) {
?>
<div class="form-control">
<label>+</label>
<input
<td class="form-group">
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
data-target="wiaas_cl_recurrent_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="recurrent"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][recurrent]"
value="<?php esc_attr_e($cl_extras[$extra_type]['recurrent'], 'wiaas') ?>"
type="text"
>
<label><?php esc_html_e('(EPR)', 'wiaas') ?></label>
</div>
<?php
}
?>
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
data-target="wiaas_cl_monthly_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="services"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][services]"
value="<?php esc_attr_e($cl_extras[$extra_type]['services'], 'wiaas') ?>"
type="text"
>
<label><?php esc_html_e('(ESR)', 'wiaas') ?></label>
</div>
data-target="wiaas_cl_fixed_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="fixed"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][fixed]"
value="<?php esc_attr_e($cl_extras[$extra_type]['fixed'], 'wiaas') ?>"
type="text"
>
</div>
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
type="text"
readonly
value="0"
>
</div>
</td>
<td class="form-group">
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
type="text"
readonly
value="0"
>
</div>
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
data-target="wiaas_cl_monthly_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="services"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][services]"
value="<?php esc_attr_e($cl_extras[$extra_type]['services'], 'wiaas') ?>"
type="text"
>
</div>
</td>
<td class="form-group">
<?php
if($configured_price['package_pay_period'] > 0) {
?>
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
type="text"
readonly
value="0"
>
</div>
<div class="form-control">
<label>+</label>
<input
class="wiaas-cl-extra-input"
data-target="wiaas_cl_recurrent_extra_<?php esc_attr_e($extra_type, 'wiaas') ?>"
data-type="recurrent"
name="cl_extras[<?php esc_attr_e($extra_type, 'wiaas')?>][recurrent]"
value="<?php esc_attr_e($cl_extras[$extra_type]['recurrent'], 'wiaas') ?>"
type="text"
>
</div>
<?php
}
?>
</td>
<td>
<div> =

View File

@@ -0,0 +1,171 @@
<?php
/**
* Class Wiaas_Admin_Supplier_Orders
*/
class Wiaas_Admin_Supplier_Orders {
/**
* Displays list of orders from supplier
*
* Enables quick preview of each order
*
* This list of orders is achieved with customization of default order list for `shop_order` post
* by using hooks and filters to allow only data that suppliershould be able to see
*
*/
public static function init() {
add_filter('bulk_actions-edit-shop_order', array(__CLASS__, 'remove_bulk_actions_for_list_table_orders'), 999);
add_filter('woocommerce_admin_order_preview_actions', array(__CLASS__, 'remove_actions_from_order_preview'));
add_filter('woocommerce_admin_order_preview_line_items', array(__CLASS__, 'filter_order_items_for_order_preview'), 999, 2);
add_filter( 'woocommerce_admin_order_preview_line_item_columns', array(__CLASS__, 'customize_order_preview_columns'), 999);
add_filter( 'woocommerce_admin_order_preview_line_item_column_wiaas_simple_product_bundle', array(__CLASS__, 'render_bundled_item_bundle'), 10, 4);
add_filter('manage_shop_order_posts_columns', array(__CLASS__, 'columns_for_list_table_orders'), 999);
add_filter('manage_edit-shop_order_sortable_columns', array(__CLASS__, 'define_sortable_columns_for_list_table_orders'), 999);
add_action('manage_shop_order_posts_custom_column', array(__CLASS__, 'render_columns_for_list_table_orders'), 999, 2);
}
/**
* Remove all bulk actions for supplier
*
* @return array
*/
public static function remove_bulk_actions_for_list_table_orders() {
return array();
}
/**
* Remove actions from shop order preview modal so only data info is visible
*
* @return array
*/
public static function remove_actions_from_order_preview() {
return array();
}
/**
* Show only simple products from this supplier on order preview
*
* @param $order_items
* @param WC_Order $order
*
* @return array
*/
public static function filter_order_items_for_order_preview($order_items, $order) {
$user_organisation_id = Wiaas_User_Organization::get_user_organization_id(wp_get_current_user()->ID);
$order_items = $order->get_items();
$items = array();
foreach ($order_items as $key => $order_item) {
if (wc_pb_is_bundled_order_item($order_item)) {
$item_supplier_organization_id = absint($order_item['wiaas_supplier_organization_id']);
if ($item_supplier_organization_id === $user_organisation_id) {
$items[] = $order_item;
}
}
}
return $items;
}
public static function customize_order_preview_columns() {
return array(
'product' => __('Product', 'wiaas'),
'quantity' => __( 'Quantity', 'wiaas' ),
'wiaas_simple_product_bundle' => __( '', 'wiaas' )
);
}
public static function render_bundled_item_bundle($empty, $item, $item_id, $order) {
$html = '';
if (wc_pb_is_bundled_order_item($item) ) {
$container_order_item = wc_pb_get_bundled_order_item_container($item, $order);
if ( ! empty($container_order_item) ) {
return $container_order_item->get_name();
}
}
return $html;
}
/**
* Override default table columns so only supplier specific columns are visible
*
* @param $columns
*
* @return array
*/
public static function columns_for_list_table_orders($columns) {
$show_columns = array();
$show_columns['cb'] = $columns['cb'];
$show_columns['_wiaas_order_number'] = __( 'Order', 'wiaas' );
$show_columns['order_date'] = $columns['order_date'];
$show_columns['wiaas_reference'] = __( 'Location', 'wiaas' );
$show_columns['wiaas_customer'] = __( 'Customer', 'wiaas' );
$show_columns['order_status'] = $columns['order_status'];
$show_columns['shipping_address'] = $columns['shipping_address'];
return $show_columns;
}
/** Append supplier columns to table sortable columns
*
* @param $sortable_columns
*
* @return mixed
*/
public static function define_sortable_columns_for_list_table_orders($sortable_columns) {
$sortable_columns['_wiaas_order_number'] = 'ID';
return $sortable_columns;
}
/**
* Render supplier specific columns
*
* @param $column
* @param $order_id
*/
public static function render_columns_for_list_table_orders($column, $order_id) {
if ($column === '_wiaas_order_number') {
$order = wc_get_order($order_id);
$order_url = $entry_url = admin_url('admin.php?page=wiaas-order-delivery&id=' . $order->get_id());
if ( $order->get_status() !== 'trash' ) {
echo '<strong><a href="' . esc_url($order_url) . '">#' . esc_attr( $order->get_order_number() ) . '</a></strong>';
echo '<a href="#" class="order-preview" data-order-id="' . absint( $order->get_id() ) . '" title="' . esc_attr( __( 'Preview', 'wiaas' ) ) . '">' . esc_html( __( 'Preview', 'wiaas' ) ) . '</a>';
} else {
echo '<strong>#' . esc_attr( $order->get_order_number() ) . '</strong>';
}
}
}
}
Wiaas_Admin_Supplier_Orders::init();

View File

@@ -13,14 +13,19 @@ class Wiaas_Admin_CL {
public static function init_admin_cl() {
$user = wp_get_current_user();
$current_user = wp_get_current_user();
$role = $user->roles[0];
$role = $current_user->roles[0];
if ($role === 'commercial_lead') {
$is_cl = $role === 'commercial_lead';
if ($is_cl) {
require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-packages.php';
require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-customers.php';
require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-orders.php';
require_once dirname( __FILE__ ) . '/admin-cl/wiaas-admin-cl-packages-ajax.php';
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
@@ -32,6 +37,7 @@ class Wiaas_Admin_CL {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_script( 'wiaas_admin_cl_packages', $plugin_url . '/assets/js/wiaas-admin-cl-packages.js' );
wp_enqueue_script('jquery-tiptip');
wp_enqueue_style( 'wiaas_admin_cl', $plugin_url . '/assets/css/wiaas-admin-cl.css' );
}

View File

@@ -0,0 +1,71 @@
<?php
class Wiaas_Admin_Countries {
public static function init() {
// Add countries fields to countries list
add_filter( 'manage_edit-product_country_columns', array( __CLASS__, 'update_list_headers' ) );
add_filter( 'manage_product_country_custom_column', array( __CLASS__, 'update_list_column_content' ), 10, 3 );
// Validate country settings
add_filter('acf/load_field/name=_wiaas_country_code', array(__CLASS__, 'populate_country_codes'));
add_filter('acf/load_field/name=_wiaas_country_currency', array(__CLASS__, 'populate_country_currencies'));
}
public static function update_list_headers($columns) {
$columns['wiaas_code'] = __( 'Code', 'wiaas' );
$columns['wiaas_vat'] = __('VAT', 'wiaas');
$columns['wiaas_currency'] = __('Currency', 'wiaas');
return $columns;
}
public static function update_list_column_content($columns, $column, $id) {
if ($column === 'wiaas_code') {
$code = get_term_meta($id, '_wiaas_country_code', true);
$columns .= '<span>'. $code . '</span>';
}
if ($column === 'wiaas_vat') {
$vat = get_term_meta($id, '_wiaas_country_vat', true);
$columns .= '<span>'. $vat . '</span>';
}
if ($column === 'wiaas_currency') {
$currency = get_term_meta($id, '_wiaas_country_currency', true);
$columns .= '<span>'. $currency . '</span>';
}
return $columns;
}
public static function populate_country_codes($field) {
$countries_list = Wiaas_Countries::get_country_choices();
$countries_choices = array();
foreach ($countries_list as $code => $name) {
$countries_choices[$code] = $code . ' - ' . $name;
}
$field['choices'] = $countries_choices;
return $field;
}
public static function populate_country_currencies($field) {
$field['choices'] = Wiaas_Countries::get_currency_choices();
return $field;
}
}
Wiaas_Admin_Countries::init();

View File

@@ -0,0 +1,172 @@
<?php
class Wiaas_Admin_Dashboard {
public static function init() {
add_action( 'wp_dashboard_setup', array( __CLASS__, 'setup_dashboard' ) );
}
public static function setup_dashboard() {
wp_add_dashboard_widget( 'wiaas_orders', __( 'Order Central', 'wiaas' ), array( __CLASS__, 'orders_widget' ) );
wp_add_dashboard_widget( 'wiaas_next_actions', __( 'Next Actions', 'wiaas' ), array( __CLASS__, 'next_actions_widget' ) );
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
}
public static function enqueue_scripts() {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_style( 'wiaas_admin_dashboard', $plugin_url . '/assets/css/wiaas-admin-dashboard.css' );
wp_enqueue_script( 'wiaas_admin_dashboard', $plugin_url . '/assets/js/wiaas-admin-dashboard.js' );
}
public static function orders_widget() {
$orders = wc_get_orders(array(
'limit' => 5,
'status' => array('open', 'processing')
));
if (empty($orders)) {
?>
<div class="wiaas-dashboard-table-empty">
<p>
<?php esc_html_e( 'No new orders', 'wiaas' ); ?>
</p>
</div>
<?php
return;
}
?>
<table id="wiaas_order_central_table" class="wiaas-dashboard-table wiaas-orders-table">
<thead>
<tr>
<th><?php esc_html_e( 'Order', 'wiaas' ); ?></th>
<th><?php esc_html_e( 'Status', 'wiaas' ); ?></th>
<th><?php esc_html_e( 'Total', 'wiaas' ); ?></th>
</tr>
</thead>
<tbody id="wiaas-orders-tbody">
<?php
foreach ($orders as $order) {
// format date
$order_timestamp = $order->get_date_created() ? $order->get_date_created()->getTimestamp() : '';
$show_date = '&ndash;';
if ( $order_timestamp ) {
if ( $order_timestamp > strtotime( '-1 day', current_time( 'timestamp', true ) ) && $order_timestamp <= current_time( 'timestamp', true ) ) {
$show_date = sprintf(
/* translators: %s: human-readable time difference */
_x( '%s ago', '%s = human-readable time difference', 'wiaas' ),
human_time_diff( $order->get_date_created()->getTimestamp(), current_time( 'timestamp', true ) )
);
} else {
$show_date = $order->get_date_created()->date_i18n( __( 'M j, Y', 'wiaas' ) );
}
}
?>
<tr>
<td>
<strong>
<?php
if (current_user_can('edit_others_shop_orders')) {
$order_edit_url = admin_url( 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' );
} else {
$order_edit_url = admin_url('admin.php?page=wiaas-order-delivery&id=' . absint( $order->get_id() ) );
}
echo '<a href="'. $order_edit_url . '">#' .
esc_html($order->get_order_number()) .
'</a>';
?>
</strong>
<br>
<time
class="wiaas-order-date"
datetime="<?php esc_attr_e( $order->get_date_created()->date( 'c' ), 'wiaas' ) ?>"
title="<?php esc_html_e( $order->get_date_created()->date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ), 'wiaas' ) ?>"
>
<?php esc_html_e($show_date, 'wiaas') ?>
</time>
</td>
<td>
<mark class="wiaas-order-status <?php esc_attr_e( sanitize_html_class( 'wiaas-order-status-' . $order->get_status() ), 'wiaas' ) ?>">
<span>
<?php esc_html_e( wc_get_order_status_name( $order->get_status() ) ) ?>
</span>
</mark>
</td>
<td><?php echo $order->get_formatted_order_total() ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
public static function next_actions_widget() {
$next_actions = Wiaas_Delivery_Process::get_next_actions_for_current_user();
if (empty($next_actions)) {
?>
<div class="wiaas-dashboard-table-empty">
<p>
<?php esc_html_e( 'No pending actions', 'wiaas' ); ?>
</p>
</div>
<?php
return;
}
?>
<table id="wiaas_next_actions_table" class="wiaas-dashboard-table">
<thead>
<tr>
<th><?php esc_html_e( 'Order', 'wiaas' ); ?></th>
<th><?php esc_html_e( 'Action', 'wiaas' ); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($next_actions as $action) {
?>
<tr>
<td>
<a href="<?php echo esc_url(admin_url('admin.php?page=wiaas-order-delivery&id=' . absint( $action['order_id'] ) )) ?>">
<strong>#<?php esc_html_e($action['order_number'], 'wiaas')?></strong>
</a>
</td>
<td>
<a href="<?php echo $action['url'] ?>">
<?php esc_html_e($action['action_title'], 'wiaas')?>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
}
Wiaas_Admin_Dashboard::init();

View File

@@ -0,0 +1,25 @@
<?php
class Wiaas_Admin_Delivery_Process {
public static function init() {
require_once dirname( __FILE__ ) . '/delivery-process/wiaas-admin-delivery-process-ajax.php';
require_once dirname( __FILE__ ) . '/delivery-process/class-wiaas-admin-delivery-process-flow.php';
require_once dirname( __FILE__ ) . '/delivery-process/class-wiaas-admin-delivery-process-order.php';
require_once dirname( __FILE__ ) . '/delivery-process/class-wiaas-admin-delivery-process-list.php';
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
}
public static function enqueue_scripts() {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_script( 'wiaas_admin_delivery_process', $plugin_url . '/assets/js/wiaas-admin-delivery-process.js', array( 'jquery-blockui' ) );
wp_enqueue_style( 'wiaas_admin_delivery_process', $plugin_url . '/assets/css/wiaas-admin-delivery-process.css' );
}
}
Wiaas_Admin_Delivery_Process::init();

View File

@@ -3,10 +3,6 @@
class Wiaas_Admin_Order_Projects {
public static function init() {
// Add admin page and subpage since woocommerce orders have custom menu page
// so this will not be automatic
add_filter('admin_menu', array(__CLASS__, 'add_admin_page'));
add_action( 'parent_file', array(__CLASS__, 'highlight_order_projects_parent_menu') );
// Add is available fields to create and edit forms
add_action( 'shop_order_project_add_form_fields', array( __CLASS__, 'add_is_available_field' ) );
@@ -19,31 +15,20 @@ class Wiaas_Admin_Order_Projects {
// Save is available field when creating and editing
add_action( 'created_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
add_action( 'edit_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
add_action( 'load-term.php', array( __CLASS__, 'admin_menu_highlight' ) );
add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_menu_highlight' ) );
}
/**
* Add admin submenu page for order projects
* Highlighting orders menu when shop orders page selected
*/
public static function add_admin_page() {
add_submenu_page( 'woocommerce',
esc_html__( 'Order projects', 'wiaas' ),
esc_html__( 'Order projects', 'wiaas' ),
'manage_woocommerce',
'edit-tags.php?taxonomy=shop_order_project'
);
}
public static function admin_menu_highlight() {
global $plugin_page;
/**
* Correctly highlight parent menu page when order projects submenu is selected
* @param $parent_file
*
* @return string
*/
public static function highlight_order_projects_parent_menu($parent_file) {
if ( get_current_screen()->taxonomy == 'shop_order_project' ) {
$parent_file = 'woocommerce';
if ( isset( $_GET['taxonomy'] ) && ( $_GET['taxonomy'] === 'shop_order_project' ) ) {
$plugin_page = 'edit.php?post_type=shop_order';
}
return $parent_file;
}
/**

View File

@@ -0,0 +1,314 @@
<?php
class Wiaas_Admin_Orders {
public static function init() {
// Orders list customization
add_filter( 'manage_shop_order_posts_columns', array(__CLASS__, 'add_additional_columns_to_orders_list'), 11 );
add_action( 'manage_shop_order_posts_custom_column', array(__CLASS__, 'render_orders_list_additional_columns') );
add_filter('default_hidden_columns', array(__CLASS__, 'filter_orders_list_default_hidden_columns'), 11, 2);
// Order preview customization
add_filter( 'woocommerce_admin_order_preview_get_order_details', array(__CLASS__, 'add_custom_data_to_order_preview') );
add_filter( 'woocommerce_admin_order_preview_start', array(__CLASS__, 'show_custom_data_before_order_preview') );
add_filter( 'woocommerce_admin_order_preview_line_items', array(__CLASS__, 'remove_simple_items_from_preview'));
add_filter( 'woocommerce_admin_order_preview_line_item_columns', array(__CLASS__, 'order_preview_order_item_columns'));
add_filter( 'woocommerce_admin_order_preview_line_item_column_wiaas_order_item_price', array(__CLASS__, 'render_order_item_preview_price_column'), 10, 4);
// Order item metadata customization
add_action('woocommerce_before_order_itemmeta', array(__CLASS__, 'render_order_details_order_item_custom_info'), 10, 3);
add_filter('woocommerce_order_item_get_formatted_meta_data', array(__CLASS__, 'filter_order_item_formatted_meta_data'), 10, 2);
add_filter('woocommerce_order_item_display_meta_key', array(__CLASS__, 'order_item_display_meta_key'), 10, 3);
add_filter('woocommerce_order_item_display_meta_value', array(__CLASS__, 'order_item_display_meta_value'), 10, 3);
}
/**
* Add columns to orders list with wiaas specific informations
* @param array $columns
*
* @return array
*/
public static function add_additional_columns_to_orders_list( $columns ) {
$new_columns = array();
$new_columns['wiaas_reference'] = __('Location', 'wiaas');
$new_columns['wiaas_commercial_lead'] = __('Commercial lead', 'wiaas');
$new_columns['wiaas_customer'] = __('Customer', 'wiaas');
$new_columns['taxonomy-shop_order_project'] = __('Project', 'wiaas');
$columns = array_merge(
array_slice($columns,0,3),
$new_columns,
array_slice($columns,3)
);
return $columns;
}
/**
* Display data for custom wiaas columns in orders list
*
* @param string $column
*/
public static function render_orders_list_additional_columns( $column ) {
global $post;
$column_content = '';
switch ($column){
case 'wiaas_reference':
$column_content = Wiaas_Order::get_order_reference($post->ID);
break;
case 'wiaas_commercial_lead':
$column_content = Wiaas_Order::get_order_commercial_lead_name($post->ID);
break;
case 'wiaas_customer':
$column_content = Wiaas_Order::get_order_customer_full_name($post->ID);
$customer_organization_info = Wiaas_Order::get_customer_organization_info($post->ID);
if ( ! empty($customer_organization_info) ) {
$column_content .= '<br>';
$column_content .= '<small>' . $customer_organization_info['name'] . '</small>';
}
break;
}
echo $column_content;
}
/**
* Filter default hidden columns for orders list
*
* @param array $hidden
* @param object $screen
*
* @return array
*/
public static function filter_orders_list_default_hidden_columns($hidden, $screen) {
if (isset($screen->id) && $screen->id === 'edit-shop_order') {
$hidden = array( 'wc_actions' );
}
return $hidden;
}
/**
* Add custom information to order preview data
*
* @param array $order
*
* @return array
*/
public static function add_custom_data_to_order_preview ($order) {
$order['wiaas_commercial_lead_name'] = Wiaas_Order::get_order_commercial_lead_name( $order['data']['id'] );
$order['needs_shipping'] = true;
return $order;
}
/**
* Display custom information in order preview
*
*/
public static function show_custom_data_before_order_preview () {
echo '<div class="wc-order-preview-addresses">
<div class="wc-order-preview-address">
<h3>Commercial lead</h3>
<strong>{{data.wiaas_commercial_lead_name}}</strong>
</div>
</div>';
}
/**
* Display only bundles (not simple products)
*
* This will also not display options and addons
*
* @param array $order_items
*
* @return array
*/
public static function remove_simple_items_from_preview( $order_items){
$items = array();
foreach ($order_items as $order_item) {
if ( Wiaas_Order_Item::is_standard_bundle($order_item) ) {
$items[] = $order_item;
}
}
return $items;
}
/**
* Columns for order preview order items table
*
* @return array
*/
public static function order_preview_order_item_columns( ) {
return array(
'product' => __('Product', 'wiaas'),
'quantity' => __( 'Quantity', 'wiaas' ),
'wiaas_order_item_price' => __( 'Price', 'wiaas' )
);
}
/**
* @param $empty
* @param WC_Order_Item $item
* @param int $item_id
* @param WC_Order $order
*
* @return string
*/
public static function render_order_item_preview_price_column($empty, $item, $item_id, $order) {
if (Wiaas_Order_Item::is_standard_bundle($item)) {
$total_price = wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
$monthly_price = wc_price(
Wiaas_Order_Item::get_monthly_recurring_total($item),
array( 'currency' => $order->get_currency() )
);
return sprintf('<strong>On Delivery:</strong> %s <br> <strong>Monthly:</strong> %s',
$total_price,
$monthly_price);
}
return '';
}
/**
* Render order item payment info with order item metadata on order details page
*
* @param $item_id
* @param WC_Order_Item $item
* @param $product
*/
public static function render_order_details_order_item_custom_info($item_id, $item, $product) {
if (Wiaas_Order_Item::is_standard_bundle($item)) {
$order = $item->get_order();
$total_price = wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
$monthly_price = wc_price(
Wiaas_Order_Item::get_monthly_recurring_total($item),
array( 'currency' => $order->get_currency() )
);
?>
<br><br>
<strong>On Delivery:</strong> <?php echo $total_price ?>
<br>
<strong>Monthly:</strong> <?php echo $monthly_price ?>
<?php
}
}
/**
* @param array $formatted_meta
* @param WC_Order_Item $order_item
*
* @return array
*/
public static function filter_order_item_formatted_meta_data($formatted_meta, $order_item) {
if (Wiaas_Order_Item::is_standard_bundle($order_item)) {
return $formatted_meta;
}
return array();
}
/**
* @param string $display_key
* @param object $meta
* @param WC_Order_Item $item
*
* @return string
*/
public static function order_item_display_meta_key($display_key, $meta, $item) {
switch ($meta->key) {
case '_wiaas_payment_type':
return 'Payment type';
case '_wiaas_services_extra':
return 'Services and support price';
case '_wiaas_recurrent_extra':
return 'Recurrent price';
default:
return $display_key;
}
}
/**
* @param string $display_value
* @param object $meta
* @param WC_Order_Item $item
*
* @return string
*/
public static function order_item_display_meta_value($display_value, $meta, $item) {
switch ($meta->key) {
case '_wiaas_services_extra':
$order = $item->get_order();
return wc_price(
Wiaas_Order_Item::get_services_total($item),
array( 'currency' => $order->get_currency())
);
case '_wiaas_recurrent_extra':
$order = $item->get_order();
return wc_price(
Wiaas_Order_Item::get_recurrent_total($item),
array( 'currency' => $order->get_currency())
);
default:
return $display_value;
}
}
}
Wiaas_Admin_Orders::init();

View File

@@ -14,8 +14,17 @@ class Wiaas_Admin_Organization {
add_filter('get_role_list', array(__CLASS__, 'get_role_list_for_user'), 10, 2);
// hide woocommerce meta fields form customer user profile
add_filter('woocommerce_customer_meta_fields', array(__CLASS__, 'hide_woocommerce_customer_fields'));
// save related customers when organization form data has been saved by acf
add_action('acf/save_post', array(__CLASS__, 'maybe_save_related_customers'), 11);
// load related customers for organization form
add_filter('acf/load_value/name=_wiaas_organization_customers', array(__CLASS__, 'load_related_customer_organizations'), 10, 3);
// retrieve only customer organizations as options to link to commercial lead
add_filter('acf/fields/taxonomy/query/name=_wiaas_organization_customers', array(__CLASS__, 'filter_customer_organizations'));
}
public static function hide_woocommerce_customer_fields() {
@@ -26,6 +35,65 @@ class Wiaas_Admin_Organization {
return array();
}
/**
* Retrieve only customer organization as options to link customers to commercial lead
*
* @param $args
*
* @return array
*/
public static function filter_customer_organizations($args) {
$args['meta_key'] = '_wiaas_organization_roles';
$args['meta_value'] = 'customer';
$args['meta_compare'] = 'LIKE';
return $args;
}
/**
* Saves related customers if organization new/edit form has been submited
* Customer ids are collected from posted data of linked customers acf field and saved
*
* @param string $id in format `term_{$organization_id}`
*/
public static function maybe_save_related_customers($id) {
if ($_POST['taxonomy'] === Wiaas_User_Organization::TAXONOMY_NAME && ! empty($_POST['acf'])) {
$field = get_field_object('_wiaas_organization_customers', $id);
//get organization id
$id = absint(str_replace('term_', '', $id));
$customer_organization_ids = $_POST['acf'][$field['key']];
$customer_organization_ids = is_array($customer_organization_ids) ?
wp_parse_id_list($customer_organization_ids) :
array();
Wiaas_Shop::set_shop_customers($id, $customer_organization_ids);
}
}
/**
* Loads related customers for linked customers acf field on organization edit form
*
* @param array $value
* @param string $id in format `term_{$organization_id}`
* @param array $field acf field details
*
* @return array
*/
public static function load_related_customer_organizations($value, $id, $field) {
//get organization id
$id = absint(str_replace('term_', '', $id));
$customers = wp_list_pluck(
Wiaas_Shop::get_shop_customers($id),
'customer_id');
return $customers;
}
/**
* Render user organization roles as available user roles on user list
* @param $role_list
@@ -73,7 +141,7 @@ class Wiaas_Admin_Organization {
* @param $admin_bar
*/
public static function add_role_switcher_menu($admin_bar) {
if (is_super_admin()) {
if (get_current_user_id() === Wiaas_Authentication::SUPER_ADMIN_USER_ID) {
$roles = array( 'administrator' );
} else {
$organization_id = wiaas_get_current_user_organization_id();
@@ -158,7 +226,7 @@ class Wiaas_Admin_Organization {
// get current user
$current_user = wp_get_current_user();
update_user_meta($current_user->ID, '_wiaas_current_user_admin_role', $role->name);
update_user_meta($current_user->ID, '_wiaas_admin_role', $role->name);
// switch user role
$current_user->set_role($role->name);

View File

@@ -10,6 +10,42 @@ class Wiaas_Admin_Package {
require_once dirname( __FILE__ ) . '/package/class-wiaas-admin-linked-packages.php';
require_once dirname( __FILE__ ) . '/package/class-wiaas-admin-package-types.php';
add_action( 'manage_product_posts_columns', array( __CLASS__, 'manage_list_table_products_columns' ), 999, 2 );
add_action( 'woocommerce_product_data_tabs', array( __CLASS__, 'package_data_tabs' ), 999);
}
/**
* Hide default WC_Product data panels.
*
* @param array $tabs
*
* @return mixed
*/
public static function package_data_tabs($tabs) {
$tabs['general']['class'] = array( 'show_if_simple', 'show_if_bundle');
unset($tabs['attribute']);
unset($tabs['variations']);
unset($tabs['advanced']);
unset($tabs['shipping']);
unset($tabs['inventory']);
return $tabs;
}
/**
* Customize list table product columns
*
* @param array $columns
*
* @return array
*/
public static function manage_list_table_products_columns($columns) {
$columns['product_tag'] = __( 'Reference', 'wiaas' );
return $columns;
}
}

View File

@@ -0,0 +1,151 @@
<?php
class Wiaas_Admin_Product {
public static function init() {
add_action('acf/save_post', array(__CLASS__, 'save_initial_product_country_and_type'), 20, 1);
add_action('woocommerce_after_register_post_type', array(__CLASS__, 'wiaas_register_product_status'));
add_filter('woocommerce_register_post_type_product', array(__CLASS__, 'wiaas_modify_product'));
add_action('add_meta_boxes', array(__CLASS__, 'maybe_remove_metaboxes'), 999);
add_filter('wp_insert_post_data', array(__CLASS__, 'wiaas_maybe_set_no_country_status'), 999, 2);
add_action('acf/render_field/type=group', array(__CLASS__, 'render_choose_button_for_new_product'), 10, 1);
}
public static function wiaas_modify_product($args) {
$args['supports'] = array('title');
return $args;
}
public static function wiaas_register_product_status() {
register_post_status('_wiaas_no_country', array(
'label' => _x('No Country', 'Product status', 'wiaas'),
'public' => false,
'exclude_from_search' => false,
'show_in_admin_all_list' => false,
'show_in_admin_status_list' => false,
));
}
public static function render_choose_button_for_new_product($field) {
if ($field['_name'] === '_wiaas_product_general') {
?>
<div id="submitpost" style="padding: 20px 0;">
<input style="float:right;" name="publish" id="publish" class="button button-large button-primary" type="submit" value="Choose"/>
</div>
<?php
}
}
public static function maybe_remove_metaboxes() {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
if ($screen_id !== 'product') {
return;
}
global $post;
$post_id = $post->ID;
if ($post_id === 0 || $post->post_status === '_wiaas_no_country') {
remove_meta_box('woocommerce-product-data', 'product', 'normal');
remove_meta_box('slugdiv', 'product', 'normal');
remove_meta_box('postexcerpt', 'product', 'normal');
remove_meta_box('template_product_meta_box', 'product', 'normal');
remove_meta_box('submitdiv', 'product', 'side');
remove_meta_box('groups-permissions', 'product', 'side');
remove_meta_box('tagsdiv-product_tag', 'product', 'side');
remove_meta_box('tagsdiv-template_category', 'product', 'side');
remove_meta_box('tagsdiv-supplier', 'product', 'side');
remove_meta_box('postimagediv', 'product', 'side');
remove_meta_box('woocommerce-product-images', 'product', 'side');
remove_meta_box('wiaas_upload_and_link_document', 'product', 'side');
remove_meta_box('tagsdiv-product_country', 'product', 'side');
remove_meta_box('tagsdiv-wiaas_units', 'product', 'side');
}
//Always hide product category, it is added wit advanced custom fields plugin for simple product
remove_meta_box('product_catdiv', 'product', 'side');
// Always hide
remove_meta_box('tagsdiv-product_country', 'product', 'side');
}
public static function wiaas_maybe_set_no_country_status($data, $postarr) {
if ($postarr['post_type'] === 'product' && (!isset($postarr['ID']) || !$postarr['ID'])) {
$data['post_status'] = '_wiaas_no_country';
}
return $data;
}
/**
* Check for post status and and if there is country available
* Set post status to draft if the country is added
*
* @param $post_id
*/
public static function save_initial_product_country_and_type($post_id) {
global $post;
if ($post->post_type !== 'product') {
return;
}
$general = get_field('_wiaas_product_general', $post_id);
$country = $general['_wiaas_product_country'];
$type = $general['_wiaas_product_type'];
/**
* If type is missing set status to no country
*
* If this is not template product type and country is missing set status to no country
*
*/
if (empty($type) || ( empty($country) && $type !== 'wiaastemplate' )) {
wp_update_post(array(
'ID' => $post_id,
'post_status' => '_wiaas_no_country'
));
return;
}
/**
* Country and type are selected for simple and bundle products so
* link them
*/
wp_set_object_terms($post_id, $type, 'product_type', true);
if ($type !== 'wiaastemplate') {
wp_set_object_terms($post_id, $country, 'product_country', true);
}
/**
* If product had no country status change it to draft status
*/
if ($post->post_status === '_wiaas_no_country') {
wp_update_post(array(
'ID' => $post_id,
'post_status' => 'draft'
));
}
}
}
Wiaas_Admin_Product::init();

View File

@@ -0,0 +1,13 @@
<?php
class Wiaas_Admin_Simple_Product {
public static function init() {
require_once dirname( __FILE__ ) . '/simple-product/class-wiaas-admin-product-additional-info.php';
}
}
Wiaas_Admin_Simple_Product::init();

View File

@@ -0,0 +1,34 @@
<?php
class Wiaas_Admin_Supplier {
public static function init() {
add_action('init', array(__CLASS__, 'init_admin_supplier'));
}
public static function init_admin_supplier() {
$current_user = wp_get_current_user();
$role = $current_user->roles[0];
$is_supplier = $role === 'supplier';
if ($is_supplier) {
require_once dirname( __FILE__ ) . '/admin-supplier/class-wiaas-admin-supplier-orders.php';
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
}
}
public static function enqueue_scripts() {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_script( 'wiaas-admin-supplier', $plugin_url . '/assets/js/wiaas-admin-supplier.js' );
wp_enqueue_style( 'wiaas-admin-supplier', $plugin_url . '/assets/css/wiaas-admin-supplier.css' );
}
}
Wiaas_Admin_Supplier::init();

View File

@@ -0,0 +1,31 @@
<?php
class Wiaas_Admin_Profile {
public static function init() {
add_filter( 'user_contactmethods', array(__CLASS__, 'modify_user_contact_methods') );
add_action( 'user_profile_update_errors', array(__CLASS__, 'crf_user_profile_update_errors'), 10, 3 );
}
public static function crf_user_profile_update_errors( $errors, $update, $user ) {
$phone = $_POST['phone'];
if (!Wiaas_Validation::is_phone($phone)){
$errors->add('phone_error', __( '<strong>ERROR</strong>: Enter valid phone number.', 'crf' ));
};
}
public static function modify_user_contact_methods($user_contact){
$user_contact['phone'] = __( 'Phone number' );
return $user_contact;
}
}
Wiaas_Admin_Profile::init();

View File

@@ -0,0 +1,85 @@
<?php
class Wiaas_Admin_Order_Process_Flow {
public static function init() {
add_action( 'admin_menu', array(__CLASS__, 'add_delivery_process_page') );
add_action( 'gravityflow_entry_detail', array( __CLASS__, 'display_process_steps_details' ), 10, 3 );
}
public static function add_delivery_process_page() {
add_submenu_page(
'edit.php?post_type=shop_order',
__( 'Order Delivery', 'wiaas' ),
null,
'read',
'wiaas-order-delivery',
array(__CLASS__, 'output_delivery_process')
);
}
public static function output_delivery_process() {
$order_id = absint( $_GET['id'] );
$has_access = Wiaas_Access_Management::can_current_user_read_order($order_id);
if (! $has_access) {
echo "<h2>You don't have permission to view this order.</h2>";
return;
}
$order = wc_get_order($order_id);
if ( !$order ) {
return;
}
$delivery_process = Wiaas_Delivery_Process::get_order_delivery_process_entry($order->get_id());
if ($delivery_process &&
wp_verify_nonce($_POST['wiaas_delivery_process_navigation_nonce'], 'wiaas_delivery_process_navigation') &&
GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
self::_maybe_process_admin_step_change_action($delivery_process);
// refresh order
$order = wc_get_order($order_id);
}
require 'views/html-admin-delivery-process-page.php';
}
private static function _maybe_process_admin_step_change_action($entry) {
$admin_action = rgpost( 'wiaas_delivery_process_navigation_action' );
if ($admin_action === 'complete') {
$api = new Gravity_Flow_API( $entry['form_id'] );
$current_step = $api->get_current_step($entry);
if ( $current_step ) {
$current_step->purge_assignees();
$current_step->update_step_status( 'complete' );
}
$api->process_workflow($entry['id']);
}
list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 );
if ( $base_admin_action == 'send_to_step' ) {
$step_id = $action_id;
$api = new Gravity_Flow_API( $entry['form_id'] );
$api->send_to_step( $entry, $step_id );
}
}
}
Wiaas_Admin_Order_Process_Flow::init();

View File

@@ -0,0 +1,150 @@
<?php
class Wiaas_Admin_Delivery_Process_List {
public static function init() {
add_filter('gform_form_list_columns', array( __CLASS__, 'filter_gform_form_list_columns' ));
add_filter('gform_form_list_forms', array( __CLASS__, 'filter_gform_form_list_forms' ), 10, 6);
add_filter('gform_form_actions', array( __CLASS__, 'filter_gform_form_actions' ), 10, 2);
add_action('gform_form_list_column_wiaas_country', array( __CLASS__, 'render_gform_form_list_wiaas_country_column' ));
add_action('gform_form_list_column_wiaas_actions', array( __CLASS__, 'render_gform_form_list_wiaas_actions_column' ));
}
/**
* Hide not needed columns for delivery process list
* Add country column
* Add actions column
*
* @param array $columns
*
* @return mixed
*/
public static function filter_gform_form_list_columns($columns) {
unset($columns['entry_count']);
unset($columns['conversion']);
unset($columns['view_count']);
$columns['wiaas_country'] = esc_html__( 'Country', 'wiaas' );
$columns['wiaas_actions'] = esc_html__( 'Actions', 'wiaas' );
return $columns;
}
/**
* Filter delivery process forms list with search query by title and country
* @param array $forms
* @param string $search_query
* @param bool $active
* @param string $sort_column
* @param string $sort_direction
* @param bool $trash
*
* @return array
*/
public static function filter_gform_form_list_forms($forms, $search_query, $active, $sort_column, $sort_direction, $trash) {
$forms = GFFormsModel::get_forms( $active, $sort_column, $sort_direction, $trash );
if ( ! rgblank( $search_query ) ) {
$filtered_forms = array();
$search_query = strtolower($search_query);
// filter forms
foreach ($forms as $form) {
$form_details = GFAPI::get_form( $form->id );
$title = strtolower($form_details['title']);
$delivery_settings = rgar($form_details, 'wiaas_delivery_process');
$country_code = ! empty($delivery_settings) ? $delivery_settings['delivery_country'] : '';
$country_name = Wiaas_Countries::get_available_country_name_by_code($country_code);
$country_name = strtolower($country_name);
if (strpos($title, $search_query) !== false || strpos($country_code, $search_query) !== false ||
strpos($country_name, $search_query) !== false) {
$filtered_forms[] = $form;
}
}
return $filtered_forms;
}
return $forms;
}
/**
* Remove unused actions and add workflow action for delivery forms list
*
* @param array $actions
* @param int $form_id
*
* @return mixed
*/
public static function filter_gform_form_actions($actions, $form_id) {
unset($actions['entries']);
unset($actions['preview']);
unset($actions['edit']);
$actions['wiaas_workflow'] = array(
'label' => __( 'Workflow', 'wiaas' ),
'short_label' => esc_html__( 'Workflow', 'wiaas' ),
'title' => __( 'Edit workflow', 'wiaas' ),
'url' => '?page=gf_edit_forms&view=settings&id=' . $form_id . '&subview=gravityflow',
'priority' => 1000,
);
return $actions;
}
/**
* Render country column for delivery process forms list
*
* @param mixed $form
*/
public static function render_gform_form_list_wiaas_country_column($form) {
$form_details = GFAPI::get_form($form->id);
$delivery_settings = rgar($form_details, 'wiaas_delivery_process');
$country_code = ! empty($delivery_settings) ? $delivery_settings['delivery_country'] : '';
$country_name = Wiaas_Countries::get_available_country_name_by_code($country_code);
echo '<strong>' . esc_html_e($country_name) . '</strong>';
}
/**
* Render actions column for delivery process forms list
* @param mixed $form
*/
public static function render_gform_form_list_wiaas_actions_column($form) {
$form_details = GFAPI::get_form($form->id);
$delivery_settings = rgar($form_details, 'wiaas_delivery_process');
$form_type = ! empty($delivery_settings) ? $delivery_settings['delivery_form_type'] : '';
?>
<a href="<?php echo '?page=gf_edit_forms&view=settings&id=' . $form->id . '&subview=gravityflow' ?>">Workflow</a>
<?php
if ($form_type !== 'action') {
?>
<span style="margin: 0 10px; opacity: 0.3;"> | </span>
<a href="<?php echo '?page=gf_edit_forms&view=settings&id=' . $form->id . '&subview=wiaas_delivery_process' ?>">Change Country</a>
<?php
}
}
}
Wiaas_Admin_Delivery_Process_List::init();

View File

@@ -0,0 +1,214 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class Wiaas_Admin_Delivery_Process_Order {
public static function init() {
if (isset($_GET['wiaas-procurement-order-id'])) {
add_action('admin_init', array(__CLASS__, 'download_procurement_order'));
}
add_action('add_meta_boxes', array(__CLASS__, 'add_delivery_process_metabox'), 100 );
add_action('woocommerce_process_shop_order_meta', array(__CLASS__, 'maybe_assign_delivery_process'), 999);
}
/**
* Assign delivery process for order
*
* @param int $order_id
*/
public static function maybe_assign_delivery_process($order_id) {
if (! empty($_POST['wiaas_order_delivery_process_id'])) {
$process_id = absint($_POST['wiaas_order_delivery_process_id']);
Wiaas_Delivery_Process::create_delivery_process_for_order($order_id, $process_id);
}
}
public static function add_delivery_process_metabox() {
add_meta_box(
'order_delivery_process_meta_box',
__('Delivery Process', 'cmb'),
array(__CLASS__, 'order_delivery_process_meta_box'),
'shop_order',
'side',
'high'
);
}
public static function order_delivery_process_meta_box() {
global $post;
$order_id = $post->ID;
$process_entry = Wiaas_Delivery_Process::get_order_delivery_process_entry($order_id);
if ( empty($process_entry) ) {
$country_code = Wiaas_Order::get_order_country_code($order_id);
$list_of_delivery_processes = Wiaas_Delivery_Process::get_available_process_list_for_country($country_code);
?>
<div>
<select name="wiaas_order_delivery_process_id" style="width: 100%;">
<option value="" disabled selected>Assign process to order ... </option>
<?php
foreach($list_of_delivery_processes as $index => $process){
echo '<option value=' . $process['id'] . '>' . $process['title'] . '</option>';
}
?>
</select>
<button type="submit" class="button" style="margin-top: 10px;">Assign</button>
</div>
<?php
} else{
$entry_url = admin_url('admin.php?page=wiaas-order-delivery&id=' . $order_id);
?>
<a href="<?php esc_attr_e($entry_url, 'wiaas') ?>"> Delivery Process </a>
<?php
}
}
/**
* Download procurement order report
*
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*
*/
public static function download_procurement_order() {
if (!is_user_logged_in()) {
wp_die( __( 'No Access.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 403 ) );
}
$order_id = $_GET['wiaas-procurement-order-id'];
$order = wc_get_order($order_id);
if (! $order) {
wp_die( __( 'Invalid order.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 404 ) );
}
$customer_user_id = $order->get_customer_id();
$organization_id = wiaas_get_user_organization_id($customer_user_id);
$customer_organization_info = wiaas_get_organization_info($organization_id);
$delivery_address = $order->get_shipping_address_1() . ',' .
$order->get_shipping_city() . ',' .
$order->get_shipping_country() . ',' .
$order->get_shipping_postcode();
$billing_address = $order->get_billing_address_1() . ',' .
$order->get_billing_city() . ',' .
$order->get_billing_country() . ',' .
$order->get_billing_postcode();
$order_procurement_info = wiaas_get_order_procurement_info($order->get_id());
$spreadsheet = new Spreadsheet();
$spreadsheet->getProperties()->setCreator("RICOH")
->setLastModifiedBy("Ricoh Dash")
->setTitle("Order Procurement Report")
->setSubject("Order Procurement Report")
->setDescription("Order Procurement Report")
->setKeywords("office 2007 openxml php order procurement")
->setCategory("Procurement report file");
$spreadsheet->setActiveSheetIndex(0);
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('Order procurement');
$sheet->setCellValue('A1', 'Customer details');
$sheet->setCellValue('A2', 'Name');
$sheet->setCellValue('A3', 'Invoice address');
$sheet->setCellValue('A4', 'Invoice Full Name');
$sheet->setCellValue('A5', 'Invoice Email');
$sheet->setCellValue('A6', 'VAT Number');
$sheet->setCellValue('B2', ! empty($customer_organization_info) ? $customer_organization_info['name'] : '');
$sheet->setCellValue('B3', $billing_address);
$sheet->setCellValue('B4', $order->get_formatted_billing_full_name());
$sheet->setCellValue('B5', $order->get_billing_email());
$sheet->setCellValue('B6', ! empty($customer_organization_info) ? $customer_organization_info['vat_code'] : '');
$sheet->getStyle('A1')->getFont()->setBold(true);
$sheet->setCellValue('A9', 'OrderDetails');
$sheet->setCellValue('A10', 'Order number');
$sheet->setCellValue('A11', 'Project number');
$sheet->setCellValue('A12', 'Delivery addres');
$sheet->setCellValue('A13', 'Delivery Full Name');
$sheet->setCellValue('A14', 'Reference');
$sheet->setCellValue('B10', $order->get_order_number());
$sheet->setCellValue('B11', Wiaas_Order_Project::get_project_name_for_order($order->get_id()) );
$sheet->setCellValue('B12', $delivery_address);
$sheet->setCellValue('B13', $order->get_formatted_shipping_full_name());
$sheet->setCellValue('B14', $order->get_meta('_wiaas_reference'));
$sheet->getStyle('A9')->getFont()->setBold(true);
$row = 14;
foreach ($order_procurement_info as $category => $products) {
$col = 1; $row += 2;
$sheet->getColumnDimensionByColumn($col)->setAutoSize(true);
$sheet->getStyleByColumnAndRow($col, $row)->getFont()->setBold(true);
$sheet->setCellValueByColumnAndRow($col, $row, ucfirst(strtolower($category)));
$row += 2;
if (! empty($products)) {
$product_columns = array_keys($products[0]);
foreach ($product_columns as $product_column_index => $product_column) {
$sheet->getColumnDimensionByColumn($product_column_index + 1)->setAutoSize(true);
$sheet->getStyleByColumnAndRow($product_column_index + 1, $row)->getFont()->setBold(true);
$sheet->setCellValueByColumnAndRow($product_column_index + 1, $row, $product_column);
}
}
$row += 1;
foreach ($products as $product) {
$product_values = array_values($product);
foreach ($product_values as $product_value_index => $product_value) {
$sheet->setCellValueByColumnAndRow($product_value_index + 1, $row, $product_value);
}
$row += 1;
}
}
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Procurement Report '.$order->get_order_number().'.xlsx"');
header('Cache-Control: max-age=0');
$writer = new Xlsx($spreadsheet);
$writer->save('php://output');
exit;
}
}
Wiaas_Admin_Delivery_Process_Order::init();

View File

@@ -0,0 +1,208 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Order $order
*
*/
$delivery_process = Wiaas_Delivery_Process::get_order_delivery_process_entry($order->get_id());
if ( ! empty($delivery_process)) {
$form_id = $delivery_process['form_id'];
$workflow_api = new Gravity_Flow_API($form_id);
$current_step = $workflow_api->get_current_step($delivery_process);
$steps = $workflow_api->get_steps();
}
?>
<div class="wrap">
<form name="delivery" action="" method="post">
<input type="hidden" name="page" value="wiaas-order-delivery"/>
<input type="hidden" name="id" value="<?php echo esc_attr($order->get_id()) ?>"/>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="postbox-container-1" class="postbox-container">
<div class="postbox">
<div class="inside">
<?php require 'html-order-notes.php' ?>
</div>
</div>
</div>
<div id="postbox-container-2" class="postbox-container">
<div class="postbox">
<div class="inside">
<div class="panel-wrap">
<div class="panel">
<h1>
Delivery Order
<?php
if (current_user_can('edit_others_shop_orders')) {
echo '<a href="' . esc_url( admin_url( 'post.php?post=' . absint( $order->get_id() ) ) . '&action=edit' ) . '">#' . esc_attr( $order->get_order_number() ) . '</a>';
} else {
echo '#' . esc_attr($order->get_order_number());
}
?>
&nbsp &nbsp
<mark class="wiaas-order-status <?php esc_attr_e( sanitize_html_class( 'wiaas-order-status-' . $order->get_status() ), 'wiaas' ) ?>">
<span>
<?php esc_html_e( wc_get_order_status_name( $order->get_status() ) ) ?>
</span>
</mark>
</h1>
<?php
if (GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
?>
<p>
<a
id="wiaas_download_procurement_order_btn"
href="<?php echo admin_url() . '?wiaas-procurement-order-id=' . $order->get_id() ?>"
download
class="button"
>
<span><?php esc_html_e('Download procurement report', 'wiaas') ?></span>
</a>
</p>
<?php
}
?>
<?php
if (empty($delivery_process)) {
echo '<h2>Delivery process has not been assigned.</h2>';
}
if (! empty($delivery_process)) {
$is_disabled = ! Wiaas_Delivery_Process::can_delivery_dates_be_set($order->get_id(), $delivery_process, $steps);
require 'html-order-suppliers-delivery-dates.php';
}
?>
</div>
</div>
</div>
</div>
<?php
if (! empty($delivery_process)) {
if ($current_step && GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
require 'html-delivery-process-navigation.php';
}
?>
<div class="postbox">
<h3>
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px;color: #34C388; "></i>
<span>Order placed </span>
</h3>
</div>
<div class="postbox">
<h3>
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px;color: #34C388; "></i>
<span> Assign process </span>
</h3>
</div>
<?php
foreach ($steps as $step) {
$step = $workflow_api->get_step($step->get_id(), $delivery_process);
require 'html-delivery-process-step.php';
}
?>
<div id="postbox-container-2" class="postbox-container">
<div id="wiaas-delivery-process-timeline" class="postbox">
<h3>
<label for="name"><?php esc_html_e( 'Timeline', 'gravityflow' ); ?></label>
</h3>
<div class="inside">
<?php
$notes = Gravity_Flow_Common::get_timeline_notes( $delivery_process );
foreach ( $notes as $note ) {
$user_id = $note->user_id;
$step = Gravity_Flow_Common::get_timeline_note_step( $note );
$display_name = Gravity_Flow_Common::get_timeline_note_display_name( $note, $step );
$step_type = $step ? $step->get_type() : $display_name;
if ( $user_id ) {
$avatar = get_avatar( $user_id, 65 );
} else {
$step_icon = $step ? $step->get_icon_url() : gravity_flow()->get_base_url() . '/images/gravityflow-icon-blue.svg';
if ( strpos( $step_icon, 'http' ) !== false ) {
$avatar = sprintf( '<img class="avatar avatar-65 photo" src="%s" style="width:65px;height:65px;" />', $step_icon );
} else {
$avatar = sprintf( '<span class="avatar avatar-65 photo">%s</span>', $step_icon );
}
}
?>
<div class="wiaas-delivery-process-timeline-note">
<div class="wiaas-delivery-process-timeline-note-avatar">
<?php echo $avatar ?>
</div>
<div class="wiaas-delivery-process-timeline-note-body-wrap">
<div class="wiaas-delivery-process-timeline-note-body">
<div>
<div class="wiaas-delivery-process-timeline-note-title">
<?php esc_html_e( $display_name, 'wiaas' ) ?>
</div>
<div class="wiaas-delivery-process-timeline-note-date">
<?php esc_html_e( Gravity_Flow_Common::format_date( $note->date_created ), 'wiaas' ) ?>
</div>
</div>
<div class="wiaas-delivery-process-timeline-note-body">
<?php echo nl2br( esc_html( $note->value ) ) ?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,50 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$is_step_completed = $current_step->get_status() === 'complete' || $current_step->get_status() === 'approved';
// get next step id
$next_step = gravity_flow()->get_next_step($current_step, $current_step->get_entry(), $current_step->get_form());
$next_step_id = empty($next_step) ? null : $next_step->get_id();
// get previous step id
foreach ($steps as $step) {
$next = gravity_flow()->get_next_step($step, $current_step->get_entry(), $current_step->get_form());
if ($next && $next->get_id() === $current_step->get_id()) {
$previous_step = $step;
}
}
$previous_step_id = empty($previous_step) ? null : $previous_step->get_id();
// bail out if none exist
if ( empty($next_step_id) && empty($previous_step_id) && $is_step_completed) {
return;
}
?>
<div style="padding:10px; height:40px">
<input id="wiaas_delivery_process_navigation_action" type="hidden" name="wiaas_delivery_process_navigation_action">
<?php wp_nonce_field( 'wiaas_delivery_process_navigation', 'wiaas_delivery_process_navigation_nonce' ); ?>
<input
data-step="<?php echo empty($next_step_id) ? 'complete' : 'send_to_step|'.$next_step_id ?>"
type="submit"
class="button button-primary wiaas_delivery_step_nav"
style="float:right; margin-left: 20px;"
value="<?php echo empty($next_step_id) ? 'COMPLETE' : 'NEXT STEP' ?>"
>
<input
data-step="send_to_step|<?php esc_attr_e($previous_step_id, 'wiaas') ?>"
type="submit"
<?php disabled(empty($previous_step_id), true, true) ?>
class="button button-primary wiaas_delivery_step_nav"
style="float:right;" value="PREV STEP">
</div>

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$workflow_api = new Gravity_Flow_API($action_entry['form_id']);
$current_action_step = $workflow_api->get_current_step($action_entry);
$entry_url = add_query_arg( array(
'page' => 'gravityflow-inbox',
'view' => 'entry',
'id' => $action_entry['form_id'],
'lid' => $action_entry['id']
), admin_url() );
?>
<table style="padding: 10px;">
<?php
foreach ($action_form['fields'] as $field) {
if ($field->type === 'wiaas_order') {
continue;
}
if ($field->type === 'workflow_discussion') {
echo '<tr style="padding: 20px;"><td colspan="2">' . $field->format_discussion_value($action_entry[$field->id]) . '</td></tr>';
continue;
}
$value = $field->get_value_entry_detail($action_entry[$field->id]);
$label = $field->get_field_label(false, $action_entry[$field->id]);
echo '<tr>' .
'<td><strong>' . $label . ' : </strong></td>' .
'<td>' . $value . '</td>' .
'</tr>';
}
?>
<tfoot>
<tr>
<td colspan="2" style="text-transform: uppercase;font-size: 11px; letter-spacing: 0.4px; margin:10px;">
<strong>
<?php
echo empty($current_action_step) ?
$workflow_api->get_status($action_entry) :
$current_action_step->get_status_label($current_action_step->get_status()) . ': ' . $current_action_step->get_name();;
echo '<a target="_blank" href="' . $entry_url . '">' .
' <i class="dashicons dashicons-external" style="font-size: 16px;"></i>' .
'</a>';
?>
</strong>
</td>
</tr>
</tfoot>
<?php
?>
</table>
<hr />

View File

@@ -0,0 +1,75 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$is_step_completed = $step->get_status() === 'complete' || $step->get_status() === 'approved';
$is_current_step = $current_step && $step->get_id() === $current_step->get_id();
if ($is_current_step) {
$style = 'color: #FD8049;';
} else if ($is_step_completed) {
$style = 'color: #34C388;';
} else {
$style = 'opacity: 0.5; color: #CCC;';
}
?>
<div class="postbox">
<h3>
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px; <?php esc_attr_e($style, 'wiaas') ?>"></i>
<span><?php esc_html_e($step->get_name(), 'wiaas') ?></span>
</h3>
<?php
if ($step->instructionsEnable) {
$instructions = $step->instructionsValue;
$instructions = GFCommon::replace_variables( $instructions, $step->get_form(), $step->get_entry(), false, false, true );
$instructions = do_shortcode( $instructions );
echo '<div class="wiaas-delivery-process-step-instructions">' . $instructions . '</div>';
}
$action_form = GFAPI::get_form( $step->target_form_id );
if (! empty($action_form)) {
$page_size = 20;
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
array( 'key' => 'wiaas_delivery_process_id',
'value' => $delivery_process['id']
),
),
);
$sorting = array( 'key' => 'date_created', 'direction' => 'DESC' );
$paging = array( 'offset' => 0, 'page_size' => $page_size );
$entries = GFAPI::get_entries( $action_form['id'], $search_criteria, $sorting, $paging );
$action_workflow = new Gravity_Flow_API($action_form['id']);
$current_assignee_key = $step->get_current_assignee_key();
foreach ($entries as $action_entry) {
$action_entry_step = $action_workflow->get_current_step($action_entry);
$show_entry = GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' ) ||
($action_entry_step &&
$action_entry_step->is_assignee($current_assignee_key));
if ($show_entry) {
require 'html-delivery-process-step-action.php';
}
}
}
?>
</div>

View File

@@ -0,0 +1,38 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<p class="form-field form-field-wide">
<label for="estimated-delivery-date">Estimated delivery date:</label>
<input id="estimated-delivery-date" name="estimated-delivery-date"
type="date" value="<?php echo $order_estimated_delivery_date ? date("Y-m-d", $order_estimated_delivery_date) : ""; ?>"
onChange="onOrderEstimatedDeliveryDateChange(this.value)"/>
</p>
<script type="text/javascript">
function onOrderEstimatedDeliveryDateChange(date) {
var timestamp = parseInt((new Date(date).getTime() / 1000).toFixed(0));
if (isNaN(timestamp)){
timestamp = '';
}
var data = {
action: 'wiaas_save_estimated_date_for_order',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_estimated_date_for_order" ) ?>',
order: '<?php echo $order_id ?>',
date: timestamp
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
$.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
</script>

View File

@@ -0,0 +1,53 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$notes = wc_get_order_notes( array( 'order_id' => $order->get_id(), 'type' => 'customer' ) );
?>
<div id="wiaas_delivery_process_order_notes" class="delivery-process-notes">
<div id="delivery_process_order_notes_list">
<?php
foreach ($notes as $note) {
?>
<div class="note_content">
<?php echo wpautop( wptexturize( wp_kses_post( $note->content ) ) ); ?>
</div>
<p class="meta">
<abbr class="exact-date" title="<?php echo $note->date_created->date( 'y-m-d h:i:s' ); ?>"><?php printf( __( 'added on %1$s at %2$s', 'woocommerce' ), $note->date_created->date_i18n( wc_date_format() ), $note->date_created->date_i18n( wc_time_format() ) ); ?></abbr>
<?php
if ( 'system' !== $note->added_by ) :
/* translators: %s: note author */
printf( ' ' . __( 'by %s', 'woocommerce' ), $note->added_by );
endif;
?>
</p>
<?php
}
?>
</div>
<div class="add-note">
<p>
<label for="add_order_note"><?php _e( 'Add note', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce' ) ); ?></label>
<textarea
data-order-id="<?php esc_attr_e($order->get_id(), 'wiaas') ?>"
data-nonce="<?php esc_attr_e( wp_create_nonce( 'wiaas-add-order-note' ), 'wiaas') ?>"
type="text"
name="order_note"
id="wiaas_add_order_note"
class="input-text"
cols="20" rows="5"></textarea>
</p>
<p>
<input type="hidden" name="order_note_type" value="customer"/>
<button type="button" id="wiaas_delivery_process_add_note" class="add_note button"><?php _e( 'Add', 'woocommerce' ); ?></button>
</p>
</div>
</div>

View File

@@ -0,0 +1,247 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$suppliers = Wiaas_Order::get_suppliers($order_id);
$final_estimated_date = Wiaas_Order::get_final_estimated_date($order_id);
$final_confirmed_date = Wiaas_Order::get_final_confirmed_date($order_id);
$earliest_installation_date = Wiaas_Order::get_earliest_installation_date($order_id);
?>
<div>
<br>
<table class="widefat" disabled="disabled">
<tr style="background: #EAF2FA;">
<th align="left"><strong>Suppliers</strong></th>
<th align="left"><strong>Estimated date</strong></th>
<th align="left"><strong>Confirmed date</strong></th>
</tr>
<?php
foreach($suppliers as $supplier){
echo '<tr style="background: #f5f5f5;"><td><strong>' . $supplier['name'] . '</strong></td>';
$estimated_date = $supplier['estimated_date'] ? date("Y-m-d", $supplier['estimated_date']) : "";
$confirmed_date = $supplier['confirmed_date'] ? date("Y-m-d", $supplier['confirmed_date']) : "";
?>
<td>
<input
id=<?php echo 'estimate-date-' . $supplier['id'] ?>
<?php disabled($is_disabled, true, true) ?>
type="date"
onChange="onEstimatedDeliveryDateChange(<?php echo $supplier['id'] ?>, this.value)"
value="<?php echo $estimated_date ?>" />
</td>
<td>
<input
id=<?php echo 'confirmed-date-' . $supplier['id'] ?>
<?php disabled($is_disabled, true, true) ?>
type="date" onChange="onConfirmedDeliveryDateChange(<?php echo $supplier['id'] ?>, this.value)"
value="<?php echo $confirmed_date ?>" />
</td>
</tr>
<tr>
<td colspan="3">
<span>Tracking:</span>
</td>
</tr>
<?php
foreach($supplier['tracking_info'] as $index => $tracking_info){
?>
<tr>
<td colspan="3">
<input id=<?php echo 'supplier_' . $supplier['id'] . '_tracking_num_' . $index ?>
<?php disabled($is_disabled, true, true) ?>
placeholder="Tracking number" value="<?php echo $tracking_info['number'] ?>" />
<input id=<?php echo 'supplier_' . $supplier['id'] . '_tracking_url_' . $index ?>
<?php disabled($is_disabled, true, true) ?>
placeholder="Tracking URL" value="<?php echo $tracking_info['url'] ?>" />
<?php
if (! $is_disabled) {
?>
<input
type="button"
<?php disabled($is_disabled, true, true) ?>
class="button"
onClick="saveTrackingInfo(event, <?php echo $supplier['id'] . ',' . $index ?>)"
value="SAVE">
<input
type="button"
<?php disabled($is_disabled, true, true) ?>
class="button"
onClick="deleteTrackingInfo(event, <?php echo $supplier['id'] . ',' . $index ?>)" value="REMOVE"
>
<?php
}
?>
</td>
</tr>
<?php
}
if (! $is_disabled) {
?>
<tr>
<td colspan="4">
<input
type="button"
<?php disabled($is_disabled, true, true) ?>
class="button"
id=<?php echo $supplier['id'] ?> onClick="addAdditionalTrackingInfo(event)"
value="Add new tracking info">
</td>
</tr>
<?php
}
?>
<?php
}
?>
<tr>
<td><h4>Final dates : </h4></td>
<td><h4><?php echo $final_estimated_date ? date('Y-m-d', $final_estimated_date) : '-' ?></h4></td>
<td><h4><?php echo $final_confirmed_date ? date('Y-m-d', $final_confirmed_date) : '-' ?></h4></td>
</tr>
<tfoot>
<tr>
<td><h4>Earliest installation date : </h4></td>
<td colspan="2">
<h4><?php echo $earliest_installation_date ? date('Y-m-d', $earliest_installation_date) : '-' ?></h4>
</td>
</tr>
</tfoot>
</table>
</div>
<script type="text/javascript">
function onEstimatedDeliveryDateChange(supplierID, date) {
var timestamp = parseInt((new Date(date).getTime() / 1000).toFixed(0));
if (isNaN(timestamp)){
timestamp = '';
}
var data = {
action: 'wiaas_save_estimated_date_for_supplier',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_estimated_date_for_supplier" ) ?>',
order: '<?php echo $order_id ?>',
supplier: supplierID,
date: timestamp
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
function onConfirmedDeliveryDateChange(supplierID, date) {
var timestamp = parseInt((new Date(date).getTime() / 1000).toFixed(0));
if (isNaN(timestamp)){
timestamp = '';
}
var data = {
action: 'wiaas_save_confirmed_date_for_supplier',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_confirmed_date_for_supplier" ) ?>',
order: '<?php echo $order_id ?>',
supplier: supplierID,
date: timestamp
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
function addAdditionalTrackingInfo(e){
e.preventDefault();
var data = {
action: 'wiaas_add_additional_tracking_info_for_supplier_in_order',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_add_additional_tracking_info_for_supplier_in_order" ) ?>',
order: '<?php echo $order_id ?>',
supplier: e.target.id
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
function saveTrackingInfo(e, supplierID, index){
e.preventDefault();
var tracking_num = document.getElementById('supplier_' + supplierID + '_tracking_num_' + index).value;
var tracking_url = document.getElementById('supplier_' + supplierID + '_tracking_url_' + index).value;
var data = {
action: 'wiaas_save_tracking_info',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_tracking_info" ) ?>',
order: '<?php echo $order_id ?>',
supplier: supplierID,
index: index,
tracking_num: tracking_num,
tracking_url: tracking_url
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
function deleteTrackingInfo(e, supplierID, index){
e.preventDefault();
var data = {
action: 'wiaas_delete_tracking_info',
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_delete_tracking_info" ) ?>',
order: '<?php echo $order_id ?>',
supplier: supplierID,
index: index
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response.success){
location.reload();
}else{
alert(response.data[0].message);
}
});
}
</script>

View File

@@ -0,0 +1,153 @@
<?php
add_action( 'wp_ajax_wiaas_add_additional_tracking_info_for_supplier_in_order', 'wiaas_ajax_add_additional_tracking_info_for_supplier_in_order' );
add_action( 'wp_ajax_wiaas_save_tracking_info', 'wiaas_ajax_save_tracking_info');
add_action( 'wp_ajax_wiaas_delete_tracking_info', 'wiaas_ajax_delete_tracking_info');
add_action( 'wp_ajax_wiaas_save_estimated_date_for_supplier', 'wiaas_ajax_save_estimated_date_for_supplier');
add_action( 'wp_ajax_wiaas_save_confirmed_date_for_supplier', 'wiaas_ajax_save_confirmed_date_for_supplier');
add_action( 'wp_ajax_wiaas_save_estimated_date_for_order', 'wiaas_ajax_save_estimated_date_for_order');
add_action( 'wp_ajax_wiaas_add_order_note', 'wiaas_ajax_add_order_note');
/**
* Adds additional tracking info for supplier in order
*/
function wiaas_ajax_add_additional_tracking_info_for_supplier_in_order(){
check_ajax_referer('wiaas_add_additional_tracking_info_for_supplier_in_order');
$error = new WP_Error('-1', 'Failed to add additional tracking info');
if (!isset($_POST['order']) || !isset($_POST['supplier'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$supplier_id = intval( $_POST['supplier'] );
if (Wiaas_Order::add_additional_tracking_info($order_id, $supplier_id)){
wp_send_json_success();
}
wp_send_json_error($error);
}
/**
* Add order note via ajax.
*/
function wiaas_ajax_add_order_note() {
check_ajax_referer( 'wiaas-add-order-note', 'security' );
if ( ! current_user_can( 'edit_shop_orders' ) ) {
wp_die( -1 );
}
$post_id = absint( $_POST['post_id'] );
$note = wp_kses_post( trim( wp_unslash( $_POST['note'] ) ) );
if ( $post_id > 0 ) {
$order = wc_get_order( $post_id );
$comment_id = $order->add_order_note( $note, true, true );
$note = wc_get_order_note( $comment_id );
?>
<div class="note_content">
<?php echo wpautop( wptexturize( wp_kses_post( $note->content ) ) ); ?>
</div>
<p class="meta">
<abbr class="exact-date" title="<?php echo $note->date_created->date( 'y-m-d h:i:s' ); ?>"><?php printf( __( 'added on %1$s at %2$s', 'woocommerce' ), $note->date_created->date_i18n( wc_date_format() ), $note->date_created->date_i18n( wc_time_format() ) ); ?></abbr>
<?php
printf( ' ' . __( 'by %s', 'wiaas' ), $note->added_by );
?>
</p>
<?php
}
wp_die();
}
function wiaas_ajax_save_tracking_info(){
check_ajax_referer('wiaas_save_tracking_info');
$error = new WP_Error('-1', 'Failed to save tracking info');
if (!isset($_POST['order']) || !isset($_POST['supplier']) || !isset($_POST['index'])
|| !isset($_POST['tracking_num']) || !isset($_POST['tracking_url'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$supplier_id = intval( $_POST['supplier'] );
$index = intval($_POST['index']);
$tracking_num = $_POST['tracking_num'];
$tracking_url = $_POST['tracking_url'];
if (Wiaas_Order::save_tracking_info($order_id, $supplier_id, $index, $tracking_num, $tracking_url)){
wp_send_json_success();
}
wp_send_json_error($error);
}
function wiaas_ajax_delete_tracking_info(){
check_ajax_referer('wiaas_delete_tracking_info');
$error = new WP_Error('-1', 'Failed to save tracking info');
if (!isset($_POST['order']) || !isset($_POST['supplier']) || !isset($_POST['index'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$supplier_id = intval( $_POST['supplier'] );
$index = intval($_POST['index']);
if (Wiaas_Order::delete_tracking_info($order_id, $supplier_id, $index)){
wp_send_json_success();
}
wp_send_json_error($error);
}
function wiaas_ajax_save_estimated_date_for_supplier(){
check_ajax_referer('wiaas_save_estimated_date_for_supplier');
$error = new WP_Error('-1', 'Failed to save estimated date');
if (!isset($_POST['order']) || !isset($_POST['supplier']) || !isset($_POST['date'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$supplier_id = intval( $_POST['supplier'] );
$date = intval($_POST['date']);
if (Wiaas_Order::save_estimated_date($order_id, $supplier_id, $date)){
wp_send_json_success();
}
wp_send_json_error($error);
}
function wiaas_ajax_save_confirmed_date_for_supplier(){
check_ajax_referer('wiaas_save_confirmed_date_for_supplier');
$error = new WP_Error('-1', 'Failed to save confirmed date');
if (!isset($_POST['order']) || !isset($_POST['supplier']) || !isset($_POST['date'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$supplier_id = intval( $_POST['supplier'] );
$date = intval($_POST['date']);
if (Wiaas_Order::save_confirmed_date($order_id, $supplier_id, $date)){
wp_send_json_success();
}
wp_send_json_error($error);
}
function wiaas_ajax_save_estimated_date_for_order(){
check_ajax_referer('wiaas_save_estimated_date_for_order');
$error = new WP_Error('-1', 'Failed to save global estimated date for order');
if (!isset($_POST['order']) || !isset($_POST['date'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$date = intval($_POST['date']);
if (Wiaas_Order::save_order_estimated_date($order_id, $date)){
wp_send_json_success();
}
wp_send_json_error($error);
}

View File

@@ -152,18 +152,29 @@ $insert_new_document = $post->post_type !== 'wiaas_doc';
response = response.response;
var infoContainer = jQuery('#wiaas_upload_info');
if (response.substring(0, 6) === 'ERROR:') {
jQuery('#wiaas_upload_errors').html('<span class="text-danger">' +
'<i class="fa fa-exclamation-triangle"></i>' +
infoContainer.html('<span style="color: darkred;">' +
'<i class="dashicons dashicons-warning"></i>' +
' &nbsp; ' + response.substring(6, response.length) +
'</span>');
return;
}
infoContainer.html('<span style="color: darkgreen;">' +
'<i class="dashicons dashicons-yes"></i>' +
' &nbsp; ' + 'Document uploaded and linked' +
'</span>');
<?php
if ($insert_new_document) {
?>
$('#wiaas_attached_documents').find('tbody').append(response);
$('.wiaas_documents_tab a').click();
<?php
} else {
?>
@@ -252,7 +263,8 @@ $insert_new_document = $post->post_type !== 'wiaas_doc';
</div>
</div>
<div id="wiaas_upload_errors" style="color: darkred;">
<div id="wiaas_upload_info">
</div>
</div>

View File

@@ -8,62 +8,17 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$( '.wiaas-search-documents' ).each(function() {
var element = $( this );
var searchTarget = $('#' + element.data('target'));
element.autocomplete({
source: function(request, response) {
$.get( window.ajaxurl, {
action: 'wiaas_json_search_documents',
query: request.term,
_ajax_nonce: '<?php echo wp_create_nonce('wiaas_json_search_documents') ?>'
} ).done( function( documents ) {
response( documents || []);
}
);
},
select: function(event, ui) {
if (!searchTarget || $('#wiaas_attached_document_' + ui.item.id).length) {
return;
}
$.get(window.ajaxurl, {
action: 'wiaas_link_document',
_ajax_nonce: '<?php echo wp_create_nonce('wiaas_link_document') ?>',
id: ui.item.id
}).done( function (document) {
searchTarget.find('tbody').append(document);
});
}
})
.autocomplete( 'instance' )._renderItem = function( ul, item ) {
return $( '<li role="option" id="wiaas-document-autocomplete-' + item.id + '">' )
.text( item.name )
.appendTo( ul );
};
});
$('#wiaas_attached_documents').delegate('.wiaas-remove-attached-document', 'click', function (e) {
e.preventDefault();
var id = $(this).data('id');
$('#wiaas_attached_document_' + id).remove();
});
});
</script>
<div id="wiaas_documents" class="panel woocommerce_options_panel">
<div class="options_group">
<p class="form-field">
<label style="font-weight: bold;" for="wiaas_addon_packages"><?php esc_html_e( 'Search documents:', 'wiaas' ); ?></label>
<input type="text" data-target="wiaas_attached_documents" class="wiaas-search-documents"/>
<input
type="text"
data-target="wiaas_attached_documents"
data-search-nonce="<?php echo wp_create_nonce('wiaas_json_search_documents') ?>"
data-link-nonce="<?php echo wp_create_nonce('wiaas_link_document') ?>"
class="wiaas-search-documents"
/>
</p>
</div>
<div class="options_group">

View File

@@ -11,12 +11,52 @@ class Wiaas_Admin_Package_Pricing {
public static function init() {
add_action( 'woocommerce_product_data_tabs', array( __CLASS__, 'package_data_tabs' ) );
add_action( 'woocommerce_product_data_panels', array( __CLASS__, 'package_data_panel' ) );
add_action( 'admin_menu', array(__CLASS__, 'add_package_pricing_editor_page') );
add_action( 'wp_ajax_create_empty_pricing_rule', array(__CLASS__, 'create_empty_pricing_rule') );
add_action( 'woocommerce_process_product_meta', array( __CLASS__, 'process_meta_box' ), 1, 2 );
add_action('woocommerce_product_options_general_product_data', array(__CLASS__, 'render_edit_prices_link'));
add_filter('woocommerce_bundle_price_html', array( __CLASS__, 'get_package_price_html' ), 10, 2);
add_filter('woocommerce_screen_ids', array(__CLASS__, 'add_package_pricing_page_to_woocommerce_screens'), 10, 1);
}
public static function get_package_price_html($price_html, $package) {
$edit_link = admin_url( 'edit.php?post_type=product&page=wiaas-package_price_editor&id=' . absint( $package->get_id() ) );
return '<a class="button button-link" href="' . esc_url($edit_link) .'" target="_blank">Edit price<a>';
}
public static function render_edit_prices_link() {
global $post;
$edit_link = admin_url( 'edit.php?post_type=product&page=wiaas-package_price_editor&id=' . absint( $post->ID ) );
?>
<div class="options_group hide_if_simple hide_if_wiaastemplate">
<p>
<a href="<?php echo esc_url($edit_link) ?>" target="_blank">
<span>Edit prices</span>
</a>
</p>
</div>
<?php
}
public static function add_package_pricing_editor_page() {
add_submenu_page(
'edit.php?post_type=product',
__( 'Edit prices', 'wiaas' ),
null,
'create_products',
'wiaas-package_price_editor',
array(__CLASS__, 'package_pricing_editor')
);
}
/**
@@ -32,48 +72,91 @@ class Wiaas_Admin_Package_Pricing {
die();
}
/**
* Registers wiaas pricing tab for package data
* @param $tabs
*
* @return array
*/
public static function package_data_tabs($tabs) {
$tabs[ 'bundled_packages_price' ] = array(
'label' => __( 'Pricing', 'wiaas' ),
'target' => 'wiaas_package_price',
'class' => array( 'show_if_bundle', 'bundled_package_tab' ),
'priority' => 50
);
return $tabs;
}
/**
* Renderes wiaas pricing tab content for package
*/
public static function package_data_panel() {
public static function package_pricing_editor() {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_script('admin_package_edit_prices', $plugin_url . '/assets/js/wiaas-admin-package-edit-prices.js');
$package_id = absint($_GET['id']);
$package = wc_get_product( $package_id );
if (empty($package) || $package->get_type() !== 'bundle') {
return;
}
// save prices
if (! empty($_POST['wiaas_save_package_prices_nonce']) &&
wp_verify_nonce($_POST['wiaas_save_package_prices_nonce'], 'wiaas_save_package_prices')) {
self::_save_posted_package_prices($package_id);
}
global $post;
$package = wc_get_product( $post->ID );
$pricing_rules = Wiaas_Package_Pricing::get_package_prices($package);
$commission = Wiaas_Package_Pricing::get_package_pricing_commission($package);
$max_cost_margin = Wiaas_Package_Pricing::get_package_max_cost_margin($package);
include 'views/html-package-pricing.php';
// collect package bundle items pricing info to display
$bundled_items = $package->get_bundled_items();
$bundled_items_per_category = array();
foreach ($bundled_items as $bundled_item) {
$product = $bundled_item->product;
$product_cat = Wiaas_Product_Category::get_category($product);
if ($product_cat === 'hardware' || $product_cat === 'software') {
$product_cat = 'product';
}
$bundled_items_per_category[$product_cat] ?: array( );
$bundled_items_per_category[$product_cat][] = $bundled_item;
}
include 'views/html-package-pricing-page.php';
}
public static function add_package_pricing_page_to_woocommerce_screens( $screens ){
$screens[] = 'product_page_wiaas-package_price_editor';
return $screens;
}
// PRIVATE HELPERS
/**
* Saves posted package pricing rules
* @param $post_id
* @param $post
* Save posted package pricing information
*
* @param int $package_id
*/
public function process_meta_box( $post_id, $post ) {
private static function _save_posted_package_prices($package_id) {
$commission = wp_unslash($_POST['wiaas_pricing_rules_commision']);
$max_cost_margin = wp_unslash($_POST['wiaas_max_cost_margin']);
$pricing_rules = array();
$posted_pricing_rules = isset($_POST['wiaas_pricing_rules']) ? wp_unslash($_POST['wiaas_pricing_rules']) : array();
foreach ($posted_pricing_rules as $rule_type => $posted_prices) {
$posted_prices = wp_unslash($posted_prices);
$prices = array();
foreach ($posted_prices as $posted_price_type => $posted_price) {
$prices[sanitize_key($posted_price_type)] = wp_unslash($posted_price);
}
$pricing_rules[sanitize_key($rule_type)] = $prices;
}
Wiaas_Package_Pricing::set_package_prices(
wc_get_product( $post_id ),
$_POST['wiaas_pricing_rules'],
$_POST['wiaas_pricing_rules_commision'],
$_POST['wiaas_max_cost_margin']);
wc_get_product( $package_id ),
$pricing_rules,
$commission,
$max_cost_margin);
Wiaas_Access_Management::maybe_handle_product_access($package_id, get_post($package_id));
}
}

View File

@@ -0,0 +1,278 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
table tr:not(.wiaas-package-price) td:not(:first-child) {
text-align: center;
vertical-align: middle; !important;
}
</style>
<div id="wiaas_package_pricing_editor" class="wrap">
<h1>
<?php
esc_html_e($package->get_title(), 'wiaas');
$country = Wiaas_Countries::get_package_country($package);
if (! empty($country)) {
esc_html_e(' (sold in ' . $country['name'] . ')', 'wiaas');
}
?>
</h1>
<br class="clear" />
<div id="col-container">
<div id="post-body" class="metabox-holder columns-2">
<div id="col-right">
<div class="col-wrap">
<div class="inside">
<table class="widefat">
<tbody>
<?php
$products_total_cost = 0;
$one_time_services_cost = 0;
$recurring_services_cost = 0;
$installation_cost = 0;
foreach ($bundled_items_per_category as $cat => $items) {
?>
<tr style="background: #F5F5F5;">
<td colspan="4">
<strong style="text-transform: uppercase;">
<?php esc_html_e($cat . ' (' . count($items) . ')', 'wiaas') ?>
</strong>
</td>
</tr>
<?php
foreach ($items as $item) {
$product = $item->product;
$product_price = Wiaas_Product_Pricing::get_product_price($product);
$total_cost = Wiaas_Pricing::get_product_total_cost($product);
?>
<tr>
<td>
<span>
<?php esc_html_e($item->get_quantity(), 'wiaas') ?>
x
<?php esc_html_e($product->get_title(), 'wiaas') ?>
</span>
</td>
<td>
<?php
esc_html_e(
$total_cost * $item->get_quantity(),
'wiaas')
?>
</td>
<td>
<?php
esc_html_e(
$total_cost . ' per unit',
'wiaas');
?>
</td>
<td>
<?php
if ($product_price['is_recurring']) {
esc_html_e(
$product_price['price'] . ' / month for ' . $product_price['pay_period'] . ' months',
'wiaas');
} else {
echo '-';
}
?>
</td>
</tr>
<?php
}
?>
<tr class="wiaas-package-price">
<td style="border-top: 1px solid #e5e5e5;"></td>
<td colspan="3" style="border-top: 1px solid #e5e5e5;">
<strong>
<?php
if ($cat === 'product') {
$products_total_cost = wiaas_get_package_product_procurement_cost($package);
esc_html_e('Total: ' . $products_total_cost, 'wiaas');
}
if ($cat === 'service') {
$one_time_services_cost = wiaas_get_package_one_time_services_procurement_cost($package);
$recurring_services_cost = wiaas_get_package_recurring_services_procurement_cost($package);
esc_html_e('One time services: ' . $one_time_services_cost, 'wiaas');
echo '<br>';
esc_html_e('Recurring services: ' . $recurring_services_cost . ' / month ', 'wiaas');
}
if ($cat === 'installation') {
$installation_cost = wiaas_get_package_installation_procurement_cost($package);
esc_html_e('Installation: ' . $installation_cost, 'wiaas');
}
?>
</strong>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr class="wiaas-package-price">
<td>
<h4>TOTAL COST :</h4>
</td>
<td colspan="3">
<strong>Fixed: <?php esc_html_e($products_total_cost + $one_time_services_cost + $installation_cost)?></strong>
<br>
<strong>Recurring: <?php esc_html_e($recurring_services_cost)?> / month</strong>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h2><?php esc_html_e('Set package prices', 'wiaas') ?></h2>
<form action="" method="post">
<input type="hidden" name="page" value="wiaas-package_price_editor">
<input type="hidden" name="id" value="<?php esc_attr_e($package->get_id(), 'wiaas') ?>">
<div class="form-field">
<label><?php esc_html_e('Max cost margin :', 'wiaas') ?>
<?php echo wc_help_tip('Product deactivation limit (total cost)') ?>
</label>
<input
id="wiaas_pricing_rules_max_cost_margin"
name="wiaas_max_cost_margin"
type="number"
min="0"
value="<?php esc_attr_e($max_cost_margin, 'wiaas') ?>"
data-total="<?php esc_attr_e(Wiaas_Pricing::get_package_total_cost($package), 'wiaas') ?>"
>
<p
id="wiaas_pricing_rules_max_cost_margin_error"
<?php if(Wiaas_Package_Status::get_package_status($package->get_id()) !== Wiaas_Package_Status::INVALID_MARGIN) echo 'style="display: none;"' ?>
class="wiaas-package-error"
>The total costs are greater than the package max margin!</p>
</div>
<div class="form-field">
<label><?php esc_html_e('Commision ( % ):', 'wiaas') ?></label>
<input
id="wiaas_pricing_rules_commision"
name="wiaas_pricing_rules_commision"
type="number"
value="<?php esc_attr_e($commission, 'wiaas') ?>"
min="0" max="100"
>
<p id="wiaas_pricing_rules_commission_details">
<?php esc_html_e('Commercial lead: ' . (100 - $commission) .'%', 'wiaas') ?>
</p>
</div>
<div class="form-field">
<div class="wrap">
<select id="wiaas_pay_types" name="wiaas-pay-type" class="pricing_rule_mode">
<option selected value="0" disabled> Select payment type ...</option>
<?php
$available_pay_types = Wiaas_Package_Pricing::get_available_pay_types();
foreach ($available_pay_types as $name => $pay_type) {
$is_added = ! empty( $pricing_rules[$name])
?>
<option
value="<?php esc_attr_e($name, 'wiaas') ?>"
id="wiaas_pay_type_<?php esc_attr_e($name, 'wiaas') ?>"
<?php disabled($is_added, true, true) ?>
>
<?php esc_html_e( $pay_type['title'], 'wiaas' ); ?>
</option>
<?php
}
?>
</select>
<button
title="<?php _e( 'Add pricing type.', 'wiaas' ); ?>"
id="wiaas-add-pricing"
type="button"
class="button">
<?php _e( 'Add Pricing Type', 'wiaas' ); ?>
</button>
</div>
</div>
<div id="wiaas_package_pricing_rules">
<?php
require 'html-package-pricing-rules-list.php';
?>
</div>
<?php wp_nonce_field( 'wiaas_save_package_prices', 'wiaas_save_package_prices_nonce' ); ?>
<input type="submit" value="Save" class="button button-primary button-large">
</form>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -8,7 +8,7 @@ $available_pay_types = Wiaas_Package_Pricing::get_available_pay_types();
foreach ( $pricing_rules as $name => $pricing_rule ) {
$pay_type = $available_pay_types[$name];
?>
<div id="wiaas-pricing-rule-<?php echo $name; ?>" class="wiaas-pricing-rule">
<div id="wiaas-pricing-rule-<?php echo $name; ?>" class="wiaas-pricing-rule form-field">
<div class="section">
<h4 class="first"><?php echo $pay_type['title']; ?>
<a href="#" data-name="<?php echo $name; ?>"

View File

@@ -1,223 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="wiaas_package_price" class="panel woocommerce_options_panel">
<script type="text/javascript">
jQuery(document).ready(function ($) {
$("#wiaas-add-pricing").click(function (event) {
event.preventDefault();
var set_index = $("#wiaas_package_pricing_rules").data('setindex') + 1;
$("#wiaas_package_pricing_rules").data('setindex', set_index);
var pay_type = $('#wiaas_pay_type').val();
var data = {
'pay_type': pay_type,
post:<?php echo isset( $_GET['post'] ) ? $_GET['post'] : 0; ?>,
action: 'create_empty_pricing_rule'
};
$.post(ajaxurl, data, function (response) {
$('#wiaas_package_pricing_rules').append(response);
$(`#wiaas_pay_type_${pay_type}`).addClass('wiaas_hidden');
var available_options = $('#wiaas_pay_type option').not('.wiaas_hidden');
if (available_options.length === 0) {
$('#wiaas_package_price_controls').addClass('wiaas_hidden');
} else {
$('#wiaas_pay_type').val(available_options.first().val());
}
});
});
//Remove Pricing Type
$('#wiaas_package_pricing_rules').delegate('.delete_wiaas_pricing_rule', 'click', function (event) {
event.preventDefault();
if (confirm("<?php _e( 'Are you sure you would like to remove this pay type?', 'wiaas' ); ?>")) {
var name = $(this).data('name');
$('#wiaas-pricing-rule-' + name).slideUp().remove();
// append new option to controls
$(`#wiaas_pay_type_${name}`).removeClass('wiaas_hidden');
var available_options = $('#wiaas_pay_type option').not('.wiaas_hidden');
if (available_options.length === 1) {
$('#wiaas_package_price_controls').removeClass('wiaas_hidden');
$('#wiaas_pay_type').val(available_options.first().val());
}
}
});
$('#wiaas_package_pricing_rules').delegate('.wiaas_minimal_services_price', 'change', function (event) {
event.preventDefault();
var minimal_services_price = parseFloat($(this).val()) || 0;
var principal_amount = 0;
var name = $(this).data('name');
var principal_amount_input = $(`#wiaas_principal_amount_${name}`).first();
if (principal_amount_input) {
principal_amount = parseFloat(principal_amount_input.val() / principal_amount_input.data('period')) || 0;
}
$(`#wiaas_minimal_recurrent_price_${name}`).text((minimal_services_price + principal_amount).toFixed(2));
var services_contract_period = $(this).data('period');
if (services_contract_period > 0) {
var final_services_price = minimal_services_price * services_contract_period;
$(`#wiaas_minimal_services_price_${name}_final`).text(final_services_price.toFixed(2));
}
});
$('#wiaas_package_pricing_rules').delegate('.wiaas_principal_amount', 'change', function (event) {
event.preventDefault();
var value = parseFloat($(this).val());
var period = parseFloat($(this).data('period'));
var interestRate = 0.58;
var principal_amount = calculateFinancing(interestRate, period, value);
var minimal_services_price = 0;
var name = $(this).data('name');
var minimal_services_price_input = $(`#wiaas_minimal_services_price_${name}`).first();
if (minimal_services_price_input) {
minimal_services_price = parseFloat(minimal_services_price_input.val()) || 0;
}
$(`#wiaas_minimal_recurrent_price_${name}`).text((minimal_services_price + principal_amount).toFixed(0));
$(`#wiaas_minimal_recurrent_package_price_${name}`).text(principal_amount.toFixed(0));
});
/**
* Copy of Excel's PMT function.
* Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js
*
* @param ratePerPeriod The interest rate for the loan.
* @param numberOfPayments The total number of payments for the loan in months.
* @param presentValue The present value, or the total amount that a series of future payments is worth now;
* Also known as the principal.
* @param futureValue The future value, or a cash balance you want to attain after the last payment is made.
* If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
* @param type Optional, defaults to 0. The number 0 (zero) or 1 and indicates when payments are due.
* 0 = At the end of period
* 1 = At the beginning of the period
* @returns {number}
*/
function calculateFinancing(ratePerPeriod, numberOfPayments, presentValue, futureValue = 0, type = 0) {
/*var q = 0;
var c = 0;
const monthlyRatePerPeriod = ratePerPeriod / 12;
if (monthlyRatePerPeriod !== 0.0) {
// Interest rate exists
q = Math.pow(1 + monthlyRatePerPeriod, numberOfPayments);
c = (monthlyRatePerPeriod * (futureValue + (q * presentValue))) / ((-1 + q) * (1 + monthlyRatePerPeriod * (type)));
return c.toFixed(2);
} else if (numberOfPayments !== 0.0) {
// No interest rate, but number of payments exists
return -(futureValue + presentValue) / numberOfPayments;
}
return 0;*/
const rates = {
24 : 4.282,
30 : 3.451,
36 : 2.896,
42 : 2.500,
48 : 2.223,
54 : 2.025,
60 : 1.834
};
const interest = rates[numberOfPayments] || 10;
return presentValue * (interest / 100);
}
});
</script>
<div class="options_group">
<?php
woocommerce_wp_text_input(
array(
'id' => '_wiaas_max_cost_margin',
'name' => 'wiaas_max_cost_margin',
'value' => $max_cost_margin,
'label' => __( 'Max cost margin:', 'wiaas' ),
'type' => 'number',
)
);
?>
</div>
<div class="options_group">
<?php
woocommerce_wp_text_input(
array(
'id' => '_wiaas_price_commision',
'name' => 'wiaas_pricing_rules_commision',
'value' => $commission,
'label' => __( 'Commision (Percent):', 'wiaas' ),
'type' => 'number',
)
);
?>
</div>
<div class="options_group">
<div class="wc-metaboxes-wrapper">
<?php
$has_available_pay_types = false;
$available_pay_types = Wiaas_Package_Pricing::get_available_pay_types();
foreach ($available_pay_types as $name => $pay_type) {
if (!isset($pricing_rule_sets[$name])) {
$has_available_pay_types = true;
break;
}
}
$class = $has_available_pay_types ? '' : 'wiaas_hidden';
?>
<div id="wiaas_package_price_controls" class="toolbar toolbar-top <?php echo $class ?>">
<select id="wiaas_pay_type" name="wiaas-pay-type" class="pricing_rule_mode">
<?php
foreach ($available_pay_types as $name => $pay_type) {
?>
<option
value="<?php echo $name ?>"
id="wiaas_pay_type_<?php echo $name ?>"
class="<?php echo $class ?>"
>
<?php _e( $pay_type['title'], 'wiaas' ); ?>
</option>
<?php
}
?>
</select>
<button
title="<?php _e( 'Add pricing type.', 'wiaas' ); ?>"
id="wiaas-add-pricing"
type="button"
class="button button-primary">
<?php _e( 'Add Pricing Type', 'wiaas' ); ?>
</button>
</div>
<div id="wiaas_package_pricing_rules" class="wc-metaboxes">
<?php
require 'html-package-pricing-rules-list.php';
?>
</div>
</div>
</div>
</div>

View File

@@ -4,29 +4,6 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<script>
jQuery(document).ready(function($) {
if ($('#product-type').val() === 'simple') {
$('#general_product_data').find('.pricing').show();
} else {
$('#general_product_data').find('.pricing').hide();
}
$('#general_product_data').find('.pricing').attr('class','wiaas_show_if_simple');
$('body').on('woocommerce-product-type-change', function (event, select_val) {
if ('simple' === select_val) {
$('.wiaas_show_if_simple').show();
} else {
$('.wiaas_show_if_simple').hide();
}
});
});
</script>
<?php
woocommerce_wp_checkbox(
array(

View File

@@ -0,0 +1,104 @@
<?php
class Wiaas_Admin_Product_Additional_Info {
public static function init() {
add_action('woocommerce_product_options_general_product_data', array(__CLASS__, 'display_additional_fields'));
add_action('woocommerce_process_product_meta', array(__CLASS__, 'save_additional_fields'));
add_filter('woocommerce_json_search_found_products', array(__CLASS__, 'filter_product_by_country'));
}
/**
* Add Manufacturer product and Supplier product number fields to
* Simple product general tab
*
*/
public static function display_additional_fields() {
global $post;
$product = wc_get_product( $post->ID );
if ($product->get_type() === 'simple') {
echo '<div class=" product_custom_field ">';
woocommerce_wp_text_input(
array(
'id' => '_manufacturer_product_no',
'label' => __('Manufacturer product number', 'woocommerce'),
'type' => 'text'
)
);
woocommerce_wp_text_input(
array(
'id' => '_supplier_product_no',
'label' => __('Supplier product number', 'woocommerce'),
'type' => 'text'
)
);
echo '</div>';
}
}
/**
* This method filters search results by template country
* In addition it adds template category to label of every product
*
* @param $search_results array provided by filter
* @return mixed array of filtered search results
*/
public static function filter_product_by_country($search_results) {
$url = wp_get_referer();
if (strpos($url, 'post') === false) {
return $search_results;
}
$post_param = explode("&", parse_url($url, PHP_URL_QUERY))[0];
$post_id = explode("=", $post_param)[1];
$country_id = wp_get_post_terms($post_id, 'product_country', array('fields' => 'ids'))[0];
if (!empty($search_results)) {
$search_result_objects = array_map('wc_get_product', array_keys($search_results));
foreach ($search_result_objects as $result_id => $product_form_search) {
if (Wiaas_Countries::get_product_country_term_id($product_form_search) !== $country_id) {
unset($search_results[$product_form_search->get_id()]);
} else {
$template_category = wp_get_object_terms($product_form_search->get_id(), 'template_category', array('fields' => 'names'));
if(!empty($template_category)){
$search_results[$product_form_search->get_id()] = $search_results[$product_form_search->get_id()].' ['.$template_category[0].']';
}
}
}
}
return $search_results;
}
/**
* Save Manufacturer product and Supplier product number fields to
* Simple product meta data
*
*/
public static function save_additional_fields($post_id) {
$manufacturer_product_no = $_POST['_manufacturer_product_no'];
if (!empty($manufacturer_product_no))
update_post_meta($post_id, '_manufacturer_product_no', esc_attr($manufacturer_product_no));
$supplier_product_no = $_POST['_supplier_product_no'];
if (!empty($supplier_product_no))
update_post_meta($post_id, '_supplier_product_no', esc_attr($supplier_product_no));
}
}
Wiaas_Admin_Product_Additional_Info::init();

View File

@@ -56,10 +56,16 @@ class Wiaas_Admin_Template_Selection {
<div id="wiaas_selected_template_items_container"><?php
$template_products_data = self::show_template_products($value);
self::render_template_products($template_products_data['hardware']);
self::render_template_products($template_products_data['services']);
self::render_template_products($template_products_data['installation']);
self::render_template_products($template_products_data['software']);
$product = wc_get_product( $post->ID );
if ($product->get_type() == 'bundle') {
$bundled_items = $product->get_bundled_items('view');
$categories_form_bundle = WC_Product_Template::extract_bundled_product_categories($bundled_items);
self::render_template_products($template_products_data['hardware'], $categories_form_bundle);
self::render_template_products($template_products_data['services'], $categories_form_bundle);
self::render_template_products($template_products_data['installation'], $categories_form_bundle);
self::render_template_products($template_products_data['software'], $categories_form_bundle);
}
?></div><?php
}
@@ -132,17 +138,22 @@ class Wiaas_Admin_Template_Selection {
* Render html of template categories
*
* @param $template_products array containing template category information
* @param $categories_form_bundle
*/
public static function render_template_products($template_products) {
public static function render_template_products($template_products, $categories_form_bundle = array()) {
if (!empty($template_products)) {
foreach ($template_products as $item) {
$connected_product = $categories_form_bundle[$item['template_category_id']] ?
$categories_form_bundle[$item['template_category_id']]->product_name : '';
$product_id = $item['template_category_id'];
$title = $item['template_category_title'];
$quantity = $item['quantity'];
$connected_product_name = $connected_product;
include('views/html-wiaas-template-selection.php');
}

View File

@@ -83,7 +83,8 @@ class Wiaas_Template_Admin_Ajax {
$terms = get_terms(array(
'taxonomy' => 'template_category',
'name__like' => $term
'name__like' => $term,
'hide_empty' => false
));
foreach ($terms as $t) {

View File

@@ -10,7 +10,6 @@ class Wiaas_template {
add_filter('woocommerce_product_data_tabs', array(__CLASS__, 'custom_product_tabs'));
add_action('woocommerce_product_data_panels', array(__CLASS__, 'wiaastemplate_product_tab_content_all'));
add_action('woocommerce_admin_process_product_object', array(__CLASS__, 'save_wiaastemplate'));
add_filter('woocommerce_product_data_tabs', array(__CLASS__, 'hide_attributes_data_panel'));
add_action('woocommerce_process_product_meta_wiaastemplate', array(__CLASS__, 'save_wiaastemplate'));
// Enqueue scripts.
@@ -198,21 +197,6 @@ class Wiaas_template {
return isset($a['menu_order']) ? 1 : -1;
}
}
/**
* Hide default WC_Product data panels.
*/
function hide_attributes_data_panel($tabs) {
$tabs['advanced']['class'][] = 'hide_if_simple_wiaastemplate hide_if_wiaastemplate';
$tabs['shipping']['class'][] = 'hide_if_simple_wiaastemplate hide_if_wiaastemplate';
$tabs['linked_product']['class'][] = 'hide_if_simple_wiaastemplate hide_if_wiaastemplate';
$tabs['attribute']['class'][] = 'hide_if_simple_wiaastemplate hide_if_wiaastemplate';
return $tabs;
}
}
Wiaas_template::init();

View File

@@ -9,5 +9,6 @@ if (!defined('ABSPATH')) {
<h3>
<strong class="item-title"><?php echo $title; ?></strong>
<strong class="item-title">[<?php echo $quantity; ?>]</strong>
<strong class="item-title">[<?php echo $connected_product_name; ?>]</strong>
</h3>
</div><?php

View File

@@ -31,12 +31,20 @@ class Wiaas_Cart_API {
'package_id' => array(
'description' => __( 'Wiaas package ID.', 'wiaas' ),
'type' => 'integer',
'required' => true,
'sanitize_callback' => 'absint',
),
'cl_id' => array(
'description' => __( 'Commercial lead ID.', 'wiaas' ),
'type' => 'integer',
'required' => true,
'sanitize_callback' => 'absint',
),
'price_id' => array(
'description' => __( 'Selected price ID for Wiaas package.', 'wiaas' ),
'type' => 'string',
'enum' => array_keys(Wiaas_Package_Pricing::get_available_pay_types()),
'required' => true,
'sanitize_callback' => 'sanitize_key',
),
'options_ids' => array(
@@ -210,7 +218,6 @@ class Wiaas_Cart_API {
public static function get_cart_items() {
return rest_ensure_response(array(
'items' => Wiaas_Cart::get_cart_packages(),
'raw' => WC()->cart->get_cart_contents(),
));
}
@@ -225,6 +232,7 @@ class Wiaas_Cart_API {
$success = Wiaas_Cart::add_package_to_cart(
$request['package_id'],
$request['price_id'],
$request['cl_id'],
$request['addons_ids'],
$request['options_ids']
);

View File

@@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/**
* TODO: This is temporary implemetation and will probably be changed during work on pending wiaas cart task
* Class Wiaas_Document_API
*/
class Wiaas_Document_API {
@@ -30,30 +29,26 @@ class Wiaas_Document_API {
)
) );
register_rest_route( self::$namespace, 'documents/order/(?P<id>\d+)/(?P<type>[\w-]+)', array(
register_rest_route( self::$namespace, 'order/(?P<id>\d+)/item/(?P<item_id>\d+)/document/(?P<key>[\w-]+)', array(
'args' => array(
'id' => array(
'description' => __( 'Order ID.', 'wiaas' ),
'type' => 'integer',
'sanitize_callback' => 'absint',
),
'type' => array(
'description' => __( 'Order document type.', 'wiaas' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_key',
),
)
),
array(
'methods' => 'GET',
'permission_callback' => 'is_user_logged_in',
'callback' => array(__CLASS__, 'download_order_document'),
'callback' => array(__CLASS__, 'download_order_item_document'),
'args' => array(
'item_id' => array(
'description' => __( 'Package Order Item ID.', 'wiaas' ),
'type' => 'integer',
'sanitize_callback' => 'absint',
'required' => true
),
'document_key' => array(
'key' => array(
'description' => __( 'Unique key identifier for order document.', 'wiaas' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_key',
@@ -62,6 +57,29 @@ class Wiaas_Document_API {
)
)
) );
register_rest_route(self::$namespace, 'order/(?P<id>\d+)/document/(?P<key>[\w-]+)', array(
'args' => array(
'id' => array(
'description' => __( 'Order ID.', 'wiaas' ),
'type' => 'integer',
'sanitize_callback' => 'absint',
)
),
array(
'methods' => 'GET',
'permission_callback' => 'is_user_logged_in',
'callback' => array(__CLASS__, 'download_order_other_document'),
'args' => array(
'key' => array(
'description' => __( 'Unique key identifier for order document.', 'wiaas' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_key',
'required' => true
),
)
)
));
}
/**
@@ -76,14 +94,23 @@ class Wiaas_Document_API {
}
/**
* Download order document
* Download order item document
*
* @param WP_REST_Request $request
*/
public static function download_order_document($request) {
public static function download_order_item_document($request) {
Wiaas_Document_Download::download_order_item_document(
$request['id'],
$request['item_id'],
$request['type'],
$request['document_key']);
$request['key']);
}
/**
* Download order document
*
* @param WP_REST_Request $request
*/
public static function download_order_other_document($request) {
Wiaas_Document_Download::download_order_other_document($request['id'], $request['key']);
}
}

View File

@@ -1,79 +0,0 @@
<?php
class Wiaas_Package_API {
private static $namespace = 'wiaas';
public static function init() {
add_filter('woocommerce_rest_product_object_query', array(__CLASS__, 'filter_packages'), 10, 2);
}
public static function register_routes() {
// TODO: Handle this when assigment of customer to commercial lead is done
register_rest_route( self::$namespace, '/commercial-leads', array(
'methods' => WP_REST_Server::READABLE,
'callback' => array(__CLASS__, 'get_customer_commercial_leads'),
'permission_callback' => 'is_user_logged_in'
) );
}
// TODO: Handle this when assigment of customer to commercial lead is done
public static function get_customer_commercial_leads() {
$commercial_leads = array();
foreach (wiaas_get_commercial_leads() as $id => $name) {
$commercial_leads[] = array(
'id' => $id,
'name' => $name
);
}
return rest_ensure_response($commercial_leads);
}
/**
* Filter woocommerce REST API query so only valid wiaas packages are returned to the customer
*
* @param $args
* @param $request
*
* @return mixed
*/
public static function filter_packages($args, $request) {
if ( empty($query['tax_query']) ){
$query['tax_query'] = array();
}
// Retrieve only packages with available package status
$query['tax_query'][] = array(
'taxonomy' => 'package_status',
'field' => 'name',
'terms' => Wiaas_Package_Status::AVAILABLE
);
$commercial_lead_id = absint($request['cl_id']);
$customer_id = wiaas_get_current_user_organization_id();
$pay_types = array_keys(Wiaas_Package_Pricing::get_available_pay_types());
$price_search_terms = array();
foreach ($pay_types as $pay_type) {
$price_search_terms[] = '_' . $commercial_lead_id . '_' . $pay_type . '_default';
$price_search_terms[] = '_' . $commercial_lead_id . '_' . $pay_type . '_customer_' . $customer_id;
}
$args['tax_query'][] = array(
'taxonomy' => '_wiaas_shop_prices',
'terms' => $price_search_terms,
'field' => 'slug'
);
return $args;
}
}
Wiaas_Package_API::init();

View File

@@ -1,5 +1,12 @@
<?php
/**
* TODO: Refactor this class so it reflects the fact that customer is an organization
* TODO: Format should be `customer/(?P<organization_id>\d+)/user/(?P<id>\d+)
*
* Class Wiaas_REST_Customer_API
*/
class Wiaas_REST_Customer_API {
/**
* Endpoint namespace.
@@ -9,13 +16,19 @@ class Wiaas_REST_Customer_API {
private static $namespace = 'wiaas';
public function __construct() {
include_once dirname( __FILE__ ) . '/../user/class-wiaas-customer.php';
include_once dirname( __FILE__ ) . '/helper/class-rest-helper-functions.php';
}
public static function register_routes() {
register_rest_route( self::$namespace, 'customer/(?P<id>\d+)/shops', array(
'methods' => 'GET',
'callback' => array(__CLASS__, 'get_customer_shops'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, 'customer/(?P<id>\d+)/profile-addresses', array(
'methods' => 'PUT',
'callback' => array(__CLASS__, 'update_customer_profile_addresses'),
@@ -54,6 +67,21 @@ class Wiaas_REST_Customer_API {
}
public static function get_customer_shops() {
$customer_shops = Wiaas_Customer::get_customer_shops();
$customer_shops = array_map(function($customer_shop) {
return array(
'id' => $customer_shop['owner_id'],
'type' => $customer_shop['order_type'],
'name' => wiaas_get_organization_name($customer_shop['owner_id'])
);
}, $customer_shops);
return rest_ensure_response($customer_shops);
}
public static function update_customer_profile_addresses(WP_REST_Request $request){
@@ -120,6 +148,10 @@ class Wiaas_REST_Customer_API {
return wiaas_api_notice('ADD_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
}
if (!Wiaas_Validation::is_phone($phone)){
return wiaas_api_notice('INVALID_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
};
if (!Wiaas_Customer::update_customer_profile_info($customer_id, $first_name, $last_name, $phone)){
return wiaas_api_notice('PROFILE_NOT_CHANGED', 'warning', Wiaas_Customer::get_customer_info($customer_id));
}

View File

@@ -26,28 +26,44 @@ class Wiass_REST_Delivery_Process_API {
*/
private static $namespace = 'wiaas';
private static $rest_base = 'delivery';
public static function register_routes() {
register_rest_route( self::$namespace, 'next-delivery-steps', array(
register_rest_route( self::$namespace, '/' . self::$rest_base . '/next-actions', array(
'methods' => 'GET',
'callback' => array(__CLASS__, 'get_next_actions_for_user'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, 'customer-acceptance/(?P<entry_id>\d+)', array(
register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P<order_id>\d+)/customer-acceptance', array(
'methods' => 'GET',
'callback' => array(__CLASS__, 'get_customer_acceptance'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, 'customer-acceptance/(?P<entry_id>\d+)', array(
register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P<order_id>\d+)/customer-acceptance', array(
'methods' => 'POST',
'callback' => array(__CLASS__, 'submit_customer_acceptance'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, 'customer-acceptance/(?P<entry_id>\d+)/upload-file' , array(
register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P<order_id>\d+)/customer-acceptance/upload' , array(
'methods' => 'POST',
'callback' => array(__CLASS__, 'upload_file'),
'callback' => array(__CLASS__, 'upload_customer_acceptance'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P<order_id>\d+)/customer-questionnaires', array(
'methods' => 'GET',
'callback' => array(__CLASS__, 'get_customer_questionnaires'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P<order_id>\d+)/customer-questionnaires/upload/(?P<action_entry_id>\d+)', array(
'methods' => 'POST',
'callback' => array(__CLASS__, 'upload_customer_questionnaire'),
'permission_callback' => 'is_user_logged_in'
) );
}
@@ -61,14 +77,6 @@ class Wiass_REST_Delivery_Process_API {
'value' => 'pending',
);
$user_roles = gravity_flow()->get_user_roles();
foreach ( $user_roles as $user_role ) {
$field_filters[] = array(
'key' => 'workflow_role_' . $user_role,
'value' => 'pending',
);
}
$field_filters['mode'] = 'any';
$search_criteria = array();
@@ -77,10 +85,11 @@ class Wiass_REST_Delivery_Process_API {
$form_ids = gravity_flow()->get_workflow_form_ids();
$total_count = 7;
$entries = GFAPI::get_entries( $form_ids, $search_criteria, null, null, $total_count );
$entries = GFAPI::get_entries(
$form_ids,
$search_criteria,
null,
null);
$data = array();
foreach ($entries as $entry) {
@@ -96,175 +105,73 @@ class Wiass_REST_Delivery_Process_API {
return rest_ensure_response($data);
}
public static function get_customer_acceptance(WP_REST_Request $request){
$entry = GFAPI::get_entry($request['entry_id']);
if (is_wp_error($entry)){
return wiaas_api_generate_error('Customer acceptance entry not found', 404);
}
public function get_customer_questionnaires(WP_REST_Request $request) {
$acceptance_documents = array();
$uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]);
$order_id = absint($request['order_id']);
foreach($uploaded_files as $file_url){
//example of decoded url :
//http://localhost/wp/index.php?gf-download=2018/08/rokovi-1535378841.docx&form-id=1&field-id=12&hash=1be6c30f0eeff93563b352d15fe459d5ded12ee06c2c8f36fed66b42dedf2534
$decoded_url = urldecode($file_url);
$url_parts = explode('?', $decoded_url);
$file_name_base_parts = explode('&', $url_parts[1]);
$file_name_parts = explode('/', $file_name_base_parts[0]);
$file_name_with_extension_parts = explode('.', $file_name_parts[2]);
$data = Wiaas_Delivery_Process::get_customer_questionnaires_data($order_id);
$acceptance_documents_entry = array(
'name' => $file_name_with_extension_parts[0],
'extension' => $file_name_with_extension_parts[1],
'url' => $file_url
);
array_push($acceptance_documents, $acceptance_documents_entry);
}
$acceptance_status = 0;
if ($entry[self::ACCEPTANCE_STATUS_FIELD_ID]){
$acceptance_status = ($entry[self::ACCEPTANCE_STATUS_FIELD_ID] === 'accept') ? 1 : -1;
}
return rest_ensure_response(array(
'documents' => $acceptance_documents,
'expiration' => $entry[self::EXPIRATION_DATE_FIELD_ID],
'status' => $acceptance_status,
'decline_reason' => $entry[self::DECLINE_REASON_FIELD_ID]
));
return rest_ensure_response($data);
}
public static function submit_customer_acceptance(WP_REST_Request $request){
$entry = GFAPI::get_entry($request['entry_id']);
if (is_wp_error($entry)){
return wiaas_api_generate_error('Customer acceptance entry not found', 404);
}
public function upload_customer_questionnaire(WP_REST_Request $request) {
$status = $request['actionType'];
$reason = $request['declineReason'];
$order_id = absint($request['order_id']);
$action_entry_id = absint($request['action_entry_id']);
Wiaas_Delivery_Process::upload_customer_questionnaire($order_id, $action_entry_id);
return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success');
}
public static function get_customer_acceptance(WP_REST_Request $request){
$order_id = absint($request['order_id']);
$data = Wiaas_Delivery_Process::get_customer_acceptance_data($order_id);
return rest_ensure_response($data);
}
public static function submit_customer_acceptance(WP_REST_Request $request) {
$status = $request['action_type'];
$reason = $request['decline_reason'];
if (!in_array($status, self::ACCEPTABLE_STATUS)){
return wiaas_api_notice('ACCEPTANCE_STATUS_MISSING', 'error');
}
$installation_declined = ($status === self::DECLINE_STATUS_LABEL);
$uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]);
if ($installation_declined && $reason === ''){
return wiaas_api_notice('DECLINE_REASON_EMPTY', 'error');
}
if (!$installation_declined && (count($uploaded_files)===0)){
$order_id = $request['order_id'];
if (! $installation_declined && ! Wiaas_Delivery_Process::is_customer_acceptance_uploaded($order_id)) {
return wiaas_api_notice('ACCEPTANCE_NOT_UPLOADED', 'error');
}
$entry[self::DECLINE_REASON_FIELD_ID] = $reason;
$entry[self::ACCEPTANCE_STATUS_FIELD_ID] = $status;
if (!GFAPI::update_entry( $entry )){
return wiaas_api_notice('INTERNAL_SERVER_ERROR', 'error');
}
//Check if step is already completed, to not submit again
$gf_api = new Gravity_Flow_API($entry['form_id']);
$current_step = $gf_api->get_current_step($entry);
if ($current_step->get_name() !== self::USER_INPUT_STEP_NAME){
return wiaas_api_notice('ACCEPTANCE_STATUS_UPDATED', 'success');
}
if ( $current_step ) {
$current_step->purge_assignees();
$current_step->update_step_status( 'complete' );
}
$entry_id = $entry['id'];
$new_step_id = $current_step->get_id() + 1;
$new_step = $gf_api->get_step( $new_step_id, $entry );
$feedback = sprintf( esc_html__( 'Sent to step: %s', 'gravityflow' ), $new_step->get_name() );
$gf_api->add_timeline_note( $entry_id, $feedback );
$gf_api->log_activity( 'workflow', 'sent_to_step', $gf_api->form_id, $entry_id, $step_id );
gform_update_meta( $entry_id, 'workflow_final_status', 'pending' );
$new_step->start();
$gf_api->process_workflow( $entry_id );
Wiaas_Delivery_Process::update_customer_acceptance_status($order_id, $status, $reason);
if ($installation_declined){
return wiaas_api_notice('INSTALLATION_DECLINED', 'success');
}
return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success');
}
public static function upload_file(WP_REST_Request $request){
$files = $request->get_file_params();
if (!$files[self::FILE_KEY_NAME]){
return wiaas_api_notice('NO_FILES_UPLOADED', 'error');
}
public static function upload_customer_acceptance(WP_REST_Request $request){
$entry = GFAPI::get_entry($request['entry_id']);
if (is_wp_error($entry)){
return wiaas_api_generate_error('Customer acceptance entry not found', 404);
}
$order_id = $request['order_id'];
$form = GFAPI::get_form($entry['form_id']);
$form_upload_path = GFFormsModel::get_upload_path( $form['id'] );
$success = Wiaas_Delivery_Process::upload_customer_acceptance_document($order_id);
$target_path = $form_upload_path . '/' . date('Y') . '/' . date('m') . '/';
wp_mkdir_p( $target_path );
GFCommon::recursive_add_index_file( $target_path );
$upload_file_field = GFAPI::get_field($form['id'], self::UPLOADED_FILES_FIELD_ID);
$file_name = sanitize_file_name($files[self::FILE_KEY_NAME]['name']);
$file_path_details = pathinfo($file_name);
if ( GFCommon::file_name_has_disallowed_extension( $file_name ) ) {
return wiaas_api_notice('INVALID_FILE_ACCEPTANCE', 'error');
}
$allowed_extensions = ! empty( $upload_file_field->allowedExtensions ) ? GFCommon::clean_extensions( explode( ',', strtolower( $upload_file_field->allowedExtensions ) ) ) : array();
if ( ! empty( $allowed_extensions ) ) {
if ( ! GFCommon::match_file_extension( $file_name, $allowed_extensions ) ) {
return wiaas_api_notice('INVALID_FILE_ACCEPTANCE', 'error');
}
}
$new_file_name = $file_path_details['filename'] . '-' . time() . '.' . $file_path_details['extension'];
// Bypasses security checks when running unit tests.
if ( defined( 'WP_TEST_IN_PROGRESS' ) && WP_TEST_IN_PROGRESS ) {
return wiaas_api_notice('FILE_UPLOADED', 'success');
}
if ( move_uploaded_file($files[self::FILE_KEY_NAME]['tmp_name'], $target_path . $new_file_name ) ) {
GFFormsModel::set_permissions( $target_path . $new_file_name );
} else {
return wiaas_api_notice('INTERNAL_SERVER_ERROR', 'error');
}
//Extract path relative to the root
//Last 6 strings (excluding last empty) are path relative to the root
$path_parts = explode('/', $target_path);
$relative_path = '';
$i = count($path_parts) - self::PATH_PARTS_TO_EXTRACT;
while($i < count($path_parts)-1){
$relative_path = $relative_path . $path_parts[$i] . '/';
$i++;
}
$file_url = self::BASE_NAME . $relative_path . $new_file_name;
$url_for_download = $upload_file_field->get_download_url($file_url);
$uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]);
if ($uploaded_files === NULL){
$uploaded_files = [];
}
array_push($uploaded_files, $url_for_download);
$entry[self::UPLOADED_FILES_FIELD_ID] = json_encode($uploaded_files);
if (GFAPI::update_entry( $entry )) {
if ($success) {
return wiaas_api_notice('FILE_UPLOADED','success');
}

View File

@@ -43,7 +43,7 @@ class Wiass_REST_User_API {
}
public static function get_countries(){
$countries = Wiaas_Countries::get_list_of_countries();
$countries = Wiaas_Countries::get_available_countries();
return rest_ensure_response($countries);
}

View File

@@ -0,0 +1,68 @@
<?php
class Wiaas_Support_Api {
/**
* Endpoint namespace.
*
* @var string
*/
private static $namespace = 'wiaas';
private static $rest_base = 'support';
public static function register_routes() {
register_rest_route(self::$namespace, self::$rest_base . '/send-support-email', array(
'methods' => 'POST',
'callback' => array(__CLASS__, 'send_support_email'),
'permission_callback' => 'is_user_logged_in',
'args' => array(
'id' => array(
'description' => __('Order ID.', 'wiaas'),
'type' => 'integer',
'required' => true,
'sanitize_callback' => 'absint',
),
'support_text' => array(
'description' => __('Email text.', 'wiaas'),
'type' => 'string',
'required' => true
)
)
));
}
/**
* Send support email and save massage to order notes
*
* @param WP_REST_Request $request Request data.
*
* @return WP_REST_Response
*/
public static function send_support_email($request) {
$order_id = $request['id'];
$message = $request['support_text'];
$order = wc_get_order($order_id);
$customer_id = $order->get_customer_id();
$customer = get_user_by('id', $customer_id);
$mailer = WC()->mailer();
$recipient = WIAAS_SUPPORT_EMAIL;
$subject = __('Customer: '.$customer->get('first_name').', '.''.$customer->get('last_name').' needs support for order number: ' .$order->get_order_number());
$headers = array();
$success = $mailer->send( $recipient, $subject, $message, $headers );
if ($success) {
wc_create_order_note($order_id , $message, true );
return wiaas_api_notice('EMAIL_SENT', 'success');
}
return wiaas_api_notice('EMAIL_NOT_SENT', 'failed');
}
}

View File

@@ -0,0 +1,118 @@
<?php
/**
* Implements wiaas shop based search on top of woocommerce product api
*
* Class Wiaas_WC_Package_API_Integration
*/
class Wiaas_WC_Package_API_Integration {
/**
* Rest base for woocommerce product search
*
* @var string
*/
private static $wc_rest_base = '/wc/v2/products';
public static function init() {
add_filter('woocommerce_rest_product_object_query', array(__CLASS__, 'filter_packages'), 10, 2);
add_filter('rest_dispatch_request', array(__CLASS__, 'validate_package_search_request'), 10, 4);
}
/**
* Force wc api request to send shop id when searching packages
*
* @param $null
* @param $request
* @param $route
* @param $handler
*
* @return null|WP_Error
*/
public static function validate_package_search_request($null, $request, $route, $handler) {
if (strpos($route, self::$wc_rest_base) !== false) {
if (empty($request['shop_id']) || ! absint($request['shop_id'])) {
return new WP_Error(
'missing_shop',
'Shop parameter is missing',
array ( 'status' => 400 )
);
}
}
return null;
}
/**
* Filter woocommerce REST API query so only valid wiaas packages are returned to the customer
*
* @param $args
* @param $request
*
* @return mixed
*/
public static function filter_packages($args, $request) {
if ( empty($args['tax_query']) ){
$args['tax_query'] = array();
}
// Retrieve only packages with available package status
$args['tax_query'][] = array(
'taxonomy' => 'package_status',
'field' => 'name',
'terms' => Wiaas_Package_Status::AVAILABLE
);
/**
* Retrieve packages that satisfy one of two:
*
* 1) Package has at least one visible customer specific price set (for current customer)
* 2) Package has at least one visible default price set and not customer specific prices set (for current customer)
*
* This approach enables us that if package has specific prices set for current customer only those prices
* are taken into account and default ones are ignored.
* Only if package has no specific prices for current customer default prices are taken into account.
*
*/
$shop_id = absint($request['shop_id']);
$customer_id = wiaas_get_current_user_organization_id();
$default_price_search_term = '_' . $shop_id . '_default';
$customer_visible_price_search_term = '_' . $shop_id . '_customer_' . $customer_id . '_visible';
$customer_hidden_price_search_term = '_' . $shop_id . '_customer_' . $customer_id . '_hidden';
$args['tax_query'][] = array(
'relation' => 'OR',
array(
'taxonomy' => '_wiaas_shop_prices',
'terms' => $customer_visible_price_search_term,
'field' => 'slug'
),
array(
array(
'taxonomy' => '_wiaas_shop_prices',
'terms' => $default_price_search_term,
'field' => 'slug'
),
array(
'taxonomy' => '_wiaas_shop_prices',
'terms' => $customer_hidden_price_search_term,
'field' => 'slug',
'operator' => 'NOT IN'
)
)
);
return $args;
}
}
Wiaas_WC_Package_API_Integration::init();

View File

@@ -1,10 +1,35 @@
<?php
/**
* Class Wiaas_Access_Management
*/
class Wiaas_Access_Management {
/**
* Handles organization and role based access management to wiaas objects (orders, products)
*
* Using Groups Access for achieve this
*
*/
public static function init() {
add_action( 'save_post', array( __CLASS__, 'maybe_handle_product_access' ), 999, 2 );
add_action('woocommerce_checkout_order_processed', array( __CLASS__, 'assign_order_to_customer_organization' ));
add_action('woocommerce_checkout_order_processed', array( __CLASS__, 'assign_order_to_commercial_lead_organization' ));
add_action('woocommerce_checkout_order_processed', array( __CLASS__, 'assign_order_to_supplier_organizations'));
add_action('wiaas_order_item_installation_assigned', array(__CLASS__, 'assign_order_to_installation_organization'), 10, 3);
}
/**
* @param int $order_id
*
* @return bool
*/
public static function can_current_user_read_order($order_id) {
return Groups_Post_Access::user_can_read_post($order_id);
}
/**
@@ -22,30 +47,98 @@ class Wiaas_Access_Management {
$product = wc_get_product($post_id);
$admin_access_group = Groups_Group::read_by_name('admin');
$access_group = null;
$access_group_ids = array();
// if product is not bundle or it not completed set it visible only for admin
if ($product->get_type() !== 'bundle' ||
$product->get_status() !== 'publish' ||
empty(Wiaas_Package_Pricing::get_package_prices($product))) {
if ($admin_access_group) {
$access_group_ids[] = $admin_access_group->group_id;
$access_group = Groups_Group::read_by_name('admin');
} else {
$access_group = Groups_Group::read_by_name('Registered');
}
// allow commercial lead to see published bundle products
$cl_access_group = Groups_Group::read_by_name('commercial_lead');
if ($product->get_type() === 'bundle' &&
$product->get_status() === 'publish' &&
$cl_access_group) {
$access_group_ids[] = $cl_access_group->group_id;
if ($access_group) {
Groups_Post_Access::update(
array(
'post_id' => $product->get_id(),
'groups_read' => $access_group->group_id
)
);
}
Groups_Post_Access::update(
array(
'post_id' => $product->get_id(),
'groups_read' => $access_group_ids
) );
}
/**
* Assignees order to corresponding user organization when order is created.
*
* @param int $order_id
*/
public static function assign_order_to_customer_organization($order_id) {
// assign order to customer organization
$customer_id = wiaas_get_current_user_organization_id();
Wiaas_User_Organization::assign_post_to_organization($order_id, $customer_id);
}
/**
* Assign order to commercial lead organization
*
* @param int $order_id
*/
public static function assign_order_to_commercial_lead_organization($order_id) {
$order = wc_get_order($order_id);
$commercial_lead_id = absint($order->get_meta('_wiaas_commercial_lead_id', true));
if ($commercial_lead_id) {
Wiaas_User_Organization::assign_post_to_organization($order_id, $commercial_lead_id);
}
}
/**
* Assignees order to supplier organizations extracted from ordered items except installation
*
* Order will be assigned to corresponding installation company during delivery process
*
* @param int $order_id
*/
public static function assign_order_to_supplier_organizations($order_id) {
$order = wc_get_order($order_id);
$order_items = $order->get_items('line_item');
foreach ($order_items as $key => $order_item) {
$supplier_organisation_id = $order_item->get_meta('_wiaas_supplier_organization_id');
if (! empty($supplier_organisation_id) && $order_item->get_meta('_wiaas_category') !== 'installation') {
Wiaas_User_Organization::assign_post_to_organization($order_id, $supplier_organisation_id);
}
}
}
/**
* Assign order to installation organization that handles installation of corresponding ordered bundle item
*
* @param WC_Order $order
* @param WC_Order_Item $bundle_item
* @param WC_Order_Item $installation_item
*/
public static function assign_order_to_installation_organization($order, $bundle_item, $installation_item) {
$supplier_organisation_id = $installation_item->get_meta('_wiaas_supplier_organization_id');
if (! empty($supplier_organisation_id) ) {
Wiaas_User_Organization::assign_post_to_organization($order->get_id(), $supplier_organisation_id);
}
}
}
Wiaas_Access_Management::init();

View File

@@ -1,17 +1,15 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Wiaas_Admin {
public static function init() {
require_once dirname( __FILE__ ) . '/admin/class-wiaas-admin-package.php';
require_once dirname( __FILE__ ) . '/admin/class-wiaas-admin-pricing.php';
require_once dirname(__FILE__) . '/admin/template/class-wiaas-admin-template-selection.php';
require_once dirname(__FILE__) . '/admin/template/class-wiaas-template-products.php';
require_once dirname(__FILE__) . '/admin/template/class-wiaas-template-admin-ajax.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-simple-product.php';
// Admin order projects interface
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-order-projects.php';
@@ -19,18 +17,43 @@ class Wiaas_Admin {
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-documents.php';
// Admin organization interface
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-organization.php';
// Admin order delivery process
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-delivery-process.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-cl.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-product.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-delivery-process.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-supplier.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-user-profile.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-countries.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-orders.php';
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-dashboard.php';
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
}
public static function enqueue_scripts() {
$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );
wp_enqueue_script( 'wiaas_data_tables', $plugin_url . '/assets/js/datatables.min.js' );
wp_enqueue_style( 'wiaas_data_tables', $plugin_url . '/assets/css/datatables.min.css' );
wp_enqueue_style( 'wiaas_admin', $plugin_url . '/assets/css/wiaas-admin.css' );
wp_enqueue_style( 'wiaas_admin_menu', $plugin_url . '/assets/css/menu.css' );
wp_enqueue_style( 'wiaas_admin_packages', $plugin_url . '/assets/css/package.css' );
wp_enqueue_style( 'wiaas_admin_packages', $plugin_url . '/assets/css/wiaas-admin-package.css' );
wp_enqueue_script( 'wiaas_admin_packages', $plugin_url . '/assets/js/wiaas-admin-package.js' );
}
}

View File

@@ -43,7 +43,8 @@ class Wiaas_API {
include_once dirname( __FILE__ ) . '/api/class-wiaas-order-projects-api.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-package-api.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-wc-package-api-integration.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-support-api.php';
// API functions
include_once dirname( __FILE__ ) . '/api/wiaas-api-functions.php';
@@ -58,7 +59,7 @@ class Wiaas_API {
'Wiass_REST_User_API',
'Wiaas_REST_Customer_API',
'Wiaas_Order_Projects_API',
'Wiaas_Package_API'
'Wiaas_Support_Api',
);
foreach ( $controllers as $controller ) {

View File

@@ -9,192 +9,177 @@
*/
class Wiaas_Authentication {
const SUPER_ADMIN_USER_ID = 1;
const SUPER_ADMIN_USER_ID = 1;
public static function init() {
// authenticate current user
add_action('determine_current_user', array(__CLASS__, 'authenticate_current_user'), 999);
public static function init() {
// authenticate current user
add_action('determine_current_user', array(__CLASS__, 'authenticate_current_user'), 999);
// authenticates user on login
add_filter( 'authenticate', array( __CLASS__, 'authenticate_user_on_login' ), 999, 3);
// authenticates user on login
add_filter( 'authenticate', array( __CLASS__, 'authenticate_user_on_login' ), 999, 3);
// retrieve preferred user role for user
add_filter('get_user_metadata', array(__CLASS__, 'maybe_filter_user_roles'), 10, 3);
add_filter('jwt_auth_token_before_dispatch', array(__CLASS__, 'authenticate_rest_user_on_login'), 999, 2);
// redirect to dashboard after login
add_filter( 'login_redirect', array( __CLASS__, 'login_redirect' ) );
// redirect to dashboard after login
add_filter( 'login_redirect', array( __CLASS__, 'login_redirect' ) );
}
// add role selector to login form
add_action('login_form', array(__CLASS__, 'pick_role_on_login'));
}
/**
* Redirect admin user to dashboard
*
* @return string
*/
public static function login_redirect() {
return admin_url('index.php') ;
}
/**
* Add role selector to login form
*/
public static function pick_role_on_login() {
?>
<p>
<label for="user_role"><?php esc_html_e( 'Role' , 'wiaas'); ?><br />
<select id="user_role" class="input" name="role">
<option value="administrator"><?php esc_html_e('Administrator', 'wiaas') ?></option>
<option value="supplier"><?php esc_html_e('Supplier', 'wiaas') ?></option>
<option value="commercial_lead"><?php esc_html_e('Commercial Lead', 'wiaas') ?></option>
</select>
</p>
<?php
}
/**
* Redirect admin user to dashboard
*
* @return string
*/
public static function login_redirect() {
return admin_url('index.php') ;
}
/**
* Authenticate current user based on roles assigned to organization
*
* @param int|false $user_id
* @return int|false|WP_Error
*/
public static function authenticate_current_user($user_id) {
// do nothing if user not authenticated, user is super admin or this is REST API request
if (! $user_id || $user_id === self::SUPER_ADMIN_USER_ID) {
return $user_id;
}
/**
* Authenticate current user based on roles assigned to organization
*
* If this is non admin request successfully validate user if he can have customer role.
*
* If this is admin panel request successfully validate user if has admin panel role selected
* and also he still can have that role (role was not removed from his customer organization)
*
* @param int|false $user_id
* @return int|false|WP_Error
*/
public static function authenticate_current_user($user_id) {
// do nothing if user not authenticated, user is super admin or this is REST API request
if (! $user_id || (int) $user_id === self::SUPER_ADMIN_USER_ID) {
return $user_id;
}
$is_rest_api = strpos($_SERVER['REQUEST_URI'], rest_get_url_prefix());
global $current_user;
$role = $is_rest_api ?
'customer' :
get_user_meta($user_id, '_wiaas_current_user_admin_role', true);
if (empty($current_user)) {
$result = self::_can_user_have_role($user_id, $role, $is_rest_api);
$current_user = new WP_User($user_id);
}
if (is_wp_error($result)) {
return false;
}
$rest_api_slug = rest_get_url_prefix();
$valid_api_uri = strpos($_SERVER['REQUEST_URI'], $rest_api_slug);
return $user_id;
}
if ($valid_api_uri) {
//for non admin request check if user has customer role
$role = 'customer';
} else {
// for admin panel request check if user has selected role
$role = get_user_meta($user_id, '_wiaas_admin_role', true);
}
/**
* Authenticate wiaas user on login based on roles assigned to organization
*
* @param WP_User $user
* @return WP_User|WP_Error
*/
public static function authenticate_user_on_login($user) {
// check if rest request
$is_rest_api = strpos($_SERVER['REQUEST_URI'], rest_get_url_prefix());
// do nothing if there is an error already,
// user is super admin or
// this is rest request
if (is_wp_error($user) || $user->ID === 1 || $is_rest_api) {
return $user;
}
if ( empty($role) || ! user_can($user_id, 'wiaas_' . $role)) {
// not available roles for user
$current_user->set_role('');
if (empty($_POST['role'])) {
return new WP_Error('error', 'You must selected role to login!');
}
return new WP_Error('wiaas_authentication_error', 'No set permissions!', array(
'status' => 403,
));
}
// get selected role
$requested_role = sanitize_key($_POST['role']);
// authenticate valid admin panel user
$current_user->set_role($role);
// validate can user have requested role
$result = self::_can_user_have_role($user->ID, $requested_role, false);
return $user_id;
}
// if user organization has no requested role prevent access
if (is_wp_error($result)) {
return $result;
}
// remember role for user and continue
update_user_meta($user->ID, '_wiaas_current_user_admin_role', $requested_role);
return $user;
}
/**
* Authenticate wiaas user on login based on roles assigned to organization
*
* If this is non admin panel request authenticate user if he can be customer.
*
* If this is admin panel login request user will be authenticated with previously selected or first available role
* from his organization roles.
*
* @param WP_User $user
* @return WP_User|WP_Error
*/
public static function authenticate_user_on_login($user) {
// do nothing if there is an error already,
// user is super admin
if (is_wp_error($user) || $user->ID === self::SUPER_ADMIN_USER_ID ) {
return $user;
}
/**
*
* Filters user roles retrieval so that selected user role is retrieved for admin panel
* and customer role is retrieved for JSON API request
*
* @param $null
* @param int $user_id
* @param string $meta_key
* @return array|null
*/
public static function maybe_filter_user_roles($null, $user_id, $meta_key) {
global $wpdb;
if ($user_id !== 0 && $user_id !== self::SUPER_ADMIN_USER_ID && $meta_key === $wpdb->get_blog_prefix() . 'capabilities') {
$is_rest_api = strpos($_SERVER['REQUEST_URI'], rest_get_url_prefix());
$role = $is_rest_api ?
'customer' :
get_user_meta($user_id, '_wiaas_current_user_admin_role', true);
return array( array ( "$role" => true ));
}
return null;
}
$rest_api_slug = rest_get_url_prefix();
$valid_api_uri = strpos($_SERVER['REQUEST_URI'], $rest_api_slug);
/**
* CUSTOMER API AUTHENTICATION
*/
// validate customer user login
if ($valid_api_uri) {
// PRIVATE
$role = user_can($user->ID, 'wiaas_customer') ? 'customer' : '';
$user->set_role($role);
/**
* Determines if user can have requested role based on his organization roles
*
* @param int $user_id
* @param string $user_role
* @param bool $is_rest_api
* @return bool|WP_Error
*/
private static function _can_user_have_role($user_id, $user_role, $is_rest_api) {
// check if role valid for access
if (! wp_roles()->is_role($user_role)) {
return new WP_Error('error', 'Role is not valid!');
}
return empty($role) ?
new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array(
'status' => 403,
)) :
$user;
}
// only customer role can access API
if ($is_rest_api && $user_role !== 'customer') {
return new WP_Error('error', 'No access!');
}
/**
* ADMIN PANEL AUTHENTICATION
*/
// customer role cannot access admin backend
if (! $is_rest_api && $user_role === 'customer') {
return new WP_Error('error', 'No access!');
}
// retrieve selected role for user
$role = get_user_meta($user->ID, '_wiaas_admin_role', true);
// if user has selected role then use it
if (! empty($role) && user_can($user->ID, 'wiaas_' . $role)) {
return $user;
}
// import organization functions (during user authentication it is not yet loaded)
require_once dirname( __FILE__ ) . '/user/wiaas-organization-functions.php';
// user does not have selected role so try to assign one in order of access
if (user_can($user->ID, 'wiaas_administrator')) {
$role = 'administrator';
} else if (user_can($user->ID, 'wiaas_commercial_lead')) {
$role = 'commercial_lead';
} else if (user_can($user->ID, 'wiaas_supplier')) {
$role = 'supplier';
}
// get user organization
$organization_id = wiaas_get_user_organization_id($user_id);
if (empty($role)) {
return new WP_Error('wiaas_authentication_error', 'No permissions!', array(
'status' => 403,
));
}
// validate if user has organization
if (empty( $organization_id)) {
return new WP_Error('error', 'Account not completed!');
}
// get organization roles
$roles = wiaas_get_organization_roles($organization_id);
update_user_meta($user->ID, '_wiaas_admin_role', $role);
// validate if user has organization roles
if (!in_array($user_role, $roles)) {
return new WP_Error( 'error', 'Your account is not authorized for requested role. Please contact us for help.' );
}
$user->set_role($role);
return $user;
}
/**
* validate that successfully logged in rest api user can be customer
*
* @param array $data
* @param WP_User $user
* @return array | WP_Error
*
*/
public static function authenticate_rest_user_on_login($data, $user) {
// if admin do nothing
if ($user->ID === self::SUPER_ADMIN_USER_ID) {
return $data;
}
$role = user_can($user->ID, 'wiaas_customer') ? 'customer' : '';
$user->set_role($role);
return empty($role) ?
new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array(
'status' => 403,
)) :
$data;
}
return true;
}
}
Wiaas_Authentication::init();

View File

@@ -21,11 +21,23 @@ class Wiaas_Cart {
public static function init() {
add_action( 'woocommerce_checkout_create_order_line_item', array( __CLASS__, 'add_order_item_meta' ), 10, 3 );
add_filter( 'woocommerce_hidden_order_itemmeta', array( __CLASS__, 'hidden_order_item_meta' ) );
add_action( 'woocommerce_before_calculate_totals', array( __CLASS__, 'on_calculate_totals' ), 99, 1);
add_action( 'woocommerce_cart_loaded_from_session', array( __CLASS__, 'on_calculate_totals' ), 99, 1);
add_action('woocommerce_checkout_create_order', array(__CLASS__, 'add_additional_order_data'), 99);
add_action('woocommerce_set_cart_cookies', array(__CLASS__, 'do_not_set_cart_cookies'));
}
/**
* Do not set cart cookies
*/
public static function do_not_set_cart_cookies() {
if ( isset( $_COOKIE['woocommerce_items_in_cart'] ) ) {
wc_setcookie( 'woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS );
wc_setcookie( 'woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS );
}
}
/**
@@ -114,12 +126,13 @@ class Wiaas_Cart {
*
* @param int $package_id Package ID of selected package
* @param string $price_id Price ID of selected package payment
* @param int $shop_owner_id Shop owner commercial lead ID
* @param array $addons_ids Array of selected additional packages IDs
* @param array $options_ids Array of selected option packages IDs
*
* @return bool TRUE if all packages are succesfully added to cart, FALSE otherwise
*/
public static function add_package_to_cart($package_id, $price_id, $addons_ids, $options_ids) {
public static function add_package_to_cart($package_id, $price_id, $shop_owner_id, $addons_ids, $options_ids) {
// try adding package to cart
try {
// Check if package is in cart
@@ -137,19 +150,53 @@ class Wiaas_Cart {
//Check if package is available for adding to cart
if (Wiaas_Package_Status::get_package_status($package_id) !== Wiaas_Package_Status::AVAILABLE){
wc_add_notice('Package cannot be purchased at the moment', 'error');
wc_add_notice('Package cannot be purchased at the moment!', 'error');
return false;
}
// Retrieve package country
$country = Wiaas_Countries::get_package_country($package);
// TODO: Change this so commercial lead is sent via request
if (empty($country)) {
wc_add_notice('Package cannot be added do cart!', 'error');
return false;
}
// Validate that order contains only stuff from single commercial lead / reseller / shop owner
if ( ! WC()->cart->is_empty() ) {
$current_shop_owner_id = get_user_meta(get_current_user_id(), '_wiaas_cart_shop_owner_id', true);
if (absint($shop_owner_id) !== absint($current_shop_owner_id)) {
wc_add_notice('Only packages from one catalogue can be purchased at the same time!', 'error');
return false;
}
} else {
update_user_meta( get_current_user_id(), '_wiaas_cart_shop_owner_id', $shop_owner_id);
}
// Validate that order contains only items for single country
if ( ! WC()->cart->is_empty() ) {
$current_country = get_user_meta(get_current_user_id(), '_wiaas_cart_items_country', true);
if ($country !== $current_country) {
wc_add_notice('Only packages from one country can be purchased at the same time!', 'error');
return false;
}
} else {
update_user_meta( get_current_user_id(), '_wiaas_cart_items_country', $country);
}
$customer_id = wiaas_get_current_user_organization_id();
$commercial_lead_id = array_keys(wiaas_get_commercial_leads())[0];
// Retrieve package price
$package_prices = Wiaas_Pricing::get_standard_package_customer_prices($package, $customer_id, $commercial_lead_id);
$package_prices = Wiaas_Pricing::get_standard_package_customer_prices($package, $customer_id, $shop_owner_id);
$selected_price_index = array_search($price_id, array_column($package_prices, 'id'));
// Initialize additional cart item data for wiaas packages
@@ -157,7 +204,6 @@ class Wiaas_Cart {
'_wiaas_standard_package' => true,
'_wiaas_addon_items' => array(),
'_wiaas_option_items' => array(),
'_wiaas_currency' => isset($country) ? $country['currency'] : get_woocommerce_currency(),
'_wiaas_payment' => $package_prices[$selected_price_index] ? $package_prices[$selected_price_index] : null,
'_wiaas_documents' => array()
);
@@ -170,7 +216,7 @@ class Wiaas_Cart {
}
// Add selected additional packages and options
self::_add_additional_packages_to_cart($cart_item_key, $price_id, $addons_ids, $options_ids);
self::_add_additional_packages_to_cart($cart_item_key, $price_id, $shop_owner_id, $addons_ids, $options_ids);
// Trigger calculation of total prices after additional packages are added
WC()->cart->calculate_totals();
@@ -224,6 +270,10 @@ class Wiaas_Cart {
* @return bool
*/
public static function update_package_quantity($package_cart_item_key, $new_quantity) {
if ($new_quantity > 65000){
return false;
}
$cart_item = WC()->cart->get_cart_item($package_cart_item_key);
if (!$cart_item) {
@@ -270,8 +320,12 @@ class Wiaas_Cart {
}
/**
* Persist used payment type information for package in corresponding order line item.
* Also for standard package type list of addons and options will be saved.
* Persist additional metadata for every order item
* This includes:
*
* 1. payment info
* 2. relation info for addons and options
* 3. prices for simple products
*
* @param $order_item
* @param $cart_item_key
@@ -281,7 +335,11 @@ class Wiaas_Cart {
* @return WC_Order_Item
*/
public static function add_order_item_meta( $order_item, $cart_item_key, $cart_item ) {
if (wc_pb_is_bundle_container_cart_item($cart_item) && isset($cart_item['_wiaas_payment'])) {
$is_bundle_item = wc_pb_is_bundle_container_cart_item($cart_item);
$is_bundled_item = wc_pb_is_bundled_cart_item($cart_item);
if ($is_bundle_item && isset($cart_item['_wiaas_payment'])) {
$payment = $cart_item['_wiaas_payment'];
@@ -299,9 +357,6 @@ class Wiaas_Cart {
if (isset($cart_item['_wiaas_standard_package'])) {
$order_item->add_meta_data( '_wiaas_standard_package', $cart_item['_wiaas_standard_package'], true );
}
if (isset($cart_item['_wiaas_currency'])) {
$order_item->add_meta_data( '_wiaas_currency', $cart_item['_wiaas_currency'], true );
}
// add options metadata
if (isset($cart_item['_wiaas_option_items'])) {
@@ -353,35 +408,141 @@ class Wiaas_Cart {
$order_item->add_meta_data( '_wiaas_documents', $item_documents, true );
}
// save simple product information that needs to be available later on
// even if this data is changed or removed from product at that time
if($is_bundled_item) {
$product = wc_get_product($cart_item['product_id']);
$order_item->add_meta_data('_wiaas_category', Wiaas_Product_Category::get_category($product), true);
$order_item->add_meta_data('_wiaas_manufacturer_product_no', $product->get_meta('_manufacturer_product_no'), true);
$order_item->add_meta_data('_wiaas_supplier_product_no', $product->get_meta('_supplier_product_no'), true);
// get supplier
if ($supplier_organization_id = Wiaas_Product_Supplier::get_supplier_organisation_id_from_product($cart_item['product_id'])) {
$order_item->add_meta_data('_wiaas_supplier_organization_id', $supplier_organization_id, true);
}
// save bundled product item total cost (price x period)
$product_price = Wiaas_Pricing::get_product_total_cost($product);
$order_item->add_meta_data('_wiaas_product_price', $product_price, true);
}
// save number of days before earliest installation for bundles
if ($is_bundle_item) {
$order_item->add_meta_data(
'_wiaas_earliest_installation_additional_days',
Wiaas_Package::get_earliest_installation_additional_days($cart_item['product_id']),
true);
}
return $order_item;
}
/**
* Mark extended properties for order as hidden
* @param $hidden
* Sets additional order data form cart after order is successfully created
*
* @param WC_Order $order
*
* @throws WC_Data_Exception
*
* @return array
*/
public static function hidden_order_item_meta( $hidden ) {
public static function add_additional_order_data($order) {
// set order currency
$country = get_user_meta(get_current_user_id(), '_wiaas_cart_items_country', true);
$currency = empty($country) ? get_woocommerce_currency() : $country['currency'];
$order->add_meta_data('_wiaas_country_code', $country['code']);
$order->set_currency($currency);
// get order commercial lead
$shop_owner_id = get_user_meta(get_current_user_id(), '_wiaas_cart_shop_owner_id', true);
$shop_owner_id = absint($shop_owner_id);
// save commercial lead info in case it gets deleted
$order->add_meta_data('_wiaas_commercial_lead_id', $shop_owner_id);
$commercial_lead_organization_info = wiaas_get_organization_info($shop_owner_id);
$order->add_meta_data('_wiaas_commercial_lead_info', $commercial_lead_organization_info);
// save customer organization info in case it gets deleted
$customer_user_id = $order->get_customer_id();
$customer_organization_id = wiaas_get_user_organization_id($customer_user_id);
$order->add_meta_data('_wiaas_customer_id', $customer_organization_id);
$customer_organization_info = wiaas_get_organization_info($customer_organization_id);
$order->add_meta_data('_wiaas_customer_info', $customer_organization_info);
// add supplier organizations information to order in case supplier organizations are deleted
// save installation suppliers separately
$suppliers_info = array();
$installation_suppliers_info = array();
$items = $order->get_items('line_item');
foreach($items as $item) {
$supplier_organization_id = $item['wiaas_supplier_organization_id'];
if (! empty($supplier_organization_id) && $item['wiaas_category'] !== 'installation' &&
empty($suppliers_info[$supplier_organization_id]) ) {
$suppliers_info[$supplier_organization_id] = array(
'id' => $supplier_organization_id,
'estimated_delivery_date' => null,
'confirmed_delivery_date' => null,
'tracking_info' => array(),
);
$supplier_organization_info = wiaas_get_organization_info($supplier_organization_id);
foreach ($supplier_organization_info as $key => $info) {
$suppliers_info[$supplier_organization_id][$key] = $info;
}
}
if (! empty($supplier_organization_id) && $item['wiaas_category'] === 'installation' &&
empty($installation_suppliers_info[$supplier_organization_id]) ) {
$installation_suppliers_info[$supplier_organization_id] = array(
'id' => $supplier_organization_id,
);
$supplier_organization_info = wiaas_get_organization_info($supplier_organization_id);
foreach ($supplier_organization_info as $key => $info) {
$installation_suppliers_info[$supplier_organization_id][$key] = $info;
}
}
}
$order->add_meta_data('_wiaas_delivery_suppliers', $suppliers_info, true);
$order->add_meta_data('_wiaas_installation_suppliers', $installation_suppliers_info, true);
// add additional date fields to order
$order->add_meta_data('_wiaas_estimated_delivery_date', null, true);
$order->add_meta_data('_wiaas_final_estimated_delivery_date', null, true);
$order->add_meta_data('_wiaas_final_confirmed_delivery_date', null, true);
$order->add_meta_data('_wiaas_earliest_installation_date', null, true);
// calculate number of days before earlier installation for whole order
$earliest_installation_additional_days = 0;
$items = $order->get_items('line_item');
foreach($items as $item) {
if (! empty($item['_wiaas_earliest_installation_additional_days'])) {
$additional_days = absint($item['_wiaas_earliest_installation_additional_days']);
$earliest_installation_additional_days = max($additional_days, $earliest_installation_additional_days);
}
}
$order->add_meta_data('_wiaas_order_additional_days_prior_installation', $earliest_installation_additional_days, true);
return array_merge( $hidden, array(
'_wiaas_payment_type',
'_wiaas_services_extra',
'_wiaas_service_contract_period',
'_wiaas_max_contract_period',
'_wiaas_period_unit',
'_wiaas_recurrent_extra',
'_wiaas_pay_period',
'_wiaas_addon_items',
'_wiaas_addon_for',
'_wiaas_option_items',
'_wiaas_option_for',
'_wiaas_option_group_name',
'_wiaas_standard_package',
'_wiaas_currency',
'_wiaas_documents'
) );
}
/**
@@ -451,6 +612,9 @@ class Wiaas_Cart {
public static function get_cart_packages() {
$items = WC()->cart->get_cart_contents();
$shop_owner_id = get_user_meta(get_current_user_id(), '_wiaas_cart_shop_owner_id', true);
$shop_owner_id = absint($shop_owner_id);
$package_items = array();
foreach ($items as $key => $item) {
@@ -500,8 +664,8 @@ class Wiaas_Cart {
'package_name' => $package->get_title(),
'quantity' => $item['quantity'],
'commercial_lead_id' => 14,
'commercial_lead' => 'Coor Service Management',
'commercial_lead_id' => $shop_owner_id,
'commercial_lead' => wiaas_get_organization_name($shop_owner_id),
'country' => Wiaas_Countries::get_package_country($package),
'are_additional_available' => true,
@@ -542,6 +706,7 @@ class Wiaas_Cart {
$documents_ids = array();
// Retrieve all document ids attached to cart content
foreach ($items as $key => $item) {
if (!isset($item['_wiaas_standard_package'])) {
continue;
@@ -559,16 +724,19 @@ class Wiaas_Cart {
}
}
// Retrieve all customer visible template documents attached to cart content
$q = new WP_Query();
$retrieved_items = $q->query(array(
'post_status' => 'publish',
'post_type' => 'wiaas_doc',
'post__in' => array_keys($documents_ids),
'meta_key' => '_wiaas_doc_visible',
'meta_value' => 'yes', // visible to customer
'tax_query' => array(
array(
'taxonomy' => 'wiaas_doc_type',
'field' => 'slug',
'terms' => array_keys(self::$cart_doc_types),
'terms' => array_keys(self::$cart_doc_types), // templates only
)
)
));
@@ -636,21 +804,20 @@ class Wiaas_Cart {
*
* @param string $package_cart_item_key
* @param int $price_id
* @param int $shop_owner_id
* @param array $addons_ids
* @param array $options_ids
*
* @throws Exception if any of the addons or options cannot be added to cart
*/
private static function _add_additional_packages_to_cart($package_cart_item_key, $price_id, $addons_ids, $options_ids) {
private static function _add_additional_packages_to_cart($package_cart_item_key, $price_id, $shop_owner_id, $addons_ids, $options_ids) {
$parent_item = WC()->cart->get_cart_item($package_cart_item_key);
$addon_items_keys = array();
$option_items_keys = array();
// TODO: Change this so commercial lead is sent via request
$customer_id = wiaas_get_current_user_organization_id();
$commercial_lead_id = array_keys(wiaas_get_commercial_leads())[0];
// Try adding package addons to cart
foreach ($addons_ids as $addon_id) {
@@ -665,7 +832,7 @@ class Wiaas_Cart {
$addon_package,
$parent_item['data'],
$customer_id,
$commercial_lead_id
$shop_owner_id
);
$selected_price_index = array_search($price_id, array_column($package_prices, 'id'));
@@ -702,7 +869,7 @@ class Wiaas_Cart {
$option_package,
$parent_item['data'],
$customer_id,
$commercial_lead_id);
$shop_owner_id);
$selected_price_index = array_search($price_id, array_column($package_prices, 'id'));
// Retrieve option package group name

View File

@@ -65,7 +65,8 @@ class Wiaas_Checkout {
do_action( 'woocommerce_checkout_order_processed', $order_id, array(), $order );
$order->payment_complete();
//Change order status from default 'Pending payment' to open (custom wiaas status)
$order->update_status('open');
WC()->cart->empty_cart( true );
@@ -83,14 +84,6 @@ class Wiaas_Checkout {
* @param array $data
*/
private static function _add_wiaas_checkout_data($order, $data) {
// save currency
$line_items = $order->get_items();
foreach ($line_items as $line_item) {
if (isset($line_item['wiaas_currency'])) {
$order->set_currency($line_item['wiaas_currency']);
break;
}
}
// save additional wiaas order info
Wiaas_Order::set_order_vat($order->get_id(), $data['vat']);
@@ -102,6 +95,7 @@ class Wiaas_Checkout {
if (isset($data['project_id'])) {
Wiaas_Order_Project::set_project_for_order($order->get_id(), $data['project_id']);
}
}
}

View File

@@ -12,28 +12,19 @@ if ( ! defined( 'ABSPATH' ) ) {
class Wiaas_Countries {
/**
* Available countries for wiaas
* Default available countries for wiaas
* @var array
*/
private static $available_countries = array(
'Sweden' => array(
'id' => 1,
'name' => 'Sweden',
'code' => 'se',
private static $default_countries = array(
'se' => array(
'vat' => 9 ,
'currency' => 'SEK'
),
'Denmark' => array(
'id' => 2,
'name' => 'Denmark',
'code' => 'dk',
'dk' => array(
'vat' => 9 ,
'currency' => 'DKK'
),
'Finland' => array(
'id' => 3,
'name' => 'Finland',
'code' => 'fi',
'fi' => array(
'vat' => 9 ,
'currency' => 'EUR'
),
@@ -44,22 +35,101 @@ class Wiaas_Countries {
add_action('woocommerce_after_register_taxonomy', array(__CLASS__, 'register_product_countries_taxonomy'));
}
public static function get_list_of_countries(){
$result = [];
foreach(self::$available_countries as $country){
array_push($result, array(
'country_id' => $country['id'],
'country_name' => $country['name']
));
/**
* Retrieve all possible country choices
*
* @return array
*/
public static function get_country_choices() {
$countries = new WC_Countries();
$choices = array();
foreach ($countries->get_countries() as $code => $name) {
$choices[strtolower($code)] = $name;
}
return $result;
return $choices;
}
public static function get_country_name_by_id($id){
foreach(self::$available_countries as $country){
if ($country['id'] == $id) return $country['name'];
/**
* Retrieve all possible currency choices
*
* @return array
*/
public static function get_currency_choices() {
return get_woocommerce_currencies();
}
/**
* Retrieve list of available countries setup by administrator
*
* @return array
*/
public static function get_available_countries() {
$available_countries = [];
$available_country_terms = get_terms(array(
'taxonomy' => 'product_country',
'hide_empty' => false,
));
foreach($available_country_terms as $country_term) {
$code = get_term_meta($country_term->term_id, '_wiaas_country_code', true);
$currency = get_term_meta($country_term->term_id, '_wiaas_country_currency', true);
$vat = get_term_meta($country_term->term_id, '_wiaas_country_vat', true);
$available_countries[] = array(
'id' => $country_term->term_id,
'name' => $country_term->name,
'code' => $code,
'currency' => $currency,
'vat' => $vat
);
}
return '';
return $available_countries;
}
/**
* Retrieve country name by code for available country
*
* @param string $code
*
* @return string|null
*/
public static function get_available_country_name_by_code($code) {
$available_countries = self::get_available_countries();
foreach ($available_countries as $available_country) {
if ($available_country['code'] === $code) {
return $available_country['name'];
}
}
return null;
}
/**
* Retrieve country code by currency for available country
*
* @param string $currency
*
* @return string|null
*/
public static function get_available_country_code_by_currency($currency) {
$available_countries = self::get_available_countries();
foreach ($available_countries as $available_country) {
if ($available_country['currency'] === $currency) {
return $available_country['code'];
}
}
return null;
}
/**
@@ -93,8 +163,27 @@ class Wiaas_Countries {
register_taxonomy( 'product_country', array( 'product' ), $args );
foreach (self::$available_countries as $available_country) {
wp_insert_term($available_country['name'], 'product_country');
$choices = self::get_country_choices();
foreach (self::$default_countries as $code => $info) {
$name = $choices[$code];
if (has_term($name)) {
// bail out
return;
}
$name = $choices[$code];
$result = wp_insert_term($name, 'product_country');
if (is_wp_error($result)) {
continue;
}
update_term_meta($result['term_id'], '_wiaas_country_code', $code);
update_term_meta($result['term_id'], '_wiaas_country_currency', $info['currency']);
update_term_meta($result['term_id'], '_wiaas_country_vat', $info['vat']);
}
}
@@ -114,12 +203,40 @@ class Wiaas_Countries {
*
* @return array|null
*/
public static function get_product_country($product) {
$product_country = get_the_terms($product->get_id(), 'product_country');
return is_array($product_country) && isset($product_country[0]) ?
self::$available_countries[$product_country[0]->name] :
null;
public static function get_product_country($product) {
$country_terms = get_the_terms($product->get_id(), 'product_country');
if (is_wp_error($country_terms) || empty($country_terms) || empty($country_terms[0])) {
return null;
}
$country_term = $country_terms[0];
$code = get_term_meta($country_term->term_id, '_wiaas_country_code', true);
$currency = get_term_meta($country_term->term_id, '_wiaas_country_currency', true);
$vat = get_term_meta($country_term->term_id, '_wiaas_country_vat', true);
return array(
'id' => $country_term->term_id,
'name' => $country_term->name,
'code' => $code,
'currency' => $currency,
'vat' => $vat
);
}
/**
* Retrieves country term id from db for provided product
* @param $product
*
* @return int|null
*/
public static function get_product_country_term_id($product) {
$product_country = get_the_terms($product->get_id(), 'product_country');
return is_array($product_country) && isset($product_country[0]) ?
$product_country[0]->term_id :
null;
}
}
Wiaas_Countries::init();

View File

@@ -5,22 +5,32 @@ defined( 'ABSPATH' ) || exit;
class Wiaas_DB_Update {
private static $db_updates = array(
'20180728222206' => 'wiaas_db_update_enable_product_by_user_role',
'20180801222206' => 'wiaas_db_update_setup_gravity',
'20180802222206' => 'wiaas_db_update_add_delivery_process_forms',
'20180811134511' => 'wiaas_db_update_enable_orders_access_management',
'20180813134511' => 'wiaas_db_update_enable_order_numbers',
'20180826153509' => 'wiaas_create_broker_access_group',
'20180911101010' => 'wiaas_db_setup_exclusive_taxonomies',
'20181003164100' => 'wiaas_db_setup_customer_capabilities',
'201810111644700' => 'wiaas_db_update_add_organization_info_ui_fields',
'201810121644700' => 'wiaas_db_update_add_user_organization_ui_fields',
'201810171645700' => 'wiaas_db_update_create_default_roles',
'201810171745700' => 'wiaas_db_import_aam_role_settings',
'201810173045700' => 'wiaas_db_update_update_commercial_lead_capabilities',
'201810173145700' => 'wiaas_db_update_update_supplier_capabilities',
'201810173245700' => 'wiaas_db_update_update_admin_capabilities',
'201810173345700' => 'wiaas_create_role_access_groups'
'20181012164450' => 'wiaas_db_update_add_user_organization_ui_fields',
'20181017164550' => 'wiaas_db_update_create_default_roles',
'20181017174550' => 'wiaas_db_import_aam_role_settings',
'20181018014550' => 'wiaas_db_update_update_supplier_capabilities',
'20181018024550' => 'wiaas_db_update_update_admin_capabilities',
'20181018034550' => 'wiaas_admin_create_role_access_groups',
'20181018044450' => 'wiaas_db_setup_create_customer_commercial_lead_table',
'20181018054450' => 'wiaas_db_update_update_commercial_lead_capabilities',
'20181018064450' => 'wiaas_db_update_add_organization_info_ui_fields',
'20181019014550' => 'wiaas_db_update_add_general_ui_fields',
'20181019014650' => 'wiaas_db_update_add_product_properties_ui_fields',
'20181020014650' => 'wiaas_create_organization_roles_capabilities',
'20181021162450' => 'wiaas_db_update_update_supplier_order_capabilities',
'20181102112451' => 'wiaas_disable_processing_order_email_delivery',
'20181103172850' => 'wiaas_db_update_update_delivery_forms',
'20181104182856' => 'wiaas_db_update_enable_workflow_inbox_for_roles',
'20181105133550' => 'wiaas_db_update_add_bundle_properties_ui_field',
'20181106133553' => 'wiaas_db_update_add_installation_date_delivery_action_form',
'20181125133553' => 'wiaas_db_update_add_country_settings_ui_fields',
'20181125143553' => 'wiaas_db_migration_fix_user_profile_addresses', // remove after migration
'20181125153553' => 'wiaas_db_migration_fix_countries', // remove after migration,
'20181203115826' => 'wiaas_db_update_add_administrator_delivery_process_capabilities'
);
public static function execute() {

View File

@@ -0,0 +1,11 @@
<?php
class Wiaas_DB {
public static function init() {
require_once dirname( __FILE__ ) . '/db/class-wiaas-shop-db.php';
}
}
Wiaas_DB::init();

View File

@@ -10,53 +10,199 @@ defined( 'ABSPATH' ) || exit;
class Wiaas_Delivery_Process {
private static $process_form_title_prefix = 'DELIVERY PROCESS:';
public static function init() {
self::_register_delivery_process_step_type();
self::_register_delivery_process();
self::_init_hooks();
}
private static function _init_hooks() {
add_action('woocommerce_new_order', array( __CLASS__, 'create_delivery_process_for_order' ));
add_filter( 'gform_entry_meta', array(__CLASS__, 'extend_gravity_form_entry_meta'), 10, 2 );
add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_process_step'), 5, 3 );
add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 3 );
// Some temporary functions to make inbox page prettier
add_filter('gravityflow_inbox_submitter_name', array(__CLASS__, 'display_step_name_in_inbox'), 10, 3);
add_filter('gravityflow_approve_label_workflow_detail', array(__CLASS__, 'approval_step_approval_label'), 10, 2);
add_filter('gravityflow_reject_label_workflow_detail', array(__CLASS__, 'approval_step_reject_label'), 10, 2);
add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 2 );
}
public static function approval_step_approval_label($label, $step) {
if ($step->get_name() === 'Complete step') {
return esc_html__( 'Complete step', 'wiaas' );
}
return $label;
}
public static function approval_step_reject_label($label, $step) {
if ($step->get_name() === 'Complete step') {
return esc_html__( 'Cancel', 'wiaas' );
}
return $label;
}
public static function display_step_name_in_inbox($name, $entry, $form) {
return $entry['wiaas_delivery_step_name'];
}
/**
* Registers our Delivery Process Step Type as available Gravity Flow Step Type
*
* Registers our Delivery Process Addons
*
*/
private static function _register_delivery_process_step_type() {
private static function _register_delivery_process() {
require_once( 'delivery-process/class-wiaas-delivery-process-addon.php' );
require_once( 'delivery-process/class-wiaas-delivery-process-action.php' );
require_once( 'delivery-process/class-wiaas-delivery-process-step-assignee.php' );
require_once( 'delivery-process/class-wiaas-delivery-process-step.php' );
// order fields
require_once( 'delivery-process/class-wiaas-order-fields.php' );
require_once( 'delivery-process/class-wiaas-field-order-number.php' );
require_once( 'delivery-process/class-wiaas-field-order-bundle.php' );
require_once( 'delivery-process/class-wiaas-field-order-installation-select.php' );
require_once( 'delivery-process/class-wiaas-field-order-bundle-document.php' );
require_once( 'delivery-process/class-wiaas-field-order-document.php' );
require_once( 'delivery-process/class-wiaas-field-order-bundle-installation-date.php' );
// merge tags (for emails)
require_once( 'delivery-process/class-wiaas-merge-tag-customer-order-url.php' );
Gravity_Flow_Steps::register( new Wiaas_Delivery_Process_Step() );
GFAddOn::register( 'Wiaas_Delivery_Process_Addon' );
}
public static function create_delivery_process_for_order($order_id, $process_id) {
$process_form = null;
$process_form = GFAPI::get_form($process_id);
if( $process_form ) {
$new_process_entry = array(
'wiaas_delivery_order_id' => $order_id,
'form_id' => $process_id,
);
$order_fields = GFCommon::get_fields_by_type($process_form, array('wiaas_order'));
if (! empty($order_fields)) {
$order_field = $order_fields[0];
$new_process_entry[$order_field['id']] = $order_id;
}
$process_entry_id = GFAPI::add_entry( $new_process_entry );
update_post_meta($order_id, 'wiaas_delivery_process_id', $process_id);
update_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id);
$order = wc_get_order($order_id);
$order->set_status('processing', 'Started order delivery process.', true);
$order->save();
return $process_entry_id;
}
return false;
}
/**
* Delivery dates cannot be set if:
* - user cannot edit delivery dates
* - actions for customer config validation is not done
* - action for customer acceptance is active or completed
*
* @param int $order_id
* @param mixed $delivery_process_entry
* @param array $steps
*
* @return bool
*/
public static function can_delivery_dates_be_set($order_id, $delivery_process_entry = null, $steps = null) {
if ( empty($delivery_process_entry) ) {
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
}
if (empty($delivery_process_entry) || ! GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
return false;
}
$workflow_api = new Gravity_Flow_API($delivery_process_entry['form_id']);
$current_step = $workflow_api->get_current_step($delivery_process_entry);
if ( empty($steps) ) {
$steps = $workflow_api->get_steps();
}
foreach ($steps as $step) {
$step = $workflow_api->get_step($step->get_id(), $delivery_process_entry);
// customer validation not done
if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_validate_questionnaires_action($step) &&
$step->get_status() !== 'complete') {
return false;
}
// customer acceptance is active or completed
if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_acceptance_action($step) &&
($current_step && $step->get_id() === $current_step->get_id() || $step->get_status() === 'complete')) {
return false;
}
}
return true;
}
public static function get_next_actions_for_current_user() {
$current_user = wp_get_current_user();
$field_filters = array();
$field_filters[] = array(
'key' => 'workflow_user_id_' . $current_user->ID,
'value' => 'pending',
);
$user_roles = gravity_flow()->get_user_roles();
foreach ( $user_roles as $user_role ) {
$field_filters[] = array(
'key' => 'workflow_role_' . $user_role,
'value' => 'pending',
);
}
$field_filters['mode'] = 'any';
$search_criteria = array();
$search_criteria['field_filters'] = $field_filters;
$search_criteria['status'] = 'active';
$form_ids = gravity_flow()->get_workflow_form_ids();
$entries = GFAPI::get_entries(
$form_ids,
$search_criteria,
null,
null);
$actions = array();
foreach ($entries as $entry) {
$order_id = $entry['wiaas_delivery_order_id'];
$order = wc_get_order($order_id);
if (! $order) {
continue;
}
$step = gravity_flow()->get_step( $entry['workflow_step'] );
if (!$step) {
continue;
}
$action = array(
'order_id' => $order_id,
'order_number' => $order->get_order_number(),
'action_title' => $step->get_name()
);
if (is_admin()) {
$action['url'] = '?page=gravityflow-inbox&view=entry&id=' . $entry['form_id'] . '&lid=' . $entry['id'];
}
$actions[] = $action;
}
return $actions;
}
/**
@@ -65,9 +211,10 @@ class Wiaas_Delivery_Process {
* @param $form
*/
public static function maybe_complete_parent_order($entry_id, $form) {
$entry = GFAPI::get_entry($entry_id);
$order_id = $entry['wiaas_delivery_order_id'];
$order_id = $entry['wiaas_delivery_order_id'];
if (!isset($order_id)) {
return;
@@ -76,12 +223,170 @@ class Wiaas_Delivery_Process {
$process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id', true);
// order process entry completed, so complete order
if (absint($process_entry_id) === $entry_id) {
if (absint($process_entry_id) === absint($entry_id)) {
$order = wc_get_order($order_id);
$order->update_status('completed', 'Completed order delivery process.', true);
}
}
public static function get_available_process_list_for_country($country_code) {
$forms = GFAPI::get_forms();
$available_process_forms = array();
foreach ($forms as $form) {
$delivery_settings = rgar($form, 'wiaas_delivery_process');
if ($delivery_settings['delivery_form_type'] === 'process' &&
$delivery_settings['delivery_country'] === $country_code) {
$available_process_forms[] = $form;
}
}
return $available_process_forms;
}
public static function get_customer_acceptance_data($order_id) {
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
$data = array();
if (! empty($delivery_process_entry)) {
$workflow = new Gravity_Flow_API($delivery_process_entry['form_id']);
$step = $workflow->get_current_step($delivery_process_entry);
if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_acceptance_action($step)) {
$action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step);
$action_entry = $action_entries[0];
$data[] = Wiaas_Delivery_Process_Action::get_customer_acceptance_action_data($action_entry['id']);
}
}
return empty( $data ) ? $data : $data[0];
}
public static function get_customer_questionnaires_data($order_id) {
$data = array();
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
if (! empty($delivery_process_entry)) {
$workflow = new Gravity_Flow_API($delivery_process_entry['form_id']);
$step = $workflow->get_current_step($delivery_process_entry);
if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_validate_questionnaires_action($step)) {
$action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step);
foreach ($action_entries as $action_entry) {
$action_data = Wiaas_Delivery_Process_Action::get_customer_validate_questionnaires_action_data($action_entry['id']);
if (! empty($action_data)) {
$data[] = $action_data;
}
}
}
}
return $data;
}
public static function update_customer_acceptance_status($order_id, $status, $reason) {
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
if (! empty($delivery_process_entry) ) {
$workflow = new Gravity_Flow_API($delivery_process_entry['form_id']);
$step = $workflow->get_current_step($delivery_process_entry);
$action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step);
$action_entry = $action_entries[0];
Wiaas_Delivery_Process_Action::update_customer_acceptance_status($action_entry['id'], $status, $reason);
}
}
public static function is_customer_acceptance_uploaded($order_id) {
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
if (! empty($delivery_process_entry) ) {
$workflow = new Gravity_Flow_API($delivery_process_entry['form_id']);
$step = $workflow->get_current_step($delivery_process_entry);
$action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step);
$action_entry = $action_entries[0];
return Wiaas_Delivery_Process_Action::is_customer_acceptance_uploaded($action_entry['id']);
}
return false;
}
public static function upload_customer_questionnaire($order_id, $action_entry_id) {
Wiaas_Delivery_Process_Action::upload_customer_questionnaire($action_entry_id);
}
public static function upload_customer_acceptance_document($order_id) {
$delivery_process_entry = self::get_order_delivery_process_entry($order_id);
if (! empty($delivery_process_entry) ) {
$workflow = new Gravity_Flow_API($delivery_process_entry['form_id']);
$step = $workflow->get_current_step($delivery_process_entry);
$action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step);
$action_entry = $action_entries[0];
$success = Wiaas_Delivery_Process_Action::upload_customer_acceptance_document($action_entry['id']);
return $success;
}
return false;
}
public static function get_order_delivery_process_entry($order_id) {
$order = wc_get_order($order_id);
$process_entry_id = $order->get_meta('wiaas_delivery_process_entry_id', true);
if (empty($process_entry_id)) {
return array();
}
return GFAPI::get_entry($process_entry_id);
}
/**
* Retrieves delivery process instance for order
*
@@ -91,8 +396,9 @@ class Wiaas_Delivery_Process {
*/
public static function get_order_delivery_process($order_id) {
$process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id');
if (!isset($process_entry_id)) {
$process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id', true);
if (empty($process_entry_id)) {
return null;
}
@@ -107,114 +413,57 @@ class Wiaas_Delivery_Process {
$delivery_process = array(
'id' => $process_form['id'],
'name' => $process_form['title'],
'steps' => array()
'steps' => array(
array(
'short_desc' => 'Order placed',
'status' => 'complete',
'order_id' => $order_id,
'process_id' => $process_entry_id,
'step_id' => -1,
),
array(
'short_desc' => 'Assign process',
'status' => 'complete',
'order_id' => $order_id,
'process_id' => $process_entry_id,
'step_id' => 0,
)
)
);
foreach ( $steps_info as $step_info ) {
$step = $api->get_step( $step_info->get_id(), $process_instance );
$current_step = $api->get_current_step($process_instance);
foreach ( $steps_info as $step_info ) {
$step = $api->get_step( $step_info->get_id(), $process_instance );
if (! $step->is_visible_to_customer) {
continue;
}
$action_code = Wiaas_Delivery_Process_Action::get_process_step_action_form_action_code($step);
$info = $step->get_feed_meta();
$status = $step->get_status();
if ($current_step && $current_step->get_id() === $step->get_id()) {
$status = 'pending';
}
$delivery_process['steps'][] = array(
'step_id' => $step->get_id(),
'step_form_entry_id' => $step->get_target_form_entry_id() ?: null,
'process_id' => $process_entry_id,
'short_desc' => $info['step_name'],
'full_desc' => $info['description'],
'action_code' => $step->get_delivery_action_type(),
'step_type' => $step->get_delivery_action_type() === 'manual' ? 'manual' : 'extraAction',
'status' => $step->get_status() ?: 'inactive',
'action_code' => $action_code,
'status' => $status,
'order_id' => $order_id,
'actual_date' => $step->get_target_actual_date(),
'comments' => $step->get_target_step_comments(),
);
}
return $delivery_process;
}
/**
* Automatically create delivery process instance when order is created
* @param $order_id
*/
public static function create_delivery_process_for_order($order_id) {
$process_form = null;
$forms = GFFormsModel::search_forms( self::$process_form_title_prefix, true );
$process_form = $forms[0];
if(isset($process_form)) {
$order = wc_get_order( $order_id );
$new_process_entry = array(
'form_id' => $process_form->id,
'2' => $order->get_customer_id(),
'wiaas_delivery_order_id' => $order_id,
);
$process_entry_id = GFAPI::add_entry( $new_process_entry );
add_post_meta($order_id, 'wiaas_delivery_process_id', $process_form->id);
add_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id);
}
}
/**
* Extends Gravity Form entry metadata with 'wiaas_delivery_process_id'
*
* This way we can track for each delivery step its parent process
* @param $entry_meta
*
* @return mixed
*/
public static function extend_gravity_form_entry_meta($entry_meta) {
$entry_meta[ 'wiaas_delivery_process_id' ] = array(
'label' => 'Wiaas Delivery Process Id',
'is_numeric' => true,
'update_entry_meta_callback' => null,
'is_default_column' => false, // this column will be displayed by default on the entry list
'filter' => array(
'operators' => array( 'is' ),
),
);
$entry_meta[ 'wiaas_delivery_order_id' ] = array(
'label' => 'Wiaas Delivery Process Order Id',
'is_numeric' => true,
'update_entry_meta_callback' => null,
'is_default_column' => false, // this column will be displayed by default on the entry list
'filter' => array(
'operators' => array( 'is' ),
),
);
$entry_meta[ 'wiaas_delivery_step_name' ] = array(
'label' => 'Wiaas Delivery Step name',
'is_numeric' => false,
'update_entry_meta_callback' => null,
'is_default_column' => false, // this column will be displayed by default on the entry list
'filter' => array(
'operators' => array( 'is' ),
),
);
return $entry_meta;
}
/**
* Process parent process when single step workflow has completed
* @param $entry_id
* @param $form
* @param $final_status
*/
public static function maybe_complete_parent_process_step($entry_id, $form) {
$entry = GFAPI::get_entry($entry_id);
$parent_entry_id = $entry['wiaas_delivery_process_id'];
if (empty($parent_entry_id)) {
return false;
}
$parent_entry_id = absint( $parent_entry_id );
$parent_entry = GFAPI::get_entry( $parent_entry_id );
$parent_api = new Gravity_Flow_API( $parent_entry['form_id'] );
$parent_api->process_workflow( $parent_entry_id );
}
}
add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') );

View File

@@ -18,8 +18,16 @@ class Wiaas_Order {
public static function init() {
require_once dirname( __FILE__ ) . '/order/class-wiaas-order-project.php';
require_once dirname( __FILE__ ) . '/order/wiaas-order-functions.php';
require_once dirname( __FILE__ ) . '/order/class-wiaas-order-item.php';
add_action('woocommerce_new_order', array( __CLASS__, 'assign_order_to_organization' ));
add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings'));
add_filter( 'woocommerce_register_shop_order_post_statuses', array(__CLASS__, 'register_custom_order_statuses'), 10, 1);
add_filter( 'wc_order_statuses', array(__CLASS__, 'add_custom_statuses_to_list' ), 10, 1);
add_filter( 'bulk_actions-edit-shop_order', array(__CLASS__, 'add_custom_statuses_to_bulk_edit' ), 10, 1);
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
@@ -28,6 +36,252 @@ class Wiaas_Order {
add_filter('woocommerce_rest_orders_prepare_object_query', array( __CLASS__, 'wiaas_prepare_rest_orders_query'), 10, 2);
add_filter('woocommerce_new_order_note_data', array( __CLASS__, 'update_new_order_comment_date'), 10, 3);
add_filter('woocommerce_order_number', array( __CLASS__, 'format_order_number'));
}
/**
* Prefix order number
*
* @param int $number
*
* @return string
*/
public static function format_order_number($number) {
return "1000000$number";
}
public static function get_additional_days_prior_installation($order_id){
$order = wc_get_order($order_id);
return $order->get_meta('_wiaas_order_additional_days_prior_installation');
}
public static function add_additional_tracking_info($order_id, $supplier_id){
$suppliers = self::get_suppliers($order_id);
foreach($suppliers as $key => $supplier){
if ($supplier['id'] === $supplier_id){
$suppliers[$key]['tracking_info'][] = array(
'number' => '',
'url' => ''
);
$order = wc_get_order($order_id);
$order->update_meta_data('_wiaas_delivery_suppliers', $suppliers);
$order->save_meta_data();
return true;
}
}
return false;
}
public static function save_tracking_info($order_id, $supplier_id, $tracking_index, $tracking_num, $tracking_url){
$suppliers = self::get_suppliers($order_id);
foreach($suppliers as $key => $supplier){
if ($supplier['id'] === $supplier_id){
$suppliers[$key]['tracking_info'][$tracking_index]['number'] = $tracking_num;
$suppliers[$key]['tracking_info'][$tracking_index]['url'] = $tracking_url;
$order = wc_get_order($order_id);
$order->update_meta_data('_wiaas_delivery_suppliers', $suppliers);
$order->save_meta_data();
return true;
}
}
return false;
}
public static function delete_tracking_info($order_id, $supplier_id, $tracking_index){
$suppliers = self::get_suppliers($order_id);
foreach($suppliers as $key => $supplier){
if ($supplier['id'] === $supplier_id){
unset($suppliers[$key]['tracking_info'][$tracking_index]);
$order = wc_get_order($order_id);
$order->update_meta_data('_wiaas_delivery_suppliers', $suppliers);
$order->save_meta_data();
return true;
}
}
return false;
}
public static function save_estimated_date($order_id, $supplier_id, $date){
$suppliers = self::get_suppliers($order_id);
$updated = false;
foreach($suppliers as $key => $supplier){
if ($supplier['id'] === $supplier_id){
$suppliers[$key]['estimated_date'] = $date;
$updated = true;
}
}
if (!$updated){
return false;
}
$order = wc_get_order($order_id);
$order->update_meta_data('_wiaas_delivery_suppliers', $suppliers);
self::_update_max_and_earliest_dates($order, $suppliers);
$order->save_meta_data();
return true;
}
public static function save_confirmed_date($order_id, $supplier_id, $date){
$suppliers = self::get_suppliers($order_id);
$updated = false;
foreach($suppliers as $key => $supplier){
if ($supplier['id'] === $supplier_id){
$suppliers[$key]['confirmed_date'] = $date;
$updated = true;
if (!$suppliers[$key]['estimated_date']){
$suppliers[$key]['estimated_date'] = $date;
}
}
}
if (!$updated){
return false;
}
$order = wc_get_order($order_id);
$order->update_meta_data('_wiaas_delivery_suppliers', $suppliers);
self::_update_max_and_earliest_dates($order, $suppliers);
$order->save_meta_data();
return true;
}
public static function get_order_estimated_date($order_id){
$order = wc_get_order($order_id);
if (!$order){
return NULL;
}
return $order->get_meta('_wiaas_order_estimated_delivery_date') ?: NULL;
}
public static function save_order_estimated_date($order_id, $date){
return update_post_meta($order_id, '_wiaas_order_estimated_delivery_date', $date);
}
public static function get_final_estimated_date($order_id){
$order = wc_get_order($order_id);
if (!$order){
return 0;
}
return $order->get_meta('_wiaas_final_estimated_delivery_date') ?: 0;
}
public static function get_final_confirmed_date($order_id){
$order = wc_get_order($order_id);
if (!$order){
return 0;
}
return $order->get_meta('_wiaas_final_confirmed_delivery_date') ?: 0;
}
public static function get_earliest_installation_date($order_id){
$order = wc_get_order($order_id);
if (!$order){
return 0;
}
return $order->get_meta('_wiaas_earliest_installation_date') ?: 0;
}
/**
* Get suppliers related to order
*/
public static function get_suppliers($order_id){
$order = wc_get_order($order_id);
return $order->get_meta('_wiaas_delivery_suppliers');
}
/**
* Register additional order statuses
*
* @param array $order_statuses
*
* @return array
*/
public static function register_custom_order_statuses($order_statuses){
// Status must start with "wc-"
$order_statuses['wc-open'] = array(
'label' => _x( 'Open', 'Order status', 'woocommerce' ),
'public' => false,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Open <span class="count">(%s)</span>', 'Open <span class="count">(%s)</span>', 'woocommerce' ),
);
return $order_statuses;
}
/**
* display custom wiaas statuses in order status dropdown
*
* @param array $order_statuses
*
* @return array
*/
public static function add_custom_statuses_to_list($order_statuses){
$order_statuses['wc-open'] = _x( 'Open', 'Order status', 'woocommerce' );
return $order_statuses;
}
/**
* display custom wiaas statuses in bulk actions
*
* @param array $bulk_actions
*
* @return array
*/
public static function add_custom_statuses_to_bulk_edit($bulk_actions){
// Note: "mark_" must be there instead of "wc"
$bulk_actions['mark_open'] = 'Change status to open';
return $bulk_actions;
}
/**
* Update `shop_order` post type settings before creation to enable better order management for wiaas
*
* @param array $args
*
* @return array
*/
public static function manage_order_settings($args) {
// show orders in backend menu
$args['show_in_menu'] = true;
//set icon
$args['menu_icon'] = 'dashicons-cart';
// set capabilities
$args['capabilities'] = array(
'edit_post' => 'edit_shop_order',
'read_post' => 'read_shop_order',
'delete_post' => 'delete_shop_order',
'edit_posts' => 'edit_shop_orders',
'edit_others_posts' => 'edit_others_shop_orders',
'publish_posts' => 'publish_shop_orders',
'read_private_posts' => 'read_private_shop_orders',
'create_posts' => 'create_shop_orders', // use `create_shop_orders` instead of `edit_shop_orders`
);
return $args;
}
public static function update_new_order_comment_date($comment_data, $order_data) {
@@ -39,16 +293,6 @@ class Wiaas_Order {
return $comment_data;
}
/**
* Assignees order to corresponding user organization when order is created.
*
* @param $order_id
*/
public static function assign_order_to_organization($order_id) {
$user = wp_get_current_user();
Wiaas_User_Organization::assign_post_to_user_organization($order_id, $user->ID);
}
/**
* Checks if current user has access to requested order/{orderId} via woocommerce REST API.
* Endpoint `/orders` is filtered correctly by groups, but endpoint `/orders/{orderId}` will return order even if
@@ -127,6 +371,25 @@ class Wiaas_Order {
return $response;
}
public static function get_order_customer_full_name($order_id){
$order = wc_get_order($order_id);
$customer_user_id = $order->get_customer_id();
$customer = get_userdata($customer_user_id);
return $customer->last_name . ' ' . $customer->first_name;
}
public static function get_order_commercial_lead_name($order_id){
$order = wc_get_order($order_id);
$commercial_lead_org_id = $order->get_meta('_wiaas_commercial_lead_id', true);
$commercial_lead_organization_info = wiaas_get_organization_info($commercial_lead_org_id);
return $commercial_lead_organization_info['name'];
}
public static function set_order_vat($order_id, $vat_code) {
add_post_meta($order_id, '_wiaas_vat_code', $vat_code);
}
@@ -159,10 +422,110 @@ class Wiaas_Order {
return get_post_meta($order_id, '_wiaas_tender', true);
}
public static function get_order_country_code($order_id) {
$order = wc_get_order($order_id);
$code = $order->get_meta('_wiaas_country_code');
if (empty($code)) {
$code = Wiaas_Countries::get_available_country_code_by_currency($order->get_currency());
$order->add_meta_data('_wiaas_country_code', $code);
$order->save_meta_data();
}
return $code;
}
/**
* Retrieve customer organization id for order
*
* @param int $order_id
*
* @return int|null
*/
public static function get_order_customer_organization_id($order_id) {
$order = wc_get_order($order_id);
$customer_organization_id = $order->get_meta('_wiaas_customer_id', true);
if (empty($customer_organization_id)) {
$customer_organization_id = wiaas_get_user_organization_id($order->get_customer_id());
}
return $customer_organization_id;
}
/**
* Retrieve customer organization info from order
*
* @param int $order_id
*
* @return array|null
*/
public static function get_customer_organization_info($order_id) {
$order = wc_get_order($order_id);
$customer_organization_info = $order->get_meta('_wiaas_customer_info', true);
$customer_organization_id = self::get_order_customer_organization_id($order_id);
if ( empty($customer_organization_info) && ! empty( $customer_organization_id) ) {
$customer_organization_info = wiaas_get_organization_info($customer_organization_id);
}
if ( ! empty($customer_organization_info) ) {
$customer_organization_info['id'] = $customer_organization_id;
}
return ! empty($customer_organization_info) ? $customer_organization_info : null;
}
/**
* PRIVATE
*/
private static function _update_max_and_earliest_dates($order, $suppliers){
$max_estimated_date = 0;
$max_confirmed_date = 0;
$earliest_installation_date = 0;
$missing_estimated = false;
foreach($suppliers as $supplier) {
if (! empty($supplier['confirmed_date']) ) {
$max_confirmed_date = max($max_confirmed_date, $supplier['confirmed_date']);
} else {
$missing_confirmed = true;
}
if (! empty($supplier['estimated_date']) ) {
$max_estimated_date = max($max_estimated_date, $supplier['estimated_date']);
} else {
$missing_estimated = true;
$earliest_installation_date = 0;
}
}
if (! $missing_estimated) {
$earliest_installation_date = max($max_estimated_date, $max_confirmed_date);
$earliest_installation_date = strtotime('+' . self::get_additional_days_prior_installation($order->id) . ' weekdays', $earliest_installation_date);
}
$order->update_meta_data('_wiaas_final_confirmed_delivery_date', $max_confirmed_date);
$order->update_meta_data('_wiaas_final_estimated_delivery_date', $max_estimated_date);
$order->update_meta_data('_wiaas_earliest_installation_date', $earliest_installation_date);
}
/**
* Append specific wiaas order details, like reference
* @param $data
@@ -182,19 +545,33 @@ class Wiaas_Order {
/**
* Appends additional wiaas customer lead info to order json response
* @param $data
* @param $order
* @param WC_Order $order
* @param $request
*
* @return mixed
*/
private static function _append_commercial_lead_info($data, $order, $request) {
$data['commercial_lead'] = array(
'id' => 1,
'name' => 'Coor Service Management',
'phone' => '123456789',
'email' => 'rikard@co-ideation.com'
);
$commercial_lead_org_id = $order->get_meta('_wiaas_commercial_lead_id', true);
$commercial_lead_organization_info = $order->get_meta('_wiaas_commercial_lead_info', true);
if (! empty($commercial_lead_org_id) && empty($commercial_lead_organization_info)) {
$commercial_lead_organization_info = wiaas_get_organization_info($commercial_lead_org_id);
$data['commercial_lead'] = array(
'id' => $commercial_lead_org_id,
'name' => $commercial_lead_organization_info['name'],
'phone' => $commercial_lead_organization_info['phone'],
'email' => $commercial_lead_organization_info['email']
);
}
if (!empty($commercial_lead_organization_info)) {
$commercial_lead_organization_info['id'] = $commercial_lead_org_id;
$data['commercial_lead'] = $commercial_lead_organization_info;
}
return $data;
}
@@ -202,25 +579,34 @@ class Wiaas_Order {
/**
* Appends additional wiaas customer info to order json response
* @param $data
* @param $order
* @param WC_Order $order
* @param $request
*
* @return mixed
*/
private static function _append_customer_info($data, $order, $request) {
$current_user = wp_get_current_user();
$customer_organization_id = $order->get_meta('_wiaas_customer_id', true);
$customer_id = $data['customer_id'];
$customer_user_id = $order->get_customer_id();
$customer_user = get_user_by('id', $customer_id);
$data['customer'] = array(
'email' => $customer_user->user_email,
'name' => $customer_user->display_name,
'phone' => '+46 (10) 5595148'
);
if (empty($customer_organization_id)) {
$data['is_my_order'] = $customer_id === $current_user->ID;
$customer_organization_id = wiaas_get_user_organization_id($customer_user_id);
}
$customer_organization_info = $order->get_meta('_wiaas_customer_info', true);
if ( !empty($customer_organization_id) && empty($customer_organization_info) ) {
$customer_organization_info = wiaas_get_organization_info($customer_organization_id);
$customer_organization_info['id'] = $customer_organization_id;
}
$data['customer'] = $customer_organization_info;
$data['is_my_order'] = $customer_user_id === get_current_user_id();
return $data;
}
@@ -290,6 +676,12 @@ class Wiaas_Order {
}
}
// installation date
if (! empty($item['wiaas_installation_date'])) {
$product_line['installation_date'] = $item['wiaas_installation_date'];
}
$line_items[] = $product_line;
}
}
@@ -368,11 +760,14 @@ class Wiaas_Order {
if (wiaas_is_order_item__standard_package($order_item)) {
$documents = wiaas_get_standard_package_order_item_documents($order, $product_line['id']);
$data['line_items'][$index] ['documents'] = $documents;
}
}
$data['documents'] = wiaas_get_order_other_documents($order->get_id());
return $data;
}
}

View File

@@ -32,6 +32,9 @@ class Wiaas_Package {
$data = self::_append_country_info($data, $package, $request);
// append package reference field
$data['reference'] = ! empty($data['tags']) ? $data['tags'][0]['name'] : '';
if (isset($request['id'])) {
$data = self::_append_package_prices($data, $package, $request);
@@ -45,6 +48,10 @@ class Wiaas_Package {
return $response;
}
public static function get_earliest_installation_additional_days($package_id){
return get_post_meta($package_id, 'additional_days_prior_earliest_installation', true);
}
/**
* Append package documents
* @param $data
@@ -93,9 +100,8 @@ class Wiaas_Package {
* @return array
*/
private static function _append_additional_packages($data, $package, $request) {
// TODO: Change this so commercial lead is sent via request
$customer_id = wiaas_get_current_user_organization_id();
$commercial_lead_id = array_keys(wiaas_get_commercial_leads())[0];
$commercial_lead_id = absint($request['shop_id']);
$data['additional_packages'] = array();
$addons = Wiaas_Package_Addon::get_package_addons($package);
@@ -142,9 +148,8 @@ class Wiaas_Package {
* @return array
*/
private static function _append_package_prices($data, $package, $request) {
// TODO: Change this so commercial lead is sent via request
$customer_id = wiaas_get_current_user_organization_id();
$commercial_lead_id = array_keys(wiaas_get_commercial_leads())[0];
$commercial_lead_id = absint($request['shop_id']);
$data['prices'] = Wiaas_Pricing::get_standard_package_customer_prices($package, $customer_id, $commercial_lead_id);

View File

@@ -48,7 +48,7 @@ class Wiaas_Pricing {
$bundled_items = $package->get_bundled_items();
foreach ($bundled_items as $bundled_item) {
$product = $bundled_item->product;
$product = wc_get_product($bundled_item->get_product_id());
$product_cat = Wiaas_Product_Category::get_category($product);
if (!isset($total_cost_per_category[$product_cat])) {

View File

@@ -5,18 +5,24 @@ class Wiaas_Product {
public static function init() {
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-category.php';
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-supplier.php';
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-quick-edit.php';
add_filter('woocommerce_register_post_type_product', array(__CLASS__, 'define_product_capabilities'));
add_filter('woocommerce_register_post_type_product', array(__CLASS__, 'manage_product_settings'));
add_filter('woocommerce_taxonomy_args_product_tag', array(__CLASS__, 'manage_tags_as_references'));
}
/**
* Define capabilities for editing products so we can easily control read/edit/create access for them
* Update product type settins before it is created:
* - Define capabilities for editing products so we can easily control read/edit/create access for them
* - Declare fields supported by product
*
* @param $args
*
* @return mixed
* @return array
*/
public static function define_product_capabilities($args) {
public static function manage_product_settings($args) {
$args['capabilities'] = array(
'edit_post' => 'edit_product',
@@ -28,8 +34,48 @@ class Wiaas_Product {
'read_private_posts' => 'read_private_products',
'create_posts' => 'create_products', // use `create_products` instead of default `edit_products`
);
$args['supports'] = array( 'title', 'thumbnail' );
return $args;
}
/**
* Hide default metabox for product tags
*
* @param $args
*
* @return array
*/
public static function manage_tags_as_references($args) {
// hide metabox
$args['meta_box_cb'] = false;
// update labels
$args['labels'] = array(
'name' => __( 'Product references', 'wiaas' ),
'singular_name' => __( 'Reference', 'wiaas' ),
'menu_name' => _x( 'References', 'Admin menu name', 'wiaas' ),
'search_items' => __( 'Search references', 'wiaas' ),
'all_items' => __( 'All references', 'wiaas' ),
'edit_item' => __( 'Edit reference', 'wiaas' ),
'update_item' => __( 'Update reference', 'wiaas' ),
'add_new_item' => __( 'Add new reference', 'wiaas' ),
'new_item_name' => __( 'New reference name', 'wiaas' ),
'popular_items' => __( 'Popular references', 'wiaas' ),
'separate_items_with_commas' => __( 'Separate references with commas', 'wiaas' ),
'add_or_remove_items' => __( 'Add or remove references', 'wiaas' ),
'choose_from_most_used' => __( 'Choose from the most used references', 'wiaas' ),
'not_found' => __( 'No references found', 'wiaas' ),
);
return $args;
}
public static function get_supplier_id($product_id){
return wp_get_post_terms($product_id, 'supplier', array('fields' => 'ids'))[0];
}
}
Wiaas_Product::init();

View File

@@ -1,5 +1,13 @@
<?php
/**
* Implements logic for multiple shops existing in one marketplace
*
* Every shop has its owner (organization that is commercial lead) and multiple customers (organizations)
* assigned to it.
*
* Class Wiaas_Shop
*/
class Wiaas_Shop {
public static function init() {
@@ -10,6 +18,92 @@ class Wiaas_Shop {
// update prices search terms for package after prices extras have been updated
add_action('wiaas_package_prices_extras_set', array(__CLASS__, 'update_package_prices_search_terms'), 10, 4);
// remove customer shop relationships for all deactivated and removed shops
add_action('wiaas_organization_roles_updated', array(__CLASS__, 'remove_deactivated_shop'));
add_action('wiaas_organization_deleted', array(__CLASS__, 'remove_shop'));
}
public static function get_shop_customers($owner_id) {
return Wiaas_Shop_DB::get_shop_customers($owner_id);
}
/**
* Link customers to shop (this will enable them to search and order packages from this shop)
*
* @param int $owner_id
* @param array $customer_ids
*/
public static function set_shop_customers($owner_id, $customer_ids) {
$current_customer_ids = wp_list_pluck(
Wiaas_Shop_DB::get_shop_customers($owner_id),
'customer_id');
// delete removed customers
$removed_customer_ids = array_diff($current_customer_ids, $customer_ids);
Wiaas_Shop_DB::remove_shop_customers($owner_id, $removed_customer_ids);
// save added customers
$added_customer_ids = array_diff($customer_ids, $current_customer_ids);
Wiaas_Shop_DB::add_shop_customers($owner_id, $added_customer_ids);
}
/**
* Retrieve default order type for shop
*
* @param int $owner_id
*
* @return string
*/
public static function get_default_order_type($owner_id) {
$order_type = get_term_meta(
$owner_id,
'_wiaas_shop_default_order_type',
true);
return empty($order_type) ? 'commercial_lead' : $order_type;
}
/**
* Update default order type for shop
*
* @param int $owner_id
* @param string $order_type
*/
public static function update_default_order_type($owner_id, $order_type) {
if (in_array($order_type, array('commercial_lead', 'reseller'))) {
update_term_meta($owner_id, '_wiaas_shop_default_order_type', $order_type);
}
}
public static function update_shop_customer_order_type($owner_id, $customer_id, $order_type) {
Wiaas_Shop_DB::update_shop_customer_order_type(
$owner_id,
$customer_id,
$order_type);
}
/**
* Remove shop for organization that is no longer commercial lead
*
* @param int $owner_id
*/
public static function remove_deactivated_shop($owner_id) {
$roles = wiaas_get_organization_roles($owner_id);
if (! in_array('commercial_lead', $roles)) {
self::remove_shop($owner_id);
}
}
/**
* remove shop
* @param int $owner_id
*/
public static function remove_shop($owner_id) {
Wiaas_Shop_DB::remove_shop($owner_id);
}
/**
@@ -20,7 +114,7 @@ class Wiaas_Shop {
'hierarchical' => false,
'query_var' => true,
'rewrite' => false,
'public' => true,
'public' => false,
'capabilities' => array(
'manage_terms' => 'manage_wiaas_package_price_terms',
'edit_terms' => 'edit_wiaas_package_price_terms',
@@ -44,7 +138,7 @@ class Wiaas_Shop {
* $extra_price_payment_type => {
* @type bool visible Indicates if payment type is visible to customer
* }
* }
* }
* @param array $old_cl_extras {
* $extra_price_payment_type => {
* @type bool visible Indicates if payment type is visible to customer
@@ -55,20 +149,66 @@ class Wiaas_Shop {
// remove pricing terms for previous prices
if (! empty($old_cl_extras)) {
$old_visible_price_types = array_keys(wp_list_filter($old_cl_extras, array( 'visible' => true )));
$old_terms = self::_get_search_terms_from_cl_extras($owner_id, $old_cl_extras);
$old_terms_names = preg_filter('/^/', '_' . $owner_id . '_', $old_visible_price_types);
wp_remove_object_terms($package_id, $old_terms_names, '_wiaas_shop_prices');
wp_remove_object_terms($package_id, $old_terms, '_wiaas_shop_prices');
}
// get visible price types set by shop owner (commercial lead)
$visible_price_types = array_keys(wp_list_filter($cl_extras, array('visible' => true)));
$new_terms_names = preg_filter('/^/', '_' . $owner_id . '_', $visible_price_types);
$new_terms = self::_get_search_terms_from_cl_extras($owner_id, $cl_extras);
// create term for every visible pricing type and link them to package so package can be queried
wp_set_object_terms($package_id, $new_terms_names, '_wiaas_shop_prices');
wp_add_object_terms($package_id, $new_terms, '_wiaas_shop_prices');
}
// PRIVATE
/**
* Generate search terms from cl extras
*
* For default prices search term
* `_{owner_id}_default` will be generated if all set prices are visible
*
* For every customer entry search term
* `_{owner_id}_customer_{customer_id}_visible` will be generated if any of the prices is visible or
* `_{owner_id}_customer_{customer_id}_hidden` if all prices are hidden`
*
* @param int $owner_id
* @param array $cl_extras
*
* @return array
*/
private static function _get_search_terms_from_cl_extras($owner_id, $cl_extras) {
// determine if extras are visible grouped by customer and default settings
$cl_extras_per_customer = array();
$cl_extra_default = false;
foreach ($cl_extras as $cl_extra_type => $cl_extra) {
// is default
if (strpos($cl_extra_type, '_default') !== false) {
// determine if default cl extra is visible
$cl_extra_default = $cl_extra_default || $cl_extra['visible'];
}
// is customer specific
if (strpos($cl_extra_type, '_customer_') !== false) {
$customer_id = absint(explode('_customer_', $cl_extra_type)[1]);
// determine if customer cl extra is visible
$cl_extras_per_customer[$customer_id] = $cl_extras_per_customer[$customer_id] || $cl_extra['visible'];
}
}
$terms = array();
if ($cl_extra_default) {
$terms[] = '_' . $owner_id . '_default';
}
foreach ($cl_extras_per_customer as $customer_id => $visible) {
$terms[] = '_' . $owner_id . '_customer_' . $customer_id . '_' .
($visible ? 'visible' : 'hidden');
}
return $terms;
}
}

View File

@@ -15,7 +15,7 @@ class Wiaas_User {
add_action('plugins_loaded', array(__CLASS__, 'remove_default_user_groups'), 30);
add_filter('woocommerce_rest_prepare_customer', array(__CLASS__, 'transform_rest_customer'), 10, 3);
add_filter('jwt_auth_token_before_dispatch', array(__CLASS__, 'transform_jwt_token_response'), 10, 2);
add_filter('jwt_auth_token_before_dispatch', array(__CLASS__, 'transform_jwt_token_response'), 999, 2);
}
public static function load_user_organization() {
@@ -58,6 +58,10 @@ class Wiaas_User {
* @return mixed
*/
public static function transform_jwt_token_response($data, $user) {
if (is_wp_error($data)) {
return $data;
}
return new WP_REST_Response(array(
'token' => $data['token'],
'userInfo' => array(

View File

@@ -0,0 +1,13 @@
<?php
defined( 'ABSPATH' ) || exit;
/**
* Class Wiaas_Validation
*/
class Wiaas_Validation {
public static function is_phone($phone){
return WC_Validation::is_phone($phone);
}
}

View File

@@ -0,0 +1 @@
{"0":{"title":"DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":36,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":36,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"process","delivery_country":"se"},"is_active":"1","date_created":"2018-11-02 10:15:28","is_trash":"0","confirmations":[{"id":"5bdb1c7c26da9","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bdb1c7c26952","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"120","form_id":"36","is_active":"1","feed_order":"0","meta":{"step_name":"Delivery Step Placeholder (Use Delivery Step type to create process workflow steps)","description":"","step_type":"wiaas_delivery_step","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","instructionsEnable":"0","instructionsValue":"","is_visible_to_customer":"1","target_form_id":"","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"}

View File

@@ -1,524 +0,0 @@
{
"0": {
"title": "DELIVERY ACTION TYPE: Customer acceptance",
"description": "The customer must accept the implementation before further actions can be taken. If the customer isn't satisfied, the problems or discrepancies must be fixed in order to gen an acceptance.",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
"fields": [
{
"type": "workflow_user",
"id": 2,
"label": "customer-id",
"adminLabel": "customer-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "administrative",
"inputs": null,
"choices": [
],
"formId": 1,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "customer-id",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"failed_validation": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": "",
"gravityflowUsersRoleFilter": ""
},
{
"type": "date",
"id": 6,
"label": "Actual date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "none",
"formId": 1,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "ymd_dash",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": ""
},
{
"type": "radio",
"id": 8,
"label": "acceptance",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"choices": [
{
"text": "not-accepted",
"value": "not-accepted",
"isSelected": true,
"price": ""
},
{
"text": "accept",
"value": "accept",
"isSelected": false,
"price": ""
},
{
"text": "decline",
"value": "decline",
"isSelected": false,
"price": ""
}
],
"formId": 1,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"productField": "",
"enableOtherChoice": "",
"enablePrice": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": ""
},
{
"type": "date",
"id": 9,
"label": "Expiration date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "none",
"formId": 1,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "ymd_dash",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": ""
},
{
"type": "text",
"id": 10,
"label": "Reason",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"formId": 1,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"productField": "",
"enablePasswordInput": "",
"maxLength": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": ""
},
{
"type": "fileupload",
"id": 12,
"label": "File",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"formId": 1,
"description": "Upload customer acceptance file",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"maxFileSize": "",
"maxFiles": "",
"multipleFiles": true,
"allowedExtensions": "pdf,docx,doc,xlsx,xls,odt,ods,jpg,png,jpeg",
"productField": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false
}
],
"version": "2.3.2",
"id": 1,
"useCurrentUserAsAuthor": true,
"postContentTemplateEnabled": false,
"postTitleTemplateEnabled": false,
"postTitleTemplate": "",
"postContentTemplate": "",
"lastPageButton": null,
"pagination": null,
"firstPageCssClass": null,
"is_active": "1",
"date_created": "2018-08-15 20:30:18",
"is_trash": "0",
"confirmations": [
{
"id": "5b5f75f7494b7",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
],
"notifications": [
{
"id": "5b5f75f748cee",
"to": "{admin_email}",
"name": "Admin Notification",
"event": "form_submission",
"toType": "email",
"subject": "New submission from {form_title}",
"message": "{all_fields}"
}
],
"feeds": {
"gravityflow": [
{
"id": "1",
"form_id": "1",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Upload acceptance file",
"description": "",
"step_type": "user_input",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field": "6",
"type": "select",
"assignees": [
"role|administrator",
"assignee_user_field|2"
],
"routing": "",
"assignee_policy": "any",
"highlight_editable_fields_enabled": "0",
"highlight_editable_fields_class": "green-triangle",
"instructionsEnable": "0",
"instructionsValue": "",
"display_fields_mode": "selected_fields",
"default_status": "hidden",
"note_mode": "not_required",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "Upload order acceptance file",
"assignee_notification_message": "A new entry requires your input.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"in_progress_notification_enabled": "0",
"in_progress_notification_type": "select",
"in_progress_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"in_progress_notification_from_name": "",
"in_progress_notification_from_email": "{admin_email}",
"in_progress_notification_reply_to": "",
"in_progress_notification_bcc": "",
"in_progress_notification_subject": "",
"in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.",
"in_progress_notification_disable_autoformat": "0",
"complete_notification_enabled": "0",
"complete_notification_type": "select",
"complete_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"complete_notification_from_name": "",
"complete_notification_from_email": "{admin_email}",
"complete_notification_reply_to": "",
"complete_notification_bcc": "",
"complete_notification_subject": "",
"complete_notification_message": "Entry {entry_id} has been updated completing the step.",
"complete_notification_disable_autoformat": "0",
"confirmation_messageEnable": "0",
"confirmation_messageValue": "Thank you.",
"expiration": "0",
"expiration_type": "date_field",
"expiration_date": "",
"expiration_delay_offset": "7",
"expiration_delay_unit": "days",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"expiration_date_field": "9",
"status_expiration": "expired",
"destination_expired": "2",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "2",
"form_id": "1",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Approve customer acceptance",
"description": "",
"step_type": "approval",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"type": "select",
"assignees": [
"role|administrator"
],
"routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"assignee_policy": "any",
"instructionsEnable": "0",
"instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button",
"display_fields_mode": "all_fields",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"rejection_notification_enabled": "0",
"rejection_notification_type": "select",
"rejection_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"rejection_notification_from_name": "",
"rejection_notification_from_email": "{admin_email}",
"rejection_notification_reply_to": "",
"rejection_notification_bcc": "",
"rejection_notification_subject": "",
"rejection_notification_message": "Entry {entry_id} has been rejected",
"rejection_notification_disable_autoformat": "0",
"approval_notification_enabled": "0",
"approval_notification_type": "select",
"approval_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"approval_notification_from_name": "",
"approval_notification_from_email": "{admin_email}",
"approval_notification_reply_to": "",
"approval_notification_bcc": "",
"approval_notification_subject": "",
"approval_notification_message": "Entry {entry_id} has been approved",
"approval_notification_disable_autoformat": "0",
"revertEnable": "0",
"revertValue": 1,
"note_mode": "not_required",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"status_expiration": "rejected",
"destination_expired": "next",
"destination_rejected": 1,
"destination_approved": "next"
},
"addon_slug": "gravityflow",
"event_type": null
}
]
}
},
"version": "2.3.2"
}

View File

@@ -1,252 +0,0 @@
{
"0": {
"title": "DELIVERY ACTION TYPE: Manual",
"description": "Manual process step action type",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
"fields": [
{
"type": "workflow_user",
"id": 2,
"label": "customer-id",
"adminLabel": "customer-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "administrative",
"inputs": null,
"choices": [
{
"value": 2,
"text": "Customer Wiaas"
},
{
"value": 1,
"text": "wpUser"
}
],
"formId": 4,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "customer-id",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"failed_validation": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": "",
"gravityflowUsersRoleFilter": ""
},
{
"type": "date",
"id": 3,
"label": "Actual Date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "calendar",
"formId": 4,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "ymd_dash",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": ""
}
],
"version": "2.3.2",
"id": 4,
"useCurrentUserAsAuthor": true,
"postContentTemplateEnabled": false,
"postTitleTemplateEnabled": false,
"postTitleTemplate": "",
"postContentTemplate": "",
"lastPageButton": null,
"pagination": null,
"firstPageCssClass": null,
"is_active": "1",
"date_created": "2018-08-09 15:36:00",
"is_trash": "0",
"confirmations": [
{
"id": "5b5f9ebc52a80",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
],
"notifications": [
{
"id": "5b5f9ebc520f3",
"to": "{admin_email}",
"name": "Admin Notification",
"event": "form_submission",
"toType": "email",
"subject": "New submission from {form_title}",
"message": "{all_fields}"
}
],
"feeds": {
"gravityflow": [
{
"id": "6",
"form_id": "4",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Complete step",
"description": "",
"step_type": "approval",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field": "3",
"type": "select",
"assignees": [
"role|administrator"
],
"routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"assignee_policy": "any",
"instructionsEnable": "0",
"instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button",
"display_fields_mode": "all_fields",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"rejection_notification_enabled": "0",
"rejection_notification_type": "select",
"rejection_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"rejection_notification_from_name": "",
"rejection_notification_from_email": "{admin_email}",
"rejection_notification_reply_to": "",
"rejection_notification_bcc": "",
"rejection_notification_subject": "",
"rejection_notification_message": "Entry {entry_id} has been rejected",
"rejection_notification_disable_autoformat": "0",
"approval_notification_enabled": "0",
"approval_notification_type": "select",
"approval_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"approval_notification_from_name": "",
"approval_notification_from_email": "{admin_email}",
"approval_notification_reply_to": "",
"approval_notification_bcc": "",
"approval_notification_subject": "",
"approval_notification_message": "Entry {entry_id} has been approved",
"approval_notification_disable_autoformat": "0",
"note_mode": "not_required",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"expiration_date_field": "3",
"status_expiration": "rejected",
"destination_expired": "next",
"destination_rejected": "complete",
"destination_approved": "next"
},
"addon_slug": "gravityflow",
"event_type": null
}
]
}
},
"version": "2.3.2"
}

View File

@@ -1,406 +0,0 @@
{
"0": {
"title": "DELIVERY ACTION TYPE: Schedule meeting",
"description": "Schedule meeting with customer",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
"fields": [
{
"type": "workflow_user",
"id": 3,
"label": "customer-id",
"adminLabel": "customer-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "administrative",
"inputs": null,
"choices": [
{
"value": 2,
"text": "Customer Wiaas"
},
{
"value": 1,
"text": "wpUser"
}
],
"formId": 2,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "customer-id",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"failed_validation": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"gravityflowUsersRoleFilter": ""
},
{
"type": "date",
"id": 4,
"label": "Actual Date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "calendar",
"formId": 2,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "ymd_dash",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": ""
},
{
"type": "date",
"id": 5,
"label": "Schedule date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "calendar",
"formId": 2,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "ymd_dash",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false
}
],
"version": "2.3.2",
"id": 2,
"useCurrentUserAsAuthor": true,
"postContentTemplateEnabled": false,
"postTitleTemplateEnabled": false,
"postTitleTemplate": "",
"postContentTemplate": "",
"lastPageButton": null,
"pagination": null,
"firstPageCssClass": null,
"is_active": "1",
"date_created": "2018-08-09 15:35:59",
"is_trash": "0",
"confirmations": [
{
"id": "5b60b12baa00e",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
],
"notifications": [
{
"id": "5b60b12ba9850",
"to": "{admin_email}",
"name": "Admin Notification",
"event": "form_submission",
"toType": "email",
"subject": "New submission from {form_title}",
"message": "{all_fields}"
}
],
"feeds": {
"gravityflow": [
{
"id": "3",
"form_id": "2",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Broker proposes meeting date",
"description": "",
"step_type": "user_input",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field": "4",
"type": "select",
"assignees": [
"role|administrator"
],
"editable_fields": [
"4",
"5"
],
"routing": "",
"assignee_policy": "all",
"highlight_editable_fields_enabled": "0",
"highlight_editable_fields_class": "green-triangle",
"instructionsEnable": "0",
"instructionsValue": "",
"display_fields_mode": "selected_fields",
"display_fields_selected": [
"4",
"5"
],
"default_status": "submit_buttons",
"note_mode": "not_required",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry requires your input.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"in_progress_notification_enabled": "0",
"in_progress_notification_type": "select",
"in_progress_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"in_progress_notification_from_name": "",
"in_progress_notification_from_email": "{admin_email}",
"in_progress_notification_reply_to": "",
"in_progress_notification_bcc": "",
"in_progress_notification_subject": "",
"in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.",
"in_progress_notification_disable_autoformat": "0",
"complete_notification_enabled": "0",
"complete_notification_type": "select",
"complete_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"complete_notification_from_name": "",
"complete_notification_from_email": "{admin_email}",
"complete_notification_reply_to": "",
"complete_notification_bcc": "",
"complete_notification_subject": "",
"complete_notification_message": "Entry {entry_id} has been updated completing the step.",
"complete_notification_disable_autoformat": "0",
"confirmation_messageEnable": "0",
"confirmation_messageValue": "Thank you.",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"expiration_date_field": "4",
"status_expiration": "complete",
"destination_expired": "next",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "4",
"form_id": "2",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Customer approval for scheduled date",
"description": "",
"step_type": "approval",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field": "4",
"type": "select",
"assignees": [
"assignee_user_field|3"
],
"routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"assignee_policy": "all",
"instructionsEnable": "0",
"instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button",
"display_fields_mode": "selected_fields",
"display_fields_selected": [
"5"
],
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"rejection_notification_enabled": "0",
"rejection_notification_type": "select",
"rejection_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"rejection_notification_from_name": "",
"rejection_notification_from_email": "{admin_email}",
"rejection_notification_reply_to": "",
"rejection_notification_bcc": "",
"rejection_notification_subject": "",
"rejection_notification_message": "Entry {entry_id} has been rejected",
"rejection_notification_disable_autoformat": "0",
"approval_notification_enabled": "0",
"approval_notification_type": "select",
"approval_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"approval_notification_from_name": "",
"approval_notification_from_email": "{admin_email}",
"approval_notification_reply_to": "",
"approval_notification_bcc": "",
"approval_notification_subject": "",
"approval_notification_message": "Entry {entry_id} has been approved",
"approval_notification_disable_autoformat": "0",
"revertEnable": "0",
"revertValue": 3,
"note_mode": "not_required",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"expiration_date_field": "4",
"status_expiration": "rejected",
"destination_expired": "next",
"destination_rejected": 3,
"destination_approved": "complete"
},
"addon_slug": "gravityflow",
"event_type": null
}
]
}
},
"version": "2.3.2"
}

View File

@@ -1,264 +0,0 @@
{
"0": {
"title": "DELIVERY ACTION TYPE: Validate Questionnaire",
"description": "The configuration details submitted at ordering must be validated and any missing or incomplete information must be added.",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
"fields": [
{
"type": "workflow_user",
"id": 4,
"label": "customer-id",
"adminLabel": "customer-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "administrative",
"inputs": null,
"choices": [
{
"value": 2,
"text": "Customer Wiaas"
},
{
"value": 1,
"text": "wpUser"
}
],
"formId": 3,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "customer-id",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"failed_validation": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": "",
"gravityflowUsersRoleFilter": ""
},
{
"type": "date",
"id": 5,
"label": "Actual date",
"adminLabel": "",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"dateType": "datepicker",
"calendarIconType": "none",
"formId": 3,
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"calendarIconUrl": "",
"dateFormat": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false
}
],
"version": "2.3.2",
"id": 3,
"useCurrentUserAsAuthor": true,
"postContentTemplateEnabled": false,
"postTitleTemplateEnabled": false,
"postTitleTemplate": "",
"postContentTemplate": "",
"lastPageButton": null,
"pagination": null,
"firstPageCssClass": null,
"is_active": "1",
"date_created": "2018-08-09 15:36:00",
"is_trash": "0",
"confirmations": [
{
"id": "5b5f688188e90",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
],
"notifications": [
{
"id": "5b5f68818822e",
"to": "{admin_email}",
"name": "Admin Notification",
"event": "form_submission",
"toType": "email",
"subject": "New submission from {form_title}",
"message": "{all_fields}"
}
],
"feeds": {
"gravityflow": [
{
"id": "5",
"form_id": "3",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Approve customer configuration",
"description": "",
"step_type": "approval",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": {
"conditionalLogic": {
"actionType": "show",
"logicType": "all",
"rules": [
{
"fieldId": "2",
"operator": "is",
"value": "administrator"
}
]
}
},
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field": "5",
"type": "select",
"assignees": [
"role|administrator"
],
"routing": [
{
"target": false,
"fieldId": "0",
"operator": "is",
"value": "",
"type": false,
"assignee": "user_id|2"
}
],
"assignee_policy": "any",
"instructionsEnable": "1",
"instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button",
"display_fields_mode": "selected_fields",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"rejection_notification_enabled": "0",
"rejection_notification_type": "select",
"rejection_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"rejection_notification_from_name": "",
"rejection_notification_from_email": "{admin_email}",
"rejection_notification_reply_to": "",
"rejection_notification_bcc": "",
"rejection_notification_subject": "",
"rejection_notification_message": "Entry {entry_id} has been rejected",
"rejection_notification_disable_autoformat": "0",
"approval_notification_enabled": "0",
"approval_notification_type": "select",
"approval_notification_routing": [
{
"assignee": "user_id|2",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"approval_notification_from_name": "",
"approval_notification_from_email": "{admin_email}",
"approval_notification_reply_to": "",
"approval_notification_bcc": "",
"approval_notification_subject": "",
"approval_notification_message": "Entry {entry_id} has been approved",
"approval_notification_disable_autoformat": "0",
"note_mode": "not_required",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "0",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"expiration_date_field": "5",
"status_expiration": "rejected",
"destination_expired": "next",
"destination_rejected": "complete",
"destination_approved": "next"
},
"addon_slug": "gravityflow",
"event_type": null
}
]
}
},
"version": "2.3.2"
}

View File

@@ -1,338 +0,0 @@
{
"0": {
"title": "DELIVERY PROCESS: Normal Delivery",
"description": "Normal delivery process",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
"fields": [
{
"type": "number",
"id": 1,
"label": "order-id",
"adminLabel": "order-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"numberFormat": "decimal_dot",
"formId": 5,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "order-id",
"noDuplicates": false,
"defaultValue": "",
"choices": "",
"conditionalLogic": "",
"enableCalculation": false,
"rangeMin": "",
"rangeMax": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": ""
},
{
"type": "workflow_user",
"id": 2,
"label": "customer-id",
"adminLabel": "customer-id",
"isRequired": false,
"size": "medium",
"errorMessage": "",
"visibility": "visible",
"inputs": null,
"choices": [
{
"value": 2,
"text": "Customer Wiaas"
},
{
"value": 1,
"text": "wpUser"
}
],
"formId": 5,
"description": "",
"allowsPrepopulate": true,
"inputMask": false,
"inputMaskValue": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "customer-id",
"noDuplicates": false,
"defaultValue": "",
"conditionalLogic": "",
"failed_validation": "",
"productField": "",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"displayOnly": "",
"enablePrice": "",
"gravityflowUsersRoleFilter": ""
}
],
"version": "2.3.2.6",
"id": 5,
"useCurrentUserAsAuthor": true,
"postContentTemplateEnabled": false,
"postTitleTemplateEnabled": false,
"postTitleTemplate": "",
"postContentTemplate": "",
"lastPageButton": null,
"pagination": null,
"firstPageCssClass": null,
"is_active": "1",
"date_created": "2018-08-09 15:36:00",
"is_trash": "0",
"confirmations": [
{
"id": "5b5f7ae4bb79e",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
],
"notifications": [
{
"id": "5b5f7ae4baced",
"to": "{admin_email}",
"name": "Admin Notification",
"event": "form_submission",
"toType": "email",
"subject": "New submission from {form_title}",
"message": "{all_fields}",
"isActive": false
}
],
"feeds": {
"gravityflow": [
{
"id": "7",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Validate customer configuration information",
"description": "Validate customer configuration information",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"instructionsEnable": "0",
"instructionsValue": "",
"target_form_id": 3,
"store_new_entry_idEnable": "1",
"new_entry_id_field": "6",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "8",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Wait for installation to be scheduled and confirmed",
"description": "Wait for installation to be scheduled and confirmed",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"instructionsEnable": "0",
"instructionsValue": "",
"target_form_id": 4,
"store_new_entry_idEnable": "0",
"new_entry_id_field": "",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "9",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Installation",
"description": " Installation",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"instructionsEnable": "0",
"instructionsValue": "",
"target_form_id": 4,
"store_new_entry_idEnable": "0",
"new_entry_id_field": "",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "10",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Customer acceptance",
"description": "Customer acceptance",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"target_form_id": 1,
"store_new_entry_idEnable": "1",
"new_entry_id_field": "7",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "11",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Customer training",
"description": "Customer training",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"instructionsEnable": "0",
"instructionsValue": "",
"target_form_id": 4,
"store_new_entry_idEnable": "0",
"new_entry_id_field": "",
"destination_complete": "next",
"feedName": " - Copy 1"
},
"addon_slug": "gravityflow",
"event_type": null
},
{
"id": "12",
"form_id": "5",
"is_active": "1",
"feed_order": "0",
"meta": {
"step_name": "Set start\/stop dates for contracts",
"description": "Set start\/stop dates for contracts",
"step_type": "wiaas_delivery_step",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"instructionsEnable": "0",
"instructionsValue": "",
"target_form_id": 4,
"store_new_entry_idEnable": "0",
"new_entry_id_field": "",
"destination_complete": "next"
},
"addon_slug": "gravityflow",
"event_type": null
}
]
}
},
"version": "2.3.2"
}

View File

@@ -0,0 +1,117 @@
[
{
"key": "group_5bc845c001de4",
"title": "Bundle Properties",
"fields": [
{
"key": "field_5bc845dc7eed5",
"label": "Reference",
"name": "_wiaas_package_reference",
"type": "taxonomy",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "product_tag",
"field_type": "select",
"allow_null": 0,
"add_term": 1,
"save_terms": 1,
"load_terms": 1,
"return_format": "id",
"multiple": 0
},
{
"key": "field_5bcfcc2cf88f4",
"label": "Country",
"name": "country",
"type": "taxonomy",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "product_country",
"field_type": "select",
"allow_null": 0,
"add_term": 0,
"save_terms": 1,
"load_terms": 1,
"return_format": "id",
"multiple": 0
},
{
"key": "field_5bdb1512ab14f",
"label": "Additional days prior earliest installation",
"name": "additional_days_prior_earliest_installation",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": 5,
"placeholder": "",
"prepend": "",
"append": "",
"min": 0,
"max": "",
"step": ""
},
{
"key": "field_5bc86761aeafc",
"label": "Unit",
"name": "unit",
"type": "taxonomy",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "wiaas_units",
"field_type": "select",
"allow_null": 0,
"add_term": 1,
"save_terms": 1,
"load_terms": 1,
"return_format": "id",
"multiple": 0
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "product"
},
{
"param": "post_taxonomy",
"operator": "==",
"value": "product_type:bundle"
}
]
],
"menu_order": 0,
"position": "acf_after_title",
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]

View File

@@ -0,0 +1,501 @@
[
{
"key": "group_5bdad38fcebee",
"title": "Country settings",
"fields": [
{
"key": "field_5bdad398384e1",
"label": "Code",
"name": "_wiaas_country_code",
"type": "select",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"ax": "ax - &#197;land Islands",
"af": "af - Afghanistan",
"al": "al - Albania",
"dz": "dz - Algeria",
"as": "as - American Samoa",
"ad": "ad - Andorra",
"ao": "ao - Angola",
"ai": "ai - Anguilla",
"aq": "aq - Antarctica",
"ag": "ag - Antigua and Barbuda",
"ar": "ar - Argentina",
"am": "am - Armenia",
"aw": "aw - Aruba",
"au": "au - Australia",
"at": "at - Austria",
"az": "az - Azerbaijan",
"bs": "bs - Bahamas",
"bh": "bh - Bahrain",
"bd": "bd - Bangladesh",
"bb": "bb - Barbados",
"by": "by - Belarus",
"pw": "pw - Belau",
"be": "be - Belgium",
"bz": "bz - Belize",
"bj": "bj - Benin",
"bm": "bm - Bermuda",
"bt": "bt - Bhutan",
"bo": "bo - Bolivia",
"bq": "bq - Bonaire, Saint Eustatius and Saba",
"ba": "ba - Bosnia and Herzegovina",
"bw": "bw - Botswana",
"bv": "bv - Bouvet Island",
"br": "br - Brazil",
"io": "io - British Indian Ocean Territory",
"vg": "vg - British Virgin Islands",
"bn": "bn - Brunei",
"bg": "bg - Bulgaria",
"bf": "bf - Burkina Faso",
"bi": "bi - Burundi",
"kh": "kh - Cambodia",
"cm": "cm - Cameroon",
"ca": "ca - Canada",
"cv": "cv - Cape Verde",
"ky": "ky - Cayman Islands",
"cf": "cf - Central African Republic",
"td": "td - Chad",
"cl": "cl - Chile",
"cn": "cn - China",
"cx": "cx - Christmas Island",
"cc": "cc - Cocos (Keeling) Islands",
"co": "co - Colombia",
"km": "km - Comoros",
"cg": "cg - Congo (Brazzaville)",
"cd": "cd - Congo (Kinshasa)",
"ck": "ck - Cook Islands",
"cr": "cr - Costa Rica",
"hr": "hr - Croatia",
"cu": "cu - Cuba",
"cw": "cw - Cura&ccedil;ao",
"cy": "cy - Cyprus",
"cz": "cz - Czech Republic",
"dk": "dk - Denmark",
"dj": "dj - Djibouti",
"dm": "dm - Dominica",
"do": "do - Dominican Republic",
"ec": "ec - Ecuador",
"eg": "eg - Egypt",
"sv": "sv - El Salvador",
"gq": "gq - Equatorial Guinea",
"er": "er - Eritrea",
"ee": "ee - Estonia",
"et": "et - Ethiopia",
"fk": "fk - Falkland Islands",
"fo": "fo - Faroe Islands",
"fj": "fj - Fiji",
"fi": "fi - Finland",
"fr": "fr - France",
"gf": "gf - French Guiana",
"pf": "pf - French Polynesia",
"tf": "tf - French Southern Territories",
"ga": "ga - Gabon",
"gm": "gm - Gambia",
"ge": "ge - Georgia",
"de": "de - Germany",
"gh": "gh - Ghana",
"gi": "gi - Gibraltar",
"gr": "gr - Greece",
"gl": "gl - Greenland",
"gd": "gd - Grenada",
"gp": "gp - Guadeloupe",
"gu": "gu - Guam",
"gt": "gt - Guatemala",
"gg": "gg - Guernsey",
"gn": "gn - Guinea",
"gw": "gw - Guinea-Bissau",
"gy": "gy - Guyana",
"ht": "ht - Haiti",
"hm": "hm - Heard Island and McDonald Islands",
"hn": "hn - Honduras",
"hk": "hk - Hong Kong",
"hu": "hu - Hungary",
"is": "is - Iceland",
"in": "in - India",
"id": "id - Indonesia",
"ir": "ir - Iran",
"iq": "iq - Iraq",
"ie": "ie - Ireland",
"im": "im - Isle of Man",
"il": "il - Israel",
"it": "it - Italy",
"ci": "ci - Ivory Coast",
"jm": "jm - Jamaica",
"jp": "jp - Japan",
"je": "je - Jersey",
"jo": "jo - Jordan",
"kz": "kz - Kazakhstan",
"ke": "ke - Kenya",
"ki": "ki - Kiribati",
"kw": "kw - Kuwait",
"kg": "kg - Kyrgyzstan",
"la": "la - Laos",
"lv": "lv - Latvia",
"lb": "lb - Lebanon",
"ls": "ls - Lesotho",
"lr": "lr - Liberia",
"ly": "ly - Libya",
"li": "li - Liechtenstein",
"lt": "lt - Lithuania",
"lu": "lu - Luxembourg",
"mo": "mo - Macao S.A.R., China",
"mk": "mk - Macedonia",
"mg": "mg - Madagascar",
"mw": "mw - Malawi",
"my": "my - Malaysia",
"mv": "mv - Maldives",
"ml": "ml - Mali",
"mt": "mt - Malta",
"mh": "mh - Marshall Islands",
"mq": "mq - Martinique",
"mr": "mr - Mauritania",
"mu": "mu - Mauritius",
"yt": "yt - Mayotte",
"mx": "mx - Mexico",
"fm": "fm - Micronesia",
"md": "md - Moldova",
"mc": "mc - Monaco",
"mn": "mn - Mongolia",
"me": "me - Montenegro",
"ms": "ms - Montserrat",
"ma": "ma - Morocco",
"mz": "mz - Mozambique",
"mm": "mm - Myanmar",
"na": "na - Namibia",
"nr": "nr - Nauru",
"np": "np - Nepal",
"nl": "nl - Netherlands",
"nc": "nc - New Caledonia",
"nz": "nz - New Zealand",
"ni": "ni - Nicaragua",
"ne": "ne - Niger",
"ng": "ng - Nigeria",
"nu": "nu - Niue",
"nf": "nf - Norfolk Island",
"kp": "kp - North Korea",
"mp": "mp - Northern Mariana Islands",
"no": "no - Norway",
"om": "om - Oman",
"pk": "pk - Pakistan",
"ps": "ps - Palestinian Territory",
"pa": "pa - Panama",
"pg": "pg - Papua New Guinea",
"py": "py - Paraguay",
"pe": "pe - Peru",
"ph": "ph - Philippines",
"pn": "pn - Pitcairn",
"pl": "pl - Poland",
"pt": "pt - Portugal",
"pr": "pr - Puerto Rico",
"qa": "qa - Qatar",
"re": "re - Reunion",
"ro": "ro - Romania",
"ru": "ru - Russia",
"rw": "rw - Rwanda",
"st": "st - S&atilde;o Tom&eacute; and Pr&iacute;ncipe",
"bl": "bl - Saint Barth&eacute;lemy",
"sh": "sh - Saint Helena",
"kn": "kn - Saint Kitts and Nevis",
"lc": "lc - Saint Lucia",
"sx": "sx - Saint Martin (Dutch part)",
"mf": "mf - Saint Martin (French part)",
"pm": "pm - Saint Pierre and Miquelon",
"vc": "vc - Saint Vincent and the Grenadines",
"ws": "ws - Samoa",
"sm": "sm - San Marino",
"sa": "sa - Saudi Arabia",
"sn": "sn - Senegal",
"rs": "rs - Serbia",
"sc": "sc - Seychelles",
"sl": "sl - Sierra Leone",
"sg": "sg - Singapore",
"sk": "sk - Slovakia",
"si": "si - Slovenia",
"sb": "sb - Solomon Islands",
"so": "so - Somalia",
"za": "za - South Africa",
"gs": "gs - South Georgia\/Sandwich Islands",
"kr": "kr - South Korea",
"ss": "ss - South Sudan",
"es": "es - Spain",
"lk": "lk - Sri Lanka",
"sd": "sd - Sudan",
"sr": "sr - Suriname",
"sj": "sj - Svalbard and Jan Mayen",
"sz": "sz - Swaziland",
"se": "se - Sweden",
"ch": "ch - Switzerland",
"sy": "sy - Syria",
"tw": "tw - Taiwan",
"tj": "tj - Tajikistan",
"tz": "tz - Tanzania",
"th": "th - Thailand",
"tl": "tl - Timor-Leste",
"tg": "tg - Togo",
"tk": "tk - Tokelau",
"to": "to - Tonga",
"tt": "tt - Trinidad and Tobago",
"tn": "tn - Tunisia",
"tr": "tr - Turkey",
"tm": "tm - Turkmenistan",
"tc": "tc - Turks and Caicos Islands",
"tv": "tv - Tuvalu",
"ug": "ug - Uganda",
"ua": "ua - Ukraine",
"ae": "ae - United Arab Emirates",
"gb": "gb - United Kingdom (UK)",
"us": "us - United States (US)",
"um": "um - United States (US) Minor Outlying Islands",
"vi": "vi - United States (US) Virgin Islands",
"uy": "uy - Uruguay",
"uz": "uz - Uzbekistan",
"vu": "vu - Vanuatu",
"va": "va - Vatican",
"ve": "ve - Venezuela",
"vn": "vn - Vietnam",
"wf": "wf - Wallis and Futuna",
"eh": "eh - Western Sahara",
"ye": "ye - Yemen",
"zm": "zm - Zambia",
"zw": "zw - Zimbabwe"
},
"default_value": [],
"allow_null": 0,
"multiple": 0,
"ui": 1,
"ajax": 0,
"return_format": "value",
"placeholder": ""
},
{
"key": "field_5bfc4b4fa5992",
"label": "Currency",
"name": "_wiaas_country_currency",
"type": "select",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"AED": "United Arab Emirates dirham",
"AFN": "Afghan afghani",
"ALL": "Albanian lek",
"AMD": "Armenian dram",
"ANG": "Netherlands Antillean guilder",
"AOA": "Angolan kwanza",
"ARS": "Argentine peso",
"AUD": "Australian dollar",
"AWG": "Aruban florin",
"AZN": "Azerbaijani manat",
"BAM": "Bosnia and Herzegovina convertible mark",
"BBD": "Barbadian dollar",
"BDT": "Bangladeshi taka",
"BGN": "Bulgarian lev",
"BHD": "Bahraini dinar",
"BIF": "Burundian franc",
"BMD": "Bermudian dollar",
"BND": "Brunei dollar",
"BOB": "Bolivian boliviano",
"BRL": "Brazilian real",
"BSD": "Bahamian dollar",
"BTC": "Bitcoin",
"BTN": "Bhutanese ngultrum",
"BWP": "Botswana pula",
"BYR": "Belarusian ruble (old)",
"BYN": "Belarusian ruble",
"BZD": "Belize dollar",
"CAD": "Canadian dollar",
"CDF": "Congolese franc",
"CHF": "Swiss franc",
"CLP": "Chilean peso",
"CNY": "Chinese yuan",
"COP": "Colombian peso",
"CRC": "Costa Rican col&oacute;n",
"CUC": "Cuban convertible peso",
"CUP": "Cuban peso",
"CVE": "Cape Verdean escudo",
"CZK": "Czech koruna",
"DJF": "Djiboutian franc",
"DKK": "Danish krone",
"DOP": "Dominican peso",
"DZD": "Algerian dinar",
"EGP": "Egyptian pound",
"ERN": "Eritrean nakfa",
"ETB": "Ethiopian birr",
"EUR": "Euro",
"FJD": "Fijian dollar",
"FKP": "Falkland Islands pound",
"GBP": "Pound sterling",
"GEL": "Georgian lari",
"GGP": "Guernsey pound",
"GHS": "Ghana cedi",
"GIP": "Gibraltar pound",
"GMD": "Gambian dalasi",
"GNF": "Guinean franc",
"GTQ": "Guatemalan quetzal",
"GYD": "Guyanese dollar",
"HKD": "Hong Kong dollar",
"HNL": "Honduran lempira",
"HRK": "Croatian kuna",
"HTG": "Haitian gourde",
"HUF": "Hungarian forint",
"IDR": "Indonesian rupiah",
"ILS": "Israeli new shekel",
"IMP": "Manx pound",
"INR": "Indian rupee",
"IQD": "Iraqi dinar",
"IRR": "Iranian rial",
"IRT": "Iranian toman",
"ISK": "Icelandic kr&oacute;na",
"JEP": "Jersey pound",
"JMD": "Jamaican dollar",
"JOD": "Jordanian dinar",
"JPY": "Japanese yen",
"KES": "Kenyan shilling",
"KGS": "Kyrgyzstani som",
"KHR": "Cambodian riel",
"KMF": "Comorian franc",
"KPW": "North Korean won",
"KRW": "South Korean won",
"KWD": "Kuwaiti dinar",
"KYD": "Cayman Islands dollar",
"KZT": "Kazakhstani tenge",
"LAK": "Lao kip",
"LBP": "Lebanese pound",
"LKR": "Sri Lankan rupee",
"LRD": "Liberian dollar",
"LSL": "Lesotho loti",
"LYD": "Libyan dinar",
"MAD": "Moroccan dirham",
"MDL": "Moldovan leu",
"MGA": "Malagasy ariary",
"MKD": "Macedonian denar",
"MMK": "Burmese kyat",
"MNT": "Mongolian t&ouml;gr&ouml;g",
"MOP": "Macanese pataca",
"MRO": "Mauritanian ouguiya",
"MUR": "Mauritian rupee",
"MVR": "Maldivian rufiyaa",
"MWK": "Malawian kwacha",
"MXN": "Mexican peso",
"MYR": "Malaysian ringgit",
"MZN": "Mozambican metical",
"NAD": "Namibian dollar",
"NGN": "Nigerian naira",
"NIO": "Nicaraguan c&oacute;rdoba",
"NOK": "Norwegian krone",
"NPR": "Nepalese rupee",
"NZD": "New Zealand dollar",
"OMR": "Omani rial",
"PAB": "Panamanian balboa",
"PEN": "Peruvian nuevo sol",
"PGK": "Papua New Guinean kina",
"PHP": "Philippine peso",
"PKR": "Pakistani rupee",
"PLN": "Polish z&#x142;oty",
"PRB": "Transnistrian ruble",
"PYG": "Paraguayan guaran&iacute;",
"QAR": "Qatari riyal",
"RON": "Romanian leu",
"RSD": "Serbian dinar",
"RUB": "Russian ruble",
"RWF": "Rwandan franc",
"SAR": "Saudi riyal",
"SBD": "Solomon Islands dollar",
"SCR": "Seychellois rupee",
"SDG": "Sudanese pound",
"SEK": "Swedish krona",
"SGD": "Singapore dollar",
"SHP": "Saint Helena pound",
"SLL": "Sierra Leonean leone",
"SOS": "Somali shilling",
"SRD": "Surinamese dollar",
"SSP": "South Sudanese pound",
"STD": "S&atilde;o Tom&eacute; and Pr&iacute;ncipe dobra",
"SYP": "Syrian pound",
"SZL": "Swazi lilangeni",
"THB": "Thai baht",
"TJS": "Tajikistani somoni",
"TMT": "Turkmenistan manat",
"TND": "Tunisian dinar",
"TOP": "Tongan pa&#x2bb;anga",
"TRY": "Turkish lira",
"TTD": "Trinidad and Tobago dollar",
"TWD": "New Taiwan dollar",
"TZS": "Tanzanian shilling",
"UAH": "Ukrainian hryvnia",
"UGX": "Ugandan shilling",
"USD": "United States (US) dollar",
"UYU": "Uruguayan peso",
"UZS": "Uzbekistani som",
"VEF": "Venezuelan bol&iacute;var",
"VND": "Vietnamese &#x111;&#x1ed3;ng",
"VUV": "Vanuatu vatu",
"WST": "Samoan t&#x101;l&#x101;",
"XAF": "Central African CFA franc",
"XCD": "East Caribbean dollar",
"XOF": "West African CFA franc",
"XPF": "CFP franc",
"YER": "Yemeni rial",
"ZAR": "South African rand",
"ZMW": "Zambian kwacha"
},
"default_value": [],
"allow_null": 0,
"multiple": 0,
"ui": 1,
"ajax": 0,
"return_format": "value",
"placeholder": ""
},
{
"key": "field_5bfc4b00ff8ad",
"label": "VAT",
"name": "_wiaas_country_vat",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
}
],
"location": [
[
{
"param": "taxonomy",
"operator": "==",
"value": "product_country"
}
]
],
"menu_order": 0,
"position": "side",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]

View File

@@ -0,0 +1,103 @@
[
{
"key": "group_5bbf694106e34",
"title": "General",
"fields": [
{
"key": "field_5bceef4c9771c",
"label": "General",
"name": "_wiaas_product_general",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "block",
"sub_fields": [
{
"key": "field_5bc0965a35406",
"label": "Type",
"name": "_wiaas_product_type",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"simple": "Simple",
"bundle": "Bundle",
"wiaastemplate": "Template"
},
"default_value": [],
"allow_null": 0,
"multiple": 0,
"ui": 1,
"ajax": 0,
"return_format": "value",
"placeholder": ""
},
{
"key": "field_5bbf899bba1af",
"label": "Country",
"name": "_wiaas_product_country",
"type": "taxonomy",
"instructions": "",
"required": 1,
"conditional_logic": [
[
{
"field": "field_5bc0965a35406",
"operator": "!=",
"value": "wiaastemplate"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "product_country",
"field_type": "select",
"allow_null": 0,
"add_term": 0,
"save_terms": 1,
"load_terms": 1,
"return_format": "id",
"multiple": 0
}
]
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "product"
},
{
"param": "post_status",
"operator": "==",
"value": "_wiaas_no_country"
}
]
],
"menu_order": 0,
"position": "acf_after_title",
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]

Some files were not shown because too many files have changed in this diff Show More