diff --git a/config/app.php b/config/app.php index e56125308..9461ece41 100755 --- a/config/app.php +++ b/config/app.php @@ -146,6 +146,24 @@ return [ */ 'editor' =>'vscode', + /** + * Debug blacklisting + */ + 'debug_blacklist' => [ + '_ENV' => [ + 'APP_KEY', + 'DB_PASSWORD' + ], + + '_SERVER' => [ + 'APP_KEY', + 'DB_PASSWORD' + ], + + '_POST' => [ + 'password' + ], + ], 'providers' => [ diff --git a/config/datagrid.php b/config/datagrid.php new file mode 100644 index 000000000..c9b1ddc6c --- /dev/null +++ b/config/datagrid.php @@ -0,0 +1,89 @@ + 'id', + + /** + * Default OrderBy + * + * * Accepted Values = Array + */ + 'order' => [ + 'column' => 'id', + 'direction' => 'desc' + ], + + /** + * Select distinct records only + * + * Accepted Values = True || False + */ + 'distinct' => true, + + /** + * Default pagination + * + * Accepted Value = integer + */ + // 'pagination' => 10, + + 'operators' => [ + 'eq' => "=", + 'lt' => "<", + 'gt' => ">", + 'lte' => "<=", + 'gte' => ">=", + 'neqs' => "<>", + 'neqn' => "!=", + 'eqo' => "<=>", + 'like' => "like", + 'blike' => "like binary", + 'nlike' => "not like", + 'ilike' => "ilike", + 'and' => "&", + 'bor' => "|", + 'regex' => "regexp", + 'notregex' => "not regexp", + // 14 => "^", + // 15 => "<<", + // 16 => ">>", + // 17 => "rlike", + // 20 => "~", + // 21 => "~*", + // 22 => "!~", + // 23 => "!~*", + // 24 => "similar to", + // 25 => "not similar to", + // 26 => "not ilike", + // 27 => "~~*", + // 28 => "!~~*" + ], + + 'bindings' => [ + 0 => "select", + 1 => "from", + 2 => "join", + 3 => "where", + 4 => "having", + 5 => "order", + 6 => "union" + ], + + 'selectcomponents' => [ + 0 => "aggregate", + 1 => "columns", + 2 => "from", + 3 => "joins", + 4 => "wheres", + 5 => "groups", + 6 => "havings", + 7 => "orders", + 8 => "limit", + 9 => "offset", + 10 => "lock", + ] +]; \ No newline at end of file diff --git a/packages/Webkul/Admin/publishable/assets/css/admin.css b/packages/Webkul/Admin/publishable/assets/css/admin.css index d4b2be071..8f7f3bc94 100755 --- a/packages/Webkul/Admin/publishable/assets/css/admin.css +++ b/packages/Webkul/Admin/publishable/assets/css/admin.css @@ -1 +1 @@ -@import url(https://fonts.googleapis.com/css?family=Montserrat:400,500);body{margin:0;color:#3a3a3a;font-family:Montserrat,sans-serif;font-size:14px;font-weight:500;position:static;min-height:100%}.navbar-top{height:60px;background:#fff;font-size:0;-webkit-box-shadow:0 3px 6px 0 rgba(0,0,0,.05);box-shadow:0 3px 6px 0 rgba(0,0,0,.05);border-bottom:1px solid hsla(0,0%,64%,.2);position:fixed;left:0;right:0;z-index:5}.navbar-top .navbar-top-left{width:50%;height:60px;display:inline-block;vertical-align:middle}.navbar-top .navbar-top-left .brand-logo{padding:10px}.navbar-top .navbar-top-right{width:50%;height:60px;text-align:right;display:inline-block;vertical-align:middle}.navbar-top .navbar-top-right .profile-info{display:inline-block;vertical-align:middle;text-align:left;min-width:50px;padding:12px 0;margin:0 25px 0 30px;font-size:15px;cursor:pointer;position:relative}.navbar-top .navbar-top-right .profile-info .dropdown-list{top:63px}.navbar-top .navbar-top-right .profile-info .name{color:#000311;display:block;text-align:left}.navbar-top .navbar-top-right .profile-info .role{font-size:14px;color:#8e8e8e;display:block;text-align:left}.navbar-top .navbar-top-right .profile-info i.icon{margin-left:10px}.navbar-left{position:absolute;top:60px;bottom:0;width:90px;padding-top:20px;height:auto;border-right:1px solid hsla(0,0%,64%,.2);z-index:2}.navbar-left ul.menubar li.menu-item{height:90px;padding:10px 5px;font-size:11px;text-align:center;text-transform:uppercase}.navbar-left ul.menubar li.menu-item a{color:#a2a2a2}.navbar-left ul.menubar li.menu-item.active a{color:#0041ff}.content-container{padding-left:90px;position:absolute;margin-top:60px;top:0;right:0;left:0;bottom:0;overflow-x:hidden;overflow-y:auto}.content-container .aside-nav{width:280px;position:fixed;top:60px;bottom:0;border-right:1px solid hsla(0,0%,64%,.2);background:#f8f9fa;padding-top:10px;overflow-y:auto;z-index:4}.content-container .aside-nav a{padding:15px;display:block;color:#000311}.content-container .aside-nav .active a{background:#fff;border-top:1px solid hsla(0,0%,64%,.2);border-bottom:1px solid hsla(0,0%,64%,.2)}.content-container .aside-nav .active i{float:right}.content-container .content-wrapper{padding:25px 25px 25px 305px}.content-container .content{padding:25px 0}.content-container .content.full-page{padding:25px}.content-container .content .page-header{display:inline-block;margin-bottom:20px;width:100%}.content-container .content .page-header .page-title{float:left}.content-container .content .page-header .page-title h1{margin-bottom:0;vertical-align:middle;display:inline-block}.content-container .content .page-header .page-action{float:right}.content-container .content .page-header .page-action *{display:inline-block}.content-container .content .page-header .page-action a{margin-left:25px}.content-container .content .page-header .control-group{width:180px;display:inline-block;margin-bottom:0;margin-left:20px}.content-container .content .page-header .control{width:100%;margin:0}.content-container .content .page-content{width:100%;display:inline-block}.control-group label{width:70%}.control-group label .locale{float:right;color:#8e8e8e}.control-group .mce-tinymce{margin-top:10px;margin-bottom:5px}.dashboard .page-header{margin-bottom:0!important;padding-bottom:15px;border-bottom:1px solid hsla(0,0%,64%,.2)}.dashboard .page-content{margin-top:15px}.dashboard .card{height:445px;background:#fff;border:1px solid #e7e7e7;-webkit-box-shadow:0 5px 10px 2px rgba(0,0,0,.08);box-shadow:0 5px 10px 2px rgba(0,0,0,.08);border-radius:2px;padding:20px 0 0 20px}.dashboard .card .card-title{font-size:14px;color:#a2a2a2;letter-spacing:-.26px;text-transform:uppercase}.dashboard .card .card-info{width:100%;height:100%;display:inline-block}.dashboard .card .card-info.center{text-align:center}.dashboard .card .card-info ul li{border-bottom:1px solid hsla(0,0%,64%,.2);width:100%;display:inline-block;padding:10px 0;position:relative}.dashboard .card .card-info ul li .image{height:60px;width:60px;float:left;margin-right:15px}.dashboard .card .card-info ul li .image.product{background:#f2f2f2}.dashboard .card .card-info ul li .image img{width:100%}.dashboard .card .card-info ul li .description{margin-top:10px}.dashboard .card .card-info ul li .description .name{color:#0041ff}.dashboard .card .card-info ul li .description .info{color:#3a3a3a;margin-top:5px}.dashboard .card .card-info ul li .icon.angle-right-icon{position:absolute;right:30px;top:50%;margin-top:-8px}.dashboard .card .card-info ul li:last-child{border-bottom:0}.dashboard .card .card-info .no-result-found{margin-top:146px}.dashboard .card .card-info .no-result-found p{margin:0;color:#a2a2a2}.dashboard .dashboard-stats{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));grid-auto-rows:auto;grid-column-gap:30px;grid-row-gap:15px}.dashboard .dashboard-stats .dashboard-card{height:100px;background:#fff;border:1px solid #e7e7e7;-webkit-box-shadow:0 5px 10px 2px rgba(0,0,0,.08);box-shadow:0 5px 10px 2px rgba(0,0,0,.08);border-radius:5px;position:relative;padding:15px}.dashboard .dashboard-stats .dashboard-card .title{font-size:14px;color:#a2a2a2;text-transform:uppercase}.dashboard .dashboard-stats .dashboard-card .data{padding-top:3px;font-size:32px;color:#0041ff}.dashboard .dashboard-stats .dashboard-card .data .progress{font-size:14px;color:#8e8e8e;float:right;margin-top:9px}.dashboard .dashboard-stats .dashboard-card .data .progress .icon{vertical-align:middle}.dashboard .graph-stats{margin-top:30px;width:100%;display:inline-block}.dashboard .graph-stats .left-card-container{float:left;width:75%;padding-right:9px}.dashboard .graph-stats .right-card-container{float:left;width:25%;padding-left:21px}.dashboard .sale-stock{width:100%;display:inline-block;display:grid;grid-template-columns:repeat(auto-fill,minmax(435px,1fr));grid-auto-rows:auto;grid-column-gap:30px;grid-row-gap:15px;margin-top:30px}.sale-container .sale-section{font-size:16px}.sale-container .sale-section .secton-title{font-size:18px;color:#8e8e8e;padding:15px 0;border-bottom:1px solid hsla(0,0%,64%,.2)}.sale-container .sale-section .section-content{display:block;padding:20px 0}.sale-container .sale-section .section-content .row{display:block;padding:7px 0}.sale-container .sale-section .section-content .row .title{width:200px;color:#3a3a3a;letter-spacing:-.26px;display:inline-block}.sale-container .sale-section .section-content .row .value{color:#3a3a3a;letter-spacing:-.26px;display:inline-block}.sale-container .table .qty-row{display:block;margin-bottom:5px}.sale-container .table .qty-row:last-child{margin-bottom:0}.sale-container .table .radio{margin:0}.sale-container .sale-summary{margin-top:2%;height:130px;float:right}.sale-container .sale-summary tr td{padding:5px 8px}.sale-container .sale-summary tr.bold{font-weight:600;font-size:15px}.sale-container .sale-summary tr.border td{border-bottom:1px solid hsla(0,0%,64%,.2)}.stars{margin-top:5px}.stars .icon{width:16px;height:16px}.export{cursor:pointer}.export .export-icon{position:relative;top:10px}.export span{margin-left:2px}.rtl{direction:rtl}.rtl .navbar-top .navbar-top-right{text-align:left}.rtl .navbar-top .navbar-top-right .profile-info{margin:0 30px 0 25px}.rtl .navbar-top .navbar-top-right .profile-info i.icon{margin-left:0;margin-right:10px}.rtl .navbar-left{border-left:1px solid hsla(0,0%,64%,.2);border-right:none}.rtl .content-container{padding-right:90px;padding-left:0}.rtl .content-container .content .page-header .page-title{float:right}.rtl .content-container .content .page-header .page-action{float:left}.rtl .content-container .content .page-header .control-group{margin-right:20px;margin-left:0}.rtl .content-container .content .page-header .control-group.date:after{margin-top:6px;position:absolute;margin-right:-35px}.rtl .content-container .content .page-header .control-group.date:last-child{margin-left:0}.rtl .content-container .content-wrapper{padding:25px 305px 25px 25px}.rtl .content-container .aside-nav .active i{float:left;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rtl .dashboard .dashboard-stats .dashboard-card .data span{float:left}.rtl .dashboard .card{padding:20px 20px 0 0}.rtl .dashboard .card .card-info ul li .image{float:right;margin-right:0;margin-left:15px}.rtl .dashboard .card .card-info ul li .icon.angle-right-icon{left:30px;right:auto;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rtl .dashboard .graph-stats .left-card-container{float:right;padding-right:0}.rtl .dashboard .graph-stats .right-card-container{float:right;padding-left:0;padding-right:30px}.rtl .sale-container .sale-summary{float:left}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter{border:2px solid #c7c7c7}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter .control{border:none;padding-right:10px}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter .ic-wrapper{border:none;padding-top:2px;padding-right:5px}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one{margin-right:0}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one .filter-name{margin-right:0;margin-left:5px}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one .filter-value{padding-right:5px;padding-left:0}.rtl .grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header span{padding-right:5px}.rtl .grid-container .table tbody td.action a:first-child{margin-left:10px;margin-right:0}.rtl .table table{text-align:right}.rtl .dropdown-list.bottom-right{left:0;right:auto}.rtl .dropdown-list .dropdown-container{text-align:right}.rtl .accordian .accordian-header .icon{float:left}.rtl .tree-container .tree-item{padding-right:30px}.rtl .tree-container .tree-item .expand-icon,.rtl .tree-container .tree-item .folder-icon{margin-left:10px;margin-right:0}.rtl .tree-container>.tree-item{padding-right:0}.rtl .radio .radio-view{margin-left:5px}.rtl .image-wrapper .image-item{margin-right:0;margin-left:20px}.rtl .image-wrapper .image-item .remove-image{margin-right:0}.rtl .control-group label.required:before{content:"*";color:#fc6868;font-weight:700}.rtl .control-group label.required:after{content:none}.rtl .control-group label .locale{float:left}.rtl .control-group.date:after{margin-top:15px;position:absolute;margin-right:-35px}.rtl .pagination .page-item .icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)} \ No newline at end of file +@import url(https://fonts.googleapis.com/css?family=Montserrat:400,500);body{margin:0;color:#3a3a3a;font-family:Montserrat,sans-serif;font-size:14px;font-weight:500;position:static;min-height:100%}::-webkit-scrollbar{width:12px}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px hsla(0,0%,100%,.3);border-radius:10px}::-webkit-scrollbar-thumb{border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.5)}.navbar-top{height:60px;background:#fff;font-size:0;-webkit-box-shadow:0 3px 6px 0 rgba(0,0,0,.05);box-shadow:0 3px 6px 0 rgba(0,0,0,.05);border-bottom:1px solid hsla(0,0%,64%,.2);position:fixed;left:0;right:0;z-index:5}.navbar-top .navbar-top-left{width:50%;height:60px;display:inline-block;vertical-align:middle}.navbar-top .navbar-top-left .brand-logo{padding:10px}.navbar-top .navbar-top-right{width:50%;height:60px;text-align:right;display:inline-block;vertical-align:middle}.navbar-top .navbar-top-right .profile-info{display:inline-block;vertical-align:middle;text-align:left;min-width:50px;padding:12px 0;margin:0 25px 0 30px;font-size:15px;cursor:pointer;position:relative}.navbar-top .navbar-top-right .profile-info .dropdown-list{top:63px}.navbar-top .navbar-top-right .profile-info .name{color:#000311;display:block;text-align:left}.navbar-top .navbar-top-right .profile-info .role{font-size:14px;color:#8e8e8e;display:block;text-align:left}.navbar-top .navbar-top-right .profile-info i.icon{margin-left:10px}.navbar-left{position:absolute;top:60px;bottom:0;width:90px;padding-top:20px;height:auto;border-right:1px solid hsla(0,0%,64%,.2);z-index:2}.navbar-left ul.menubar li.menu-item{height:90px;padding:10px 5px;font-size:11px;text-align:center;text-transform:uppercase}.navbar-left ul.menubar li.menu-item a{color:#a2a2a2}.navbar-left ul.menubar li.menu-item.active a{color:#0041ff}.content-container{padding-left:90px;position:absolute;margin-top:60px;top:0;right:0;left:0;bottom:0;overflow-x:hidden;overflow-y:auto}.content-container .aside-nav{width:280px;position:fixed;top:60px;bottom:0;border-right:1px solid hsla(0,0%,64%,.2);background:#f8f9fa;padding-top:10px;overflow-y:auto;z-index:4}.content-container .aside-nav a{padding:15px;display:block;color:#000311}.content-container .aside-nav .active a{background:#fff;border-top:1px solid hsla(0,0%,64%,.2);border-bottom:1px solid hsla(0,0%,64%,.2)}.content-container .aside-nav .active i{float:right}.content-container .content-wrapper{padding:25px 25px 25px 305px}.content-container .content{margin-top:25px}.content-container .content.full-page{padding:25px}.content-container .content .page-header{display:inline-block;margin-bottom:20px;width:100%}.content-container .content .page-header .page-title{float:left}.content-container .content .page-header .page-title h1{margin-bottom:0;vertical-align:middle;display:inline-block}.content-container .content .page-header .page-action{float:right}.content-container .content .page-header .page-action *{display:inline-block}.content-container .content .page-header .page-action a{margin-left:25px}.content-container .content .page-header .control-group{width:180px;display:inline-block;margin-bottom:0;margin-left:20px}.content-container .content .page-header .control{width:100%;margin:0}.content-container .content .page-content{width:100%;display:inline-block}.control-group label{width:70%}.control-group label .locale{float:right;color:#8e8e8e}.control-group .mce-tinymce{margin-top:10px;margin-bottom:5px}.dashboard .page-header{margin-bottom:0!important;padding-bottom:15px;border-bottom:1px solid hsla(0,0%,64%,.2)}.dashboard .page-content{margin-top:15px}.dashboard .card{height:445px;background:#fff;border:1px solid #e7e7e7;-webkit-box-shadow:0 5px 10px 2px rgba(0,0,0,.08);box-shadow:0 5px 10px 2px rgba(0,0,0,.08);border-radius:2px;padding:20px 0 0 20px}.dashboard .card .card-title{font-size:14px;color:#a2a2a2;letter-spacing:-.26px;text-transform:uppercase}.dashboard .card .card-info{width:100%;height:100%;display:inline-block}.dashboard .card .card-info.center{text-align:center}.dashboard .card .card-info ul li{border-bottom:1px solid hsla(0,0%,64%,.2);width:100%;display:inline-block;padding:10px 0;position:relative}.dashboard .card .card-info ul li .image{height:60px;width:60px;float:left;margin-right:15px}.dashboard .card .card-info ul li .image.product{background:#f2f2f2}.dashboard .card .card-info ul li .image img{width:100%}.dashboard .card .card-info ul li .description{margin-top:10px}.dashboard .card .card-info ul li .description .name{color:#0041ff}.dashboard .card .card-info ul li .description .info{color:#3a3a3a;margin-top:5px}.dashboard .card .card-info ul li .icon.angle-right-icon{position:absolute;right:30px;top:50%;margin-top:-8px}.dashboard .card .card-info ul li:last-child{border-bottom:0}.dashboard .card .card-info .no-result-found{margin-top:146px}.dashboard .card .card-info .no-result-found p{margin:0;color:#a2a2a2}.dashboard .dashboard-stats{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));grid-auto-rows:auto;grid-column-gap:30px;grid-row-gap:15px}.dashboard .dashboard-stats .dashboard-card{height:100px;background:#fff;border:1px solid #e7e7e7;-webkit-box-shadow:0 5px 10px 2px rgba(0,0,0,.08);box-shadow:0 5px 10px 2px rgba(0,0,0,.08);border-radius:5px;position:relative;padding:15px}.dashboard .dashboard-stats .dashboard-card .title{font-size:14px;color:#a2a2a2;text-transform:uppercase}.dashboard .dashboard-stats .dashboard-card .data{padding-top:3px;font-size:32px;color:#0041ff}.dashboard .dashboard-stats .dashboard-card .data .progress{font-size:14px;color:#8e8e8e;float:right;margin-top:9px}.dashboard .dashboard-stats .dashboard-card .data .progress .icon{vertical-align:middle}.dashboard .graph-stats{margin-top:30px;width:100%;display:inline-block}.dashboard .graph-stats .left-card-container{float:left;width:75%;padding-right:9px}.dashboard .graph-stats .right-card-container{float:left;width:25%;padding-left:21px}.dashboard .sale-stock{width:100%;display:inline-block;display:grid;grid-template-columns:repeat(auto-fill,minmax(435px,1fr));grid-auto-rows:auto;grid-column-gap:30px;grid-row-gap:15px;margin-top:30px}.sale-container .sale-section{font-size:16px}.sale-container .sale-section .secton-title{font-size:18px;color:#8e8e8e;padding:15px 0;border-bottom:1px solid hsla(0,0%,64%,.2)}.sale-container .sale-section .section-content{display:block;padding:20px 0}.sale-container .sale-section .section-content .row{display:block;padding:7px 0}.sale-container .sale-section .section-content .row .title{width:200px;color:#3a3a3a;letter-spacing:-.26px;display:inline-block}.sale-container .sale-section .section-content .row .value{color:#3a3a3a;letter-spacing:-.26px;display:inline-block}.sale-container .table .qty-row{display:block;margin-bottom:5px}.sale-container .table .qty-row:last-child{margin-bottom:0}.sale-container .table .radio{margin:0}.sale-container .sale-summary{margin-top:2%;height:130px;float:right}.sale-container .sale-summary tr td{padding:5px 8px}.sale-container .sale-summary tr.bold{font-weight:600;font-size:15px}.sale-container .sale-summary tr.border td{border-bottom:1px solid hsla(0,0%,64%,.2)}.stars{margin-top:5px}.stars .icon{width:16px;height:16px}.export{cursor:pointer}.export .export-icon{position:relative;top:10px}.export span{margin-left:2px}.rtl{direction:rtl}.rtl .navbar-top .navbar-top-right{text-align:left}.rtl .navbar-top .navbar-top-right .profile-info{margin:0 30px 0 25px}.rtl .navbar-top .navbar-top-right .profile-info i.icon{margin-left:0;margin-right:10px}.rtl .navbar-left{border-left:1px solid hsla(0,0%,64%,.2);border-right:none}.rtl .content-container{padding-right:90px;padding-left:0}.rtl .content-container .content .page-header .page-title{float:right}.rtl .content-container .content .page-header .page-action{float:left}.rtl .content-container .content .page-header .control-group{margin-right:20px;margin-left:0}.rtl .content-container .content .page-header .control-group.date:after{margin-top:6px;position:absolute;margin-right:-35px}.rtl .content-container .content .page-header .control-group.date:last-child{margin-left:0}.rtl .content-container .content-wrapper{padding:25px 305px 25px 25px}.rtl .content-container .aside-nav .active i{float:left;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rtl .dashboard .dashboard-stats .dashboard-card .data span{float:left}.rtl .dashboard .card{padding:20px 20px 0 0}.rtl .dashboard .card .card-info ul li .image{float:right;margin-right:0;margin-left:15px}.rtl .dashboard .card .card-info ul li .icon.angle-right-icon{left:30px;right:auto;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rtl .dashboard .graph-stats .left-card-container{float:right;padding-right:0}.rtl .dashboard .graph-stats .right-card-container{float:right;padding-left:0;padding-right:30px}.rtl .sale-container .sale-summary{float:left}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter{border:2px solid #c7c7c7}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter .control{border:none;padding-right:10px}.rtl .grid-container .filter-wrapper .filter-row-one .search-filter .ic-wrapper{border:none;padding-top:2px;padding-right:5px}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one{margin-right:0}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one .filter-name{margin-right:0;margin-left:5px}.rtl .grid-container .filter-wrapper .filter-row-two .filter-one .filter-value{padding-right:5px;padding-left:0}.rtl .grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header span{padding-right:5px}.rtl .grid-container .table tbody td.action a:first-child{margin-left:10px;margin-right:0}.rtl .table table{text-align:right}.rtl .dropdown-list.bottom-right{left:0;right:auto}.rtl .dropdown-list .dropdown-container{text-align:right}.rtl .accordian .accordian-header .icon{float:left}.rtl .tree-container .tree-item{padding-right:30px}.rtl .tree-container .tree-item .expand-icon,.rtl .tree-container .tree-item .folder-icon{margin-left:10px;margin-right:0}.rtl .tree-container>.tree-item{padding-right:0}.rtl .radio .radio-view{margin-left:5px}.rtl .image-wrapper .image-item{margin-right:0;margin-left:20px}.rtl .image-wrapper .image-item .remove-image{margin-right:0}.rtl .control-group label.required:before{content:"*";color:#fc6868;font-weight:700}.rtl .control-group label.required:after{content:none}.rtl .control-group label .locale{float:left}.rtl .control-group.date:after{margin-top:15px;position:absolute;margin-right:-35px}.rtl .pagination .page-item .icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)} \ No newline at end of file diff --git a/packages/Webkul/Admin/publishable/assets/mix-manifest.json b/packages/Webkul/Admin/publishable/assets/mix-manifest.json index 0161eb3be..55e257eec 100755 --- a/packages/Webkul/Admin/publishable/assets/mix-manifest.json +++ b/packages/Webkul/Admin/publishable/assets/mix-manifest.json @@ -1,4 +1,4 @@ { "/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77", - "/css/admin.css": "/css/admin.css?id=d40a640933cbcc121f1d" + "/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21" } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php index bb6caf11c..fa7a936c3 100755 --- a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php @@ -2,213 +2,156 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Attributes DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class AttributeDataGrid +class AttributeDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for Attributes - */ - public function createAttributeDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('attributes')->select('id')->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel'); - return DataGrid::make([ - 'name' => 'Attributes', - 'table' => 'attributes', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => true, + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' => [ - 0 => [ - 'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance - 'action' => route('admin.catalog.attributes.massdelete'), - 'method' => 'DELETE' - ] - ], + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.catalog.attributes.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.catalog.attributes.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'attributeId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'attributeCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'admin_name', - 'alias' => 'attributeAdminName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'type', - 'alias' => 'attributeType', - 'type' => 'string', - 'label' => 'Type', - 'sortable' => true, - ], [ - 'name' => 'is_required', - 'alias' => 'attributeIsRequired', - 'type' => 'boolean', - 'label' => 'Required', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ], [ - 'name' => 'is_unique', - 'alias' => 'attributeIsUnique', - 'type' => 'boolean', - 'label' => 'Unique', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ], [ - 'name' => 'value_per_locale', - 'alias' => 'attributeValuePerLocale', - 'type' => 'boolean', - 'label' => 'Locale based', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ], [ - 'name' => 'value_per_channel', - 'alias' => 'attributeValuePerChannel', - 'type' => 'boolean', - 'label' => 'Channel based', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ] - ], - - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'attributeId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'attributeCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'admin_name', - 'alias' => 'attributeAdminName', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'type', - 'alias' => 'attributeType', - 'type' => 'string', - 'label' => 'Type', - ], [ - 'column' => 'is_required', - 'alias' => 'attributeIsRequired', - 'type' => 'boolean', - 'label' => 'Required', - ], [ - 'column' => 'is_unique', - 'alias' => 'attributeIsUnique', - 'type' => 'boolean', - 'label' => 'Unique', - ], [ - 'column' => 'value_per_locale', - 'alias' => 'attributeValuePerLocale', - 'type' => 'boolean', - 'label' => 'Locale based', - ], [ - 'column' => 'value_per_channel', - 'alias' => 'attributeValuePerChannel', - 'type' => 'boolean', - 'label' => 'Channel based', - ] - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'code', - 'alias' => 'attributeCode', - 'type' => 'string', - ], [ - 'column' => 'admin_name', - 'alias' => 'attributeAdminName', - 'type' => 'string', - ], [ - 'column' => 'type', - 'alias' => 'attributeType', - 'type' => 'string', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - - // 'css' => [] + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'attributeId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'code', + 'alias' => 'attributeCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'admin_name', + 'alias' => 'attributeAdminName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'type', + 'alias' => 'attributeType', + 'label' => 'Type', + 'type' => 'string', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'is_required', + 'alias' => 'attributeRequired', + 'label' => 'Required', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'True'; + else + return 'False'; + } + ]); + + $this->addColumn([ + 'index' => 'is_unique', + 'alias' => 'attributeIsUnique', + 'label' => 'Unique', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'True'; + else + return 'False'; + } + ]); + + $this->addColumn([ + 'index' => 'value_per_locale', + 'alias' => 'attributeValuePerLocale', + 'label' => 'Locale Based', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'True'; + else + return 'False'; + } + ]); + + $this->addColumn([ + 'index' => 'value_per_channel', + 'alias' => 'attributeValuePerChannel', + 'label' => 'Channel Based', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'True'; + else + return 'False'; + } + ]); } - public function render() - { - return $this->createAttributeDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.catalog.attributes.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.catalog.attributes.delete', + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + $this->addMassAction([ + 'type' => 'delete', + 'action' => route('admin.catalog.attributes.massdelete'), + 'method' => 'DELETE' + ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php index 32df17782..2c8adeff9 100755 --- a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php @@ -2,143 +2,93 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Attributes Family DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class AttributeFamilyDataGrid +class AttributeFamilyDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for Attribute Families - */ - public function createAttributeFamilyDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('attribute_families')->select('id')->addSelect('id', 'code', 'name'); - return DataGrid::make([ - 'name' => 'Attribute Family', - 'table' => 'attribute_families', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.catalog.families.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.catalog.families.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'attributeFamilyId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'attributeFamilyCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'attributeFamilyName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], - ], - - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'attributeFamilyId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'attributeFamilyCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'attributeFamilyName', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'attributeFamilyId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'code', + 'alias' => 'attributeFamilyCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'name', + 'alias' => 'attributeFamilyName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() - { + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.catalog.families.edit', + 'icon' => 'icon pencil-lg-icon' + ]); - return $this->createAttributeFamilyDataGrid()->render(); + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.catalog.families.delete', + // 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), + 'icon' => 'icon trash-icon' + ]); + } + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.familites.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.familites.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 313cec54d..8665cab42 100755 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -2,167 +2,119 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; - +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Category DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CategoryDataGrid +class CategoryDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for category - */ - public function createCategoryDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('categories as cat')->select('cat.id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale')->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id'); - return DataGrid::make([ - 'name' => 'Categories', - 'table' => 'categories as cat', - 'select' => 'cat.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.catalog.categories.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.catalog.categories.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'cat.id', + 'alias' => 'catId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'category_translations as ct', - 'primaryKey' => 'cat.id', - 'condition' => '=', - 'secondaryKey' => 'ct.category_id', - ], - ], + $this->addColumn([ + 'index' => 'ct.name', + 'alias' => 'catName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); - //use aliasing on secodary columns if join is performed + $this->addColumn([ + 'index' => 'cat.position', + 'alias' => 'catPosition', + 'label' => 'Position', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); - 'columns' => [ - [ - 'name' => 'cat.id', - 'alias' => 'catid', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'ct.name', - 'alias' => 'catname', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'cat.position', - 'alias' => 'catposition', - 'type' => 'string', - 'label' => 'Position', - 'sortable' => true, - ], [ - 'name' => 'cat.status', - 'alias' => 'catstatus', - 'type' => 'boolean', - 'label' => 'Visible in Menu', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ], [ - 'name' => 'ct.locale', - 'alias' => 'catlocale', - 'type' => 'string', - 'label' => 'Locale', - 'sortable' => true, - 'filter' => [ - 'function' => 'orWhere', - 'condition' => ['ct.locale', app()->getLocale()] - ], - ] - ], + $this->addColumn([ + 'index' => 'cat.status', + 'alias' => 'catStatus', + 'label' => 'Status', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'Active'; + else + return 'Inactive'; + } + ]); - 'filterable' => [ - [ - 'column' => 'cat.id', - 'alias' => 'catid', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'ct.name', - 'alias' => 'catname', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'cat.status', - 'alias' => 'catstatus', - 'type' => 'boolean', - 'label' => 'Visible in Menu', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'cat.id', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'ct.name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'cat.status', - 'type' => 'string', - 'label' => 'Visible in Menu', - ] - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'ct.locale', + 'alias' => 'catLocale', + 'label' => 'Locale', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px' ]); } - public function render() - { - return $this->createCategoryDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.catalog.products.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.catalog.products.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php index 87c9bde98..a3ba4f12c 100755 --- a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -2,157 +2,103 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; - +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Channels DataGrid + * Channel Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class ChannelDataGrid +class ChannelDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for channel - */ - public function createChannelsDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('channels')->addSelect('id', 'code', 'name', 'hostname'); - return DataGrid::make([ - 'name' => 'Channels', - 'table' => 'channels', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.channels.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.channels.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'channelID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'channelCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'channelName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'hostname', - 'alias' => 'channelHostName', - 'type' => 'string', - 'label' => 'Host Name', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'channelID', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'channelCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'channelName', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'hostname', - 'type' => 'string', - 'label' => 'Host Name', - ], [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'channelId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'code', + 'alias' => 'channelCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'name', + 'alias' => 'channelName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'hostname', + 'alias' => 'channelHostname', + 'label' => 'Hostname', + 'type' => 'string', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px' + ]); } - public function render() - { - return $this->createChannelsDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.channels.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.channels.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php index a94818bc6..32679093a 100755 --- a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php @@ -2,165 +2,112 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; - +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Countries DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CountryDataGrid +class CountryDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for countries - */ - public function createCountryDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('countries')->select('id')->addSelect($this->columns); - return DataGrid::make([ - 'name' => 'Countries', - 'table' => 'countries', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins - - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => route('admin.datagrid.delete'), - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => route('admin.datagrid.delete'), - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'countryId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'countryCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'countryName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'status', - 'alias' => 'countryStatus', - 'type' => 'number', - 'label' => 'Code', - 'sortable' => true, - ], - - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'countryId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'countryCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'countryName', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'status', - 'alias' => 'countryStatus', - 'type' => 'number', - 'label' => 'Code', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'status', - 'type' => 'number', - 'label' => 'Code', - ] - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->setQueryBuilder($queryBuilder); + } + public function addColumns() + { + $this->addColumn([ + 'column' => 'id', + 'alias' => 'countryId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'column' => 'code', + 'alias' => 'countryCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'column' => 'name', + 'alias' => 'countryName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'column' => 'status', + 'alias' => 'countryStatus', + 'label' => 'Status', + 'type' => 'number', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px' + ]); + } + + public function prepareActions() { + $this->prepareAction([ + 'type' => 'Edit', + 'route' => 'admin.catalog.products.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->prepareAction([ + 'type' => 'Delete', + 'route' => 'admin.catalog.products.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } public function render() { + $this->addColumns(); - return $this->createCountryDataGrid()->render(); + $this->prepareActions(); + $this->prepareMassActions(); + + $this->prepareQueryBuilder(); + + return view('ui::testgrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php index a53903a99..c1a9e11d7 100755 --- a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php @@ -2,146 +2,92 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Currencies DataGrid + * Currency Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CurrencyDataGrid +class CurrencyDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for currencies - */ - public function createCurrencyDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('currencies')->addSelect('id', 'name', 'code'); - return DataGrid::make([ - 'name' => 'Currencies', - 'table' => 'currencies', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - 0 => [ - 'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance - 'action' => route('admin.currencies.massdelete'), - 'method' => 'DELETE' - ] - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.currencies.edit', - // 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.currencies.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'currencyId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'currencyCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'currencyName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], - - ], - - //don't use aliasing in case of filters - - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'currencyId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'currencyCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'currencyName', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'id', - 'alias' => 'currencyId', - 'type' => 'number', - ], [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'currencyId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'name', + 'alias' => 'currencyName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'code', + 'alias' => 'currencyCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() - { - return $this->createCurrencyDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.currencies.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.currencies.delete', + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php index 7d4f9242b..463534b67 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -2,154 +2,103 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Customer DataGrid + * Currency Data Grid class * - * @author Rahul Shukla @rahul-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CustomerDataGrid +class CustomerDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The CustomerDataGrid implementation. - */ - public function createCustomerDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('customers as cus')->addSelect('cus.id', 'cus.first_name', 'cus.email', 'cg.name')->leftJoin('customer_groups as cg', 'cus.customer_group_id', '=', 'cg.id'); - return DataGrid::make([ - 'name' => 'Customer', - 'table' => 'customers as cus', - 'select' => 'cus.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', //select || button only - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.customer.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.customer.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'customer_groups as cg', - 'primaryKey' => 'cus.customer_group_id', - 'condition' => '=', - 'secondaryKey' => 'cg.id', - ] - ], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'cus.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'CONCAT(first_name, " ", last_name)', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'Email', - 'sortable' => false, - ], [ - 'name' => 'cg.name', - 'alias' => 'CustomerGroupName', - 'type' => 'string', - 'label' => 'Group Name', - 'sortable' => false, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'cus.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'Email', - ], [ - 'column' => 'cg.name', - 'alias' => 'CustomerGroupName', - 'type' => 'string', - 'label' => 'Group Name', - ], [ - 'column' => 'CONCAT(first_name, " ", last_name)', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'FirstName', - 'type' => 'string', - 'label' => 'First Name', - ], [ - 'column' => 'email', - 'alias' => 'Email', - 'type' => 'string', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'cus.id', + 'alias' => 'customerId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + // 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)', + 'index' => 'cus.first_name', + 'alias' => 'customerFullName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'cus.email', + 'alias' => 'customerEmail', + 'label' => 'Email', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'cg.name', + 'alias' => 'customerGroupName', + 'label' => 'Group', + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render($pagination = true) - { + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.customer.edit', + 'icon' => 'icon pencil-lg-icon' + ]); - return $this->createCustomerDataGrid()->render($pagination); + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.customer.delete', + 'icon' => 'icon trash-icon' + ]); + } + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php index 8bd25c996..64891c0d3 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php @@ -2,136 +2,83 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Customer Group DataGrid + * Currency Data Grid class * - * @author Rahul Shukla + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CustomerGroupDataGrid +class CustomerGroupDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Customer Group Data Grid implementation. - */ - public function createCustomerGroupDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('customer_groups')->addSelect('id', 'name'); - return DataGrid::make([ + $this->setQueryBuilder($queryBuilder); + } - 'name' => 'Customer Group', - 'table' => 'customer_groups as cg', - 'select' => 'cg.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins - - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - // [ - // 'route' => route('admin.datagrid.index'), - // 'method' => 'POST', - // 'label' => 'View Grid', - // 'type' => 'select', - // 'options' =>[ - // 1 => 'Edit', - // 2 => 'Set', - // 3 => 'Change Status' - // ] - // ], - ], - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.groups.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.groups.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'cg.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'cg.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'cg.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name' - ], [ - 'column' => 'cg.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID' - ], - ], - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'cg.id', - 'type' => 'number', - 'label' => 'Id' - ], [ - 'column' => 'cg.name', - 'type' => 'string', - 'label' => 'Name' - ] - ], - - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'groupId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + // 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)', + 'index' => 'name', + 'alias' => 'groupName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() { - return $this->createCustomerGroupDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.customer.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.customer.delete', + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php index b3381e2e6..015f0783e 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php @@ -2,182 +2,119 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; - +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * CustomerReview DataGrid + * Currency Data Grid class * - * @author Rahul Shukla @rahul-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CustomerReviewDataGrid +class CustomerReviewDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The ProductReviewDataGrid implementation for Product Reviews - */ - public function createCustomerReviewDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id'); - return DataGrid::make([ - 'name' => 'Review', - 'table' => 'product_reviews as pr', - 'select' => 'pr.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - 0 => [ - 'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance - 'action' => route('admin.customer.review.massdelete'), - 'method' => 'DELETE' - ], 1 => [ - 'type' => 'update', //all lower case will be shifted in the configuration file for better control and increased fault tolerance - 'action' => route('admin.customer.review.massupdate'), - 'method' => 'PUT', - 'options' => [ - 0 => 'Disapprove', - 1 => 'Approve', - ] - ] - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.customer.review.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.customer.review.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'products_grid as pt', - 'primaryKey' => 'pr.product_id', - 'condition' => '=', - 'secondaryKey' => 'pt.product_id', - ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'pr.id', - 'alias' => 'reviewId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'pr.title', - 'alias' => 'titleName', - 'type' => 'string', - 'label' => 'Title', - 'sortable' => true, - ], [ - 'name' => 'pr.comment', - 'alias' => 'productComment', - 'type' => 'string', - 'label' => 'Comment', - 'sortable' => true, - ], [ - 'name' => 'pt.name', - 'alias' => 'productName', - 'type' => 'string', - 'label' => 'Product Name', - 'sortable' => true, - ], [ - 'name' => 'pr.status', - 'alias' => 'reviewStatus', - 'type' => 'number', - 'label' => 'Status', - 'sortable' => true, - 'closure' => true, - 'wrapper' => function ($value) { - if($value == 'approved') - return 'Approved'; - else if($value == "pending") - return 'Pending'; - }, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'pr.id', - 'alias' => 'reviewId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'pr.title', - 'alias' => 'titleName', - 'type' => 'string', - 'label' => 'Title', - ], [ - 'column' => 'pr.comment', - 'alias' => 'productComment', - 'type' => 'string', - 'label' => 'Comment', - ], [ - 'column' => 'pt.name', - 'alias' => 'productName', - 'type' => 'string', - 'label' => 'Product Name', - ], [ - 'column' => 'pr.status', - 'alias' => 'reviewStatus', - 'type' => 'string', - 'label' => 'Status', - ], - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'title', - 'type' => 'string', - 'label' => 'Title', - ], [ - 'column' => 'rating', - 'type' => 'number', - 'label' => 'Rating', - ], [ - 'column' => 'pt.name', - 'alias' => 'productName', - 'type' => 'string', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'pr.id', + 'alias' => 'reviewId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'pr.title', + 'alias' => 'reviewTitle', + 'label' => 'Title', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'pr.comment', + 'alias' => 'reviewComment', + 'label' => 'Comment', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'pg.name', + 'alias' => 'productName', + 'label' => 'Product', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'pr.status', + 'alias' => 'reviewStatus', + 'label' => 'Status', + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'closure' => true, + 'wrapper' => function ($value) { + if($value == 'approved') + return 'Approved'; + else if($value == "pending") + return 'Pending'; + }, + ]); } - public function render() - { - return $this->createCustomerReviewDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.customer.review.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.customer.review.delete', + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + $this->addMassAction([ + 'type' => 'delete', + 'action' => route('admin.catalog.products.massdelete'), + 'method' => 'DELETE' + ]); + + $this->addMassAction([ + 'type' => 'update', + 'action' => route('admin.catalog.products.massupdate'), + 'method' => 'PUT', + 'options' => [ + 0 => true, + 1 => false, + ] + ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php index d2f9b0ef8..2b45a8497 100755 --- a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php @@ -2,141 +2,93 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Exchange Rates DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class ExchangeRatesDataGrid +class ExchangeRatesDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for Exchange Rates - */ - public function createExchangeRatesDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id'); - return DataGrid::make([ - 'name' => 'Exchange Rates', - 'table' => 'currency_exchange_rates as cer', - 'select' => 'cer.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.exchange_rates.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.exchange_rates.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'currencies as curr', - 'primaryKey' => 'cer.target_currency', - 'condition' => '=', - 'secondaryKey' => 'curr.id', - ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'cer.id', - 'alias' => 'exchid', - 'type' => 'number', - 'label' => 'Rate ID', - 'sortable' => true, - ], [ - 'name' => 'curr.name', - 'alias' => 'exchcurrname', - 'type' => 'string', - 'label' => 'Currency Name', - 'sortable' => true, - ], [ - 'name' => 'cer.rate', - 'alias' => 'exchrate', - 'type' => 'string', - 'label' => 'Exchange Rate', - 'sortable' => true - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'cer.id', - 'alias' => 'exchid', - 'type' => 'number', - 'label' => 'Rate ID', - ], [ - 'column' => 'curr.name', - 'alias' => 'exchcurrname', - 'type' => 'string', - 'label' => 'Currency Name', - ], [ - 'column' => 'cer.rate', - 'alias' => 'exchrate', - 'type' => 'string', - 'label' => 'Exchange Rate', - ], - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'exchcurrname', - 'type' => 'string', - 'label' => 'Currency Name', - ], [ - 'column' => 'cer.rate', - 'type' => 'string', - 'label' => 'Exchange Rate', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'cer.id', + 'alias' => 'exchId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'curr.name', + 'alias' => 'exchName', + 'label' => 'Currency Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'cer.rate', + 'alias' => 'exchRate', + 'label' => 'Exchange Rate', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() - { - return $this->createExchangeRatesDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.exchange_rates.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.exchange_rates.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 65c3f3858..668fe3bc3 100755 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -2,169 +2,119 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Inventory Sources DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class InventorySourcesDataGrid +class InventorySourcesDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for Inventory Sources - */ - public function createInventorySourcesDataGrid() + public function prepareQueryBuilder() { - return DataGrid::make([ - 'name' => 'Inventory Sources', - 'table' => 'inventory_sources', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status'); - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + $this->setQueryBuilder($queryBuilder); + } - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.inventory_sources.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.inventory_sources.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], + public function setIndex() { + $this->index = 'id'; + } - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'invId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - //use aliasing on secodary columns if join is performed - 'columns' => [ + $this->addColumn([ + 'index' => 'code', + 'alias' => 'invCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); - [ - 'name' => 'id', - 'alias' => 'inventoryID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'inventoryCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'inventoryName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'priority', - 'alias' => 'inventoryPriority', - 'type' => 'string', - 'label' => 'Priority', - 'sortable' => true, - ], [ - 'name' => 'status', - 'alias' => 'inventoryStatus', - 'type' => 'boolean', - 'label' => 'Status', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "In Active"; - else - return "Active"; - }, - ], + $this->addColumn([ + 'index' => 'name', + 'alias' => 'invName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); - ], - - //don't use aliasing in case of filters - - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'inventoryID', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'inventoryCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'inventoryName', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'name' => 'status', - 'alias' => 'inventoryStatus', - 'type' => 'boolean', - 'label' => 'Status', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'priority', + 'alias' => 'invPriority', + 'label' => 'Priority', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + $this->addColumn([ + 'index' => 'status', + 'alias' => 'invStatus', + 'label' => 'Status', + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'Active'; + else + return 'Inactive'; + } ]); } - public function render() - { - return $this->createInventorySourcesDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.inventory_sources.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.inventory_sources.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index 9a2ca5ef2..044321232 100755 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -2,141 +2,93 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Locales DataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class LocalesDataGrid +class LocalesDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for countries - */ - public function createCountryDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name'); - return DataGrid::make([ - 'name' => 'Locales', - 'table' => 'locales', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.locales.edit', - // 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.locales.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing as attribute - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'localeId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'code', - 'alias' => 'localeCode', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'localeName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], - - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'localeId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'code', - 'alias' => 'localeCode', - 'type' => 'string', - 'label' => 'Code', - ], [ - 'column' => 'name', - 'alias' => 'localeName', - 'type' => 'string', - 'label' => 'Name', - ], - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'code', - 'type' => 'string', - 'label' => 'Code', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'localeId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'code', + 'alias' => 'localeCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'name', + 'alias' => 'localeName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() - { - return $this->createCountryDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.locales.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.locales.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php b/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php index c8c9e7bb7..84d7e2dad 100755 --- a/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php @@ -2,140 +2,99 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * orderDataGrid + * News Letter Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class NewsLetterDataGrid +class NewsLetterDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for orders - */ - public function newsLetterDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('subscribers_list')->addSelect('id', 'is_subscribed', 'email'); - return DataGrid::make([ - 'name' => 'Subscriberslist', - 'table' => 'subscribers_list as sublist', - 'select' => 'sublist.id', - 'perpage' => 10, - 'aliased' => false, - //True in case of joins else aliasing key required on all cases + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + public function setIndex() { + $this->index = 'id'; + } - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.customers.subscribers.edit', - // 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.customers.subscribers.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'subsId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - 'join' => [], + $this->addColumn([ + 'index' => 'is_subscribed', + 'alias' => 'subsCode', + 'label' => 'Subscribed', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'wrapper' => function($value){ + if($value == 1) + return 'True'; + else + return 'False'; + } + ]); - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'sublist.id', - 'alias' => 'subid', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true - ], [ - 'name' => 'sublist.is_subscribed', - 'alias' => 'issubs', - 'type' => 'boolean', - 'label' => 'Subscribed', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 0) - return "False"; - else - return "True"; - }, - ], [ - 'name' => 'sublist.email', - 'alias' => 'subsemail', - 'type' => 'string', - 'label' => 'Email', - 'sortable' => true - ] - ], - - 'filterable' => [ - [ - 'column' => 'sublist.id', - 'alias' => 'subid', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'sublist.is_subscribed', - 'alias' => 'issubs', - 'type' => 'boolean', - 'label' => 'Subscribed', - ], [ - 'column' => 'sublist.email', - 'alias' => 'subsemail', - 'type' => 'string', - 'label' => 'Email', - ] - ], - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'sublist.id', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'sublist.is_subscribed', - 'type' => 'string', - 'label' => 'Subscribed', - ], [ - 'column' => 'sublist.email', - 'type' => 'string', - 'label' => 'Email', - ] - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'email', + 'alias' => 'subsEmail', + 'label' => 'Email', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' ]); } - public function render() - { - return $this->newsLetterDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.customers.subscribers.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.customers.subscribers.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php index 512281de6..b2913d2dc 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php @@ -2,177 +2,139 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * OrderDataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class OrderDataGrid +class OrderDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for orders - */ - public function createOrderDataGrid() + public function prepareQueryBuilder() { - return DataGrid::make([ - 'name' => 'orders', - 'table' => 'orders as or', - 'select' => 'or.id', - 'perpage' => 10, - 'aliased' => false, //True in case of joins else aliasing key required on all cases + $queryBuilder = DB::table('orders')->select('id', 'base_grand_total', 'grand_total', 'created_at', 'channel_name', 'status')->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as fullname')); - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + $this->setQueryBuilder($queryBuilder); + } - 'actions' => [ - [ - 'type' => 'View', - 'route' => 'admin.sales.orders.view', - // 'confirm_text' => 'Do you really want to view this record?', - 'icon' => 'icon eye-icon', - 'icon-alt' => 'View' - ] - ], + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } - 'join' => [], + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'orderId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'or.id', - 'alias' => 'orderid', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'CONCAT(or.customer_first_name, " ", or.customer_last_name)', - 'alias' => 'oafirstname', - 'type' => 'string', - 'label' => 'Billed To', - 'sortable' => false, - ], [ - 'name' => 'or.base_grand_total', - 'alias' => 'orbasegrandtotal', - 'type' => 'string', - 'label' => 'Base Total', - 'sortable' => true, - 'wrapper' => function ($value) { - return core()->formatBasePrice($value); - } - ], [ - 'name' => 'or.grand_total', - 'alias' => 'oagrandtotal', - 'type' => 'string', - 'label' => 'Grand Total', - 'sortable' => false, - 'wrapper' => function ($value) { - return core()->formatBasePrice($value); - } - ], [ - 'name' => 'or.created_at', - 'alias' => 'createdat', - 'type' => 'datetime', - 'label' => 'Order Date', - 'sortable' => true, - ], [ - 'name' => 'or.channel_name', - 'alias' => 'channelname', - 'type' => 'string', - 'label' => 'Channel Name', - 'sortable' => true, - ], [ - 'name' => 'or.status', - 'alias' => 'orstatus', - 'type' => 'string', - 'label' => 'Status', - 'sortable' => true, - 'closure' => true, //to be used when ever wrappers or callables are used - 'wrapper' => function ($value) { - if($value == 'processing') - return 'Processing'; - else if($value == 'completed') - return 'Completed'; - else if($value == "canceled") - return 'Canceled'; - else if($value == "closed") - return 'Closed'; - else if($value == "pending") - return 'Pending'; - else if($value == "pending_payment") - return 'Pending Payment'; - else if($value == "fraud") - return 'Fraud'; - }, - ], - ], + $this->addColumn([ + 'index' => 'base_grand_total', + 'alias' => 'baseGrandTotal', + 'label' => 'Base Total', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'wrapper' => function ($value) { + return core()->formatBasePrice($value); + } + ]); - 'filterable' => [ - [ - 'column' => 'or.id', - 'alias' => 'orderid', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'or.status', - 'alias' => 'orstatus', - 'type' => 'string', - 'label' => 'Status' - ], [ - 'column' => 'or.created_at', - 'alias' => 'createdat', - 'type' => 'datetime', - 'label' => 'Order Date', - ], [ - 'column' => 'CONCAT(or.customer_first_name, " ", or.customer_last_name)', - 'alias' => 'oafirstname', - 'type' => 'string', - 'label' => 'Billed To', - ], - ], + $this->addColumn([ + 'index' => 'grand_total', + 'alias' => 'grandTotal', + 'label' => 'Grand Total', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'wrapper' => function ($value) { + return core()->formatBasePrice($value); + } + ]); - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'or.id', - 'alias' => 'orderid', - 'type' => 'number', - ], [ - 'column' => 'or.status', - 'alias' => 'orstatus', - 'type' => 'string', - ] - ], + $this->addColumn([ + 'index' => 'created_at', + 'alias' => 'orderDate', + 'label' => 'Order Date', + 'type' => 'string', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px', + ]); - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], + $this->addColumn([ + 'index' => 'channel_name', + 'alias' => 'channelName', + 'label' => 'Channel Name', + 'type' => 'string', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px' + ]); - // 'css' => [] + $this->addColumn([ + 'index' => 'status', + 'alias' => 'status', + 'label' => 'Status', + 'type' => 'string', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'closure' => true, + 'wrapper' => function ($value) { + if($value == 'processing') + return 'Processing'; + else if($value == 'completed') + return 'Completed'; + else if($value == "canceled") + return 'Canceled'; + else if($value == "closed") + return 'Closed'; + else if($value == "pending") + return 'Pending'; + else if($value == "pending_payment") + return 'Pending Payment'; + else if($value == "fraud") + return 'Fraud'; + } + ]); + + $this->addColumn([ + 'index' => 'fullname', + 'alias' => 'fullName', + 'label' => 'Billed To', + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'width' => '100px' ]); } - public function render($pagination = true) - { - return $this->createOrderDataGrid()->render($pagination); + public function prepareActions() { + $this->addAction([ + 'type' => 'View', + 'route' => 'admin.sales.orders.view', + 'icon' => 'icon eye-icon' + ]); + } + + public function prepareMassActions() { + // $this->addMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.attributes.massdelete'), + // 'method' => 'DELETE' + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php index be9ab208f..b21410693 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php @@ -2,156 +2,86 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * OrderInvoicesDataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class OrderInvoicesDataGrid +class OrderInvoicesDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Order invoices Data Grid implementation for invoices of orders - */ - public function createOrderInvoicesDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('invoices')->select('id', 'order_id', 'state', 'grand_total', 'created_at'); - return DataGrid::make([ - 'name' => 'invoices', - 'table' => 'invoices as inv', - 'select' => 'inv.id', - 'perpage' => 10, - 'aliased' => false, + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } - 'actions' => [ - [ - 'type' => 'View', - 'route' => 'admin.sales.invoices.view', - // 'confirm_text' => 'Do you really want to view this record?', - 'icon' => 'icon eye-icon', - 'icon-alt' => 'View' - ], - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'invid', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'orders as ors', - // 'primaryKey' => 'inv.order_id', - // 'condition' => '=', - // 'secondaryKey' => 'ors.id', - // ] - ], + $this->addColumn([ + 'index' => 'order_id', + 'alias' => 'orderId', + 'label' => 'Order ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '100px' + ]); - //use aliasing on secodary columns if join is performed + $this->addColumn([ + 'index' => 'grand_total', + 'alias' => 'invgrandtotal', + 'label' => 'Grand Total', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + ]); - 'columns' => [ - [ - 'name' => 'inv.id', - 'alias' => 'invid', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true - ], [ - 'name' => 'inv.order_id', - 'alias' => 'invorderid', - 'type' => 'number', - 'label' => 'Order ID', - 'sortable' => true - ], [ - 'name' => 'inv.state', - 'alias' => 'invstate', - 'type' => 'string', - 'label' => 'State', - 'sortable' => true - ], [ - 'name' => 'inv.grand_total', - 'alias' => 'invgrandtotal', - 'type' => 'number', - 'label' => 'Amount', - 'sortable' => true, - 'wrapper' => function ($value) { - return core()->formatBasePrice($value); - }, - ], [ - 'name' => 'inv.created_at', - 'alias' => 'invcreated_at', - 'type' => 'datetime', - 'label' => 'Invoice Date', - 'sortable' => true - ] - ], - - 'filterable' => [ - [ - 'column' => 'inv.id', - 'alias' => 'invid', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'inv.order_id', - 'alias' => 'invorderid', - 'type' => 'number', - 'label' => 'Order ID', - ], [ - 'column' => 'inv.state', - 'alias' => 'invstate', - 'type' => 'string', - 'label' => 'State', - ], [ - 'column' => 'inv.grand_total', - 'alias' => 'invgrandtotal', - 'type' => 'number', - 'label' => 'Amount', - ], [ - 'column' => 'inv.created_at', - 'alias' => 'invcreated_at', - 'type' => 'datetime', - 'label' => 'Invoice Date', - ] - ], - //don't use aliasing in case of searchables - - 'searchable' => [ - // [ - // 'column' => 'or.id', - // 'alias' => 'orderid', - // 'type' => 'number', - // 'label' => 'ID', - // ] - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'created_at', + 'alias' => 'invcreatedat', + 'label' => 'Invoice Date', + 'type' => 'datetime', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', ]); } - public function render($pagination = true) - { - return $this->createOrderInvoicesDataGrid()->render($pagination); + public function prepareActions() { + $this->addAction([ + 'type' => 'View', + 'route' => 'admin.sales.invoices.view', + 'icon' => 'icon eye-icon' + ]); + } + + public function prepareMassActions() { + // $this->addMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.attributes.massdelete'), + // 'method' => 'DELETE' + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php index c6e6f3e54..46d26af23 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php @@ -2,154 +2,116 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; use DB; /** - * OrderShipmentsDataGrid + * Product Data Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class OrderShipmentsDataGrid +class OrderShipmentsDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Order Shipments Data Grid implementation for shipments of orders - */ - public function createOrderShipmentsDataGrid() + public function prepareQueryBuilder() { - return DataGrid::make([ - 'name' => 'shipments', - 'table' => 'shipments as ship', - 'select' => 'ship.id', - 'perpage' => 10, - 'aliased' => true, + $queryBuilder = DB::table('shipments as ship')->select('ship.id', 'ship.order_id', 'ship.total_qty', 'is.name', 'ors.created_at as orderdate', 'ship.created_at')->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'))->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id'); - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + $this->setQueryBuilder($queryBuilder); + } - 'actions' => [ - [ - 'type' => 'View', - 'route' => 'admin.sales.shipments.view', - // 'confirm_text' => 'Do you really want to view this record?', - 'icon' => 'icon eye-icon', - 'icon-alt' => 'View' - ], - ], + public function setIndex() { + $this->index = 'id'; //the column that needs to be treated as index column + } - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'orders as ors', - 'primaryKey' => 'ship.order_id', - 'condition' => '=', - 'secondaryKey' => 'ors.id', - ], [ - 'join' => 'leftjoin', - 'table' => 'inventory_sources as is', - 'primaryKey' => 'ship.inventory_source_id', - 'condition' => '=', - 'secondaryKey' => 'is.id', - ] - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'ship.id', + 'alias' => 'shipId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'ship.id', - 'alias' => 'shipID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true - ], [ - 'name' => 'ship.order_id', - 'alias' => 'orderid', - 'type' => 'number', - 'label' => 'Order ID', - 'sortable' => true - ], [ - 'name' => 'ship.total_qty', - 'alias' => 'shiptotalqty', - 'type' => 'number', - 'label' => 'Total Quantity', - 'sortable' => true - ], [ - 'name' => 'CONCAT(ors.customer_first_name, " ", ors.customer_last_name)', - 'alias' => 'ordercustomerfirstname', - 'type' => 'string', - 'label' => 'Customer Name', - 'sortable' => false, - ], [ - 'name' => 'is.name', - 'alias' => 'inventorySourceName', - 'type' => 'string', - 'label' => 'Inventory Source', - 'sortable' => true - ], [ - 'name' => 'ors.created_at', - 'alias' => 'orscreated', - 'type' => 'date', - 'label' => 'Order Date', - 'sortable' => true - ], [ - 'name' => 'ship.created_at', - 'alias' => 'shipdate', - 'type' => 'datetime', - 'label' => 'Shipment Date', - 'sortable' => true - ] - ], + $this->addColumn([ + 'index' => 'ship.order_id', + 'alias' => 'orderId', + 'label' => 'Order ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '100px' + ]); - 'filterable' => [ - [ - 'column' => 'ship.id', - 'alias' => 'shipID', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'ship.created_at', - 'alias' => 'shipdate', - 'type' => 'datetime', - 'label' => 'Shipment Date', - ] - ], - //don't use aliasing in case of searchables + $this->addColumn([ + 'index' => 'ship.total_qty', + 'alias' => 'shipTotalQty', + 'label' => 'Total Qty', + 'type' => 'number', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + ]); - 'searchable' => [ - // [ - // 'column' => 'ors.customer_first_name', - // 'alias' => 'ordercustomerfirstname', - // 'type' => 'string', - // ] - ], + $this->addColumn([ + 'index' => 'is.name', + 'alias' => 'shipInventoryName', + 'label' => 'Inventory Source', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + ]); - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'orderdate', + 'alias' => 'shipOrderDate', + 'label' => 'Order Date', + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'ship.created_at', + 'alias' => 'shipDate', + 'label' => 'Shipment Date', + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'custname', + 'alias' => 'shipTO', + 'label' => 'Shipping To', + 'type' => 'string', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px' ]); } - public function render($pagination = true) - { - return $this->createOrderShipmentsDataGrid()->render($pagination); + public function prepareActions() { + $this->addAction([ + 'type' => 'View', + 'route' => 'admin.sales.orders.view', + 'icon' => 'icon eye-icon' + ]); + } + + public function prepareMassActions() { + // $this->addMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.attributes.massdelete'), + // 'method' => 'DELETE' + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php index ca04bbf36..bc285dae5 100755 --- a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php @@ -2,137 +2,86 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * User Roles DataGrid + * News Letter Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class RolesDataGrid +class RolesDataGrid extends AbsGrid { - /** - * The Data Grid implementation for Roles - */ - public function createRolesDataGrid() + public $allColumns = []; + + public function prepareQueryBuilder() { + $queryBuilder = DB::table('roles')->addSelect('id', 'name', 'permission_type'); - return DataGrid::make([ - 'name' => 'Roles', - 'table' => 'roles', - 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.roles.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ] - ], - - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 'id', - 'alias' => 'roleId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'name', - 'alias' => 'roleName', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'permission_type', - 'alias' => 'rolePermissionType', - 'type' => 'string', - 'label' => 'Permission Type', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - - 'filterable' => [ - [ - 'column' => 'id', - 'alias' => 'roleId', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'name', - 'alias' => 'roleName', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'permission_type', - 'alias' => 'rolePermissionType', - 'type' => 'string', - 'label' => 'Permission Type', - ], - ], - - //don't use aliasing in case of searchables - - 'searchable' => [ - [ - 'column' => 'name', - 'type' => 'string', - 'label' => 'Name', - ], [ - 'column' => 'permission_type', - 'type' => 'string', - 'label' => 'Permission Type', - ], - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'roleId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'name', + 'alias' => 'roleName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'permission_type', + 'alias' => 'roleType', + 'label' => 'Permission Type', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() - { - return $this->createRolesDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.roles.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index 042322293..a79da325f 100755 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -2,143 +2,92 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Sliders DataGrid + * News Letter Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class SliderDataGrid +class SliderDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for Sliders - */ - public function createSliderDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('sliders as sl')->addSelect('sl.id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id'); - return DataGrid::make([ - 'name' => 'Sliders', - 'table' => 'sliders as s', - 'select' => 's.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - ], + public function setIndex() { + $this->index = 'id'; + } - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.sliders.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], [ - 'type' => 'Delete', - 'route' => 'admin.sliders.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], + public function addColumns() + { + $this->addColumn([ + 'index' => 'sl.id', + 'alias' => 'sliderId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'channels as c', - 'primaryKey' => 's.channel_id', - 'condition' => '=', - 'secondaryKey' => 'c.id', - ] - ], + $this->addColumn([ + 'index' => 'sl.title', + 'alias' => 'sliderTitle', + 'label' => 'Tile', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); - //use aliasing on secodary columns if join is performed - - 'columns' => [ - [ - 'name' => 's.id', - 'alias' => 'sliderId', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 's.title', - 'alias' => 'sliderTitle', - 'type' => 'string', - 'label' => 'title', - 'sortable' => true - ], [ - 'name' => 'c.name', - 'alias' => 'channelName', - 'type' => 'string', - 'label' => 'Channel Name', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 's.id', - 'alias' => 'sliderId', - 'type' => 'number', - 'label' => 'ID' - ], [ - 'column' => 's.title', - 'alias' => 'sliderTitle', - 'type' => 'string', - 'label' => 'title' - ], [ - 'column' => 'c.name', - 'alias' => 'channelName', - 'type' => 'string', - 'label' => 'Channel Name', - ] - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 's.id', - 'type' => 'number', - 'label' => 'ID' - ], [ - 'column' => 's.title', - 'type' => 'string', - 'label' => 'Slider Title' - ], [ - 'column' => 'c.name', - 'type' => 'string', - 'label' => 'Channel Name', - ] - ], - - //list of viable operators that will be used - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + $this->addColumn([ + 'index' => 'ch.name', + 'alias' => 'channelName', + 'label' => 'Channel Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' ]); } - public function render() - { - return $this->createSliderDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.sliders.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.sliders.delete', + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php index 2e2a79aa2..b71bd21eb 100755 --- a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php @@ -2,151 +2,92 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Tax Category DataGrid + * Tax Category Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ - -class TaxCategoryDataGrid +class TaxCategoryDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Tax Category Data Grid implementation. - */ - public function createTaxCategoryDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('tax_categories')->addSelect('id', 'name', 'code'); - return DataGrid::make([ + $this->setQueryBuilder($queryBuilder); + } - 'name' => 'Tax Category', - 'table' => 'tax_categories as tr', - 'select' => 'tr.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins - - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - // [ - // 'route' => route('admin.datagrid.index'), - // 'method' => 'POST', - // 'label' => 'View Grid', - // 'type' => 'select', - // 'options' =>[ - // 1 => 'Edit', - // 2 => 'Set', - // 3 => 'Change Status' - // ] - // ], - ], - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.tax-categories.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], - [ - 'type' => 'Delete', - 'route' => 'admin.tax-categories.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'tr.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'tr.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - ], [ - 'name' => 'tr.code', - 'alias' => 'code', - 'type' => 'string', - 'label' => 'Code', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'tr.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID' - ], [ - 'column' => 'tr.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name' - ], [ - 'column' => 'tr.code', - 'alias' => 'code', - 'type' => 'string', - 'label' => 'Code' - ] - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'tr.code', - 'type' => 'string', - 'label' => 'Code' - ], [ - 'column' => 'tr.name', - 'type' => 'string', - 'label' => 'Name' - ] - ], - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'taxCatId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'name', + 'alias' => 'taxCatName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'code', + 'alias' => 'taxCatCode', + 'label' => 'Code', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() { + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.tax-categories.edit', + 'icon' => 'icon pencil-lg-icon' + ]); - return $this->createTaxCategoryDataGrid()->render(); + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.tax-categories.delete', + 'icon' => 'icon trash-icon' + ]); + } + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php index f8d962e12..1598965b0 100755 --- a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php @@ -2,172 +2,112 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Tax Rates DataGrid + * Tax Rate Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class TaxRateDataGrid +class TaxRateDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Tax Category Data Grid implementation. - */ - public function createTaxRateDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate'); - return DataGrid::make([ - 'name' => 'Tax Rates', - 'table' => 'tax_rates as tr', - 'select' => 'tr.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + $this->setQueryBuilder($queryBuilder); + } - 'massoperations' =>[ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - // [ - // 'route' => route('admin.datagrid.index'), - // 'method' => 'POST', - // 'label' => 'View Grid', - // 'type' => 'select', - // 'options' =>[ - // 1 => 'Edit', - // 2 => 'Set', - // 3 => 'Change Status' - // ] - // ], - ], - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.tax-rates.store', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], - [ - 'type' => 'Delete', - 'route' => 'admin.tax-rates.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - 'join' => [], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'tr.id', - 'alias' => 'id', - 'type' => 'number', - 'label' => 'ID', - 'sortable' => true, - ], [ - 'name' => 'tr.identifier', - 'alias' => 'identifier', - 'type' => 'string', - 'label' => 'Identifier', - 'sortable' => true, - // 'wrapper' => function ($value, $object) { - // return '' . $object->identifier . ''; - // }, - ], [ - 'name' => 'tr.state', - 'alias' => 'state', - 'type' => 'string', - 'label' => 'State', - 'sortable' => true, - ], [ - 'name' => 'tr.country', - 'alias' => 'country', - 'type' => 'string', - 'label' => 'Country', - 'sortable' => true, - ], [ - 'name' => 'tr.tax_rate', - 'alias' => 'taxrate', - 'type' => 'number', - 'label' => 'Tax Rate', - 'sortable' => true, - ], - ], - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'tr.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'ID', - ], [ - 'column' => 'tr.identifier', - 'alias' => 'identifier', - 'type' => 'string', - 'label' => 'Identifier', - ], [ - 'column' => 'tr.state', - 'alias' => 'state', - 'type' => 'string', - 'label' => 'State', - ], [ - 'column' => 'tr.country', - 'alias' => 'country', - 'type' => 'string', - 'label' => 'Country', - ], [ - 'column' => 'tr.tax_rate', - 'alias' => 'taxrate', - 'type' => 'number', - 'label' => 'Tax Rate', - ], - ], - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'tr.identifier', - 'type' => 'string', - 'label' => 'Identifier', - ], [ - 'column' => 'tr.state', - 'type' => 'string', - 'label' => 'State', - ], [ - 'column' => 'tr.country', - 'type' => 'string', - 'label' => 'Country', - ], [ - 'column' => 'tr.tax_rate', - 'type' => 'number', - 'label' => 'Tax Rate', - ], - ], - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - // 'css' => [] + public function setIndex() { + $this->index = 'id'; + } + public function addColumns() + { + $this->addColumn([ + 'index' => 'id', + 'alias' => 'taxRateId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'identifier', + 'alias' => 'taxRateName', + 'label' => 'Identifier', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'state', + 'alias' => 'taxRateState', + 'label' => 'State', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'country', + 'alias' => 'taxRateCountry', + 'label' => 'Country', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'tax_rate', + 'alias' => 'taxRate', + 'label' => 'Rate', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() { + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.tax-categories.edit', + 'icon' => 'icon pencil-lg-icon' + ]); - return $this->createTaxRateDataGrid()->render(); + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.tax-categories.delete', + 'icon' => 'icon trash-icon' + ]); + } + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TestDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TestDataGrid.php new file mode 100644 index 000000000..441d3c646 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/TestDataGrid.php @@ -0,0 +1,147 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class TestDataGrid extends AbsGrid +{ + public $allColumns = []; + + public function prepareQueryBuilder() + { + $queryBuilder = DB::table('products_grid')->addSelect('products_grid.product_id', 'products_grid.sku', 'products_grid.name', 'products.type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity')->leftJoin('products', 'products_grid.product_id', '=', 'products.id'); + + $this->setQueryBuilder($queryBuilder); + } + + public function setIndex() { + $this->index = 'product_id'; //the column that needs to be treated as index column + } + + // public function setGridName() { + // $this->gridName = 'products_grid'; // should be the table name for getting proper index + // } + + public function addColumns() + { + $this->addColumn([ + 'index' => 'products_grid.product_id', + 'alias' => 'productid', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' + ]); + + $this->addColumn([ + 'index' => 'products_grid.sku', + 'alias' => 'productsku', + 'label' => 'SKU', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'products_grid.name', + 'alias' => 'productname', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'products.type', + 'alias' => 'producttype', + 'label' => 'Type', + 'type' => 'string', + 'sortable' => true, + 'searchable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'products_grid.status', + 'alias' => 'productstatus', + 'label' => 'Status', + 'type' => 'boolean', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value) { + if($value == 1) + return 'Active'; + else + return 'Inactive'; + } + ]); + + $this->addColumn([ + 'index' => 'products_grid.price', + 'alias' => 'productprice', + 'label' => 'Price', + 'type' => 'number', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px', + 'wrapper' => function($value) { + return core()->formatBasePrice($value); + } + ]); + + $this->addColumn([ + 'index' => 'products_grid.quantity', + 'alias' => 'productqty', + 'label' => 'Quantity', + 'type' => 'number', + 'sortable' => true, + 'searchable' => false, + 'width' => '100px' + ]); + } + + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.catalog.products.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + + $this->addAction([ + 'type' => 'Delete', + 'route' => 'admin.catalog.products.delete', + 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), + 'icon' => 'icon trash-icon' + ]); + } + + public function prepareMassActions() { + $this->addMassAction([ + 'type' => 'delete', + 'action' => route('admin.catalog.products.massdelete'), + 'method' => 'DELETE' + ]); + + $this->addMassAction([ + 'type' => 'update', + 'action' => route('admin.catalog.products.massupdate'), + 'method' => 'PUT', + 'options' => [ + 0 => true, + 1 => false, + ] + ]); + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php index 465815192..fe40caafd 100755 --- a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php @@ -2,192 +2,103 @@ namespace Webkul\Admin\DataGrids; -use Illuminate\View\View; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Ui\DataGrid\AbsGrid; +use DB; /** - * Users DataGrid + * News Letter Grid class * - * @author Prashant Singh @prashant-webkul + * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class UserDataGrid +class UserDataGrid extends AbsGrid { + public $allColumns = []; - /** - * The Data Grid implementation for admin users - */ - public function createUserDataGrid() + public function prepareQueryBuilder() { + $queryBuilder = DB::table('admins as u')->addSelect('u.id', 'u.name', 'u.status', 'u.email', 'ro.name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id'); - return DataGrid::make([ + $this->setQueryBuilder($queryBuilder); + } - 'name' => 'Admins', - 'table' => 'admins as u', - 'select' => 'u.id', - 'perpage' => 10, - 'aliased' => true, //use this with false as default and true in case of joins + public function setIndex() { + $this->index = 'id'; + } - 'massoperations' => [ - // [ - // 'route' => route('admin.datagrid.delete'), - // 'method' => 'DELETE', - // 'label' => 'Delete', - // 'type' => 'button', - // ], - // [ - // 'route' => route('admin.datagrid.index'), - // 'method' => 'POST', - // 'label' => 'View Grid', - // 'type' => 'select', - // 'options' =>[ - // 1 => 'Edit', - // 2 => 'Set', - // 3 => 'Change Status' - // ] - // ], - ], - - 'actions' => [ - [ - 'type' => 'Edit', - 'route' => 'admin.users.edit', - 'confirm_text' => 'Do you really want to edit this record?', - 'icon' => 'icon pencil-lg-icon', - ], - [ - 'type' => 'Delete', - 'route' => 'admin.users.delete', - 'confirm_text' => 'Do you really want to delete this record?', - 'icon' => 'icon trash-icon', - ], - ], - 'join' => [ - [ - 'join' => 'leftjoin', - 'table' => 'roles as r', - 'primaryKey' => 'u.role_id', - 'condition' => '=', - 'secondaryKey' => 'r.id', - ] - ], - - //use aliasing on secodary columns if join is performed - 'columns' => [ - [ - 'name' => 'u.id', - 'alias' => 'ID', - 'type' => 'string', - 'label' => 'Admin ID', - 'sortable' => true, - // 'wrapper' => function ($value, $object) { - // return '' . $object->ID . ''; - // }, - ], [ - 'name' => 'u.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - // 'wrapper' => function ($value, $object) { - // return '' . $object->Name . ''; - // }, - ], [ - 'name' => 'u.status', - 'alias' => 'Status', - 'type' => 'boolean', - 'label' => 'Status', - 'sortable' => true, - 'wrapper' => function ($value) { - if($value == 1) - return "Active"; - else - return "Inactive"; - }, - ], [ - 'name' => 'u.email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'Email', - 'sortable' => true, - ], [ - 'name' => 'r.name', - 'alias' => 'rolename', - 'type' => 'string', - 'label' => 'Role Name', - 'sortable' => true, - ], - ], - - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'u.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'Admin ID' - ], [ - 'column' => 'u.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name' - ], [ - 'column' => 'u.email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'Email' - ], [ - 'column' => 'r.name', - 'alias' => 'rolename', - 'type' => 'string', - 'label' => 'Role Name' - ], [ - 'name' => 'u.status', - 'alias' => 'Status', - 'type' => 'boolean', - 'label' => 'Status' - ] - ], - - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'u.email', - 'type' => 'string', - 'label' => 'Email' - ], [ - 'column' => 'u.name', - 'type' => 'string', - 'label' => 'Name' - ], [ - 'column' => 'u.email', - 'type' => 'string', - 'label' => 'Email', - ], [ - 'column' => 'r.name', - 'type' => 'string', - 'label' => 'Role Name', - ] - ], - - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - - // 'css' => [] + public function addColumns() + { + $this->addColumn([ + 'index' => 'u.id', + 'alias' => 'adminId', + 'label' => 'ID', + 'type' => 'number', + 'searchable' => false, + 'sortable' => true, + 'width' => '40px' ]); + $this->addColumn([ + 'index' => 'u.name', + 'alias' => 'adminName', + 'label' => 'Name', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); + + $this->addColumn([ + 'index' => 'u.status', + 'alias' => 'adminStatus', + 'label' => 'Status', + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'wrapper' => function($value) { + if($value == 1) { + return 'Active'; + } else { + return 'Inactive'; + } + } + ]); + + $this->addColumn([ + 'index' => 'u.email', + 'alias' => 'adminEmail', + 'label' => 'Email', + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px' + ]); } - public function render() { - return $this->createUserDataGrid()->render(); + public function prepareActions() { + $this->addAction([ + 'type' => 'Edit', + 'route' => 'admin.roles.edit', + 'icon' => 'icon pencil-lg-icon' + ]); + } + + public function prepareMassActions() { + // $this->prepareMassAction([ + // 'type' => 'delete', + // 'action' => route('admin.catalog.products.massdelete'), + // 'method' => 'DELETE' + // ]); + + // $this->prepareMassAction([ + // 'type' => 'update', + // 'action' => route('admin.catalog.products.massupdate'), + // 'method' => 'PUT', + // 'options' => [ + // 0 => true, + // 1 => false, + // ] + // ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php b/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php index 8ffcb9388..ae6a5299a 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php @@ -4,11 +4,11 @@ namespace Webkul\Admin\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Illuminate\Routing\Controller; -use Webkul\Ui\DataGrid\Facades\DataGrid; +use Webkul\Admin\Http\Controllers\Controller; +use Webkul\Admin\DataGrids\TestDataGrid; /** - * DataGrid controller + * TestDataGrid controller * * @author Nikhil Malik @ysmnikhil * @author Prashant Singh @prashant-webkul @@ -16,6 +16,18 @@ use Webkul\Ui\DataGrid\Facades\DataGrid; */ class DataGridController extends Controller { + protected $_config; + protected $testgrid; + + public function __construct(TestDataGrid $testgrid) + { + $this->middleware('admin'); + + $this->_config = request('_config'); + + $this->testgrid = $testgrid; + } + public function massDelete() { dd(request()->all()); } @@ -23,4 +35,8 @@ class DataGridController extends Controller public function massUpdate() { dd(request()->all()); } + + public function testGrid() { + return $this->testgrid->render(); + } } diff --git a/packages/Webkul/Admin/src/Http/routes.php b/packages/Webkul/Admin/src/Http/routes.php index 7a2f0a56c..fb6330ce7 100755 --- a/packages/Webkul/Admin/src/Http/routes.php +++ b/packages/Webkul/Admin/src/Http/routes.php @@ -7,6 +7,10 @@ Route::group(['middleware' => ['web']], function () { 'view' => 'admin::users.sessions.create' ])->name('admin.session.create'); + Route::get('/testgrid', 'Webkul\Admin\Http\Controllers\DataGridController@testGrid')->defaults('_config', [ + 'view' => 'admin::catalog.categories.test' + ]); + //login post route to admin auth controller Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [ 'redirect' => 'admin.dashboard.index' diff --git a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss index efed33611..4e1464a90 100755 --- a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss @@ -15,6 +15,20 @@ body { min-height: 100%; } +::-webkit-scrollbar { + width: 12px; +} + +::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.3); + border-radius: 10px; +} + +::-webkit-scrollbar-thumb { + border-radius: 10px; + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); +} + .navbar-top { height: 60px; background: #ffffff; @@ -157,7 +171,7 @@ body { } .content { - padding: 25px 0; + margin-top: 25px; &.full-page { padding: 25px; diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index ff8856f64..5322928a0 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -575,6 +575,7 @@ return [ 'country' => 'Country', 'male' => 'Male', 'female' => 'Female', + 'phone' => 'Phone', 'created' => 'Customer created successfully.', 'updated' => 'Customer updated successfully.', 'deleted' => 'Customer deleted successfully.', diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/categories/test.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/categories/test.blade.php new file mode 100644 index 000000000..40c3316c7 --- /dev/null +++ b/packages/Webkul/Admin/src/Resources/views/catalog/categories/test.blade.php @@ -0,0 +1,24 @@ +@extends('admin::layouts.content') + +@section('page_title') + {{ __('admin::app.customers.customers.title') }} +@stop + +@section('content') +
+ + +
+

Test the grid here

+
+
+@endsection \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php index 4f8fd7628..1348da23b 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php @@ -14,7 +14,7 @@ } .table td.actions .icon.pencil-lg-icon { margin-right: 10px; - } + } @stop @@ -46,7 +46,7 @@
- +
@{{ errors.first(variantInputName + '[weight]') }}
@@ -232,7 +232,7 @@ weight: 0, status: 1 }, this.variant)); - + this.resetModel(); this.$parent.closeModal(); @@ -252,7 +252,7 @@ }); Vue.component('variant-list', { - + template: '#variant-list-template', inject: ['$validator'], @@ -331,7 +331,7 @@ if(inventories.length) return inventories[0]['qty']; - return 0; + return 0; }, updateTotalQty () { diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php index b51469de3..5d75b7260 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php @@ -5,7 +5,7 @@ @stop @section('content') -
+
@stop \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php index a275a2553..893e3b8cd 100755 --- a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php @@ -62,7 +62,7 @@ @if (isset($field['repository'])) @foreach($value as $option) -
- - @push('scripts') + + - } + + + @endpush + diff --git a/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php index 7e7e86ae1..08a0c5352 100755 --- a/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php @@ -67,7 +67,7 @@ haveStates() { if(this.countryStates[this.country] && this.countryStates[this.country].length) return true; - + return false; }, } diff --git a/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php index 37a94826d..5cfb688fc 100755 --- a/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php @@ -62,6 +62,12 @@ @{{ errors.first('date_of_birth') }}
+
+ + + @{{ errors.first('phone') }} +
+
+ @{{ errors.first('first_name') }}
- + @{{ errors.first('last_name') }}
- + @{{ errors.first('email') }}
@@ -65,6 +66,12 @@ @{{ errors.first('date_of_birth') }}
+
+ + + @{{ errors.first('phone') }} +
+
diff --git a/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php index 9c67e67c2..a5e49369e 100755 --- a/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php @@ -12,12 +12,12 @@

