@@ -623,6 +623,8 @@ <h5 th:text="#{t_who_selling_series}">Who was selling/buying this series</h5>
623
623
</ div >
624
624
</ div >
625
625
626
+ < div id ="series-sales-list " sec:authorize ="hasAuthority('VIEW_SERIES_SALES') "> </ div >
627
+
626
628
< div class ="row " sec:authorize ="hasAuthority('ADD_SERIES_SALES') ">
627
629
< div class ="col-sm-12 ">
628
630
< h5 th:text ="#{t_add_info_who_selling_series} "> Add info about selling/buying this series</ h5 >
@@ -999,6 +1001,105 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
999
1001
1000
1002
responseCount ++ ;
1001
1003
1004
+ return new Promise ( function delayExecution ( resolve ) {
1005
+ setTimeout ( resolve , 500 /* 0.5 second */ ) ;
1006
+
1007
+ } ) . then ( function returnResponse ( ) {
1008
+ return stubResponse . status == 500 ? Promise . reject ( stubResponse ) : Promise . resolve ( stubResponse ) ;
1009
+ } ) ;
1010
+ } ,
1011
+ get : function ( url ) {
1012
+ var possibleOutcomes = [ 'success' ] ;
1013
+ var outcome = possibleOutcomes [ responseCount % possibleOutcomes . length ] ;
1014
+ var possibleResponses = {
1015
+ '/series/100' : {
1016
+ 'success' : {
1017
+ status : 200 ,
1018
+ data : [
1019
+ {
1020
+ id : 1 ,
1021
+ sellerName : 'James Alan Hetfield' ,
1022
+ sellerUrl : 'http://example.com/james-alan-hetfield' ,
1023
+ buyerName : 'Eicca Toppinen' ,
1024
+ buyerUrl : 'http://example.com/eicca-toppinen' ,
1025
+ transactionUrl : 'http://example.com/james-alan-hetfield/selling-stamps' ,
1026
+ firstPrice : 100 ,
1027
+ firstCurrency : 'USD' ,
1028
+ condition : 'CANCELLED'
1029
+ } ,
1030
+ {
1031
+ id : 2 ,
1032
+ sellerName : 'James Alan Hetfield' ,
1033
+ sellerUrl : 'http://example.com/james-alan-hetfield' ,
1034
+ transactionUrl : 'http://example.com/james-alan-hetfield/selling-stamps' ,
1035
+ firstPrice : 100 ,
1036
+ firstCurrency : 'USD' ,
1037
+ secondPrice : 650 ,
1038
+ secondCurrency : 'RUB' ,
1039
+ condition : 'CANCELLED'
1040
+ } ,
1041
+ {
1042
+ id : 3 ,
1043
+ date : '02.02.2002' ,
1044
+ sellerName : 'Tommy Lee Jones' ,
1045
+ sellerUrl : 'http://example.com/tommy-lee-jones' ,
1046
+ transactionUrl : 'http://example.com/tommy-lee-jones/selling-stamps' ,
1047
+ firstPrice : 200 ,
1048
+ firstCurrency : 'USD' ,
1049
+ condition : 'MNH'
1050
+ } ,
1051
+ {
1052
+ id : 4 ,
1053
+ date : '02.02.2002' ,
1054
+ sellerName : 'Tommy Lee Jones' ,
1055
+ sellerUrl : 'http://example.com/tommy-lee-jones' ,
1056
+ transactionUrl : 'http://example.com/tommy-lee-jones/selling-stamps' ,
1057
+ firstPrice : 200 ,
1058
+ firstCurrency : 'USD' ,
1059
+ secondPrice : 1300 ,
1060
+ secondCurrency : 'RUB' ,
1061
+ } ,
1062
+ {
1063
+ id : 5 ,
1064
+ date : '03.02.2002' ,
1065
+ sellerName : 'Eicca Toppinen' ,
1066
+ sellerUrl : 'http://example.com/eicca-toppinen' ,
1067
+ transactionUrl : 'http://example.com/tommy-lee-jones/selling-stamps' ,
1068
+ firstPrice : 300 ,
1069
+ firstCurrency : 'USD' ,
1070
+ secondPrice : 1560 ,
1071
+ secondCurrency : 'RUB' ,
1072
+ } ,
1073
+ {
1074
+ id : 6 ,
1075
+ date : '03.02.2002' ,
1076
+ sellerName : 'Eicca Toppinen' ,
1077
+ sellerUrl : 'http://example.com/eicca-toppinen' ,
1078
+ buyerName : 'Kurt Cobain' ,
1079
+ firstPrice : 300 ,
1080
+ firstCurrency : 'USD' ,
1081
+ secondPrice : 1560 ,
1082
+ secondCurrency : 'RUB' ,
1083
+ }
1084
+ ]
1085
+ }
1086
+ }
1087
+ } ;
1088
+ var stubResponse ;
1089
+
1090
+ switch ( outcome ) {
1091
+ case 'success' :
1092
+ stubResponse = possibleResponses [ url ] [ outcome ] ;
1093
+ break ;
1094
+ default :
1095
+ stubResponse = {
1096
+ status : 500 ,
1097
+ statusText : 'Fake Server Error'
1098
+ } ;
1099
+ }
1100
+
1101
+ responseCount ++ ;
1102
+
1002
1103
return new Promise ( function delayExecution ( resolve ) {
1003
1104
setTimeout ( resolve , 500 /* 0.5 second */ ) ;
1004
1105
@@ -1019,6 +1120,8 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1019
1120
< script src ="../../../../../../target/classes/js/components/AddReleaseYearForm.js " th:src ="${RELEASE_YEAR_FORM_JS} "> </ script >
1020
1121
< script src ="../../../../../../target/classes/js/components/AddCatalogPriceForm.js " th:src ="${CATALOG_PRICE_FORM_JS} "> </ script >
1021
1122
< script src ="../../../../../../target/classes/js/components/AddCatalogNumbersForm.js " th:src ="${CATALOG_NUMBERS_FORM_JS} "> </ script >
1123
+ < script src ="../../../../../../target/classes/js/components/SeriesSalesList.js " th:src ="${SERIES_SALES_LIST_JS} "> </ script >
1124
+
1022
1125
1023
1126
< script th:inline ="javascript ">
1024
1127
/*[+
@@ -1057,6 +1160,12 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1057
1160
't_add': [[ #{t_add} ]]
1058
1161
}
1059
1162
};
1163
+ var seriesSalesListProps = {
1164
+ 'url': [[ '__@{${INFO_SERIES_PAGE}(id=${series.id})}__' ]],
1165
+ 'l10n': {
1166
+ 't_server_error': [[ #{t_server_error} ]],
1167
+ }
1168
+ };
1060
1169
+]*/
1061
1170
1062
1171
/*[- */
@@ -1074,10 +1183,17 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1074
1183
'url' : '/series/100' ,
1075
1184
'l10n' : { }
1076
1185
} ;
1186
+
1187
+ var seriesSalesListProps = {
1188
+ 'url' : '/series/100' ,
1189
+ 'l10n' : { }
1190
+ } ;
1077
1191
/* -]*/
1078
1192
1079
1193
renderComponent ( AddCatalogPriceForm , addCatalogPriceProps , 'add-catalog-price' ) ;
1080
1194
renderComponent ( AddCatalogNumbersForm , addCatalogNumbersProps , 'add-catalog-numbers' ) ;
1195
+ renderComponent ( SeriesSalesList , seriesSalesListProps , 'series-sales-list' ) ;
1196
+
1081
1197
1082
1198
/*[# th:if="${series.releaseYear == null}"]*/
1083
1199
/*[+
0 commit comments