From 9d5a9843e515cc1038421d13a789529523e2337f Mon Sep 17 00:00:00 2001 From: faxblaster Date: Wed, 21 Jul 2021 09:19:58 -0400 Subject: [PATCH 1/4] add Customers listing page --- dist/js/tool.js | 887 ++++++++++++++---- resources/js/components/ChargesTable.vue | 159 ++-- resources/js/components/CustomersTable.vue | 137 +++ ...aginationLinks.vue => PaginationLinks.vue} | 4 +- resources/js/tool.js | 24 +- resources/js/views/Customers.vue | 15 + resources/views/navigation.blade.php | 6 + routes/api.php | 2 + src/Clients/StripeClient.php | 10 + src/Http/StripeCustomersController.php | 19 + 10 files changed, 980 insertions(+), 283 deletions(-) create mode 100644 resources/js/components/CustomersTable.vue rename resources/js/components/{ChargesPaginationLinks.vue => PaginationLinks.vue} (93%) create mode 100644 resources/js/views/Customers.vue create mode 100644 src/Http/StripeCustomersController.php diff --git a/dist/js/tool.js b/dist/js/tool.js index 1fa5f6f..53df835 100644 --- a/dist/js/tool.js +++ b/dist/js/tool.js @@ -1780,14 +1780,19 @@ Nova.booting(function (Vue, router) { Vue.config.devtools = true; router.addRoutes([{ - name: 'nova-stripe', - path: '/nova-stripe', + name: "nova-stripe", + path: "/nova-stripe", component: __webpack_require__(6) }, { - name: 'charge-detail', - path: '/nova-stripe/charge/:chargeId', + name: "charge-detail", + path: "/nova-stripe/charge/:chargeId", component: __webpack_require__(24), props: true + }, { + name: "customer-list", + path: "/nova-stripe/customers", + component: __webpack_require__(37), + props: true }]); }); @@ -2236,7 +2241,7 @@ exports = module.exports = __webpack_require__(1)(false); // module -exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* Scoped Styles */\n", ""]); +exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* Scoped Styles */\n", ""]); // exports @@ -2247,8 +2252,8 @@ exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ChargesPaginationLinks_vue__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ChargesPaginationLinks_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__ChargesPaginationLinks_vue__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__PaginationLinks_vue__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__PaginationLinks_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__PaginationLinks_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_moneyFormat__ = __webpack_require__(3); // // @@ -2320,13 +2325,21 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); // // // +// +// +// +// +// +// +// +// /* harmony default export */ __webpack_exports__["default"] = ({ components: { - 'charges-pagination-links': __WEBPACK_IMPORTED_MODULE_0__ChargesPaginationLinks_vue___default.a + "charges-pagination-links": __WEBPACK_IMPORTED_MODULE_0__PaginationLinks_vue___default.a }, data: function data() { @@ -2346,7 +2359,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); listCharges: function listCharges(params) { var _this = this; - Nova.request().get('/nova-vendor/nova-stripe/stripe/charges', { params: params }).then(function (response) { + Nova.request().get("/nova-vendor/nova-stripe/stripe/charges", { params: params }).then(function (response) { _this.charges = response.data.charges.data; _this.hasMore = response.data.charges.has_more; _this.initialLoading = false; @@ -2356,14 +2369,16 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); nextPage: function nextPage() { this.loading = true; - this.listCharges({ 'starting_after': this.charges[this.charges.length - 1].id }); + this.listCharges({ + starting_after: this.charges[this.charges.length - 1].id + }); this.page++; }, previousPage: function previousPage() { this.loading = true; - this.listCharges({ 'ending_before': this.charges[0].id }); + this.listCharges({ ending_before: this.charges[0].id }); if (this.hasPrevious) { this.page--; @@ -2379,7 +2394,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); filters: { date: function date(_date) { - return moment.unix(_date).format('YYYY/MM/DD h:mm:ss a'); + return moment.unix(_date).format("YYYY/MM/DD h:mm:ss a"); }, @@ -2392,187 +2407,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); }); /***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -var disposed = false -var normalizeComponent = __webpack_require__(0) -/* script */ -var __vue_script__ = __webpack_require__(20) -/* template */ -var __vue_template__ = __webpack_require__(21) -/* template functional */ -var __vue_template_functional__ = false -/* styles */ -var __vue_styles__ = null -/* scopeId */ -var __vue_scopeId__ = null -/* moduleIdentifier (server only) */ -var __vue_module_identifier__ = null -var Component = normalizeComponent( - __vue_script__, - __vue_template__, - __vue_template_functional__, - __vue_styles__, - __vue_scopeId__, - __vue_module_identifier__ -) -Component.options.__file = "resources/js/components/ChargesPaginationLinks.vue" - -/* hot reload */ -if (false) {(function () { - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), false) - if (!hotAPI.compatible) return - module.hot.accept() - if (!module.hot.data) { - hotAPI.createRecord("data-v-14899e2b", Component.options) - } else { - hotAPI.reload("data-v-14899e2b", Component.options) - } - module.hot.dispose(function (data) { - disposed = true - }) -})()} - -module.exports = Component.exports - - -/***/ }), -/* 20 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ __webpack_exports__["default"] = ({ - props: ['charges', 'hasMore', 'hasPrevious'], - - methods: { - /** - * Select the previous page. - */ - previousPage: function previousPage() { - this.$emit('previous'); - }, - - - /** - * Select the next page. - */ - nextPage: function nextPage() { - this.$emit('next'); - } - } -}); - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -var render = function() { - var _vm = this - var _h = _vm.$createElement - var _c = _vm._self._c || _h - return _c("div", { staticClass: "bg-20 rounded-b" }, [ - _vm.charges.length > 0 - ? _c("nav", { staticClass: "flex" }, [ - _c( - "button", - { - staticClass: "btn btn-link py-3 px-4", - class: { - "text-primary dim": _vm.hasPrevious, - "text-80 opacity-50 cursor-not-allowed": !_vm.hasPrevious - }, - attrs: { - disabled: !_vm.hasPrevious, - rel: "prev", - dusk: "previous" - }, - on: { - click: function($event) { - $event.preventDefault() - return _vm.previousPage() - } - } - }, - [ - _vm._v( - "\n " + _vm._s(_vm.__("Previous")) + "\n " - ) - ] - ), - _vm._v(" "), - _c( - "button", - { - staticClass: "ml-auto btn btn-link py-3 px-4", - class: { - "text-primary dim": _vm.hasMore, - "text-80 opacity-50 cursor-not-allowed": !_vm.hasMore - }, - attrs: { disabled: !_vm.hasMore, rel: "next", dusk: "next" }, - on: { - click: function($event) { - $event.preventDefault() - return _vm.nextPage() - } - } - }, - [_vm._v("\n " + _vm._s(_vm.__("Next")) + "\n ")] - ) - ]) - : _vm._e() - ]) -} -var staticRenderFns = [] -render._withStripped = true -module.exports = { render: render, staticRenderFns: staticRenderFns } -if (false) { - module.hot.accept() - if (module.hot.data) { - require("vue-hot-reload-api") .rerender("data-v-14899e2b", module.exports) - } -} - -/***/ }), +/* 19 */, +/* 20 */, +/* 21 */, /* 22 */ /***/ (function(module, exports, __webpack_require__) { @@ -2608,7 +2445,7 @@ var render = function() { { staticClass: "inline-flex items-center" }, [ _vm._v( - "\n Charge ID\n " + "\n Charge ID\n " ) ] ) @@ -2620,7 +2457,7 @@ var render = function() { { staticClass: "inline-flex items-center" }, [ _vm._v( - "\n Amount\n " + "\n Amount\n " ) ] ) @@ -2632,7 +2469,7 @@ var render = function() { { staticClass: "inline-flex items-center" }, [ _vm._v( - "\n Created\n " + "\n Created\n " ) ] ) @@ -2644,7 +2481,7 @@ var render = function() { { staticClass: "inline-flex items-center" }, [ _vm._v( - "\n Status\n " + "\n Status\n " ) ] ) @@ -2718,7 +2555,7 @@ var render = function() { _vm._v(" "), _c("charges-pagination-links", { attrs: { - charges: _vm.charges, + resource: _vm.charges, hasMore: _vm.hasMore, hasPrevious: _vm.hasPrevious }, @@ -3095,5 +2932,659 @@ if (false) { // removed by extract-text-webpack-plugin +/***/ }), +/* 31 */, +/* 32 */, +/* 33 */, +/* 34 */, +/* 35 */, +/* 36 */, +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(40) +/* template */ +var __vue_template__ = __webpack_require__(41) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "resources/js/views/Customers.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-c9944874", Component.options) + } else { + hotAPI.reload("data-v-c9944874", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 38 */, +/* 39 */, +/* 40 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_CustomersTable__ = __webpack_require__(42); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_CustomersTable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__components_CustomersTable__); +// +// +// +// +// +// +// +// + + + +/* harmony default export */ __webpack_exports__["default"] = ({ + components: { CustomersTable: __WEBPACK_IMPORTED_MODULE_0__components_CustomersTable___default.a } +}); + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +var render = function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c( + "div", + [ + _c("heading", { staticClass: "mb-6" }, [_vm._v("Customers")]), + _vm._v(" "), + _c("customers-table") + ], + 1 + ) +} +var staticRenderFns = [] +render._withStripped = true +module.exports = { render: render, staticRenderFns: staticRenderFns } +if (false) { + module.hot.accept() + if (module.hot.data) { + require("vue-hot-reload-api") .rerender("data-v-c9944874", module.exports) + } +} + +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +function injectStyle (ssrContext) { + if (disposed) return + __webpack_require__(43) +} +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(45) +/* template */ +var __vue_template__ = __webpack_require__(46) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = injectStyle +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "resources/js/components/CustomersTable.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-b32879b8", Component.options) + } else { + hotAPI.reload("data-v-b32879b8", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a diff --git a/resources/js/components/CustomersTable.vue b/resources/js/components/CustomersTable.vue new file mode 100644 index 0000000..e25ab91 --- /dev/null +++ b/resources/js/components/CustomersTable.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/resources/js/components/ChargesPaginationLinks.vue b/resources/js/components/PaginationLinks.vue similarity index 93% rename from resources/js/components/ChargesPaginationLinks.vue rename to resources/js/components/PaginationLinks.vue index 13c1c74..cf72cd6 100644 --- a/resources/js/components/ChargesPaginationLinks.vue +++ b/resources/js/components/PaginationLinks.vue @@ -1,6 +1,6 @@