@@ -21,15 +21,11 @@ import TableHead from '@material-ui/core/TableHead';
2121import TableRow from '@material-ui/core/TableRow' ;
2222import Typography from '@material-ui/core/Typography' ;
2323
24-
2524const useStyles = theme => ( {
2625 backdrop : {
2726 zIndex : theme . zIndex . drawer + 1 ,
2827 color : '#fff' ,
29- } ,
30- title : {
31- // minWidth: 650,
32- } ,
28+ }
3329} ) ;
3430
3531class GenerateLink extends React . Component {
@@ -56,7 +52,6 @@ class GenerateLink extends React.Component {
5652 purchasedProductIframeurl : '' ,
5753 calculatedAmountDetails : '' ,
5854 loading : false ,
59- subCategories : [ ] ,
6055 coupons : [ ]
6156 }
6257 }
@@ -158,7 +153,6 @@ class GenerateLink extends React.Component {
158153 handleProductChange = async ( event , value ) => {
159154 this . setState ( {
160155 product : value ,
161- subCategories : [ ] ,
162156 coupons : [ ]
163157 } )
164158
@@ -200,7 +194,6 @@ class GenerateLink extends React.Component {
200194 activeCartIframeUrl : '' ,
201195 purchasedProductIframeurl : '' ,
202196 loading : false ,
203- subCategories : [ ] ,
204197 coupons : [ ] ,
205198 } )
206199 } else {
@@ -212,7 +205,6 @@ class GenerateLink extends React.Component {
212205 activeCartIframeUrl : activeCartDetails . data . iframeUrl ,
213206 purchasedProductIframeurl : purchasedProductDetails . data . iframeUrl ,
214207 loading : true ,
215- subCategories : [ ] ,
216208 coupons : [ ] ,
217209 } )
218210 } ) . catch ( ( error ) => {
@@ -230,27 +222,20 @@ class GenerateLink extends React.Component {
230222 this . unsetGeneratedLink ( )
231223 }
232224
233-
234- fillSubCategories = ( data ) => {
235- couponController . fetchSubCategories ( data ) . then ( ( subCategories ) => {
225+ handleCategoryChange = ( event ) => {
226+
227+ if ( ! event . target . value ) {
236228 this . setState ( {
237- subCategories : subCategories . data
229+ coupons : [ ]
238230 } )
239- } ) . catch ( ( error ) => {
240- ErrorHandler . handle ( error )
241- } )
242- } ;
243-
244- handleCategoryChange = ( event ) => {
245- this . fillSubCategories ( { category : event . target . value } )
246- }
231+ return
232+ }
247233
248- handleSubCategoryChange = ( category , subCategoryId ) => {
249234 couponController . fetchCouponsApplicableForAUserAndProduct ( {
250235 user_id : this . state . user . id ,
251236 product_id : this . state . product . id ,
252- category : category ,
253- sub_category_id : subCategoryId
237+ category : event . target . value ,
238+ organization_id : this . state . organizationId
254239 } ) . then ( ( response ) => {
255240 this . setState ( {
256241 coupons : response . data
@@ -309,11 +294,8 @@ class GenerateLink extends React.Component {
309294
310295 render ( ) {
311296 const { classes } = this . props ;
312-
313297 return (
314298 < div >
315-
316-
317299 < Head title = "Coding Blocks | Dukaan | Generate Product Link" />
318300 < Layout />
319301 < CheckLogin >
@@ -336,7 +318,6 @@ class GenerateLink extends React.Component {
336318 onApplyCreditsChange = { this . onApplyCreditsChange }
337319 ongenerateLink = { this . ongenerateLink }
338320 handleCategoryChange = { this . handleCategoryChange }
339- handleSubCategoryChange = { this . handleSubCategoryChange }
340321 />
341322 </ div >
342323
0 commit comments