{{ __('admin::app.customers.customers.title') }}

-
+ {{--
{{ __('admin::app.export.export') }} -
+
--}} {{ __('admin::app.customers.customers.add-title') }} @@ -32,18 +32,18 @@
- + {{--

{{ __('admin::app.export.download') }}

-
+
--}} @stop @push('scripts') - + --}} @endpush diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php index 8adc8b98b..9f4ee570c 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php @@ -17,7 +17,7 @@ - +
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/index.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/index.blade.php index be6610721..b85fb7296 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/index.blade.php @@ -11,14 +11,14 @@

{{ __('admin::app.sales.invoices.title') }}

-
+ {{--
{{ __('admin::app.export.export') }}
-
+
--}}
@@ -27,18 +27,18 @@
- + {{--

{{ __('admin::app.export.download') }}

-
+
--}} @stop @push('scripts') - + --}} @endpush \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/sales/orders/index.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/orders/index.blade.php index c023f8293..149b1eeff 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/orders/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/orders/index.blade.php @@ -11,14 +11,14 @@

{{ __('admin::app.sales.orders.title') }}

-
+ {{--
{{ __('admin::app.export.export') }}
-
+
--}}
@@ -27,18 +27,18 @@
- + {{--

{{ __('admin::app.export.download') }}

-
+
--}} @stop @push('scripts') - + --}} + --}} @endpush \ No newline at end of file diff --git a/packages/Webkul/Core/src/Core.php b/packages/Webkul/Core/src/Core.php index 9b868a81e..4c3fa1855 100755 --- a/packages/Webkul/Core/src/Core.php +++ b/packages/Webkul/Core/src/Core.php @@ -695,7 +695,6 @@ class Core foreach (config('core') as $coreData) { if (isset($coreData['fields'])) { foreach ($coreData['fields'] as $field) { - $name = $coreData['key'] . '.' . $field['name']; if ($name == $fieldName ) { diff --git a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php index 686f77818..6a0eee394 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php @@ -99,6 +99,7 @@ class CustomerController extends Controller 'gender' => 'required', 'date_of_birth' => 'date|before:today', 'email' => 'email|unique:customers,email,'.$id, + 'phone' => 'nullable|numeric|unique:customers,phone,'. $id, 'password' => 'confirmed' ]); diff --git a/packages/Webkul/Customer/src/Models/Customer.php b/packages/Webkul/Customer/src/Models/Customer.php index 1f4c2c0ba..a7b8bd97a 100755 --- a/packages/Webkul/Customer/src/Models/Customer.php +++ b/packages/Webkul/Customer/src/Models/Customer.php @@ -17,7 +17,7 @@ class Customer extends Authenticatable protected $table = 'customers'; - protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token']; + protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token', 'phone']; protected $hidden = ['password', 'remember_token']; diff --git a/packages/Webkul/Payment/src/Config/system.php b/packages/Webkul/Payment/src/Config/system.php index e1fdae26e..9eddc97e2 100755 --- a/packages/Webkul/Payment/src/Config/system.php +++ b/packages/Webkul/Payment/src/Config/system.php @@ -35,9 +35,6 @@ return [ [ 'title' => 'Pending', 'value' => 'pending' - ], [ - 'title' => 'Approved', - 'value' => 'Approved' ], [ 'title' => 'Pending Payment', 'value' => 'pending_payment' @@ -86,9 +83,6 @@ return [ [ 'title' => 'Pending', 'value' => 'pending' - ], [ - 'title' => 'Approved', - 'value' => 'Approved' ], [ 'title' => 'Pending Payment', 'value' => 'pending_payment' @@ -137,9 +131,6 @@ return [ [ 'title' => 'Pending', 'value' => 'pending' - ], [ - 'title' => 'Approved', - 'value' => 'Approved' ], [ 'title' => 'Pending Payment', 'value' => 'pending_payment' diff --git a/packages/Webkul/Product/src/Helpers/Toolbar.php b/packages/Webkul/Product/src/Helpers/Toolbar.php index b1c72dbf5..80d45dfcd 100755 --- a/packages/Webkul/Product/src/Helpers/Toolbar.php +++ b/packages/Webkul/Product/src/Helpers/Toolbar.php @@ -18,7 +18,7 @@ class Toolbar extends AbstractProduct 'created_at-desc' => 'newest-first', 'created_at-asc' => 'oldest-first', 'price-asc' => 'cheapest-first', - 'price-desc' => 'expansive-first' + 'price-desc' => 'expensive-first' ]; } /** diff --git a/packages/Webkul/Product/src/Http/Controllers/ProductController.php b/packages/Webkul/Product/src/Http/Controllers/ProductController.php index 5d9734689..619da0939 100755 --- a/packages/Webkul/Product/src/Http/Controllers/ProductController.php +++ b/packages/Webkul/Product/src/Http/Controllers/ProductController.php @@ -11,6 +11,7 @@ use Webkul\Product\Repositories\ProductGridRepository as ProductGrid; use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily; use Webkul\Category\Repositories\CategoryRepository as Category; use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource; +use Webkul\Admin\DataGrids\TestDataGrid; /** * Product controller @@ -202,6 +203,7 @@ class ProductController extends Controller */ public function massDestroy() { + dd(request()->input()); $productIds = explode(',', request()->input('indexes')); foreach ($productIds as $productId) { @@ -220,12 +222,17 @@ class ProductController extends Controller */ public function massUpdate() { + dd(request()->input()); $data = request()->all(); if (!isset($data['massaction-type'])) { return redirect()->back(); } + if(!$data['massaction-type'] == 'update') { + return redirect()->back(); + } + $productIds = explode(',', $data['indexes']); foreach ($productIds as $productId) { diff --git a/packages/Webkul/Sales/src/Repositories/ShipmenttemRepository.php b/packages/Webkul/Sales/src/Repositories/ShipmenttemRepository.php deleted file mode 100755 index 2e5428c65..000000000 --- a/packages/Webkul/Sales/src/Repositories/ShipmenttemRepository.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ - -class ShipmentItemRepository extends Repository -{ - /** - * Specify Model class name - * - * @return Mixed - */ - - function model() - { - return 'Webkul\Sales\Contracts\ShipmentItem'; - } -} \ No newline at end of file diff --git a/packages/Webkul/Shipping/src/Config/system.php b/packages/Webkul/Shipping/src/Config/system.php index f09c13391..03e49e78f 100755 --- a/packages/Webkul/Shipping/src/Config/system.php +++ b/packages/Webkul/Shipping/src/Config/system.php @@ -106,16 +106,21 @@ return [ 'name' => 'Origin', 'sort' => 0, 'fields' => [ - // [ - // 'name' => 'country', - // 'title' => 'Country', - // 'type' => 'country_state', - // 'stateName' => 'state' - // 'validation' => 'required', - // 'channel_based' => true, - // 'locale_based' => true - // ], [ + 'name' => 'country', + 'title' => 'Country', + 'type' => 'country', + 'validation' => 'required', + 'channel_based' => true, + 'locale_based' => true + ], [ + 'name' => 'state', + 'title' => 'State', + 'type' => 'state', + 'validation' => 'required', + 'channel_based' => true, + 'locale_based' => true + ], [ 'name' => 'address1', 'title' => 'Address Line 1', 'type' => 'text', diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/edit.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/edit.blade.php index c2b4c9127..9be26f0f8 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/edit.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/edit.blade.php @@ -63,6 +63,12 @@ @{{ errors.first('email') }} +
+ + + @{{ errors.first('phone') }} +
+
diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php index 824af17a3..d82873194 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php @@ -55,6 +55,11 @@ {{ $customer->email }} + + {{ __('shop::app.customer.account.profile.phone') }} + {{ $customer->phone }} + + {{-- @if($customer->subscribed_to_news_letter == 1) {{ __('shop::app.footer.subscribe-newsletter') }} diff --git a/packages/Webkul/Ui/publishable/assets/css/ui.css b/packages/Webkul/Ui/publishable/assets/css/ui.css index 5e4d54f31..2df34d31a 100755 --- a/packages/Webkul/Ui/publishable/assets/css/ui.css +++ b/packages/Webkul/Ui/publishable/assets/css/ui.css @@ -1 +1 @@ -.active.configuration-icon,.catalog-icon,.configuration-icon,.customer-icon,.dashboard-icon,.sales-icon,.settings-icon{width:48px;height:48px;display:inline-block;background-size:cover}.icon{display:inline-block;background-size:cover}.dashboard-icon{background-image:url("../images/Icon-Dashboard.svg")}.sales-icon{background-image:url("../images/Icon-Sales.svg")}.catalog-icon{background-image:url("../images/Icon-Catalog.svg")}.customer-icon{background-image:url("../images/Icon-Customers.svg")}.configuration-icon{background-image:url("../images/Icon-Configure.svg")}.settings-icon{background-image:url("../images/Icon-Settings.svg")}.angle-right-icon{background-image:url("../images/Angle-Right.svg");width:17px;height:17px}.angle-left-icon{background-image:url("../images/Angle-Left.svg");width:17px;height:17px}.arrow-down-icon{background-image:url("../images/Arrow-Down-Light.svg");width:14px;height:8px}.arrow-right-icon{background-image:url("../images/Arrow-Right.svg");width:18px;height:18px}.white-cross-sm-icon{background-image:url("../images/Icon-Sm-Cross-White.svg");width:18px;height:18px}.accordian-up-icon{background-image:url("../images/Accordion-Arrow-Up.svg");width:24px;height:24px}.accordian-down-icon{background-image:url("../images/Accordion-Arrow-Down.svg");width:24px;height:24px}.cross-icon{background-image:url("../images/Icon-Crossed.svg");width:18px;height:18px}.trash-icon{background-image:url("../images/Icon-Trash.svg");width:24px;height:24px}.remove-icon{background-image:url("../images/Icon-remove.svg");width:24px;height:24px}.pencil-lg-icon{background-image:url("../images/Icon-Pencil-Large.svg");width:24px;height:24px}.eye-icon{background-image:url("../images/Icon-eye.svg");width:24px;height:24px}.search-icon{background-image:url("../images/icon-search.svg");width:24px;height:24px}.sortable-icon{background-image:url("../images/Icon-Sortable.svg");width:24px;height:24px}.sort-down-icon,.sort-up-icon{background-image:url("../images/Icon-Sort-Down.svg");width:18px;height:18px}.sort-up-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.primary-back-icon{background-image:url("../images/Icon-Back-Primary.svg");width:24px;height:24px}.checkbox-dash-icon{background-image:url("../images/Checkbox-Dash.svg");width:24px;height:24px}.account-icon{background-image:url("../images/icon-account.svg");width:24px;height:24px}.expand-icon{background-image:url("../images/Expand-Light.svg");width:18px;height:18px}.expand-on-icon{background-image:url("../images/Expand-Light-On.svg");width:18px;height:18px}.dark-left-icon{background-image:url("../images/arrow-left-dark.svg");width:18px;height:18px}.light-right-icon{background-image:url("../images/arrow-right-light.svg");width:18px;height:18px}.folder-icon{background-image:url("../images/Folder-Icon.svg");width:24px;height:24px}.star-icon{background-image:url("../images/Star-Icon.svg");width:24px;height:24px}.arrow-down-white-icon{background-image:url("../images/down-arrow-white.svg");width:17px;height:13px}.arrow-up-white-icon{background-image:url("../images/up-arrow-white.svg");width:17px;height:13px}.profile-pic-icon{background-image:url("../images/Profile-Pic.svg");width:60px;height:60px}.graph-up-icon{background-image:url("../images/Icon-Graph-Green.svg");width:24px;height:24px}.graph-down-icon{background-image:url("../images/Icon-Graph-Red.svg");width:24px;height:24px}.no-result-icon{background-image:url("../images/limited-icon.svg");width:52px;height:47px}.active .dashboard-icon{background-image:url("../images/Icon-Dashboard-Active.svg")}.active .sales-icon{background-image:url("../images/Icon-Sales-Active.svg")}.active .catalog-icon{background-image:url("../images/Icon-Catalog-Active.svg")}.active .customer-icon{background-image:url("../images/Icon-Customers-Active.svg")}.active .settings-icon{background-image:url("../images/Icon-Settings-Active.svg")}.active .configuration-icon{background-image:url("../images/Icon-Configure-Active.svg")}.active>.arrow-down-icon{background-image:url("../images/Arrow-Down.svg");width:14px;height:8px}.active>.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.active.dashboard-icon{background-image:url("../images/Icon-Dashboard-Active.svg")}.active.customer-icon{background-image:url("../images/Icon-Customers-Active.svg")}.active.sales-icon{background-image:url("../images/Icon-Sales-Active.svg")}.active.settings-icon{background-image:url("../images/Icon-Settings-Active.svg")}.active.configuration-icon{background-image:url("../images/Icon-Configure-Active.svg")}.active.arrow-down-icon{background-image:url("../images/Arrow-Down.svg");width:14px;height:8px}.active.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.icon-404{background-image:url("../images/404-image.svg");width:255px;height:255px}.export-icon{background-image:url("../images/Icon-Export.svg");width:32px;height:32px}.star-blue-icon{width:17px;height:17px;background-image:url("../images/Icon-star.svg")}.grid-container .filter-wrapper{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}.grid-container .filter-wrapper .filter-row-one,.grid-container .filter-wrapper .filter-row-two{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.grid-container .filter-wrapper .filter-row-one{height:40px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.grid-container .filter-wrapper .filter-row-one .search-filter .control{font-family:montserrat,sans-serif;padding-left:10px;width:380px;height:36px;border:2px solid #c7c7c7;border-radius:3px;border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;font-size:14px}.grid-container .filter-wrapper .filter-row-one .search-filter .ic-wrapper{display:block;height:36px;width:36px;border:2px solid #c7c7c7;border-left:none;border-radius:2px}.grid-container .filter-wrapper .filter-row-one .search-filter .ic-wrapper .search-icon{margin-left:4px;margin-top:4px;height:24px;width:24px}.grid-container .filter-wrapper .filter-row-one .dropdown-filters{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-family:montserrat,sans-serif;padding-left:5px;height:36px;width:150px;border:2px solid #c7c7c7;border-radius:2px;background-color:#fff;color:#8e8e8e;font-size:14px}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header{width:100%;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header .arrow-down-icon{margin-right:5px}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul li.filter-column-dropdown .filter-column-select,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul li input,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul li select{width:100%;background:#fff;border:2px solid #c7c7c7;border-radius:3px;height:36px;display:inline-block;vertical-align:middle;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);padding:0 5px;font-family:montserrat,sans-serif;margin-top:10px;margin-bottom:5px}.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-condition-dropdown-boolean,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-condition-dropdown-datetime,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-condition-dropdown-number,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-condition-dropdown-string,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-response-boolean,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-response-datetime,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-response-number,.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-list .dropdown-container ul .filter-response-string{display:none}.grid-container .filter-wrapper .filter-row-two{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-top:6px;margin-bottom:6px}.grid-container .filter-wrapper .filter-row-two .filter-one{margin-right:10px}.grid-container .filter-wrapper .filter-row-two .filter-one .filter-name{margin-right:5px}.grid-container .filter-wrapper .filter-row-two .filter-one .filter-value{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;background:#e7e7e7;padding-left:5px;color:#000311;vertical-align:middle}.grid-container .filter-wrapper .filter-row-two .filter-one .filter-value .f-value{margin:auto}.grid-container .filter-wrapper .filter-row-two .filter-one .filter-value .cross-icon{margin:5px;height:18px!important;width:18px!important;cursor:pointer}.grid-container .table thead .mass-action-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.grid-container .table thead .mass-action-wrapper .massaction-remove{margin-top:4px;margin-right:10px}.grid-container .table thead .mass-action-wrapper .selected-items{margin-right:15px}.grid-container .table thead tr th.grid_head .sort-down-icon,.grid-container .table thead tr th.grid_head .sort-up-icon{margin-left:5px;margin-top:-3px;vertical-align:middle}.grid-container .table thead tr th.grid_head.sortable{cursor:pointer}.grid-container .table thead tr th{text-transform:capitalize}.grid-container .table tbody td.action a:first-child{margin-right:10px}.grid-container .table .pagination{margin-top:20px}@-webkit-keyframes jelly{0%{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}70%{-webkit-transform:translateY(5px) scale(1.05);transform:translateY(5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}}@keyframes jelly{0%{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}70%{-webkit-transform:translateY(5px) scale(1.05);transform:translateY(5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}}@-webkit-keyframes jelly-out{0%{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}30%{-webkit-transform:translateY(-5px) scale(1.05);transform:translateY(-5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}}@keyframes jelly-out{0%{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}30%{-webkit-transform:translateY(-5px) scale(1.05);transform:translateY(-5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}}*{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:focus{outline:none}a:active,a:focus,a:hover,a:link,a:visited{text-decoration:none;color:#0041ff}textarea{resize:none}ul{margin:0;padding:0;list-style:none}h1{font-size:28px;margin-top:0}h1,h2{color:#3a3a3a}h2{font-size:18px}.tooltip{position:relative;border-bottom:1px solid #000}.tooltip .tooltiptext{visibility:hidden;width:120px;background-color:#000;color:#fff;text-align:center;border-radius:6px;padding:5px 0;position:absolute;z-index:1}.tooltip:hover .tooltiptext{visibility:visible}.hide{display:none!important}.btn{-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.2),0 0 8px 0 rgba(0,0,0,.1);box-shadow:0 1px 4px 0 rgba(0,0,0,.2),0 0 8px 0 rgba(0,0,0,.1);border-radius:3px;border:none;color:#fff;cursor:pointer;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);font:inherit;display:inline-block}.btn:active,.btn:focus,.btn:hover{opacity:.75;border:none}.btn.btn-sm{padding:6px 12px}.btn.btn-md{padding:8px 16px}.btn.btn-lg{padding:10px 20px}.btn.btn-xl{padding:12px 24px;font-size:16px}.btn.btn-primary{background:#0041ff;color:#fff}.btn.btn-black{background:#000;color:#fff}.btn:disabled,.btn[disabled=disabled],.btn[disabled=disabled]:active,.btn[disabled=disabled]:hover{cursor:not-allowed;background:#b1b1ae;-webkit-box-shadow:none;box-shadow:none;opacity:1}.dropdown-open{position:relative}.dropdown-list{width:200px;margin-bottom:20px;-webkit-box-shadow:0 2px 4px 0 rgba(0,0,0,.16),0 0 9px 0 rgba(0,0,0,.16);box-shadow:0 2px 4px 0 rgba(0,0,0,.16),0 0 9px 0 rgba(0,0,0,.16);border-radius:3px;background-color:#fff;position:absolute;display:none;z-index:10;text-align:left}.dropdown-list.bottom-left{top:42px;left:0}.dropdown-list.bottom-right{top:42px;right:0}.dropdown-list.top-left{bottom:42px;left:0}.dropdown-list.top-right{bottom:42px;right:0}.dropdown-list .search-box{padding:20px;border-bottom:1px solid hsla(0,0%,64%,.2)}.dropdown-list .search-box .control{background:#fff;border:2px solid #c7c7c7;border-radius:3px;width:100%;height:36px;display:inline-block;vertical-align:middle;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);padding:0 10px;font-size:15px}.dropdown-list .search-box .control:focus{border-color:#0041ff}.dropdown-list .dropdown-container{padding:20px;overflow-y:auto;max-height:280px}.dropdown-list .dropdown-container label{font-size:15px;display:inline-block;text-transform:uppercase;color:#9e9e9e;font-weight:700;padding-bottom:5px}.dropdown-list .dropdown-container ul{margin:0;list-style-type:none;padding:0}.dropdown-list .dropdown-container ul li{padding:5px 0}.dropdown-list .dropdown-container ul li a:active,.dropdown-list .dropdown-container ul li a:focus,.dropdown-list .dropdown-container ul li a:link,.dropdown-list .dropdown-container ul li a:visited{color:#333;display:block}.dropdown-list .dropdown-container ul li a:hover{color:#0041ff}.dropdown-list .dropdown-container ul li .checkbox{margin:0}.dropdown-list .dropdown-container ul li .control-group label{color:#3a3a3a;font-size:15px;font-weight:500;text-transform:capitalize;width:100%}.dropdown-list .dropdown-container .btn{width:100%;margin-top:10px}.table{width:100%;overflow-x:auto}.table table{width:100%;border-collapse:collapse;text-align:left}.table table thead th{font-weight:700;padding:12px 10px;background:#f8f9fa;color:#3a3a3a}.table table tbody td{padding:10px;border-bottom:1px solid #d3d3d3;color:#3a3a3a;vertical-align:top}.table table tbody td.actions{text-align:right}.table table tbody td.actions .icon{cursor:pointer;vertical-align:middle}.table table tbody td.empty{text-align:center}.table table tbody tr:last-child td{border-bottom:none}.table .control-group{width:100%;margin-bottom:0}.table .control-group .control{width:100%;margin:0}.dropdown-btn{min-width:150px;text-align:left;background:#fff;border:2px solid #c7c7c7;border-radius:3px;font-size:14px;padding:8px 35px 8px 10px;cursor:pointer;position:relative}.dropdown-btn:active,.dropdown-btn:focus,.dropdown-btn:hover{opacity:.75;border:2px solid #c7c7c7}.dropdown-btn .icon{position:absolute;right:10px;top:50%;margin-top:-4px}.pagination .page-item{background:#fff;border:2px solid #c7c7c7;border-radius:3px;padding:7px 14px;margin-right:5px;font-size:16px;display:inline-block;color:#8e8e8e;vertical-align:middle;text-decoration:none}.pagination .page-item.next,.pagination .page-item.previous{padding:6px 9px}.pagination .page-item.active{background:#0041ff;color:#fff;border-color:#0041ff}.pagination .page-item .icon{vertical-align:middle;margin-bottom:3px}.checkbox{position:relative;display:block;vertical-align:middle;margin:0 5px 5px 0}.checkbox input{left:0;opacity:0;position:absolute;top:0;height:24px;width:24px;z-index:100}.checkbox .checkbox-view{background-image:url("../images/Checkbox.svg");height:24px;width:24px;margin:0;display:inline-block!important;vertical-align:middle;margin-right:5px}.checkbox input:checked+.checkbox-view{background-image:url("../images/Checkbox-Checked.svg")}.checkbox input:disabled+.checkbox-view{opacity:.5;cursor:not-allowed}.radio{position:relative;display:block;margin:10px 5px 5px 0}.radio input{left:0;opacity:0;position:absolute;top:0;z-index:100}.radio .radio-view{background-image:url("../images/controls.svg");background-position:-21px 0;height:20px;width:20px;margin:0;display:inline-block!important;vertical-align:middle;margin-right:5px}.radio input:checked+.radio-view{background-position:-21px -21px}.radio input:disabled+.radio-view{opacity:.5;cursor:not-allowed}.control-group{display:block;margin-bottom:25px;font-size:15px;color:#333;width:750px;max-width:100%;position:relative}.control-group label{display:block;color:#3a3a3a}.control-group label.required:after{content:"*";color:#fc6868;font-weight:700;display:inline-block}.control-group textarea.control{height:100px;padding:10px}.control-group .control{background:#fff;border:2px solid #c7c7c7;border-radius:3px;width:70%;height:36px;display:inline-block;vertical-align:middle;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);padding:0 10px;font-size:15px;margin-top:10px;margin-bottom:5px}.control-group .control:focus{border-color:#0041ff}.control-group .control[disabled=disabled]{border-color:#d3d3d3;background-color:#d3d3d3;cursor:not-allowed}.control-group .control[multiple]{height:100px}.control-group.date:after,.control-group.datetime:after{background-image:url("../images/Icon-Calendar.svg");width:24px;height:24px;content:"";display:inline-block;vertical-align:middle;margin-left:-34px;margin-top:2px;pointer-events:none}.control-group .control-info{display:block;font-style:italic;color:#6f6f6f}.control-group .control-error{display:none;color:#ff5656;margin-top:5px}.control-group.has-error .control{border-color:#fc6868}.control-group.has-error .control-error{display:block}.control-group.price .currency-code{vertical-align:middle;display:inline-block}.button-group{margin-top:20px;margin-bottom:20px}.alert-wrapper{width:300px;top:10px;right:10px;position:fixed;z-index:6;text-align:left}.alert-wrapper .alert{width:300px;padding:15px;border-radius:3px;display:inline-block;-webkit-box-shadow:0 4px 15.36px .64px rgba(0,0,0,.1),0 2px 6px 0 rgba(0,0,0,.12);box-shadow:0 4px 15.36px .64px rgba(0,0,0,.1),0 2px 6px 0 rgba(0,0,0,.12);position:relative;-webkit-animation:jelly .5s ease-in-out;animation:jelly .5s ease-in-out;-webkit-transform-origin:center top;transform-origin:center top;z-index:500;margin-bottom:10px}.alert-wrapper .alert.alert-error{background:#fc6868}.alert-wrapper .alert.alert-info{background:#204d74}.alert-wrapper .alert.alert-success{background:#4caf50}.alert-wrapper .alert.alert-warning{background:#ffc107}.alert-wrapper .alert .icon{position:absolute;right:10px;top:10px;cursor:pointer}.alert-wrapper .alert p{color:#fff;margin:0;padding:0;font-size:15px}.tabs ul{border-bottom:1px solid hsla(0,0%,64%,.2)}.tabs ul li{display:inline-block}.tabs ul li a{padding:15px 20px;cursor:pointer;margin:0 2px;text-align:center;color:#000311;display:block}.tabs ul li.active a{border-bottom:3px solid #0041ff}.accordian,accordian{display:inline-block;width:100%}.accordian .accordian-header,.accordian div[slot*=header],accordian .accordian-header,accordian div[slot*=header]{width:100%;display:inline-block;font-size:18px;color:#3a3a3a;border-bottom:1px solid hsla(0,0%,64%,.2);padding:20px 15px;cursor:pointer}.accordian .accordian-header .expand-icon,.accordian div[slot*=header] .expand-icon,accordian .accordian-header .expand-icon,accordian div[slot*=header] .expand-icon{background-image:url("../images/Expand-Light.svg");margin-right:10px;margin-top:3px}.accordian .accordian-header h1,.accordian div[slot*=header] h1,accordian .accordian-header h1,accordian div[slot*=header] h1{margin:0;font-size:20px;display:inline-block}.accordian .accordian-header .icon,.accordian div[slot*=header] .icon,accordian .accordian-header .icon,accordian div[slot*=header] .icon{float:right}.accordian .accordian-header .icon.left,.accordian div[slot*=header] .icon.left,accordian .accordian-header .icon.left,accordian div[slot*=header] .icon.left{float:left}.accordian .accordian-content,.accordian div[slot*=body],accordian .accordian-content,accordian div[slot*=body]{width:100%;padding:20px 15px;display:none;-webkit-transition:all .3s ease;transition:all .3s ease}.accordian.active>.accordian-content,accordian.active>.accordian-content{display:inline-block}.accordian.active>.accordian-header .expand-icon,accordian.active>.accordian-header .expand-icon{background-image:url("../images/Expand-Light-On.svg")}.tree-container .tree-item{padding-left:30px;display:inline-block;margin-top:10px;width:100%}.tree-container .tree-item>.tree-item{display:none}.tree-container .tree-item.active>.tree-item{display:inline-block}.tree-container .tree-item .checkbox,.tree-container .tree-item .radio{margin:0;display:inline-block}.tree-container .tree-item .expand-icon{display:inline-block;margin-right:10px;cursor:pointer;background-image:url("../images/Expand-Light.svg");width:18px;height:18px;vertical-align:middle}.tree-container .tree-item .folder-icon{vertical-align:middle;margin-right:10px}.tree-container .tree-item.active>.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.tree-container>.tree-item{padding-left:0}.panel{-webkit-box-shadow:0 2px 25px 0 rgba(0,0,0,.15);box-shadow:0 2px 25px 0 rgba(0,0,0,.15);border-radius:5px;background:#fff}.panel .panel-content{padding:20px}modal{display:none}.modal-open{overflow:hidden}.modal-overlay{display:none;overflow-y:auto;z-index:10;top:0;right:0;bottom:0;left:0;position:fixed;background:#000;opacity:.75}.modal-open .modal-overlay{display:block}.modal-container{-webkit-animation:fade-in-white .3s ease-in-out;animation:fade-in-white .3s ease-in-out;z-index:11;margin-left:-350px;width:600px;max-width:80%;background:#fff;position:fixed;left:50%;top:100px;margin-bottom:100px;-webkit-box-shadow:0 15px 25px 0 rgba(0,0,0,.03),0 20px 45px 5px rgba(0,0,0,.2);box-shadow:0 15px 25px 0 rgba(0,0,0,.03),0 20px 45px 5px rgba(0,0,0,.2);-webkit-animation:jelly .5s ease-in-out;animation:jelly .5s ease-in-out;border-radius:5px}.modal-container .modal-header{padding:20px}.modal-container .modal-header h3{display:inline-block;font-size:20px;color:#3a3a3a;margin:0}.modal-container .modal-header .icon{float:right;cursor:pointer}.modal-container .modal-body{padding:20px}.modal-container .modal-body .control-group .control{width:100%}.label{background:#e7e7e7;border-radius:2px;padding:8px;color:#000311;display:inline-block}.label.label-sm{padding:5px}.label.label-md{padding:8px}.label.label-lg{padding:11px}.label.label-xl{padding:14px}.badge{border-radius:50px;color:#fff;padding:8px;white-space:nowrap}.badge.badge-sm{padding:5px}.badge.badge-md{padding:3px 10px}.badge.badge-lg{padding:11px}.badge.badge-xl{padding:14px}.badge.badge-success{background-color:#4caf50}.badge.badge-info{background-color:#0041ff}.badge.badge-danger{background-color:#fc6868}.badge.badge-warning{background-color:#ffc107}.image-wrapper{margin-bottom:20px;margin-top:10px;display:inline-block;width:100%}.image-wrapper .image-item{width:200px;height:200px;margin-right:20px;background:#f8f9fa;border-radius:3px;display:inline-block;position:relative;background-image:url("../images/placeholder-icon.svg");background-repeat:no-repeat;background-position:50%;margin-bottom:20px}.image-wrapper .image-item img.preview{width:100%;height:100%}.image-wrapper .image-item input{display:none}.image-wrapper .image-item .remove-image{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.08)),to(rgba(0,0,0,.24)));background-image:linear-gradient(-180deg,rgba(0,0,0,.08),rgba(0,0,0,.24));border-radius:0 0 4px 4px;position:absolute;bottom:0;width:100%;padding:10px;text-align:center;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.24);margin-right:20px;cursor:pointer}.image-wrapper .image-item:hover .remove-image{display:block}.image-wrapper .image-item.has-image{background-image:none}.cp-spinner{width:48px;height:48px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}.cp-round:before{border-radius:50%;border:6px solid #bababa}.cp-round:after,.cp-round:before{content:" ";width:48px;height:48px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;top:0;left:0}.cp-round:after{border-radius:50%;border-top:6px solid #0041ff;border-right:6px solid transparent;border-bottom:6px solid transparent;border-left:6px solid transparent;-webkit-animation:spin 1s ease-in-out infinite;animation:spin 1s ease-in-out infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} \ No newline at end of file +.active.configuration-icon,.catalog-icon,.configuration-icon,.customer-icon,.dashboard-icon,.sales-icon,.settings-icon{width:48px;height:48px;display:inline-block;background-size:cover}.icon{display:inline-block;background-size:cover}.dashboard-icon{background-image:url("../images/Icon-Dashboard.svg")}.sales-icon{background-image:url("../images/Icon-Sales.svg")}.catalog-icon{background-image:url("../images/Icon-Catalog.svg")}.customer-icon{background-image:url("../images/Icon-Customers.svg")}.configuration-icon{background-image:url("../images/Icon-Configure.svg")}.settings-icon{background-image:url("../images/Icon-Settings.svg")}.angle-right-icon{background-image:url("../images/Angle-Right.svg");width:17px;height:17px}.angle-left-icon{background-image:url("../images/Angle-Left.svg");width:17px;height:17px}.arrow-down-icon{background-image:url("../images/Arrow-Down-Light.svg");width:14px;height:8px}.arrow-right-icon{background-image:url("../images/Arrow-Right.svg");width:18px;height:18px}.white-cross-sm-icon{background-image:url("../images/Icon-Sm-Cross-White.svg");width:18px;height:18px}.accordian-up-icon{background-image:url("../images/Accordion-Arrow-Up.svg");width:24px;height:24px}.accordian-down-icon{background-image:url("../images/Accordion-Arrow-Down.svg");width:24px;height:24px}.cross-icon{background-image:url("../images/Icon-Crossed.svg");width:18px;height:18px}.trash-icon{background-image:url("../images/Icon-Trash.svg");width:24px;height:24px}.remove-icon{background-image:url("../images/Icon-remove.svg");width:24px;height:24px}.pencil-lg-icon{background-image:url("../images/Icon-Pencil-Large.svg");width:24px;height:24px}.eye-icon{background-image:url("../images/Icon-eye.svg");width:24px;height:24px}.search-icon{background-image:url("../images/icon-search.svg");width:24px;height:24px}.sortable-icon{background-image:url("../images/Icon-Sortable.svg");width:24px;height:24px}.sort-down-icon,.sort-up-icon{background-image:url("../images/Icon-Sort-Down.svg");width:18px;height:18px}.sort-up-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.primary-back-icon{background-image:url("../images/Icon-Back-Primary.svg");width:24px;height:24px}.checkbox-dash-icon{background-image:url("../images/Checkbox-Dash.svg");width:24px;height:24px}.account-icon{background-image:url("../images/icon-account.svg");width:24px;height:24px}.expand-icon{background-image:url("../images/Expand-Light.svg");width:18px;height:18px}.expand-on-icon{background-image:url("../images/Expand-Light-On.svg");width:18px;height:18px}.dark-left-icon{background-image:url("../images/arrow-left-dark.svg");width:18px;height:18px}.light-right-icon{background-image:url("../images/arrow-right-light.svg");width:18px;height:18px}.folder-icon{background-image:url("../images/Folder-Icon.svg");width:24px;height:24px}.star-icon{background-image:url("../images/Star-Icon.svg");width:24px;height:24px}.arrow-down-white-icon{background-image:url("../images/down-arrow-white.svg");width:17px;height:13px}.arrow-up-white-icon{background-image:url("../images/up-arrow-white.svg");width:17px;height:13px}.profile-pic-icon{background-image:url("../images/Profile-Pic.svg");width:60px;height:60px}.graph-up-icon{background-image:url("../images/Icon-Graph-Green.svg");width:24px;height:24px}.graph-down-icon{background-image:url("../images/Icon-Graph-Red.svg");width:24px;height:24px}.no-result-icon{background-image:url("../images/limited-icon.svg");width:52px;height:47px}.active .dashboard-icon{background-image:url("../images/Icon-Dashboard-Active.svg")}.active .sales-icon{background-image:url("../images/Icon-Sales-Active.svg")}.active .catalog-icon{background-image:url("../images/Icon-Catalog-Active.svg")}.active .customer-icon{background-image:url("../images/Icon-Customers-Active.svg")}.active .settings-icon{background-image:url("../images/Icon-Settings-Active.svg")}.active .configuration-icon{background-image:url("../images/Icon-Configure-Active.svg")}.active>.arrow-down-icon{background-image:url("../images/Arrow-Down.svg");width:14px;height:8px}.active>.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.active.dashboard-icon{background-image:url("../images/Icon-Dashboard-Active.svg")}.active.customer-icon{background-image:url("../images/Icon-Customers-Active.svg")}.active.sales-icon{background-image:url("../images/Icon-Sales-Active.svg")}.active.settings-icon{background-image:url("../images/Icon-Settings-Active.svg")}.active.configuration-icon{background-image:url("../images/Icon-Configure-Active.svg")}.active.arrow-down-icon{background-image:url("../images/Arrow-Down.svg");width:14px;height:8px}.active.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.icon-404{background-image:url("../images/404-image.svg");width:255px;height:255px}.export-icon{background-image:url("../images/Icon-Export.svg");width:32px;height:32px}.star-blue-icon{width:17px;height:17px;background-image:url("../images/Icon-star.svg")}.grid-container{display:block;width:100%;height:100%}.filter-row-one{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.filter-row-one,.filter-row-two{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:10px}.filter-row-two,.search-filter{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.search-filter{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.search-filter .control{background:#fff;border:2px solid #c7c7c7;border-right:none;border-top-right-radius:0;border-bottom-right-radius:0;border-radius:3px;height:36px;width:360px;padding-left:10px;font-size:15px;color:#8e8e8e}.search-filter .contorl:focus{border-color:#0041ff}.search-filter .icon-wrapper{border:2px solid #c7c7c7;border-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0;height:36px;width:36px;margin-left:-1px}.search-filter .icon-wrapper .search-icon{margin-top:3px;margin-left:3px}.dropdown-header{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:36px;width:202px;border:2px solid #c7c7c7;border-radius:3px;color:#8e8e8e;padding:0 5px}.dropdown-header .arrow-icon-down{float:right}.filter-tag{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;border-radius:2px}.filter-tag,.filter-tag .wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:14px;height:28px}.filter-tag .wrapper{margin-left:5px;padding:0 5px;background:#e7e7e7;color:#000311;letter-spacing:-.22px}.filter-tag:not(first-child){margin-left:10px}@-webkit-keyframes jelly{0%{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}70%{-webkit-transform:translateY(5px) scale(1.05);transform:translateY(5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}}@keyframes jelly{0%{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}70%{-webkit-transform:translateY(5px) scale(1.05);transform:translateY(5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}}@-webkit-keyframes jelly-out{0%{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}30%{-webkit-transform:translateY(-5px) scale(1.05);transform:translateY(-5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}}@keyframes jelly-out{0%{-webkit-transform:translateY(0) scale(1);transform:translateY(0) scale(1);opacity:1}30%{-webkit-transform:translateY(-5px) scale(1.05);transform:translateY(-5px) scale(1.05);opacity:1}to{-webkit-transform:translateY(0) scale(.7);transform:translateY(0) scale(.7);opacity:0}}*{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:focus{outline:none}a:active,a:focus,a:hover,a:link,a:visited{text-decoration:none;color:#0041ff}textarea{resize:none}ul{margin:0;padding:0;list-style:none}h1{font-size:28px;margin-top:0}h1,h2{color:#3a3a3a}h2{font-size:18px}.tooltip{position:relative;border-bottom:1px solid #000}.tooltip .tooltiptext{visibility:hidden;width:120px;background-color:#000;color:#fff;text-align:center;border-radius:6px;padding:5px 0;position:absolute;z-index:1}.tooltip:hover .tooltiptext{visibility:visible}.hide{display:none!important}.btn{-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.2),0 0 8px 0 rgba(0,0,0,.1);box-shadow:0 1px 4px 0 rgba(0,0,0,.2),0 0 8px 0 rgba(0,0,0,.1);border-radius:3px;border:none;color:#fff;cursor:pointer;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);font:inherit;display:inline-block}.btn:active,.btn:focus,.btn:hover{opacity:.75;border:none}.btn.btn-sm{padding:6px 12px}.btn.btn-md{padding:8px 16px}.btn.btn-lg{padding:10px 20px}.btn.btn-xl{padding:12px 24px;font-size:16px}.btn.btn-primary{background:#0041ff;color:#fff}.btn.btn-black{background:#000;color:#fff}.btn:disabled,.btn[disabled=disabled],.btn[disabled=disabled]:active,.btn[disabled=disabled]:hover{cursor:not-allowed;background:#b1b1ae;-webkit-box-shadow:none;box-shadow:none;opacity:1}.dropdown-open{position:relative}.dropdown-list{width:200px;margin-bottom:20px;-webkit-box-shadow:0 2px 4px 0 rgba(0,0,0,.16),0 0 9px 0 rgba(0,0,0,.16);box-shadow:0 2px 4px 0 rgba(0,0,0,.16),0 0 9px 0 rgba(0,0,0,.16);border-radius:3px;background-color:#fff;position:absolute;display:none;z-index:10;text-align:left}.dropdown-list.bottom-left{top:42px;left:0}.dropdown-list.bottom-right{top:42px;right:0}.dropdown-list.top-left{bottom:42px;left:0}.dropdown-list.top-right{bottom:42px;right:0}.dropdown-list .search-box{padding:20px;border-bottom:1px solid hsla(0,0%,64%,.2)}.dropdown-list .search-box .control{background:#fff;border:2px solid #c7c7c7;border-radius:3px;width:100%;height:36px;display:inline-block;vertical-align:middle;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);padding:0 10px;font-size:15px}.dropdown-list .search-box .control:focus{border-color:#0041ff}.dropdown-list .dropdown-container{padding:20px;overflow-y:auto;max-height:280px}.dropdown-list .dropdown-container label{font-size:15px;display:inline-block;text-transform:uppercase;color:#9e9e9e;font-weight:700;padding-bottom:5px}.dropdown-list .dropdown-container ul{margin:0;list-style-type:none;padding:0}.dropdown-list .dropdown-container ul li{padding:5px 0}.dropdown-list .dropdown-container ul li a:active,.dropdown-list .dropdown-container ul li a:focus,.dropdown-list .dropdown-container ul li a:link,.dropdown-list .dropdown-container ul li a:visited{color:#333;display:block}.dropdown-list .dropdown-container ul li a:hover{color:#0041ff}.dropdown-list .dropdown-container ul li .checkbox{margin:0}.dropdown-list .dropdown-container ul li .control-group label{color:#3a3a3a;font-size:15px;font-weight:500;text-transform:capitalize;width:100%}.dropdown-list .dropdown-container .btn{width:100%;margin-top:10px}.table{width:100%;overflow-x:auto}.table table{width:100%;border-collapse:collapse;text-align:left}.table table thead th{font-weight:700;padding:12px 10px;background:#f8f9fa;color:#3a3a3a}.table table tbody td{padding:10px;border-bottom:1px solid #d3d3d3;color:#3a3a3a;vertical-align:top}.table table tbody td.actions{text-align:right}.table table tbody td.actions .icon{cursor:pointer;vertical-align:middle}.table table tbody td.empty{text-align:center}.table table tbody tr:last-child td{border-bottom:none}.table .control-group{width:100%;margin-bottom:0}.table .control-group .control{width:100%;margin:0}.dropdown-btn{min-width:150px;text-align:left;background:#fff;border:2px solid #c7c7c7;border-radius:3px;font-size:14px;padding:8px 35px 8px 10px;cursor:pointer;position:relative}.dropdown-btn:active,.dropdown-btn:focus,.dropdown-btn:hover{opacity:.75;border:2px solid #c7c7c7}.dropdown-btn .icon{position:absolute;right:10px;top:50%;margin-top:-4px}.pagination .page-item{background:#fff;border:2px solid #c7c7c7;border-radius:3px;padding:7px 14px;margin-right:5px;font-size:16px;display:inline-block;color:#8e8e8e;vertical-align:middle;text-decoration:none}.pagination .page-item.next,.pagination .page-item.previous{padding:6px 9px}.pagination .page-item.active{background:#0041ff;color:#fff;border-color:#0041ff}.pagination .page-item .icon{vertical-align:middle;margin-bottom:3px}.checkbox{position:relative;display:block}.checkbox input{left:0;opacity:0;position:absolute;top:0;height:24px;width:24px;z-index:100}.checkbox .checkbox-view{background-image:url("../images/Checkbox.svg");height:24px;width:24px;margin:0;display:inline-block!important;vertical-align:middle;margin-right:5px}.checkbox input:checked+.checkbox-view{background-image:url("../images/Checkbox-Checked.svg")}.checkbox input:disabled+.checkbox-view{opacity:.5;cursor:not-allowed}.radio{position:relative;display:block;margin:10px 5px 5px 0}.radio input{left:0;opacity:0;position:absolute;top:0;z-index:100}.radio .radio-view{background-image:url("../images/controls.svg");background-position:-21px 0;height:20px;width:20px;margin:0;display:inline-block!important;vertical-align:middle;margin-right:5px}.radio input:checked+.radio-view{background-position:-21px -21px}.radio input:disabled+.radio-view{opacity:.5;cursor:not-allowed}.control-group{display:block;margin-bottom:25px;font-size:15px;color:#333;width:750px;max-width:100%;position:relative}.control-group label{display:block;color:#3a3a3a}.control-group label.required:after{content:"*";color:#fc6868;font-weight:700;display:inline-block}.control-group textarea.control{height:100px;padding:10px}.control-group .control{background:#fff;border:2px solid #c7c7c7;border-radius:3px;width:70%;height:36px;display:inline-block;vertical-align:middle;-webkit-transition:.2s cubic-bezier(.4,0,.2,1);transition:.2s cubic-bezier(.4,0,.2,1);padding:0 10px;font-size:15px;margin-top:10px;margin-bottom:5px}.control-group .control:focus{border-color:#0041ff}.control-group .control[disabled=disabled]{border-color:#d3d3d3;background-color:#d3d3d3;cursor:not-allowed}.control-group .control[multiple]{height:100px}.control-group.date:after,.control-group.datetime:after{background-image:url("../images/Icon-Calendar.svg");width:24px;height:24px;content:"";display:inline-block;vertical-align:middle;margin-left:-34px;margin-top:2px;pointer-events:none}.control-group .control-info{display:block;font-style:italic;color:#6f6f6f}.control-group .control-error{display:none;color:#ff5656;margin-top:5px}.control-group.has-error .control{border-color:#fc6868}.control-group.has-error .control-error{display:block}.control-group.price .currency-code{vertical-align:middle;display:inline-block}.button-group{margin-top:20px;margin-bottom:20px}.alert-wrapper{width:300px;top:10px;right:10px;position:fixed;z-index:6;text-align:left}.alert-wrapper .alert{width:300px;padding:15px;border-radius:3px;display:inline-block;-webkit-box-shadow:0 4px 15.36px .64px rgba(0,0,0,.1),0 2px 6px 0 rgba(0,0,0,.12);box-shadow:0 4px 15.36px .64px rgba(0,0,0,.1),0 2px 6px 0 rgba(0,0,0,.12);position:relative;-webkit-animation:jelly .5s ease-in-out;animation:jelly .5s ease-in-out;-webkit-transform-origin:center top;transform-origin:center top;z-index:500;margin-bottom:10px}.alert-wrapper .alert.alert-error{background:#fc6868}.alert-wrapper .alert.alert-info{background:#204d74}.alert-wrapper .alert.alert-success{background:#4caf50}.alert-wrapper .alert.alert-warning{background:#ffc107}.alert-wrapper .alert .icon{position:absolute;right:10px;top:10px;cursor:pointer}.alert-wrapper .alert p{color:#fff;margin:0;padding:0;font-size:15px}.tabs ul{border-bottom:1px solid hsla(0,0%,64%,.2)}.tabs ul li{display:inline-block}.tabs ul li a{padding:15px 20px;cursor:pointer;margin:0 2px;text-align:center;color:#000311;display:block}.tabs ul li.active a{border-bottom:3px solid #0041ff}.accordian,accordian{display:inline-block;width:100%}.accordian .accordian-header,.accordian div[slot*=header],accordian .accordian-header,accordian div[slot*=header]{width:100%;display:inline-block;font-size:18px;color:#3a3a3a;border-bottom:1px solid hsla(0,0%,64%,.2);padding:20px 15px;cursor:pointer}.accordian .accordian-header .expand-icon,.accordian div[slot*=header] .expand-icon,accordian .accordian-header .expand-icon,accordian div[slot*=header] .expand-icon{background-image:url("../images/Expand-Light.svg");margin-right:10px;margin-top:3px}.accordian .accordian-header h1,.accordian div[slot*=header] h1,accordian .accordian-header h1,accordian div[slot*=header] h1{margin:0;font-size:20px;display:inline-block}.accordian .accordian-header .icon,.accordian div[slot*=header] .icon,accordian .accordian-header .icon,accordian div[slot*=header] .icon{float:right}.accordian .accordian-header .icon.left,.accordian div[slot*=header] .icon.left,accordian .accordian-header .icon.left,accordian div[slot*=header] .icon.left{float:left}.accordian .accordian-content,.accordian div[slot*=body],accordian .accordian-content,accordian div[slot*=body]{width:100%;padding:20px 15px;display:none;-webkit-transition:all .3s ease;transition:all .3s ease}.accordian.active>.accordian-content,accordian.active>.accordian-content{display:inline-block}.accordian.active>.accordian-header .expand-icon,accordian.active>.accordian-header .expand-icon{background-image:url("../images/Expand-Light-On.svg")}.tree-container .tree-item{padding-left:30px;display:inline-block;margin-top:10px;width:100%}.tree-container .tree-item>.tree-item{display:none}.tree-container .tree-item.active>.tree-item{display:inline-block}.tree-container .tree-item .checkbox,.tree-container .tree-item .radio{margin:0;display:inline-block}.tree-container .tree-item .expand-icon{display:inline-block;margin-right:10px;cursor:pointer;background-image:url("../images/Expand-Light.svg");width:18px;height:18px;vertical-align:middle}.tree-container .tree-item .folder-icon{vertical-align:middle;margin-right:10px}.tree-container .tree-item.active>.expand-icon{background-image:url("../images/Expand-Light-On.svg")}.tree-container>.tree-item{padding-left:0}.panel{-webkit-box-shadow:0 2px 25px 0 rgba(0,0,0,.15);box-shadow:0 2px 25px 0 rgba(0,0,0,.15);border-radius:5px;background:#fff}.panel .panel-content{padding:20px}modal{display:none}.modal-open{overflow:hidden}.modal-overlay{display:none;overflow-y:auto;z-index:10;top:0;right:0;bottom:0;left:0;position:fixed;background:#000;opacity:.75}.modal-open .modal-overlay{display:block}.modal-container{-webkit-animation:fade-in-white .3s ease-in-out;animation:fade-in-white .3s ease-in-out;z-index:11;margin-left:-350px;width:600px;max-width:80%;background:#fff;position:fixed;left:50%;top:100px;margin-bottom:100px;-webkit-box-shadow:0 15px 25px 0 rgba(0,0,0,.03),0 20px 45px 5px rgba(0,0,0,.2);box-shadow:0 15px 25px 0 rgba(0,0,0,.03),0 20px 45px 5px rgba(0,0,0,.2);-webkit-animation:jelly .5s ease-in-out;animation:jelly .5s ease-in-out;border-radius:5px}.modal-container .modal-header{padding:20px}.modal-container .modal-header h3{display:inline-block;font-size:20px;color:#3a3a3a;margin:0}.modal-container .modal-header .icon{float:right;cursor:pointer}.modal-container .modal-body{padding:20px}.modal-container .modal-body .control-group .control{width:100%}.label{background:#e7e7e7;border-radius:2px;padding:8px;color:#000311;display:inline-block}.label.label-sm{padding:5px}.label.label-md{padding:8px}.label.label-lg{padding:11px}.label.label-xl{padding:14px}.badge{border-radius:50px;color:#fff;padding:8px;white-space:nowrap}.badge.badge-sm{padding:5px}.badge.badge-md{padding:3px 10px}.badge.badge-lg{padding:11px}.badge.badge-xl{padding:14px}.badge.badge-success{background-color:#4caf50}.badge.badge-info{background-color:#0041ff}.badge.badge-danger{background-color:#fc6868}.badge.badge-warning{background-color:#ffc107}.image-wrapper{margin-bottom:20px;margin-top:10px;display:inline-block;width:100%}.image-wrapper .image-item{width:200px;height:200px;margin-right:20px;background:#f8f9fa;border-radius:3px;display:inline-block;position:relative;background-image:url("../images/placeholder-icon.svg");background-repeat:no-repeat;background-position:50%;margin-bottom:20px}.image-wrapper .image-item img.preview{width:100%;height:100%}.image-wrapper .image-item input{display:none}.image-wrapper .image-item .remove-image{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.08)),to(rgba(0,0,0,.24)));background-image:linear-gradient(-180deg,rgba(0,0,0,.08),rgba(0,0,0,.24));border-radius:0 0 4px 4px;position:absolute;bottom:0;width:100%;padding:10px;text-align:center;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.24);margin-right:20px;cursor:pointer}.image-wrapper .image-item:hover .remove-image{display:block}.image-wrapper .image-item.has-image{background-image:none}.cp-spinner{width:48px;height:48px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}.cp-round:before{border-radius:50%;border:6px solid #bababa}.cp-round:after,.cp-round:before{content:" ";width:48px;height:48px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;top:0;left:0}.cp-round:after{border-radius:50%;border-top:6px solid #0041ff;border-right:6px solid transparent;border-bottom:6px solid transparent;border-left:6px solid transparent;-webkit-animation:spin 1s ease-in-out infinite;animation:spin 1s ease-in-out infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} \ No newline at end of file diff --git a/packages/Webkul/Ui/publishable/assets/mix-manifest.json b/packages/Webkul/Ui/publishable/assets/mix-manifest.json index f5ad30267..7338f6a33 100755 --- a/packages/Webkul/Ui/publishable/assets/mix-manifest.json +++ b/packages/Webkul/Ui/publishable/assets/mix-manifest.json @@ -1,4 +1,4 @@ { "/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922", - "/css/ui.css": "/css/ui.css?id=0b2b51d90a970c9a4219" + "/css/ui.css": "/css/ui.css?id=1edd188de8c037f174a0" } \ No newline at end of file diff --git a/packages/Webkul/Ui/src/DataGrid/AbsGrid.php b/packages/Webkul/Ui/src/DataGrid/AbsGrid.php new file mode 100644 index 000000000..03afd8b51 --- /dev/null +++ b/packages/Webkul/Ui/src/DataGrid/AbsGrid.php @@ -0,0 +1,196 @@ + + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +abstract class AbsGrid +{ + protected $index = null; + protected $columns = []; + protected $allColumns = []; + protected $queryBuilder = []; + protected $collection = []; + protected $actions = []; + protected $massActions = []; + protected $request; + protected $parse; + // protected $gridName = null; + + abstract public function prepareMassActions(); + abstract public function prepareActions(); + abstract public function prepareQueryBuilder(); + abstract public function addColumns(); + abstract public function setIndex(); + + /** + * Parse the URL and get it ready to be used. + */ + private function parse() + { + $parsed = []; + $unparsed = url()->full(); + + if (count(explode('?', $unparsed)) > 1) { + $to_be_parsed = explode('?', $unparsed)[1]; + + parse_str($to_be_parsed, $parsed); + unset($parsed['page']); + } + + return $parsed; + } + + public function addColumn($column) + { + array_push($this->columns, $column); + + $this->setAllColumnDetails($column); + } + + public function setAllColumnDetails($column) + { + array_push($this->allColumns, $column); + } + + public function setQueryBuilder($queryBuilder) + { + $this->queryBuilder = $queryBuilder; + } + + public function addAction($action) + { + array_push($this->actions, $action); + } + + public function addMassAction($massAction) + { + array_push($this->massActions, $massAction); + } + + public function getCollection() + { + $p = $this->parse(); + + if(count($p)) { + $filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $p); + + // return $filteredOrSortedCollection->get(); + + if (config()->has('datagrid.pagination')) { + return $filteredOrSortedCollection->paginate(config('datagrid.pagination')); + } else { + return $filteredOrSortedCollection->get(); + } + } + + if (config()->has('datagrid.pagination')) { + $this->collection = $this->queryBuilder->paginate(config('datagrid.pagination')); + } else { + $this->collection = $this->queryBuilder->get(); + } + + if ($this->collection) { + return $this->collection; + } else { + dd('no records found'); + } + } + + /** + * To find the alias of the column and by taking the column name. + * + * @return string + */ + public function findColumnType($columnAlias) { + foreach($this->allColumns as $column) { + if($column['alias'] == $columnAlias) { + return [$column['type'], $column['index']]; + } + } + } + + public function sortOrFilterCollection($collection, $parseInfo) { + + foreach($parseInfo as $key => $info) { + $columnType = $this->findColumnType($key)[0]; + $columnName = $this->findColumnType($key)[1]; + + if($key == "sort") { + $count_keys = count(array_keys($info)); + + if ($count_keys > 1) { + throw new \Exception('Fatal Error! Multiple Sort keys Found, Please Resolve the URL Manually'); + } + + $columnName = $this->findColumnType(array_keys($info)[0]); + + return $collection->orderBy( + $columnName[1], + array_values($info)[0] + ); + } else if($key == "search") { + $count_keys = count(array_keys($info)); + + if($count_keys > 1) { + throw new \Exception('Multiple Search keys Found, Please Resolve the URL Manually'); + } + + if($count_keys == 1) { + return $collection->where(function() use($collection, $info) { + foreach ($this->allColumns as $column) { + if($column['searchable'] == true) + $collection->orWhere($column['index'], 'like', '%'.$info['all'].'%'); + } + }); + } + } else { + if (array_keys($info)[0] == "like" || array_keys($info)[0] == "nlike") { + foreach ($info as $condition => $filter_value) { + return $collection->where( + $columnName, + config("datagrid.operators.{$condition}"), + '%'.$filter_value.'%' + ); + } + } else { + foreach ($info as $condition => $filter_value) { + if($columnType == 'datetime') { + return $collection->whereDate( + $columnName, + config("datagrid.operators.{$condition}"), + $filter_value + ); + } else { + return $collection->where( + $columnName, + config("datagrid.operators.{$condition}"), + $filter_value + ); + } + } + } + } + } + } + + public function render() + { + $this->addColumns(); + + $this->setIndex(); + + $this->prepareActions(); + + $this->prepareMassActions(); + + $this->prepareQueryBuilder(); + + return view('ui::testgrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index]); + } +} \ No newline at end of file diff --git a/packages/Webkul/Ui/src/DataGrid/DataGrid.php b/packages/Webkul/Ui/src/DataGrid/DataGrid.php index 51c985f9e..650c0559f 100755 --- a/packages/Webkul/Ui/src/DataGrid/DataGrid.php +++ b/packages/Webkul/Ui/src/DataGrid/DataGrid.php @@ -1,4 +1,5 @@ make( $name, $table, @@ -162,43 +159,45 @@ class DataGrid // list($name, $select, $table, $join, $columns) = array_values($args); $name = $select = $aliased = $table = false; $join = $columns = $filterable = $searchable = - $massoperations = $css = $operators = $actions = []; + $massoperations = $css = $actions = []; + extract($args); - return $this->build($name, $select, $filterable, $searchable, $massoperations, $aliased, $perpage, $table, $join, $columns, $css, $operators,$actions); + + return $this->build($name, $select, $filterable, $searchable, $massoperations, $aliased, $perpage, $table, $join, $columns, $css, $actions); } //This assigns the private and public properties of the datagrid classes from make functions - public function build( - $name = null, - $select = false, + public function build ( + string $name = null, + string $select = null, array $filterable = [], array $searchable = [], array $massoperations = [], bool $aliased = false, - $perpage = 0, - $table = null, + int $perpage = 0, + string $table = null, array $join = [], array $columns = null, array $css = [], - array $operators = [], array $actions = [], Pagination $pagination = null ) { $this->request = Request::capture(); $this->setName($name); + $this->setAlias($aliased); + $this->setTable($table); $this->setSelect($select); $this->setFilterable($filterable); $this->setSearchable($filterable); $this->setMassOperations($massoperations); - $this->setAlias($aliased); $this->setPerPage($perpage); - $this->setTable($table); $this->setJoin($join); $this->addColumns($columns, true); $this->setCss($css); - $this->setOperators($operators); + $this->setOperators(); $this->setActions($actions); // $this->addPagination($pagination); + return $this; } @@ -207,10 +206,9 @@ class DataGrid * * @return $this */ - public function setName(string $name) { - $this->name = $name ?: 'Default' . time(); + $this->name = $name ? : 'Default' . time(); return $this; } @@ -219,18 +217,28 @@ class DataGrid * * @return $this */ - public function setSelect($select) { - $this->select = $select ? : false; + if (!$select) { + $select = config('datagrid.select'); + + if ($this->aliased) { + $alias = $this->findTableAlias(); + + $select = $alias.'.'.$select; + } + } + + $this->select = $select; + return $this; } /** * Set Filterable + * * @return $this */ - public function setFilterable(array $filterable) { $this->filterable = $filterable ? : []; @@ -239,9 +247,9 @@ class DataGrid /** * Set Searchable columns + * * @return $this */ - public function setSearchable($searchable) { $this->searchable = $searchable ? : []; @@ -250,9 +258,9 @@ class DataGrid /** * Set mass operations + * * @return $this */ - public function setMassOperations($massops) { $this->massoperations = $massops ? : []; @@ -260,13 +268,10 @@ class DataGrid } /** - * Set alias parameter - * to know whether - * aliasing is true or not. + * Set alias parameter to know whether aliasing is true or not. * * @return $this. */ - public function setAlias(bool $aliased) { $this->aliased = $aliased ? : false; @@ -274,13 +279,10 @@ class DataGrid } /** - * Set the default - * pagination for - * data grid. + * Set the default pagination for data grid. * * @return $this */ - public function setPerPage($perpage) { $this->perpage = $perpage ? : 5; @@ -288,12 +290,10 @@ class DataGrid } /** - * Set table name in front - * of query scope. + * Set table name in front of query scope. * * @return $this */ - public function setTable(string $table) { $this->table = $table ?: false; @@ -301,12 +301,10 @@ class DataGrid } /** - * Set join bag if - * present. + * Set join bag if present. * * @return $this */ - public function setJoin(array $join) { $this->join = $join ?: []; @@ -315,20 +313,45 @@ class DataGrid /** * Adds the custom css rules - * @retun $this + * + * @return $this */ - private function setCss($css = []) { $this->css = new Css($css); return $this->css; } + /** - * setFilterableColumns + * Adds operands to be used for query condition + * * @return $this */ + public function setOperators() + { + $operands = [ + 'eq' => "=", + 'lt' => "<", + 'gt' => ">", + 'lte' => "<=", + 'gte' => ">=", + 'neqs' => "<>", + 'neqn' => "!=", + 'like' => "like", + 'nlike' => "not like", + ]; + $this->operators = $operands; + + return $this; + } + + /** + * setFilterableColumns + * + * @return $this + */ // public function setFilterableColumns($filterable_columns = []) // { // $this->join = $filterable_columns ?: []; @@ -336,11 +359,25 @@ class DataGrid // } /** - * Section actions bag - * here. + * get alias of the leftmost table + * + * @return null|string + */ + public function findTableAlias() { + if($this->aliased) { + $alias = trim(explode('as', $this->table)[1]); + } else { + $alias = null; + } + + return $alias; + } + + /** + * Section actions bag here. + * * @return $this */ - public function setActions($actions = []) { $this->actions = $actions ?: []; return $this; @@ -351,17 +388,18 @@ class DataGrid * * @return $this */ - public function addColumns($columns = [], $reCreate = false) { if ($reCreate) { $this->columns = new Collection(); } + if ($columns) { foreach ($columns as $column) { $this->addColumn($column); } } + return $this; } @@ -370,7 +408,6 @@ class DataGrid * * @return $this */ - public function addColumn($column = []) { if ($column instanceof Column) { @@ -380,16 +417,15 @@ class DataGrid } else { throw new \Exception("DataGrid: Add Column argument is not valid!"); } + return $this; } /** - * Add ColumnMultiple. - * Currently is not - * of any use. + * Add multiple columns, not being used currently + * * @return $this */ - private function addColumnMultiple($column = [], $multiple = false) { if ($column instanceof Column) { @@ -419,16 +455,6 @@ class DataGrid return $this; } - /** - * Adds expressional verbs to be used - * @return $this - */ - public function setOperators(array $operators) - { - $this->operators = $operators ?: []; - return $this; - } - /** * Add Pagination. * @@ -443,27 +469,28 @@ class DataGrid } else { throw new \Exception("DataGrid: Pagination argument is not valid!"); } + return $this; } /** - * Used for selecting - * the columns got in - * make from controller. + * Used for selecting the columns got in make from controller. + * * @return $this */ private function getSelect() { $select = []; + + if ($this->select) { + $this->query->addselect($this->select); + } + foreach ($this->columns as $column) { $this->query->addselect(DB::raw($column->name.' as '.$column->alias)); } // $this->query->select(...$select); - - if ($this->select) { - $this->query->addselect($this->select); - } } /** @@ -473,7 +500,7 @@ class DataGrid * name. * @return string */ - public function findAlias($column_alias) { + public function findColumnAlias($column_alias) { foreach($this->columns as $column) { if($column->alias == $column_alias) { return $column->name; @@ -488,7 +515,7 @@ class DataGrid * name. * @return string */ - public function findType($column_alias) { + public function findColumnType($column_alias) { foreach($this->columns as $column) { if($column->alias == $column_alias) { return $column->type; @@ -497,14 +524,13 @@ class DataGrid } /** - * Parse the URL - * and get it ready - * to be used. + * Parse the URL and get it ready to be used. */ private function parse() { $parsed = []; $unparsed = url()->full(); + if (count(explode('?', $unparsed)) > 1) { $to_be_parsed = explode('?', $unparsed)[1]; @@ -519,17 +545,24 @@ class DataGrid /** * ->join('contacts', 'users.id', '=', 'contacts.user_id') + * * @return $this->query */ private function getQueryWithJoin() { foreach ($this->join as $join) { $this->query->{$join['join']}($join['table'], $join['primaryKey'], $join['condition'], $join['secondaryKey']); + + if(isset($join['conditions'])) { + // dd($join['conditions']['condition'][0], $join['conditions']['condition'][1]); + $this->query->{$join['join']}($join['table'], $join['primaryKey'], $join['condition'], $join['secondaryKey'])->where($join['conditions']['condition'][0], $join['conditions']['condition'][1]); + } } } private function getQueryWithColumnFilters() { + // config()->set('key', $value); foreach ($this->columns as $column) { if ($column->filter) { // if the filter bag in array exists then these will be applied. // if (count($column->filter['condition']) == count($column->filter['condition'], COUNT_RECURSIVE)) { @@ -567,13 +600,13 @@ class DataGrid if ($this->aliased) { //aliasing is expected in this case or it will be changed to presence of join bag foreach ($parsed as $key=>$value) { - $column_name = $this->findAlias($key); - $column_type = $this->findType($key); + $column_name = $this->findColumnAlias($key); + $column_type = $this->findColumnType($key); if ($key == "sort") { //resolve the case with the column helper class if(substr_count($key,'_') >= 1) - $column_name = $this->findAlias($key); + $column_name = $this->findColumnAlias($key); //case that don't need any resolving $count_keys = count(array_keys($value)); @@ -599,7 +632,7 @@ class DataGrid } }); } else { - $column_name = $this->findAlias($key); + $column_name = $this->findColumnAlias($key); if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") { foreach ($value as $condition => $filter_value) { if (strpos($column_name, 'CONCAT') !== false) { @@ -640,7 +673,6 @@ class DataGrid } else { //this is the case for the non aliasing. foreach ($parsed as $key => $value) { - if ($key=="sort") { //case that don't need any resolving @@ -672,8 +704,8 @@ class DataGrid } else { // $column_name = $key; - $column_name = $this->findAlias($key); - $column_type = $this->findType($key); + $column_name = $this->findColumnAlias($key); + $column_type = $this->findColumnType($key); if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") { foreach ($value as $condition => $filter_value) { @@ -712,7 +744,6 @@ class DataGrid } } } - } } @@ -811,9 +842,11 @@ class DataGrid $this->getQueryWithFilters(); } - if ($pagination == 'true') { + if ($pagination == 'true' && config('datagrid.distinct')) { + $this->results = $this->query->orderBy($this->select, 'desc')->distinct()->paginate($this->perpage)->appends(request()->except('page')); + } else if($pagination == 'true' && !config('datagrid.distinct')) { $this->results = $this->query->orderBy($this->select, 'desc')->paginate($this->perpage)->appends(request()->except('page')); - } else { + }else { $this->results = $this->query->orderBy($this->select, 'desc')->get(); } @@ -842,13 +875,10 @@ class DataGrid } /** - * Main Render Function, - * it renders views responsible - * for loading datagrid. + * Main Render Function, it renders views responsible for loading datagrid. * * @return view */ - public function render($pagination = true) { $this->getDbQueryResults($pagination); diff --git a/packages/Webkul/Ui/src/DataGrid/Helpers/AbstractFillable.php b/packages/Webkul/Ui/src/DataGrid/Helpers/AbstractFillable.php index 5d67b68be..30bc9cd83 100755 --- a/packages/Webkul/Ui/src/DataGrid/Helpers/AbstractFillable.php +++ b/packages/Webkul/Ui/src/DataGrid/Helpers/AbstractFillable.php @@ -94,7 +94,7 @@ abstract class AbstractFillable break; } - if($error) throw new \Exception($error); + if ($error) throw new \Exception($error); $this->{$key} = $value; } diff --git a/packages/Webkul/Ui/src/DataGrid/Helpers/Column.php b/packages/Webkul/Ui/src/DataGrid/Helpers/Column.php index 25e1ff32d..2333eae32 100755 --- a/packages/Webkul/Ui/src/DataGrid/Helpers/Column.php +++ b/packages/Webkul/Ui/src/DataGrid/Helpers/Column.php @@ -159,7 +159,6 @@ class Column extends AbstractFillable public function render($obj) { - if (property_exists($obj, ($this->aliasing = $this->alias))) { $this->value = $obj->{$this->aliasing}; $this->wrap($obj); diff --git a/packages/Webkul/Ui/src/DataGrid/Helpers/Pagination.php b/packages/Webkul/Ui/src/DataGrid/Helpers/Pagination.php index f1f276680..1cd6f044e 100755 --- a/packages/Webkul/Ui/src/DataGrid/Helpers/Pagination.php +++ b/packages/Webkul/Ui/src/DataGrid/Helpers/Pagination.php @@ -17,7 +17,7 @@ use Illuminate\Pagination\Paginator; class Pagination extends Paginator { - const LIMIT = 20; + const LIMIT = 10; const OFFSET = 0; const VIEW = ''; diff --git a/packages/Webkul/Ui/src/Resources/assets/js/dropdown.js b/packages/Webkul/Ui/src/Resources/assets/js/dropdown.js index 3be40a7cf..d888bfece 100755 --- a/packages/Webkul/Ui/src/Resources/assets/js/dropdown.js +++ b/packages/Webkul/Ui/src/Resources/assets/js/dropdown.js @@ -15,7 +15,7 @@ $(function() { var currentElement = $(e.currentTarget); if(currentElement.attr('disabled') == "disabled") return; - + $('.dropdown-list').hide(); if(currentElement.hasClass('active')) { currentElement.removeClass('active'); @@ -59,7 +59,7 @@ $(function() { height = dropdown.height() + 50; var topOffset = dropdown.offset().top - 70; var bottomOffset = $(window).height() - topOffset - dropdown.height(); - + if(bottomOffset > topOffset || height < bottomOffset) { dropdown.removeClass("bottom"); if(dropdown.hasClass('top-right')) { diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss index fb6b354a1..aec5755a6 100755 --- a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss @@ -354,8 +354,7 @@ h2 { .checkbox { position: relative; display: block; - vertical-align: middle; - margin: 0px 5px 5px 0px; + // vertical-align: middle; input { left: 0; diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/components.scss b/packages/Webkul/Ui/src/Resources/assets/sass/components.scss index 0e8d05174..980448fc8 100755 --- a/packages/Webkul/Ui/src/Resources/assets/sass/components.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/components.scss @@ -1,257 +1,106 @@ -/* Data grid css starts here */ .grid-container { - .filter-wrapper { - display: block; - box-sizing: border-box; + display: block; + width: 100%; + height: 100%; +} - .filter-row-one, - .filter-row-two { - display: flex; - flex-direction: row; - } - .filter-row-one { - height: 40px; - align-items: center; - justify-content: space-between; +.filter-row-one { + display: flex; + width: 100%; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; +} - .search-filter { - .control { - font-family: "montserrat", sans-serif; - padding-left: 10px; - width: 380px; - height: 36px; - border: 2px solid $control-border-color; - border-radius: 3px; - border-right: 0px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; - font-size: 14px; - } - .ic-wrapper { - display: block; - height: 36px; - width: 36px; - border: 2px solid $control-border-color; - border-left: none; - border-radius: 2px; +.filter-row-two { + display: flex; + width: 100%; + flex-direction: row; + justify-content: flex-start; + align-items: center; + margin-bottom: 10px; +} - .search-icon { - margin-left: 4px; - margin-top: 4px; - height: 24px; - width: 24px; - } - } - } +.search-filter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; - .dropdown-filters { - display: inline-flex; - - .more-filters { - - .dropdown-toggle { - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - font-family: "montserrat", sans-serif; - padding-left: 5px; - height: 36px; - width: 150px; - border: 2px solid $control-border-color; - border-radius: 2px; - background-color: $color-white; - color: $filter-toggle-color; - font-size: 14px; - - .dropdown-header { - width: 100%; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - - .arrow-down-icon { - margin-right: 5px; - } - } - } - - .dropdown-list { - .dropdown-container { - ul { - li.filter-column-dropdown { - .filter-column-select { - width: 100%; - background: $color-white; - border: 2px solid $control-border-color; - border-radius: 3px; - height: 36px; - display: inline-block; - vertical-align: middle; - -webkit-transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - padding: 0px 5px; - font-family: "montserrat", sans-serif; - margin-top: 10px; - margin-bottom: 5px; - } - } - - li { - select { - background: $color-white; - border: 2px solid $control-border-color; - border-radius: 3px; - height: 36px; - width: 100%; - display: inline-block; - vertical-align: middle; - -webkit-transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - padding: 0px 5px; - font-family: "montserrat", sans-serif; - margin-top: 10px; - margin-bottom: 5px; - } - - input { - background: #fff; - border: 2px solid #c7c7c7; - border-radius: 3px; - height: 36px; - width: 100%; - display: inline-block; - vertical-align: middle; - -webkit-transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - transition: 0.2s - cubic-bezier(0.4, 0, 0.2, 1); - padding: 0px 5px; - font-family: "montserrat", sans-serif; - margin-top: 10px; - margin-bottom: 5px; - } - } - - .filter-condition-dropdown-string { - display: none; - } - .filter-condition-dropdown-number { - display: none; - } - .filter-condition-dropdown-datetime { - display: none; - } - .filter-condition-dropdown-boolean { - display: none; - } - - .filter-response-string { - display: none; - } - .filter-response-boolean { - display: none; - } - .filter-response-datetime { - display: none; - } - .filter-response-number { - display: none; - } - } - } - } - } - } - } - .filter-row-two { - display: flex; - flex-direction: row; - flex-wrap: wrap; - margin-top: 6px; - margin-bottom: 6px; - - .filter-one { - margin-right: 10px; - - .filter-name { - margin-right: 5px; - } - - .filter-value { - display: inline-flex; - background: #e7e7e7; - padding-left: 5px; - color: $color-black-shade; - vertical-align: middle; - - .f-value { - margin: auto; - } - - .cross-icon { - margin: 5px; - height: 18px !important; - width: 18px !important; - cursor: pointer; - } - } - } - } + .control { + background: #ffffff; + border: 2px solid $control-border-color; + border-right: none; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; + border-radius: 3px; + height: 36px; + width: 360px; + padding-left: 10px; + font-size: 15px; + color: #8E8E8E; } - .table { - thead { - .mass-action-wrapper { - display: flex; - flex-direction: row; - justify-content: flex-start; - align-items: center; - .massaction-remove { - margin-top: 4px; - margin-right: 10px; - } + .contorl:focus { + border-color: $brand-color; + } - .selected-items { - margin-right: 15px; - } - } - tr { - th.grid_head { + .icon-wrapper { + border: 2px solid $control-border-color; + border-radius: 3px; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; + height: 36px; + width: 36px; + margin-left: -1px; - .sort-down-icon, .sort-up-icon { - margin-left: 5px; - margin-top: -3px; - vertical-align: middle; - } - } - - th.grid_head.sortable { - cursor: pointer; - } - - th { - text-transform: capitalize; - } - } - } - - tbody { - td.action { - a:first-child { - margin-right: 10px; - } - } - } - - .pagination { - margin-top:20px; + .search-icon { + margin-top: 3px; + margin-left: 3px; } } } -/* DataGrid css ends in here */ + +.dropdown-header { + display: inline-flex; + justify-content: space-between; + align-items: center; + height: 36px; + width: 202px; + border: 2px solid $control-border-color; + border-radius: 3px; + color: #8E8E8E; + padding: 0px 5px 0px 5px; + + .arrow-icon-down { + float: right; + } +} + +.filter-tag { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + font-size: 14px; + height: 28px; + border-radius: 2px; + + .wrapper { + margin-left: 5px; + padding: 0px 5px 0px 5px; + display: flex; + flex-direction: row; + align-items: center; + background: #E7E7E7; + font-size: 14px; + height: 28px; + color: #000311; + letter-spacing: -0.22px; + } +} + +.filter-tag:not(first-child) { + margin-left: 10px; +} \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/filters.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/filters.blade.php index 5dffa79eb..1e349aa7d 100755 --- a/packages/Webkul/Ui/src/Resources/views/datagrid/filters.blade.php +++ b/packages/Webkul/Ui/src/Resources/views/datagrid/filters.blade.php @@ -2,6 +2,7 @@
+
diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/index.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/index.blade.php index 203e4feae..12a8fc5aa 100755 --- a/packages/Webkul/Ui/src/Resources/views/datagrid/index.blade.php +++ b/packages/Webkul/Ui/src/Resources/views/datagrid/index.blade.php @@ -133,26 +133,26 @@ var conditionUsed = $('.filter-condition-dropdown-number').find(':selected').val(); var response = $('.response-number').val(); - formURL(selectedColumn,conditionUsed,response,params,col_label); + formURL(selectedColumn,conditionUsed,response,params, col_label); } if(typeValue == 'string') { var conditionUsed = $('.filter-condition-dropdown-string').find(':selected').val(); var response = $('.response-string').val(); - formURL(selectedColumn,conditionUsed,response,params,col_label); + formURL(selectedColumn,conditionUsed,response,params, col_label); } if(typeValue == 'datetime') { var conditionUsed = $('.filter-condition-dropdown-datetime').find(':selected').val(); var response = $('.response-datetime').val(); - formURL(selectedColumn,conditionUsed,response,params,col_label); + formURL(selectedColumn,conditionUsed,response,params, col_label); } if(typeValue == 'boolean') { //use select dropdown with two values true and false // console.log('boolean'); var conditionUsed = $('.filter-condition-dropdown-boolean').find(':selected').val(); var response = $('.response-boolean').val(); - formURL(selectedColumn,conditionUsed,response,params,col_label); + formURL(selectedColumn,conditionUsed,response,params, col_label); } }); }); @@ -160,6 +160,7 @@ //remove the filter and from clicking on cross icon on tag $('.remove-filter').on('click', function() { var id = $(this).parents('.filter-one').attr('id'); + if(allFilters.length == 1) { allFilters.pop(); var uri = window.location.href.toString(); @@ -298,10 +299,10 @@ //make the url from the array and redirect function makeURL(repetition = false) { - if(allFilters.length>0 && repetition == false) + if(allFilters.length > 0 && repetition == false) { - for(i=0;i{!! $column['wrapper']($record->{$index}) !!} + @else + {{ $column['wrapper']($record->{$index}) }} + @endif + @else + {{ $record->{$index} }} + @endif + @endforeach + + +
+ + + @endforeach + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/views/testgrid/filters.blade.php b/packages/Webkul/Ui/src/Resources/views/testgrid/filters.blade.php new file mode 100644 index 000000000..b31ca660f --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/views/testgrid/filters.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/packages/Webkul/Ui/src/Resources/views/testgrid/head.blade.php b/packages/Webkul/Ui/src/Resources/views/testgrid/head.blade.php new file mode 100644 index 000000000..60bd9abc9 --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/views/testgrid/head.blade.php @@ -0,0 +1,14 @@ + + + + + + + + + + @foreach($columns as $key => $column) + {{ $column['label'] }} + @endforeach + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/views/testgrid/pagination.blade.php b/packages/Webkul/Ui/src/Resources/views/testgrid/pagination.blade.php new file mode 100644 index 000000000..90116cf07 --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/views/testgrid/pagination.blade.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/views/testgrid/table.blade.php b/packages/Webkul/Ui/src/Resources/views/testgrid/table.blade.php new file mode 100644 index 000000000..c33c4900d --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/views/testgrid/table.blade.php @@ -0,0 +1,639 @@ +
+ + + @if(config('datagrid.pagination')) + @include('ui::testgrid.pagination', ['results' => $results['records']]) + @endif + + @push('scripts') + + + + @endpush +
\ No newline at end of file diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore deleted file mode 100755 index d6b7ef32c..000000000 --- a/storage/app/public/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore