repo_id
stringclasses 36
values | file_path
stringlengths 63
188
| content
stringlengths 62
41.5k
| __index_level_0__
int64 0
0
|
---|---|---|---|
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/SelectZipCodeInfoClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { SelectZipCodeInfoClientRequestHandler } from "PosApi/Extend/RequestHandlers/StoreOperationsRequestHandlers";
import { SelectZipCodeInfoClientRequest, SelectZipCodeInfoClientResponse } from "PosApi/Consume/StoreOperations";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for select zip code info request.
*/
export default class SelectZipCodeInfoClientRequestHandlerExt extends SelectZipCodeInfoClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {SelectZipCodeInfoClientRequest<SelectZipCodeInfoClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<SelectZipCodeInfoClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: SelectZipCodeInfoClientRequest):
Promise<ClientEntities.ICancelableDataResult<SelectZipCodeInfoClientResponse>> {
this.context.logger.logInformational("Executing SelectZipCodeInfoClientRequestHandlerExt for request: " + JSON.stringify(request) + ".");
// Do the extension logic here in place of default handler.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/LoyaltyCardPointsBalanceOperationRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { LoyaltyCardPointsBalanceOperationRequestHandler } from "PosApi/Extend/RequestHandlers/StoreOperationsRequestHandlers";
import { LoyaltyCardPointsBalanceOperationRequest, LoyaltyCardPointsBalanceOperationResponse } from "PosApi/Consume/StoreOperations";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for the loyalty card balance operation.
*/
export default class LoyaltyCardPointsBalanceOperationRequestHandlerExt extends LoyaltyCardPointsBalanceOperationRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {LoyaltyCardPointsBalanceOperationRequest<LoyaltyCardPointsBalanceOperationResponse>} request The request containing the response.
* @return {Promise<ICancelableDataResult<LoyaltyCardPointsBalanceOperationResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: LoyaltyCardPointsBalanceOperationRequest<LoyaltyCardPointsBalanceOperationResponse>):
Promise<ClientEntities.ICancelableDataResult<LoyaltyCardPointsBalanceOperationResponse>> {
// User could implement new business logic here to override deposit override flow.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/PaymentTerminalExecuteTaskRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { PaymentTerminalExecuteTaskRequestHandler } from "PosApi/Extend/RequestHandlers/PeripheralsRequestHandlers";
import { PaymentTerminalExecuteTaskRequest, PaymentTerminalExecuteTaskResponse } from "PosApi/Consume/Peripherals";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { GetCurrentCartClientRequest, GetCurrentCartClientResponse } from "PosApi/Consume/Cart";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import PaymentTerminalExecuteTaskRequestFactory from "Create/Helpers/PaymentTerminalExecuteTaskRequestFactory";
/**
* Override request handler class for the payment terminal ExecuteTask request.
*/
export default class PaymentTerminalExecuteTaskRequestHandlerExt extends PaymentTerminalExecuteTaskRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {PaymentTerminaExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>} request The request.
* @return {Promise<ICancelableDataResult<PaymentTerminalExecuteTaskResponse>>}
* The cancelable promise containing the response.
*/
public executeAsync(request: PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>):
Promise<ClientEntities.ICancelableDataResult<PaymentTerminalExecuteTaskResponse>> {
let cart: ProxyEntities.Cart = null;
let cartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest();
// Get cart first and then build PaymentTerminalExecuteTaskRequest base on request task and cart info.
return this.context.runtime.executeAsync(cartRequest)
.then((result: ClientEntities.ICancelableDataResult<GetCurrentCartClientResponse>): void => {
if (!(result.canceled || ObjectExtensions.isNullOrUndefined(result.data))) {
cart = result.data.result;
}
}).then((): Promise<ClientEntities.ICancelableDataResult<PaymentTerminalExecuteTaskResponse>> => {
let newRequest: PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse> =
PaymentTerminalExecuteTaskRequestFactory.createPaymentTerminalExecuteTaskRequest(request.task, cart);
return this.defaultExecuteAsync(newRequest);
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetShippingDateClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetShippingDateClientRequestHandler } from "PosApi/Extend/RequestHandlers/CartRequestHandlers";
import { GetShippingDateClientRequest, GetShippingDateClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for getting shipping date.
*/
export default class GetShippingDateClientRequestHandlerExt extends GetShippingDateClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetShippingDateClientRequest<GetShippingDateClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<GetShippingDateClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetShippingDateClientRequest<GetShippingDateClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetShippingDateClientResponse>> {
// User could implement new business logic here to override the dialog.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetSerialNumberClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetSerialNumberClientRequestHandler } from "PosApi/Extend/RequestHandlers/ProductsRequestHandlers";
import { GetSerialNumberClientRequest, GetSerialNumberClientResponse } from "PosApi/Consume/Products";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for getting serial number request.
*/
export default class GetSerialNumberClientRequestHandlerExt extends GetSerialNumberClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetSerialNumberClientRequest<GetSerialNumberClientResponse>} request The request containing the response.
* @return {Promise<ICancelableDataResult<GetSerialNumberClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetSerialNumberClientRequest<GetSerialNumberClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetSerialNumberClientResponse>> {
// User could implement new business logic here to process the serial number.
// Following example sets serial number "112233" for product 82001.
if (request.product.ItemId === "82001") {
let response: GetSerialNumberClientResponse = new GetSerialNumberClientResponse("112233");
return Promise.resolve(<ClientEntities.ICancelableDataResult<GetSerialNumberClientResponse>>{
canceled: false,
data: response
});
}
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetPickupDateClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetPickupDateClientRequestHandler } from "PosApi/Extend/RequestHandlers/CartRequestHandlers";
import { GetPickupDateClientRequest, GetPickupDateClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for getting serial number request.
*/
export default class GetPickupDateClientRequestHandlerExt extends GetPickupDateClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetPickupDateClientRequest<GetPickupDateClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<GetPickupDateClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetPickupDateClientRequest<GetPickupDateClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetPickupDateClientResponse>> {
let response: Promise<ClientEntities.ICancelableDataResult<GetPickupDateClientResponse>> =
new Promise<ClientEntities.ICancelableDataResult<GetPickupDateClientResponse>>(
(resolve: (date: ClientEntities.ICancelableDataResult<GetPickupDateClientResponse>) => void, reject: (reason?: any) => void) => {
this.defaultExecuteAsync(request).then((value: ClientEntities.ICancelableDataResult<GetPickupDateClientResponse>) => {
if (value.canceled) {
resolve({ canceled: true, data: null });
/* Example of extra validation for delivery date
} else if (!DateExtensions.isTodayOrFutureDate(value.data.result)) {
let error: ClientEntities.ExtensionError = new ClientEntities.ExtensionError("The delivery date is not valid.");
reject(error); */
} else {
resolve({ canceled: false, data: new GetPickupDateClientResponse(value.data.result) });
}
}).catch((reason: any) => {
reject(reason);
});
});
return response;
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetCountedTenderDetailAmountClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as TenderCountingRequestHandlers from "PosApi/Extend/RequestHandlers/TenderCountingRequestHandlers";
import { GetCountedTenderDetailAmountClientRequest, GetCountedTenderDetailAmountClientResponse } from "PosApi/Consume/StoreOperations";
import { AbstractRequestType } from "PosApi/Create/RequestHandlers";
import { ClientEntities } from "PosApi/Entities";
import { StringExtensions } from "PosApi/TypeExtensions";
import MessageDialog from "../../Create/Dialogs/DialogSample/MessageDialog";
/**
* Example implementation of an GetCountedTenderDetailAmountClientRequestHandler request handler that shown a message on the screen
* and returns a fixed value of counted tender (without showing a dialog).
*/
export default class GetCountedTenderDetailAmountClientRequestHandlerExt extends TenderCountingRequestHandlers.GetCountedTenderDetailAmountClientRequestHandler {
/**
* Gets the supported request type.
* @return {AbstractRequestType<GetCountedTenderDetailAmountClientResponse>} The supported abstract or concrete request type.
*/
public supportedRequestType(): AbstractRequestType<GetCountedTenderDetailAmountClientResponse> {
return GetCountedTenderDetailAmountClientRequest;
}
/**
* Executes the request handler asynchronously.
* @param {GetCountedTenderDetailAmountClientRequest<GetCountedTenderDetailAmountClientResponse>} request The GetCountedTenderDetailAmountClientRequest request.
* @return {Promise<ClientEntities.ICancelableDataResult<GetCountedTenderDetailAmountClientResponse>>} The promise with a cancelable result containing the response.
*/
public executeAsync(request: GetCountedTenderDetailAmountClientRequest<GetCountedTenderDetailAmountClientResponse>)
: Promise<ClientEntities.ICancelableDataResult<GetCountedTenderDetailAmountClientResponse>> {
const value: number = 20;
let message: string = StringExtensions.format("Using GetCountedTenderDetailAmountClientRequestHandler extension. Response value: {0}.", value);
return MessageDialog.show(this.context, message).then((): Promise<ClientEntities.ICancelableDataResult<GetCountedTenderDetailAmountClientResponse>> => {
let response: GetCountedTenderDetailAmountClientResponse = new GetCountedTenderDetailAmountClientResponse(value);
return Promise.resolve(<ClientEntities.ICancelableDataResult<GetCountedTenderDetailAmountClientResponse>>{ canceled: false, data: response });
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetScanResultClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetScanResultClientRequestHandler } from "PosApi/Extend/RequestHandlers/ScanResultsRequestHandlers";
import { ClientEntities } from "PosApi/Entities";
import { GetScanResultClientRequest, GetScanResultClientResponse } from "PosApi/Consume/ScanResults";
/**
* Override request handler class for getting scan result request.
*/
export default class GetScanResultClientRequestHandlerExt extends GetScanResultClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetScanResultClientRequest<GetScanResultClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<GetScanResultClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetScanResultClientRequest<GetScanResultClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetScanResultClientResponse>> {
let newBarCode: string = request.scanText;
// User could implement new business logic here to process the bar code.
// Following example take the first 13 characters as the new bar code.
// newBarCode = newBarCode.substr(0, 13);
let newRequest: GetScanResultClientRequest<GetScanResultClientResponse> =
new GetScanResultClientRequest<GetScanResultClientResponse>(newBarCode);
return this.defaultExecuteAsync(newRequest);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/PrintPackingSlipClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { PrintPackingSlipClientRequestHandler } from "PosApi/Extend/RequestHandlers/StoreFulfillmentRequestHandlers";
import { PrintPackingSlipClientRequest, PrintPackingSlipClientResponse } from "PosApi/Consume/SalesOrders";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for printing packing slip request.
*/
export default class PrintPackingSlipClientRequestHandlerExt extends PrintPackingSlipClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {PrintPackingSlipClientRequest<PrintPackingSlipClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<PrintPackingSlipClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: PrintPackingSlipClientRequest<PrintPackingSlipClientResponse>):
Promise<ClientEntities.ICancelableDataResult<PrintPackingSlipClientResponse>> {
// Do the extension logic here before calling the default handler.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetCancellationChargeClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetCancellationChargeClientRequestHandler } from "PosApi/Extend/RequestHandlers/SalesOrdersRequestHandlers";
import { ClientEntities } from "PosApi/Entities";
import { GetCancellationChargeClientRequest, GetCancellationChargeClientResponse } from "PosApi/Consume/SalesOrders";
/**
* Override request handler class for get cancellation charge client request.
*/
export default class GetCancellationChargeClientRequestHandlerExt extends GetCancellationChargeClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetCancellationChargeClientRequest<GetCancellationChargeClientResponse>} request The request containing the response.
* @return {Promise<ICancelableDataResult<GetCancellationChargeClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetCancellationChargeClientRequest<GetCancellationChargeClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetCancellationChargeClientResponse>> {
// May skip a dialog directly and set here the amount for cancellation charge
let cancelationChargeAmount: number = request.cart.CancellationChargeAmount > 5 ? 5 : request.cart.CancellationChargeAmount;
let response: GetCancellationChargeClientResponse = new GetCancellationChargeClientResponse(cancelationChargeAmount);
return Promise.resolve(<ClientEntities.ICancelableDataResult<GetCancellationChargeClientResponse>>{ canceled: false, data: response });
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/DepositOverrideOperationRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { DepositOverrideOperationRequestHandler } from "PosApi/Extend/RequestHandlers/CartRequestHandlers";
import { DepositOverrideOperationRequest, DepositOverrideOperationResponse } from "PosApi/Consume/Cart";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for creating of deposit override operation.
*/
export default class DepositOverrideOperationRequestHandlerExt extends DepositOverrideOperationRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {DepositOverrideOperationRequest<DepositOverrideOperationResponse>} request The request containing the response.
* @return {Promise<ICancelableDataResult<DepositOverrideOperationResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: DepositOverrideOperationRequest<DepositOverrideOperationResponse>):
Promise<ClientEntities.ICancelableDataResult<DepositOverrideOperationResponse>> {
// User could implement new business logic here to override deposit override flow.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetTenderDetailsClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetTenderDetailsClientRequestHandler } from "PosApi/Extend/RequestHandlers/TenderCountingRequestHandlers";
import { GetTenderDetailsClientRequest, GetTenderDetailsClientResponse } from "PosApi/Consume/StoreOperations";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for getting the tender details request.
*/
export default class GetTenderDetailsClientRequestHandlerExt extends GetTenderDetailsClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetTenderDetailsClientRequest<GetTenderDetailsClientResponse>} The request containing the response.
* @return {Promise<ICancelableDataResult<GetTenderDetailsClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetTenderDetailsClientRequest<GetTenderDetailsClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetTenderDetailsClientResponse>> {
this.context.logger.logInformational("Executing GetTenderDetailsClientRequestHandlerExt for request: " + JSON.stringify(request) + ".");
// Do the extension logic here in place of default handler.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Extend/RequestHandlers/GetKeyedInPriceClientRequestHandlerExt.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { GetKeyedInPriceClientRequestHandler } from "PosApi/Extend/RequestHandlers/CartRequestHandlers";
import { GetKeyedInPriceClientRequest, GetKeyedInPriceClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities } from "PosApi/Entities";
/**
* Override request handler class for getting price request.
*/
export default class GetKeyedInPriceClientRequestHandlerExt extends GetKeyedInPriceClientRequestHandler {
/**
* Executes the request handler asynchronously.
* @param {GetKeyedInPriceClientRequest<GetKeyedInPriceClientResponse>} The request containing the response.
* @return {Promise<GetKeyedInPriceClientRequest<GetKeyedInPriceClientResponse>>} The cancelable promise containing the response.
*/
public executeAsync(request: GetKeyedInPriceClientRequest<GetKeyedInPriceClientResponse>):
Promise<ClientEntities.ICancelableDataResult<GetKeyedInPriceClientResponse>> {
// User could implement new business logic here to override the dialog.
return this.defaultExecuteAsync(request);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/readme.md | # Custom View Controller Samples
The samples in this directory show how to create custom views for Store Commerce. Each sample in this folder shows how to achieve different scenarios with the CustomViewControllers including how to use the DataList, NumPad and other controls from the PosApi.
The sample views listed below show how to implement some of the most common custom view requirements, and each code sample contains comments detailing how it works.
- Barcode Scanner Support:
- [TransactionNumPadView](./Samples/TransactionNumPadView.ts)
- Magnetic Stripe Reader Support:
- [TransactionNumPadView](./Samples/TransactionNumPadView.ts)
- App Bar Command Support:
- [AppBarView](./Samples/AppBarView.ts)
- Loader Support:
- [LoaderView](./Samples/LoaderView.ts)
- NumberPad Support:
- [AlphanumericNumPadView](./Samples/AlphanumericNumPadView.ts), [CurrencyNumPadView](./Samples/CurrencyNumPadView.ts), [NumericNumPadView](./Samples/NumericNumPadView.ts), [TransactionNumPadView](./Samples/TransactionNumPadView.ts)
- Pivot Sample:
- [SimpleNextView](./SimpleNextView.ts)
- DataList Sample:
- [DataListView](./Samples/DataListView.ts)
- [Menu Sample]:
- [AppBarView](./Samples/AppBarView.ts)
- Knockout.js Usage
- [SimpleNextView](./SimpleNextView.ts)
## Additional Resources
- [Debugging POS Extensions in Store Commerce](https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/sc-debug)
- [Debugging POS Extensions in Cloud POS](https://docs.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/debug-pos-extension#run-and-debug-cloud-pos)
- [POS APIs](https://docs.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-apis)
- [Create a custom view in POS](https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/custom-pos-view)
- [Knockout.js in POS Extensions](https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/knockout-pos-extension) | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/NavigationContracts.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
"use strict";
/**
* Type interface for simple next view model constructor options.
*/
export interface ISimpleNextViewModelOptions {
message: string;
}
/**
* Type interface for simple extension view model constructor options.
*/
export interface ISimpleExtensionViewModelOptions {
displayMessage: string;
}
/**
* Type interface for post logon view constructor options.
*/
export interface IPostLogOnViewOptions {
resolveCallback: (value?: any | PromiseLike<any>) => void;
rejectCallback: (reason?: any) => void;
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleExtension.css | .simpleExtensionView {
color: red;
background-color: beige;
align-self: center;
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleExtensionView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple view test</title>
<link href="SimpleExtension.css" rel="stylesheet" />
</head>
<body>
<div class="simpleExtensionView">
<div class="h6" id="simpleStrTest" data-bind="text: viewModel.simpleMessage"></div>
<br />
<button aria-label="Update message" id="btSimpleClick" data-bind="click: viewModel.updateMessage.bind(viewModel)">Update message</button>
<button aria-label="Next" id="btnNext" data-bind="click: viewModel.navigateNext.bind(viewModel)">Next</button>
<button id="btnOpenTemplatedDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: viewModel.openTemplatedDialog.bind(viewModel)">open templated dialog</button>
<button id="btnOpenMessageDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: viewModel.openMessageDialog.bind(viewModel)">open message dialog</button>
<button id="btnOpenBarcodeMSRDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: viewModel.openBarcodeMsrDialog.bind(viewModel)">open barcode msr dialog</button>
<div class="h4">Dialog result</div>
<div class="h4" data-bind="text: viewModel.dialogResult"></div>
<div class="h4">Sample control</div>
<div style="border: solid green 1px" data-bind="microsoftSampleExtensionsCustomControl: { msg: 'hello' }"></div>
<br />
<div id="SimpleViewToggleSwitch">
</div>
<br /><br />
<div class="h4">Example Date Picker (input)</div>
<div id="datePicker"></div>
<div class="h4" data-bind="text: 'Date Picker Value: ' + viewModel.date().toString()"></div>
<div class="h4">Example Time Picker (input)</div>
<div id="timePicker"></div>
<div class="h4" data-bind="text: 'Time Picker Value: ' + viewModel.time().toString()"></div>
<br /><br />
<div class="h4">Sample Menu control</div>
<button id="SimpleExtensionView_ShowStaticMenu" data-bind="click: showMenuStatic" style="float: left">Show static menu</button>
<div id="menuStatic"></div>
<button id="SimpleExtensionView_ShowStaticToggleMenu" data-bind="click: showToggleMenuStatic">Show static toggle menu</button>
<div id="toggleMenu"></div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleNextView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple view test</title>
</head>
<body>
<div class="simpleNextView">
<div id="SimpleViewPivot"></div>
</div>
<script id="PivotItem1" type="text/html">
<div class="padLeft20">
<button aria-label="Update message" id="btnClick" data-bind="click: viewModel.updateMessage.bind(viewModel)">Update message</button>
<button aria-label="Simple page" id="btnSimple" data-bind="click: viewModel.navigateToSimplePage.bind(viewModel)">Simple page</button>
<div class="simpleView">
<div class="h6" id="simpleStrTest" data-bind="text: viewModel.simpleMessage"></div>
</div>
</div>
</script>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleNextView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { IEventRequest, SimpleNextViewModel } from "./SimpleNextViewModel";
import { ISimpleNextViewModelOptions } from "./NavigationContracts";
import { ClientEntities } from "PosApi/Entities";
import { DateFormatter } from "PosApi/Consume/Formatters";
import { IDataList, IDataListOptions, DataListInteractionMode, IPivot } from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for SimpleNextView.
*/
export default class SimpleNextView extends Views.CustomViewControllerBase implements Views.IBarcodeScannerEndpoint, Views.IMagneticStripeReaderEndpoint {
public readonly viewModel: SimpleNextViewModel;
public dataList: IDataList<IEventRequest>;
public pivot: IPivot;
public readonly implementsIBarcodeScannerEndpoint: true;
public readonly implementsIMagneticStripeReaderEndpoint: true;
constructor(context: Views.ICustomViewControllerContext, state: Views.ICustomViewControllerBaseState,
options: ISimpleNextViewModelOptions) {
let config: Views.ICustomViewControllerConfiguration = {
title: "",
commandBar: {
commands: [
{
name: "updateMessageCommand",
label: context.resources.getString("string_11"),
icon: Views.Icons.LightningBolt,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
this.viewModel.updateMessage();
}
}
]
}
};
super(context, config);
this.context.logger.logInformational("SimpleNextView loaded");
// Initialize the view model.
this.viewModel = new SimpleNextViewModel(context, this.state, options);
this.state.title = this.context.resources.getString("string_10");
}
/**
* Initializes the page state when the page is created.
* @param {HTMLElement} element The view's DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
this.pivot = this.context.controlFactory.create(
this.context.logger.getNewCorrelationId(),
"Pivot",
{
items: [
{
id: "tab1",
header: this.context.resources.getString("string_8"),
onReady: (element: HTMLElement) => {
ko.applyBindingsToNode(element, {
template: {
name: "PivotItem1",
data: this
}
});
},
onShown: () => {
return;
}
},
{
id: "tab2",
header: this.context.resources.getString("string_9"),
onReady: (element: HTMLElement) => {
this._initDataList(element);
},
onShown: () => {
return;
}
}
]
},
element.querySelector("#SimpleViewPivot") as HTMLDivElement);
this.pivot.addEventListener("SelectionChanged", (): void => {
this.viewModel.tabChanged("SelectionChanged");
});
}
private _initDataList(element: HTMLElement): void {
// Initialize the POS SDK Controls.
let dataListOptions: Readonly<IDataListOptions<IEventRequest>> = {
interactionMode: DataListInteractionMode.MultiSelect,
data: [],
columns: [
{
title: this.context.resources.getString("string_12"),
ratio: 20,
collapseOrder: 2,
minWidth: 100,
computeValue: (rowData: IEventRequest): string => { return DateFormatter.toShortDateAndTime(rowData.requestDateTime); }
},
{
title: this.context.resources.getString("string_13"),
ratio: 30,
collapseOrder: 4,
minWidth: 100,
computeValue: (rowData: IEventRequest): string => { return rowData.requestedWorkerName; }
},
{
title: this.context.resources.getString("string_14"),
ratio: 30,
collapseOrder: 1,
minWidth: 100,
computeValue: (rowData: IEventRequest): string => { return rowData.requestType; }
},
{
title: this.context.resources.getString("string_15"),
ratio: 20,
collapseOrder: 3,
minWidth: 100,
computeValue: (rowData: IEventRequest): string => { return rowData.requestStatus; }
}
]
};
this.dataList = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "DataList", dataListOptions, element as HTMLDivElement);
this.dataList.addEventListener("SelectionChanged", (eventData: { items: IEventRequest[] }): any => {
this.viewModel.selectionChanged(eventData.items);
});
this.dataList.addEventListener("ItemInvoked", (eventData: { item: IEventRequest }): any => {
this.viewModel.listItemInvoked(eventData.item);
});
this.dataList.data = this.viewModel.load();
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Handler for barcode scanned.
* @param {string} barcode The barcode that was scanned.
*/
public onBarcodeScanned(barcode: string): void {
this.context.logger.logInformational(barcode);
}
/**
* Handler for card swiped on msr.
* @param {ClientEntities.ICardInfo} card The card information.
*/
public onMagneticStripeRead(card: ClientEntities.ICardInfo): void {
this.context.logger.logInformational(card.CardNumber);
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleExtensionView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ClientEntities } from "PosApi/Entities";
import { ISimpleExtensionViewModelOptions } from "./NavigationContracts";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import SimpleExtensionViewModel from "./SimpleExtensionViewModel";
import ko from "knockout";
/**
* The controller for SimpleExtensionView.
*/
export default class SimpleExtensionView extends Views.CustomViewControllerBase implements Views.IBarcodeScannerEndpoint, Views.IMagneticStripeReaderEndpoint {
public readonly viewModel: SimpleExtensionViewModel;
public datePicker: Controls.IDatePicker;
public timePicker: Controls.ITimePicker;
public toggleSwitch: Controls.IToggle;
public menuStatic: Controls.IMenu;
public toggleMenuStatic: Controls.IMenu;
public readonly implementsIBarcodeScannerEndpoint: true;
public readonly implementsIMagneticStripeReaderEndpoint: true;
constructor(context: Views.ICustomViewControllerContext, options?: ISimpleExtensionViewModelOptions) {
let config: Views.ICustomViewControllerConfiguration = {
title: "",
commandBar: {
commands: [
{
name: "navigateToNextPageCommand",
label: context.resources.getString("string_58"),
icon: Views.Icons.Add,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
this.viewModel.navigateNext();
}
}
]
}
};
super(context, config);
// Initialize the view model.
this.viewModel = new SimpleExtensionViewModel(context, options);
this.state.title = this.viewModel.title();
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
const correlationId: string = this.context.logger.getNewCorrelationId();
let datePickerOptions: Controls.IDatePickerOptions = {
date: this.viewModel.date(),
enabled: this.viewModel.permitDateAndTimeChanges()
};
let datePickerRootElem: HTMLDivElement = element.querySelector("#datePicker") as HTMLDivElement;
this.datePicker = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "DatePicker", datePickerOptions, datePickerRootElem);
this.datePicker.addEventListener("DateChanged", (eventData: { date: Date }) => {
this.viewModel.date(eventData.date);
});
let timePickerOptions: Controls.ITimePickerOptions = {
enabled: this.viewModel.permitDateAndTimeChanges(),
minuteIncrement: 15,
time: this.viewModel.time()
};
let timePickerRootElem: HTMLDivElement = element.querySelector("#timePicker") as HTMLDivElement;
this.timePicker = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "TimePicker", timePickerOptions, timePickerRootElem);
this.timePicker.addEventListener("TimeChanged", (eventData: { time: Date }) => {
this.viewModel.time(eventData.time);
});
// Enable/disable based on toggle switch value.
this.viewModel.permitDateAndTimeChanges.subscribe((toggleValue: boolean): void => {
this.timePicker.enabled = toggleValue;
this.datePicker.enabled = toggleValue;
});
// Initialize Toggle switch.
let toggleOptions: Controls.IToggleOptions = {
labelOn: this.context.resources.getString("string_59"),
labelOff: this.context.resources.getString("string_60"),
tabIndex: 0,
checked: this.viewModel.permitDateAndTimeChanges(),
enabled: true
};
let toggleRootElem: HTMLDivElement = element.querySelector("#SimpleViewToggleSwitch") as HTMLDivElement;
this.toggleSwitch = this.context.controlFactory.create(correlationId, "Toggle", toggleOptions, toggleRootElem);
this.toggleSwitch.addEventListener("CheckedChanged", (eventData: { checked: boolean }) => {
this.viewModel.toggleChanged(eventData.checked);
});
// Initialize static Menu.
let menuOptions: Controls.IMenuOptions = {
commands: [{
id: "MenuCommand1",
label: this.context.resources.getString("string_61"),
}, {
id: "MenuCommand2",
label: this.context.resources.getString("string_62"),
selected: true,
}],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "button"
};
let menuRootElem: HTMLDivElement = element.querySelector("#menuStatic") as HTMLDivElement;
this.menuStatic = this.context.controlFactory.create(correlationId, "Menu", menuOptions, menuRootElem);
this.menuStatic.addEventListener("CommandInvoked", (eventData: { id: string }) => {
if (eventData.id == "MenuCommand1") {
this._menuCommandClick(eventData.id);
}
else {
this._menuCommandClick2(eventData.id);
}
});
// Initialize Toggle Menu.
let toggleMenuOptions: Controls.IMenuOptions = {
commands: [{
id: "MenuCommand1",
label: this.context.resources.getString("string_61"),
}, {
id: "MenuCommand2",
label: this.context.resources.getString("string_62"),
selected: true,
}],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "toggle"
};
let toggleMenuRootElem: HTMLDivElement = element.querySelector("#toggleMenu") as HTMLDivElement;
this.toggleMenuStatic = this.context.controlFactory.create(correlationId, "Menu", toggleMenuOptions, toggleMenuRootElem);
this.toggleMenuStatic.addEventListener("CommandInvoked", (eventData: { id: string }) => {
if (eventData.id == "MenuCommand1") {
this._menuCommandClick(eventData.id);
}
else {
this._menuCommandClick2(eventData.id);
}
});
}
/**
* Shows the toggle menu.
* @param {any} data The data.
* @param {Event} event The event.
*/
public showToggleMenuStatic(data: any, event: Event): void {
this.toggleMenuStatic.show(<HTMLElement>event.currentTarget);
}
/**
* Shows the static menu.
* @param {any} data The data.
* @param {Event} event The event.
*/
public showMenuStatic(data: any, event: Event): void {
this.menuStatic.show(<HTMLElement>event.currentTarget);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Handler for barcode scanned.
* @param {string} barcode The barcode that was scanned.
*/
public onBarcodeScanned(barcode: string): void {
this.context.logger.logVerbose(barcode);
}
/**
* Handler for card swiped on msr.
* @param {ClientEntities.ICardInfo} card The card information.
*/
public onMagneticStripeRead(card: ClientEntities.ICardInfo): void {
this.context.logger.logVerbose(JSON.stringify(card));
}
/**
* The click handler for the first menu command.
* @param {string} id The id clicked.
*/
private _menuCommandClick(id: string): void {
this.context.logger.logVerbose("menuCommandClick clicked. Id : " + id);
}
/**
* The click handler for the second menu command.
* @param {string} id The id clicked.
*/
private _menuCommandClick2(id: string): void {
this.context.logger.logVerbose("menuCommandClick2 clicked. Id : " + id);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleExtensionViewModel.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ICustomViewControllerContext } from "PosApi/Create/Views";
import { ObjectExtensions, StringExtensions } from "PosApi/TypeExtensions";
import { ISimpleExtensionViewModelOptions, ISimpleNextViewModelOptions } from "./NavigationContracts";
import { ISampleDialogResult } from "../Dialogs/DialogSample/IDialogSampleResult";
import { IBarcodeMsrDialogResult } from "../Dialogs/BarcodeMsrDialog/BarcodeMsrDialogTypes";
import DialogSampleModule from "../Dialogs/DialogSample/DialogSampleModule";
import BarcodeMsrDialog from "../Dialogs/BarcodeMsrDialog/BarcodeMsrDialog";
import MessageDialog from "../Dialogs/DialogSample/MessageDialog";
import ko from "knockout";
import KnockoutExtensionViewModelBase from "./BaseClasses/KnockoutExtensionViewModelBase";
/**
* The ViewModel for SimpleExtensionView.
*/
export default class SimpleExtensionViewModel extends KnockoutExtensionViewModelBase {
public simpleMessage: ko.Observable<string>;
public allowNavigateNext: ko.Observable<boolean>;
public title: ko.Observable<string>;
public dialogResult: ko.Observable<string>;
public date: ko.Observable<Date>;
public time: ko.Observable<Date>;
public permitDateAndTimeChanges: ko.Observable<boolean>;
public preventDateAndTimeChanges: ko.Computed<boolean>;
private _context: ICustomViewControllerContext;
constructor(context: ICustomViewControllerContext, options?: ISimpleExtensionViewModelOptions) {
super();
this._context = context;
this.allowNavigateNext = ko.observable(false);
this.title = ko.observable(this._context.resources.getString("string_50"));
this.dialogResult = ko.observable("");
this.date = ko.observable(new Date());
this.time = ko.observable(new Date());
this.permitDateAndTimeChanges = ko.observable(true);
this.preventDateAndTimeChanges = ko.computed((): boolean => { return !this.permitDateAndTimeChanges(); }, this);
if (ObjectExtensions.isNullOrUndefined(options) || StringExtensions.isNullOrWhitespace(options.displayMessage)) {
this.simpleMessage = ko.observable(this._context.resources.getString("string_51"));
} else {
this.simpleMessage = ko.observable(options.displayMessage);
}
}
/**
* Update on screen display message when button is clicked.
*/
public updateMessage(): void {
this._context.logger.logInformational("SimpleExtensionViewModel: Updating message...");
this.simpleMessage(this._context.resources.getString("string_52"));
this.allowNavigateNext(true);
}
/**
* Opens the templated dialog sample.
*/
public openTemplatedDialog(): void {
let dialog: DialogSampleModule = new DialogSampleModule();
dialog.open(this._context.resources.getString("string_53")).then((result: ISampleDialogResult) => {
this.dialogResult(StringExtensions.format(this._context.resources.getString("string_54"), result.selectedValue));
}).catch((reason: any) => {
this._context.logger.logError("SimpleExtensionViewModel.openTemplatedDialog: " + JSON.stringify(reason));
});
}
/**
* Opens the barcode msr dialog sample.
*/
public openBarcodeMsrDialog(): void {
let dialog: BarcodeMsrDialog = new BarcodeMsrDialog();
dialog.open().then((result: IBarcodeMsrDialogResult): void => {
if (!result.canceled) {
this.dialogResult("InputType: " + result.inputType + " -- Input Value: " + result.value);
}
}).catch((reason: any): void => {
this._context.logger.logError("SimpleExtensionViewModel.openBarcodeMsrDialog: " + JSON.stringify(reason));
});
}
/**
* Opens the message dialog sample.
*/
public openMessageDialog(): void {
MessageDialog.show(this._context, this._context.resources.getString("string_55")).then(() => {
this._context.logger.logInformational("MessageDialog closed");
});
}
/**
* Navigate to SimpleNextView.
*/
public navigateNext(): void {
// Navigator to SimpleNext page.
this._context.logger.logInformational("SimpleExtensionViewModel: Navigating to SimpleNextView...");
let options: ISimpleNextViewModelOptions = { message: this._context.resources.getString("string_56") };
this._context.navigator.navigate("SimpleNextView", options);
}
/**
* Update on screen display message when toggle is changed.
* @param {boolean} toggleValue The value of the toggle.
*/
public toggleChanged(toggleValue: boolean): void {
this.simpleMessage(StringExtensions.format(this._context.resources.getString("string_57"), toggleValue));
this.permitDateAndTimeChanges(toggleValue);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SamplesView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
export interface ISampleItem {
label: string;
viewName?: string;
items?: ISampleItem[];
}
/**
* The controller for SamplesView.
*/
export default class SamplesView extends Views.CustomViewControllerBase {
public readonly samplesList: ISampleItem[];
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Samples";
this.samplesList = [
{
label: "Pos Controls",
items: [
{ label: "AlphanumericNumPad", viewName: "AlphanumericNumPadView" },
{ label: "AppBar", viewName: "AppBarView" },
{ label: "CurrencyNumPad", viewName: "CurrencyNumPadView" },
{ label: "DataList", viewName: "DataListView" },
{ label: "DataList (dynamic)", viewName: "DynamicDataListView" },
{ label: "DatePicker", viewName: "DatePickerView" },
{ label: "Loader", viewName: "LoaderView" },
{ label: "Menu", viewName: "MenuView" },
{ label: "NumericNumPad", viewName: "NumericNumPadView" },
{ label: "TimePicker", viewName: "TimePickerView" },
{ label: "ToggleMenu", viewName: "ToggleMenuView" },
{ label: "ToggleSwitch", viewName: "ToggleSwitchView" },
{ label: "TransactionNumPad", viewName: "TransactionNumPadView" },
]
},
{
label: "Api",
items: [
{ label: "ApiView", viewName: "ApiView" },
{ label: "AddTenderLineToCart", viewName: "AddTenderLineToCartView" },
{ label: "CloseShift", viewName: "CloseShiftView" },
{ label: "ForceVoidTransactionView", viewName: "ForceVoidTransactionView" },
{ label: "SyncStockCountJournalsView", viewName: "SyncStockCountJournalsView" },
{ label: "VoidTenderLineView", viewName: "VoidTenderLineView" },
{ label: "VoidCartLineView", viewName: "VoidCartLineView" }
]
},
{
label: "Other",
items: [
{ label: "SimpleExtensionView", viewName: "SimpleExtensionView" }
]
},
{
label: "Dialogs",
items: [
{ label: "ListInputDialogView", viewName: "ListInputDialogView" },
{ label: "AlphanumericInputDialogView", viewName: "AlphanumericInputDialogView" },
{ label: "NumericInputDialogView", viewName: "NumericInputDialogView" },
{ label: "TextInputDialogView", viewName: "TextInputDialogView" }
]
}
];
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Click handler for sample link.
* @param sampleItem Sample item that was clicked.
*/
public sampleClick(sampleItem: ISampleItem): void {
this.context.navigator.navigate(sampleItem.viewName);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SamplesView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Samples view</title>
</head>
<body>
<div class="SamplesView">
<script id="SamplesView_SamplesSection" type="text/html">
<div class="width300 col">
<div class="h4 pad8" data-bind="text: label"></div>
<div class="grow scrollY col" data-bind="template: { name: 'SamplesView_SampleButtonTemplate', foreach: items }"></div>
</div>
</script>
<script id="SamplesView_SampleButtonTemplate" type="text/html">
<div>
<a href="#" class="accentColor" data-bind="click: $root.sampleClick.bind($root)">
<div class="h4 pad8" data-bind="text: label"></div>
</a>
</div>
</script>
<div class="grow pad20 scrollX col">
<div class="grow row" data-bind="template: { name: 'SamplesView_SamplesSection', foreach: samplesList }">
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/SimpleNextViewModel.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ObjectExtensions, StringExtensions } from "PosApi/TypeExtensions";
import { ISimpleExtensionViewModelOptions, ISimpleNextViewModelOptions } from "./NavigationContracts";
import KnockoutExtensionViewModelBase from "./BaseClasses/KnockoutExtensionViewModelBase";
import { ICustomViewControllerContext, ICustomViewControllerBaseState } from "PosApi/Create/Views";
import ko from "knockout";
/**
* Type interface for an event request.
*/
export interface IEventRequest {
requestDateTime: Date;
requestedWorkerName: string;
requestType: string;
requestStatus: string;
}
/**
* The ViewModel for SimpleNextViewModel.
*/
export class SimpleNextViewModel extends KnockoutExtensionViewModelBase {
public simpleMessage: ko.Observable<string>;
private _context: ICustomViewControllerContext;
private _customViewControllerBaseState: ICustomViewControllerBaseState;
/**
* Creates a new instance of the SimpleNextViewModel class.
* @param {ICustomViewControllerContext} context The custom view controller context.
* @param {ICustomViewControllerBaseState} state Tbe custom view controller base state.
* @param {ISimpleNextViewModelOptions} [options] The view model options, if any.
*/
constructor(context: ICustomViewControllerContext, state: ICustomViewControllerBaseState,
options?: ISimpleNextViewModelOptions) {
super();
this._context = context;
let messageToDisplay: string = this._context.resources.getString("string_10");
if (!ObjectExtensions.isNullOrUndefined(options) && !StringExtensions.isNullOrWhitespace(options.message)) {
messageToDisplay = options.message;
}
this.simpleMessage = ko.observable(messageToDisplay);
this._customViewControllerBaseState = state;
this._customViewControllerBaseState.isProcessing = false;
}
/**
* Loads the view model state and returns list of event requests.
* @returns {IEventRequest[]} The list of event requests.
*/
public load(): IEventRequest[] {
// Enable the busy indicator while the page is loading.
this._customViewControllerBaseState.isProcessing = true;
let eventRequests: IEventRequest[] = [
{
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: this._context.resources.getString("string_16"),
requestStatus: this._context.resources.getString("string_19")
},
{
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: this._context.resources.getString("string_17"),
requestStatus: this._context.resources.getString("string_20")
},
{
requestDateTime: new Date(),
requestedWorkerName: "Greg Marchievsky",
requestType: this._context.resources.getString("string_18"),
requestStatus: this._context.resources.getString("string_21")
}
];
this._customViewControllerBaseState.isProcessing = false;
return eventRequests;
}
/**
* Update on screen display message when button is clicked.
*/
public updateMessage(): void {
this._customViewControllerBaseState.isProcessing = true;
this.simpleMessage(this._context.resources.getString("string_22"));
setTimeout(() => {
this._customViewControllerBaseState.isProcessing = false;
}, 2000);
}
/**
* Update on screen display message when tab is changed.
* @param {string} message The tab changed message.
*/
public tabChanged(message: string): void {
this._context.logger.logInformational("Tab operation: " + message);
this.simpleMessage(message);
}
/**
* Handler for list item selection.
* @param {IEventRequest} item The data corresponding to the invoked row.
*/
public listItemInvoked(item: IEventRequest): void {
this._context.logger.logInformational("Item selected:" + item.requestedWorkerName, item.requestStatus);
}
/**
* Handler for list item selection.
* @param {IEventRequest[]} items The data corresponding to the selected rows.
*/
public selectionChanged(items: IEventRequest[]): void {
this._context.logger.logVerbose("Items selected:");
items.forEach((item: IEventRequest) => {
this._context.logger.logVerbose("Item:" + item.requestedWorkerName + ", status:" + item.requestStatus);
});
}
/**
* Navigate to SimpleExtensionView.
*/
public navigateToSimplePage(): void {
this._context.logger.logInformational("SimpleNextViewModel: Navigating to SimpleExtensionView...");
let options: ISimpleExtensionViewModelOptions = { displayMessage: this._context.resources.getString("string_23") };
this._context.navigator.navigate("SimpleExtensionView", options);
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DynamicDataListView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The interface for shift data.
*/
export interface IShiftData {
requestId: number;
requestDateTime: Date;
requestedWorkerName: string;
requestType: string;
requestStatus: string;
}
/**
* The controller for DynamicDataListView.
*/
export default class DynamicDataListView extends Views.CustomViewControllerBase {
public paginatedDataList: Controls.IPaginatedDataList<IShiftData>;
private _isUsingAlternativeData: boolean;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Dynamic DataList sample";
this._isUsingAlternativeData = false;
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
document.getElementById("selectByIdMessage").innerHTML = "Try to click the 'Select random item by id' button!";
document.getElementById("selectRandomItemsByIdButton").addEventListener('click', () => {
this.selectRandomItemsById();
});
document.getElementById("selectItemsByNameButton").addEventListener('click', () => {
this.selectItemsByName();
});
// Initialize datalist source
let paginatedDataSource: Controls.IPaginatedDataSource<IShiftData> = {
pageSize: 5,
loadDataPage: this._loadDataPage.bind(this)
};
// Initialize datalist options
let dataListOptions: Readonly<Controls.IPaginatedDataListOptions<IShiftData>> = {
columns: [
{
title: "ID",
ratio: 20,
collapseOrder: 3,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestId.toString();
}
},
{
title: "Name",
ratio: 30,
collapseOrder: 4,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestedWorkerName;
}
},
{
title: "Type",
ratio: 25,
collapseOrder: 1,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestType;
}
},
{
title: "Status",
ratio: 25,
collapseOrder: 2,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestStatus;
}
}
],
data: paginatedDataSource,
interactionMode: Controls.DataListInteractionMode.MultiSelect,
equalityComparer: (left: IShiftData, right: IShiftData): boolean => left.requestId === right.requestId
};
// Initialize datalist
let dataListRootElem: HTMLDivElement = element.querySelector("#dynamicDataListSample") as HTMLDivElement;
this.paginatedDataList = this.context.controlFactory.create("", "PaginatedDataList", dataListOptions, dataListRootElem);
this.paginatedDataList.addEventListener("SelectionChanged", (eventData: { items: IShiftData[] }) => {
this._dataListSelectionChanged();
});
let reloadBtn: HTMLButtonElement = element.querySelector("#reloadDataButton") as HTMLButtonElement;
reloadBtn.addEventListener('click', () => {
this._isUsingAlternativeData = !this._isUsingAlternativeData;
this.paginatedDataList.reloadData();
});
}
/**
* Callback for selecting items by random id button.
* Selecting will be applied only to the items which are already loaded.
* If the item is not yet loaded, nothing will happen to it.
*/
public selectRandomItemsById(): void {
let items = this._getData();
if (items.length == 0) {
return;
}
let index = Math.floor(Math.random() * items.length);
let item = items[index];
document.getElementById("selectByIdMessage").innerHTML =
`Tried to select item with id=${item.requestId}.`;
this.paginatedDataList.selectItems([item]);
}
/**
* Callback for selecting items by name button.
* Selecting will be applied only to the items which are already loaded.
* If the item is not yet loaded, nothing will happen to it.
*/
public selectItemsByName(): void {
let nameFilterValue = (<HTMLInputElement>document.getElementById("nameFilter")).value;
let items = this._getData();
let itemsToSelect = items.filter(
item => item.requestedWorkerName.toLowerCase().indexOf(nameFilterValue.toLowerCase()) != -1);
this.paginatedDataList.selectItems(itemsToSelect);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for data list.
*/
private _dataListSelectionChanged(): void {
this.context.logger.logInformational("_dataListSelectionChanged");
}
/**
* Load data page callback.
* @param {number} size The number of items to load.
* @param {number} skip The number of items that were already loaded.
* @returns {Promise<IShiftData[]>} The loaded items promise.
*/
private _loadDataPage(size: number, skip: number): Promise<IShiftData[]> {
let promise: Promise<any> = new Promise((resolve: (value?: any) => void) => {
// Emulate delay of request to server.
setTimeout(() => {
this.context.logger.logInformational("dataListPageLoaded");
let pageData: IShiftData[] = this._getData(size, skip);
resolve(pageData);
}, 1000);
});
return promise;
}
/**
* Gets items based on the current data source.
* @param {number} size The number of items to return.
* @param {number} skip The number of items to skip.
* @returns {IShiftData[]} The requested items.
*/
private _getData(size?: number, skip?: number): IShiftData[] {
if (ObjectExtensions.isNullOrUndefined(skip)) {
skip = 0;
}
let data: IShiftData[] = [];
if (this._isUsingAlternativeData) {
data = this._getAlternativeData();
} else {
data = this._getAllItems();
}
if (ObjectExtensions.isNullOrUndefined(size)) {
return data.slice(skip);
} else {
return data.slice(skip, skip + size);
}
}
/**
* Gets alternative items.
* @returns {Promise<IShiftData[]>} The requested items.
*/
private _getAlternativeData(): IShiftData[] {
return [{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Alternative Name.",
requestType: "Alternative Type.",
requestStatus: "Approved"
}];
}
/**
* Gets all sample data items.
* @returns {IShiftData[]} The items for the data list.
*/
private _getAllItems(): IShiftData[] {
return [{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 2,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 3,
requestDateTime: new Date(),
requestedWorkerName: "Greg Marchievsky",
requestType: "Shift Offer",
requestStatus: "Rejected"
},
{
requestId: 4,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 5,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 6,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 7,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 8,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 9,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 10,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 11,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 12,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 13,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 14,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 15,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 16,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 17,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 18,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 19,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 20,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 21,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 22,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 23,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 24,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 25,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 26,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 27,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 28,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 29,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 30,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
}];
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ToggleMenuView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
import ko from "knockout";
/**
* The controller for ToggleMenuView.
*/
export default class ToggleMenuView extends Views.CustomViewControllerBase {
public toggleMenu: Controls.IMenu;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ToggleMenuView sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let toggleMenuOptions: Controls.IMenuOptions = {
commands: [
{
id: "MenuCommand1",
label: "Menu command 1",
},
{
id: "MenuCommand2",
label: "Menu command 2",
selected: true,
}
],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "toggle"
};
let toggleMenuRootElem: HTMLDivElement = element.querySelector("#toggleMenu") as HTMLDivElement;
this.toggleMenu = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Menu", toggleMenuOptions, toggleMenuRootElem);
this.toggleMenu.addEventListener("CommandInvoked", (eventData: { id: string }) => {
this.menuCommandClick(eventData.id);
});
}
/**
* Callback for toggle menu.
* @param {ToggleMenuView} controller View controller.
* @param {Event} event Html event object.
*/
public showToggleMenu(controller: ToggleMenuView, event: Event): void {
this.toggleMenu.show(<HTMLElement>event.currentTarget);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for toggle menu command.
* @param {string} args Arguments.
*/
private menuCommandClick(args: string): void {
this.context.logger.logInformational(JSON.stringify(args));
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/VoidTenderLineView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>VoidTenderLineView</title>
</head>
<body>
<div class="VoidTenderLineView height100Percent">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Void payments</div>
<button data-bind="click:getCurrentCart">Refresh Cart</button>
<button data-bind="click:voidTenderLine">Void Tender Line</button>
</div>
<textarea class="height220" data-bind="text: currentCart"></textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AlphanumericInputDialogView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AlphanumericInputDialogView</title>
</head>
<body>
<div class="AlphanumericInputDialogView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>InputAlphanumericDialog</h3>
<div class="pad8">
<button id="btnOpenInputAlphanumericDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: openAlphanumericInputDialog">Open Input Alphanumeric Dialog</button>
</div>
<div class="h4">Dialog result</div>
<div class="h4" data-bind="text: dialogResult"></div>
<div class="h4 padTop40">AlphanumericInputDialog option interface</div>
<textarea class="height220">
export interface IAlphanumericInputDialogOptions extends IInputDialogOptions<IAlphanumericInputDialogResult> {
numPadLabel: string;
defaultValue?: string;
enableMagneticStripReader?: boolean;
enableBarcodeScanner?: boolean;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import AlphanumericInputDialog from "../../Controls/DialogSample/AlphanumericInputDialog";
/**
* The controller for AlphanumericInputDialogView.
*/
export default class AlphanumericInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.dialogResult = ko.observable("");
this.state.title = "Alphanumeric Input Dialog Sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
super.onReady(element);
// Customized binding
ko.applyBindings(this, element);
}
/**
* Opens the Alphanumeric Input dialog sample.
*/
public openAlphanumericInputDialog(): void {
let alphanumericInputDialog: AlphanumericInputDialog = new AlphanumericInputDialog();
alphanumericInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("AlphanumericInputDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/CloseShiftView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { CloseShiftOperationRequest, CloseShiftOperationResponse } from "PosApi/Consume/Shifts";
import { ClientEntities } from "PosApi/Entities";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Views from "PosApi/Create/Views";
import ko from "knockout";
/**
* The controller for CloseShift.
*/
export default class CloseShiftView extends Views.CustomViewControllerBase {
public lastStatus: ko.Observable<string>;
/**
* Creates a new instance of the CloseShiftView class.
* @param {Views.IExtensionViewControllerContext} context The extension controller context.
* @param {any} [options] The options used to initialize the view state.
*/
constructor(context: Views.ICustomViewControllerContext, options?: any) {
super(context);
this.state.title = "Close Shift"
this.lastStatus = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Performs the sync operation.
*/
public closeShiftAsync(): void {
let clientRequest: CloseShiftOperationRequest<CloseShiftOperationResponse> =
new CloseShiftOperationRequest<CloseShiftOperationResponse>(this.context.logger.getNewCorrelationId());
this.context.runtime.executeAsync(clientRequest)
.then((result: ClientEntities.ICancelableDataResult<CloseShiftOperationResponse>) => {
if (result.canceled) {
this.lastStatus("cancelled");
} else {
this.lastStatus(JSON.stringify(result.data));
}
}).catch((error: any) => {
this.lastStatus(JSON.stringify(error));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DatePickerView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for DatePickerView.
*/
export default class DatePickerView extends Views.CustomViewControllerBase {
public datePicker: Controls.IDatePicker;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "DatePicker sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let datePickerOptions: Controls.IDatePickerOptions = {
date: new Date(),
enabled: true
};
let datePickerRootElem: HTMLDivElement = element.querySelector("#datePickerSample") as HTMLDivElement;
this.datePicker = this.context.controlFactory.create("", "DatePicker", datePickerOptions, datePickerRootElem);
this.datePicker.addEventListener("DateChanged", (eventData: { date: Date }) => {
this._dateChangedHandler(eventData.date);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for date picker.
* @param {Date} newDate
*/
private _dateChangedHandler(newDate: Date): void {
this.context.logger.logInformational("DateChanged: " + JSON.stringify(newDate));
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ToggleMenuView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ToggleMenuView</title>
</head>
<body>
<div class="ToggleMenuView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>ToggleMenu</h3>
<div class="pad8">
<div id="toggleMenu">
</div>
<button data-bind="click: showToggleMenu">Show toggle menu</button>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
export interface IToggleMenuState {
placement?: MenuPlacementOptions;
alignment?: MenuAlignmentOptions;
commands?: IToggleMenuCommandState[];
}
export interface IMenuCommandState {
id: string;
label: string;
onClick?: MenuToggleCommandClickCallback;
selected?: boolean;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for ToggleMenuView.
*/
export default class ToggleMenuView extends Views.CustomViewControllerBase {
public toggleMenu: Controls.IMenu;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ToggleMenuView sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let toggleMenuOptions: Controls.IMenuOptions = {
commands: [{
id: "MenuCommand1",
label: "Menu command 1",
}, {
id: "MenuCommand2",
label: "Menu command 2",
selected: true,
}],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "toggle"
};
let toggleMenuRootElem: HTMLDivElement = element.querySelector("#toggleMenu") as HTMLDivElement;
this.toggleMenu = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Menu", toggleMenuOptions, toggleMenuRootElem);
this.toggleMenu.addEventListener("CommandInvoked", (eventData: { id: string }) => {
this.menuCommandClick(eventData.id);
});
}
/**
* Callback for toggle menu.
* @param {ToggleMenuView} controller View controller.
* @param {Event} event Html event object.
*/
public showToggleMenu(controller: ToggleMenuView, event: Event): void {
this.toggleMenu.show(<HTMLElement>event.currentTarget);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for toggle menu command.
* @param {string} args Arguments.
*/
private menuCommandClick(args: string): void {
this.context.logger.logInformational(JSON.stringify(args));
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div data-bind="msPosToggleMenu: toggleMenu">
</div>
<button data-bind="click: showToggleMenu">Show toggle menu</button>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TextInputDialogView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import TextInputDialog from "../../Dialogs/DialogSample/TextInputDialog";
import ko from "knockout";
/**
* The controller for TextInputDialogView.
*/
export default class TextDialogView extends Views.CustomViewControllerBase {
public dialogResult: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "TextInputDialog sample";
this.dialogResult = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Opens the text dialog sample.
*/
public openTextDialog(): void {
let textInputDialog: TextInputDialog = new TextInputDialog();
textInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("TextInputDialog: " + JSON.stringify(reason));
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ApiView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
RefreshCartClientRequest, RefreshCartClientResponse, GetCurrentCartClientRequest, GetCurrentCartClientResponse,
PriceOverrideOperationRequest, PriceOverrideOperationResponse, SetTransactionCommentOperationRequest, SetTransactionCommentOperationResponse,
SetCartLineCommentOperationRequest, SetCartLineCommentOperationResponse
} from "PosApi/Consume/Cart";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ArrayExtensions, ObjectExtensions } from "PosApi/TypeExtensions";
import * as Views from "PosApi/Create/Views";
import ko from "knockout";
type ICancelableDataResult<TResult> = ClientEntities.ICancelableDataResult<TResult>;
/**
* The controller for AppBarView.
*/
export default class ApiView extends Views.CustomViewControllerBase {
public lastStatus: ko.Observable<string>;
public transactionComment: ko.Observable<string>;
public cartLineComment: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext, options?: any) {
super(context);
this.state.title = "Api sample"
this.lastStatus = ko.observable("");
this.transactionComment = ko.observable("");
this.cartLineComment = ko.observable("");
}
/**
* Callback for Refresh cart API button
*/
public onRefreshCart(): void {
let correlationId: string = this.context.logger.logInformational("ApiView.onRefreshCart - Refreshing the cart...");
let request: RefreshCartClientRequest<RefreshCartClientResponse> = new RefreshCartClientRequest<RefreshCartClientResponse>();
this.context.runtime.executeAsync(request).then((result: ClientEntities.ICancelableDataResult<RefreshCartClientResponse>): void => {
this.onRequestSuccess(result, correlationId);
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Callback for Override price for cart line API button
*/
public onPriceOverride(percent: number): void {
let correlationId: string = this.context.logger.getNewCorrelationId();
this.getFirstCartLine(correlationId).then((line: ProxyEntities.CartLine) => {
let priceOverrideRequest: PriceOverrideOperationRequest<PriceOverrideOperationResponse> =
new PriceOverrideOperationRequest<PriceOverrideOperationResponse>(line.LineId, line.Price * (1 - (percent / 100)), correlationId);
this.context.runtime.executeAsync(priceOverrideRequest)
.then((result: ClientEntities.ICancelableDataResult<PriceOverrideOperationResponse>): void => {
this.onRequestSuccess(result, correlationId);
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}
/**
* Callback for transaction comment API button
*/
public onTransactionComment(): void {
let correlationId: string = this.context.logger.getNewCorrelationId();
let request: SetTransactionCommentOperationRequest<SetTransactionCommentOperationResponse> =
new SetTransactionCommentOperationRequest<SetTransactionCommentOperationResponse>(correlationId, this.transactionComment());
this.context.runtime.executeAsync(request).then((result: ClientEntities.ICancelableDataResult<SetTransactionCommentOperationResponse>): void => {
this.onRequestSuccess(result, correlationId);
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}
/**
* Callback for cart line comment API button
*/
public onCartLineComment(): void {
let correlationId: string = this.context.logger.getNewCorrelationId();
this.getFirstCartLine(correlationId).then((line: ProxyEntities.CartLine) => {
let request: SetCartLineCommentOperationRequest<SetCartLineCommentOperationResponse> =
new SetCartLineCommentOperationRequest<SetCartLineCommentOperationResponse>(line.LineId, this.cartLineComment(), correlationId);
this.context.runtime.executeAsync(request).then((result: ClientEntities.ICancelableDataResult<SetCartLineCommentOperationResponse>): void => {
this.onRequestSuccess(result, correlationId);
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}).catch((error: any): void => {
this.onRequestFailed(error, correlationId);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Executes function on the first line in the current cart
* @param {string} correlationId The correlation identifier.
*/
private getFirstCartLine(correlationId: string): Promise<ProxyEntities.CartLine> {
this.context.logger.logInformational("ApiView.getFirstCartLine - Getting the current cart...", correlationId);
let getCartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest<GetCurrentCartClientResponse>();
return this.context.runtime.executeAsync(getCartRequest).then((value: ICancelableDataResult<GetCurrentCartClientResponse>) => {
if (!value.canceled) {
let cart: ProxyEntities.Cart = (<GetCurrentCartClientResponse>value.data).result;
if (!ObjectExtensions.isNullOrUndefined(cart) &&
ArrayExtensions.hasElements(cart.CartLines)) {
this.context.logger.logInformational("ApiView.getFirstCartLine - get current cart completed successfully.", correlationId);
return cart.CartLines[0];
} else {
throw new Error("failed - cart is not loaded or no lines in cart");
}
} else {
throw new Error("cancelled");
}
});
}
/**
* Callback for API request success.
* @param value The result of the API request.
* @param correlationId The correlation identifier.
*/
private onRequestSuccess(value: ICancelableDataResult<any>, correlationId: string): void {
if (!value.canceled) {
this.lastStatus(JSON.stringify(value.data, null, 2));
this.context.logger.logVerbose("ApiView.onRequestSuccess - last status updated.", correlationId);
} else {
this.lastStatus("cancelled");
this.context.logger.logVerbose("ApiView.onRequestSuccess - Request cancelled and last status updated.", correlationId);
}
}
/**
* Callback for API request failure.
* @param err The error object.
* @param correlationId The correlation identifier.
*/
private onRequestFailed(err: any, correlationId: string): void {
this.lastStatus(JSON.stringify(err, null, 2));
this.context.logger.logError("ApiView.onRequestFailed Error: " + this.lastStatus(), correlationId);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DynamicDataListView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>DynamicDataListView</title>
</head>
<body>
<div class="dynamicdatalistview">
<div class="grow scrollY">
<div class="pad20 col width680">
<div class="h3">Dynamic DataList</div>
<div class="pad8">
<button id="reloadDataButton" class="primaryButton minWidth200">Change Data Source</button>
</div>
<div class="pad8 height220">
<div id="dynamicDataListSample">
</div>
</div>
<div class="h4 center">
Selecting will be applied
<span class="bold"> ONLY </span>
to the items that are already
<span class="bold"> loaded </span>
in the Dynamic DataList
</div>
<div class="pad8 row centerY">
<button id="selectRandomItemsByIdButton" class="primaryButton minWidth200">Select random item</button>
<div id="selectByIdMessage" class="h4 marginLeft8 marginTopAuto marginBottomAuto">Tried to select an item with id=4.</div>
</div>
<div class="pad8">
<div class="marginBottom8">
<input id="nameFilter" type="text" placeholder="Name" />
</div>
<button id="selectItemsByNameButton" class="primaryButton minWidth200">Select items by name</button>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
/**
* Interface for data source that provides the loading data dynamically page by page.
*/
export interface IPaginatedDataSource<TData> {
loadDataPage: (pageSize: number, skip: number) => Promise<TData[]>; // The callback function which will be called each time when page is requested.
pageSize: number; // The page size.
}
/**
* The interface for paginated data list control options.
*/
export interface IPaginatedDataListOptions<TData> extends IDataListBaseOptions<TData> {
data: IPaginatedDataSource<TData>;
}
/**
* The interface for paginated data lists.
*/
export interface IPaginatedDataList<TData> extends IDataListBase<TData> {
reloadData(): void;
}
export interface IIncrementalDataSource {
callerMethod: Function;
dataManager?: any;
onLoading?: Observable<boolean>;
pageSize?: number;
pageLoadCallBack?: any;
reloadCallBack?: Observable<() => void>;
updateItemCallBack?: Observable<(index: number, item: any)=> void>;
pageLoadCompleteCallBackFunction?: any;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
export interface IShiftData {
requestId: number;
requestDateTime: Date;
requestedWorkerName: string;
requestType: string;
requestStatus: string;
}
/**
* The controller for DynamicDataListView.
*/
export default class DynamicDataListView extends Views.CustomViewControllerBase {
public paginatedDataList: Controls.IPaginatedDataList<IShiftData>;
private _isUsingAlternativeData: boolean;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Dynamic DataList sample";
this._isUsingAlternativeData = false;
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
document.getElementById("selectByIdMessage").innerHTML = "Try to click the 'Select random item by id' button!";
document.getElementById("selectRandomItemsByIdButton").addEventListener('click', () => {
this.selectRandomItemsById();
});
document.getElementById("selectItemsByNameButton").addEventListener('click', () => {
this.selectItemsByName();
});
// Initialize datalist source
let paginatedDataSource: Controls.IPaginatedDataSource<IShiftData> = {
pageSize: 5,
loadDataPage: this._loadDataPage.bind(this)
};
// Initialize datalist options
let dataListOptions: Readonly<Controls.IPaginatedDataListOptions<IShiftData>> = {
columns: [
{
title: "ID",
ratio: 20,
collapseOrder: 3,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestId.toString();
}
},
{
title: "Name",
ratio: 30,
collapseOrder: 4,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestedWorkerName;
}
},
{
title: "Type",
ratio: 25,
collapseOrder: 1,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestType;
}
},
{
title: "Status",
ratio: 25,
collapseOrder: 2,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestStatus;
}
}
],
data: paginatedDataSource,
interactionMode: Controls.DataListInteractionMode.MultiSelect,
equalityComparer: (left: IShiftData, right: IShiftData): boolean => left.requestId === right.requestId
};
// Initialize datalist
let dataListRootElem: HTMLDivElement = element.querySelector("#dynamicDataListSample") as HTMLDivElement;
this.paginatedDataList = this.context.controlFactory.create("", "PaginatedDataList", dataListOptions, dataListRootElem);
this.paginatedDataList.addEventListener("SelectionChanged", (eventData: { items: IShiftData[] }) => {
this._dataListSelectionChanged();
});
let reloadBtn: HTMLButtonElement = element.querySelector("#reloadDataButton") as HTMLButtonElement;
reloadBtn.addEventListener('click', () => {
this._isUsingAlternativeData = !this._isUsingAlternativeData;
this.paginatedDataList.reloadData();
});
}
/**
* Callback for selecting items by random id button.
* Selecting will be applied only to the items which are already loaded.
* If the item is not yet loaded, nothing will happen to it.
*/
public selectRandomItemsById(): void {
let items = this._getData();
if (items.length == 0) {
return;
}
let index = Math.floor(Math.random() * items.length);
let item = items[index];
document.getElementById("selectByIdMessage").innerHTML =
`Tried to select item with id=${item.requestId}.`;
this.paginatedDataList.selectItems([item]);
}
/**
* Callback for selecting items by name button.
* Selecting will be applied only to the items which are already loaded.
* If the item is not yet loaded, nothing will happen to it.
*/
public selectItemsByName(): void {
let nameFilterValue = (<HTMLInputElement>document.getElementById("nameFilter")).value;
let items = this._getData();
let itemsToSelect = items.filter(
item => item.requestedWorkerName.toLowerCase().indexOf(nameFilterValue.toLowerCase()) != -1);
this.paginatedDataList.selectItems(itemsToSelect);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for data list.
*/
private _dataListSelectionChanged(): void {
this.context.logger.logInformational("_dataListSelectionChanged");
}
/**
* Load data page callback.
* @param {number} size The number of items to load.
* @param {number} skip The number of items that were already loaded.
* @returns {Promise<IShiftData[]>} The loaded items promise.
*/
private _loadDataPage(size: number, skip: number): Promise<IShiftData[]> {
let promise: Promise<any> = new Promise((resolve: (value?: any) => void) => {
// Emulate delay of request to server.
setTimeout(() => {
this.context.logger.logInformational("dataListPageLoaded");
let pageData: IShiftData[] = this._getData(size, skip);
resolve(pageData);
}, 1000);
});
return promise;
}
/**
* Gets items based on the current data source.
* @param {number} size The number of items to return.
* @param {number} skip The number of items to skip.
* @returns {IShiftData[]} The requested items.
*/
private _getData(size?: number, skip?: number): IShiftData[] {
if (ObjectExtensions.isNullOrUndefined(skip)) {
skip = 0;
}
let data: IShiftData[] = [];
if (this._isUsingAlternativeData) {
data = this._getAlternativeData();
} else {
data = this._getAllItems();
}
if (ObjectExtensions.isNullOrUndefined(size)) {
return data.slice(skip);
} else {
return data.slice(skip, skip + size);
}
}
/**
* Gets alternative items.
* @returns {Promise<IShiftData[]>} The requested items.
*/
private _getAlternativeData(): IShiftData[] {
return [{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Alternative Name.",
requestType: "Alternative Type.",
requestStatus: "Approved"
}];
}
/**
* Gets all sample data items.
* @returns {IShiftData[]} The items for the data list.
*/
private _getAllItems(): IShiftData[] {
return [{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 2,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 3,
requestDateTime: new Date(),
requestedWorkerName: "Greg Marchievsky",
requestType: "Shift Offer",
requestStatus: "Rejected"
},
{
requestId: 4,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 5,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 6,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 7,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 8,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 9,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 10,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 11,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 12,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 13,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 14,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 15,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 16,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 17,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 18,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 19,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 20,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 21,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 22,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 23,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 24,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 25,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 26,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 27,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 28,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 29,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 30,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
}];
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
Height must be greater than row height in order for data list to work.
So make sure you have sufficient space.
<div class="pad8 height220">
<div id="dynamicDataListSample"></div>
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DataListView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>DataListView</title>
</head>
<body>
<div class="datalistview">
<div class="grow scrollY">
<div class="pad20 col width680">
<div class="h3">DataList</div>
<div class="pad8 height220">
<div id="dataListSample">
</div>
</div>
<div class="pad8">
<button id="selectRandomItemButton" class="primaryButton">
Select random item by id
</button>
</div>
<div class="pad8">
<div class="margin8">
<input id="nameFilter" type="text" placeholder="Name" />
</div>
<button id="selectItemsByNameButton" class="primaryButton">
Select items filtered by name
</button>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
/**
* The interface for data list control options.
*/
export interface IDataListOptions<TData> extends IDataListBaseOptions<TData> {
data: Readonly<TData[]>;
}
/**
* The interface for data lists.
*/
export interface IDataList<TData> extends IDataListBase<TData> {
data: Readonly<TData[]>;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
export interface IShiftData {
requestId: number;
requestDateTime: Date;
requestedWorkerName: string;
requestType: string;
requestStatus: string;
}
/**
* The controller for DataListView.
*/
export default class DataListView extends Views.CustomViewControllerBase {
public dataList: Controls.IDataList<IShiftData>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "DataList sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
document.getElementById("selectRandomItemButton").addEventListener('click', () => {
this.selectRandomItem();
});
document.getElementById("selectItemsByNameButton").addEventListener('click', () => {
this.selectItemsByName();
});
let dataListDataSource: Readonly<IShiftData[]> = [
{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 2,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 3,
requestDateTime: new Date(),
requestedWorkerName: "Greg Marchievsky",
requestType: "Shift Offer",
requestStatus: "Rejected"
},
{
requestId: 4,
requestDateTime: new Date(),
requestedWorkerName: "Bohdan Yevchenko",
requestType: "Vacation request",
requestStatus: "Approved"
}
];
let dataListOptions: Readonly<Controls.IDataListOptions<IShiftData>> = {
columns: [
{
title: "Name",
ratio: 30,
collapseOrder: 3,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestedWorkerName;
}
},
{
title: "Type",
ratio: 30,
collapseOrder: 1,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestType;
}
},
{
title: "Status",
ratio: 40,
collapseOrder: 2,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestStatus;
}
}
],
data: dataListDataSource,
interactionMode: Controls.DataListInteractionMode.MultiSelect,
equalityComparer: (left: IShiftData, right: IShiftData): boolean => left.requestId === right.requestId
};
let dataListRootElem: HTMLDivElement = element.querySelector("#dataListSample") as HTMLDivElement;
this.dataList = this.context.controlFactory.create("", "DataList", dataListOptions, dataListRootElem);
this.dataList.addEventListener("SelectionChanged", (eventData: { items: IShiftData[] }) => {
this._dataListSelectionChanged(eventData.items);
});
this.dataList.addEventListener("ItemInvoked", (eventData: { item: IShiftData }) => {
this._dataListItemInvoked(eventData.item);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for selecting random items button.
*/
public selectRandomItem(): void {
if (this.dataList.data.length == 0) {
return;
}
let index = Math.floor(Math.random() * this.dataList.data.length);
let item = this.dataList.data[index];
this.dataList.selectItems([item]);
}
/**
* Callback for selecting items by name button.
*/
public selectItemsByName(): void {
let nameFilterValue = (<HTMLInputElement>document.getElementById("nameFilter")).value;
let itemsToSelect = this.dataList.data.filter(
item => item.requestedWorkerName.toLowerCase().indexOf(nameFilterValue.toLowerCase()) != -1);
this.dataList.selectItems(itemsToSelect);
}
/**
* Callback for data list selection changed.
*/
private _dataListSelectionChanged(items: IShiftData[]): void {
this.context.logger.logInformational("SelectionChanged: " + JSON.stringify(items));
}
/**
* Callback for data list item invoked.
*/
private _dataListItemInvoked(item: IShiftData): void {
this.context.logger.logInformational("ItemInvoked " + JSON.stringify(item));
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
Height must be greater than row height in order for data list to work.
So make sure you have sufficient space.
<div class="pad8 height220">
<div id="dataListSample"></div>
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/VoidCartLineView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>VoidCartLineView</title>
</head>
<body>
<div class="VoidCartLineView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Void cart line</div>
<button data-bind="click:getCurrentCart">Refresh Cart</button>
<button data-bind="click:voidCartLine">Void Cart Line</button>
</div>
<textarea class="height220" data-bind="text: currentCart"></textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/SyncStockCountJournalsView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as StockCountJournal from "PosApi/Consume/StockCountJournals";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import * as Views from "PosApi/Create/Views";
import { ArrayExtensions, ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for SyncStockCountJournals.
*/
export default class SyncStockCountJournalsView extends Views.CustomViewControllerBase {
public journals: ko.Observable<string>;
/**
* Creates a new instance of the SyncStockCountJournalsView class.
* @param {Views.ICustomViewControllerContext} context The custom view controller context.
* @param {any} [options] The options used to initialize the view state.
*/
constructor(context: Views.ICustomViewControllerContext, options?: any) {
super(context);
this.state.title = "Sync Stock Count Journals";
this.journals = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Performs the sync operation.
*/
public syncAllStockCountJournalsAsync(): void {
let clientRequest: StockCountJournal.SyncAllStockCountJournalsClientRequest<StockCountJournal.SyncAllStockCountJournalsClientResponse> =
new StockCountJournal.SyncAllStockCountJournalsClientRequest<StockCountJournal.SyncAllStockCountJournalsClientResponse>();
this.context.runtime.executeAsync(clientRequest)
.then((result: ClientEntities.ICancelableDataResult<StockCountJournal.SyncAllStockCountJournalsClientResponse>) => {
let journalsList: string = "";
if (!result.canceled && !ObjectExtensions.isNullOrUndefined(result.data) && ArrayExtensions.hasElements(result.data.result)) {
result.data.result.forEach((stockCountJournal: ProxyEntities.StockCountJournal) => {
journalsList = journalsList.concat(JSON.stringify(stockCountJournal));
});
}
this.journals(journalsList);
}).catch((error: any) => {
this.journals(JSON.stringify(error));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TimePickerView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
import ko from "knockout";
/**
* The controller for TimePickerView.
*/
export default class TimePickerView extends Views.CustomViewControllerBase {
public timePicker: Controls.ITimePicker;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "TimePicker sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let timePickerOptions: Controls.ITimePickerOptions = {
enabled: true,
minuteIncrement: 15,
time: new Date()
};
let timePickerRootElem: HTMLDivElement = element.querySelector("#timePicker") as HTMLDivElement;
this.timePicker = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "TimePicker", timePickerOptions, timePickerRootElem);
this.timePicker.addEventListener("TimeChanged", (eventData: { time: Date }) => {
this.timePickerChanged(eventData.time)
});
}
/**
* Callback for time picker.
* @param {Date} newDate New date.
*/
private timePickerChanged(newDate: Date): void {
this.context.logger.logInformational(newDate.getHours() + ":" + newDate.getMinutes());
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/PostLogOnView.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>PostLogOnView</title>
</head>
<body>
<div class="PostLogOnView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Confirm Login</div>
<button id="confirmBtn">Confirm Login</button>
</div>
</div>
</div>
</div>
</body>
</html> | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/SyncStockCountJournalsView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>SyncStockCountJournals</title>
</head>
<body>
<div class="SyncStockCountJournals">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Sync Stock Count Journals</div>
<button data-bind="click: syncAllStockCountJournalsAsync">Sync</button>
</div>
<textarea class="height220" data-bind="text: journals"></textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AppBarView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AppBarView</title>
</head>
<body>
<div class="AppBarView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>AppBar</h3>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
/**
* Type interface representing a command definition.
*/
export interface ICommandDefinition extends Commerce.Extensibility.ICommandDefinition {
/**
* The command's execute implementation.
* @param {CustomViewControllerExecuteCommandArgs} args The command execution arguments.
*/
readonly execute: (args: CustomViewControllerExecuteCommandArgs) => void;
}
/**
* Type interface representing the command bar configuration.
*/
export interface ICommandBarConfiguration {
readonly commands: ICommandDefinition[];
}
/**
* Type interface representing a custom view controller configuration.
*/
export interface ICustomViewControllerConfiguration {
readonly title: string;
readonly commandBar?: ICommandBarConfiguration;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* The controller for AppBarView.
*/
export default class AppBarView extends Views.CustomViewControllerBase {
constructor(context: Views.ICustomViewControllerContext) {
let config: Views.ICustomViewControllerConfiguration = {
title: "",
commandBar: {
commands: [
{
name: "AppBarView_appBarCommand",
label: "Execute command",
icon: Views.Icons.Add,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
this.appBarCommandExecute();
}
}
]
}
};
super(context, config);
this.state.title = "AppBar sample"
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for appbar command.
*/
private appBarCommandExecute(): void {
this.context.logger.logInformational("appBarCommandExecute");
}
}
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ToggleSwitchView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
import ko from "knockout";
/**
* The controller for ToggleSwitchView.
*/
export default class ToggleSwitchView extends Views.CustomViewControllerBase {
public toggleSwitch: Controls.IToggle;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ToggleSwitch sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let toggleOptions: Controls.IToggleOptions = {
tabIndex: 0,
enabled: true,
checked: false,
labelOn: "On",
labelOff: "Off",
};
let toggleRootElem: HTMLDivElement = element.querySelector("#toggleSwitch") as HTMLDivElement;
this.toggleSwitch = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Toggle", toggleOptions, toggleRootElem);
this.toggleSwitch.addEventListener("CheckedChanged", (eventData: { checked: boolean }) => {
this.toggleSwitchChanged(eventData.checked);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for toggle switch.
* @param {boolean} checked True if checked, otherwise false.
*/
private toggleSwitchChanged(checked: boolean): void {
this.context.logger.logInformational("toggleSwitchChanged: " + checked);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DataListView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The interface for shift data.
*/
export interface IShiftData {
requestId: number;
requestDateTime: Date;
requestedWorkerName: string;
requestType: string;
requestStatus: string;
}
/**
* The controller for DataListView.
*/
export default class DataListView extends Views.CustomViewControllerBase {
public dataList: Controls.IDataList<IShiftData>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "DataList sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
document.getElementById("selectRandomItemButton").addEventListener('click', () => {
this.selectRandomItem();
});
document.getElementById("selectItemsByNameButton").addEventListener('click', () => {
this.selectItemsByName();
});
let dataListDataSource: Readonly<IShiftData[]> = [
{
requestId: 1,
requestDateTime: new Date(),
requestedWorkerName: "Allison Berker",
requestType: "Leave request",
requestStatus: "Approved"
},
{
requestId: 2,
requestDateTime: new Date(),
requestedWorkerName: "Bert Miner",
requestType: "Shift Swap",
requestStatus: "Pending"
},
{
requestId: 3,
requestDateTime: new Date(),
requestedWorkerName: "Greg Marchievsky",
requestType: "Shift Offer",
requestStatus: "Rejected"
},
{
requestId: 4,
requestDateTime: new Date(),
requestedWorkerName: "Bohdan Yevchenko",
requestType: "Vacation request",
requestStatus: "Approved"
}
];
let dataListOptions: Readonly<Controls.IDataListOptions<IShiftData>> = {
columns: [
{
title: "Name",
ratio: 30,
collapseOrder: 3,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestedWorkerName;
}
},
{
title: "Type",
ratio: 30,
collapseOrder: 1,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestType;
}
},
{
title: "Status",
ratio: 40,
collapseOrder: 2,
minWidth: 100,
computeValue: (value: IShiftData): string => {
return value.requestStatus;
}
}
],
data: dataListDataSource,
interactionMode: Controls.DataListInteractionMode.MultiSelect,
equalityComparer: (left: IShiftData, right: IShiftData): boolean => left.requestId === right.requestId
};
let dataListRootElem: HTMLDivElement = element.querySelector("#dataListSample") as HTMLDivElement;
this.dataList = this.context.controlFactory.create("", "DataList", dataListOptions, dataListRootElem);
this.dataList.addEventListener("SelectionChanged", (eventData: { items: IShiftData[] }) => {
this._dataListSelectionChanged(eventData.items);
});
this.dataList.addEventListener("ItemInvoked", (eventData: { item: IShiftData }) => {
this._dataListItemInvoked(eventData.item);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for selecting random items button.
*/
public selectRandomItem(): void {
if (this.dataList.data.length == 0) {
return;
}
let index = Math.floor(Math.random() * this.dataList.data.length);
let item = this.dataList.data[index];
this.dataList.selectItems([item]);
}
/**
* Callback for selecting items by name button.
*/
public selectItemsByName(): void {
let nameFilterValue = (<HTMLInputElement>document.getElementById("nameFilter")).value;
let itemsToSelect = this.dataList.data.filter(
item => item.requestedWorkerName.toLowerCase().indexOf(nameFilterValue.toLowerCase()) != -1);
this.dataList.selectItems(itemsToSelect);
}
/**
* Callback for data list selection changed.
*/
private _dataListSelectionChanged(items: IShiftData[]): void {
this.context.logger.logInformational("SelectionChanged: " + JSON.stringify(items));
}
/**
* Callback for data list item invoked.
*/
private _dataListItemInvoked(item: IShiftData): void {
this.context.logger.logInformational("ItemInvoked " + JSON.stringify(item));
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AlphanumericInputDialogView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import AlphanumericInputDialog from "../../Dialogs/DialogSample/AlphanumericInputDialog";
import ko from "knockout";
/**
* The controller for AlphanumericInputDialogView.
*/
export default class AlphanumericInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.dialogResult = ko.observable("");
this.state.title = "Alphanumeric Input Dialog Sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the Alphanumeric Input dialog sample.
*/
public openAlphanumericInputDialog(): void {
let alphanumericInputDialog: AlphanumericInputDialog = new AlphanumericInputDialog();
alphanumericInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("AlphanumericInputDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/MenuView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MenuView</title>
</head>
<body>
<div class="MenuView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>Menu</h3>
<div class="pad8">
<button data-bind="click: showMenu" style="float: left">Menu anchor</button>
<div id="menu">
</div>
<button data-bind="click: showMenu">Another menu anchor</button>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
export interface IMenuState {
placement?: MenuPlacementOptions;
alignment?: MenuAlignmentOptions;
commands?: IMenuCommandState[];
}
export interface IMenuCommandState {
id: string;
label: string;
onClick?: MenuCommandClickCallback;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for MenuView.
*/
export default class MenuView extends Views.CustomViewControllerBase {
public menu: Controls.IMenu;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Menu sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let menuOptions: Controls.IMenuOptions = {
commands: [{
id: "MenuCommand1",
label: "Menu command 1",
}, {
id: "MenuCommand2",
label: "Menu command 2",
}],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "button"
};
let menuRootElem: HTMLDivElement = element.querySelector("#menu") as HTMLDivElement;
this.menu = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Menu", menuOptions, menuRootElem);
this.menu.addEventListener("CommandInvoked", (eventData: { id: string }) => {
this.menuCommandClick(eventData.id);
});
}
/**
* Callback for menu.
* @param {MenuView} controller View controller.
* @param {Event} eventArgs Html event.
*/
public showMenu(controller: MenuView, eventArgs: Event): void {
this.menu.show(<HTMLElement>event.currentTarget);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for menu command.
* @param {string} args Menu command arguments.
*/
private menuCommandClick(args: string): void {
this.context.logger.logInformational("menuCommandClick: " + args);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<button data-bind="click: showMenu" style="float:left">Menu anchor</button>
<div id="menu">
</div>
<button data-bind="click: showMenu">Another menu anchor</button>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TimePickerView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TimePickerView</title>
</head>
<body>
<div class="TimePickerView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>TimePicker</h3>
<div class="pad8">
<div id="timePicker">
</div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
export interface ITimePickerOptions extends IControlOptions {
enabled: boolean;
minuteIncrement: number;
time: Date;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for TimePickerView.
*/
export default class TimePickerView extends Views.CustomViewControllerBase {
public timePicker: Controls.ITimePicker;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "TimePicker sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let timePickerOptions: Controls.ITimePickerOptions = {
enabled: true,
minuteIncrement: 15,
time: new Date()
};
let timePickerRootElem: HTMLDivElement = element.querySelector("#timePicker") as HTMLDivElement;
this.timePicker = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "TimePicker", timePickerOptions, timePickerRootElem);
this.timePicker.addEventListener("TimeChanged", (eventData: { time: Date }) => {
this.timePickerChanged(eventData.time);
});
}
/**
* Callback for time picker.
* @param {Date} newDate New date.
*/
private timePickerChanged(newDate: Date): void {
this.context.logger.logInformational(newDate.getHours() + ":" + newDate.getMinutes());
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="timePicker">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ApiView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ApiView</title>
</head>
<body>
<div class="ApiView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Refresh cart</div>
<button data-bind="click:onRefreshCart">Refresh</button>
</div>
<div>
<div class="h4">Override price in cart</div>
<button data-bind="click:function(){this.onPriceOverride(10);}">10%</button>
<button data-bind="click:function(){this.onPriceOverride(20);}">20%</button>
<button data-bind="click:function(){this.onPriceOverride(30);}">30%</button>
<button data-bind="click:function(){this.onPriceOverride(40);}">40%</button>
<button data-bind="click:function(){this.onPriceOverride(50);}">50%</button>
</div>
<div>
<div class="h4">Add comment to transaction</div>
<input type="text" placeholder="comment" data-bind="value: transactionComment" /><button data-bind="click:onTransactionComment">Comment</button>
</div>
<div>
<div class="h4">Add comment to cart line</div>
<input type="text" placeholder="comment" data-bind="value: cartLineComment" /><button data-bind="click:onCartLineComment">Comment</button>
</div>
<pre class="height220" data-bind="text: lastStatus"></pre>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/CloseShiftView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CloseShift</title>
</head>
<body>
<div class="CloseShift">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Close Shift</div>
<button data-bind="click: closeShiftAsync">Close</button>
</div>
<pre class="height220" data-bind="text: lastStatus"></pre>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/DatePickerView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>DatePickerView</title>
</head>
<body>
<div class="DatePickerView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>DatePicker</h3>
<div class="pad8">
<div id="datePickerSample">
</div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
export interface IDatePickerOptions {
date: Date;
enabled: boolean;
}
export interface IDatePicker {
readonly date: Date;
enabled: boolean;
}
export interface IDatePickerEventMap {
"DateChanged": {
date: Date;
};
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as HeaderSplitView from "PosUISdk/Controls/HeaderSplitView";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for DatePickerView.
*/
export default class DatePickerView extends Views.CustomViewControllerBase {
public datePicker: Controls.IDatePicker;
constructor(context: Views.ICustomViewControllerContext) {
// Do not save in history
super(context);
this.state.title = "DatePicker sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let datePickerOptions: Controls.IDatePickerOptions = {
date: new Date(),
enabled: true
};
let datePickerRootElem: HTMLDivElement = element.querySelector("#datePickerSample") as HTMLDivElement;
this.datePicker = this.context.controlFactory.create("", "DatePicker", datePickerOptions, datePickerRootElem);
this.datePicker.addEventListener("DateChanged", (eventData: { date: Date }) => {
this._dateChangedHandler(eventData.date);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for date picker.
* @param {Date} newDate
*/
private _dateChangedHandler(newDate: Date): void {
this.context.logger.logInformational("DateChanged: " + JSON.stringify(newDate));
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="datePickerSample">
</div>
</textarea>
</div>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/VoidCartLineView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { GetCurrentCartClientRequest, GetCurrentCartClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ObjectExtensions, ArrayExtensions } from "PosApi/TypeExtensions";
import { VoidCartLineOperationRequest, VoidCartLineOperationResponse } from "PosApi/Consume/Cart";
import ko from "knockout";
type ICancelableDataResult<TResult> = ClientEntities.ICancelableDataResult<TResult>;
/**
* The controller for VoidCartLineView.
*/
export default class VoidCartLineView extends Views.CustomViewControllerBase {
public currentCart: ko.Observable<string>;
public cartLineId: string;
/**
* Creates a new instance of the VoidCartLineView class.
* @param {Views.ICustomViewControllerContext} context The custom view controller context.
* @param {any} [options] The options used to initialize the view state.
*/
constructor(context: Views.ICustomViewControllerContext, options?: any) {
// Do not save in history
super(context);
this.state.title = "Void cart line sample";
this.currentCart = ko.observable("");
this.cartLineId = "";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Gets the current cart.
*/
public getCurrentCart(): void {
let getCartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest<GetCurrentCartClientResponse>();
this.context.runtime.executeAsync(getCartRequest).then((value: ICancelableDataResult<GetCurrentCartClientResponse>) => {
let cart: ProxyEntities.Cart = (<GetCurrentCartClientResponse>value.data).result;
let nonVoidedCartLines: ProxyEntities.CartLine[] = cart.CartLines.filter((cartLine: ProxyEntities.CartLine) => {
return !cartLine.IsVoided;
});
if (ArrayExtensions.hasElements(nonVoidedCartLines)) {
this.cartLineId = nonVoidedCartLines[0].LineId;
}
this.currentCart(JSON.stringify(cart));
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Voids a cart line.
*/
public voidCartLine(): void {
let voidCartLineOperationRequest: VoidCartLineOperationRequest<VoidCartLineOperationResponse> =
new VoidCartLineOperationRequest<VoidCartLineOperationResponse>(this.cartLineId, this.context.logger.getNewCorrelationId());
this.context.runtime.executeAsync(voidCartLineOperationRequest).then((value: ICancelableDataResult<VoidCartLineOperationResponse>) => {
if (value.canceled) {
this.currentCart("Void cart line is canceled");
} else {
this.currentCart(JSON.stringify(value.data.cart));
}
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AppBarView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { DirectionalHint, IMenu, IMenuOptions } from "PosApi/Consume/Controls";
import * as Views from "PosApi/Create/Views";
import { ArrayExtensions, ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for AppBarView.
* This view demonstrates how to use the AppBar control including adding commands, enabling/disabling commands, and showing/hiding commands.
*/
export default class AppBarView extends Views.CustomViewControllerBase {
private static readonly APP_BAR_COMMAND_NAME: string = "AppBarView_appBarCommand";
private _menu: IMenu;
private _commandElement: HTMLElement;
constructor(context: Views.ICustomViewControllerContext) {
let config: Views.ICustomViewControllerConfiguration = {
title: "AppBar sample",
commandBar: {
commands: [
{
name: AppBarView.APP_BAR_COMMAND_NAME,
label: "Show menu",
icon: Views.Icons.Add,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
if (ObjectExtensions.isNullOrUndefined(this._commandElement)) {
this._commandElement = document.getElementById(args.commandId);
}
this._menu.show(this._commandElement); // Show the menu when the command is executed (i.e. when the button is clicked)
}
},
{
name: "AppBarView_toggleEnableCommand",
label: "Enable/Disable show menu command",
icon: Views.Icons.Go,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
this._appBarCommand.canExecute = !this._appBarCommand.canExecute; // Toggle the enabled state of the command by setting the canExecute property.
}
},
{
name: "AppBarView_toggleVisibilityCommand",
label: "Show/Hide show menu command",
icon: Views.Icons.TwoPage,
isVisible: true,
canExecute: true,
execute: (args: Views.CustomViewControllerExecuteCommandArgs): void => {
this._appBarCommand.isVisible = !this._appBarCommand.isVisible; // Toggle the visibility of the command by setting the isVisible property.
}
}
]
}
};
super(context, config);
}
private get _appBarCommand(): Views.ICommand {
return ArrayExtensions.firstOrUndefined(this.state.commandBar.commands, (command: Views.ICommand) => {
return command.name === AppBarView.APP_BAR_COMMAND_NAME;
});
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let menuCommands: Commerce.Extensibility.IMenuCommand[] = [
{
id: "AppBarView_menuCommand1",
label: "Execute action",
canExecute: true,
isVisible: true
}
];
let menuOptions: IMenuOptions = {
directionalHint: DirectionalHint.TopLeftEdge,
type: "button",
commands: menuCommands
};
let menuHostElement: HTMLDivElement = document.createElement("div");
element.appendChild(menuHostElement);
this._menu = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Menu", menuOptions, menuHostElement);
this._menu.addEventListener("CommandInvoked", (data: { id: string; }) => {
this._appBarCommandExecute();
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for appBar command.
*/
private _appBarCommandExecute(): void {
this.state.isProcessing = true; // Show the spinner on the view while it is processing.
setTimeout(() => {
this.state.isProcessing = false; // Hide the spinner on the view after processing is complete.
}, 2000);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TransactionNumPadView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TransactionNumPadView</title>
</head>
<body>
<div class="TransactionNumPadView">
<div data-bind="msPosHeaderSplitView: headerSplitView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>TransactionNumPad</h3>
<div class="pad8">
<div class="minWidth260 maxWidth320" id="TransactionNumPad"></div>
<div class="h4" data-bind="text: 'onEnter - value: ' + numPadValue() + ' quantity: '+ numPadQuantity()"></div>
<div class="h4" data-bind="text: scanResultSourceText"></div>
<div class="h4" data-bind="text: scanResult()"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/PostLogOnView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { IPostLogOnViewOptions } from "../NavigationContracts";
import ko from "knockout";
/**
* The controller for PostLogOnView.
*/
export default class PostLogOnView extends Views.CustomViewControllerBase {
private _options: any;
constructor(context: Views.ICustomViewControllerContext, options?: IPostLogOnViewOptions) {
super(context);
this.state.title = "PostLogOnView sample";
this._options = options;
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
var btn = document.getElementById("confirmBtn");
btn.addEventListener('click', () => {
this._confirmLogin();
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Confirm login.
*/
private _confirmLogin(): void {
this._options.resolveCallback();
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/NumericInputDialogView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>NumericInputDialogView</title>
</head>
<body>
<div class="NumericInputDialogView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>InputNumberDialog</h3>
<div class="pad8">
<button id="btnOpenInputNumDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: openNumericInputDialog">open NumericInput dialog</button>
</div>
<div class="h4">Dialog result</div>
<div class="h4" data-bind="text: dialogResult"></div>
<div class="h4 padTop40">NumericInputDialog option interface</div>
<textarea class="height220">
export interface INumericInputDialogOptions extends IInputDialogOptions<INumericInputDialogResult> {
numPadLabel: string;
defaultNumber?: string;
decimalPrecision?: number;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import NumericInputDialog from "../../Controls/DialogSample/NumericInputDialog";
/**
* The controller for NumericInputDialogView.
*/
export default class NumericInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "NumericInputDialog sample";
this.dialogResult = ko.observable("");
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the numeric input dialog sample.
*/
public openNumericInputDialog(): void {
let numericInputDialog: NumericInputDialog = new NumericInputDialog();
numericInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("NumericInputDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ForceVoidTransactionView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { GetCurrentCartClientRequest, GetCurrentCartClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities } from "PosApi/Entities";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { VoidTransactionOperationRequest, VoidTransactionOperationResponse } from "PosApi/Consume/Cart";
import ko from "knockout";
type ICancelableDataResult<TResult> = ClientEntities.ICancelableDataResult<TResult>;
/**
* The controller for AppBarView.
*/
export default class ForceVoidTransactionView extends Views.CustomViewControllerBase {
public currentCart: ko.Observable<string>;
/**
* Creates a new instance of the ForceVoidTransactionView class.
* @param {Views.ICustomViewControllerContext} context The custom view controller context.
* @param {any} [options] The options used to initialize the view state.
*/
constructor(context: Views.ICustomViewControllerContext, options?: any) {
// Do not save in history
super(context);
this.state.title = "Force Void Transaction sample"
this.currentCart = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Callback for get cart button
*/
public getCurrentCart(): void {
let getCartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest<GetCurrentCartClientResponse>();
this.context.runtime.executeAsync(getCartRequest).then((value: ICancelableDataResult<GetCurrentCartClientResponse>) => {
let cart: Commerce.Proxy.Entities.Cart = (<GetCurrentCartClientResponse>value.data).result;
this.currentCart(JSON.stringify(cart));
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Callback for force void button
*/
public forceVoidTransaction(): void {
let forceVoidTransactionRequest: VoidTransactionOperationRequest<VoidTransactionOperationResponse> =
new VoidTransactionOperationRequest<VoidTransactionOperationResponse>(false, this.context.logger.getNewCorrelationId());
this.context.runtime.executeAsync(forceVoidTransactionRequest).then((value: ICancelableDataResult<VoidTransactionOperationResponse>) => {
this.currentCart(JSON.stringify(value.data.cart));
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AlphanumericNumPadView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AlphanumericNumPadView</title>
</head>
<body>
<div class="AlphanumericNumPadView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>AlphanumericNumPad</h3>
<div class="pad8">
<div class="minWidth260 maxWidth320" id="AlphanumericNumPad"></div>
<div class="h4" data-bind="text: 'onEnter - value: ' + numPadValue()"></div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
interface IAlphanumericNumPadOptions extends INumPadOptions<string>
{
}
interface IAlphanumericNumPad extends INumPad<string, INumPadEventMap<string>>
{
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* The controller for AlphanumericNumPadView.
*/
export default class AlphanumericNumPadView extends Views.CustomViewControllerBase {
public numPad: Controls.IAlphanumericNumPad;
public numPadValue: Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.numPadValue = ko.observable("");
this.state.title = "AlphanumericNumPad sample"
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let numPadOptions: Controls.IAlphanumericNumPadOptions = {
globalInputBroker: this.numPadInputBroker,
label: "NumPad Label",
value: this.numPadValue()
};
let numPadRootElem: HTMLDivElement = element.querySelector("#AlphanumericNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "AlphanumericNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(result: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(result.toString());
this.numPad.value = "";
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="AlphanumericNumPad">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/LoaderView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for LoaderView.
*/
export default class LoaderView extends Views.CustomViewControllerBase {
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Loader sample";
this.state.isProcessing = false;
}
/**
* Show loader control.
*/
public showLoaderClick(): void {
this.state.isProcessing = true;
window.setTimeout(() => {
this.state.isProcessing = false;
}, 3000);
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/NumericInputDialogView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import NumericInputDialog from "../../Dialogs/DialogSample/NumericInputDialog";
import ko from "knockout";
/**
* The controller for NumericInputDialogView.
*/
export default class NumericInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "NumericInputDialog sample";
this.dialogResult = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the numeric input dialog sample.
*/
public openNumericInputDialog(): void {
let numericInputDialog: NumericInputDialog = new NumericInputDialog();
numericInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("NumericInputDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ForceVoidTransactionView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ApiView</title>
</head>
<body>
<div class="ApiView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Force Void Transaction</div>
<button data-bind="click:getCurrentCart">Refresh Cart</button>
<button data-bind="click:forceVoidTransaction">Force Void Transaction</button>
</div>
<textarea class="height220" data-bind="text: currentCart"></textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/CurrencyNumPadView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ko from "knockout";
/**
* The controller for CurrencyNumPadView.
*/
export default class CurrencyNumPadView extends Views.CustomViewControllerBase {
public numPad: Controls.ICurrencyNumPad;
public numPadValue: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "CurrencyNumPad sample";
this.numPadValue = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let inputBroker: Commerce.Peripherals.INumPadInputBroker = null;
let numPadOptions: Controls.ICurrencyNumPadOptions = {
currencyCode: "USD",
globalInputBroker: inputBroker,
label: "NumPad label",
value: 0
};
let numPadRootElem: HTMLDivElement = element.querySelector("#CurrencyNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "CurrencyNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(value: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(value.toString());
this.numPad.value = 0;
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/VoidTenderLineView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { GetCurrentCartClientRequest, GetCurrentCartClientResponse } from "PosApi/Consume/Cart";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ObjectExtensions, ArrayExtensions } from "PosApi/TypeExtensions";
import { VoidTenderLineOperationRequest, VoidTenderLineOperationResponse } from "PosApi/Consume/Cart";
import ko from "knockout";
type ICancelableDataResult<TResult> = ClientEntities.ICancelableDataResult<TResult>;
/**
* The controller for VoidTenderLineView.
*/
export default class VoidTenderLineView extends Views.CustomViewControllerBase {
public currentCart: ko.Observable<string>;
public tenderLineId: string;
/**
* Creates a new instance of the VoidTenderLineView class.
* @param {Views.ICustomViewControllerContext} context The custom view controller context.
* @param {any} [options] The options used to initialize the view state.
*/
constructor(context: Views.ICustomViewControllerContext, options?: any) {
super(context);
this.state.title = "Void payment sample";
this.currentCart = ko.observable("");
this.tenderLineId = "";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Gets the current cart.
*/
public getCurrentCart(): void {
let getCartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest<GetCurrentCartClientResponse>();
this.context.runtime.executeAsync(getCartRequest).then((value: ICancelableDataResult<GetCurrentCartClientResponse>) => {
let cart: ProxyEntities.Cart = (<GetCurrentCartClientResponse>value.data).result;
let nonVoidedTenderLines: ProxyEntities.TenderLine[] = cart.TenderLines.filter((tenderLine: ProxyEntities.TenderLine) => {
return tenderLine.StatusValue !== ProxyEntities.TenderLineStatus.Voided;
});
if (ArrayExtensions.hasElements(nonVoidedTenderLines)) {
this.tenderLineId = nonVoidedTenderLines[0].TenderLineId;
}
this.currentCart(JSON.stringify(cart));
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Voids a tender line.
*/
public voidTenderLine(): void {
let voidTenderLineOperationRequest: VoidTenderLineOperationRequest<VoidTenderLineOperationResponse> =
new VoidTenderLineOperationRequest<VoidTenderLineOperationResponse>(this.tenderLineId, this.context.logger.getNewCorrelationId());
this.context.runtime.executeAsync(voidTenderLineOperationRequest).then((value: ICancelableDataResult<VoidTenderLineOperationResponse>) => {
if (value.canceled) {
this.currentCart("Void tender line is canceled");
} else {
this.currentCart(JSON.stringify(value.data.cart));
}
}).catch((err: any) => {
this.currentCart(JSON.stringify(err));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/NumericNumPadView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>NumericNumPadView</title>
</head>
<body>
<div class="NumericNumPadView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>NumericNumPad</h3>
<div class="pad8">
<div class="minWidth260 maxWidth320" id="NumericNumPad"></div>
<div class="h4" data-bind="text: 'onEnter - value: ' + numPadValue()"></div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
interface INumericNumPadOptions extends INumPadOptions<number>
{
decimalPrecision: number;
}
interface INumericNumPad extends INumPad<number, INumPadEventMap<number>>
{
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* The controller for NumericNumPadView.
*/
export default class NumericNumPadView extends Views.CustomViewControllerBase {
public numPad: Controls.INumericNumPad;
public numPadValue: Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "NumericNumPad sample";
this.numPadValue = ko.observable("");
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let inputBroker: INumPadInputBroker = null;
let numPadOptions: Controls.INumericNumPadOptions = {
decimalPrecision: 1,
globalInputBroker: inputBroker,
label: "NumPad label",
value: 0
};
let numPadRootElem: HTMLDivElement = element.querySelector("#NumericNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "NumericNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(value: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(value.toString());
this.numPad.value = 0;
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div data-bind="msPosNumericNumPad: numPad">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ListInputDialogView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ListInputDialog from "../../Dialogs/DialogSample/ListInputDialog";
import ko from "knockout";
/**
* The controller for ListInputDialogView.
*/
export default class ListInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ListInputDialog sample";
this.dialogResult = ko.observable("");
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the list input dialog sample.
*/
public openListInputDialog(): void {
let listInputDialog: ListInputDialog = new ListInputDialog();
listInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("ListInputDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AddTenderLineToCartView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AddTenderLineToCartView</title>
</head>
<body>
<div class="AddTenderLineToCartView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<div>
<div class="h4">Add tender line</div>
<button data-bind="click:onAddTenderLineToCartClick">Add tender line</button>
</div>
<textarea class="height220" data-bind="text: lastStatus"></textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/MenuView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
import ko from "knockout";
/**
* The controller for MenuView.
*/
export default class MenuView extends Views.CustomViewControllerBase {
public menu: Controls.IMenu;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "Menu sample";
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let menuOptions: Controls.IMenuOptions = {
commands: [
{
id: "MenuCommand1",
label: "Menu command 1",
},
{
id: "MenuCommand2",
label: "Menu command 2",
}
],
directionalHint: Controls.DirectionalHint.BottomCenter,
type: "button"
};
let menuRootElem: HTMLDivElement = element.querySelector("#menu") as HTMLDivElement;
this.menu = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Menu", menuOptions, menuRootElem);
this.menu.addEventListener("CommandInvoked", (eventData: { id: string }) => {
this.menuCommandClick(eventData.id);
});
}
/**
* Callback for menu.
* @param {MenuView} controller View controller.
* @param {Event} eventArgs Html event.
*/
public showMenu(controller: MenuView, eventArgs: Event): void {
this.menu.show(<HTMLElement>eventArgs.currentTarget);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for menu command.
* @param {string} args Menu command arguments.
*/
private menuCommandClick(args: string): void {
this.context.logger.logInformational("menuCommandClick: " + args);
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AddTenderLineToCartView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
AddTenderLineToCartClientRequest,
AddTenderLineToCartClientResponse,
GetCurrentCartClientRequest,
GetCurrentCartClientResponse
} from "PosApi/Consume/Cart";
import {
GetDeviceConfigurationClientRequest,
GetDeviceConfigurationClientResponse
} from "PosApi/Consume/Device";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ArrayExtensions, StringExtensions, ObjectExtensions } from "PosApi/TypeExtensions";
import * as Views from "PosApi/Create/Views";
import ko from "knockout";
type ICancelableDataResult<TResult> = ClientEntities.ICancelableDataResult<TResult>;
/**
* The controller for AppBarView.
*/
export default class AddTenderLineToCartView extends Views.CustomViewControllerBase {
public readonly lastStatus: ko.Observable<string>;
constructor(context: Views.ICustomViewControllerContext, options?: any) {
super(context);
this.state.title = "AddTenderLineToCartView sample";
this.lastStatus = ko.observable("");
}
/**
* Call add tender line to cart.
*/
public onAddTenderLineToCartClick(): void {
let getCartRequest: GetCurrentCartClientRequest<GetCurrentCartClientResponse> = new GetCurrentCartClientRequest<GetCurrentCartClientResponse>();
this.context.runtime.executeAsync(getCartRequest)
.then((getCurrentCartClientResponse: ICancelableDataResult<GetCurrentCartClientResponse>) => {
if (!getCurrentCartClientResponse.canceled) {
let cart: ProxyEntities.Cart = getCurrentCartClientResponse.data.result;
if (!ObjectExtensions.isNullOrUndefined(cart) &&
ArrayExtensions.hasElements(cart.CartLines)) {
let getDeviceConfigurationClientRequest: GetDeviceConfigurationClientRequest<GetDeviceConfigurationClientResponse> =
new GetDeviceConfigurationClientRequest();
this.context.runtime.executeAsync(getDeviceConfigurationClientRequest)
.then((getDeviceConfigurationClientResponse: ICancelableDataResult<GetDeviceConfigurationClientResponse>) => {
if (!getDeviceConfigurationClientResponse.canceled) {
// Get currency settings.
let deviceConfiguration: GetDeviceConfigurationClientResponse = getDeviceConfigurationClientResponse.data;
let cartTenderLine: ProxyEntities.CartTenderLine = {
Amount: 1, // $1
TenderTypeId: "1", // Cash
Currency: deviceConfiguration.result.Currency
};
let addTenderLineToCartClientRequest: AddTenderLineToCartClientRequest<AddTenderLineToCartClientResponse> =
new AddTenderLineToCartClientRequest<AddTenderLineToCartClientResponse>(cartTenderLine);
this.context.runtime.executeAsync(addTenderLineToCartClientRequest)
.then((addTenderLineToCartClientResponse: ICancelableDataResult<AddTenderLineToCartClientResponse>) => {
if (!addTenderLineToCartClientResponse.canceled) {
let cart: ProxyEntities.Cart = addTenderLineToCartClientResponse.data.result;
let tenderLinesGridCount: number = 0;
if (ArrayExtensions.hasElements(cart.TenderLines)) {
tenderLinesGridCount = cart.TenderLines.length;
}
let message: string = StringExtensions.format("Tender Lines Count: {0} \n Cart: \n {1}",
tenderLinesGridCount,
JSON.stringify(addTenderLineToCartClientResponse.data.result));
this.lastStatus(message);
} else {
this.lastStatus("addTenderLineToCartClientRequest: cancelled");
}
}).catch((err: any) => {
// Error will be thrown if total cart amount is negative already.
this.lastStatus(JSON.stringify(err));
});
}
}).catch((err: any) => {
this.lastStatus(JSON.stringify(err));
});
} else {
this.lastStatus("failed onAddTenderLineToCartClick - cart is not loaded or no lines in cart");
}
} else {
this.lastStatus("onAddTenderLineToCartClick: cancelled");
}
}).catch((err: any) => {
this.lastStatus(JSON.stringify(err));
});
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/NumericNumPadView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { INumPadInputSubscriber } from "PosApi/Consume/Peripherals";
import ko from "knockout";
/**
* The controller for NumericNumPadView.
*/
export default class NumericNumPadView extends Views.CustomViewControllerBase implements Views.INumPadInputSubscriberEndpoint {
public numPad: Controls.INumericNumPad;
public numPadValue: ko.Observable<string>;
public readonly implementsINumPadInputSubscriberEndpoint: true;
private readonly _numPadOptions: Controls.INumericNumPadOptions;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "NumericNumPad sample";
this.numPadValue = ko.observable("");
this.implementsINumPadInputSubscriberEndpoint = true; // Set the flag to true to indicate that the view implements INumPadInputSubscriberEndpoint.
this._numPadOptions = {
decimalPrecision: 1,
globalInputBroker: undefined,
label: "NumPad label",
value: 0
};
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let numPadRootElem: HTMLDivElement = element.querySelector("#NumericNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "NumericNumPad", this._numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Sets the numpad input subscriber for the custom view.
* @param numPadInputSubscriber The numpad input subscriber.
*/
public setNumPadInputSubscriber(numPadInputSubscriber: INumPadInputSubscriber): void {
this._numPadOptions.globalInputBroker = numPadInputSubscriber;
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(value: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(value.toString());
this.numPad.value = 0;
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TextInputDialogView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TextInputDialogView</title>
</head>
<body>
<div class="TextInputDialogView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>TextDialog</h3>
<div class="pad8">
<button id="btnOpenTextDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: openTextDialog">Open Text Input Dialog</button>
</div>
<div class="h4">Dialog result</div>
<div class="h4" data-bind="text: dialogResult"></div>
<div class="h4 padTop40">Text Dialog options interface</div>
<textarea class="height220">
export interface ITextInputDialogOptions extends IInputDialogOptions< ITextInputDialogResult > {
label?: string;
defaultText?: string;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* The controller for HeaderSplitViewView.
*/
export default class HeaderSplitViewView extends Views.CustomViewControllerBase {
constructor(context: Views.ICustomViewControllerContext) {
// Do not save in history
super(context);
this.state.title = "TextInputDialog sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the text input dialog sample.
*/
public openTextDialog(): void {
let textInputDialog: TextInputDialog = new TextInputDialog();
textInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("TextDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ListInputDialogView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ListInputDialogView</title>
</head>
<body>
<div class="ListInputDialogView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>ListDialog</h3>
<div class="pad8">
<button id="btnOpenInputNumDialog" data-bind="resx: { ariaLabel: 'string_49' }, click: openListInputDialog">open list input dialog</button>
</div>
<div class="h4">Dialog result</div>
<div class="h4" data-bind="text: dialogResult"></div>
<div class="h4 padTop40">ListDialog item and option interface</div>
<textarea class="height220">
export interface IListInputDialogItem {
label: string;
value: any;
}
export interface IListInputDialogOptions extends IInputDialogOptions<IListInputDialogResult>{
items: IListInputDialogItem[];
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import ListInputDialog from "../../Controls/DialogSample/ListInputDialog";
/**
* The controller for ListInputDialogView.
*/
export default class ListInputDialogView extends Views.CustomViewControllerBase {
public dialogResult: Observable<string>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ListInputDialog sample";
this.dialogResult = ko.observable("");
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
super.onReady(element);
// Customized binding
ko.applyBindings(this, element);
}
/**
* Opens the list input dialog sample.
*/
public openListInputDialog(): void {
let listInputDialog: ListInputDialog = new ListInputDialog();
listInputDialog.show(this.context, this.context.resources.getString("string_55"))
.then((result: string) => {
this.dialogResult(result);
}).catch((reason: any) => {
this.context.logger.logError("ListDialog: " + JSON.stringify(reason));
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/ToggleSwitchView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ToggleSwitchView</title>
</head>
<body>
<div class="ToggleSwitchView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>ToggleSwitch</h3>
<div class="pad8">
<div id="toggleSwitch">
</div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
export interface IToggleOptions extends IControlOptions {
labelOn: string;
labelOff: string;
enabled: boolean;
checked: boolean;
tabIndex: number;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for ToggleSwitchView.
*/
export default class ToggleSwitchView extends Views.CustomViewControllerBase {
public toggleSwitch: Controls.IToggle;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "ToggleSwitch sample";
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
let toggleOptions: Controls.IToggleOptions = {
tabIndex: 0,
enabled: true,
checked: false,
labelOn: "On",
labelOff: "Off",
};
let toggleRootElem: HTMLDivElement = element.querySelector("#toggleSwitch") as HTMLDivElement;
this.toggleSwitch = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "Toggle", toggleOptions, toggleRootElem);
this.toggleSwitch.addEventListener("CheckedChanged", (eventData: { checked: boolean }) => {
this.toggleSwitchChanged(eventData.checked);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
/**
* Callback for toggle switch.
* @param {boolean} checked True if checked, otherwise false.
*/
private toggleSwitchChanged(checked: boolean): void {
this.context.logger.logInformational("toggleSwitchChanged: " + checked);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="toggleSwitch">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/TransactionNumPadView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as ScanResults from "PosApi/Consume/ScanResults";
import * as Products from "PosApi/Consume/Products";
import { ITransactionNumPad, ITransactionNumPadOptions } from "PosApi/Consume/Controls";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { INumPadInputBroker, INumPadInputSubscriber } from "PosApi/Consume/Peripherals";
import { CustomViewControllerBase, IBarcodeScannerEndpoint, IMagneticStripeReaderEndpoint, INumPadInputSubscriberEndpoint } from "PosApi/Create/Views";
import { ErrorHelper } from "../../../Helpers";
import ko from "knockout";
type ScanSource = "BarcodeScanner" | "MagneticStripeReader" | "NumberPad";
/**
* The controller for TransactionNumPadView.
* The view implements INumPadInputSubscriberEndpoint which allows it to receive global keyboard input for the numpad.
* The view implements IBarcodeScannerEndpoint which allows it to receive barcode scanner events.
* The view implements IMagneticStripeReaderEndpoint which allows it to receive magnetic stripe reader events.
*/
export default class TransactionNumPadView extends CustomViewControllerBase implements INumPadInputSubscriberEndpoint, IMagneticStripeReaderEndpoint, IBarcodeScannerEndpoint {
public numPad: ITransactionNumPad;
public numPadValue: ko.Observable<string>;
public numPadQuantity: ko.Observable<string>;
public scanResult: ko.Observable<string>;
public scanResultSourceText: ko.Observable<string>;
public readonly implementsINumPadInputSubscriberEndpoint: true;
public readonly implementsIBarcodeScannerEndpoint: true; // Set the flag to true to indicate that the view implements IBarcodeScannerEndpoint.
public readonly implementsIMagneticStripeReaderEndpoint: true;
private _numPadInputSubscriber: INumPadInputSubscriber;
constructor(context: Views.ICustomViewControllerContext) {
// Do not save in history
super(context);
this.numPadValue = ko.observable("");
this.numPadQuantity = ko.observable("");
this.scanResult = ko.observable("");
this.scanResultSourceText = ko.observable("");
this._numPadInputSubscriber = undefined;
this.implementsINumPadInputSubscriberEndpoint = true; // Set the flag to true to indicate that the view implements INumPadInputSubscriberEndpoint.
this.implementsIBarcodeScannerEndpoint = true; // Set the flag to true to indicate that the view implements IBarcodeScannerEndpoint.
this.implementsIMagneticStripeReaderEndpoint = true; // Set the flag to true to indicate that the view implements IMagneticStripeReaderEndpoint.
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
// Customized binding
ko.applyBindings(this, element);
//Initialize numpad
let numPadOptions: ITransactionNumPadOptions = {
globalInputBroker: this._numPadInputSubscriber as INumPadInputBroker,
label: "NumPad label",
value: this.numPadValue()
};
let numPadRootElem: HTMLDivElement = element.querySelector("#TransactionNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "TransactionNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { quantity?: number; value: string }) => {
this.numPadValue(eventData.value);
if (eventData.quantity) {
this.numPadQuantity(eventData.quantity.toString());
} else {
this.numPadQuantity("");
}
this._getScanResult(eventData.value, "NumberPad");
});
}
/**
* Sets the numpad input subscriber for the custom view.
* @param numPadInputSubscriber The numpad input subscriber.
*/
public setNumPadInputSubscriber(numPadInputSubscriber: INumPadInputSubscriber): void {
this._numPadInputSubscriber = numPadInputSubscriber;
}
/**
* The callback for barcode scanner events.
* @param barcode The scanned barcode.
*/
public onBarcodeScanned(barcode: string): void {
this._getScanResult(barcode, "BarcodeScanner");
}
/**
* The callback for magnetic stripe reader events.
* @param cardInfo The card information.
*/
public onMagneticStripeRead(cardInfo: ClientEntities.ICardInfo): void {
this._getScanResult(cardInfo.CardNumber, "MagneticStripeReader");
}
/**
* Callback for numpad.
* @param {string} scanText Numpad current value.
*/
private _getScanResult(scanText: string, scanSource: ScanSource): void {
this.numPad.value = "";
this.scanResult("");
this.scanResultSourceText("Scan text source: " + scanSource);
if (scanSource !== "NumberPad") {
this.numPadQuantity("");
this.numPadValue("");
}
this.state.isProcessing = true; // Setting this flag to true will show the processing indicator (spinner) on the view.
let getScanResultClientRequest: ScanResults.GetScanResultClientRequest<ScanResults.GetScanResultClientResponse> =
new ScanResults.GetScanResultClientRequest(scanText);
this.context.runtime.executeAsync(getScanResultClientRequest)
.then((response: ClientEntities.ICancelableDataResult<ScanResults.GetScanResultClientResponse>): void => {
this.state.isProcessing = false; // Setting this flag to false will hide the processing indicator.
if (ObjectExtensions.isNullOrUndefined(response.data)
|| ObjectExtensions.isNullOrUndefined(response.data.result)) {
this.scanResult("Error");
} else {
let scanResult: ProxyEntities.ScanResult = response.data.result;
let barcodeMaskType: ProxyEntities.BarcodeMaskType = scanResult.MaskTypeValue;
switch (barcodeMaskType) {
case ProxyEntities.BarcodeMaskType.Item:
// If the scanned text maps to a product bar code based on the bar code mask,
// but the product associated with the bar code is not found, the Product field
// on the scanResult won't be set.
let product: ProxyEntities.SimpleProduct = scanResult.Product;
if (ObjectExtensions.isNullOrUndefined(product)) {
this.scanResult("Product error: The product associated with the bar code was not found.");
} else {
// If a KitMaster product is passed on the request below, its default configuration will be loaded.
if (product.ProductTypeValue === ProxyEntities.ProductType.Master) {
let selectPVClientRequest: Products.SelectProductVariantClientRequest<Products.SelectProductVariantClientResponse> =
new Products.SelectProductVariantClientRequest(product);
this.context.runtime.executeAsync(selectPVClientRequest)
.then((response: ClientEntities.ICancelableDataResult<Products.SelectProductVariantClientResponse>): void => {
if (response.canceled) {
this.scanResult("Product variant selection canceled.");
} else {
this.scanResult("Product variant: " + response.data.result.Name);
}
}).catch((reason: any) => {
this.context.logger.logError("Select product variant error: " + JSON.stringify(reason));
});
} else {
this.scanResult("Product: " + product.Name);
}
}
break;
case ProxyEntities.BarcodeMaskType.Customer:
// If the scanned text maps to a customer bar code based on the bar code mask,
// but the customer associated with the bar code is not found, the Customer field
// on the scanResult won't be set.
if (ObjectExtensions.isNullOrUndefined(scanResult.Customer)) {
this.scanResult("Customer error: The customer associated with the bar code was not found.");
} else {
this.scanResult("Customer: " + scanResult.Customer.Name);
}
break;
case ProxyEntities.BarcodeMaskType.LoyaltyCard:
// If the scanned text maps to a loyalty card bar code based on the bar code mask,
// but the loyalty card associated with the bar code is not found, the Loyalty card field
// on the scanResult won't be set.
if (ObjectExtensions.isNullOrUndefined(scanResult.LoyaltyCard)) {
this.scanResult("Customer error: The customer associated with the bar code was not found.");
} else {
this.scanResult("LoyaltyCard: " + scanResult.LoyaltyCard.CardNumber);
}
break;
case ProxyEntities.BarcodeMaskType.DiscountCode:
this.scanResult("Discount code: " + scanResult.Barcode.DiscountCode);
break;
case ProxyEntities.BarcodeMaskType.Coupon:
this.scanResult("Coupon code: " + scanResult.Barcode.CouponId);
break;
case ProxyEntities.BarcodeMaskType.None:
this.scanResult("Nothing was found");
break;
default:
this.scanResult("The bar code type that was scanned is not supported.");
break;
}
}
}).catch((reason: any) => {
this.state.isProcessing = false; // Setting this flag to false will hide the processing indicator.
ErrorHelper.displayErrorAsync(this.context, reason);
});
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/CurrencyNumPadView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CurrencyNumPadView</title>
</head>
<body>
<div class="CurrencyNumPadView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>CurrencyNumPad</h3>
<div class="pad8">
<div class="minWidth260 maxWidth320" id="CurrencyNumPad"></div>
<div class="h4" data-bind="text: 'onEnter - value: ' + numPadValue()"></div>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
interface ICurrencyNumPadOptions extends INumPadOptions<number>
{
currencyCode: string;
}
interface ICurrencyNumPad extends INumPad<number, INumPadEventMap<number>>
{
currencyCode: string;
}
</textarea>
<div class="h4 padTop40">Controller syntax</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import * as Controls from "PosApi/Consume/Controls";
/**
* The controller for CurrencyNumPadView.
*/
export default class CurrencyNumPadView extends Views.ExtensionViewControllerBase {
public numPad: Controls.ICurrencyNumPad;
public numPadValue: Observable<string>;
constructor(context: Views.IExtensionViewControllerContext) {
// Do not save in history
super(context, false);
this.state.title = "CurrencyNumPad sample";
this.numPadValue = ko.observable("");
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let inputBroker: INumPadInputBroker = null;
let numPadOptions: Controls.INumericNumPadOptions = {
decimalPrecision: 3,
globalInputBroker: inputBroker,
label: "NumPad label",
value: 0
};
let numPadRootElem: HTMLDivElement = element.querySelector("#CurrencyNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "CurrencyNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(value: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(value.toString());
this.numPad.value = 0;
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="CurrencyNumPad">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/AlphanumericNumPadView.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Views from "PosApi/Create/Views";
import * as Controls from "PosApi/Consume/Controls";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { INumPadInputSubscriber } from "PosApi/Consume/Peripherals";
import ko from "knockout";
/**
* The controller for AlphanumericNumPadView.
*/
export default class AlphanumericNumPadView extends Views.CustomViewControllerBase implements Views.INumPadInputSubscriberEndpoint {
public numPad: Controls.IAlphanumericNumPad;
public numPadValue: ko.Observable<string>;
public implementsINumPadInputSubscriberEndpoint: true;
private _numpadInputSubscriber: INumPadInputSubscriber;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this.state.title = "AlphanumericNumPad sample";
this.numPadValue = ko.observable("");
this.implementsINumPadInputSubscriberEndpoint = true; // Set the flag to true to indicate that the view implements INumPadInputSubscriberEndpoint.
}
/**
* Bind the html element with view controller.
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
//Initialize numpad
let numPadOptions: Controls.IAlphanumericNumPadOptions = {
globalInputBroker: this._numpadInputSubscriber as Commerce.Peripherals.INumPadInputBroker,
label: "NumPad Label",
value: this.numPadValue()
};
let numPadRootElem: HTMLDivElement = element.querySelector("#AlphanumericNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "AlphanumericNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this.onNumPadEnter(eventData.value);
});
}
/**
* Sets the num pad input subscriber for the custom view.
* @param numPadInputSubscriber The numpad input subscriber.
*/
public setNumPadInputSubscriber(numPadInputSubscriber: INumPadInputSubscriber): void {
this._numpadInputSubscriber = numPadInputSubscriber;
}
/**
* Callback for numpad.
* @param {number} value Numpad current value.
*/
private onNumPadEnter(result: Commerce.Extensibility.NumPadValue): void {
this.numPadValue(result.toString());
this.numPad.value = "";
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/Samples/LoaderView.html | <!--
HTMLLint is an internal tool that fails on this file due to non-localized example labels,
there is no need for this comment and the one below in real-world extensions.
-->
<!-- HTMLLint Disable LabelExistsValidator -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>LoaderView</title>
</head>
<body>
<div class="LoaderView">
<div class="grow marginBottom48 scrollY">
<div class="pad20 col width680">
<h3>Loader</h3>
<div class="pad8">
<button data-bind="click: showLoaderClick">Show loader</button>
</div>
<div class="h4 padTop40">ViewModel interface</div>
<textarea class="height220">
import * as Views from "PosApi/Create/Views";
import * as HeaderSplitView from "PosUISdk/Controls/HeaderSplitView";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* The controller for LoaderView.
*/
export default class LoaderView extends Views.CustomViewControllerBase {
private _isLoaderVisible: Observable<boolean>;
constructor(context: Views.ICustomViewControllerContext) {
super(context);
this._isLoaderVisible = ko.observable(false);
this.state.title = "Loader sample"
this.state.isProcessing = this._isLoaderVisible();
}
/**
* Show loader control.
*/
public showLoaderClick(): void {
this._isLoaderVisible(true);
window.setTimeout(() => {
this._isLoaderVisible(false);
}, 3000);
}
/**
* Bind the html element with view controller.
*
* @param {HTMLElement} element DOM element.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Called when the object is disposed.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
</textarea>
<div class="h4 padTop40">HTML syntax</div>
<textarea class="height220">
<div id="loader">
</div>
</textarea>
</div>
</div>
</div>
</body>
</html>
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Views/BaseClasses/KnockoutExtensionViewModelBase.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
"use strict";
import { ObjectExtensions } from "PosApi/TypeExtensions";
/**
* Represents the base class for knockout based view models.
* @remarks Implements a dispose method to ensure that resources are properly released.
*/
abstract class KnockoutExtensionViewModelBase implements Commerce.IDisposable {
/**
* Disposes of the view model's resources.
*/
public dispose(): void {
ObjectExtensions.disposeAllProperties(this);
}
}
export default KnockoutExtensionViewModelBase; | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/GiftCardNumberDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
ShowAlphanumericInputDialogClientRequest, ShowAlphanumericInputDialogClientResponse,
IAlphanumericInputDialogOptions, IAlphanumericInputDialogResult, ShowAlphanumericInputDialogError
} from "PosApi/Consume/Dialogs";
import { GetGiftCardByIdServiceRequest, GetGiftCardByIdServiceResponse } from "PosApi/Consume/Payments";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
/**
* (Sample) Dialog for getting a gift card entity by its number.
*/
export default class GiftCardNumberDialog {
/**
* Shows the GiftCardNumberDialog.
* @param {IExtensionContext} context The extension context contained runtime to execute async requests.
* @param {string} correlationId The correlation identifier.
* @return {Promise<ProxyEntities.GiftCard>} The result from message dialog.
*/
public show(context: IExtensionContext, correlationId: string): Promise<ClientEntities.ICancelableDataResult<ProxyEntities.GiftCard>> {
let giftCard: ProxyEntities.GiftCard = null;
let alphanumericInputDialogOptions: IAlphanumericInputDialogOptions = {
title: "Gift card balance",
subTitle: "Enter the card number to check the balance on the gift card.",
numPadLabel: "Card number",
enableBarcodeScanner: true,
enableMagneticStripReader: true,
onBeforeClose: ((result: ClientEntities.ICancelableDataResult<IAlphanumericInputDialogResult>): Promise<void> => {
return this._onBeforeClose(result, context, correlationId).then((result: ProxyEntities.GiftCard) => {
giftCard = result;
});
})
};
let dialogRequest: ShowAlphanumericInputDialogClientRequest<ShowAlphanumericInputDialogClientResponse> =
new ShowAlphanumericInputDialogClientRequest<ShowAlphanumericInputDialogClientResponse>(alphanumericInputDialogOptions);
return context.runtime.executeAsync(dialogRequest).then((result: ClientEntities.ICancelableDataResult<ShowAlphanumericInputDialogClientResponse>) => {
return Promise.resolve({ canceled: result.canceled, data: result.canceled ? null : giftCard });
});
}
/**
* Decides what to do with the dialog based on the button pressed and input.
* @param {ClientEntities.ICancelableDataResult<IAlphanumericInputDialogResult>} result Input result of dialog.
* @param {IExtensionContext} context The context object passed to all POS extensions.
* @param {string} correlationId A telemetry correlation ID, used to group events logged from this request together with the calling context.
* @returns {Promise<ProxyEntities.GiftCard>} The returned promise.
*/
private _onBeforeClose(
result: ClientEntities.ICancelableDataResult<IAlphanumericInputDialogResult>,
context: IExtensionContext,
correlationId: string): Promise<ProxyEntities.GiftCard> {
if (!result.canceled) {
if (!ObjectExtensions.isNullOrUndefined(result.data)) {
const incorrectNumberMessage: string = "The gift card number does not exist. Enter another number.";
return this._getGiftCardByIdAsync(result.data.value, context, correlationId).then((result: ProxyEntities.GiftCard) => {
if (!ObjectExtensions.isNullOrUndefined(result)) {
return Promise.resolve(result);
} else {
let error: ShowAlphanumericInputDialogError = new ShowAlphanumericInputDialogError(incorrectNumberMessage);
return Promise.reject(error);
}
}).catch((reason: any) => {
let error: ShowAlphanumericInputDialogError = new ShowAlphanumericInputDialogError(incorrectNumberMessage);
return Promise.reject(error);
});
} else {
const noNumberMessage: string = "The gift card number is required. Enter the gift card number, and then try again.";
let error: ShowAlphanumericInputDialogError = new ShowAlphanumericInputDialogError(noNumberMessage);
return Promise.reject(error);
}
} else {
return Promise.resolve(null);
}
}
/**
* Gets the gift card by card ID.
* @param {string} giftCardId The gift card ID.
* @param {IExtensionContext} context The context object passed to all POS extensions.
* @param {string} correlationId A telemetry correlation ID, used to group events logged from this request together with the calling context.
* @returns {Promise<Proxy.Entities.GiftCard>} The async result.
*/
private _getGiftCardByIdAsync(giftCardId: string, context: IExtensionContext, correlationId: string): Promise<ProxyEntities.GiftCard> {
let request: GetGiftCardByIdServiceRequest<GetGiftCardByIdServiceResponse> = new GetGiftCardByIdServiceRequest(correlationId, giftCardId);
return context.runtime.executeAsync(request).then((response: ClientEntities.ICancelableDataResult<GetGiftCardByIdServiceResponse>) => {
return Promise.resolve(response.canceled ? null : response.data.giftCard);
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/DialogSample.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Sample Dialog</title>
<link rel="stylesheet" href="DialogSampleStyles.min.css" />
</head>
<body>
<!-- HTMLLint Disable LabelExistsValidator -->
<div class="sampleExtension_dialogSample col grow">
<div>
<div class="h4">Enter value:</div>
</div>
<div>
<input type="text" data-bind="value: userEnteredValue" />
</div>
<div class="grow"></div>
<div class="col">
<button class="primaryButton stretch" data-bind="click: enableOkClicked">Enable Ok</button>
<button class="primaryButton stretch" data-bind="click: closeDialogClicked">Close dialog</button>
</div>
</div>
</body>
</html> | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/DialogSampleModule.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Dialogs from "PosApi/Create/Dialogs";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ISampleDialogResult } from "./IDialogSampleResult";
import ko from "knockout";
type SampleMessageDialogResolve = (value: ISampleDialogResult) => void;
type SampleMessageDialogReject = (reason: any) => void;
export default class DialogSampleModule extends Dialogs.ExtensionTemplatedDialogBase {
public messagePassedToDialog: ko.Observable<string>;
public userEnteredValue: ko.Observable<string>;
private resolve: SampleMessageDialogResolve;
constructor() {
super();
this.userEnteredValue = ko.observable("");
}
/**
* Initializes the dialog.
* @param element The element to bind to.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
public open(message: string): Promise<ISampleDialogResult> {
this.userEnteredValue(message);
let promise: Promise<ISampleDialogResult> = new Promise((resolve: SampleMessageDialogResolve, reject: SampleMessageDialogReject) => {
this.resolve = resolve;
let option: Dialogs.ITemplatedDialogOptions = {
title: "Templated dialog sample",
subTitle: "Dialog sub title",
onCloseX: this.onCloseX.bind(this),
button1: {
id: "Button1",
label: "OK",
isPrimary: true,
onClick: this.button1ClickHandler.bind(this)
},
button2: {
id: "Button2",
label: "Cancel",
onClick: this.button2ClickHandler.bind(this)
}
};
this.openDialog(option);
});
this.setButtonDisabledState("Button1", true);
return promise;
}
/**
* Close dialog button clicked.
*/
public closeDialogClicked(): void {
this.closeDialog();
this.resolvePromise("Closed");
}
/**
* Enable the OK button.
*/
public enableOkClicked(): void {
this.setButtonDisabledState("Button1", false);
this.resolvePromise("Closed");
}
/**
* Close button clicked.
* @returns {boolean} True if the dialog should close, false otherwise.
*/
private onCloseX(): boolean {
this.resolvePromise("Closed");
return true;
}
/**
* Handle the OK button click.
*/
private button1ClickHandler(): boolean {
this.resolvePromise("Everything ok");
return true;
}
/**
* Handle the Cancel button click.
*/
private button2ClickHandler(): boolean {
this.resolvePromise("Canceled");
return false;
}
/**
* Resolve the promise.
* @param result The result to resolve the promise with.
*/
private resolvePromise(result: string): void {
if (ObjectExtensions.isFunction(this.resolve)) {
this.resolve(<ISampleDialogResult>{
selectedValue: result
});
this.resolve = null;
}
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/TextInputDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
ShowTextInputDialogClientRequest, ShowTextInputDialogClientResponse, ITextInputDialogOptions,
ShowTextInputDialogError, ITextInputDialogResult
} from "PosApi/Consume/Dialogs";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities } from "PosApi/Entities";
export default class TextInputDialog {
/**
* Shows the text input dialog.
* @param context The extension context.
* @param message The message to display in the dialog.
* @returns {Promise<string>} The promise.
*/
public show(context: IExtensionContext, message: string): Promise<string> {
let promise: Promise<string> = new Promise<string>((resolve: (num: string) => void, reject: (reason?: any) => void) => {
let textInputDialogOptions: ITextInputDialogOptions = {
title: context.resources.getString("string_55"), // string that denotes the optional title on the text dialog
subTitle: context.resources.getString("string_55"), // string that denotes the optional subtitle under the title
label: "Enter Text",
defaultText: "Hello World",
onBeforeClose: this.onBeforeClose.bind(this)
};
let dialogRequest: ShowTextInputDialogClientRequest<ShowTextInputDialogClientResponse> =
new ShowTextInputDialogClientRequest<ShowTextInputDialogClientResponse>(textInputDialogOptions);
context.runtime.executeAsync(dialogRequest)
.then((result: ClientEntities.ICancelableDataResult<ShowTextInputDialogClientResponse>) => {
if (!result.canceled) {
context.logger.logInformational("Text Entered in Box: " + result.data.result.value);
resolve(result.data.result.value);
} else {
context.logger.logInformational("Text Dialog is canceled.");
resolve(null);
}
}).catch((reason: any) => {
context.logger.logError(JSON.stringify(reason));
reject(reason);
});
});
return promise;
}
/**
* Decides what to do with the dialog based on the button pressed and input.
* @param {ClientEntities.ICancelableDataResult<ITextInputDialogResult>} result Input result of dialog.
* @returns {Promise<void>} The returned promise.
*/
private onBeforeClose(result: ClientEntities.ICancelableDataResult<ITextInputDialogResult>): Promise<void> {
if (!result.canceled) {
if (!ObjectExtensions.isNullOrUndefined(result.data)) {
if (result.data.value === "Hello World") {
let error: ShowTextInputDialogError = new ShowTextInputDialogError("Invalid input. Enter different value.",
"New Hello World" /* new default value */);
return Promise.reject(error);
} else {
return Promise.resolve();
}
} else {
// Should not reach this branch
let error: ShowTextInputDialogError = new ShowTextInputDialogError("Data result is null.");
return Promise.reject(error);
}
} else {
// Note that if result.cancelled is true, then result.data is null
let error: ShowTextInputDialogError = new ShowTextInputDialogError("Cannot close dialog. Must enter value");
return Promise.reject(error);
}
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/DialogSampleStyles.min.css | .sampleExtension_dialogSample .blueBorder{border:solid red 1px}
/*# sourceMappingURL=DialogSampleStyles.min.css.map */
| 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/MessageDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ShowMessageDialogClientRequest, ShowMessageDialogClientResponse, IMessageDialogOptions } from "PosApi/Consume/Dialogs";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ClientEntities } from "PosApi/Entities";
export default class MessageDialog {
/**
* Shows the message dialog.
* @param context The extension context.
* @param message The message to display in the dialog.
* @returns {Promise<string>} The promise.
*/
public static show(context: IExtensionContext, message: string): Promise<string> {
let promise: Promise<string> = new Promise<string>((resolve: (value: string) => void, reject: (reason?: any) => void) => {
let messageDialogOptions: IMessageDialogOptions = {
title: "Extension Message Dialog",
message: message,
showCloseX: true, // Result for dialog will be return as canceled when "X" is clicked to close dialog.
button1: {
id: "button1OK",
label: "OK",
result: "OKResult"
},
button2: {
id: "Button2Cancel",
label: "Cancel",
result: "CancelResult"
}
};
let dialogRequest: ShowMessageDialogClientRequest<ShowMessageDialogClientResponse> =
new ShowMessageDialogClientRequest<ShowMessageDialogClientResponse>(messageDialogOptions);
context.runtime.executeAsync(dialogRequest).then((result: ClientEntities.ICancelableDataResult<ShowMessageDialogClientResponse>) => {
if (!result.canceled) {
context.logger.logInformational("MessageDialog result: " + result.data.result.dialogResult);
resolve(result.data.result.dialogResult);
} else {
context.logger.logInformational("Request for MessageDialog is canceled.");
resolve(null);
}
}).catch((reason: any) => {
context.logger.logError(JSON.stringify(reason));
reject(reason);
});
});
return promise;
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/AlphanumericInputDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
ShowAlphanumericInputDialogClientRequest, ShowAlphanumericInputDialogClientResponse,
IAlphanumericInputDialogOptions, ShowAlphanumericInputDialogError, IAlphanumericInputDialogResult
} from "PosApi/Consume/Dialogs";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities } from "PosApi/Entities";
export default class AlphanumericInputDialog {
/**
* Shows the alphanumeric input dialog.
* @param {IExtensionContext} context The extension context contained runtime to execute async requests.
* @param {string} message The message to display in the dialog.
* @returns {Promise<string>} The promise with the input value.
*/
public show(context: IExtensionContext, message: string): Promise<string> {
let promise: Promise<string> = new Promise<string>((resolve: (num: string) => void, reject: (reason?: any) => void) => {
let subTitleMsg: string = "Enter voice call verification code or void transaction.\n\n"
+ "The merchant is responsible for entering a valid Auth Code.\n\n"
+ "If an invalid auth code is sent to the bank, the batch cannot be settled and the merchant may get fined ($50 for each instance currently).";
let alphanumericInputDialogOptions: IAlphanumericInputDialogOptions = {
title: "Voice Call",
subTitle: subTitleMsg,
numPadLabel: "Please enter code:",
defaultValue: "abc123",
onBeforeClose: this.onBeforeClose.bind(this)
};
let dialogRequest: ShowAlphanumericInputDialogClientRequest<ShowAlphanumericInputDialogClientResponse> =
new ShowAlphanumericInputDialogClientRequest<ShowAlphanumericInputDialogClientResponse>(alphanumericInputDialogOptions);
context.runtime.executeAsync(dialogRequest)
.then((result: ClientEntities.ICancelableDataResult<ShowAlphanumericInputDialogClientResponse>) => {
if (!result.canceled) {
context.logger.logInformational("AlphanumericInputDialog result: " + result.data.result.value);
resolve(result.data.result.value);
} else {
context.logger.logInformational("AlphanumericInputDialog is canceled.");
resolve(null);
}
}).catch((reason: any) => {
context.logger.logError(JSON.stringify(reason));
reject(reason);
});
});
return promise;
}
/**
* Decides what to do with the dialog based on the button pressed and input.
* @param {ClientEntities.ICancelableDataResult<IAlphanumericInputDialogResult>} result Input result of dialog.
* @returns {Promise<void>} The returned promise.
*/
private onBeforeClose(result: ClientEntities.ICancelableDataResult<IAlphanumericInputDialogResult>): Promise<void> {
if (!result.canceled) {
if (!ObjectExtensions.isNullOrUndefined(result.data)) {
if (result.data.value === "111") {
let error: ShowAlphanumericInputDialogError =
new ShowAlphanumericInputDialogError("Invalid input. Enter different value.", "2121" /* new default value */);
return Promise.reject(error);
} else {
return Promise.resolve();
}
} else {
// Should not reach this branch
let error: ShowAlphanumericInputDialogError = new ShowAlphanumericInputDialogError("Data result is null.");
return Promise.reject(error);
}
} else {
// Note that if result.cancelled is true, then result.data is null
let error: ShowAlphanumericInputDialogError =
new ShowAlphanumericInputDialogError("Cannot close dialog. Must enter value");
return Promise.reject(error);
}
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/ListInputDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
ShowListInputDialogClientRequest, ShowListInputDialogClientResponse, IListInputDialogOptions,
IListInputDialogItem, ShowListInputDialogError, IListInputDialogResult
} from "PosApi/Consume/Dialogs";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities } from "PosApi/Entities";
export default class ListInputDialog {
/**
* Shows the list input dialog.
* @param context The extension context.
* @param message The message to display in the dialog.
* @returns {Promise<string>} The promise.
*/
public show(context: IExtensionContext, message: string): Promise<string> {
let promise: Promise<string> = new Promise<string>((resolve: (num: string) => void, reject: (reason?: any) => void) => {
/* List data that you may want to display */
let listItems: ListData[] = [new ListData("Houston", "1"), new ListData("Seattle", "2"), new ListData("Boston", "3")];
/* Convert your list data into an array of IListInputDialogItem */
let convertedListItems: IListInputDialogItem[] = listItems.map((listItem: ListData): IListInputDialogItem => {
let convertedListItem: IListInputDialogItem = {
label: listItem.label, // string to be displayed for the given item
value: listItem // list data item that the string label represents
};
return convertedListItem;
});
let listInputDialogOptions: IListInputDialogOptions = {
title: context.resources.getString("string_55"), // string that denotes the optional title on the list dialog
subTitle: context.resources.getString("string_55"), // string that denotes the optional subtitle under the title
items: convertedListItems,
onBeforeClose: this.onBeforeClose.bind(this)
};
let dialogRequest: ShowListInputDialogClientRequest<ShowListInputDialogClientResponse> =
new ShowListInputDialogClientRequest<ShowListInputDialogClientResponse>(listInputDialogOptions);
context.runtime.executeAsync(dialogRequest)
.then((result: ClientEntities.ICancelableDataResult<ShowListInputDialogClientResponse>) => {
if (!result.canceled) {
/* The response returns the selected IListInputDialogItem */
let selectedItem: IListInputDialogItem = result.data.result.value;
let selectedListData: ListData = selectedItem.value;
context.logger.logInformational("Selected ListData label: " + selectedListData.label);
context.logger.logInformational("Selected ListData value: " + selectedListData.value);
resolve(selectedItem.label);
} else {
context.logger.logInformational("ListInputDialog is canceled.");
resolve(null);
}
}).catch((reason: any) => {
context.logger.logError(JSON.stringify(reason));
reject(reason);
});
});
return promise;
}
/**
* Decides what to do with the dialog based on the list item pressed.
* @param {ClientEntities.ICancelableDataResult<IListInputDialogResult>} result Selected result of dialog.
* @returns {Promise<void>} The returned promise.
*/
private onBeforeClose(result: ClientEntities.ICancelableDataResult<IListInputDialogResult>): Promise<void> {
if (!result.canceled) {
if (!ObjectExtensions.isNullOrUndefined(result.data)) {
if (result.data.value.label === "Houston") {
/* new List data that you may want to display after displaying error message */
let listItems: ListData[] = [new ListData("Pittsburgh", "1"), new ListData("Seattle", "2"), new ListData("Boston", "3")];
let convertedListItems: IListInputDialogItem[] = listItems.map((listItem: ListData): IListInputDialogItem => {
let convertedListItem: IListInputDialogItem = {
label: listItem.label, // string to be displayed for the given item
value: listItem // list data item that the string label represents
};
return convertedListItem;
});
let error: ShowListInputDialogError = new ShowListInputDialogError
("Invalid item selected. Select different item.", convertedListItems /* updated list items to display */);
return Promise.reject(error);
} else {
return Promise.resolve();
}
} else {
// Should not reach this branch
let error: ShowListInputDialogError = new ShowListInputDialogError("Data result is null.");
return Promise.reject(error);
}
} else {
// Note that if result.cancelled is true, then result.data is null
let error: ShowListInputDialogError = new ShowListInputDialogError("Cannot close dialog. Must select item.");
return Promise.reject(error);
}
}
}
class ListData {
label: string;
value: string;
constructor(label: string, value: string) {
this.label = label;
this.value = value;
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/NumericInputDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import {
ShowNumericInputDialogClientRequest, ShowNumericInputDialogClientResponse,
INumericInputDialogOptions, INumericInputDialogResult, ShowNumericInputDialogError
} from "PosApi/Consume/Dialogs";
import { IExtensionContext } from "PosApi/Framework/ExtensionContext";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities } from "PosApi/Entities";
export default class NumericInputDialog {
/**
* Shows the numeric input dialog.
* @param context The extension context.
* @param message The message to display in the dialog.
* @returns {Promise<string>} The promise.
*/
public show(context: IExtensionContext, message: string): Promise<string> {
let promise: Promise<string> = new Promise<string>((resolve: (num: string) => void, reject: (reason?: any) => void) => {
let subTitleMsg: string = "Enter voice call verification code or void transaction.\n\n"
+ "The merchant is responsible for entering a valid Auth Code.\n\n"
+ "If an invalid auth code is sent to the bank, the batch cannot be settled and the merchant may get fined ($50 for each instance currently).";
let numericInputDialogOptions: INumericInputDialogOptions = {
title: "Voice Call",
subTitle: subTitleMsg,
numPadLabel: "Please enter code:",
defaultNumber: "0000",
onBeforeClose: this.onBeforeClose.bind(this)
};
let dialogRequest: ShowNumericInputDialogClientRequest<ShowNumericInputDialogClientResponse> =
new ShowNumericInputDialogClientRequest<ShowNumericInputDialogClientResponse>(numericInputDialogOptions);
context.runtime.executeAsync(dialogRequest)
.then((result: ClientEntities.ICancelableDataResult<ShowNumericInputDialogClientResponse>) => {
if (!result.canceled) {
context.logger.logInformational("NumericInputDialog result: " + result.data.result.value);
resolve(result.data.result.value);
} else {
context.logger.logInformational("NumericInputDialog is canceled.");
resolve(null);
}
}).catch((reason: any) => {
context.logger.logError(JSON.stringify(reason));
reject(reason);
});
});
return promise;
}
/**
* Decides what to do with the dialog based on the button pressed and input.
* @param {ClientEntities.ICancelableDataResult<INumericInputDialogResult>} result Input result of dialog.
* @returns {Promise<void>} The returned promise.
*/
private onBeforeClose(result: ClientEntities.ICancelableDataResult<INumericInputDialogResult>): Promise<void> {
if (!result.canceled) {
if (!ObjectExtensions.isNullOrUndefined(result.data)) {
if (result.data.value === "111") {
let error: ShowNumericInputDialogError = new ShowNumericInputDialogError
("Invalid input. Enter different value.", "2121" /* new default value */);
return Promise.reject(error);
} else {
return Promise.resolve();
}
} else {
// Should not reach this branch.
let error: ShowNumericInputDialogError = new ShowNumericInputDialogError("Data result is null.");
return Promise.reject(error);
}
} else {
// Note that if result.cancelled is true, then result.data is null.
let error: ShowNumericInputDialogError = new ShowNumericInputDialogError("Cannot close dialog. Must enter value");
return Promise.reject(error);
}
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/DialogSample/IDialogSampleResult.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
export interface ISampleDialogResult {
selectedValue: string;
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/GiftCardBalanceDialog/GiftCardBalanceDialog.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Gift card balance</title>
</head>
<body>
<!-- HTMLLint Disable LabelExistsValidator -->
<div class="sampleExtension_giftCardBalanceDialogSample col grow">
<div>
<div class="h4 secondaryFontColor">Card number</div>
<div class="h1" data-bind="text: number"></div>
</div>
<div>
<div class="h4 secondaryFontColor">Balance</div>
<div class="h1" data-bind="text: balance"></div>
</div>
<div>
<div class="h4 secondaryFontColor">Expiration date</div>
<div class="h1" data-bind="text: expirationDate"></div>
</div>
</div>
</body>
</html> | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/GiftCardBalanceDialog/GiftCardBalanceDialogTypes.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
/**
* The result from the gift card balance dialog.
*/
export interface IGiftCardBalanceDialogResult {
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/GiftCardBalanceDialog/GiftCardBalanceDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import * as Dialogs from "PosApi/Create/Dialogs";
import { DateExtensions } from "PosApi/TypeExtensions";
import { ProxyEntities } from "PosApi/Entities";
import { IGiftCardBalanceDialogResult } from "./GiftCardBalanceDialogTypes";
import ko from "knockout";
export default class GiftCardBalanceDialog extends Dialogs.ExtensionTemplatedDialogBase {
public balance: ko.Observable<string>;
public expirationDate: ko.Observable<string>;
public number: ko.Observable<string>;
constructor() {
super();
this.balance = ko.observable("");
this.expirationDate = ko.observable("");
this.number = ko.observable("");
}
/**
* The function that is called when the dialog element is ready.
* @param {HTMLElement} element The element containing the dialog.
*/
public onReady(element: HTMLElement): void {
ko.applyBindings(this, element);
}
/**
* Opens the dialog.
* @returns {Promise<IBarcodeMsrDialogResult>} The promise that represents showing the dialog and contains the dialog result.
*/
public open(giftCard: ProxyEntities.GiftCard): Promise<IGiftCardBalanceDialogResult> {
this.balance(giftCard.BalanceCurrencyCode.concat(" ", giftCard.Balance.toString()));
this.expirationDate(DateExtensions.now.toDateString());
this.number(giftCard.Id);
let promise: Promise<IGiftCardBalanceDialogResult> =
new Promise((resolve: (value: IGiftCardBalanceDialogResult) => void, reject: (reason: any) => void) => {
let option: Dialogs.ITemplatedDialogOptions = {
title: "Gift card balance",
onCloseX: () => {
resolve({});
return true;
},
button1: {
id: "CloseButton",
label: "Close",
isPrimary: true,
onClick: () => {
resolve({});
return true;
}
}
};
this.openDialog(option);
});
return promise;
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/BarcodeMsrDialog/readme.md | # Barcode MSR Dialog Sample
## Overview
This sample shows how to create a new dialog that listens to barcode scanner and magnetic stripe reader events. The sample dialog is used on the fulfillment line view in POS to scan a barcode to select the matching fulfillment line.

## Running the sample
- Open the solution in Visual Studio 2022
- Restore the nuget packages for the solution
- Build the solution
- Follow the steps outlined [here](https://docs.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/debug-pos-extension#run-and-debug-cloud-pos) on how to debug extensions
- Sign in to Cloud POS
- Navigate to the fulfillment line view and click the "Scan and Select Product" app bar button
## APIs and extension points used
### "PosApi/Create/Dialogs"
- ExtensionTemplatedDialogBase: The base class for all dialogs created by extensions.
- openDialog: This protected method on the ExtensionTemplatedDialogBase class opens the dialog.
- closeDialog: This protected method on the ExtensionTemplatedDialogBase class closes the dialog.
- onReady: The onReady function is called after the extension dialog element has been added to the DOM and is ready to be used.
- onBarcodeScanned: Setting the onBarcodeScanned event handler on the extension templated dialog in the constructor enables the dialog to handle barcode scanner events.
- onMsrSwiped: Setting the onMsrSwiped event handler on the extension templated dialog in the constructor enables the dialog to handle MSR events.
### "PosApi/Consume/Controls"
- IControlFactory: The interface representing the POS control factory. The control factory instance is provided to extensions in the ExtensionContext.
- Used by the BarcodeMsrDialog to create and display an alphanumeric numpad.
- IAlphanumericNumpad: The interface for the POS Number pad control that accepts alphanumeric input.
- addEventListener: Used to add event listeners for the events listed below. Adding event listeners allows the extension to know when the number pad has updated or received input from the user.
- "EnterPressed": Event raised when the number pad enter button was pressed.
- "ValueChanged": Event raised when the number pad value has been updated.
### "PosApi/Consume/Dialogs"
- ShowMessageDialogClientRequest/ShowMessageDialogClientResponse: This API is used to show a message in POS and in this sample it is used to display an error message.
### "PosApi/Consume/ScanResults"
- GetScanResultClientRequest/GetScanResultClientResponse: This API is used to get the scan result information for the specified barcode scan text. A scan result can contain a product, customer, loyalty card or gift card entity.
### "PosApi/Extend/Views/FulfillmentLine"
- FulfillmentLineExtensionCommandBase: The base class for all extension commands for the fulfillment line view.
- fulfillmentLinesSelectionHandler: Setting the fulfillmentLinesSelectionHandler event handler enables the extension command to update when a fulfillment line is selected.
- fulfillmentLinesSelectionClearedHandler: Setting the fulfillmentLinesSelectionClearedHandler event handler enables the extension command to update when the fulfillment line selection is cleared.
- packingSlipSelectedHandler: Setting the packingSlipSelectedHandler event handler enables the extension command to update when a packing slip is selected.
- packingSlipSelectionClearedHandler: Setting the packingSlipSelectionClearedHandler event handler enables the extension command to update when the packing slip selection is cleared.
## Additional Resources
- [Debugging POS Extensions](https://docs.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/debug-pos-extension#run-and-debug-cloud-pos)
- [Using POS Controls](https://docs.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/controls-pos-extension) | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/BarcodeMsrDialog/BarcodeMsrDialog.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionTemplatedDialogBase, ITemplatedDialogOptions } from "PosApi/Create/Dialogs";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ClientEntities } from "PosApi/Entities";
import { BarcodeMsrDialogInputType, IBarcodeMsrDialogResult } from "./BarcodeMsrDialogTypes";
import { IAlphanumericNumPad, IAlphanumericNumPadOptions } from "PosApi/Consume/Controls";
type BarcodeMsrDialogResolveFunction = (value: IBarcodeMsrDialogResult) => void;
type BarcodeMsrDialogRejectFunction = (reason: any) => void;
export default class BarcodeMsrDialog extends ExtensionTemplatedDialogBase {
public numPad: IAlphanumericNumPad;
private resolve: BarcodeMsrDialogResolveFunction;
private _inputType: BarcodeMsrDialogInputType;
private _automatedEntryInProgress: boolean;
constructor() {
super();
this._inputType = "None";
this._automatedEntryInProgress = false;
// Set the onBarcodeScanned property to enable the barcode scanner in a templated dialog.
this.onBarcodeScanned = (data: string): void => {
this._automatedEntryInProgress = true;
this.numPad.value = data;
this._inputType = "Barcode";
this._automatedEntryInProgress = false;
};
// Set the onMsrSwiped property to handle MSR swipe events in a templated dialog.
this.onMsrSwiped = (data: ClientEntities.ICardInfo): void => {
this._automatedEntryInProgress = true;
this.numPad.value = data.CardNumber;
this._inputType = "MSR";
this._automatedEntryInProgress = false;
};
}
/**
* The function that is called when the dialog element is ready.
* @param {HTMLElement} element The element containing the dialog.
*/
public onReady(element: HTMLElement): void {
let numPadOptions: IAlphanumericNumPadOptions = {
globalInputBroker: this.numPadInputBroker,
label: "Please enter a value, scan or swipe:",
value: ""
};
let numPadRootElem: HTMLDivElement = element.querySelector("#barcodeMsrDialogAlphanumericNumPad") as HTMLDivElement;
this.numPad = this.context.controlFactory.create(this.context.logger.getNewCorrelationId(), "AlphanumericNumPad", numPadOptions, numPadRootElem);
this.numPad.addEventListener("EnterPressed", (eventData: { value: Commerce.Extensibility.NumPadValue }) => {
this._resolvePromise({ canceled: false, inputType: this._inputType, value: eventData.value.toString() });
});
this.numPad.addEventListener("ValueChanged", (eventData: { value: string }) => {
if (!this._automatedEntryInProgress) {
this._inputType = "Manual";
}
});
}
/**
* Opens the dialog.
* @returns {Promise<IBarcodeMsrDialogResult>} The promise that represents showing the dialog and contains the dialog result.
*/
public open(): Promise<IBarcodeMsrDialogResult> {
let promise: Promise<IBarcodeMsrDialogResult> = new Promise((resolve: BarcodeMsrDialogResolveFunction, reject: BarcodeMsrDialogRejectFunction) => {
this.resolve = resolve;
let option: ITemplatedDialogOptions = {
title: "Barcode Scanner and MSR Swipe Dialog",
onCloseX: this._cancelButtonClickHandler.bind(this)
};
this.openDialog(option);
});
return promise;
}
/**
* Handles the cancel button click.
* @returns {boolean} True if the dialog should close. False otherwise.
*/
private _cancelButtonClickHandler(): boolean {
this._resolvePromise({ canceled: true });
return false;
}
/**
* Results the dialog promise with the specified result.
* @param {IBarcodeMsrDialogResult} result The result with which the dialog promise should be resolved.
*/
private _resolvePromise(result: IBarcodeMsrDialogResult): void {
if (ObjectExtensions.isFunction(this.resolve)) {
this.resolve(result);
this.resolve = null;
this.closeDialog();
}
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/BarcodeMsrDialog/BarcodeMsrDialog.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Barcode-MSR Dialog</title>
</head>
<body>
<!-- HTMLLint Disable LabelExistsValidator -->
<div class="sampleExtension_barcodeMsrDialogSample col grow">
<div class="grow"></div>
<div class="col">
<div id="barcodeMsrDialogAlphanumericNumPad"></div>
</div>
</div>
</body>
</html> | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Dialogs/BarcodeMsrDialog/BarcodeMsrDialogTypes.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
export type BarcodeMsrDialogInputType = "None" | "Manual" | "Barcode" | "MSR";
export interface IBarcodeMsrDialogResult {
canceled: boolean;
inputType?: BarcodeMsrDialogInputType;
value?: string;
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Helpers/PaymentTerminalExecuteTaskRequestFactory.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { PaymentTerminalExecuteTaskRequest, PaymentTerminalExecuteTaskResponse } from "PosApi/Consume/Peripherals";
import { ProxyEntities } from "PosApi/Entities";
/**
* (Sample) Creation of PaymentTerminalExecuteTaskRequest.
*/
export default class PaymentTerminalExecuteTaskRequestFactory {
/**
* Creates a PaymentTerminalExecuteTaskRequest based on the task and cart information.
* @param {string} task The PaymentTerminalExecuteTaskRequest task.
* @param {ProxyEntities.Cart} cart The ProxyEntities.Cart.
* @returns {PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>} The PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>
*/
public static createPaymentTerminalExecuteTaskRequest(task: string, cart: ProxyEntities.Cart): PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse> {
var request: PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>;
if (task === "getconfirmation") {
request = new PaymentTerminalExecuteTaskRequest(
"getconfirmation",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "Testing confirmation task, l1"} },
{ Key: "Contents", Value: { StringValue: cart.Comment ?? "Some contents, l2" } },
{ Key: "LeftButton", Value: { StringValue: "Cancel" } },
{ Key: "RightButton", Value: { StringValue: "Ok" } }
]
},
undefined,
180);
} else if (task === "getsignature") {
request = new PaymentTerminalExecuteTaskRequest(
"getsignature",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "Please sign for delivery" } },
{ Key: "Contents", Value: { StringValue: "" } },
]
},
undefined,
180);
} else if (task === "menubuttons") {
request = new PaymentTerminalExecuteTaskRequest(
"menubuttons",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "Which city is in the USA?" } },
{ Key: "Contents", Value: { StringValue: "Please choose a single answer." } },
{ Key: "MenuEntry1", Value: { StringValue: "New York" } },
{ Key: "MenuEntry2", Value: { StringValue: "Paris" } },
{ Key: "MenuEntry3", Value: { StringValue: "Beijing" } },
{ Key: "MenuEntry4", Value: { StringValue: "Tokyo" } },
]
},
undefined,
180);
} else if (task === "getdigit") {
request = new PaymentTerminalExecuteTaskRequest(
"getdigit",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "GetDigit" } },
{ Key: "Contents", Value: { StringValue: "Enter your zip code" } },
]
},
undefined,
180);
} else if (task === "getamount") {
request = new PaymentTerminalExecuteTaskRequest(
"getamount",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "GetAmount" } },
{ Key: "Contents", Value: { StringValue: "Enter amount" } },
]
},
undefined,
180);
} else if (task === "getphonenumber") {
request = new PaymentTerminalExecuteTaskRequest(
"getphonenumber",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "GetPhoneNumber" } },
{ Key: "Contents", Value: { StringValue: "Enter your phone number" } },
]
},
undefined,
180);
} else if (task === "gettext") {
request = new PaymentTerminalExecuteTaskRequest(
"gettext",
{
ExtensionProperties: [
{ Key: "Header", Value: { StringValue: "GetText" } },
{ Key: "Contents", Value: { StringValue: "Enter your email address" } },
]
},
undefined,
180);
} else {
throw new Error("Unsupported task: " + task);
}
return request;
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/CheckGiftCardBalance/CheckGiftCardBalanceFactory.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionOperationRequestFactoryFunctionType, IOperationContext } from "PosApi/Create/Operations";
import { ClientEntities } from "PosApi/Entities";
import CheckGiftCardBalanceRequest from "./CheckGiftCardBalanceRequest";
import CheckGiftCardBalanceResponse from "./CheckGiftCardBalanceResponse";
let getOperationRequest: ExtensionOperationRequestFactoryFunctionType<CheckGiftCardBalanceResponse> =
/**
* Gets an instance of CheckGiftCardBalanceRequest.
* @param {number} operationId The operation Id.
* @param {string[]} actionParameters The action parameters.
* @param {string} correlationId A telemetry correlation ID, used to group events logged from this request together with the calling context.
* @return {CheckGiftCardBalanceRequest<TResponse>} Instance of CheckGiftCardBalanceRequest.
*/
function (
context: IOperationContext,
operationId: number,
actionParameters: string[],
correlationId: string
): Promise<ClientEntities.ICancelableDataResult<CheckGiftCardBalanceRequest<CheckGiftCardBalanceResponse>>> {
let operationRequest: CheckGiftCardBalanceRequest<CheckGiftCardBalanceResponse> =
new CheckGiftCardBalanceRequest<CheckGiftCardBalanceResponse>(correlationId);
return Promise.resolve(<ClientEntities.ICancelableDataResult<CheckGiftCardBalanceRequest<CheckGiftCardBalanceResponse>>>{
canceled: false,
data: operationRequest
});
};
export default getOperationRequest; | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/CheckGiftCardBalance/CheckGiftCardBalanceHandler.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionOperationRequestType, ExtensionOperationRequestHandlerBase } from "PosApi/Create/Operations";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import CheckGiftCardBalanceRequest from "./CheckGiftCardBalanceRequest";
import CheckGiftCardBalanceResponse from "./CheckGiftCardBalanceResponse";
import GiftCardBalanceDialog from "../../Dialogs/GiftCardBalanceDialog/GiftCardBalanceDialog";
import GiftCardNumberDialog from "../../Dialogs/GiftCardNumberDialog";
/**
* (Sample) Request handler for the CheckGiftCardBalanceRequest class.
*/
export default class CheckGiftCardBalanceHandler<TResponse extends CheckGiftCardBalanceResponse> extends ExtensionOperationRequestHandlerBase<TResponse> {
/**
* Gets the supported request type.
* @return {RequestType<TResponse>} The supported request type.
*/
public supportedRequestType(): ExtensionOperationRequestType<TResponse> {
return CheckGiftCardBalanceRequest;
}
/**
* Executes the request handler asynchronously.
* @param {CheckGiftCardBalanceRequest<TResponse>} request The request.
* @return {Promise<ICancelableDataResult<TResponse>>} The cancelable async result containing the response.
*/
public executeAsync(request: CheckGiftCardBalanceRequest<TResponse>): Promise<ClientEntities.ICancelableDataResult<TResponse>> {
this.context.logger.logInformational("Log message from CheckGiftCardBalanceHandler executeAsync().", this.context.logger.getNewCorrelationId());
let giftCardNumberDialog: GiftCardNumberDialog = new GiftCardNumberDialog();
return giftCardNumberDialog.show(this.context, request.correlationId).then((result: ClientEntities.ICancelableDataResult<ProxyEntities.GiftCard>)
: Promise<ClientEntities.ICancelableDataResult<TResponse>> => {
if (result.canceled) {
return Promise.resolve({ canceled: true, data: null });
}
let giftCardBalanceDialog: GiftCardBalanceDialog = new GiftCardBalanceDialog();
return giftCardBalanceDialog.open(result.data).then(() => {
return Promise.resolve({ canceled: false, data: <TResponse>new CheckGiftCardBalanceResponse() });
});
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/CheckGiftCardBalance/CheckGiftCardBalanceResponse.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { Response } from "PosApi/Create/RequestHandlers";
/**
* (Sample) Operation response for check gift card balance operation.
*/
export default class CheckGiftCardBalanceResponse extends Response {
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/CheckGiftCardBalance/CheckGiftCardBalanceRequest.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionOperationRequestBase } from "PosApi/Create/Operations";
import CheckGiftCardBalanceResponse from "./CheckGiftCardBalanceResponse";
/**
* (Sample) Operation request for check gift card balance operation.
*/
export default class CheckGiftCardBalanceRequest<TResponse extends CheckGiftCardBalanceResponse> extends ExtensionOperationRequestBase<TResponse> {
constructor(correlationId: string) {
super(5002 /* operationId */, correlationId);
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/EndOfDay/EndOfDayOperationResponse.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { Response } from "PosApi/Create/RequestHandlers";
/**
* (Sample) Operation response of executing end of day operations.
*/
export default class EndOfDayOperationResponse extends Response { } | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/EndOfDay/EndOfDayOperationRequestHandler.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionOperationRequestType, ExtensionOperationRequestHandlerBase } from "PosApi/Create/Operations";
import { CloseShiftOperationRequest, CloseShiftOperationResponse } from "PosApi/Consume/Shifts";
import { SafeDropOperationRequest, SafeDropOperationResponse } from "PosApi/Consume/StoreOperations";
import { TenderDeclarationOperationRequest, TenderDeclarationOperationResponse } from "PosApi/Consume/StoreOperations";
import { TenderRemovalOperationRequest, TenderRemovalOperationResponse } from "PosApi/Consume/StoreOperations";
import { ClientEntities } from "PosApi/Entities";
import EndOfDayOperationResponse from "./EndOfDayOperationResponse";
import EndOfDayOperationRequest from "./EndOfDayOperationRequest";
/**
* (Sample) Request handler for the EndOfDayOperationRequest class.
*/
export default class EndOfDayOperationRequestHandler extends ExtensionOperationRequestHandlerBase<EndOfDayOperationResponse> {
/**
* Gets the supported request type.
* @return {RequestType<TResponse>} The supported request type.
*/
public supportedRequestType(): ExtensionOperationRequestType<EndOfDayOperationResponse> {
return EndOfDayOperationRequest;
}
/**
* Executes the request handler asynchronously.
* @param {EndOfDayOperationRequest<TResponse>} request The request.
* @return {Promise<ICancelableDataResult<TResponse>>} The cancelable async result containing the response.
*/
public executeAsync(printRequest: EndOfDayOperationRequest<EndOfDayOperationResponse>): Promise<ClientEntities.ICancelableDataResult<EndOfDayOperationResponse>> {
this.context.logger.logInformational("Log message from PrintOperationRequestHandler executeAsync().", this.context.logger.getNewCorrelationId());
// Tender Removal
let tenderRemovalRequest: TenderRemovalOperationRequest<TenderRemovalOperationResponse> =
new TenderRemovalOperationRequest(this.context.logger.getNewCorrelationId());
return this.context.runtime.executeAsync(tenderRemovalRequest).then((result: ClientEntities.ICancelableDataResult<TenderRemovalOperationResponse>)
: Promise<ClientEntities.ICancelableDataResult<SafeDropOperationResponse>> => {
// Safe Drop
if (!result.canceled) {
let safeDropRequest: SafeDropOperationRequest<SafeDropOperationResponse> =
new SafeDropOperationRequest(this.context.logger.getNewCorrelationId());
return this.context.runtime.executeAsync(safeDropRequest);
} else {
return Promise.resolve({
canceled: true,
data: null
});
}
}).then((result: Commerce.Client.Entities.ICancelableDataResult<SafeDropOperationResponse>)
: Promise<ClientEntities.ICancelableDataResult<TenderDeclarationOperationResponse>> => {
// Tender Declaration
if (!result.canceled) {
let tenderDeclarationRequest: TenderDeclarationOperationRequest<TenderDeclarationOperationResponse> =
new TenderDeclarationOperationRequest(this.context.logger.getNewCorrelationId());
return this.context.runtime.executeAsync(tenderDeclarationRequest);
} else {
return Promise.resolve({
canceled: true,
data: null
});
}
}).then((result: ClientEntities.ICancelableDataResult<TenderDeclarationOperationResponse>)
: Promise<ClientEntities.ICancelableDataResult<CloseShiftOperationResponse>> => {
// Close Shift
if (!result.canceled) {
return new Promise(
(resolve: (value?: ClientEntities.ICancelableDataResult<CloseShiftOperationResponse>) => void, reject: (reason?: any) => void) => {
// A delay of ten seconds is added here as a work-around for issues with printing a second receipt to the windows driver
// printer before the first dialog is closed. A ten second delay gives the user a chance to close the first dialog before
// the issue occurs.
setTimeout(() => { resolve(null); }, 10000);
}).then(() => {
let closeShiftOperationRequest: CloseShiftOperationRequest<CloseShiftOperationResponse> =
new CloseShiftOperationRequest(this.context.logger.getNewCorrelationId());
return this.context.runtime.executeAsync(closeShiftOperationRequest);
});
} else {
return Promise.resolve({
canceled: true,
data: null
});
}
}).then((result: ClientEntities.ICancelableDataResult<CloseShiftOperationResponse>)
: ClientEntities.ICancelableDataResult<EndOfDayOperationResponse> => {
return <ClientEntities.ICancelableDataResult<EndOfDayOperationResponse>>{
canceled: result.canceled,
data: result.canceled ? null : new EndOfDayOperationResponse()
};
});
}
} | 0 |
Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations | Dynamics365Commerce.InStore/Dynamics365Commerce.InStore/src/StoreCommerceSamples/PosExtensionSamples/Pos/Create/Operations/EndOfDay/EndOfDayOperationRequest.ts | /**
* SAMPLE CODE NOTICE
*
* THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED. YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/
import { ExtensionOperationRequestBase } from "PosApi/Create/Operations";
import EndOfDayOperationResponse from "./EndOfDayOperationResponse";
/**
* (Sample) Operation request for executing end of day operations.
*/
export default class EndOfDayOperationRequest<TResponse extends EndOfDayOperationResponse> extends ExtensionOperationRequestBase<TResponse> {
constructor(correlationId: string) {
super(5001, correlationId);
}
} | 0 |
Subsets and Splits